WIP end of the day

main
Paul Schneider 9 years ago
parent f62b3d5ca6
commit 1ac48b438d
10 changed files with 367 additions and 57 deletions

@ -88,7 +88,7 @@
<SpecificVersion>False</SpecificVersion>
<HintPath>..\..\..\..\..\..\..\Program Files (x86)\Reference Assemblies\Microsoft\Framework\MonoAndroid\v7.0\Mono.Android.dll</HintPath>
</Reference>
<Reference Include="Mono.Android.Export, Version=1.0.6110.33687, Culture=neutral, PublicKeyToken=84e04ff9cfb79065, processorArchitecture=MSIL">
<Reference Include="Mono.Android.Export, Version=1.0.6149.16186, Culture=neutral, PublicKeyToken=84e04ff9cfb79065, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\..\..\..\..\..\..\Program Files (x86)\Reference Assemblies\Microsoft\Framework\MonoAndroid\v7.0\Mono.Android.Export.dll</HintPath>
</Reference>

@ -1,7 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android" android:versionCode="1" android:versionName="1.0" package="fr.pschneider.bas" android:installLocation="auto">
<uses-sdk android:minSdkVersion="15" />
<application android:allowBackup="true" android:label="Booking Star" android:icon="@drawable/icon" android:theme="@style/MainTheme">
<application android:allowBackup="true" android:label="Booking Star" android:icon="@drawable/icon" android:theme="@style/MainTheme" android:configChanges="navigation|screenLayout|orientation|screenSize|smallestScreenSize">
<meta-data android:name="com.google.android.maps.v2.API_KEY" android:value="AIzaSyBLSEDhZixwpHDsWmO2pKwgGDJReoTuQ7A" />
<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">
@ -11,13 +11,13 @@
<category android:name="fr.pschneider.bas" />
</intent-filter>
</receiver>
<activity android:name="fr.pschneider.bas.MainActivity" android:label="Book a Star">
<activity android:name="fr.pschneider.bas.MainActivity" android:label="@string/app_name">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity android:name="fr.pschneider.bas.SendFilesActivity" android:label="@string/app_name">
<activity android:name="fr.pschneider.bas.SendFilesActivity" android:label="@string/send_to_app_name">
<intent-filter>
<action android:name="android.intent.action.SEND" />
<category android:name="android.intent.category.DEFAULT" />

@ -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()
{

@ -1,6 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<string name="app_name">Booking star</string>
<string name="send_to_app_name">Vers les étoiles</string>
<string name="yavscIdentRemoved">Identification supprimée</string>
<string name="yavscAccountTypeName">Booking star</string>
<string name="cancel">Annuler</string>

@ -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<EditBillingLinePage, BillingLineViewModel>();
ViewFactory.Register<EditEstimatePage, EditEstimateViewModel>();
ViewFactory.Register<UserFiles, DirectoryInfoViewModel>();
ViewFactory.Register<UserProfilePage, UserProfileViewModel>();
ConfigManager = new GenericConfigSettingsMgr(s =>
MainSettings.AppSettings.GetValueOrDefault<string>(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<AccountChooserPage>(); }
)
() =>
{
ShowPage(userProfilePage);
} )
};
ToolbarItem tiHome = new ToolbarItem()
@ -220,8 +242,9 @@ namespace BookAStar
Text = "Accueil",
Icon = "icon.png",
Command = new Command(
() => { NavigationService.NavigateTo<ChatPage>(); }
)
() => {
ShowPage(homePage);
})
};
ToolbarItem tiPubChat= new ToolbarItem()
@ -229,7 +252,7 @@ namespace BookAStar
Text = "Chat",
Icon = "chat_icon_s.png",
Command = new Command(
() => { NavigationService.NavigateTo<ChatPage>(); }
() => { 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; }

@ -81,6 +81,7 @@
</Compile>
<Compile Include="ViewModels\Signing\EstimateSignaturePad.cs" />
<Compile Include="ViewModels\Signing\SignaturePadConfigViewModel.cs" />
<Compile Include="ViewModels\UserProfile\UserProfileViewModel.cs" />
<Compile Include="ViewModels\UserProfile\DirectoryInfoViewModel.cs" />
<Compile Include="Views\EnumPicker.cs" />
<Compile Include="Converters\BooleanToObjectConverter.cs" />
@ -249,7 +250,7 @@
<Private>True</Private>
</Reference>
<Reference Include="Mono.Android">
<HintPath>..\..\..\..\..\..\..\..\Program Files (x86)\Reference Assemblies\Microsoft\Framework\MonoAndroid\v6.0\Mono.Android.dll</HintPath>
<HintPath>..\..\..\..\..\..\..\Program Files (x86)\Reference Assemblies\Microsoft\Framework\MonoAndroid\v7.0\Mono.Android.dll</HintPath>
</Reference>
<Reference Include="Newtonsoft.Json">
<HintPath>..\..\packages\Newtonsoft.Json.9.0.1\lib\portable-net45+wp80+win8+wpa81\Newtonsoft.Json.dll</HintPath>

@ -34,6 +34,7 @@
<Button Text="{Binding PerformerStatus}" Clicked="OnViewPerformerStatus" />
<Button Text="{Binding UserQueries}" Clicked="OnViewUserQueries"
VisualElement.IsVisible="{Binding UserIsPro}"/>
<Button Text="{Binding UserFilesLabel}" Clicked="OnManageFiles" />
<StackLayout Orientation="Horizontal" VisualElement.IsVisible="{Binding HaveAnUser}">
<Label Text="Recevoir les notifications push" StyleClass="Header" />

@ -1,7 +1,55 @@
<?xml version="1.0" encoding="utf-8" ?>
<ContentPage xmlns="http://xamarin.com/schemas/2014/forms"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
x:Class="BookAStar.Pages.UserProfile.UserProfilePage">
<Label Text="{Binding UserName}" VerticalOptions="Center" HorizontalOptions="Center" />
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}">
<ScrollView>
<StackLayout BoxView.Color="{StaticResource ContentBackgroundColor}" Spacing="10,10,10,10" >
<StackLayout VisualElement.IsVisible="{Binding HaveAnUser}">
<Label Text="{Binding UserName}" Style="{StaticResource LabelPageHeadingStyle}"
HorizontalTextAlignment="Center"
LineBreakMode="WordWrap" XAlign="Center"
></Label>
<controls:ImageButton
x:Name="AvatarButton"
BackgroundColor="#01abdf"
HeightRequest="75"
ImageHeightRequest="50"
ImageWidthRequest="50"
Orientation="ImageToLeft"
Text="{Binding UserName}"
TextColor="#ffffff"
WidthRequest="175"
Source="{Binding Avatar}" />
<StackLayout Orientation="Horizontal">
<Label Text="Recevoir les notifications push" StyleClass="Header" />
<Switch IsToggled="{Binding ReceivePushNotifications, Mode=TwoWay}"
HorizontalOptions="End" />
</StackLayout>
<StackLayout Orientation="Horizontal">
<Label Text="Utiliser ma position" StyleClass="Header" />
<Switch HorizontalOptions="End" IsToggled="{Binding AllowUseMyPosition, Mode=TwoWay}"/>
</StackLayout>
<StackLayout VisualElement.IsVisible="{Binding IsAPerformer}">
<StackLayout Orientation="Horizontal" VerticalOptions="Start"
VisualElement.IsVisible="{Binding UserIsPro}" >
<Label Text="Ne recevoir de demande de devis que de la part de professionnels uniquement" />
<Switch HorizontalOptions="End" IsToggled="{Binding AllowProBookingOnly, Mode=TwoWay}"/>
</StackLayout>
<Button Text="{Binding PerformerStatus}" Clicked="OnViewPerformerStatus" />
</StackLayout>
</StackLayout>
</StackLayout>
</ScrollView>
</ContentPage>

@ -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<UserFiles>(null, true);
}
public void OnViewPerformerStatus(object sender, EventArgs e)
{
ShowPage<AccountChooserPage>(null, true);
}
private void ShowPage<T>(object[] args, bool animate = false) where T : Page
{
App.NavigationService.NavigateTo<T>(animate, args);
App.MasterPresented = false;
}
}
}

@ -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<int>(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<User>(ref user, value, "User");
if (user!=null)
{
user.PropertyChanged += User_PropertyChanged;
}
UpdateUserMeta();
}
}
private ImageSource avatar;
public ImageSource Avatar { get {
return avatar;
} }
public ObservableCollection<User> 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<bool>(ref haveAnUser, newHaveAnUser, "HaveAnUser");
SetProperty<bool>(ref userIsPro, newUserIsPro, "UserIsPro");
SetProperty<string>(ref performerStatus, newStatusString, "PerformerStatus");
SetProperty<string>(ref userQueries, newQueriesButtonText, "UserQueries");
SetProperty<long>(ref queryCount, newQueryCount, "QueryCount");
SetProperty<ImageSource>(ref avatar, newAvatar, "Avatar");
}
private void User_PropertyChanged(object sender, System.ComponentModel.PropertyChangedEventArgs e)
{
UpdateUserMeta();
}
public RelayGesture UserNameGesture { get; set; }
}
}
Loading…