Skip to content

Commit

Permalink
Enable authentication on Android
Browse files Browse the repository at this point in the history
  • Loading branch information
MartinZikmund committed Nov 28, 2023
1 parent d2a0c8f commit 6231e89
Show file tree
Hide file tree
Showing 5 changed files with 30 additions and 2 deletions.
7 changes: 6 additions & 1 deletion src/app/MZikmund.Mobile/Android/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -1,4 +1,9 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android">
<application android:allowBackup="true" android:supportsRtl="true"></application>
<application android:allowBackup="true" android:supportsRtl="true"></application>
<queries>
<intent>
<action android:name="android.support.customtabs.action.CustomTabsService" />
</intent>
</queries>
</manifest>
1 change: 1 addition & 0 deletions src/app/MZikmund.Mobile/Android/Main.Android.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
using Microsoft.UI.Xaml.Media;

namespace MZikmund.Droid;

[global::Android.App.ApplicationAttribute(
Label = "@string/ApplicationName",
Icon = "@mipmap/icon",
Expand Down
7 changes: 7 additions & 0 deletions src/app/MZikmund.Mobile/Android/MainActivity.Android.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,20 @@
using Android.OS;
using Android.Views;
using Android.Widget;
using Microsoft.Identity.Client;

namespace MZikmund.Droid;

[Activity(
MainLauncher = true,
ConfigurationChanges = global::Uno.UI.ActivityHelper.AllConfigChanges,
WindowSoftInputMode = SoftInput.AdjustNothing | SoftInput.StateHidden
)]
public class MainActivity : Microsoft.UI.Xaml.ApplicationActivity
{
protected override void OnActivityResult(int requestCode, Result resultCode, Android.Content.Intent data)
{
base.OnActivityResult(requestCode, resultCode, data);
AuthenticationContinuationHelper.SetAuthenticationContinuationEventArgs(requestCode, resultCode, data);
}
}
15 changes: 15 additions & 0 deletions src/app/MZikmund.Mobile/Android/MsalActivity.Android.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
using Android.App;
using Android.Content.PM;
using Microsoft.Identity.Client;

namespace MZikmund.Droid;

[Activity(NoHistory = true, LaunchMode = LaunchMode.SingleTop, Exported = true)]
[IntentFilter(
new[] { Android.Content.Intent.ActionView },
Categories = new[] { Android.Content.Intent.CategoryDefault, Android.Content.Intent.CategoryBrowsable },
DataHost = "auth",
DataScheme = "msal7e13557a-4799-46b8-9e2b-0f31c41a051e")]
public class MsalActivity : BrowserTabActivity
{
}
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,5 @@ namespace MZikmund.ViewModels.Admin;

public class BlogPostsManagerViewModel : PageViewModel
{
public override string Title => Localizer.Instance.GetString("Posts");
public override string Title => Localizer.Instance.GetString("BlogPosts");
}

0 comments on commit 6231e89

Please sign in to comment.