Skip to content
This repository has been archived by the owner on May 15, 2024. It is now read-only.

Commit

Permalink
Merge branch 'main' into issue-1972
Browse files Browse the repository at this point in the history
  • Loading branch information
jfversluis authored Apr 5, 2022
2 parents a3006b0 + 101971f commit 1d09035
Show file tree
Hide file tree
Showing 8 changed files with 9 additions and 17 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,9 @@
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.BATTERY_STATS" />
<uses-permission android:name="android.permission.CAMERA" />
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.FLASHLIGHT" />
<uses-permission android:name="android.permission.FLASHLIGHT" />
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.VIBRATE" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.READ_CONTACTS" />
<queries>
<!-- Email -->
Expand Down
2 changes: 0 additions & 2 deletions Samples/Samples.Android/Properties/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,6 @@
<uses-permission android:name="android.permission.CAMERA" />
<uses-permission android:name="android.permission.FLASHLIGHT" />
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.VIBRATE" />
<uses-permission android:name="android.permission.READ_CONTACTS" />
<queries>
Expand Down
1 change: 1 addition & 0 deletions Xamarin.Essentials/AppActions/AppActions.android.cs
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ static AppAction ToAppAction(this ShortcutInfo shortcutInfo) =>
const string extraAppActionTitle = "EXTRA_XE_APP_ACTION_TITLE";
const string extraAppActionSubtitle = "EXTRA_XE_APP_ACTION_SUBTITLE";
const string extraAppActionIcon = "EXTRA_XE_APP_ACTION_ICON";
internal const string extraAppActionHandled = "EXTRA_XE_APP_ACTION_HANDLED";

internal static AppAction ToAppAction(this Intent intent)
=> new AppAction(
Expand Down
4 changes: 0 additions & 4 deletions Xamarin.Essentials/FilePicker/FilePicker.android.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,6 @@ public static partial class FilePicker
{
static async Task<IEnumerable<FileResult>> PlatformPickAsync(PickOptions options, bool allowMultiple = false)
{
// we only need the permission when accessing the file, but it's more natural
// to ask the user first, then show the picker.
await Permissions.EnsureGrantedAsync<Permissions.StorageRead>();

// Essentials supports >= API 19 where this action is available
var action = Intent.ActionOpenDocument;

Expand Down
4 changes: 0 additions & 4 deletions Xamarin.Essentials/MediaPicker/MediaPicker.android.cs
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,6 @@ static Task<FileResult> PlatformPickVideoAsync(MediaPickerOptions options)

static async Task<FileResult> PlatformPickAsync(MediaPickerOptions options, bool photo)
{
// We only need the permission when accessing the file, but it's more natural
// to ask the user first, then show the picker.
await Permissions.EnsureGrantedAsync<Permissions.StorageRead>();

var intent = new Intent(Intent.ActionGetContent);
intent.SetType(photo ? FileSystem.MimeTypes.ImageAll : FileSystem.MimeTypes.VideoAll);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -186,9 +186,9 @@ void LocationAuthCallback(object sender, CLAuthorizationChangedEventArgs e)
}

del.AuthorizationStatusChanged -= LocationAuthCallback;
tcs.TrySetResult(GetLocationStatus(whenInUse));
locationManager?.Dispose();
locationManager = null;
tcs.TrySetResult(GetLocationStatus(whenInUse));
}
catch (Exception ex)
{
Expand Down
4 changes: 2 additions & 2 deletions Xamarin.Essentials/PhoneDialer/PhoneDialer.ios.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,12 @@ public static partial class PhoneDialer

internal static bool IsSupported => UIApplication.SharedApplication.CanOpenUrl(CreateNsUrl(new string('0', 10)));

static async void PlatformOpen(string number)
static void PlatformOpen(string number)
{
ValidateOpen(number);

var nsUrl = CreateNsUrl(number);
await Launcher.PlatformOpenAsync(nsUrl);
Launcher.PlatformOpenAsync(nsUrl);
}

static NSUrl CreateNsUrl(string number) => new NSUrl(new Uri($"tel:{number}").AbsoluteUri);
Expand Down
5 changes: 4 additions & 1 deletion Xamarin.Essentials/Platform/Platform.android.cs
Original file line number Diff line number Diff line change
Expand Up @@ -110,8 +110,11 @@ public static void OnResume(Activity activity = null)

static void CheckAppActions(AndroidIntent intent)
{
if (intent?.Action == Intent.ActionAppAction)
if (intent?.Action == Intent.ActionAppAction && !intent.GetBooleanExtra(AppActions.extraAppActionHandled, false))
{
// prevent launch intent getting handled on activity resume
intent.PutExtra(AppActions.extraAppActionHandled, true);

var appAction = intent.ToAppAction();

if (!string.IsNullOrEmpty(appAction?.Id))
Expand Down

0 comments on commit 1d09035

Please sign in to comment.