Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[fix][calendar] Fix iOS 17 permissions in current module #24545

Merged
merged 13 commits into from
Sep 21, 2023
Merged
4 changes: 4 additions & 0 deletions apps/bare-expo/ios/BareExpo/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,8 @@
</dict>
<key>NSCalendarsUsageDescription</key>
<string>Allow bare-expo to access your calendar</string>
<key>NSCalendarsFullAccessUsageDescription</key>
<string>Allow bare-expo to access your calendar</string>
<key>NSCameraUsageDescription</key>
<string>Allow bare-expo to use the camera</string>
<key>NSContactsUsageDescription</key>
Expand All @@ -77,6 +79,8 @@
<string>Give bare-expo periences permission to access your photos</string>
<key>NSRemindersUsageDescription</key>
<string>Allow bare-expo to access your reminders</string>
<key>NSRemindersFullAccessUsageDescription</key>
<string>Allow bare-expo to access your reminders</string>
<key>NSUserTrackingUsageDescription</key>
<string>Allow Expo projects to use data for tracking the user or the device</string>
<key>UIBackgroundModes</key>
Expand Down
64 changes: 32 additions & 32 deletions apps/bare-expo/ios/Podfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ PODS:
- ExpoModulesCore
- EXConstants (15.1.0):
- ExpoModulesCore
- EXContacts (12.5.0):
- EXContacts (12.5.1):
- ExpoModulesCore
- EXFont (11.7.0):
- ExpoModulesCore
Expand All @@ -44,29 +44,29 @@ PODS:
- ExpoModulesCore
- RCT-Folly (= 2021.07.22.00)
- React-Core
- EXNotifications (0.24.1):
- EXNotifications (0.24.2):
- ExpoModulesCore
- EXPermissions (14.4.0):
- ExpoModulesCore
- Expo (50.0.0-alpha.4):
- Expo (50.0.0-alpha.5):
- ExpoModulesCore
- expo-dev-client (3.1.0):
- expo-dev-client (3.1.1):
- EXManifests
- expo-dev-launcher
- expo-dev-menu
- expo-dev-menu-interface
- EXUpdatesInterface
- expo-dev-launcher (3.2.0):
- expo-dev-launcher (3.2.1):
- EXManifests
- expo-dev-launcher/Main (= 3.2.0)
- expo-dev-launcher/Main (= 3.2.1)
- expo-dev-menu
- expo-dev-menu-interface
- ExpoModulesCore
- EXUpdatesInterface
- RCT-Folly (= 2021.07.22.00)
- React-Core
- React-RCTAppDelegate
- expo-dev-launcher/Main (3.2.0):
- expo-dev-launcher/Main (3.2.1):
- EXManifests
- expo-dev-launcher/Unsafe
- expo-dev-menu
Expand All @@ -76,7 +76,7 @@ PODS:
- RCT-Folly (= 2021.07.22.00)
- React-Core
- React-RCTAppDelegate
- expo-dev-launcher/Tests (3.2.0):
- expo-dev-launcher/Tests (3.2.1):
- EXManifests
- expo-dev-menu
- expo-dev-menu-interface
Expand All @@ -90,7 +90,7 @@ PODS:
- React-Core
- React-CoreModules
- React-RCTAppDelegate
- expo-dev-launcher/Unsafe (3.2.0):
- expo-dev-launcher/Unsafe (3.2.1):
- EXManifests
- expo-dev-menu
- expo-dev-menu-interface
Expand All @@ -99,42 +99,42 @@ PODS:
- RCT-Folly (= 2021.07.22.00)
- React-Core
- React-RCTAppDelegate
- expo-dev-menu (4.2.0):
- expo-dev-menu/Main (= 4.2.0)
- expo-dev-menu/ReactNativeCompatibles (= 4.2.0)
- expo-dev-menu (4.2.1):
- expo-dev-menu/Main (= 4.2.1)
- expo-dev-menu/ReactNativeCompatibles (= 4.2.1)
- RCT-Folly (= 2021.07.22.00)
- React-Core
- expo-dev-menu-interface (1.4.0)
- expo-dev-menu-interface/Tests (1.4.0):
- Nimble
- Quick
- expo-dev-menu/Main (4.2.0):
- expo-dev-menu/Main (4.2.1):
- EXManifests
- expo-dev-menu-interface
- expo-dev-menu/Vendored
- ExpoModulesCore
- RCT-Folly (= 2021.07.22.00)
- React-Core
- expo-dev-menu/ReactNativeCompatibles (4.2.0):
- expo-dev-menu/ReactNativeCompatibles (4.2.1):
- RCT-Folly (= 2021.07.22.00)
- React-Core
- expo-dev-menu/SafeAreaView (4.2.0):
- expo-dev-menu/SafeAreaView (4.2.1):
- ExpoModulesCore
- RCT-Folly (= 2021.07.22.00)
- React-Core
- expo-dev-menu/Tests (4.2.0):
- expo-dev-menu/Tests (4.2.1):
- ExpoModulesTestCore
- Nimble
- Quick
- RCT-Folly (= 2021.07.22.00)
- React-Core
- React-CoreModules
- expo-dev-menu/UITests (4.2.0):
- expo-dev-menu/UITests (4.2.1):
- RCT-Folly (= 2021.07.22.00)
- React
- React-Core
- React-CoreModules
- expo-dev-menu/Vendored (4.2.0):
- expo-dev-menu/Vendored (4.2.1):
- expo-dev-menu/SafeAreaView
- RCT-Folly (= 2021.07.22.00)
- React-Core
Expand Down Expand Up @@ -171,7 +171,7 @@ PODS:
- ReactCommon/turbomodule/core
- ExpoHaptics (12.6.0):
- ExpoModulesCore
- ExpoImage (1.5.1):
- ExpoImage (1.5.2):
- ExpoModulesCore
- SDWebImage (~> 5.17.0)
- SDWebImageAVIFCoder (~> 0.10.1)
Expand All @@ -182,7 +182,7 @@ PODS:
- ExpoModulesCore
- ExpoImagePicker (14.5.0):
- ExpoModulesCore
- ExpoInsights (0.4.0):
- ExpoInsights (0.4.1):
- EASClient
- ExpoModulesCore
- ExpoKeepAwake (12.6.0):
Expand Down Expand Up @@ -237,7 +237,7 @@ PODS:
- ExpoModulesCore
- ExpoSpeech (11.5.0):
- ExpoModulesCore
- ExpoSQLite (11.7.0):
- ExpoSQLite (11.7.1):
- ExpoModulesCore
- sqlite3 (~> 3.42.0)
- ExpoStoreReview (6.6.0):
Expand All @@ -254,7 +254,7 @@ PODS:
- ExpoModulesCore
- EXScreenCapture (5.5.0):
- ExpoModulesCore
- EXSplashScreen (0.23.0):
- EXSplashScreen (0.23.1):
- ExpoModulesCore
- RCT-Folly (= 2021.07.22.00)
- React-Core
Expand Down Expand Up @@ -1307,20 +1307,20 @@ SPEC CHECKSUMS:
EXCalendar: f4dac0aa190d359f20652659707f5cc307656b6d
EXCamera: 3302fc0e5188a47a2272a439acef7d9a5248a67c
EXConstants: 2a5b45fc0f6eccd4351349eadb0c022b735329ae
EXContacts: 921cb74db0a191e931df4a3811bcce33820e5702
EXContacts: 80f3433f7403286a87c105208348423e109ccb8d
EXFont: b5d79c5341f45b55c362e323735fe658003afc7a
EXImageLoader: 03063370bc06ea1825713d3f55fe0455f7c88d04
EXInAppPurchases: 7cb409539cf093b0f5d266f9577c984003a15f72
EXJSONUtils: b82ded3f9fed1681638c772207bb2e35651478eb
EXLocation: e5dd52bdf61ccb6153c9e46ad4cb2686c96a35f9
EXManifests: 3b001efa12886d0abc2b011bc32c4f3346b74256
EXMediaLibrary: 802eee8ef888ee16ef80f1b79005d3d611793e14
EXNotifications: 91905ba30c801a44a1c8c5531b2870d3bec0fb41
EXNotifications: f6ae23a3d89a1e2236bca9861dc9bd36b4544cda
EXPermissions: 51c6115893689c3e9787f4819aa67ceeae601038
Expo: 0ccb4f7970a51de586683f48f2e738836f66aa94
expo-dev-client: f150ac3b78ca158d2d12fafea8deb4dbe455db7e
expo-dev-launcher: 8a9124854f5b57c9f15e12edea01f0a43f0197d7
expo-dev-menu: be0dd705a5f4f33f9ed5b048c1534fb6f97903ab
Expo: 001317580dc33f3a8bdcebd50adaf7f58cc9e303
expo-dev-client: 9249b1dc8236038479779b7ea56f5c8c5472616e
expo-dev-launcher: bd6cc619cf034fd6fc1cb331ad30cbe2d5f0a773
expo-dev-menu: 09e216cbc3abc442ca6f6b9888923ad96f3f9e31
expo-dev-menu-interface: 25a94ce9bead4668f624732d1f981b1791bbe8e2
ExpoAppleAuthentication: 8c95178a99e7fdb8aea1e3f6385843708471c3df
ExpoBackgroundFetch: fed277fbbb3ed9765c7a74e17c0f7fb23efda936
Expand All @@ -1335,10 +1335,10 @@ SPEC CHECKSUMS:
ExpoFileSystem: 62cf8d5681581de1fb43b8af8ea6d7604eb786a6
ExpoGL: 6aedfc52c13c1eea5728ec4504f96580bc4dee65
ExpoHaptics: 604aca02e942d1d43c139cae7cf397b26f85476f
ExpoImage: bbd451559f49f78d858592fe1d4d74aedb3d900b
ExpoImage: 2674cbdeaf6292b065727fdeacf78104b486dc58
ExpoImageManipulator: 6d37f811d47a89afb34c0ec2521c6a6ea5f5a5be
ExpoImagePicker: 9e5c745cb3e56ee00e1cfe5d6af59caab66ecf1a
ExpoInsights: 13a962e646b6e5fd12b5251585f7f082331f9d83
ExpoInsights: 6ea24739ea011ae67d1d39380d2c5b0299442606
ExpoKeepAwake: df1cf76de3171cd57e7cc8a2547401404fcc0b31
ExpoLinearGradient: 5d18293f89c063036121281175c4653d6a7c34a2
ExpoLocalAuthentication: 2fed4b25cf8e54d36d5d1ebc9917e8325b3b5911
Expand All @@ -1356,15 +1356,15 @@ SPEC CHECKSUMS:
ExpoSharing: 5366dab0e9a270a6da3acbb1e3471d5522044baf
ExpoSMS: fbd73390bb7abf0388c8631d6b78186e1342049f
ExpoSpeech: 8a73bb7e6e84a5b5b8dbaabd5b4f287bec39bf3b
ExpoSQLite: 1b715f89f306f0f9fe4f96d0e54cc3d058d5c578
ExpoSQLite: 30654205a1c7d55209699e843390fb1290d202bc
ExpoStoreReview: 6a63b9ae177bc6b46ec1679eb800ecc8a83a649a
ExpoSystemUI: e4afa05539f42fe3be09d21a6498e5495019a5b2
ExpoTrackingTransparency: b14d3e7946b36962ee87c8656be540d60ff70c5d
ExpoVideo: d02bcd2a3afa123dc4a7edfc2d0db6cb5177bd6a
ExpoVideoThumbnails: d2ded9402b7f8ac10f148238e352eaa4026f2865
ExpoWebBrowser: 1ff7c5454410b9fbc55084bf298c5914608904d4
EXScreenCapture: 6ba7b396fd8afd19cb9a5e0ac8820188baf5415e
EXSplashScreen: f464b6f673272b7e427d3816dd7ec07e943095b3
EXSplashScreen: 02ca46718fc0d8e6c7ec16b1e93644e4008d048b
EXStructuredHeaders: b0591d7da7218124a950335b746366f0b2a90178
EXTaskManager: aae3b3c8144af1e0bfdbe8a3cc19fb116a01368d
EXUpdatesInterface: 98f69982f4b429eb62a1d99259bc980038240f27
Expand Down
2 changes: 1 addition & 1 deletion ios/Podfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -4975,7 +4975,7 @@ SPEC CHECKSUMS:
EXUpdates: a910a0b964a12f9c7a6d673bad3c5eb70249fc5e
EXUpdatesInterface: 98f69982f4b429eb62a1d99259bc980038240f27
FBAEMKit: af2972f39bb0f3f7c45998f435b007833c32ffb2
FBAudienceNetwork: 4d6223a9a88a22e9dca8c9e6c1829a8745b86228
FBAudienceNetwork: 03e273f66b70756be7d060927111af97b7641b06
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🤔

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, that happened after a rebase but not sure where it's coming from 🤔

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

updated in this commit already 94a58ec

we could confirm the 03e273f66b70756be7d060927111af97b7641b06 is correct one

FBLazyVector: 5d4a3b7f411219a45a6d952f77d2c0a6c9989da5
FBReactNativeSpec: df3315aada45b530ac36e68e3aa3197eaf61f41f
FBSDKCoreKit: 19e2e18b3be578d7a51fed8fdd8c152bef0b9511
Expand Down
2 changes: 2 additions & 0 deletions packages/expo-calendar/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@

### 🐛 Bug fixes

- On `iOS`, fix permissions error on `iOS 17`. ([#24545](https://github.com/expo/expo/pull/24545) by [@alanjhughes](https://github.com/alanjhughes))

### 💡 Others

## 12.0.0 — 2023-09-04
Expand Down
10 changes: 5 additions & 5 deletions packages/expo-calendar/ios/EXCalendar/EXCalendar.m
Original file line number Diff line number Diff line change
Expand Up @@ -773,7 +773,7 @@ - (EKEventStore *)eventStore
[EXPermissionsMethodsDelegate askForPermissionWithPermissionsManager:_permissionsManager
withRequester:[EXCalendarPermissionRequester class]
resolve:resolve
reject:reject];
reject:reject];
}

EX_EXPORT_METHOD_AS(getRemindersPermissionsAsync,
Expand All @@ -790,10 +790,10 @@ - (EKEventStore *)eventStore
requestRemindersPermissionsAsync:(EXPromiseResolveBlock)resolve
rejecter:(EXPromiseRejectBlock)reject)
{
[EXPermissionsMethodsDelegate askForPermissionWithPermissionsManager:_permissionsManager
withRequester:[EXRemindersPermissionRequester class]
resolve:resolve
reject:reject];
[EXPermissionsMethodsDelegate askForPermissionWithPermissionsManager:_permissionsManager
alanjhughes marked this conversation as resolved.
Show resolved Hide resolved
withRequester:[EXRemindersPermissionRequester class]
resolve:resolve
reject:reject];
}

#pragma mark - helpers
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,23 @@ - (NSDictionary *)getPermissions
EXPermissionStatus status;
EKAuthorizationStatus permissions;

NSString *calendarUsageDescription = [[NSBundle mainBundle] objectForInfoDictionaryKey:@"NSCalendarsUsageDescription"];
NSString *description;
if (@available(iOS 17, *)) {
description = @"NSCalendarsFullAccessUsageDescription";
} else {
description = @"NSCalendarsUsageDescription";
}

NSString *calendarUsageDescription = [[NSBundle mainBundle] objectForInfoDictionaryKey:description];

if (!calendarUsageDescription) {
EXFatal(EXErrorWithMessage(@"This app is missing NSCalendarsUsageDescription, so calendar methods will fail. Add this key to your bundle's Info.plist."));
NSString *message = [NSString stringWithFormat:@"This app is missing %@, so calendar methods will fail. Add this key to your bundle's Info.plist.", description];
EXFatal(EXErrorWithMessage(message));
permissions = EKAuthorizationStatusDenied;
} else {
permissions = [EKEventStore authorizationStatusForEntityType:EKEntityTypeEvent];
}

switch (permissions) {
case EKAuthorizationStatusAuthorized:
status = EXPermissionStatusGranted;
Expand All @@ -33,6 +43,7 @@ - (NSDictionary *)getPermissions
status = EXPermissionStatusUndetermined;
break;
}

return @{
@"status": @(status)
};
Expand All @@ -42,15 +53,26 @@ - (void)requestPermissionsWithResolver:(EXPromiseResolveBlock)resolve rejecter:(
{
EKEventStore *eventStore = [[EKEventStore alloc] init];
EX_WEAKIFY(self)
[eventStore requestAccessToEntityType:EKEntityTypeEvent completion:^(BOOL granted, NSError *error) {
EX_STRONGIFY(self)
// Error code 100 is a when the user denies permission; in that case we don't want to reject.
if (error && error.code != 100) {
reject(@"E_CALENDAR_ERROR_UNKNOWN", error.localizedDescription, error);
} else {
resolve([self getPermissions]);
}
}];
if (@available(iOS 17, *)) {
[eventStore requestFullAccessToEventsWithCompletion:^(BOOL granted, NSError * _Nullable error) {
EX_STRONGIFY(self)
if (error && error.code != 100) {
reject(@"E_CALENDAR_ERROR_UNKNOWN", error.localizedDescription, error);
} else {
resolve([self getPermissions]);
}
}];
} else {
[eventStore requestAccessToEntityType:EKEntityTypeEvent completion:^(BOOL granted, NSError *error) {
EX_STRONGIFY(self)
// Error code 100 is a when the user denies permission; in that case we don't want to reject.
if (error && error.code != 100) {
reject(@"E_CALENDAR_ERROR_UNKNOWN", error.localizedDescription, error);
} else {
resolve([self getPermissions]);
}
}];
}
}


Expand Down
Loading