Skip to content

Commit

Permalink
Support Expo SDK 45: cpp AppDelegate.mm
Browse files Browse the repository at this point in the history
  • Loading branch information
amit-kremer93 committed May 15, 2022
1 parent 2e5ae8f commit b092a58
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions expo/withAppsFlyerIos.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,27 +13,27 @@ function modifyAppDelegate(appDelegate) {
if (!appDelegate.includes(RNAPPSFLYER_IMPORT)) {
appDelegate = RNAPPSFLYER_IMPORT + appDelegate;
}
if (appDelegate.includes(RNAPPSFLYER_CONTINUE_USER_ACTIVITY_IDENTIFIER)) {
if (appDelegate.includes(RNAPPSFLYER_CONTINUE_USER_ACTIVITY_IDENTIFIER) && !appDelegate.includes(RNAPPSFLYER_CONTINUE_USER_ACTIVITY_CODE)) {
const block = RNAPPSFLYER_CONTINUE_USER_ACTIVITY_IDENTIFIER + '\n' + RNAPPSFLYER_CONTINUE_USER_ACTIVITY_CODE;
appDelegate = appDelegate.replace(RNAPPSFLYER_CONTINUE_USER_ACTIVITY_IDENTIFIER, block);
} else {
throw new Error('Failed to detect continueUserActivity in AppDelegate.m');
WarningAggregator.addWarningIOS('withAppsFlyerAppDelegate', "Failed to detect continueUserActivity in AppDelegate or AppsFlyer's delegate method already exists");
}
if (appDelegate.includes(RNAPPSFLYER_OPENURL_IDENTIFIER)) {
if (appDelegate.includes(RNAPPSFLYER_OPENURL_IDENTIFIER) && !appDelegate.includes(RNAPPSFLYER_OPENURL_CODE)) {
const block = RNAPPSFLYER_OPENURL_IDENTIFIER + '\n' + RNAPPSFLYER_OPENURL_CODE;
appDelegate = appDelegate.replace(RNAPPSFLYER_OPENURL_IDENTIFIER, block);
} else {
throw new Error('Failed to detect openURL in AppDelegate.m');
WarningAggregator.addWarningIOS('withAppsFlyerAppDelegate', "Failed to detect openURL in AppDelegate or AppsFlyer's delegate method already exists");
}
return appDelegate;
}

function withAppsFlyerAppDelegate(config) {
return withAppDelegate(config, (config) => {
if (config.modResults.language === 'objc') {
if (['objc', 'objcpp'].includes(config.modResults.language)) {
config.modResults.contents = modifyAppDelegate(config.modResults.contents);
} else {
WarningAggregator.addWarningIOS('withAppsFlyerAppDelegate', 'Swift AppDelegate files are not supported yet.');
WarningAggregator.addWarningIOS('withAppsFlyerAppDelegate', `${config.modResults.language} AppDelegate file is not supported yet`);
}
return config;
});
Expand Down

0 comments on commit b092a58

Please sign in to comment.