Merge branch 'vnext' of github.com:pazof/yavsc into vnext
This commit is contained in:
commit
ca36d067de
26 changed files with 2308 additions and 2048 deletions
|
|
@ -0,0 +1,58 @@
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
|
||||||
|
using Android.App;
|
||||||
|
using Android.Content;
|
||||||
|
using Android.OS;
|
||||||
|
using Android.Runtime;
|
||||||
|
using Android.Views;
|
||||||
|
using Android.Widget;
|
||||||
|
using Android.Accounts;
|
||||||
|
|
||||||
|
namespace BookAStar.Droid.Accounts
|
||||||
|
{
|
||||||
|
class YavscAccountAuthenticator : AbstractAccountAuthenticator
|
||||||
|
{
|
||||||
|
public YavscAccountAuthenticator(Context context): base(context)
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public override Bundle AddAccount(AccountAuthenticatorResponse response, string accountType, string authTokenType, string[] requiredFeatures, Bundle options)
|
||||||
|
{
|
||||||
|
throw new NotImplementedException();
|
||||||
|
}
|
||||||
|
|
||||||
|
public override Bundle ConfirmCredentials(AccountAuthenticatorResponse response, Account account, Bundle options)
|
||||||
|
{
|
||||||
|
throw new NotImplementedException();
|
||||||
|
}
|
||||||
|
|
||||||
|
public override Bundle EditProperties(AccountAuthenticatorResponse response, string accountType)
|
||||||
|
{
|
||||||
|
throw new NotImplementedException();
|
||||||
|
}
|
||||||
|
|
||||||
|
public override Bundle GetAuthToken(AccountAuthenticatorResponse response, Account account, string authTokenType, Bundle options)
|
||||||
|
{
|
||||||
|
throw new NotImplementedException();
|
||||||
|
}
|
||||||
|
|
||||||
|
public override string GetAuthTokenLabel(string authTokenType)
|
||||||
|
{
|
||||||
|
throw new NotImplementedException();
|
||||||
|
}
|
||||||
|
|
||||||
|
public override Bundle HasFeatures(AccountAuthenticatorResponse response, Account account, string[] features)
|
||||||
|
{
|
||||||
|
throw new NotImplementedException();
|
||||||
|
}
|
||||||
|
|
||||||
|
public override Bundle UpdateCredentials(AccountAuthenticatorResponse response, Account account, string authTokenType, Bundle options)
|
||||||
|
{
|
||||||
|
throw new NotImplementedException();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -328,6 +328,7 @@
|
||||||
</Reference>
|
</Reference>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
|
<Compile Include="Accounts\YavscAccountAuthenticator.cs" />
|
||||||
<Compile Include="Helpers\Settings.cs" />
|
<Compile Include="Helpers\Settings.cs" />
|
||||||
<Compile Include="Helpers\SimpleJsonPostMethod.cs" />
|
<Compile Include="Helpers\SimpleJsonPostMethod.cs" />
|
||||||
<Compile Include="Helpers\YavscHelpers.cs" />
|
<Compile Include="Helpers\YavscHelpers.cs" />
|
||||||
|
|
@ -347,6 +348,7 @@
|
||||||
<Compile Include="Resources\Resource.Designer.cs" />
|
<Compile Include="Resources\Resource.Designer.cs" />
|
||||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||||
<Compile Include="SendFilesActivity.cs" />
|
<Compile Include="SendFilesActivity.cs" />
|
||||||
|
<Compile Include="Services\AccountChooserService.cs" />
|
||||||
<Compile Include="Services\YavscChooserTargetService.cs" />
|
<Compile Include="Services\YavscChooserTargetService.cs" />
|
||||||
<Compile Include="Services\GcmListenerService.cs" />
|
<Compile Include="Services\GcmListenerService.cs" />
|
||||||
<Compile Include="Services\GcmRegistrationIntentService.cs" />
|
<Compile Include="Services\GcmRegistrationIntentService.cs" />
|
||||||
|
|
@ -474,7 +476,9 @@
|
||||||
<SubType>Designer</SubType>
|
<SubType>Designer</SubType>
|
||||||
</AndroidResource>
|
</AndroidResource>
|
||||||
<AndroidResource Include="Resources\values\dimens.xml" />
|
<AndroidResource Include="Resources\values\dimens.xml" />
|
||||||
<AndroidResource Include="Resources\values\strings.xml" />
|
<AndroidResource Include="Resources\values\strings.xml">
|
||||||
|
<SubType>Designer</SubType>
|
||||||
|
</AndroidResource>
|
||||||
<AndroidResource Include="Resources\drawable\glyphish_07_map_marker.png" />
|
<AndroidResource Include="Resources\drawable\glyphish_07_map_marker.png" />
|
||||||
<AndroidResource Include="Resources\drawable\glyphish_13_target.png" />
|
<AndroidResource Include="Resources\drawable\glyphish_13_target.png" />
|
||||||
<AndroidResource Include="Resources\drawable\glyphish_74_location.png" />
|
<AndroidResource Include="Resources\drawable\glyphish_74_location.png" />
|
||||||
|
|
@ -499,6 +503,14 @@
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<AndroidResource Include="Resources\drawable\peer_to_peer.png" />
|
<AndroidResource Include="Resources\drawable\peer_to_peer.png" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<AndroidResource Include="Resources\xml\authenticator.xml">
|
||||||
|
<SubType>Designer</SubType>
|
||||||
|
</AndroidResource>
|
||||||
|
</ItemGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<AndroidResource Include="Resources\xml\account_preferences.xml" />
|
||||||
|
</ItemGroup>
|
||||||
<Import Project="$(MSBuildExtensionsPath)\Xamarin\Android\Xamarin.Android.CSharp.targets" />
|
<Import Project="$(MSBuildExtensionsPath)\Xamarin\Android\Xamarin.Android.CSharp.targets" />
|
||||||
<Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
|
<Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
|
|
|
||||||
|
|
@ -319,15 +319,16 @@ namespace BookAStar.Droid
|
||||||
return manager.FindAccountsForService(Constants.ApplicationName);
|
return manager.FindAccountsForService(Constants.ApplicationName);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
YaOAuth2Authenticator auth = new YaOAuth2Authenticator(
|
|
||||||
clientId: "d9be5e97-c19d-42e4-b444-0e65863b19e1",
|
|
||||||
clientSecret: "blouh",
|
|
||||||
scope: "profile",
|
|
||||||
authorizeUrl: new Uri(Constants.AuthorizeUrl),
|
|
||||||
redirectUrl: new Uri("http://dev.pschneider.fr/oauth/success"),
|
|
||||||
accessTokenUrl: new Uri("http://dev.pschneider.fr/token"));
|
|
||||||
public void AddAccount()
|
public void AddAccount()
|
||||||
{
|
{
|
||||||
|
var auth = new YaOAuth2Authenticator(
|
||||||
|
clientId: "d9be5e97-c19d-42e4-b444-0e65863b19e1",
|
||||||
|
clientSecret: "blouh",
|
||||||
|
scope: "profile",
|
||||||
|
authorizeUrl: new Uri(Constants.AuthorizeUrl),
|
||||||
|
redirectUrl: new Uri("http://dev.pschneider.fr/oauth/success"),
|
||||||
|
accessTokenUrl: new Uri("http://dev.pschneider.fr/token"));
|
||||||
Intent loginIntent = auth.GetUI(this);
|
Intent loginIntent = auth.GetUI(this);
|
||||||
var accStore = AccountStore.Create(this);
|
var accStore = AccountStore.Create(this);
|
||||||
auth.Completed += (sender, eventArgs) =>
|
auth.Completed += (sender, eventArgs) =>
|
||||||
|
|
|
||||||
|
|
@ -6,7 +6,7 @@
|
||||||
<meta-data android:name="com.google.android.gms.version" android:value="@integer/google_play_services_version" />
|
<meta-data android:name="com.google.android.gms.version" android:value="@integer/google_play_services_version" />
|
||||||
<receiver android:name="com.google.android.gms.gcm.GcmReceiver" android:exported="true" android:permission="com.google.android.c2dm.permission.SEND">
|
<receiver android:name="com.google.android.gms.gcm.GcmReceiver" android:exported="true" android:permission="com.google.android.c2dm.permission.SEND">
|
||||||
<intent-filter>
|
<intent-filter>
|
||||||
<action android:name="com.google.android.c2dm.intent.RECEIVE" />
|
<action android:name="com.google.android.c2dm.intent.RECEIVE" />
|
||||||
<action android:name="com.google.android.c2dm.intent.REGISTRATION" />
|
<action android:name="com.google.android.c2dm.intent.REGISTRATION" />
|
||||||
<category android:name="fr.pschneider.bas" />
|
<category android:name="fr.pschneider.bas" />
|
||||||
</intent-filter>
|
</intent-filter>
|
||||||
|
|
@ -30,6 +30,13 @@
|
||||||
<action android:name="android.service.chooser.ChooserTargetService" />
|
<action android:name="android.service.chooser.ChooserTargetService" />
|
||||||
</intent-filter>
|
</intent-filter>
|
||||||
</service>
|
</service>
|
||||||
|
<service android:name="fr.pschneider.bas.AccountChooserService" >
|
||||||
|
<intent-filter>
|
||||||
|
<action android:name="android.accounts.AccountAuthenticator" />
|
||||||
|
</intent-filter>
|
||||||
|
<meta-data android:name="android.accounts.AccountAuthenticator"
|
||||||
|
android:resource="@xml/authenticator" />
|
||||||
|
</service>
|
||||||
</application>
|
</application>
|
||||||
<uses-permission android:name="android.permission.INTERNET" />
|
<uses-permission android:name="android.permission.INTERNET" />
|
||||||
<uses-permission android:name="android.permission.WAVE_LOCK" />
|
<uses-permission android:name="android.permission.WAVE_LOCK" />
|
||||||
|
|
|
||||||
3791
BookAStar/BookAStar.Droid/Resources/Resource.Designer.cs
generated
3791
BookAStar/BookAStar.Droid/Resources/Resource.Designer.cs
generated
File diff suppressed because it is too large
Load diff
|
|
@ -14,5 +14,12 @@
|
||||||
<string name="url">url</string>
|
<string name="url">url</string>
|
||||||
<string name="url_hint">url_hint</string>
|
<string name="url_hint">url_hint</string>
|
||||||
<string name="picture">picture</string>
|
<string name="picture">picture</string>
|
||||||
<string name="google_app_id">325408689282</string>
|
<string name="google_app_id">325408689282</string>
|
||||||
|
<string name="pref_screen_title">Comptes Booking Star</string>
|
||||||
|
<string name="account_authenticator_label">Comptes Booking Star</string>
|
||||||
|
|
||||||
|
<string name="accounts">Comptes</string>
|
||||||
|
<string name="bookingstar_accounts_pref_screen_summary">
|
||||||
|
Préférences des comptes Booking Star
|
||||||
|
</string>
|
||||||
</resources>
|
</resources>
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,13 @@
|
||||||
|
<?xml version="1.0" encoding="utf-8" ?>
|
||||||
|
<PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android">
|
||||||
|
<PreferenceCategory android:title="@string/accounts" />
|
||||||
|
<PreferenceScreen
|
||||||
|
android:key="bookingstar_accounts_pref_screen"
|
||||||
|
android:title="@string/pref_screen_title"
|
||||||
|
android:summary="@string/bookingstar_accounts_pref_screen_summary">
|
||||||
|
<intent
|
||||||
|
android:action="bookingstar_accounts_pref_screen.ACTION"
|
||||||
|
android:targetPackage="bookingstar_accounts_pref_screen.package"
|
||||||
|
android:targetClass="bookingstar_accounts_pref_screen.class" />
|
||||||
|
</PreferenceScreen>
|
||||||
|
</PreferenceScreen>
|
||||||
|
|
@ -0,0 +1,8 @@
|
||||||
|
<?xml version="1.0" encoding="utf-8" ?>
|
||||||
|
<account-authenticator xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
android:accountType="typeOfAuthenticator"
|
||||||
|
android:icon="@drawable/icon"
|
||||||
|
android:smallIcon="@drawable/icon"
|
||||||
|
android:label="@string/account_authenticator_label"
|
||||||
|
android:accountPreferences="@xml/account_preferences"
|
||||||
|
/>
|
||||||
41
BookAStar/BookAStar.Droid/Services/AccountChooserService.cs
Normal file
41
BookAStar/BookAStar.Droid/Services/AccountChooserService.cs
Normal file
|
|
@ -0,0 +1,41 @@
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
|
||||||
|
using Android.App;
|
||||||
|
using Android.Content;
|
||||||
|
using Android.OS;
|
||||||
|
using Android.Runtime;
|
||||||
|
using Android.Views;
|
||||||
|
using Android.Widget;
|
||||||
|
using BookAStar.Droid.OAuth;
|
||||||
|
|
||||||
|
namespace BookAStar.Droid.Services
|
||||||
|
{
|
||||||
|
[Service(
|
||||||
|
Name = "fr.pschneider.bas.AccountChooserService",
|
||||||
|
Label = "Yavsc accounts service",
|
||||||
|
Icon = "@drawable/icon",
|
||||||
|
Exported = true,
|
||||||
|
Enabled = true
|
||||||
|
)]
|
||||||
|
[IntentFilter(new String[] { "android.accounts.AccountAuthenticator" })]
|
||||||
|
|
||||||
|
class AccountChooserService : Service
|
||||||
|
{
|
||||||
|
public static YaOAuth2Authenticator authenticator;
|
||||||
|
public override void OnCreate()
|
||||||
|
{
|
||||||
|
base.OnCreate();
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public override IBinder OnBind(Intent intent)
|
||||||
|
{
|
||||||
|
throw new NotImplementedException();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -67,27 +67,28 @@ 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);
|
MainSettings_UserChanged(this, null);
|
||||||
if (CrossConnectivity.Current.IsConnected)
|
|
||||||
StartHubConnection();
|
StartConnexion();
|
||||||
}
|
}
|
||||||
|
|
||||||
// omg
|
// omg
|
||||||
private void OnError(object sender, EventArgs e)
|
private void OnError(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Called on rotation after OnSuspended
|
// Called on rotation after OnSuspended
|
||||||
private void OnClosing(object sender, EventArgs e)
|
private void OnClosing(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
|
ChatHubConnection.Dispose();
|
||||||
}
|
}
|
||||||
|
|
||||||
// FIXME Never called.
|
// FIXME Never called.
|
||||||
private void OnInitialize(object sender, EventArgs e)
|
private void OnInitialize(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// called on app startup, not on rotation
|
// called on app startup, not on rotation
|
||||||
|
|
@ -106,7 +107,7 @@ namespace BookAStar
|
||||||
// Called on rotation
|
// Called on rotation
|
||||||
private void OnSuspended(object sender, EventArgs e)
|
private void OnSuspended(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
// TODO save the navigation stack
|
StopConnection();
|
||||||
int position = 0;
|
int position = 0;
|
||||||
DataManager.Instance.AppState.Clear();
|
DataManager.Instance.AppState.Clear();
|
||||||
foreach (Page page in Navigation.NavigationStack)
|
foreach (Page page in Navigation.NavigationStack)
|
||||||
|
|
@ -125,6 +126,7 @@ namespace BookAStar
|
||||||
// called on app startup, after OnStartup, not on rotation
|
// called on app startup, after OnStartup, not on rotation
|
||||||
private void OnAppResumed(object sender, EventArgs e)
|
private void OnAppResumed(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
|
StartConnexion();
|
||||||
// TODO restore the navigation stack
|
// TODO restore the navigation stack
|
||||||
base.OnResume();
|
base.OnResume();
|
||||||
foreach (var pageState in DataManager.Instance.AppState)
|
foreach (var pageState in DataManager.Instance.AppState)
|
||||||
|
|
@ -146,7 +148,7 @@ namespace BookAStar
|
||||||
// FIXME Not called?
|
// FIXME Not called?
|
||||||
private void OnRotation(object sender, EventArgs<Orientation> e)
|
private void OnRotation(object sender, EventArgs<Orientation> e)
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static GenericConfigSettingsMgr ConfigManager { protected set; get; }
|
public static GenericConfigSettingsMgr ConfigManager { protected set; get; }
|
||||||
|
|
@ -154,9 +156,6 @@ namespace BookAStar
|
||||||
private void Configure(IXFormsApp app)
|
private void Configure(IXFormsApp app)
|
||||||
{
|
{
|
||||||
ViewFactory.EnableCache = true;
|
ViewFactory.EnableCache = true;
|
||||||
ViewFactory.Register<ChatPage, ChatViewModel>(
|
|
||||||
r=> new ChatViewModel { }
|
|
||||||
);
|
|
||||||
ViewFactory.Register<DashboardPage, DashboardViewModel>(
|
ViewFactory.Register<DashboardPage, DashboardViewModel>(
|
||||||
resolver => new DashboardViewModel());
|
resolver => new DashboardViewModel());
|
||||||
ViewFactory.Register<BookQueryPage, BookQueryViewModel>();
|
ViewFactory.Register<BookQueryPage, BookQueryViewModel>();
|
||||||
|
|
@ -184,13 +183,18 @@ namespace BookAStar
|
||||||
Init();
|
Init();
|
||||||
// Builds the Main page
|
// Builds the Main page
|
||||||
BuildMainPage();
|
BuildMainPage();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
BookQueriesPage bQueriesPage;
|
BookQueriesPage bQueriesPage;
|
||||||
AccountChooserPage accChooserPage;
|
AccountChooserPage accChooserPage;
|
||||||
HomePage homePage;
|
HomePage homePage;
|
||||||
UserProfilePage userProfilePage;
|
|
||||||
|
private static UserProfilePage userProfilePage;
|
||||||
|
|
||||||
|
public static UserProfilePage UserProfilePage
|
||||||
|
{ get { return userProfilePage; } }
|
||||||
|
|
||||||
ChatPage chatPage;
|
ChatPage chatPage;
|
||||||
|
|
||||||
private void ShowPage(Page page)
|
private void ShowPage(Page page)
|
||||||
|
|
@ -207,6 +211,10 @@ namespace BookAStar
|
||||||
|
|
||||||
private void BuildMainPage()
|
private void BuildMainPage()
|
||||||
{
|
{
|
||||||
|
// TODO
|
||||||
|
// in case of App resume,
|
||||||
|
// do not create new BindingContext's,
|
||||||
|
// but use those from the AppState property
|
||||||
accChooserPage = new AccountChooserPage();
|
accChooserPage = new AccountChooserPage();
|
||||||
|
|
||||||
bQueriesPage = new BookQueriesPage
|
bQueriesPage = new BookQueriesPage
|
||||||
|
|
@ -218,6 +226,7 @@ namespace BookAStar
|
||||||
homePage = 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",
|
userProfilePage = new UserProfilePage { Title = "Profile utilisateur", Icon = "ic_corp_icon.png",
|
||||||
BindingContext = new UserProfileViewModel() };
|
BindingContext = new UserProfileViewModel() };
|
||||||
|
|
||||||
chatPage = new ChatPage
|
chatPage = new ChatPage
|
||||||
{
|
{
|
||||||
Title = "Chat",
|
Title = "Chat",
|
||||||
|
|
@ -308,7 +317,7 @@ namespace BookAStar
|
||||||
if (isConnected)
|
if (isConnected)
|
||||||
{
|
{
|
||||||
// TODO Start all cloud related stuff
|
// TODO Start all cloud related stuff
|
||||||
StartHubConnection();
|
StartConnexion();
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
@ -323,9 +332,10 @@ namespace BookAStar
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// Start the Hub connection
|
// Start the Hub connection
|
||||||
public static async void StartHubConnection ()
|
public static async void StartConnexion ()
|
||||||
{
|
{
|
||||||
try
|
if (CrossConnectivity.Current.IsConnected)
|
||||||
|
try
|
||||||
{
|
{
|
||||||
await chatHubConnection.Start();
|
await chatHubConnection.Start();
|
||||||
}
|
}
|
||||||
|
|
@ -342,6 +352,8 @@ namespace BookAStar
|
||||||
|
|
||||||
public void SetupHubConnection()
|
public void SetupHubConnection()
|
||||||
{
|
{
|
||||||
|
if (chatHubConnection != null)
|
||||||
|
chatHubConnection.Dispose();
|
||||||
chatHubConnection = new HubConnection(Constants.SignalRHubsUrl);
|
chatHubConnection = new HubConnection(Constants.SignalRHubsUrl);
|
||||||
chatHubConnection.Error += ChatHubConnection_Error;
|
chatHubConnection.Error += ChatHubConnection_Error;
|
||||||
|
|
||||||
|
|
@ -359,21 +371,31 @@ namespace BookAStar
|
||||||
DataManager.Instance.ChatUsers.OnPrivateMessage(msg);
|
DataManager.Instance.ChatUsers.OnPrivateMessage(msg);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
public static void StopConnection()
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
chatHubConnection.Stop();
|
||||||
|
}
|
||||||
|
catch (WebException)
|
||||||
|
{
|
||||||
|
// TODO use webex, set this cx down status somewhere,
|
||||||
|
// & display it & maybe try again later.
|
||||||
|
}
|
||||||
|
catch (Exception)
|
||||||
|
{
|
||||||
|
// TODO use ex
|
||||||
|
}
|
||||||
|
}
|
||||||
private void MainSettings_UserChanged(object sender, EventArgs e)
|
private void MainSettings_UserChanged(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
if (chatHubConnection != null)
|
StopConnection();
|
||||||
{
|
|
||||||
chatHubConnection.Dispose();
|
|
||||||
chatHubConnection = null;
|
|
||||||
chatHubProxy = null;
|
|
||||||
}
|
|
||||||
if (MainSettings.CurrentUser != null)
|
if (MainSettings.CurrentUser != null)
|
||||||
{
|
{
|
||||||
var token = MainSettings.CurrentUser.YavscTokens.AccessToken;
|
var token = MainSettings.CurrentUser.YavscTokens.AccessToken;
|
||||||
SetupHubConnection();
|
|
||||||
chatHubConnection.Headers.Add("Authorization", $"Bearer {token}");
|
chatHubConnection.Headers.Add("Authorization", $"Bearer {token}");
|
||||||
}
|
}
|
||||||
|
StartConnexion();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void ChatHubConnection_Error(Exception obj)
|
private void ChatHubConnection_Error(Exception obj)
|
||||||
|
|
|
||||||
|
|
@ -62,6 +62,9 @@
|
||||||
<Compile Include="Model\Settings\SignatureSettings.cs" />
|
<Compile Include="Model\Settings\SignatureSettings.cs" />
|
||||||
<Compile Include="Model\Social\Chat\ChatStatus.cs" />
|
<Compile Include="Model\Social\Chat\ChatStatus.cs" />
|
||||||
<Compile Include="Model\Social\Chat\ChatMessage.cs" />
|
<Compile Include="Model\Social\Chat\ChatMessage.cs" />
|
||||||
|
<Compile Include="Pages\ClientPages\SearchPage.xaml.cs">
|
||||||
|
<DependentUpon>SearchPage.xaml</DependentUpon>
|
||||||
|
</Compile>
|
||||||
<Compile Include="ViewModels\Messaging\ChatUserCollection.cs" />
|
<Compile Include="ViewModels\Messaging\ChatUserCollection.cs" />
|
||||||
<Compile Include="ViewModels\Messaging\ChatUserInfo.cs" />
|
<Compile Include="ViewModels\Messaging\ChatUserInfo.cs" />
|
||||||
<Compile Include="Model\Social\Chat\Connection.cs" />
|
<Compile Include="Model\Social\Chat\Connection.cs" />
|
||||||
|
|
@ -211,9 +214,6 @@
|
||||||
<Compile Include="Views\ImageButton.cs" />
|
<Compile Include="Views\ImageButton.cs" />
|
||||||
<Compile Include="Views\MarkdownView.cs" />
|
<Compile Include="Views\MarkdownView.cs" />
|
||||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||||
<Compile Include="Pages\SearchPage.xaml.cs">
|
|
||||||
<DependentUpon>SearchPage.xaml</DependentUpon>
|
|
||||||
</Compile>
|
|
||||||
<Compile Include="Pages\UserProfile\AccountChooserPage.xaml.cs">
|
<Compile Include="Pages\UserProfile\AccountChooserPage.xaml.cs">
|
||||||
<DependentUpon>AccountChooserPage.xaml</DependentUpon>
|
<DependentUpon>AccountChooserPage.xaml</DependentUpon>
|
||||||
</Compile>
|
</Compile>
|
||||||
|
|
@ -246,17 +246,12 @@
|
||||||
<Generator>MSBuild:UpdateDesignTimeXaml</Generator>
|
<Generator>MSBuild:UpdateDesignTimeXaml</Generator>
|
||||||
<SubType>Designer</SubType>
|
<SubType>Designer</SubType>
|
||||||
</EmbeddedResource>
|
</EmbeddedResource>
|
||||||
<EmbeddedResource Include="Pages\SearchPage.xaml">
|
|
||||||
<Generator>MSBuild:UpdateDesignTimeXaml</Generator>
|
|
||||||
<SubType>Designer</SubType>
|
|
||||||
</EmbeddedResource>
|
|
||||||
<EmbeddedResource Include="Pages\UserProfile\AccountChooserPage.xaml">
|
<EmbeddedResource Include="Pages\UserProfile\AccountChooserPage.xaml">
|
||||||
<Generator>MSBuild:UpdateDesignTimeXaml</Generator>
|
<Generator>MSBuild:UpdateDesignTimeXaml</Generator>
|
||||||
<SubType>Designer</SubType>
|
<SubType>Designer</SubType>
|
||||||
</EmbeddedResource>
|
</EmbeddedResource>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<Folder Include="Model\Billing\" />
|
|
||||||
<Folder Include="Model\UI\" />
|
<Folder Include="Model\UI\" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
|
|
@ -507,6 +502,12 @@
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<EmbeddedResource Include="Images\Chat\talk.png" />
|
<EmbeddedResource Include="Images\Chat\talk.png" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<EmbeddedResource Include="Pages\ClientPages\SearchPage.xaml">
|
||||||
|
<Generator>MSBuild:UpdateDesignTimeXaml</Generator>
|
||||||
|
<SubType>Designer</SubType>
|
||||||
|
</EmbeddedResource>
|
||||||
|
</ItemGroup>
|
||||||
<Import Project="$(MSBuildExtensionsPath32)\Microsoft\Portable\$(TargetFrameworkVersion)\Microsoft.Portable.CSharp.targets" />
|
<Import Project="$(MSBuildExtensionsPath32)\Microsoft\Portable\$(TargetFrameworkVersion)\Microsoft.Portable.CSharp.targets" />
|
||||||
<Import Project="..\..\packages\Xamarin.Forms.2.3.2.127\build\portable-win+net45+wp80+win81+wpa81+MonoAndroid10+MonoTouch10+Xamarin.iOS10\Xamarin.Forms.targets" Condition="Exists('..\..\packages\Xamarin.Forms.2.3.2.127\build\portable-win+net45+wp80+win81+wpa81+MonoAndroid10+MonoTouch10+Xamarin.iOS10\Xamarin.Forms.targets')" />
|
<Import Project="..\..\packages\Xamarin.Forms.2.3.2.127\build\portable-win+net45+wp80+win81+wpa81+MonoAndroid10+MonoTouch10+Xamarin.iOS10\Xamarin.Forms.targets" Condition="Exists('..\..\packages\Xamarin.Forms.2.3.2.127\build\portable-win+net45+wp80+win81+wpa81+MonoAndroid10+MonoTouch10+Xamarin.iOS10\Xamarin.Forms.targets')" />
|
||||||
<Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
|
<Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
|
||||||
|
|
|
||||||
|
|
@ -26,7 +26,6 @@ namespace BookAStar
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
public static readonly string SignInUrl = YavscHomeUrl + "/signin";
|
|
||||||
public static readonly string AuthorizeUrl = YavscHomeUrl + "/authorize";
|
public static readonly string AuthorizeUrl = YavscHomeUrl + "/authorize";
|
||||||
public static readonly string RedirectUrl = YavscHomeUrl + "/oauth/success";
|
public static readonly string RedirectUrl = YavscHomeUrl + "/oauth/success";
|
||||||
public static readonly string AccessTokenUrl = YavscHomeUrl + "/token";
|
public static readonly string AccessTokenUrl = YavscHomeUrl + "/token";
|
||||||
|
|
|
||||||
|
|
@ -47,7 +47,19 @@ namespace BookAStar.Model.Workflow
|
||||||
}
|
}
|
||||||
|
|
||||||
public string OwnerId { get; set; }
|
public string OwnerId { get; set; }
|
||||||
|
[JsonIgnore]
|
||||||
|
public ClientProviderInfo Owner
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
if (!string.IsNullOrWhiteSpace(OwnerId))
|
||||||
|
{
|
||||||
|
var dm = DataManager.Instance;
|
||||||
|
return dm.Contacts.LocalGet(OwnerId);
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
public string ClientId { get; set; }
|
public string ClientId { get; set; }
|
||||||
[JsonIgnore]
|
[JsonIgnore]
|
||||||
public BookQueryData Query
|
public BookQueryData Query
|
||||||
|
|
|
||||||
|
|
@ -9,7 +9,6 @@
|
||||||
xmlns:local="clr-namespace:BookAStar;Assembly:BookAStar"
|
xmlns:local="clr-namespace:BookAStar;Assembly:BookAStar"
|
||||||
xmlns:extensions="clr-namespace:BookAStar.Extensions;assembly=BookAStar"
|
xmlns:extensions="clr-namespace:BookAStar.Extensions;assembly=BookAStar"
|
||||||
Style="{StaticResource PageStyle}" >
|
Style="{StaticResource PageStyle}" >
|
||||||
|
|
||||||
<TabbedPage.Resources>
|
<TabbedPage.Resources>
|
||||||
<ResourceDictionary>
|
<ResourceDictionary>
|
||||||
<converters:SignalRConnectionStateToObject x:Key="cxToStyleImage" x:TypeArguments="Style">
|
<converters:SignalRConnectionStateToObject x:Key="cxToStyleImage" x:TypeArguments="Style">
|
||||||
|
|
|
||||||
|
|
@ -12,8 +12,18 @@ namespace BookAStar.Pages.Chat
|
||||||
public partial class ChatPage : TabbedPage
|
public partial class ChatPage : TabbedPage
|
||||||
{
|
{
|
||||||
public string ChatUser { get; set; }
|
public string ChatUser { get; set; }
|
||||||
|
public ChatPage(ChatViewModel model)
|
||||||
|
{
|
||||||
|
Init();
|
||||||
|
BindingContext = model;
|
||||||
|
}
|
||||||
|
|
||||||
public ChatPage()
|
public ChatPage()
|
||||||
|
{
|
||||||
|
Init();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void Init()
|
||||||
{
|
{
|
||||||
InitializeComponent();
|
InitializeComponent();
|
||||||
|
|
||||||
|
|
@ -45,7 +55,7 @@ namespace BookAStar.Pages.Chat
|
||||||
chatUserList.BindingContext = DataManager.Instance.ChatUsers;
|
chatUserList.BindingContext = DataManager.Instance.ChatUsers;
|
||||||
|
|
||||||
|
|
||||||
sendPVButton.Clicked += async (sender, args) =>
|
sendPVButton.Clicked += (sender, args) =>
|
||||||
{
|
{
|
||||||
var dest = chatUserList.SelectedUser;
|
var dest = chatUserList.SelectedUser;
|
||||||
if (dest!=null)
|
if (dest!=null)
|
||||||
|
|
@ -56,7 +66,7 @@ namespace BookAStar.Pages.Chat
|
||||||
foreach (var cx in dest.ObservableConnections)
|
foreach (var cx in dest.ObservableConnections)
|
||||||
{
|
{
|
||||||
if (cx.Connected)
|
if (cx.Connected)
|
||||||
await App.ChatHubProxy.Invoke<string>("SendPV", cx.ConnectionId, pvEntry.Text);
|
App.ChatHubProxy.Invoke<string>("SendPV", cx.ConnectionId, pvEntry.Text);
|
||||||
}
|
}
|
||||||
pvEntry.Text = null;
|
pvEntry.Text = null;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
51
BookAStar/BookAStar/Pages/ClientPages/SearchPage.xaml
Normal file
51
BookAStar/BookAStar/Pages/ClientPages/SearchPage.xaml
Normal file
|
|
@ -0,0 +1,51 @@
|
||||||
|
<?xml version="1.0" encoding="utf-8" ?>
|
||||||
|
<TabbedPage xmlns="http://xamarin.com/schemas/2014/forms"
|
||||||
|
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
|
||||||
|
x:Class="BookAStar.Pages.ClientPages.SearchPage"
|
||||||
|
xmlns:views="clr-namespace:BookAStar.Views;assembly=BookAStar"
|
||||||
|
xmlns:controls="clr-namespace:XLabs.Forms.Controls;assembly=XLabs.Forms"
|
||||||
|
xmlns:toolkit="clr-namespace:XLabs.Forms.Mvvm;assembly=XLabs.Forms"
|
||||||
|
xmlns:converters="clr-namespace:BookAStar.Converters;assembly=BookAStar"
|
||||||
|
xmlns:local="clr-namespace:BookAStar;Assembly:BookAStar"
|
||||||
|
xmlns:extensions="clr-namespace:BookAStar.Extensions;assembly=BookAStar"
|
||||||
|
|
||||||
|
Style="{StaticResource PageStyle}" >
|
||||||
|
|
||||||
|
<TabbedPage.Children>
|
||||||
|
<ContentPage Title="Une star" Icon="">
|
||||||
|
<StackLayout Orientation="Horizontal">
|
||||||
|
<Editor x:Name="search_phrase" HorizontalOptions="FillAndExpand"/>
|
||||||
|
<Button x:Name="btn_update" HorizontalOptions="End" />
|
||||||
|
</StackLayout>
|
||||||
|
<DatePicker x:Name="search_date" />
|
||||||
|
</ContentPage>
|
||||||
|
</TabbedPage.Children>
|
||||||
|
<TabbedPage.Children>
|
||||||
|
<ContentPage Title="Un DJ" Icon="">
|
||||||
|
<StackLayout Orientation="Horizontal">
|
||||||
|
<Editor x:Name="search_phrase" HorizontalOptions="FillAndExpand"/>
|
||||||
|
<Button x:Name="btn_update" HorizontalOptions="End" />
|
||||||
|
</StackLayout>
|
||||||
|
<DatePicker x:Name="search_date" />
|
||||||
|
</ContentPage>
|
||||||
|
</TabbedPage.Children>
|
||||||
|
<TabbedPage.Children>
|
||||||
|
<ContentPage Title="Un chanteur" Icon="">
|
||||||
|
<StackLayout Orientation="Horizontal">
|
||||||
|
<Editor x:Name="search_phrase" HorizontalOptions="FillAndExpand"/>
|
||||||
|
<Button x:Name="btn_update" HorizontalOptions="End" />
|
||||||
|
</StackLayout>
|
||||||
|
<DatePicker x:Name="search_date" />
|
||||||
|
</ContentPage>
|
||||||
|
</TabbedPage.Children>
|
||||||
|
<TabbedPage.Children>
|
||||||
|
<ContentPage Title="Une formation musicale" Icon="">
|
||||||
|
<StackLayout Orientation="Horizontal">
|
||||||
|
<Editor x:Name="search_phrase" HorizontalOptions="FillAndExpand"/>
|
||||||
|
<Button x:Name="btn_update" HorizontalOptions="End" />
|
||||||
|
</StackLayout>
|
||||||
|
<DatePicker x:Name="search_date" />
|
||||||
|
</ContentPage>
|
||||||
|
</TabbedPage.Children>
|
||||||
|
|
||||||
|
</TabbedPage>
|
||||||
18
BookAStar/BookAStar/Pages/ClientPages/SearchPage.xaml.cs
Normal file
18
BookAStar/BookAStar/Pages/ClientPages/SearchPage.xaml.cs
Normal file
|
|
@ -0,0 +1,18 @@
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
using Xamarin.Forms;
|
||||||
|
|
||||||
|
namespace BookAStar.Pages.ClientPages
|
||||||
|
{
|
||||||
|
public partial class SearchPage : TabbedPage
|
||||||
|
{
|
||||||
|
public SearchPage()
|
||||||
|
{
|
||||||
|
InitializeComponent();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -1,7 +1,40 @@
|
||||||
<?xml version="1.0" encoding="utf-8" ?>
|
<?xml version="1.0" encoding="utf-8" ?>
|
||||||
<ContentPage xmlns="http://xamarin.com/schemas/2014/forms"
|
<ContentPage xmlns="http://xamarin.com/schemas/2014/forms"
|
||||||
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
|
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
|
||||||
x:Class="BookAStar.Pages.EstimatesClientPage">
|
x:Class="BookAStar.Pages.EstimatesClientPage"
|
||||||
|
Style="{StaticResource PageStyle}">
|
||||||
<Label Text="{Binding MainText}" VerticalOptions="Center" HorizontalOptions="Center" />
|
|
||||||
|
<ScrollView>
|
||||||
|
<StackLayout Padding="10,10,10,10" x:Name="mainLayout">
|
||||||
|
<ListView RefreshCommand="{Binding RefreshCommand}" IsPullToRefreshEnabled="True"
|
||||||
|
ItemsSource="{Binding Estimates}" x:Name="estimates" ItemTapped="OnViewDetail" HasUnevenRows="true" RowHeight="80">
|
||||||
|
<ListView.ItemTemplate HeightRequest="80" VerticalOptions="StartAndExpand">
|
||||||
|
<DataTemplate>
|
||||||
|
<ViewCell>
|
||||||
|
<ViewCell.View>
|
||||||
|
<StackLayout Orientation="Horizontal" Padding="10,10,10,10" VerticalOptions="StartAndExpand">
|
||||||
|
<StackLayout Orientation="Vertical"
|
||||||
|
HeightRequest="80" VerticalOptions="StartAndExpand">
|
||||||
|
|
||||||
|
<StackLayout Orientation="Vertical" >
|
||||||
|
<Image Source="{Binding Owner.Avatar}" />
|
||||||
|
<Label Text="{Binding Client.UserName}"
|
||||||
|
Style="{StaticResource labelStyle}"></Label>
|
||||||
|
</StackLayout>
|
||||||
|
|
||||||
|
<Label LineBreakMode="WordWrap" Text="{Binding EventDate, StringFormat='{0:dddd d MMMM à HH:mm}'}" FontSize="12" FontFamily="Italic"/>
|
||||||
|
</StackLayout>
|
||||||
|
<StackLayout Orientation="Vertical" HorizontalOptions="FillAndExpand">
|
||||||
|
<Label LineBreakMode="WordWrap" Text="{Binding Location.Address}"/>
|
||||||
|
<Label Text="{Binding Previsionnal}"/>
|
||||||
|
<Label Text="{Binding Id}" HorizontalTextAlignment="End"/>
|
||||||
|
</StackLayout>
|
||||||
|
</StackLayout>
|
||||||
|
</ViewCell.View>
|
||||||
|
</ViewCell>
|
||||||
|
</DataTemplate>
|
||||||
|
</ListView.ItemTemplate>
|
||||||
|
</ListView>
|
||||||
|
</StackLayout>
|
||||||
|
</ScrollView>
|
||||||
</ContentPage>
|
</ContentPage>
|
||||||
|
|
@ -1,55 +0,0 @@
|
||||||
<?xml version="1.0" encoding="UTF-8"?>
|
|
||||||
<ContentPage xmlns="http://xamarin.com/schemas/2014/forms"
|
|
||||||
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
|
|
||||||
xmlns:local="clr-namespace:BookAStar;Assembly:BookAStar"
|
|
||||||
x:Class="BookAStar.SearchPage" Title="Page de recherche"
|
|
||||||
Style="{StaticResource PageStyle}">
|
|
||||||
<ContentPage.Resources>
|
|
||||||
<ResourceDictionary>
|
|
||||||
<Style TargetType="Label">
|
|
||||||
<Setter Property="Style" Value="{StaticResource ContentLabelStyle}" />
|
|
||||||
</Style>
|
|
||||||
<Style TargetType="Button">
|
|
||||||
<Setter Property="Style" Value="{StaticResource ButtonStyle}" />
|
|
||||||
</Style>
|
|
||||||
</ResourceDictionary>
|
|
||||||
</ContentPage.Resources>
|
|
||||||
<ContentPage.Content>
|
|
||||||
<StackLayout>
|
|
||||||
|
|
||||||
|
|
||||||
<StackLayout Orientation="Horizontal">
|
|
||||||
<Editor x:Name="search_phrase" HorizontalOptions="FillAndExpand"/>
|
|
||||||
<Button x:Name="btn_update" HorizontalOptions="End" />
|
|
||||||
</StackLayout>
|
|
||||||
<DatePicker x:Name="search_date" />
|
|
||||||
|
|
||||||
<ListView x:Name="list" ItemsSource="{x:Static local:Manager.Events}"
|
|
||||||
HasUnevenRows="true">
|
|
||||||
<ListView.ItemTemplate>
|
|
||||||
<DataTemplate>
|
|
||||||
<ViewCell>
|
|
||||||
<ViewCell.View>
|
|
||||||
<StackLayout Orientation="Horizontal">
|
|
||||||
<Image Source="{Binding ImgLocator}" HeightRequest="80" />
|
|
||||||
<StackLayout Orientation="Vertical">
|
|
||||||
<Label Text="{Binding Title}"/>
|
|
||||||
<StackLayout Orientation="Horizontal">
|
|
||||||
<StackLayout><Label Text="Heure:" FontAttributes="Italic" FontSize="9" />
|
|
||||||
<Label Text="{Binding StartDate, StringFormat='{0:H:mm}'}" VerticalOptions="End"/>
|
|
||||||
</StackLayout>
|
|
||||||
<StackLayout><Label Text="Lieu:" FontAttributes="Italic" FontSize="9" VerticalOptions="End"/>
|
|
||||||
<Label Text="{Binding Location.Name}"/></StackLayout>
|
|
||||||
|
|
||||||
<Label Text="{Binding Promotion}" FontSize="20" TextColor="Yellow" BackgroundColor="#102030"/>
|
|
||||||
</StackLayout>
|
|
||||||
</StackLayout>
|
|
||||||
</StackLayout>
|
|
||||||
</ViewCell.View>
|
|
||||||
</ViewCell>
|
|
||||||
</DataTemplate>
|
|
||||||
</ListView.ItemTemplate>
|
|
||||||
</ListView>
|
|
||||||
</StackLayout>
|
|
||||||
</ContentPage.Content>
|
|
||||||
</ContentPage>
|
|
||||||
|
|
@ -1,31 +0,0 @@
|
||||||
using System;
|
|
||||||
using Xamarin.Forms;
|
|
||||||
using System.Collections.ObjectModel;
|
|
||||||
using BookAStar.Model.Social;
|
|
||||||
using BookAStar.Model.Workflow.Messaging;
|
|
||||||
using BookAStar.Pages;
|
|
||||||
|
|
||||||
namespace BookAStar
|
|
||||||
{
|
|
||||||
public partial class SearchPage : ContentPage
|
|
||||||
{
|
|
||||||
public ObservableCollection<LocalizedEvent> Events { get; private set; }
|
|
||||||
public SearchPage ()
|
|
||||||
{
|
|
||||||
|
|
||||||
InitializeComponent ();
|
|
||||||
|
|
||||||
BindingContext = this;
|
|
||||||
Events = Manager.Events;
|
|
||||||
list.ItemTapped += async (object sender, ItemTappedEventArgs e) => {
|
|
||||||
await Navigation.PushAsync(new EventDetail( (YaEvent) e.Item) { Title = "Détail de la soirée" } );
|
|
||||||
};
|
|
||||||
search_date.Date = DateTime.Now;
|
|
||||||
search_date.MinimumDate = DateTime.Now;
|
|
||||||
search_phrase.Text = "Suresnes";
|
|
||||||
btn_update.Clicked += (object sender, EventArgs e) => {
|
|
||||||
//
|
|
||||||
};
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -21,7 +21,18 @@
|
||||||
<ContentPage.Content>
|
<ContentPage.Content>
|
||||||
<ScrollView>
|
<ScrollView>
|
||||||
<StackLayout BoxView.Color="{StaticResource ContentBackgroundColor}">
|
<StackLayout BoxView.Color="{StaticResource ContentBackgroundColor}">
|
||||||
<Image Source="{Binding Avatar}" HeightRequest="{StaticResource BigUserAvatarSize}" />
|
<lc:GesturesContentView>
|
||||||
|
<Image Source="{Binding Avatar}" HeightRequest="{StaticResource BigUserAvatarSize}" >
|
||||||
|
<lb:Gestures.Interests>
|
||||||
|
<lb:GestureCollection>
|
||||||
|
<lb:GestureInterest GestureType="SingleTap" GestureCommand="{Binding AvatarCommand}" GestureParameter="{Binding Ready}"/>
|
||||||
|
<lb:GestureInterest GestureType="LongPress" GestureCommand="{Binding AvatarCommand}" GestureParameter="{Binding Ready}"/>
|
||||||
|
<lb:GestureInterest GestureType="Swipe" Direction="Left" GestureCommand="{Binding AvatarCommand}" GestureParameter="{Binding Ready}"/>
|
||||||
|
<lb:GestureInterest GestureType="Swipe" Direction="Right" GestureCommand="{Binding AvatarCommand}" GestureParameter="{Binding Ready}"/>
|
||||||
|
</lb:GestureCollection>
|
||||||
|
</lb:Gestures.Interests>
|
||||||
|
</Image>
|
||||||
|
</lc:GesturesContentView>
|
||||||
<Button Text="{Binding UserName}" Clicked="OnRefreshQuery" />
|
<Button Text="{Binding UserName}" Clicked="OnRefreshQuery" />
|
||||||
|
|
||||||
<Button Text="{Binding UserFilesText}" Clicked="OnManageFiles" />
|
<Button Text="{Binding UserFilesText}" Clicked="OnManageFiles" />
|
||||||
|
|
|
||||||
|
|
@ -10,6 +10,7 @@ namespace BookAStar.Pages.UserProfile
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Net.Http;
|
using System.Net.Http;
|
||||||
using ViewModels.UserProfile;
|
using ViewModels.UserProfile;
|
||||||
|
using XLabs.Forms.Controls;
|
||||||
|
|
||||||
public partial class DashboardPage : ContentPage
|
public partial class DashboardPage : ContentPage
|
||||||
{
|
{
|
||||||
|
|
@ -26,32 +27,39 @@ namespace BookAStar.Pages.UserProfile
|
||||||
|
|
||||||
public async void OnRefreshQuery(object sender, EventArgs e)
|
public async void OnRefreshQuery(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
IsBusy = true;
|
// TODO disable the button when current user is not registered
|
||||||
using (var client = UserHelpers.CreateJsonClient())
|
if (MainSettings.CurrentUser==null)
|
||||||
|
ShowPage<AccountChooserPage>(null, true);
|
||||||
|
else
|
||||||
{
|
{
|
||||||
using (var request = new HttpRequestMessage(HttpMethod.Get, Constants.UserInfoUrl))
|
IsBusy = true;
|
||||||
|
using (var client = UserHelpers.CreateJsonClient())
|
||||||
{
|
{
|
||||||
using (var response = await client.SendAsync(request))
|
using (var request = new HttpRequestMessage(HttpMethod.Get, Constants.UserInfoUrl))
|
||||||
{
|
{
|
||||||
response.EnsureSuccessStatusCode();
|
using (var response = await client.SendAsync(request))
|
||||||
string userJson = await response.Content.ReadAsStringAsync();
|
{
|
||||||
JObject jactiveUser = JObject.Parse(userJson);
|
response.EnsureSuccessStatusCode();
|
||||||
var username = jactiveUser["UserName"].Value<string>();
|
string userJson = await response.Content.ReadAsStringAsync();
|
||||||
var roles = jactiveUser["Roles"].Values<string>().ToList();
|
JObject jactiveUser = JObject.Parse(userJson);
|
||||||
var emails = jactiveUser["EMails"].Values<string>().ToList();
|
var username = jactiveUser["UserName"].Value<string>();
|
||||||
var avatar = jactiveUser["Avatar"].Value<string>();
|
var roles = jactiveUser["Roles"].Values<string>().ToList();
|
||||||
var address = jactiveUser["Avatar"].Value<string>();
|
var emails = jactiveUser["EMails"].Values<string>().ToList();
|
||||||
var me = MainSettings.CurrentUser;
|
var avatar = jactiveUser["Avatar"].Value<string>();
|
||||||
me.Address = address;
|
var address = jactiveUser["Avatar"].Value<string>();
|
||||||
me.Avatar = avatar;
|
var me = MainSettings.CurrentUser;
|
||||||
me.EMails = emails;
|
me.Address = address;
|
||||||
me.UserName = username;
|
me.Avatar = avatar;
|
||||||
me.Roles = roles;
|
me.EMails = emails;
|
||||||
MainSettings.SaveUser(me);
|
me.UserName = username;
|
||||||
|
me.Roles = roles;
|
||||||
|
MainSettings.SaveUser(me);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
IsBusy = false;
|
||||||
}
|
}
|
||||||
IsBusy = false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void OnManageFiles(object sender, EventArgs e)
|
public void OnManageFiles(object sender, EventArgs e)
|
||||||
|
|
|
||||||
|
|
@ -93,7 +93,7 @@ namespace BookAStar.Model.Social.Chat
|
||||||
{
|
{
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
return string.Join(", ", Roles);
|
return Roles == null? "": string.Join(", ", Roles);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -151,6 +151,7 @@ namespace BookAStar.Model.Social.Chat
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[JsonIgnore]
|
||||||
public bool Unread
|
public bool Unread
|
||||||
{
|
{
|
||||||
get
|
get
|
||||||
|
|
@ -159,6 +160,8 @@ namespace BookAStar.Model.Social.Chat
|
||||||
m => !m.Read);
|
m => !m.Read);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[JsonIgnore]
|
||||||
public ImageSource MessagesBadge
|
public ImageSource MessagesBadge
|
||||||
{
|
{
|
||||||
get
|
get
|
||||||
|
|
@ -166,6 +169,7 @@ namespace BookAStar.Model.Social.Chat
|
||||||
return Unread ? ImageSource.FromResource("BookAStar.Images.Chat.talk.png") :null;
|
return Unread ? ImageSource.FromResource("BookAStar.Images.Chat.talk.png") :null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void OnConnected(string cxId)
|
public void OnConnected(string cxId)
|
||||||
{
|
{
|
||||||
// We do assume this cxId dosn't already exist in this list.
|
// We do assume this cxId dosn't already exist in this list.
|
||||||
|
|
|
||||||
|
|
@ -10,7 +10,7 @@ namespace BookAStar.ViewModels.Messaging
|
||||||
using Model.Social.Chat;
|
using Model.Social.Chat;
|
||||||
using Model.Social.Messaging;
|
using Model.Social.Messaging;
|
||||||
|
|
||||||
class ChatViewModel: ViewModel
|
public class ChatViewModel: ViewModel
|
||||||
{
|
{
|
||||||
public ObservableCollection<ChatMessage> Messages { get; set; }
|
public ObservableCollection<ChatMessage> Messages { get; set; }
|
||||||
public ObservableCollection<ChatMessage> Notifs { get; set; }
|
public ObservableCollection<ChatMessage> Notifs { get; set; }
|
||||||
|
|
|
||||||
|
|
@ -146,7 +146,7 @@ namespace BookAStar.ViewModels.UserProfile
|
||||||
{
|
{
|
||||||
if (g.GestureType == GestureType.LongPress)
|
if (g.GestureType == GestureType.LongPress)
|
||||||
{
|
{
|
||||||
Resolver.Resolve<INavigationService>().NavigateTo<AccountChooserPage>(true);
|
Navigation.PushAsync(App.UserProfilePage);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
MainSettings.UserChanged += MainSettings_UserChanged;
|
MainSettings.UserChanged += MainSettings_UserChanged;
|
||||||
|
|
@ -179,14 +179,14 @@ namespace BookAStar.ViewModels.UserProfile
|
||||||
bool newUserIsPro;
|
bool newUserIsPro;
|
||||||
ImageSource newAvatar;
|
ImageSource newAvatar;
|
||||||
string newQueriesButtonText;
|
string newQueriesButtonText;
|
||||||
bool newHaveAnUser = user == null;
|
bool userIsNull = user == null;
|
||||||
if (newHaveAnUser)
|
if (userIsNull)
|
||||||
{
|
{
|
||||||
newQueryCount = 0;
|
newQueryCount = 0;
|
||||||
newUserIsPro = false;
|
newUserIsPro = false;
|
||||||
newStatusString = null;
|
newStatusString = "no user selected";
|
||||||
newAvatar = null;
|
newAvatar = null;
|
||||||
newQueriesButtonText = null;
|
newQueriesButtonText = "no user selected";
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|
@ -202,7 +202,7 @@ namespace BookAStar.ViewModels.UserProfile
|
||||||
"Profile professionel non renseigné";
|
"Profile professionel non renseigné";
|
||||||
newAvatar = UserHelpers.Avatar(user.Avatar);
|
newAvatar = UserHelpers.Avatar(user.Avatar);
|
||||||
}
|
}
|
||||||
SetProperty<bool>(ref haveAnUser, newHaveAnUser, "HaveAnUser");
|
SetProperty<bool>(ref haveAnUser, userIsNull, "HaveAnUser");
|
||||||
SetProperty<bool>(ref userIsPro, newUserIsPro, "UserIsPro");
|
SetProperty<bool>(ref userIsPro, newUserIsPro, "UserIsPro");
|
||||||
SetProperty<string>(ref performerStatus, newStatusString, "PerformerStatus");
|
SetProperty<string>(ref performerStatus, newStatusString, "PerformerStatus");
|
||||||
SetProperty<string>(ref userQueries, newQueriesButtonText, "UserQueries");
|
SetProperty<string>(ref userQueries, newQueriesButtonText, "UserQueries");
|
||||||
|
|
@ -216,8 +216,6 @@ namespace BookAStar.ViewModels.UserProfile
|
||||||
|
|
||||||
NotifyPropertyChanged("UserName");
|
NotifyPropertyChanged("UserName");
|
||||||
NotifyPropertyChanged("UserId");
|
NotifyPropertyChanged("UserId");
|
||||||
NotifyPropertyChanged("HaveAnUser");
|
|
||||||
NotifyPropertyChanged("UserIsPro");
|
|
||||||
});
|
});
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -3,6 +3,7 @@ using System.Threading.Tasks;
|
||||||
using Microsoft.AspNet.Mvc;
|
using Microsoft.AspNet.Mvc;
|
||||||
using Microsoft.AspNet.Mvc.Rendering;
|
using Microsoft.AspNet.Mvc.Rendering;
|
||||||
using Microsoft.Data.Entity;
|
using Microsoft.Data.Entity;
|
||||||
|
using System.Collections.Generic;
|
||||||
using Yavsc.Models;
|
using Yavsc.Models;
|
||||||
using Yavsc.Models.Auth;
|
using Yavsc.Models.Auth;
|
||||||
|
|
||||||
|
|
@ -42,6 +43,7 @@ namespace Yavsc.Controllers
|
||||||
// GET: Client/Create
|
// GET: Client/Create
|
||||||
public IActionResult Create()
|
public IActionResult Create()
|
||||||
{
|
{
|
||||||
|
SetAppTypesInputValues();
|
||||||
return View();
|
return View();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -62,8 +64,7 @@ namespace Yavsc.Controllers
|
||||||
}
|
}
|
||||||
private void SetAppTypesInputValues()
|
private void SetAppTypesInputValues()
|
||||||
{
|
{
|
||||||
ViewData["Type"] =
|
IEnumerable<SelectListItem> types = new SelectListItem[] {
|
||||||
new SelectListItem[] {
|
|
||||||
new SelectListItem {
|
new SelectListItem {
|
||||||
Text = ApplicationTypes.JavaScript.ToString(),
|
Text = ApplicationTypes.JavaScript.ToString(),
|
||||||
Value = ((int) ApplicationTypes.JavaScript).ToString() },
|
Value = ((int) ApplicationTypes.JavaScript).ToString() },
|
||||||
|
|
@ -72,6 +73,7 @@ namespace Yavsc.Controllers
|
||||||
Value = ((int) ApplicationTypes.NativeConfidential).ToString()
|
Value = ((int) ApplicationTypes.NativeConfidential).ToString()
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
ViewData["Type"] = types;
|
||||||
}
|
}
|
||||||
// GET: Client/Edit/5
|
// GET: Client/Edit/5
|
||||||
public async Task<IActionResult> Edit(string id)
|
public async Task<IActionResult> Edit(string id)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue