@@ -97,10 +97,10 @@ function addPod(source) {
9797 if ( ! next . includes ( "pod 'DouyinOpenSDK'" ) ) {
9898 next = next . replace ( / u s e _ e x p o _ m o d u l e s ! \n / , "use_expo_modules!\n pod 'DouyinOpenSDK'\n" ) ;
9999 }
100- return addIOSSimulatorPodPatch ( next ) ;
100+ return addIOSPodPatches ( next ) ;
101101}
102102
103- function addIOSSimulatorPodPatch ( source ) {
103+ function addIOSPodPatches ( source ) {
104104 const helperName = 'patch_douyin_ios_simulator_linkage' ;
105105 const helper = `def ${ helperName } (installer)
106106 installer.aggregate_targets.each do |aggregate_target|
@@ -129,6 +129,18 @@ function addIOSSimulatorPodPatch(source) {
129129 end
130130 end
131131end
132+
133+ def patch_douyin_resource_bundles(installer)
134+ sandbox_root = installer.sandbox.root.to_s
135+ info_plist = File.join(sandbox_root, 'DouyinOpenSDK', 'DouyinOpenSDK.framework', 'Resources', 'DYOpenCore.bundle', 'Info.plist')
136+ return unless File.exist?(info_plist)
137+
138+ if system('/usr/libexec/PlistBuddy', '-c', 'Print :CFBundleExecutable', info_plist, out: File::NULL, err: File::NULL)
139+ system('/usr/libexec/PlistBuddy', '-c', 'Delete :CFBundleExecutable', info_plist)
140+ end
141+ system('/usr/libexec/PlistBuddy', '-c', 'Set :CFBundlePackageType BNDL', info_plist) ||
142+ system('/usr/libexec/PlistBuddy', '-c', 'Add :CFBundlePackageType string BNDL', info_plist)
143+ end
132144` ;
133145 const helperPattern = new RegExp ( `def ${ helperName } \\(installer\\)[\\s\\S]*?\\nend\\n\\ntarget ['"]` ) ;
134146 let next = helperPattern . test ( source )
140152 ( match ) => `${ match } \n ${ helperName } (installer)` ,
141153 ) ;
142154 }
155+ if ( ! next . includes ( '\n patch_douyin_resource_bundles(installer)' ) ) {
156+ next = next . replace (
157+ new RegExp ( `(\\n ${ helperName } \\(installer\\))` ) ,
158+ ( match ) => `${ match } \n patch_douyin_resource_bundles(installer)` ,
159+ ) ;
160+ }
143161 return next ;
144162}
145163
0 commit comments