From 83495c2f004b5aaa5fca000f44594821848d02ec Mon Sep 17 00:00:00 2001 From: HavenDV Date: Fri, 16 Feb 2024 16:45:49 +0400 Subject: [PATCH] feat: Added Options.DefaultRequestCode. --- src/libs/Directory.Build.props | 2 +- .../AndroidInAppUpdatesOptions.cs | 9 +++++++-- .../Platforms/Android/Handler.cs | 6 +++--- 3 files changed, 11 insertions(+), 6 deletions(-) diff --git a/src/libs/Directory.Build.props b/src/libs/Directory.Build.props index dae8748..f4fd889 100755 --- a/src/libs/Directory.Build.props +++ b/src/libs/Directory.Build.props @@ -9,7 +9,7 @@ - 1.0.1 + 1.0.2 true true Oscore diff --git a/src/libs/Maui.Android.InAppUpdates/AndroidInAppUpdatesOptions.cs b/src/libs/Maui.Android.InAppUpdates/AndroidInAppUpdatesOptions.cs index 5ab0ad1..e262cdb 100644 --- a/src/libs/Maui.Android.InAppUpdates/AndroidInAppUpdatesOptions.cs +++ b/src/libs/Maui.Android.InAppUpdates/AndroidInAppUpdatesOptions.cs @@ -5,9 +5,14 @@ namespace Maui.Android.InAppUpdates; /// public class AndroidInAppUpdatesOptions { + /// + /// This value is used to differentiate between multiple update or request processes within your app. + /// + public const int DefaultRequestCode = 4711; + /// /// Show the download progress.
- /// Default is true.
+ /// Default is false.
///
public bool ShowDownload { get; set; } @@ -26,7 +31,7 @@ public class AndroidInAppUpdatesOptions /// This value is used to differentiate between multiple update or request processes within your app.
/// To avoid intersection with other libraries or request codes, choose a unique value within your application context. /// - public int UpdateRequestId { get; set; } = 4711; + public int RequestCode { get; set; } = DefaultRequestCode; /// /// This action will be triggered when the app is updated.
diff --git a/src/libs/Maui.Android.InAppUpdates/Platforms/Android/Handler.cs b/src/libs/Maui.Android.InAppUpdates/Platforms/Android/Handler.cs index d091b92..889acec 100644 --- a/src/libs/Maui.Android.InAppUpdates/Platforms/Android/Handler.cs +++ b/src/libs/Maui.Android.InAppUpdates/Platforms/Android/Handler.cs @@ -43,7 +43,7 @@ public static void HandleCreate(Activity activity, Bundle? savedInstanceState) AppUpdateSuccessListener ??= new AppUpdateSuccessListener( appUpdateManager: AppUpdateManager, activity: activity, - updateRequest: Options.UpdateRequestId); + updateRequest: Options.RequestCode); AppUpdateManager.AppUpdateInfo.AddOnSuccessListener(AppUpdateSuccessListener); } @@ -61,7 +61,7 @@ public static void HandleResume(Activity activity) ResumeSuccessListener ??= new ResumeSuccessListener( appUpdateManager: AppUpdateManager, activity: activity, - updateRequest: Options.UpdateRequestId); + updateRequest: Options.RequestCode); AppUpdateManager.AppUpdateInfo.AddOnSuccessListener(ResumeSuccessListener); } @@ -78,7 +78,7 @@ public static void HandleActivityResult( [GeneratedEnum] Result resultCode, Intent? data) { - if (requestCode != Options.UpdateRequestId) + if (requestCode != Options.RequestCode) { return; }