diff --git a/Mear/Mear/App.xaml.cs b/Mear/Mear/App.xaml.cs
index 0d6b858..46ee60b 100644
--- a/Mear/Mear/App.xaml.cs
+++ b/Mear/Mear/App.xaml.cs
@@ -13,6 +13,7 @@ namespace Mear
InitializeComponent();
MainPage = new Landing();
+ //MainPage = new MusicLibrary();
}
protected override void OnStart()
diff --git a/Mear/Mear/Constants/App/Info.cs b/Mear/Mear/Constants/App/Info.cs
new file mode 100644
index 0000000..d5a26ae
--- /dev/null
+++ b/Mear/Mear/Constants/App/Info.cs
@@ -0,0 +1,26 @@
+using System;
+using System.Collections.Generic;
+using System.Text;
+
+namespace Mear.Constants.App
+{
+ public class Info
+ {
+ #region Fields
+ private static string _appName = "Mear";
+ private static string _appVersion = "Dev Pre-release";
+ #endregion
+
+
+ #region Properties
+ public static string AppName
+ {
+ get => _appName;
+ }
+ public static string AppVersion
+ {
+ get => _appVersion;
+ }
+ #endregion
+ }
+}
diff --git a/Mear/Mear/Mear.csproj b/Mear/Mear/Mear.csproj
index f930dcb..d87d284 100644
--- a/Mear/Mear/Mear.csproj
+++ b/Mear/Mear/Mear.csproj
@@ -20,10 +20,6 @@
-
-
-
-
ArtistView.xaml
diff --git a/Mear/Mear/Models/Authentication/Token.cs b/Mear/Mear/Models/Authentication/Token.cs
new file mode 100644
index 0000000..47b2afd
--- /dev/null
+++ b/Mear/Mear/Models/Authentication/Token.cs
@@ -0,0 +1,19 @@
+using System;
+using System.Collections.Generic;
+using System.Runtime.Serialization;
+using System.Text;
+
+using SQLite;
+
+namespace Mear.Models.Authentication
+{
+ [DataContract]
+ [Table("Token")]
+ public class Token
+ {
+ [PrimaryKey, Column("Id"), AutoIncrement]
+ public int Id { get; set; }
+ public string AccessToken { get; set; }
+ public int UserId { get; set; }
+ }
+}
diff --git a/Mear/Mear/Repositories/Database/DBRepository.cs b/Mear/Mear/Repositories/Database/DBRepository.cs
new file mode 100644
index 0000000..8f48343
--- /dev/null
+++ b/Mear/Mear/Repositories/Database/DBRepository.cs
@@ -0,0 +1,67 @@
+using System;
+using System.Collections.Generic;
+using System.IO;
+using System.Text;
+
+using Mear.Constants.App;
+
+using SQLite;
+
+namespace Mear.Repositories.Database
+{
+ public class DBRepository
+ {
+ #region Fields
+ protected SQLiteConnection _Db;
+ protected string _dbPath;
+ #endregion
+
+
+ #region Properties
+ public string DBPath
+ {
+ get => _dbPath;
+ }
+ #endregion
+
+
+ #region Constructors
+ #endregion
+
+
+ #region Methods
+ protected bool DoesTableExist(string tablename)
+ {
+ var result = 0;
+
+ try
+ {
+ result = _Db.GetTableInfo(tablename).Count;
+
+ if (result > 0)
+ {
+ return true;
+ }
+ }
+ catch (Exception ex)
+ {
+ var msg = ex.Message;
+ }
+ return false;
+ }
+
+ protected void CloseDb()
+ {
+ _Db.Close();
+ }
+ protected void Initialize()
+ {
+ var appName = Info.AppName;
+ _dbPath = Path.Combine(Environment.GetFolderPath(
+ Environment.SpecialFolder.Personal), appName);
+
+ _Db = new SQLiteConnection(_dbPath);
+ }
+ #endregion
+ }
+}
diff --git a/Mear/Mear/Repositories/Database/DBTokenRepository.cs b/Mear/Mear/Repositories/Database/DBTokenRepository.cs
index e8973ff..a29ec85 100644
--- a/Mear/Mear/Repositories/Database/DBTokenRepository.cs
+++ b/Mear/Mear/Repositories/Database/DBTokenRepository.cs
@@ -2,9 +2,58 @@
using System.Collections.Generic;
using System.Text;
+using SQLite;
+
+using Mear.Constants.App;
+using Mear.Models.Authentication;
+
namespace Mear.Repositories.Database
{
- public class DBTokenRepository
+ public class DBTokenRepository : DBRepository
{
+ #region Fields
+ #endregion
+
+
+ #region Properties
+ #endregion
+
+
+ #region Constructors
+ public DBTokenRepository()
+ {
+ Initialize();
+ }
+ #endregion
+
+
+ #region Methods
+ public Token RetrieveToken()
+ {
+ try
+ {
+ var token = _Db.Table().FirstOrDefault();
+
+ return token;
+ }
+ catch (Exception ex)
+ {
+ var msg = ex.Message;
+ }
+
+ return null;
+ }
+ public void SaveToken(Token token)
+ {
+ if (!DoesTableExist("Token"))
+ {
+ _Db.CreateTable();
+ }
+
+ _Db.DeleteAll();
+
+ _Db.Insert(token);
+ }
+ #endregion
}
}
diff --git a/Mear/Mear/Repositories/Mock/MockUserRepository.cs b/Mear/Mear/Repositories/Mock/MockUserRepository.cs
index 90a63ff..046b64c 100644
--- a/Mear/Mear/Repositories/Mock/MockUserRepository.cs
+++ b/Mear/Mear/Repositories/Mock/MockUserRepository.cs
@@ -34,12 +34,12 @@ namespace Mear.Repositories.Mock
{
_users = new List();
- var firstname = "";
- var lastname = "";
- var email = "";
- var phone = "";
- var username = "";
- var password = "";
+ var firstname = "kuoth";
+ var lastname = "Universe";
+ var email = "life@hell.org";
+ var phone = "4330944491";
+ var username = "kverse";
+ var password = "demolaugh";
_users.Add(new User
{
diff --git a/Mear/Mear/ViewModels/BaseViewModel.cs b/Mear/Mear/ViewModels/BaseViewModel.cs
new file mode 100644
index 0000000..6bc9650
--- /dev/null
+++ b/Mear/Mear/ViewModels/BaseViewModel.cs
@@ -0,0 +1,18 @@
+using System;
+using System.Collections.Generic;
+using System.ComponentModel;
+using System.Text;
+
+using Xamarin.Forms;
+
+namespace Mear.ViewModels
+{
+ public class BaseViewModel : INotifyPropertyChanged
+ {
+ #region Fields
+ #region INotifyPropertyChanged
+ public event PropertyChangedEventHandler PropertyChanged;
+ #endregion
+ #endregion
+ }
+}
diff --git a/Mear/Mear/ViewModels/SongViewModel.cs b/Mear/Mear/ViewModels/SongViewModel.cs
new file mode 100644
index 0000000..0d3ce69
--- /dev/null
+++ b/Mear/Mear/ViewModels/SongViewModel.cs
@@ -0,0 +1,26 @@
+using System;
+using System.Collections.Generic;
+using System.Text;
+
+using Xamarin.Forms;
+
+namespace Mear.ViewModels
+{
+ public class SongViewModel : BaseViewModel
+ {
+ #region Fields
+ #endregion
+
+
+ #region Properties
+ #endregion
+
+
+ #region Constructors
+ public SongViewModel()
+ {
+ //Title = "Songs";
+ }
+ #endregion
+ }
+}
diff --git a/Mear/Mear/Views/AlbumView.xaml b/Mear/Mear/Views/AlbumView.xaml
index 1fa5bea..51e35a2 100644
--- a/Mear/Mear/Views/AlbumView.xaml
+++ b/Mear/Mear/Views/AlbumView.xaml
@@ -1,13 +1,13 @@
-
-
+
-
-
\ No newline at end of file
+
+
\ No newline at end of file
diff --git a/Mear/Mear/Views/AlbumView.xaml.cs b/Mear/Mear/Views/AlbumView.xaml.cs
index 580d90d..43f2ebe 100644
--- a/Mear/Mear/Views/AlbumView.xaml.cs
+++ b/Mear/Mear/Views/AlbumView.xaml.cs
@@ -10,7 +10,7 @@ using Xamarin.Forms.Xaml;
namespace Mear.Views
{
[XamlCompilation(XamlCompilationOptions.Compile)]
- public partial class AlbumView : ContentView
+ public partial class AlbumView : ContentPage
{
public AlbumView()
{
diff --git a/Mear/Mear/Views/ArtistView.xaml b/Mear/Mear/Views/ArtistView.xaml
index 69f2e8b..ffa114b 100644
--- a/Mear/Mear/Views/ArtistView.xaml
+++ b/Mear/Mear/Views/ArtistView.xaml
@@ -1,13 +1,13 @@
-
-
+
-
-
\ No newline at end of file
+
+
\ No newline at end of file
diff --git a/Mear/Mear/Views/ArtistView.xaml.cs b/Mear/Mear/Views/ArtistView.xaml.cs
index fe60fb7..bd56d62 100644
--- a/Mear/Mear/Views/ArtistView.xaml.cs
+++ b/Mear/Mear/Views/ArtistView.xaml.cs
@@ -10,7 +10,7 @@ using Xamarin.Forms.Xaml;
namespace Mear.Views
{
[XamlCompilation(XamlCompilationOptions.Compile)]
- public partial class ArtistView : ContentView
+ public partial class ArtistView : ContentPage
{
public ArtistView()
{
diff --git a/Mear/Mear/Views/LoginPage.xaml.cs b/Mear/Mear/Views/LoginPage.xaml.cs
index 86f1407..d644be9 100644
--- a/Mear/Mear/Views/LoginPage.xaml.cs
+++ b/Mear/Mear/Views/LoginPage.xaml.cs
@@ -9,6 +9,7 @@ using Xamarin.Forms.Xaml;
using Mear.Managers;
using Mear.Models.Authentication;
+using Mear.Repositories.Database;
using Mear.Repositories.Mock;
namespace Mear.Views
@@ -67,6 +68,12 @@ namespace Mear.Views
if (loginRes.Expiration > 0 && loginRes != null)
{
+ DBTokenRepository tokRepo = new DBTokenRepository();
+ tokRepo.SaveToken(new Token
+ {
+ AccessToken = loginRes.Token,
+ UserId = loginRes.UserId
+ });
await DisplayAlert("Icarus Login", "Successfully logged in", "Ok");
App.Current.MainPage = new MusicLibrary();
}
diff --git a/Mear/Mear/Views/MusicLibrary.xaml b/Mear/Mear/Views/MusicLibrary.xaml
index 0e3321a..7bb37c2 100644
--- a/Mear/Mear/Views/MusicLibrary.xaml
+++ b/Mear/Mear/Views/MusicLibrary.xaml
@@ -7,12 +7,6 @@
xmlns:views="clr-namespace:Mear.Views"
x:Class="Mear.Views.MusicLibrary">
-
-
-
-
-
-
\ No newline at end of file
diff --git a/Mear/Mear/Views/MusicLibrary.xaml.cs b/Mear/Mear/Views/MusicLibrary.xaml.cs
index 6bee183..459d745 100644
--- a/Mear/Mear/Views/MusicLibrary.xaml.cs
+++ b/Mear/Mear/Views/MusicLibrary.xaml.cs
@@ -7,14 +7,38 @@ using System.Threading.Tasks;
using Xamarin.Forms;
using Xamarin.Forms.Xaml;
+using Mear.Models.Authentication;
+using Mear.Repositories.Database;
+
namespace Mear.Views
{
[XamlCompilation(XamlCompilationOptions.Compile)]
public partial class MusicLibrary : TabbedPage
{
+ #region Fields
+ #endregion
+
+
+ #region Properties
+ #endregion
+
+
+ #region Constructors
public MusicLibrary()
{
InitializeComponent();
}
+ #endregion
+
+
+ #region Methods
+ #region Test
+ public void TokenTest()
+ {
+ DBTokenRepository tokRepo = new DBTokenRepository();
+ var token = tokRepo.RetrieveToken();
+ }
+ #endregion
+ #endregion
}
}
\ No newline at end of file
diff --git a/Mear/Mear/Views/SongView.xaml b/Mear/Mear/Views/SongView.xaml
index 5682fc1..a9eceb5 100644
--- a/Mear/Mear/Views/SongView.xaml
+++ b/Mear/Mear/Views/SongView.xaml
@@ -1,13 +1,18 @@
-
-
+ x:Class="Mear.Views.SongView"
+ xmlns:vm="clr-namespace:Mear.ViewModels"
+ Title="{Binding Title}">
+
+
+
+
+
-
-
\ No newline at end of file
+
\ No newline at end of file
diff --git a/Mear/Mear/Views/SongView.xaml.cs b/Mear/Mear/Views/SongView.xaml.cs
index 79dbd3e..f2492c6 100644
--- a/Mear/Mear/Views/SongView.xaml.cs
+++ b/Mear/Mear/Views/SongView.xaml.cs
@@ -10,7 +10,7 @@ using Xamarin.Forms.Xaml;
namespace Mear.Views
{
[XamlCompilation(XamlCompilationOptions.Compile)]
- public partial class SongView : ContentView
+ public partial class SongView : ContentPage
{
public SongView()
{