WIP profile UX

This commit is contained in:
2016-11-21 23:43:57 +01:00
parent 1ac48b438d
commit 210ee87819
5 changed files with 26 additions and 11 deletions

View File

@ -85,8 +85,7 @@ namespace Yavsc.Helpers
public async Task<JsonValue> InvokeJson(object query)
{
JsonValue jsonDoc = null;
try
{
using (Stream streamQuery = request.GetRequestStream())
{
using (StreamWriter writer = new StreamWriter(streamQuery))
@ -102,7 +101,9 @@ namespace Yavsc.Helpers
jsonDoc = await Task.Run(() => JsonObject.Load(stream));
}
response.Close();
}
}
try
{
}
catch (WebException ex)
{

View File

@ -33,7 +33,6 @@ namespace BookAStar
public static IPlatform PlatformSpecificInstance { get; set; }
public static string AppName { get; set; }
[Obsolete("Instead using this, use new static properties.")]
public static App CurrentApp { get { return Current as App; } }
@ -64,7 +63,7 @@ namespace BookAStar
MainSettings.UserChanged += MainSettings_UserChanged;
CrossConnectivity.Current.ConnectivityChanged += (conSender, args) =>
{ App.IsConnected = args.IsConnected; };
SetupHubConnection();
MainSettings_UserChanged(this, null);
if (CrossConnectivity.Current.IsConnected)
StartHubConnection();
}
@ -341,20 +340,21 @@ namespace BookAStar
}
);
});
MainSettings_UserChanged(this, null);
}
private void MainSettings_UserChanged(object sender, EventArgs e)
{
if (MainSettings.CurrentUser == null)
{
chatHubConnection.Headers.Clear();
chatHubConnection.Dispose();
chatHubConnection = null;
chatHubProxy = null;
}
else
{
var token = MainSettings.CurrentUser.YavscTokens.AccessToken;
chatHubConnection.Headers.Add(
"Authorization", $"Bearer {token}");
SetupHubConnection();
chatHubConnection.Headers.Add("Authorization", $"Bearer {token}");
}
}

View File

@ -18,6 +18,9 @@
HorizontalTextAlignment="Center"
LineBreakMode="WordWrap" XAlign="Center"
></Label>
<Image Source="{Binding User.AvatarSource}"></Image>
<!--
<controls:ImageButton
x:Name="AvatarButton"
BackgroundColor="#01abdf"
@ -28,7 +31,8 @@
Text="{Binding UserName}"
TextColor="#ffffff"
WidthRequest="175"
Source="{Binding Avatar}" />
Source="{Binding User.AvatarSource}" />
-->
<StackLayout Orientation="Horizontal">
<Label Text="Recevoir les notifications push" StyleClass="Header" />
<Switch IsToggled="{Binding ReceivePushNotifications, Mode=TwoWay}"

View File

@ -1,4 +1,5 @@

using BookAStar.ViewModels.UserProfile;
using System;
using Xamarin.Forms;
@ -10,7 +11,8 @@ namespace BookAStar.Pages.UserProfile
public UserProfilePage()
{
InitializeComponent();
AvatarButton.Clicked += AvatarButton_Clicked;
// AvatarButton.Clicked += AvatarButton_Clicked;
}
private void AvatarButton_Clicked (object sender, EventArgs e)

View File

@ -16,6 +16,14 @@ namespace BookAStar.ViewModels.UserProfile
internal class UserProfileViewModel : ViewModel
{
public bool IsAPerformer
{
get
{
return User?.Roles.Contains("Performer") ?? false;
}
}
public string UserFilesLabel
{
get; set;