diff --git a/BookAStar/BookAStar.Droid/BookAStar.Droid.csproj b/BookAStar/BookAStar.Droid/BookAStar.Droid.csproj
index 66be7693..7c1f681d 100644
--- a/BookAStar/BookAStar.Droid/BookAStar.Droid.csproj
+++ b/BookAStar/BookAStar.Droid/BookAStar.Droid.csproj
@@ -88,7 +88,7 @@
False
..\..\..\..\..\..\..\Program Files (x86)\Reference Assemblies\Microsoft\Framework\MonoAndroid\v7.0\Mono.Android.dll
-
+
False
..\..\..\..\..\..\..\Program Files (x86)\Reference Assemblies\Microsoft\Framework\MonoAndroid\v7.0\Mono.Android.Export.dll
diff --git a/BookAStar/BookAStar.Droid/Properties/AndroidManifest.xml b/BookAStar/BookAStar.Droid/Properties/AndroidManifest.xml
index fbc04fe9..6ece6f55 100644
--- a/BookAStar/BookAStar.Droid/Properties/AndroidManifest.xml
+++ b/BookAStar/BookAStar.Droid/Properties/AndroidManifest.xml
@@ -1,7 +1,7 @@
-
+
@@ -11,13 +11,13 @@
-
+
-
+
diff --git a/BookAStar/BookAStar.Droid/Resources/Resource.Designer.cs b/BookAStar/BookAStar.Droid/Resources/Resource.Designer.cs
index 7be6d2f1..7c7f592d 100644
--- a/BookAStar/BookAStar.Droid/Resources/Resource.Designer.cs
+++ b/BookAStar/BookAStar.Droid/Resources/Resource.Designer.cs
@@ -5341,26 +5341,26 @@ namespace BookAStar.Droid
// aapt resource value: 0x7f07004c
public const int ApplicationName = 2131165260;
- // aapt resource value: 0x7f070061
- public const int Date = 2131165281;
+ // aapt resource value: 0x7f070062
+ public const int Date = 2131165282;
- // aapt resource value: 0x7f070060
- public const int Description = 2131165280;
+ // aapt resource value: 0x7f070061
+ public const int Description = 2131165281;
// aapt resource value: 0x7f07004b
public const int Hello = 2131165259;
- // aapt resource value: 0x7f070062
- public const int Location = 2131165282;
-
// aapt resource value: 0x7f070063
- public const int Pricing = 2131165283;
+ public const int Location = 2131165283;
- // aapt resource value: 0x7f07005e
- public const int Settings = 2131165278;
+ // aapt resource value: 0x7f070064
+ public const int Pricing = 2131165284;
// aapt resource value: 0x7f07005f
- public const int Title = 2131165279;
+ public const int Settings = 2131165279;
+
+ // aapt resource value: 0x7f070060
+ public const int Title = 2131165280;
// aapt resource value: 0x7f070034
public const int abc_action_bar_home_description = 2131165236;
@@ -5437,8 +5437,8 @@ namespace BookAStar.Droid
// aapt resource value: 0x7f070049
public const int bottom_sheet_behavior = 2131165257;
- // aapt resource value: 0x7f07005d
- public const int cancel = 2131165277;
+ // aapt resource value: 0x7f07005e
+ public const int cancel = 2131165278;
// aapt resource value: 0x7f07004a
public const int character_counter_pattern = 2131165258;
@@ -5548,8 +5548,8 @@ namespace BookAStar.Droid
// aapt resource value: 0x7f070052
public const int fullscreen_button = 2131165266;
- // aapt resource value: 0x7f070067
- public const int google_app_id = 2131165287;
+ // aapt resource value: 0x7f070068
+ public const int google_app_id = 2131165288;
// aapt resource value: 0x7f07004f
public const int invalid_date = 2131165263;
@@ -5614,8 +5614,8 @@ namespace BookAStar.Droid
// aapt resource value: 0x7f070055
public const int pause = 2131165269;
- // aapt resource value: 0x7f070066
- public const int picture = 2131165286;
+ // aapt resource value: 0x7f070067
+ public const int picture = 2131165287;
// aapt resource value: 0x7f070056
public const int seekbar = 2131165270;
@@ -5623,6 +5623,9 @@ namespace BookAStar.Droid
// aapt resource value: 0x7f070057
public const int select_an_action = 2131165271;
+ // aapt resource value: 0x7f07005b
+ public const int send_to_app_name = 2131165275;
+
// aapt resource value: 0x7f070047
public const int status_bar_notification_info_overflow = 2131165255;
@@ -5638,17 +5641,17 @@ namespace BookAStar.Droid
// aapt resource value: 0x7f070059
public const int time_duration = 2131165273;
- // aapt resource value: 0x7f070064
- public const int url = 2131165284;
-
// aapt resource value: 0x7f070065
- public const int url_hint = 2131165285;
+ public const int url = 2131165285;
- // aapt resource value: 0x7f07005c
- public const int yavscAccountTypeName = 2131165276;
+ // aapt resource value: 0x7f070066
+ public const int url_hint = 2131165286;
- // aapt resource value: 0x7f07005b
- public const int yavscIdentRemoved = 2131165275;
+ // aapt resource value: 0x7f07005d
+ public const int yavscAccountTypeName = 2131165277;
+
+ // aapt resource value: 0x7f07005c
+ public const int yavscIdentRemoved = 2131165276;
static String()
{
diff --git a/BookAStar/BookAStar.Droid/Resources/values/strings.xml b/BookAStar/BookAStar.Droid/Resources/values/strings.xml
index 43cdc6cd..2eb87da7 100644
--- a/BookAStar/BookAStar.Droid/Resources/values/strings.xml
+++ b/BookAStar/BookAStar.Droid/Resources/values/strings.xml
@@ -1,6 +1,7 @@
Booking star
+ Vers les étoiles
Identification supprimée
Booking star
Annuler
diff --git a/BookAStar/BookAStar/App.xaml.cs b/BookAStar/BookAStar/App.xaml.cs
index b5a00742..ed96d59b 100644
--- a/BookAStar/BookAStar/App.xaml.cs
+++ b/BookAStar/BookAStar/App.xaml.cs
@@ -1,4 +1,8 @@
using System;
+using Microsoft.AspNet.SignalR.Client;
+using System.Net;
+using System.Linq;
+using System.Threading.Tasks;
using Xamarin.Forms;
using XLabs.Forms.Mvvm;
using XLabs.Forms.Pages;
@@ -12,20 +16,17 @@ using XLabs.Enums;
namespace BookAStar
{
- using System.Threading.Tasks;
using Data;
using Interfaces;
using Model;
using Model.UI;
using Pages;
using Plugin.Connectivity;
- using Microsoft.AspNet.SignalR.Client;
using Model.Social.Messaging;
using ViewModels.Messaging;
using ViewModels.UserProfile;
using Pages.UserProfile;
using ViewModels.EstimateAndBilling;
- using System.Net;
public partial class App : Application // superclass new in 1.3
{
@@ -149,6 +150,7 @@ namespace BookAStar
ViewFactory.Register();
ViewFactory.Register();
ViewFactory.Register();
+ ViewFactory.Register();
ConfigManager = new GenericConfigSettingsMgr(s =>
MainSettings.AppSettings.GetValueOrDefault(s, MainSettings.SettingsDefault), null);
}
@@ -174,7 +176,20 @@ namespace BookAStar
BookQueriesPage bQueriesPage;
AccountChooserPage accChooserPage;
- HomePage home;
+ HomePage homePage;
+ UserProfilePage userProfilePage;
+ ChatPage chatPage;
+
+ private void ShowPage(Page page)
+ {
+ if (masterDetail.Detail.Navigation.NavigationStack.Contains(page))
+ {
+ if (masterDetail.Detail.Navigation.NavigationStack.Last() == page) return;
+ masterDetail.Detail.Navigation.RemovePage(page);
+ page.Parent = null;
+ }
+ masterDetail.Detail.Navigation.PushAsync(page);
+ }
private void BuildMainPage()
{
@@ -186,9 +201,15 @@ namespace BookAStar
Icon = "icon.png",
BindingContext = new BookQueriesViewModel()
};
-
- home = new HomePage() { Title = "Accueil", Icon = "icon.png" };
-
+ homePage = new HomePage() { Title = "Accueil", Icon = "icon.png" };
+ userProfilePage = new UserProfilePage { Title = "Profile utilisateur", Icon = "ic_corp_icon.png",
+ BindingContext = new UserProfileViewModel() };
+ chatPage = new ChatPage
+ {
+ Title = "Chat",
+ Icon = "",
+ BindingContext = new ChatViewModel()
+ };
// var mainPage = new NavigationPage(bQueriesPage);
masterDetail = new ExtendedMasterDetailPage()
@@ -202,17 +223,18 @@ namespace BookAStar
BindingContext = new DashboardViewModel()
};
- // masterDetail.Detail = home;
- masterDetail.Detail = new NavigationPage(home);
+ masterDetail.Detail = new NavigationPage(homePage);
ToolbarItem tiSetts = new ToolbarItem()
{
// FIXME what for? Priority = 0,
Text = "Paramètres",
Icon = "ic_corp_icon.png",
Command = new Command(
- () => { NavigationService.NavigateTo(); }
- )
+ () =>
+ {
+ ShowPage(userProfilePage);
+ } )
};
ToolbarItem tiHome = new ToolbarItem()
@@ -220,8 +242,9 @@ namespace BookAStar
Text = "Accueil",
Icon = "icon.png",
Command = new Command(
- () => { NavigationService.NavigateTo(); }
- )
+ () => {
+ ShowPage(homePage);
+ })
};
ToolbarItem tiPubChat= new ToolbarItem()
@@ -229,7 +252,7 @@ namespace BookAStar
Text = "Chat",
Icon = "chat_icon_s.png",
Command = new Command(
- () => { NavigationService.NavigateTo(); }
+ () => { ShowPage(chatPage); }
)
};
masterDetail.ToolbarItems.Add(tiHome);
@@ -259,11 +282,6 @@ namespace BookAStar
}
- private void TiPubChat_Clicked(object sender, EventArgs e)
- {
-
- }
-
public static INavigationService NavigationService { protected set; get; }
public static bool isConnected;
public static bool IsConnected { get { return isConnected; }
diff --git a/BookAStar/BookAStar/BookAStar.csproj b/BookAStar/BookAStar/BookAStar.csproj
index e8deb46c..ee39eae4 100644
--- a/BookAStar/BookAStar/BookAStar.csproj
+++ b/BookAStar/BookAStar/BookAStar.csproj
@@ -81,6 +81,7 @@
+
@@ -249,7 +250,7 @@
True
- ..\..\..\..\..\..\..\..\Program Files (x86)\Reference Assemblies\Microsoft\Framework\MonoAndroid\v6.0\Mono.Android.dll
+ ..\..\..\..\..\..\..\Program Files (x86)\Reference Assemblies\Microsoft\Framework\MonoAndroid\v7.0\Mono.Android.dll
..\..\packages\Newtonsoft.Json.9.0.1\lib\portable-net45+wp80+win8+wpa81\Newtonsoft.Json.dll
diff --git a/BookAStar/BookAStar/Pages/UserProfile/DashboardPage.xaml b/BookAStar/BookAStar/Pages/UserProfile/DashboardPage.xaml
index 2ef86a72..d0b929ff 100644
--- a/BookAStar/BookAStar/Pages/UserProfile/DashboardPage.xaml
+++ b/BookAStar/BookAStar/Pages/UserProfile/DashboardPage.xaml
@@ -34,6 +34,7 @@
+
diff --git a/BookAStar/BookAStar/Pages/UserProfile/UserProfilePage.xaml b/BookAStar/BookAStar/Pages/UserProfile/UserProfilePage.xaml
index b9fc2df2..ba506934 100644
--- a/BookAStar/BookAStar/Pages/UserProfile/UserProfilePage.xaml
+++ b/BookAStar/BookAStar/Pages/UserProfile/UserProfilePage.xaml
@@ -1,7 +1,55 @@
-
-
+ x:Class="BookAStar.Pages.UserProfile.UserProfilePage"
+ xmlns:local="clr-namespace:BookAStar;assembly=BookAStar"
+ xmlns:views="clr-namespace:BookAStar.Views;assembly=BookAStar"
+ xmlns:extensions="clr-namespace:BookAStar.Extensions;assembly=BookAStar"
+ xmlns:controls="clr-namespace:XLabs.Forms.Controls;assembly=XLabs.Forms"
+ Style="{StaticResource PageStyle}">
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/BookAStar/BookAStar/Pages/UserProfile/UserProfilePage.xaml.cs b/BookAStar/BookAStar/Pages/UserProfile/UserProfilePage.xaml.cs
index dba8eda7..fc1f780d 100644
--- a/BookAStar/BookAStar/Pages/UserProfile/UserProfilePage.xaml.cs
+++ b/BookAStar/BookAStar/Pages/UserProfile/UserProfilePage.xaml.cs
@@ -1,8 +1,5 @@
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-using System.Threading.Tasks;
+
+using System;
using Xamarin.Forms;
@@ -13,6 +10,28 @@ namespace BookAStar.Pages.UserProfile
public UserProfilePage()
{
InitializeComponent();
+ AvatarButton.Clicked += AvatarButton_Clicked;
+ }
+
+ private void AvatarButton_Clicked (object sender, EventArgs e)
+ {
+ throw new NotImplementedException();
+ }
+
+ public void OnManageFiles(object sender, EventArgs e)
+ {
+ ShowPage(null, true);
+ }
+
+ public void OnViewPerformerStatus(object sender, EventArgs e)
+ {
+ ShowPage(null, true);
+ }
+
+ private void ShowPage(object[] args, bool animate = false) where T : Page
+ {
+ App.NavigationService.NavigateTo(animate, args);
+ App.MasterPresented = false;
}
}
}
diff --git a/BookAStar/BookAStar/ViewModels/UserProfile/UserProfileViewModel.cs b/BookAStar/BookAStar/ViewModels/UserProfile/UserProfileViewModel.cs
new file mode 100644
index 00000000..2873d130
--- /dev/null
+++ b/BookAStar/BookAStar/ViewModels/UserProfile/UserProfileViewModel.cs
@@ -0,0 +1,219 @@
+using System.Collections.ObjectModel;
+using System.Linq;
+using Xamarin.Forms;
+using XLabs.Forms.Behaviors;
+using XLabs.Forms.Controls;
+using XLabs.Forms.Mvvm;
+using XLabs.Ioc;
+using XLabs.Platform.Services;
+
+namespace BookAStar.ViewModels.UserProfile
+{
+ using Data;
+ using Helpers;
+ using Model.Auth.Account;
+ using Pages.UserProfile;
+
+ internal class UserProfileViewModel : ViewModel
+ {
+ public string UserFilesLabel
+ {
+ get; set;
+ }
+
+ int rating;
+ public int Rating
+ {
+ get
+ {
+ return rating;
+ }
+ set
+ {
+ SetProperty(ref rating, value, "Rating");
+ }
+ }
+
+ public string UserId
+ {
+ get
+ {
+ return User?.Id;
+ }
+ }
+
+ public bool AllowUseMyPosition
+ {
+ get
+ {
+ return MainSettings.AllowGPSUsage;
+ }
+ set
+ {
+ MainSettings.AllowGPSUsage = value;
+ }
+ }
+
+ public bool AllowProBookingOnly
+ {
+ get
+ {
+ return MainSettings.AllowProBookingOnly;
+ }
+ set
+ {
+ MainSettings.AllowProBookingOnly = value;
+ }
+ }
+
+ public bool ReceivePushNotifications
+ {
+ get
+ {
+ return MainSettings.PushNotifications;
+ }
+ set
+ {
+ MainSettings.PushNotifications = value;
+ }
+ }
+ private long queryCount;
+ private User user;
+
+ public long QueryCount
+ {
+ get
+ {
+ return queryCount;
+ }
+ }
+
+ public User User
+ {
+ get { return user; }
+ protected set
+ {
+ SetProperty(ref user, value, "User");
+ if (user!=null)
+ {
+ user.PropertyChanged += User_PropertyChanged;
+
+ }
+
+ UpdateUserMeta();
+
+ }
+ }
+ private ImageSource avatar;
+ public ImageSource Avatar { get {
+ return avatar;
+ } }
+
+ public ObservableCollection Accounts { get; protected set; }
+ private string performerStatus;
+ public string PerformerStatus
+ {
+ get
+ {
+ return performerStatus;
+ }
+ }
+ string userQueries;
+ public string UserQueries
+ {
+ get
+ {
+ return userQueries;
+ }
+ }
+ public string UserName
+ {
+ get
+ {
+ return User?.UserName;
+ }
+ }
+
+ private bool userIsPro = false;
+
+ public UserProfileViewModel()
+ {
+ Accounts = MainSettings.AccountList;
+ User = MainSettings.CurrentUser;
+ UpdateUserMeta();
+ Rating = 2;
+ UserNameGesture = new RelayGesture((g, x) =>
+ {
+ if (g.GestureType == GestureType.LongPress)
+ {
+ NavigationService.NavigateTo("accountChooser");
+ }
+ });
+ MainSettings.UserChanged += MainSettings_UserChanged;
+
+ }
+
+ private void MainSettings_UserChanged(object sender, System.EventArgs e)
+ {
+ User = MainSettings.CurrentUser;
+ UpdateUserMeta();
+ }
+
+ bool haveAnUser;
+
+ public bool HaveAnUser
+ {
+ get { return User!=null; }
+ }
+
+ public bool UserIsPro
+ {
+ get { return User?.Roles?.Contains("Performer") ?? false ; }
+ }
+
+ private void UpdateUserMeta ()
+ {
+ string newStatusString;
+ long newQueryCount;
+ bool newUserIsPro;
+ ImageSource newAvatar;
+ string newQueriesButtonText;
+ bool newHaveAnUser = user == null;
+ if (newHaveAnUser) {
+ newQueryCount = 0;
+ newUserIsPro = false;
+ newStatusString = null;
+ newAvatar = null;
+ newQueriesButtonText = null;
+ }
+ else
+ {
+ newUserIsPro = UserIsPro;
+
+ newQueryCount = newUserIsPro ? DataManager.Current.BookQueries.Count : 0;
+
+ newStatusString = newUserIsPro ?
+ $"Profile professionel renseigné" :
+ "Profile professionel non renseigné";
+ newQueriesButtonText = newUserIsPro ?
+ $"{newQueryCount} demandes valides en cours" :
+ "Profile professionel non renseigné";
+ newAvatar = UserHelpers.Avatar(user.Avatar);
+ }
+ SetProperty(ref haveAnUser, newHaveAnUser, "HaveAnUser");
+ SetProperty(ref userIsPro, newUserIsPro, "UserIsPro");
+ SetProperty(ref performerStatus, newStatusString, "PerformerStatus");
+ SetProperty(ref userQueries, newQueriesButtonText, "UserQueries");
+ SetProperty(ref queryCount, newQueryCount, "QueryCount");
+ SetProperty(ref avatar, newAvatar, "Avatar");
+ }
+
+ private void User_PropertyChanged(object sender, System.ComponentModel.PropertyChangedEventArgs e)
+ {
+ UpdateUserMeta();
+ }
+
+ public RelayGesture UserNameGesture { get; set; }
+
+ }
+}
\ No newline at end of file