Skip to content

Commit 52e5479

Browse files
author
Harun.Karahan
committed
chore: refactor
1 parent f9a8f57 commit 52e5479

File tree

1 file changed

+9
-14
lines changed

1 file changed

+9
-14
lines changed

packages/jsActions/mobile-resources-native/src/permissions/RequestGenericPermission.ts

Lines changed: 9 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -31,31 +31,26 @@ function handleBlockedPermission(permission: string): void {
3131
const permissionName = permission.replace(/_IOS|_ANDROID/, "");
3232

3333
if (permissionName === "SCHEDULE_EXACT_ALARM") {
34-
Alert.alert("", "Please allow setting alarms and reminders", [
34+
return Alert.alert("", "Please allow setting alarms and reminders", [
3535
{
3636
text: "Go to alarm settings",
3737
onPress: async () => {
38-
if (Platform.OS === "android") {
38+
const canSchedule = await canScheduleExactAlarms();
39+
if (!canSchedule) {
3940
// Check if permission is already granted
40-
const canSchedule = await canScheduleExactAlarms();
41-
if (!canSchedule) {
42-
// Open exact alarm settings - same as RNExactAlarmPermission.getPermission()
43-
await openSettings("alarms");
44-
}
45-
} else {
46-
openSettings();
41+
return openSettings("alarms");
4742
}
43+
return openSettings();
4844
},
4945
isPreferred: true
5046
},
5147
{ text: "Cancel", style: "cancel" }
5248
]);
53-
} else {
54-
Alert.alert("", `Please allow ${permissionName} access`, [
55-
{ text: "Go to settings", onPress: () => openSettings(), isPreferred: true },
56-
{ text: "Cancel", style: "cancel" }
57-
]);
5849
}
50+
return Alert.alert("", `Please allow ${permissionName} access`, [
51+
{ text: "Go to settings", onPress: () => openSettings(), isPreferred: true },
52+
{ text: "Cancel", style: "cancel" }
53+
]);
5954
}
6055

6156
function mapPermissionName(permissionName: string): Permission | "android.permission.SCHEDULE_EXACT_ALARM" | undefined {

0 commit comments

Comments
 (0)