-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* chore: clean up plists * chore: update podfile.lock * Quick fix for spill over * Working with build settings, with some spillover * Clean up Clean up config plugins * Add withExpoExperimentalAppExtension * Revert to publish js bundle * Remove expo-constants dependency * Move appleTeamId to new place, remove from config plugin * v0.2.0 * Apply suggestions from code review Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com> --------- Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
- Loading branch information
1 parent
acc212f
commit 28cd9a1
Showing
33 changed files
with
474 additions
and
315 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
const { targets } = require("./withTargetEntitlements"); | ||
|
||
/** @type {import('@expo/config-plugins').ConfigPlugin<{ appGroup: string; }>} */ | ||
const withExpoExperimentalAppExtensionFlags = (config, props) => { | ||
config.extra = { | ||
...config.extra, | ||
eas: { | ||
...config.extra?.eas, | ||
build: { | ||
...config.extra?.eas?.build, | ||
experimental: { | ||
...config.extra?.eas?.build?.experimental, | ||
ios: { | ||
...config.extra?.eas?.build?.experimental?.ios, | ||
appExtensions: targets.map((targetName) => { | ||
return { | ||
targetName, | ||
bundleIdentifier: | ||
config.ios.bundleIdentifier + "." + targetName, | ||
entitlements: { | ||
"com.apple.developer.family-controls": true, | ||
"com.apple.security.application-groups": [props.appGroup], | ||
}, | ||
}; | ||
}), | ||
}, | ||
}, | ||
}, | ||
}, | ||
}; | ||
|
||
return config; | ||
}; | ||
|
||
module.exports = withExpoExperimentalAppExtensionFlags; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
const { withInfoPlist } = require("expo/config-plugins"); | ||
|
||
/** @type {import('@expo/config-plugins').ConfigPlugin<{ appGroup: string }>} */ | ||
const withInfoPlistAppGroup = (config) => { | ||
return withInfoPlist(config, (config) => { | ||
config.modResults.REACT_NATIVE_DEVICE_ACTIVITY_APP_GROUP = | ||
"$(REACT_NATIVE_DEVICE_ACTIVITY_APP_GROUP)"; | ||
return config; | ||
}); | ||
}; | ||
|
||
module.exports = withInfoPlistAppGroup; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
const { default: plist } = require("@expo/plist"); | ||
const fs = require("fs"); | ||
|
||
const targets = [ | ||
"ActivityMonitorExtension", | ||
"ShieldConfiguration", | ||
"ShieldAction", | ||
]; | ||
|
||
/** @type {import('@expo/config-plugins').ConfigPlugin<{ appGroup: string; }>} */ | ||
const withTargetEntitlements = (config, { appGroup }) => { | ||
const projectRoot = config._internal.projectRoot; | ||
const path = require('path'); | ||
|
||
// eslint-disable-next-line no-undef | ||
const projectTargetFolderPath = path.join(projectRoot, "targets"); | ||
// find all entitlements files in the projectTargetFolderPath | ||
const entitlementsFiles = fs | ||
.readdirSync(projectTargetFolderPath, { recursive: true }) | ||
.filter( | ||
(file) => | ||
targets.some((target) => file.startsWith(target)) && | ||
file.endsWith(".entitlements"), | ||
); | ||
|
||
for (const entitlementsFile of entitlementsFiles) { | ||
const entitlementsFilePath = | ||
projectTargetFolderPath + "/" + entitlementsFile; | ||
|
||
const entitlementsFileContents = fs.readFileSync( | ||
entitlementsFilePath, | ||
"utf8", | ||
); | ||
|
||
const parsedEntitlements = plist.parse(entitlementsFileContents); | ||
|
||
if (parsedEntitlements["com.apple.security.application-groups"]) { | ||
parsedEntitlements["com.apple.security.application-groups"] = [appGroup]; | ||
} | ||
|
||
const modifiedEntitlementsFileContents = plist.build(parsedEntitlements); | ||
|
||
fs.writeFileSync(entitlementsFilePath, modifiedEntitlementsFileContents); | ||
} | ||
|
||
return config; | ||
}; | ||
|
||
module.exports = { withTargetEntitlements, targets }; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
const { withXcodeProject } = require("@expo/config-plugins"); | ||
|
||
/** @type {import('@expo/config-plugins').ConfigPlugin<{ appGroup: string }>} */ | ||
const withXcodeSettings = (config, { appGroup }) => { | ||
return withXcodeProject(config, (newConfig) => { | ||
const xcodeProject = newConfig.modResults; | ||
|
||
const settings = { | ||
REACT_NATIVE_DEVICE_ACTIVITY_APP_GROUP: appGroup, | ||
}; | ||
|
||
const configurations = xcodeProject.pbxXCBuildConfigurationSection(); | ||
|
||
for (const key in configurations) { | ||
// could be trimmed down to main target + react-native-device-activity targets, but since it's the name is so specific this should be fine | ||
if (typeof configurations[key].buildSettings !== "undefined") { | ||
const buildSettingsObj = configurations[key].buildSettings; | ||
for (const key in settings) { | ||
buildSettingsObj[key] = settings[key]; | ||
} | ||
} | ||
} | ||
return newConfig; | ||
}); | ||
}; | ||
|
||
module.exports = withXcodeSettings; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.