WIP profile UX
This commit is contained in:
parent
597a7753a4
commit
2bb55330c2
5 changed files with 26 additions and 11 deletions
|
|
@ -85,8 +85,7 @@ namespace Yavsc.Helpers
|
||||||
public async Task<JsonValue> InvokeJson(object query)
|
public async Task<JsonValue> InvokeJson(object query)
|
||||||
{
|
{
|
||||||
JsonValue jsonDoc = null;
|
JsonValue jsonDoc = null;
|
||||||
try
|
|
||||||
{
|
|
||||||
using (Stream streamQuery = request.GetRequestStream())
|
using (Stream streamQuery = request.GetRequestStream())
|
||||||
{
|
{
|
||||||
using (StreamWriter writer = new StreamWriter(streamQuery))
|
using (StreamWriter writer = new StreamWriter(streamQuery))
|
||||||
|
|
@ -102,7 +101,9 @@ namespace Yavsc.Helpers
|
||||||
jsonDoc = await Task.Run(() => JsonObject.Load(stream));
|
jsonDoc = await Task.Run(() => JsonObject.Load(stream));
|
||||||
}
|
}
|
||||||
response.Close();
|
response.Close();
|
||||||
}
|
}
|
||||||
|
try
|
||||||
|
{
|
||||||
}
|
}
|
||||||
catch (WebException ex)
|
catch (WebException ex)
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -33,7 +33,6 @@ namespace BookAStar
|
||||||
public static IPlatform PlatformSpecificInstance { get; set; }
|
public static IPlatform PlatformSpecificInstance { get; set; }
|
||||||
public static string AppName { get; set; }
|
public static string AppName { get; set; }
|
||||||
|
|
||||||
|
|
||||||
[Obsolete("Instead using this, use new static properties.")]
|
[Obsolete("Instead using this, use new static properties.")]
|
||||||
public static App CurrentApp { get { return Current as App; } }
|
public static App CurrentApp { get { return Current as App; } }
|
||||||
|
|
||||||
|
|
@ -64,7 +63,7 @@ namespace BookAStar
|
||||||
MainSettings.UserChanged += MainSettings_UserChanged;
|
MainSettings.UserChanged += MainSettings_UserChanged;
|
||||||
CrossConnectivity.Current.ConnectivityChanged += (conSender, args) =>
|
CrossConnectivity.Current.ConnectivityChanged += (conSender, args) =>
|
||||||
{ App.IsConnected = args.IsConnected; };
|
{ App.IsConnected = args.IsConnected; };
|
||||||
SetupHubConnection();
|
MainSettings_UserChanged(this, null);
|
||||||
if (CrossConnectivity.Current.IsConnected)
|
if (CrossConnectivity.Current.IsConnected)
|
||||||
StartHubConnection();
|
StartHubConnection();
|
||||||
}
|
}
|
||||||
|
|
@ -341,20 +340,21 @@ namespace BookAStar
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
MainSettings_UserChanged(this, null);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void MainSettings_UserChanged(object sender, EventArgs e)
|
private void MainSettings_UserChanged(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
if (MainSettings.CurrentUser == null)
|
if (MainSettings.CurrentUser == null)
|
||||||
{
|
{
|
||||||
chatHubConnection.Headers.Clear();
|
chatHubConnection.Dispose();
|
||||||
|
chatHubConnection = null;
|
||||||
|
chatHubProxy = null;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
var token = MainSettings.CurrentUser.YavscTokens.AccessToken;
|
var token = MainSettings.CurrentUser.YavscTokens.AccessToken;
|
||||||
chatHubConnection.Headers.Add(
|
SetupHubConnection();
|
||||||
"Authorization", $"Bearer {token}");
|
chatHubConnection.Headers.Add("Authorization", $"Bearer {token}");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -18,6 +18,9 @@
|
||||||
HorizontalTextAlignment="Center"
|
HorizontalTextAlignment="Center"
|
||||||
LineBreakMode="WordWrap" XAlign="Center"
|
LineBreakMode="WordWrap" XAlign="Center"
|
||||||
></Label>
|
></Label>
|
||||||
|
<Image Source="{Binding User.AvatarSource}"></Image>
|
||||||
|
<!--
|
||||||
|
|
||||||
<controls:ImageButton
|
<controls:ImageButton
|
||||||
x:Name="AvatarButton"
|
x:Name="AvatarButton"
|
||||||
BackgroundColor="#01abdf"
|
BackgroundColor="#01abdf"
|
||||||
|
|
@ -28,7 +31,8 @@
|
||||||
Text="{Binding UserName}"
|
Text="{Binding UserName}"
|
||||||
TextColor="#ffffff"
|
TextColor="#ffffff"
|
||||||
WidthRequest="175"
|
WidthRequest="175"
|
||||||
Source="{Binding Avatar}" />
|
Source="{Binding User.AvatarSource}" />
|
||||||
|
-->
|
||||||
<StackLayout Orientation="Horizontal">
|
<StackLayout Orientation="Horizontal">
|
||||||
<Label Text="Recevoir les notifications push" StyleClass="Header" />
|
<Label Text="Recevoir les notifications push" StyleClass="Header" />
|
||||||
<Switch IsToggled="{Binding ReceivePushNotifications, Mode=TwoWay}"
|
<Switch IsToggled="{Binding ReceivePushNotifications, Mode=TwoWay}"
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,5 @@
|
||||||
|
|
||||||
|
using BookAStar.ViewModels.UserProfile;
|
||||||
using System;
|
using System;
|
||||||
|
|
||||||
using Xamarin.Forms;
|
using Xamarin.Forms;
|
||||||
|
|
@ -10,7 +11,8 @@ namespace BookAStar.Pages.UserProfile
|
||||||
public UserProfilePage()
|
public UserProfilePage()
|
||||||
{
|
{
|
||||||
InitializeComponent();
|
InitializeComponent();
|
||||||
AvatarButton.Clicked += AvatarButton_Clicked;
|
// AvatarButton.Clicked += AvatarButton_Clicked;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void AvatarButton_Clicked (object sender, EventArgs e)
|
private void AvatarButton_Clicked (object sender, EventArgs e)
|
||||||
|
|
|
||||||
|
|
@ -16,6 +16,14 @@ namespace BookAStar.ViewModels.UserProfile
|
||||||
|
|
||||||
internal class UserProfileViewModel : ViewModel
|
internal class UserProfileViewModel : ViewModel
|
||||||
{
|
{
|
||||||
|
public bool IsAPerformer
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
return User?.Roles.Contains("Performer") ?? false;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
public string UserFilesLabel
|
public string UserFilesLabel
|
||||||
{
|
{
|
||||||
get; set;
|
get; set;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue