Skip to content

Commit

Permalink
.
Browse files Browse the repository at this point in the history
  • Loading branch information
mediaexplorer74 committed Feb 12, 2022
1 parent 41fccb9 commit b69c6f7
Show file tree
Hide file tree
Showing 35 changed files with 75 additions and 2,044 deletions.
40 changes: 20 additions & 20 deletions Andro2UWP/Andro2UWP.Shared/AccountSelection.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -28,21 +28,21 @@ private enum ClientType
}

// Set these values to your app's ID and return URL.
private readonly string oneDriveForBusinessClientId = "Insert your OneDrive for Business client id";
private readonly string oneDriveForBusinessReturnUrl = "http://localhost:8080";
private readonly string oneDriveForBusinessBaseUrl = "https://graph.microsoft.com/";

private readonly string oneDriveConsumerClientId = "560b76b6-f929-4200-b8b0-70892f08f94a";//"Insert your OneDrive Consumer client id";
private readonly string oneDriveConsumerReturnUrl = "msal560b76b6-f929-4200-b8b0-70892f08f94a://auth";//"https://login.live.com/oauth20_desktop.srf";
private readonly string oneDriveConsumerBaseUrl = "https://api.onedrive.com/v1.0";

private readonly string[] scopes = new string[]
{
"onedrive.readonly", // ok! //"onedrive.readwrite", //RnD
"onedrive.appfolder", // ok
"wl.signin",
"offline_access"
};
//private readonly string oneDriveForBusinessClientId = "Insert your OneDrive for Business client id";
//private readonly string oneDriveForBusinessReturnUrl = "http://localhost:8080";
//private readonly string oneDriveForBusinessBaseUrl = "https://graph.microsoft.com/";

//private readonly string oneDriveConsumerClientId = "560b76b6-f929-4200-b8b0-70892f08f94a";//"Insert your OneDrive Consumer client id";
//private readonly string oneDriveConsumerReturnUrl = "msal560b76b6-f929-4200-b8b0-70892f08f94a://auth";//"https://login.live.com/oauth20_desktop.srf";
//private readonly string oneDriveConsumerBaseUrl = "https://api.onedrive.com/v1.0";

//private readonly string[] scopes = new string[]
//{
// "onedrive.readonly", // ok! //"onedrive.readwrite", //RnD
// "onedrive.appfolder", // ok
// "wl.signin",
// "offline_access"
//};

public AccountSelectionPage()
{
Expand Down Expand Up @@ -156,10 +156,10 @@ private async void InitializeClient(ClientType clientType, RoutedEventArgs e)
#if !__ANDROID__
var msaAuthProvider = new MsaAuthenticationProvider
(
this.oneDriveConsumerClientId,
this.oneDriveConsumerReturnUrl,
this.scopes,
new CredentialVault(this.oneDriveConsumerClientId)
App.oneDriveConsumerClientId, // this.
App.oneDriveConsumerReturnUrl, // this.
App.scopes, // this.
new CredentialVault(App.oneDriveConsumerClientId) // this.
);
#else
Android.Content.Context ctxt = Android.App.Application.Context;
Expand All @@ -178,7 +178,7 @@ private async void InitializeClient(ClientType clientType, RoutedEventArgs e)

authTask = msaAuthProvider.RestoreMostRecentFromCacheOrAuthenticateUserAsync();

app.uOneDriveClient = new OneDriveClient(this.oneDriveConsumerBaseUrl, msaAuthProvider);
app.uOneDriveClient = new OneDriveClient(App.oneDriveConsumerBaseUrl, msaAuthProvider);

app.AuthProvider = msaAuthProvider; // !
}
Expand Down
39 changes: 19 additions & 20 deletions Andro2UWP/Andro2UWP.Shared/App.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -54,11 +54,17 @@ public enum ClientType

public IAuthenticationProvider AuthProvider { get; set; }

public readonly static string GoneDriveConsumerClientId = "560b76b6-f929-4200-b8b0-70892f08f94a";//"Insert your OneDrive Consumer client id";
public readonly static string GoneDriveConsumerReturnUrl = "msal560b76b6-f929-4200-b8b0-70892f08f94a://auth";//"https://login.live.com/oauth20_desktop.srf";
public readonly static string GoneDriveConsumerBaseUrl = "https://api.onedrive.com/v1.0";
public readonly static string oneDriveConsumerClientId = "560b76b6-f929-4200-b8b0-70892f08f94a";//"Insert your OneDrive Consumer client id";
//public readonly static string oneDriveConsumerClientId = "a643bcca-2548-4793-aa1c-826a430680f4";

private readonly string[] Gscopes = new string[]

public readonly static string oneDriveConsumerReturnUrl = "msal560b76b6-f929-4200-b8b0-70892f08f94a://auth";//"https://login.live.com/oauth20_desktop.srf";
//public readonly static string oneDriveConsumerReturnUrl = "msala643bcca-2548-4793-aa1c-826a430680f4://auth";


public readonly static string oneDriveConsumerBaseUrl = "https://api.onedrive.com/v1.0";

public readonly static string[] scopes = new string[]
{
"onedrive.readonly", // ok! //"onedrive.readwrite", //RnD
"onedrive.appfolder", // ok
Expand Down Expand Up @@ -197,10 +203,10 @@ public async void SighInIfNeeded(ClientType clientType, LaunchActivatedEventArgs
MsaAuthenticationProvider msaAuthProvider =
new MsaAuthenticationProvider
(
GoneDriveConsumerClientId, // this.
GoneDriveConsumerReturnUrl, // this.
Gscopes, // this.
new CredentialVault(GoneDriveConsumerClientId) //this.
oneDriveConsumerClientId,
oneDriveConsumerReturnUrl,
scopes,
new CredentialVault(oneDriveConsumerClientId)
);
#else

Expand All @@ -218,33 +224,28 @@ public async void SighInIfNeeded(ClientType clientType, LaunchActivatedEventArgs

authTask = msaAuthProvider.RestoreMostRecentFromCacheOrAuthenticateUserAsync();

// RnD
// = null;

app.uOneDriveClient =
new OneDriveClient
(
GoneDriveConsumerBaseUrl, //this.GoneDriveConsumerBaseUrl,
oneDriveConsumerBaseUrl,
msaAuthProvider
);

app.AuthProvider = msaAuthProvider; // !

app.AuthProvider = msaAuthProvider;

try
{
await authTask;

// RnD : error hadling
//app.NavigationStack.Add(new ItemModel(new Item()));

//this.Frame.Navigate(typeof(MainPage), e);

}
catch (Exception ex) //catch (ServiceException exception)
{
// Swallow the auth exception but write message for debugging.
//Debug.WriteLine(exception.Error.Message);

//RnD

Debug.WriteLine("AccountSelection - InitializeClient - exception: " + ex.Message);

// TODO : error hadling
Expand Down Expand Up @@ -435,8 +436,6 @@ public static async System.Threading.Tasks.Task<bool> EnsureOneDriveOpen(bool bM
string[] scopes = { "Files.ReadWrite" };
App.gOnedrive = new Uno.OneDrive.Connector
(
//"287faaf5-69f4-46e7-977e-1980e19790d0"
//"560b76b6-f929-4200-b8b0-70892f08f94a"
GoneDriveConsumerClientId,
scopes
);
Expand Down
32 changes: 18 additions & 14 deletions Andro2UWP/Andro2UWP.Shared/MainPage.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -69,30 +69,31 @@ private async void uiPage_Loaded(object sender, RoutedEventArgs e)

// for UWP we do not refresh - it takes a long time
// RnD: UWP refresh when app started (Main page loaded)
if (1 == 1) //(p.k.GetPlatform("android"))
if (p.k.GetPlatform("android")) // (1 == 0)
{

if (p.k.GetPlatform("uwp"))
//if (p.k.GetPlatform("uwp"))
//{
if (!await App.LoadNews(true))
{
if (!await App.LoadNews(true))
{
return;
}
return;
}

//if (!await App.initODandDict())
// return; // first of all-reading the dictionaries anew (so as not to reset the dictionary!)

//await App.WczytajNowe();
}
//}


RefreshListView(false);

}

#if NETFX_CORE

//RnD
// this is in BottomBar, which is not present outside UWP, so you can not refer to it :)
if (!p.k.IsFamilyDesktop())
if (p.k.GetPlatform("android")) //(!p.k.IsFamilyDesktop())
{
// besides the desktop does not make sense, because the OS
// and so turned off on timeout
Expand Down Expand Up @@ -743,11 +744,14 @@ private async void uiAutoRefresh_Click(object sender, RoutedEventArgs e)
if(!uiAutoRefresh.IsChecked.HasValue) return;
if(uiAutoRefresh.IsChecked.Value)
{
if(!p.k.IsFamilyDesktop())
{
p.k.DialogBox("Sorry, but this would work only on desktop"); // bez .resw, bo i tak to powinno być zablokowane
return;
}
// RnD
//if(!p.k.IsFamilyDesktop())
//{
// bez .resw, bo i tak to powinno być zablokowane...
// p.k.DialogBox("Sorry, but this would work only on desktop.");
// return;
//}

Windows.ApplicationModel.Background.SystemCondition oCondition =
new Windows.ApplicationModel.Background.SystemCondition
(Windows.ApplicationModel.Background.SystemConditionType.InternetAvailable);
Expand Down
11 changes: 7 additions & 4 deletions Andro2UWP/Andro2UWP.UWP/Andro2UWP.UWP.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
<ItemGroup>
<PackageReference Include="Microsoft.NETCore.UniversalWindowsPlatform">
<Version>6.2.2</Version>
<Version>6.2.13</Version>
</PackageReference>
<PackageReference Include="Microsoft.Extensions.Logging.Console" Version="1.1.1" />
<PackageReference Include="Microsoft.Extensions.Logging.Filter" Version="1.1.1" />
Expand All @@ -16,10 +16,13 @@
<PackageReference Include="Microsoft.OneDriveSDK.Authentication">
<Version>1.0.10</Version>
</PackageReference>
<PackageReference Include="Microsoft.UI.Xaml">
<Version>2.7.0</Version>
</PackageReference>
<PackageReference Include="Newtonsoft.Json">
<Version>13.0.1</Version>
<Version>9.0.1</Version>
</PackageReference>
<PackageReference Include="Uno.Core" Version="1.27.0" />
<PackageReference Include="Uno.Core" Version="2.4.0" />
</ItemGroup>
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
Expand All @@ -31,7 +34,7 @@
<AssemblyName>Andro2UWP</AssemblyName>
<DefaultLanguage>en-us</DefaultLanguage>
<TargetPlatformIdentifier>UAP</TargetPlatformIdentifier>
<TargetPlatformVersion>10.0.15063.0</TargetPlatformVersion>
<TargetPlatformVersion>10.0.19041.0</TargetPlatformVersion>
<TargetPlatformMinVersion>10.0.15063.0</TargetPlatformMinVersion>
<MinimumVisualStudioVersion>14</MinimumVisualStudioVersion>
<FileAlignment>512</FileAlignment>
Expand Down
2 changes: 1 addition & 1 deletion Andro2UWP/Andro2UWP.UWP/Package.appxmanifest
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<Package xmlns="http://schemas.microsoft.com/appx/manifest/foundation/windows10" xmlns:mp="http://schemas.microsoft.com/appx/2014/phone/manifest" xmlns:uap="http://schemas.microsoft.com/appx/manifest/uap/windows10" IgnorableNamespaces="uap mp">
<Identity Name="Andro2UWP1" Publisher="CN=media" Version="1.0.11.0" />
<Identity Name="Andro2UWP1" Publisher="CN=media" Version="1.0.12.0" />
<mp:PhoneIdentity PhoneProductId="d0cc5bdd-f438-4335-a112-49cb246ce412" PhonePublisherId="00000000-0000-0000-0000-000000000000" />
<Properties>
<DisplayName>Andro2UWP</DisplayName>
Expand Down
49 changes: 0 additions & 49 deletions Andro2UWP/Andro2UWP.Wasm/Andro2UWP.Wasm.csproj

This file was deleted.

Binary file removed Andro2UWP/Andro2UWP.Wasm/Assets/SplashScreen.png
Binary file not shown.
9 changes: 0 additions & 9 deletions Andro2UWP/Andro2UWP.Wasm/LinkerConfig.xml

This file was deleted.

17 changes: 0 additions & 17 deletions Andro2UWP/Andro2UWP.Wasm/Program.cs

This file was deleted.

27 changes: 0 additions & 27 deletions Andro2UWP/Andro2UWP.Wasm/Properties/launchSettings.json

This file was deleted.

10 changes: 0 additions & 10 deletions Andro2UWP/Andro2UWP.Wasm/WasmCSS/Fonts.css

This file was deleted.

7 changes: 0 additions & 7 deletions Andro2UWP/Andro2UWP.Wasm/WasmScripts/AppManifest.js

This file was deleted.

Loading

0 comments on commit b69c6f7

Please sign in to comment.