From 238fbc0ce9c918ba64cbb25a8ad781e3745d4cf8 Mon Sep 17 00:00:00 2001 From: Paul Schneider Date: Mon, 2 Jan 2017 18:51:06 +0100 Subject: [PATCH] none --- .../BookAStar.Droid/BookAStar.Droid.csproj | 2 +- BookAStar/BookAStar.Droid/MainActivity.cs | 4 +- .../OAuth2/YaOAuth2Authenticator.cs | 2 +- .../Properties/AndroidManifest.xml | 15 ++- BookAStar/BookAStar/App.xaml.cs | 25 +++- .../Behaviors/EditorMaxLengthValidator.cs | 16 ++- BookAStar/BookAStar/BookAStar.csproj | 7 +- BookAStar/BookAStar/Constants.cs | 2 +- BookAStar/BookAStar/Data/RemoteEntity.cs | 3 +- BookAStar/BookAStar/Pages/HomePage.xaml | 108 +++++++++++++++++- BookAStar/BookAStar/Pages/HomePage.xaml.cs | 48 ++++++-- .../Pages/UserProfile/DashboardPage.xaml | 4 +- .../Pages/UserProfile/UserProfilePage.xaml | 2 +- BookAStar/BookAStar/Settings/MainSettings.cs | 2 +- BookAStar/BookAStar/Strings.Designer.cs | 18 +++ BookAStar/BookAStar/Strings.resx | 6 + .../BookAStar/ViewModels/HomeViewModel.cs | 14 +++ .../Searching/SearchingAnArtistViewModel.cs | 13 +++ .../UserProfile/UserProfileViewModel.cs | 50 ++++---- Yavsc/ApiControllers/ChatApiController.cs | 14 ++- Yavsc/Models/Billing/ExceptionSIREN.cs | 2 +- Yavsc/Views/Manage/SetActivity.cshtml | 2 +- Yavsc/Views/SIRENExceptions/Edit.cshtml | 39 ------- Yavsc/Views/SIRENExceptions/Index.cshtml | 1 - Yavsc/project.json | 6 +- Yavsc/project.lock.json | 40 ++++--- 26 files changed, 313 insertions(+), 132 deletions(-) create mode 100644 BookAStar/BookAStar/ViewModels/HomeViewModel.cs create mode 100644 BookAStar/BookAStar/ViewModels/Searching/SearchingAnArtistViewModel.cs delete mode 100644 Yavsc/Views/SIRENExceptions/Edit.cshtml diff --git a/BookAStar/BookAStar.Droid/BookAStar.Droid.csproj b/BookAStar/BookAStar.Droid/BookAStar.Droid.csproj index 81697433..a1d532a7 100644 --- a/BookAStar/BookAStar.Droid/BookAStar.Droid.csproj +++ b/BookAStar/BookAStar.Droid/BookAStar.Droid.csproj @@ -31,7 +31,7 @@ full false bin\Debug\ - TRACE;DEBUG;DEV + TRACE;DEBUG prompt 0 True diff --git a/BookAStar/BookAStar.Droid/MainActivity.cs b/BookAStar/BookAStar.Droid/MainActivity.cs index f4fe972e..97d2098e 100644 --- a/BookAStar/BookAStar.Droid/MainActivity.cs +++ b/BookAStar/BookAStar.Droid/MainActivity.cs @@ -327,8 +327,8 @@ namespace BookAStar.Droid 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")); + redirectUrl: new Uri(Constants.RedirectUrl), + accessTokenUrl: new Uri(Constants.AccessTokenUrl)); Intent loginIntent = auth.GetUI(this); var accStore = AccountStore.Create(this); auth.Completed += (sender, eventArgs) => diff --git a/BookAStar/BookAStar.Droid/OAuth2/YaOAuth2Authenticator.cs b/BookAStar/BookAStar.Droid/OAuth2/YaOAuth2Authenticator.cs index 8f8fa6a0..89def904 100644 --- a/BookAStar/BookAStar.Droid/OAuth2/YaOAuth2Authenticator.cs +++ b/BookAStar/BookAStar.Droid/OAuth2/YaOAuth2Authenticator.cs @@ -368,7 +368,7 @@ public class YaOAuth2Authenticator : WebRedirectAuthenticator var query = queryValues.FormEncode(); var req = WebRequest.Create(accessTokenUrl); - // (req as HttpWebRequest).Accept = "application/json"; + (req as HttpWebRequest).Accept = "application/json"; req.Method = "POST"; var body = Encoding.UTF8.GetBytes(query); req.ContentLength = body.Length; diff --git a/BookAStar/BookAStar.Droid/Properties/AndroidManifest.xml b/BookAStar/BookAStar.Droid/Properties/AndroidManifest.xml index ff5bad8e..304d93ae 100644 --- a/BookAStar/BookAStar.Droid/Properties/AndroidManifest.xml +++ b/BookAStar/BookAStar.Droid/Properties/AndroidManifest.xml @@ -6,7 +6,7 @@ - + @@ -30,13 +30,12 @@ - - - - - - + + + + + + diff --git a/BookAStar/BookAStar/App.xaml.cs b/BookAStar/BookAStar/App.xaml.cs index 46dd40dc..6c3147c9 100644 --- a/BookAStar/BookAStar/App.xaml.cs +++ b/BookAStar/BookAStar/App.xaml.cs @@ -216,15 +216,30 @@ namespace BookAStar // but use those from the AppState property accChooserPage = new AccountChooserPage(); + var bookQueries = new BookQueriesViewModel(); + + var userprofile = new UserProfileViewModel(); + bQueriesPage = new BookQueriesPage { Title = "Demandes", Icon = "icon.png", - BindingContext = new BookQueriesViewModel() + BindingContext = bookQueries + }; + + homePage = new HomePage() { + Title = "Accueil", + Icon = "icon.png" }; + + homePage.BindingContext = new HomeViewModel { + BookQueries = bookQueries, + UserProfile = userprofile }; + + userProfilePage = new UserProfilePage { + Title = "Profile utilisateur", + Icon = "ic_corp_icon.png", + BindingContext = userprofile }; - 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 { @@ -394,6 +409,8 @@ namespace BookAStar if (MainSettings.CurrentUser != null) { var token = MainSettings.CurrentUser.YavscTokens.AccessToken; + if (chatHubConnection.Headers.ContainsKey("Authorization")) + chatHubConnection.Headers.Remove("Authorization"); chatHubConnection.Headers.Add("Authorization", $"Bearer {token}"); } StartConnexion(); diff --git a/BookAStar/BookAStar/Behaviors/EditorMaxLengthValidator.cs b/BookAStar/BookAStar/Behaviors/EditorMaxLengthValidator.cs index 8ad1ec97..57f4cab0 100644 --- a/BookAStar/BookAStar/Behaviors/EditorMaxLengthValidator.cs +++ b/BookAStar/BookAStar/Behaviors/EditorMaxLengthValidator.cs @@ -6,21 +6,26 @@ namespace BookAStar.Behaviors public class EditorMaxLengthValidator : Behavior { public static readonly BindableProperty MaxLengthProperty = - BindableProperty.Create("MaxLength", typeof(int), typeof(EditorMaxLengthValidator), 0); + BindableProperty.Create("MaxLength", typeof(int), typeof(EditorMaxLengthValidator), int.MaxValue); + public static readonly BindableProperty MinLengthProperty = BindableProperty.Create("MinLength", typeof(int), typeof(EditorMaxLengthValidator), 0); + public static readonly BindableProperty IsValidProperty = BindableProperty.Create("IsValid", typeof(bool), typeof(EditorMaxLengthValidator), false); + public static readonly BindableProperty ErrorProperty = BindableProperty.Create("Error", typeof(string), typeof(EditorMaxLengthValidator), null); + public int MaxLength { get { return (int) GetValue(MaxLengthProperty); } set { SetValue(MaxLengthProperty, value); } } + public int MinLength { - get { return (int)GetValue(MinLengthProperty); } + get { return (int) GetValue(MinLengthProperty); } set { SetValue(MinLengthProperty, value); } } @@ -30,15 +35,16 @@ namespace BookAStar.Behaviors } public bool IsValid { - get { return (bool)GetValue(IsValidProperty); } + get { return (bool) GetValue(IsValidProperty); } set { SetValue(IsValidProperty, value); } } public string Error { - get { - return (string)GetValue(ErrorProperty); + get + { + return (string) GetValue(ErrorProperty); } set { diff --git a/BookAStar/BookAStar/BookAStar.csproj b/BookAStar/BookAStar/BookAStar.csproj index 0fec5857..0e9ad990 100644 --- a/BookAStar/BookAStar/BookAStar.csproj +++ b/BookAStar/BookAStar/BookAStar.csproj @@ -22,7 +22,7 @@ full false bin\Debug\ - TRACE;DEBUG;WDEV + TRACE;DEBUG;DEV prompt 4 @@ -65,9 +65,11 @@ SearchPage.xaml + + @@ -311,6 +313,9 @@ ..\..\packages\Microsoft.Net.Http.2.2.29\lib\portable-net45+win8+wpa81\System.Net.Http.Primitives.dll True + + ..\..\..\..\..\..\..\Program Files (x86)\Reference Assemblies\Microsoft\Framework\MonoAndroid\v1.0\System.Web.Services.dll + ..\..\packages\Xamarin.Forms.2.3.2.127\lib\portable-win+net45+wp80+win81+wpa81+MonoAndroid10+MonoTouch10+Xamarin.iOS10\Xamarin.Forms.Core.dll True diff --git a/BookAStar/BookAStar/Constants.cs b/BookAStar/BookAStar/Constants.cs index c24898a5..a6bc047b 100644 --- a/BookAStar/BookAStar/Constants.cs +++ b/BookAStar/BookAStar/Constants.cs @@ -16,7 +16,7 @@ namespace BookAStar public const string YavscHomeUrl = "http://dev.pschneider.fr"; #else #if WDEV - public const string YavscHomeUrl = "http://192.168.0.39:5000"; + public const string YavscHomeUrl = "http://192.168.0.29:5000"; #else #if YAVSC public const string YavscHomeUrl = "https://yavsc.pschneider.fr"; diff --git a/BookAStar/BookAStar/Data/RemoteEntity.cs b/BookAStar/BookAStar/Data/RemoteEntity.cs index 319a94f5..b1aa9e35 100644 --- a/BookAStar/BookAStar/Data/RemoteEntity.cs +++ b/BookAStar/BookAStar/Data/RemoteEntity.cs @@ -11,6 +11,7 @@ namespace BookAStar.Data using Helpers; using System.Diagnostics; using System.Text; + using System.Web; public class RemoteEntity : LocalEntity, ICommand where K : IEquatable { @@ -95,7 +96,7 @@ namespace BookAStar.Data protected Uri GetUri(K key) { - return new Uri(ControllerUri.AbsoluteUri + "/" + key.ToString()); + return new Uri(ControllerUri.AbsoluteUri + "/" + HttpUtility.UrlEncode(key.ToString())); } public virtual async Task RemoteGet(K key) diff --git a/BookAStar/BookAStar/Pages/HomePage.xaml b/BookAStar/BookAStar/Pages/HomePage.xaml index 0e0badb7..47624f55 100644 --- a/BookAStar/BookAStar/Pages/HomePage.xaml +++ b/BookAStar/BookAStar/Pages/HomePage.xaml @@ -1,8 +1,9 @@  - + Style="{StaticResource PageStyle}" + Title="Accueil"> - \ No newline at end of file + + + + + + + + +