diff --git a/Aurora.gtk/Aurora.gtk.csproj b/Aurora.gtk/Aurora.gtk.csproj
index 34acb22..d80583a 100644
--- a/Aurora.gtk/Aurora.gtk.csproj
+++ b/Aurora.gtk/Aurora.gtk.csproj
@@ -150,7 +150,7 @@
..\packages\System.Threading.Tasks.Extensions.4.5.2\lib\netstandard2.0\System.Threading.Tasks.Extensions.dll
- ..\packages\Microsoft.Bcl.AsyncInterfaces.1.0.0\lib\net461\Microsoft.Bcl.AsyncInterfaces.dll
+ ..\packages\Microsoft.Bcl.AsyncInterfaces.1.1.0\lib\net461\Microsoft.Bcl.AsyncInterfaces.dll
..\packages\System.Linq.Async.4.0.0\lib\net461\System.Linq.Async.dll
@@ -164,6 +164,10 @@
..\packages\CarouselView.FormsPlugin.5.2.0\lib\netstandard2.0\CarouselView.FormsPlugin.Abstractions.dll
+
+ ..\packages\Autofac.5.0.0\lib\net461\Autofac.dll
+
+
diff --git a/Aurora.gtk/packages.config b/Aurora.gtk/packages.config
index 652707f..45a8c07 100644
--- a/Aurora.gtk/packages.config
+++ b/Aurora.gtk/packages.config
@@ -1,5 +1,6 @@
+
@@ -13,7 +14,7 @@
-
+
diff --git a/Aurora.sln b/Aurora.sln
index 59160f4..2140969 100644
--- a/Aurora.sln
+++ b/Aurora.sln
@@ -5,6 +5,8 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Aurora", "Aurora\Aurora.csp
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Aurora.gtk", "Aurora.gtk\Aurora.gtk.csproj", "{E8C8C24A-5C51-47CB-B241-F5A9F0E808B1}"
EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Aurora.test", "Aurora.test\Aurora.test.csproj", "{45680D8A-1AF1-4D93-AAC0-59CDB01CED5D}"
+EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|iPhoneSimulator = Debug|iPhoneSimulator
@@ -39,5 +41,17 @@ Global
{E8C8C24A-5C51-47CB-B241-F5A9F0E808B1}.Debug|Any CPU.Build.0 = Debug|iPhoneSimulator
{E8C8C24A-5C51-47CB-B241-F5A9F0E808B1}.Release|Any CPU.ActiveCfg = Release|iPhoneSimulator
{E8C8C24A-5C51-47CB-B241-F5A9F0E808B1}.Release|Any CPU.Build.0 = Release|iPhoneSimulator
+ {45680D8A-1AF1-4D93-AAC0-59CDB01CED5D}.Debug|iPhoneSimulator.ActiveCfg = Debug|Any CPU
+ {45680D8A-1AF1-4D93-AAC0-59CDB01CED5D}.Debug|iPhoneSimulator.Build.0 = Debug|Any CPU
+ {45680D8A-1AF1-4D93-AAC0-59CDB01CED5D}.Release|iPhoneSimulator.ActiveCfg = Release|Any CPU
+ {45680D8A-1AF1-4D93-AAC0-59CDB01CED5D}.Release|iPhoneSimulator.Build.0 = Release|Any CPU
+ {45680D8A-1AF1-4D93-AAC0-59CDB01CED5D}.Debug|iPhone.ActiveCfg = Debug|Any CPU
+ {45680D8A-1AF1-4D93-AAC0-59CDB01CED5D}.Debug|iPhone.Build.0 = Debug|Any CPU
+ {45680D8A-1AF1-4D93-AAC0-59CDB01CED5D}.Release|iPhone.ActiveCfg = Release|Any CPU
+ {45680D8A-1AF1-4D93-AAC0-59CDB01CED5D}.Release|iPhone.Build.0 = Release|Any CPU
+ {45680D8A-1AF1-4D93-AAC0-59CDB01CED5D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {45680D8A-1AF1-4D93-AAC0-59CDB01CED5D}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {45680D8A-1AF1-4D93-AAC0-59CDB01CED5D}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {45680D8A-1AF1-4D93-AAC0-59CDB01CED5D}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
EndGlobal
diff --git a/Aurora.test/Aurora.test.csproj b/Aurora.test/Aurora.test.csproj
new file mode 100644
index 0000000..6c6b85c
--- /dev/null
+++ b/Aurora.test/Aurora.test.csproj
@@ -0,0 +1,117 @@
+
+
+ netcoreapp3.0
+ false
+
+
+
+
+
+
+
+ runtime; build; native; contentfiles; analyzers; buildtransitive
+ all
+
+
+
+
+
+
+
+
+
+
+
+
+
+ PreserveNewest
+
+
+ PreserveNewest
+
+
+ PreserveNewest
+
+
+ PreserveNewest
+
+
+ PreserveNewest
+
+
+ PreserveNewest
+
+
+ PreserveNewest
+
+
+ PreserveNewest
+
+
+ PreserveNewest
+
+
+ PreserveNewest
+
+
+ PreserveNewest
+
+
+ PreserveNewest
+
+
+ PreserveNewest
+
+
+ PreserveNewest
+
+
+ PreserveNewest
+
+
+ PreserveNewest
+
+
+ PreserveNewest
+
+
+ PreserveNewest
+
+
+ PreserveNewest
+
+
+ PreserveNewest
+
+
+ PreserveNewest
+
+
+ PreserveNewest
+
+
+ PreserveNewest
+
+
+ PreserveNewest
+
+
+ PreserveNewest
+
+
+ PreserveNewest
+
+
+ PreserveNewest
+
+
+ PreserveNewest
+
+
+ PreserveNewest
+
+
+ PreserveNewest
+
+
+
\ No newline at end of file
diff --git a/Aurora.test/ControllerTests/EventTests.cs b/Aurora.test/ControllerTests/EventTests.cs
new file mode 100644
index 0000000..513331c
--- /dev/null
+++ b/Aurora.test/ControllerTests/EventTests.cs
@@ -0,0 +1,100 @@
+
+using NUnit.Framework;
+using Aurora.Proto.Party;
+using Aurora.Services.Server;
+using Aurora.Services.EventManager;
+using Grpc.Core;
+using System.Threading.Tasks;
+using System.Threading;
+using Autofac;
+namespace Aurora.test.ControllerTests
+{
+ public class EventTest
+ {
+ private RemotePartyService.RemotePartyServiceClient _remotePartyService;
+ private Channel _channel;
+ private IContainer _container;
+ private IServerService _serverService;
+
+ #region Setup
+ [SetUp]
+ public void Setup()
+ {
+ _container = SetupUtil.SetupOneTime();
+ _remotePartyService = SetupUtil.Setup(ref _container, ref _serverService, ref _channel);
+ }
+
+ [TearDown]
+ public async Task TearDown()
+ {
+ await _serverService.Stop();
+ await _channel.ShutdownAsync();
+ _container.Dispose();
+ }
+ #endregion Setup
+ [Test]
+ [TestCase(EventType.MediaPlaying)]
+ public void Asdf(EventType value)
+ {
+ Assert.AreEqual(1, 1);
+ }
+
+ [Test]
+ [TestCase(EventType.MediaPlaying)]
+ [TestCase(EventType.MediaStopped)]
+ [TestCase(EventType.MemberCreated)]
+ [TestCase(EventType.MemberDeleted)]
+ public async Task TestEventSubscriptions(EventType value)
+ {
+ using (var scope = _container.BeginLifetimeScope())
+ {
+ IEventManager eventManager = scope.Resolve();
+
+ //Create new party member
+ Member member = _remotePartyService.CreateMember(new CreateMemberRequest()
+ {
+ Parent = "party1",
+ Member = new Member()
+ {
+ UserName = "newMember1",
+ IpAddress = ServerService.GetLocalIPAddress(),
+ }
+ });
+
+ //Subscribe to event type
+ _remotePartyService.CreateEventSubscription(new CreateEventSubscriptionRequest()
+ {
+ Parent = member.Name,
+ EventSubscription = new EventSubscription()
+ {
+ Type = value
+ }
+ });
+
+ BaseEvent @event = new BaseEvent
+ {
+ EventType = value,
+ };
+ //Fire event
+
+ CancellationTokenSource eventCancellationTokenSource = new CancellationTokenSource();
+ BaseEvent newEvent = null;
+
+ Task.Run(async () => { await Task.Delay(1000); eventManager.FireEvent(@event); });
+
+ using (AsyncServerStreamingCall eventStream = _remotePartyService
+ .GetEvents(new GetEventsRequest() { Parent = member.Name }))
+ {
+ while ((!eventCancellationTokenSource.Token.IsCancellationRequested &&
+ await eventStream.ResponseStream.MoveNext(eventCancellationTokenSource.Token)))
+ {
+ newEvent = new BaseEvent(eventStream.ResponseStream.Current);
+ break;
+ }
+ };
+
+ Assert.AreEqual(newEvent.EventType, value);
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/Aurora.test/ControllerTests/MediaControllerTest.cs b/Aurora.test/ControllerTests/MediaControllerTest.cs
new file mode 100644
index 0000000..cf9e4ba
--- /dev/null
+++ b/Aurora.test/ControllerTests/MediaControllerTest.cs
@@ -0,0 +1,78 @@
+using NUnit.Framework;
+using Aurora.Proto.Party;
+using Aurora.Services.Server;
+using Grpc.Core;
+using System.Threading.Tasks;
+using System.Linq;
+using System.IO;
+using Autofac;
+
+namespace Aurora.test.ControllerTests
+{
+ public class MediaControllerTests
+ {
+ private RemotePartyService.RemotePartyServiceClient _remotePartyService;
+ private Channel _channel;
+ private IContainer _container;
+ private IServerService _serverService;
+
+ #region Setup
+ [OneTimeSetUp]
+ public void SetupOneTime()
+ {
+ _container = SetupUtil.SetupOneTime();
+ }
+
+ [OneTimeTearDown]
+ public void TearDownOneTime()
+ {
+ _container.Dispose();
+ }
+
+ [SetUp]
+ public void Setup()
+ {
+ _remotePartyService = SetupUtil.Setup(ref _container, ref _serverService, ref _channel);
+ }
+
+ [TearDown]
+ public async Task TearDown()
+ {
+ await _serverService.Stop();
+ await _channel.ShutdownAsync();
+ }
+ #endregion Setup
+
+ [Test]
+ public void TestNotEmpty()
+ {
+ ListMediaResponse resp = _remotePartyService.ListMedia(new ListMediaRequest()
+ {
+ Parent = "testParty",
+ PageSize = 5
+ });
+
+ Assert.NotNull(resp.Media);
+ Assert.NotZero(resp.Media.Count);
+ Assert.AreEqual(resp.Media.Count, 5);
+ }
+
+ [Test]
+ public void GetMediaTest()
+ {
+ ListMediaResponse resp = _remotePartyService.ListMedia(new ListMediaRequest()
+ {
+ Parent = "testParty",
+ PageSize = 5
+ });
+
+ Media media = _remotePartyService.GetMedia(new GetMediaRequest()
+ {
+ Name = resp.Media[0].Name
+ });
+
+ Assert.NotNull(media);
+ Assert.AreEqual(media.Name, resp.Media[0].Name);
+ }
+ }
+}
\ No newline at end of file
diff --git a/Aurora.test/ControllerTests/MembersControllerTest.cs b/Aurora.test/ControllerTests/MembersControllerTest.cs
new file mode 100644
index 0000000..212ffc2
--- /dev/null
+++ b/Aurora.test/ControllerTests/MembersControllerTest.cs
@@ -0,0 +1,206 @@
+using NUnit.Framework;
+using Aurora.Proto.Party;
+using Aurora.Services.Server;
+using Grpc.Core;
+using System.Threading.Tasks;
+using System.Linq;
+using Autofac;
+
+namespace Aurora.test.ControllerTests
+{
+ public class MemberControllerTests
+ {
+ private RemotePartyService.RemotePartyServiceClient _remotePartyService;
+ private Channel _channel;
+
+ private IContainer _container;
+ private IServerService _serverService;
+
+ #region Setup
+ [OneTimeSetUp]
+ public void SetupOneTime()
+ {
+ _container = SetupUtil.SetupOneTime();
+ }
+
+ [OneTimeTearDown]
+ public void TearDownOneTime()
+ {
+ _container.Dispose();
+ }
+
+ [SetUp]
+ public void Setup()
+ {
+ _remotePartyService = SetupUtil.Setup(ref _container, ref _serverService, ref _channel);
+ }
+
+ [TearDown]
+ public async Task TearDown()
+ {
+ await _serverService.Stop();
+ await _channel.ShutdownAsync();
+ }
+ #endregion Setup
+
+
+ [Test]
+ public void DefaultTest()
+ {
+ ListMembersResponse resp = _remotePartyService.ListMembers(new ListMembersRequest()
+ {
+ Parent = "party1",
+ PageSize = 10,
+ });
+ Assert.NotNull(resp);
+ Assert.GreaterOrEqual(resp.Members.Count, 1);
+ }
+
+ [Test]
+ [TestCase("Alex")]
+ [TestCase("Alex Goldberg")]
+ [TestCase("Alex/goldberg")]
+ [TestCase("alex@welcome.com")]
+ public void CreateMemberTest(string value)
+ {
+ Member member = _remotePartyService.CreateMember(new CreateMemberRequest()
+ {
+ Parent = "party1",
+ Member = new Member()
+ {
+ UserName = value,
+ IpAddress = ServerService.GetLocalIPAddress(),
+ }
+ });
+
+ Assert.NotNull(member);
+ }
+
+ static object[] MultipleMembersCases =
+ {
+ new object[] {"Tupac", "Aubrey Grahm", "Beyonce Knowls", "Ke$ha", "A$ap Ferg"},
+ };
+
+ [Test]
+ [TestCaseSource("MultipleMembersCases")]
+ public void CreateMultiplMembersTest(object[] memberNames)
+ {
+ //Add members
+ foreach (string name in memberNames)
+ {
+ Member member = _remotePartyService.CreateMember(new CreateMemberRequest()
+ {
+ Parent = "party1",
+ Member = new Member()
+ {
+ UserName = name
+ }
+ });
+
+ Assert.NotNull(member);
+ }
+
+ //List members
+ ListMembersResponse resp = _remotePartyService.ListMembers(new ListMembersRequest()
+ {
+ Parent = "party1",
+ PageSize = 10,
+ });
+ Assert.NotNull(resp);
+ Assert.AreEqual(resp.Members.Count, 6);
+ }
+
+ [Test]
+ [TestCaseSource("MultipleMembersCases")]
+ public void DeleteMemberTest(object[] memberNames)
+ {
+ //Add members
+ foreach (string name in memberNames)
+ {
+ Member member = _remotePartyService.CreateMember(new CreateMemberRequest()
+ {
+ Parent = "party1",
+ Member = new Member()
+ {
+ UserName = name
+ }
+ });
+
+ Assert.NotNull(member);
+ }
+
+ //List members
+ ListMembersResponse resp = _remotePartyService.ListMembers(new ListMembersRequest()
+ {
+ Parent = "party1",
+ PageSize = 10,
+ });
+ Assert.NotNull(resp);
+ Assert.AreEqual(resp.Members.Count, 6);
+
+ string keshaResourceName = resp.Members.First(member => member.UserName == "Ke$ha").Name;
+
+ //Delete member
+
+ _remotePartyService.DeleteMember(new DeleteMemberRequest()
+ {
+ Name = keshaResourceName
+ });
+
+ //List members
+ resp = _remotePartyService.ListMembers(new ListMembersRequest()
+ {
+ Parent = "party1",
+ PageSize = 10,
+ });
+ Assert.NotNull(resp);
+ Assert.AreEqual(resp.Members.Count, 5);
+ Assert.False(resp.Members.Any(member => member.UserName == "Ke$sha"));
+ }
+
+ static object[] PagingCases =
+ {
+ new object[] {"Tupac", "Aubrey Grahm", "Beyonce Knowls", "Ke$ha", "A$ap Ferg", "asdf", "sdfa", "dfas", "fasd"},
+ };
+
+ [Test]
+ [TestCaseSource("PagingCases")]
+ public void MemberPagingTest(object[] members)
+ {
+ foreach (string name in members)
+ {
+ Member member = _remotePartyService.CreateMember(new CreateMemberRequest()
+ {
+ Parent = "party1",
+ Member = new Member()
+ {
+ UserName = name
+ }
+ });
+
+ Assert.NotNull(member);
+ }
+
+ //List members
+ ListMembersResponse resp = _remotePartyService.ListMembers(new ListMembersRequest()
+ {
+ Parent = "party1",
+ PageSize = 2,
+ });
+
+ string nextPageToken = resp.NextPageToken;
+
+ Assert.AreEqual(resp.Members.Count, 2);
+
+ //List members
+ resp = _remotePartyService.ListMembers(new ListMembersRequest()
+ {
+ Parent = "party1",
+ PageSize = 2,
+ PageToken = nextPageToken,
+ });
+
+ Assert.AreEqual(resp.Members.Count, 2);
+ }
+ }
+}
\ No newline at end of file
diff --git a/Aurora.test/ControllerTests/PartyControllerTest.cs b/Aurora.test/ControllerTests/PartyControllerTest.cs
new file mode 100644
index 0000000..9c10b8d
--- /dev/null
+++ b/Aurora.test/ControllerTests/PartyControllerTest.cs
@@ -0,0 +1,53 @@
+using System.Threading.Tasks;
+using NUnit.Framework;
+using Aurora.Proto.Party;
+using Aurora.Services.Server;
+using Grpc.Core;
+using Autofac;
+
+namespace Aurora.test.ControllerTests
+{
+ public class PartyControllerTests
+ {
+ private RemotePartyService.RemotePartyServiceClient _remotePartyService;
+ private Channel _channel;
+ private IContainer _container;
+ private IServerService _serverService;
+
+ #region Setup
+ [OneTimeSetUp]
+ public void SetupOneTime()
+ {
+ _container = SetupUtil.SetupOneTime();
+ }
+
+ [OneTimeTearDown]
+ public void TearDownOneTime()
+ {
+ _container.Dispose();
+ }
+
+ [SetUp]
+ public void Setup()
+ {
+ _remotePartyService = SetupUtil.Setup(ref _container, ref _serverService, ref _channel);
+ }
+
+ [TearDown]
+ public async Task TearDown()
+ {
+ await _serverService.Stop();
+ await _channel.ShutdownAsync();
+ }
+ #endregion Setup
+
+ [Test]
+ public void DefaultTest()
+ {
+ Party party = _remotePartyService.GetParty(new Proto.General.Empty());
+
+ Assert.NotNull(party);
+ Assert.AreEqual(party.Name, "party/party1");
+ }
+ }
+}
\ No newline at end of file
diff --git a/Aurora.test/ControllerTests/Setup.cs b/Aurora.test/ControllerTests/Setup.cs
new file mode 100644
index 0000000..f011bf7
--- /dev/null
+++ b/Aurora.test/ControllerTests/Setup.cs
@@ -0,0 +1,39 @@
+using Autofac;
+using Aurora.Proto.Party;
+using Aurora.Services.Server;
+using Aurora.Services.Library;
+using Aurora.Services.Settings;
+using Aurora.Services.EventManager;
+using Aurora.test.Models.Mock;
+using System.IO;
+using Grpc.Core;
+
+namespace Aurora.test.ControllerTests
+{
+ public class SetupUtil
+ {
+ public static IContainer SetupOneTime()
+ {
+ ContainerBuilder builder = new ContainerBuilder();
+ builder.RegisterType().As().SingleInstance();
+ builder.RegisterInstance(new SettingsServiceMock()
+ {
+ Username = "Test User 1",
+ DefaultPort = 4005,
+ LibraryLocation = string.Format("{0}/Resources", Directory.GetCurrentDirectory())
+ }).SingleInstance();
+ builder.RegisterType().As().SingleInstance();
+ builder.RegisterType().As().SingleInstance();
+ return builder.Build();
+ }
+
+ public static RemotePartyService.RemotePartyServiceClient Setup(ref IContainer container, ref IServerService serverService, ref Channel channel)
+ {
+ serverService = container.Resolve();
+ serverService.Start("testParty", "asdf");
+ channel = new Channel(string.Format("{0}:{1}", ServerService.GetLocalIPAddress(), 8080), ChannelCredentials.Insecure);
+ return new RemotePartyService.RemotePartyServiceClient(channel);
+ }
+
+ }
+}
\ No newline at end of file
diff --git a/Aurora.test/Models/CallContext.cs b/Aurora.test/Models/CallContext.cs
new file mode 100644
index 0000000..420c245
--- /dev/null
+++ b/Aurora.test/Models/CallContext.cs
@@ -0,0 +1,39 @@
+using System;
+using System.Threading;
+using System.Threading.Tasks;
+using Grpc.Core;
+
+namespace Aurora.test.Models
+{
+ public class CallContext : ServerCallContext
+ {
+ protected override string MethodCore => throw new NotImplementedException();
+
+ protected override string HostCore => throw new NotImplementedException();
+
+ protected override string PeerCore => throw new NotImplementedException();
+
+ protected override DateTime DeadlineCore => throw new NotImplementedException();
+
+ protected override Metadata RequestHeadersCore => throw new NotImplementedException();
+
+ protected override CancellationToken CancellationTokenCore => throw new NotImplementedException();
+
+ protected override Metadata ResponseTrailersCore => throw new NotImplementedException();
+
+ protected override Status StatusCore { get => throw new NotImplementedException(); set => throw new NotImplementedException(); }
+ protected override WriteOptions WriteOptionsCore { get => throw new NotImplementedException(); set => throw new NotImplementedException(); }
+
+ protected override AuthContext AuthContextCore => throw new NotImplementedException();
+
+ protected override ContextPropagationToken CreatePropagationTokenCore(ContextPropagationOptions options)
+ {
+ throw new NotImplementedException();
+ }
+
+ protected override Task WriteResponseHeadersAsyncCore(Metadata responseHeaders)
+ {
+ throw new NotImplementedException();
+ }
+ }
+}
\ No newline at end of file
diff --git a/Aurora.test/Models/Mock/SettingsServiceMock.cs b/Aurora.test/Models/Mock/SettingsServiceMock.cs
new file mode 100644
index 0000000..6126c92
--- /dev/null
+++ b/Aurora.test/Models/Mock/SettingsServiceMock.cs
@@ -0,0 +1,35 @@
+using Aurora.Services.Settings;
+using Plugin.Settings.Abstractions;
+
+namespace Aurora.test.Models.Mock
+{
+ public class SettingsServiceMock : ISettingsService
+ {
+ public SettingsServiceMock()
+ {
+
+ }
+
+ public ISettings AppSettings { get; set; }
+
+ ///
+ /// The user's username. This is persisted.
+ ///
+ ///
+ public string Username { get; set; }
+
+ ///
+ /// The default port to use. This is persisted.
+ ///
+ ///
+ public int DefaultPort { get; set; }
+
+ ///
+ /// The current sessions clientId. This is assigned by the server. This is not persisted.
+ ///
+ ///
+ public string ClientName { get; set; }
+
+ public string LibraryLocation { get; set; }
+ }
+}
\ No newline at end of file
diff --git a/Aurora.test/Resources/Jidenna/The Chief/01 A Bull's Tale.mp3 b/Aurora.test/Resources/Jidenna/The Chief/01 A Bull's Tale.mp3
new file mode 100755
index 0000000..4378585
Binary files /dev/null and b/Aurora.test/Resources/Jidenna/The Chief/01 A Bull's Tale.mp3 differ
diff --git a/Aurora.test/Resources/Jidenna/The Chief/02 Chief Don't Run.mp3 b/Aurora.test/Resources/Jidenna/The Chief/02 Chief Don't Run.mp3
new file mode 100755
index 0000000..dc40b81
Binary files /dev/null and b/Aurora.test/Resources/Jidenna/The Chief/02 Chief Don't Run.mp3 differ
diff --git a/Aurora.test/Resources/Jidenna/The Chief/03 Trampoline.mp3 b/Aurora.test/Resources/Jidenna/The Chief/03 Trampoline.mp3
new file mode 100755
index 0000000..dea9b1f
Binary files /dev/null and b/Aurora.test/Resources/Jidenna/The Chief/03 Trampoline.mp3 differ
diff --git a/Aurora.test/Resources/Jidenna/The Chief/04 Bambi.mp3 b/Aurora.test/Resources/Jidenna/The Chief/04 Bambi.mp3
new file mode 100755
index 0000000..0ea6edd
Binary files /dev/null and b/Aurora.test/Resources/Jidenna/The Chief/04 Bambi.mp3 differ
diff --git a/Aurora.test/Resources/Jidenna/The Chief/05 Helicopters _ Beware.mp3 b/Aurora.test/Resources/Jidenna/The Chief/05 Helicopters _ Beware.mp3
new file mode 100755
index 0000000..457fe3f
Binary files /dev/null and b/Aurora.test/Resources/Jidenna/The Chief/05 Helicopters _ Beware.mp3 differ
diff --git a/Aurora.test/Resources/Jidenna/The Chief/06 Long Live The Chief.mp3 b/Aurora.test/Resources/Jidenna/The Chief/06 Long Live The Chief.mp3
new file mode 100755
index 0000000..04ff67d
Binary files /dev/null and b/Aurora.test/Resources/Jidenna/The Chief/06 Long Live The Chief.mp3 differ
diff --git a/Aurora.test/Resources/Jidenna/The Chief/07 2 Points.mp3 b/Aurora.test/Resources/Jidenna/The Chief/07 2 Points.mp3
new file mode 100755
index 0000000..6501991
Binary files /dev/null and b/Aurora.test/Resources/Jidenna/The Chief/07 2 Points.mp3 differ
diff --git a/Aurora.test/Resources/Jidenna/The Chief/08 The Let Out.mp3 b/Aurora.test/Resources/Jidenna/The Chief/08 The Let Out.mp3
new file mode 100755
index 0000000..9509e2d
Binary files /dev/null and b/Aurora.test/Resources/Jidenna/The Chief/08 The Let Out.mp3 differ
diff --git a/Aurora.test/Resources/Jidenna/The Chief/09 Safari.mp3 b/Aurora.test/Resources/Jidenna/The Chief/09 Safari.mp3
new file mode 100755
index 0000000..64a4e6c
Binary files /dev/null and b/Aurora.test/Resources/Jidenna/The Chief/09 Safari.mp3 differ
diff --git a/Aurora.test/Resources/Jidenna/The Chief/10 Adaora.mp3 b/Aurora.test/Resources/Jidenna/The Chief/10 Adaora.mp3
new file mode 100755
index 0000000..22d0f69
Binary files /dev/null and b/Aurora.test/Resources/Jidenna/The Chief/10 Adaora.mp3 differ
diff --git a/Aurora.test/Resources/Jidenna/The Chief/11 Little Bit More.mp3 b/Aurora.test/Resources/Jidenna/The Chief/11 Little Bit More.mp3
new file mode 100755
index 0000000..7cf9c19
Binary files /dev/null and b/Aurora.test/Resources/Jidenna/The Chief/11 Little Bit More.mp3 differ
diff --git a/Aurora.test/Resources/Jidenna/The Chief/12 Some Kind Of Way.mp3 b/Aurora.test/Resources/Jidenna/The Chief/12 Some Kind Of Way.mp3
new file mode 100755
index 0000000..1b81852
Binary files /dev/null and b/Aurora.test/Resources/Jidenna/The Chief/12 Some Kind Of Way.mp3 differ
diff --git a/Aurora.test/Resources/Jidenna/The Chief/13 White Niggas.mp3 b/Aurora.test/Resources/Jidenna/The Chief/13 White Niggas.mp3
new file mode 100755
index 0000000..ccf5195
Binary files /dev/null and b/Aurora.test/Resources/Jidenna/The Chief/13 White Niggas.mp3 differ
diff --git a/Aurora.test/Resources/Jidenna/The Chief/14 Bully Of The Earth.mp3 b/Aurora.test/Resources/Jidenna/The Chief/14 Bully Of The Earth.mp3
new file mode 100755
index 0000000..784ef6f
Binary files /dev/null and b/Aurora.test/Resources/Jidenna/The Chief/14 Bully Of The Earth.mp3 differ
diff --git a/Aurora.test/Resources/Mac Miller/Best Day Ever/01 Best Day Ever (Prod. By_ ID Labs).m4a b/Aurora.test/Resources/Mac Miller/Best Day Ever/01 Best Day Ever (Prod. By_ ID Labs).m4a
new file mode 100755
index 0000000..5c002a1
Binary files /dev/null and b/Aurora.test/Resources/Mac Miller/Best Day Ever/01 Best Day Ever (Prod. By_ ID Labs).m4a differ
diff --git a/Aurora.test/Resources/Mac Miller/Best Day Ever/02 Get Up (Prod. By_ Teddy Roxpin).m4a b/Aurora.test/Resources/Mac Miller/Best Day Ever/02 Get Up (Prod. By_ Teddy Roxpin).m4a
new file mode 100755
index 0000000..96fbcb3
Binary files /dev/null and b/Aurora.test/Resources/Mac Miller/Best Day Ever/02 Get Up (Prod. By_ Teddy Roxpin).m4a differ
diff --git a/Aurora.test/Resources/Mac Miller/Best Day Ever/03 Donald Trump (Prod. By_ Sap).m4a b/Aurora.test/Resources/Mac Miller/Best Day Ever/03 Donald Trump (Prod. By_ Sap).m4a
new file mode 100755
index 0000000..5ad4e13
Binary files /dev/null and b/Aurora.test/Resources/Mac Miller/Best Day Ever/03 Donald Trump (Prod. By_ Sap).m4a differ
diff --git a/Aurora.test/Resources/Mac Miller/Best Day Ever/04 Oy Vey (Prod By_ ID Labs).mp3 b/Aurora.test/Resources/Mac Miller/Best Day Ever/04 Oy Vey (Prod By_ ID Labs).mp3
new file mode 100755
index 0000000..c758aa5
Binary files /dev/null and b/Aurora.test/Resources/Mac Miller/Best Day Ever/04 Oy Vey (Prod By_ ID Labs).mp3 differ
diff --git a/Aurora.test/Resources/Mac Miller/Best Day Ever/05 I'll Be There (feat. Phonte) (Prod. By_ Beanz 'n' Kornbread).mp3 b/Aurora.test/Resources/Mac Miller/Best Day Ever/05 I'll Be There (feat. Phonte) (Prod. By_ Beanz 'n' Kornbread).mp3
new file mode 100755
index 0000000..1edcf91
Binary files /dev/null and b/Aurora.test/Resources/Mac Miller/Best Day Ever/05 I'll Be There (feat. Phonte) (Prod. By_ Beanz 'n' Kornbread).mp3 differ
diff --git a/Aurora.test/Resources/Mac Miller/Best Day Ever/06 Wear My Hat (Prod. By_ Chuck Inglish).m4a b/Aurora.test/Resources/Mac Miller/Best Day Ever/06 Wear My Hat (Prod. By_ Chuck Inglish).m4a
new file mode 100755
index 0000000..5410711
Binary files /dev/null and b/Aurora.test/Resources/Mac Miller/Best Day Ever/06 Wear My Hat (Prod. By_ Chuck Inglish).m4a differ
diff --git a/Aurora.test/Resources/Mac Miller/Best Day Ever/07 Wake Up (Prod By_ Sap & ID Labs).m4a b/Aurora.test/Resources/Mac Miller/Best Day Ever/07 Wake Up (Prod By_ Sap & ID Labs).m4a
new file mode 100755
index 0000000..8e94ac6
Binary files /dev/null and b/Aurora.test/Resources/Mac Miller/Best Day Ever/07 Wake Up (Prod By_ Sap & ID Labs).m4a differ
diff --git a/Aurora.test/Resources/Mac Miller/Best Day Ever/08 All Around The World (Prod. By_ Just Blaze).m4a b/Aurora.test/Resources/Mac Miller/Best Day Ever/08 All Around The World (Prod. By_ Just Blaze).m4a
new file mode 100755
index 0000000..c2cfe88
Binary files /dev/null and b/Aurora.test/Resources/Mac Miller/Best Day Ever/08 All Around The World (Prod. By_ Just Blaze).m4a differ
diff --git a/Aurora.test/Resources/Mac Miller/Best Day Ever/09 Down The Rabbit Hole (Prod. By_ Blue of The Sore Losers).m4a b/Aurora.test/Resources/Mac Miller/Best Day Ever/09 Down The Rabbit Hole (Prod. By_ Blue of The Sore Losers).m4a
new file mode 100755
index 0000000..85ccc30
Binary files /dev/null and b/Aurora.test/Resources/Mac Miller/Best Day Ever/09 Down The Rabbit Hole (Prod. By_ Blue of The Sore Losers).m4a differ
diff --git a/Aurora.test/Resources/Mac Miller/Best Day Ever/10 In The Air (Prod By_ Ritz Reynolds).m4a b/Aurora.test/Resources/Mac Miller/Best Day Ever/10 In The Air (Prod By_ Ritz Reynolds).m4a
new file mode 100755
index 0000000..96f324e
Binary files /dev/null and b/Aurora.test/Resources/Mac Miller/Best Day Ever/10 In The Air (Prod By_ Ritz Reynolds).m4a differ
diff --git a/Aurora.test/Resources/Mac Miller/Best Day Ever/11 Play Ya Cards (Prod By_ Chuck Inglish).m4a b/Aurora.test/Resources/Mac Miller/Best Day Ever/11 Play Ya Cards (Prod By_ Chuck Inglish).m4a
new file mode 100755
index 0000000..b8694c5
Binary files /dev/null and b/Aurora.test/Resources/Mac Miller/Best Day Ever/11 Play Ya Cards (Prod By_ Chuck Inglish).m4a differ
diff --git a/Aurora.test/Resources/Mac Miller/Best Day Ever/12 She Said (Prod By_ Khrysis).m4a b/Aurora.test/Resources/Mac Miller/Best Day Ever/12 She Said (Prod By_ Khrysis).m4a
new file mode 100755
index 0000000..d1917d7
Binary files /dev/null and b/Aurora.test/Resources/Mac Miller/Best Day Ever/12 She Said (Prod By_ Khrysis).m4a differ
diff --git a/Aurora.test/Resources/Mac Miller/Best Day Ever/13 Life Ain't Easy (Prod. By_ ID Labs).m4a b/Aurora.test/Resources/Mac Miller/Best Day Ever/13 Life Ain't Easy (Prod. By_ ID Labs).m4a
new file mode 100755
index 0000000..afa0d89
Binary files /dev/null and b/Aurora.test/Resources/Mac Miller/Best Day Ever/13 Life Ain't Easy (Prod. By_ ID Labs).m4a differ
diff --git a/Aurora.test/Resources/Mac Miller/Best Day Ever/14 Snooze (Prod By_ ID Labs).m4a b/Aurora.test/Resources/Mac Miller/Best Day Ever/14 Snooze (Prod By_ ID Labs).m4a
new file mode 100755
index 0000000..f1573a8
Binary files /dev/null and b/Aurora.test/Resources/Mac Miller/Best Day Ever/14 Snooze (Prod By_ ID Labs).m4a differ
diff --git a/Aurora.test/Resources/Mac Miller/Best Day Ever/15 Keep Floatin' (feat. Wiz Khalifa) (Prod. By_ ID Labs).mp3 b/Aurora.test/Resources/Mac Miller/Best Day Ever/15 Keep Floatin' (feat. Wiz Khalifa) (Prod. By_ ID Labs).mp3
new file mode 100755
index 0000000..c813526
Binary files /dev/null and b/Aurora.test/Resources/Mac Miller/Best Day Ever/15 Keep Floatin' (feat. Wiz Khalifa) (Prod. By_ ID Labs).mp3 differ
diff --git a/Aurora.test/Resources/Mac Miller/Best Day Ever/16 BDE Bonus (Prod. By_ ID Labs).mp3 b/Aurora.test/Resources/Mac Miller/Best Day Ever/16 BDE Bonus (Prod. By_ ID Labs).mp3
new file mode 100755
index 0000000..1eb1a11
Binary files /dev/null and b/Aurora.test/Resources/Mac Miller/Best Day Ever/16 BDE Bonus (Prod. By_ ID Labs).mp3 differ
diff --git a/Aurora/App.xaml.cs b/Aurora/App.xaml.cs
index cc5f24c..487ba7d 100644
--- a/Aurora/App.xaml.cs
+++ b/Aurora/App.xaml.cs
@@ -1,19 +1,57 @@
using System;
using Aurora.Design.Views.Main;
+using Aurora.Design.Views.Albums;
+using Aurora.Design.Views.Artists;
+using Aurora.Design.Views.Party;
+using Aurora.Design.Views.Profile;
+using Aurora.Design.Views.Songs;
+using Aurora.Design.Views.Stations;
+using Aurora.Services.EventManager;
+using Aurora.Services.Server;
+using Aurora.Services.Client;
+using Autofac;
using LibVLCSharp.Shared;
using Xamarin.Forms;
-using Xamarin.Forms.Xaml;
+using Aurora.Services.Player;
+using Aurora.Services.Settings;
+using Aurora.Services.Library;
namespace Aurora
{
public partial class App : Application
{
+ private static IContainer _container;
public App()
{
InitializeComponent();
Core.Initialize();
- MainPage = new MainView();
+ //Register DI
+ ContainerBuilder _builder = new ContainerBuilder();
+ // _builder.RegisterInstance(new PlayerService()).SingleInstance();
+ _builder.RegisterType().As().SingleInstance();
+ _builder.RegisterType().As().SingleInstance();
+ _builder.RegisterType().As().SingleInstance();
+ _builder.RegisterType().As().SingleInstance();
+ _builder.RegisterType().As().SingleInstance();
+ _builder.RegisterType().As().SingleInstance();
+ _builder.RegisterType().SingleInstance();
+ _builder.RegisterType();
+ _builder.RegisterType();
+ _builder.RegisterType();
+ _builder.RegisterType();
+ _builder.RegisterType();
+ _builder.RegisterType();
+
+ // _builder.RegisterInstance(new SettingsService()).SingleInstance();
+ _container = _builder.Build();
+
+ MainPage = _container.Resolve();
+ }
+
+ public static IContainer Container
+ {
+ get { return _container; }
}
protected override void OnStart()
diff --git a/Aurora/Aurora.csproj b/Aurora/Aurora.csproj
index 1c6f392..06593eb 100644
--- a/Aurora/Aurora.csproj
+++ b/Aurora/Aurora.csproj
@@ -23,6 +23,7 @@
+
@@ -51,7 +52,7 @@
-
+
@@ -61,15 +62,12 @@
-
-
-
-
-
-
-
+
+
+
+
@@ -77,11 +75,11 @@
-
-
-
-
-
-
+
+
+
+
+
+
\ No newline at end of file
diff --git a/Aurora/Design/Components/MemberList/MemberList.xaml.cs b/Aurora/Design/Components/MemberList/MemberList.xaml.cs
index 7a61fe4..0d09652 100644
--- a/Aurora/Design/Components/MemberList/MemberList.xaml.cs
+++ b/Aurora/Design/Components/MemberList/MemberList.xaml.cs
@@ -24,7 +24,7 @@ namespace Aurora.Design.Components.MemberList
///
public static readonly BindableProperty MembersProperty =
BindableProperty.Create(propertyName: "Members",
- returnType: typeof(ObservableCollection),
+ returnType: typeof(ObservableCollection),
declaringType: typeof(MemberList),
defaultBindingMode: BindingMode.Default,
propertyChanged: OnMembersChanged);
@@ -33,11 +33,11 @@ namespace Aurora.Design.Components.MemberList
/// Backing property for MembersProperty
///
///
- public ObservableCollection Members
+ public ObservableCollection Members
{
get
{
- return (ObservableCollection)GetValue(MembersProperty);
+ return (ObservableCollection)GetValue(MembersProperty);
}
set
{
diff --git a/Aurora/Design/Views/MainView/MainView.xaml.cs b/Aurora/Design/Views/MainView/MainView.xaml.cs
index a008571..67d7f16 100644
--- a/Aurora/Design/Views/MainView/MainView.xaml.cs
+++ b/Aurora/Design/Views/MainView/MainView.xaml.cs
@@ -9,8 +9,8 @@ using Xamarin.Forms;
using Xamarin.Forms.Xaml;
using Aurora.Models.Media;
using Aurora.Design.Components.MediaPlayer;
-using Aurora.Services.PlayerService;
-using System.Threading;
+using Aurora.Services.Player;
+using Autofac;
namespace Aurora.Design.Views.Main
{
@@ -38,10 +38,10 @@ namespace Aurora.Design.Views.Main
private Dictionary _viewModels;
private BaseViewModel _lastViewModel;
private Player _playerComponent;
- private PlayerService _playerService;
+ private IPlayer _playerService;
private ContentPresenter _viewContent;
- public MainView()
+ public MainView(IPlayer player)
{
InitializeComponent();
BindingContext = new MainViewModel();
@@ -50,7 +50,7 @@ namespace Aurora.Design.Views.Main
_playerComponent = Player;
_viewContent = (ContentPresenter)Content.FindByName("ViewContent");
- _playerService = PlayerService.Instance;
+ _playerService = player;
MasterPage.ListView.ItemSelected += OnNavItemSelected;
@@ -89,7 +89,7 @@ namespace Aurora.Design.Views.Main
}
//Instantiate new view model
- vm = (BaseViewModel)Activator.CreateInstance(item.TargetViewModelType);
+ vm = (BaseViewModel)App.Container.Resolve(item.TargetViewModelType); //Activator.CreateInstance(item.TargetViewModelType);
_viewModels.Add(item.Id, vm);
}
@@ -135,7 +135,7 @@ namespace Aurora.Design.Views.Main
else
{
//Instantiate new view model
- vm = (BaseViewModel)Activator.CreateInstance(firstNavItem.TargetViewModelType);
+ vm = (BaseViewModel)App.Container.Resolve(firstNavItem.TargetViewModelType); //(BaseViewModel)Activator.CreateInstance(firstNavItem.TargetViewModelType);
_viewModels.Add(firstNavItem.Id, vm);
}
diff --git a/Aurora/Design/Views/Party/PartyViewModel.cs b/Aurora/Design/Views/Party/PartyViewModel.cs
index b9daa6d..d047e63 100644
--- a/Aurora/Design/Views/Party/PartyViewModel.cs
+++ b/Aurora/Design/Views/Party/PartyViewModel.cs
@@ -1,18 +1,18 @@
using System;
using System.Collections.ObjectModel;
+using System.Collections.Generic;
using System.Threading.Tasks;
+using System.Threading;
using System.Linq;
using Xamarin.Forms;
-using Aurora.Services;
-using Aurora.Proto.General;
using Aurora.Proto.Party;
-using Aurora.Proto.Events;
-using Aurora.Services.ClientService;
-using Aurora.Services.ClientService.Events;
-using Aurora.Services.PlayerService;
-using Aurora.Services.EventManager;
using Aurora.Models.Media;
+using Aurora.Services.Client;
using Aurora.Design.Views.Party.NewPartyDialog;
+using Aurora.Services.Settings;
+using Aurora.Services.Server;
+using Aurora.Services.EventManager;
+using Grpc.Core;
namespace Aurora.Design.Views.Party
{
@@ -24,42 +24,55 @@ namespace Aurora.Design.Views.Party
Hosting,
Connecting,
}
-
+ delegate void EventHandler(BaseEvent e);
public class PartyViewModel : BaseViewModel
{
private PartyState _state;
private string _hostname = "";
- private ObservableCollection _members;
+ private ObservableCollection _members;
private ObservableCollection _queue;
private BaseMedia _selectedMedia;
- private ClientService _client;
+ // private IClientService _client;
+ private ISettingsService _settingsService;
+ private IClientService _clientService;
+ private IServerService _serverService;
+ private IEventManager _eventManager;
+
+ private CancellationTokenSource _eventCancellationTokenSource;
+
+ private Dictionary _eventHandlers;
private int _selectedTabIndex;
- public PartyViewModel()
+ public PartyViewModel(
+ ISettingsService settingsService,
+ IServerService serverService,
+ IEventManager eventManager,
+ IClientService clientService)
{
- _members = new ObservableCollection();
+ _members = new ObservableCollection();
_queue = new ObservableCollection();
+ this._settingsService = settingsService;
+ this._serverService = serverService;
+ this._eventManager = eventManager;
+ this._clientService = clientService;
+
SetState(PartyState.SelectingHost);
PlayCommand = new Command(OnDoubleClickCommandExecute, CanDoubleClickCommandExecute);
LeavePartyCommand = new Command(OnLeavePartyCommandExecute, CanLeavePartyCommandExecute);
- _client = ClientService.Instance;
-
- _client.OnMediaPaused += this.OnRemoteMediaPaused;
- _client.OnMediaResumed += this.OnRemoteMediaResumed;
- _client.OnNewMediaPlaying += this.OnNewRemoteMediaPlaying;
- _client.OnPartyMemberJoined += this.OnPartyMemberJoined;
- _client.OnPartyMemberLeft += this.OnPartyMemberLeft;
-
- }
-
- ~PartyViewModel()
- {
- //Task.Run(ServerService.Instance.Stop);
+ //Setup event handlers
+ _eventHandlers = new Dictionary()
+ {
+ {BaseEvent.DerivedEventOneofCase.MediaPausedEvent, this.OnRemoteMediaPaused},
+ {BaseEvent.DerivedEventOneofCase.MediaResumedEvent, this.OnRemoteMediaResumed},
+ {BaseEvent.DerivedEventOneofCase.NewMediaPlayingEvent, this.OnNewRemoteMediaPlaying},
+ {BaseEvent.DerivedEventOneofCase.MemberCreatedEvent, this.OnPartyMemberJoined},
+ {BaseEvent.DerivedEventOneofCase.MemberDeletedEvent, this.OnPartyMemberLeft}
+ };
}
#region Properties
@@ -74,7 +87,7 @@ namespace Aurora.Design.Views.Party
/// Publc property for the members list
///
///
- public ObservableCollection Members
+ public ObservableCollection Members
{
get
{
@@ -136,7 +149,7 @@ namespace Aurora.Design.Views.Party
if (this._state == PartyState.Hosting ||
this._state == PartyState.InParty)
{
- await _client.GetEvents().ConfigureAwait(false);
+ await this.GetEvents().ConfigureAwait(false);
}
else
{
@@ -173,7 +186,7 @@ namespace Aurora.Design.Views.Party
///
public override Task OnInactive()
{
- _client.StopEvents();
+ this._eventCancellationTokenSource.Cancel();
return Task.FromResult