WIP
This commit is contained in:
parent
1279363a94
commit
3dd0f0553e
24 changed files with 2267 additions and 2014 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>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="Accounts\YavscAccountAuthenticator.cs" />
|
||||
<Compile Include="Helpers\Settings.cs" />
|
||||
<Compile Include="Helpers\SimpleJsonPostMethod.cs" />
|
||||
<Compile Include="Helpers\YavscHelpers.cs" />
|
||||
|
|
@ -347,6 +348,7 @@
|
|||
<Compile Include="Resources\Resource.Designer.cs" />
|
||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||
<Compile Include="SendFilesActivity.cs" />
|
||||
<Compile Include="Services\AccountChooserService.cs" />
|
||||
<Compile Include="Services\YavscChooserTargetService.cs" />
|
||||
<Compile Include="Services\GcmListenerService.cs" />
|
||||
<Compile Include="Services\GcmRegistrationIntentService.cs" />
|
||||
|
|
@ -474,7 +476,9 @@
|
|||
<SubType>Designer</SubType>
|
||||
</AndroidResource>
|
||||
<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_13_target.png" />
|
||||
<AndroidResource Include="Resources\drawable\glyphish_74_location.png" />
|
||||
|
|
@ -499,6 +503,14 @@
|
|||
<ItemGroup>
|
||||
<AndroidResource Include="Resources\drawable\peer_to_peer.png" />
|
||||
</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" />
|
||||
<Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
|
||||
<PropertyGroup>
|
||||
|
|
|
|||
|
|
@ -319,15 +319,16 @@ namespace BookAStar.Droid
|
|||
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()
|
||||
{
|
||||
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);
|
||||
var accStore = AccountStore.Create(this);
|
||||
auth.Completed += (sender, eventArgs) =>
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@
|
|||
<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">
|
||||
<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" />
|
||||
<category android:name="fr.pschneider.bas" />
|
||||
</intent-filter>
|
||||
|
|
@ -30,6 +30,13 @@
|
|||
<action android:name="android.service.chooser.ChooserTargetService" />
|
||||
</intent-filter>
|
||||
</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>
|
||||
<uses-permission android:name="android.permission.INTERNET" />
|
||||
<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_hint">url_hint</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>
|
||||
|
|
|
|||
|
|
@ -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();
|
||||
}
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue