@@ -31,31 +31,26 @@ function handleBlockedPermission(permission: string): void {
3131 const permissionName = permission . replace ( / _ I O S | _ A N D R O I D / , "" ) ;
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
6156function mapPermissionName ( permissionName : string ) : Permission | "android.permission.SCHEDULE_EXACT_ALARM" | undefined {
0 commit comments