@xrnjs/app-template 0.0.7 → 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (126) hide show
  1. package/$package.json +30 -36
  2. package/android/app/build.gradle +56 -73
  3. package/android/app/src/debug/java/com/xrn/template/ReactNativeFlipper.java +23 -44
  4. package/android/app/src/main/assets/xrn-manifest.json +1 -1
  5. package/android/app/src/main/java/com/xrn/template/MainApplication.kt +54 -65
  6. package/android/app/src/main/java/com/xrn/template/multibundle/CodePushBundleActivity.kt +65 -0
  7. package/android/app/src/main/java/com/xrn/template/multibundle/CodePushJSBundleLoader.kt +18 -0
  8. package/android/app/src/main/java/com/xrn/template/multibundle/CodePushUtils.kt +263 -0
  9. package/android/app/src/main/java/com/xrn/template/multibundle/XBundleTool.kt +9 -0
  10. package/android/app/src/main/java/com/xrn/template/multibundle/XRNReactHostDelegate.kt +56 -0
  11. package/android/app/src/main/java/com/xrn/template/navigation/XBundleActivity.kt +10 -7
  12. package/android/app/src/main/res/raw/bundle_config.json +2 -6
  13. package/android/build.gradle +40 -39
  14. package/android/buildSrc/build.gradle.kts +15 -0
  15. package/android/gradle/wrapper/gradle-wrapper.properties +3 -1
  16. package/android/gradle.properties +17 -10
  17. package/android/settings.gradle +40 -12
  18. package/harmony/.clang-tidy +1 -1
  19. package/harmony/.clangd +3 -1
  20. package/harmony/AppScope/app.json5 +1 -1
  21. package/harmony/build-profile.json5 +8 -8
  22. package/harmony/entry/oh-package-lock.json5 +283 -262
  23. package/harmony/entry/oh-package.json5 +35 -36
  24. package/harmony/entry/src/main/cpp/CMakeLists.txt +37 -17
  25. package/harmony/entry/src/main/cpp/PackageProvider.cpp +20 -2
  26. package/harmony/entry/src/main/cpp/generated/BundleNavigation.cpp +3 -0
  27. package/harmony/entry/src/main/cpp/generated/RNOHGeneratedPackage.h +31 -87
  28. package/harmony/entry/src/main/cpp/generated/RTNCodePush.cpp +7 -1
  29. package/harmony/entry/src/main/cpp/generated/XRNBundleModule.cpp +9 -0
  30. package/harmony/entry/src/main/cpp/generated/XRNDebugToolsModule.cpp +10 -0
  31. package/harmony/entry/src/main/cpp/generated/{ImageResizer.cpp → XRNImageView.cpp} +6 -3
  32. package/harmony/entry/src/main/cpp/generated/{ImageResizer.h → XRNImageView.h} +2 -2
  33. package/harmony/entry/src/main/cpp/generated/{RNCWebViewComponentDescriptor.h → XRNImageViewComponentDescriptor.h} +11 -10
  34. package/harmony/entry/src/main/cpp/generated/XRNImageViewJSIBinder.h +58 -0
  35. package/harmony/entry/src/main/cpp/generated/XRNKeyboard.cpp +23 -0
  36. package/harmony/entry/src/main/cpp/generated/{RNLocalize.h → XRNKeyboard.h} +2 -2
  37. package/harmony/entry/src/main/cpp/generated/XRNNavigation.cpp +5 -0
  38. package/harmony/entry/src/main/cpp/generated/{RNCWebViewModule.cpp → XRNNetworkModule.cpp} +2 -4
  39. package/harmony/entry/src/main/cpp/generated/{RNCWebViewModule.h → XRNNetworkModule.h} +2 -2
  40. package/harmony/entry/src/main/ets/BundleHelper.ets +41 -45
  41. package/harmony/entry/src/main/ets/MainAbilityStage.ets +9 -4
  42. package/harmony/entry/src/main/ets/entryability/EntryAbility.ets +1 -1
  43. package/harmony/entry/src/main/ets/navDestination/BizModuleContainer.ets +2 -2
  44. package/harmony/entry/src/main/ets/navDestination/MainModuleContainer.ets +2 -2
  45. package/harmony/entry/src/main/ets/navDestination/Splash.ets +1 -2
  46. package/harmony/entry/src/main/ets/pages/Index.ets +4 -4
  47. package/harmony/entry/src/main/resources/rawfile/bundle_config.json5 +2 -6
  48. package/harmony/entry/src/main/resources/rawfile/xrn-manifest.json +1 -0
  49. package/harmony/oh-package-lock.json5 +2 -1
  50. package/harmony/oh-package.json5 +12 -4
  51. package/index.ts +0 -0
  52. package/ios/BundleEventCenter/Hooks/XRNCustomKeyborad+XTHooks.h +16 -0
  53. package/ios/BundleEventCenter/Hooks/XRNCustomKeyborad+XTHooks.mm +40 -0
  54. package/ios/BundleEventCenter/Hooks/XTIQKeyboardManagerBridge.h +15 -0
  55. package/ios/BundleEventCenter/Hooks/XTIQKeyboardManagerBridge.m +22 -0
  56. package/ios/BundleEventCenter/XTBundleProvider.m +98 -72
  57. package/ios/BundleEventCenter/XTBundleViewControllerFactory.m +4 -15
  58. package/ios/BundleEventCenter/bundleController/XTBundleViewController.mm +43 -0
  59. package/ios/BundleEventCenter/bundleController/XTMainBundleViewController.mm +48 -0
  60. package/ios/BundleEventCenter/bundleController/xtBundles.plist +1 -1
  61. package/ios/Podfile +234 -151
  62. package/ios/Podfile.lock +2810 -594
  63. package/ios/RNDebug/DebugPlugin/XTPluginManage.m +5 -5
  64. package/ios/RNDebug/MotroTools/XTMetroAutoConnector.h +21 -0
  65. package/ios/RNDebug/MotroTools/XTMetroAutoConnector.m +124 -0
  66. package/ios/RNDebug/MotroTools/XTReloadCommandHelper.h +30 -0
  67. package/ios/RNDebug/MotroTools/XTReloadCommandHelper.mm +128 -0
  68. package/ios/RNDebug/Views/XTScanQRPlugin.swift +9 -4
  69. package/ios/XRNTemplate/AppDelegate.h +3 -3
  70. package/ios/XRNTemplate/AppDelegate.mm +40 -102
  71. package/ios/XRNTemplate/Info.plist +4 -4
  72. package/ios/XRNTemplate/PrivacyInfo.xcprivacy +48 -0
  73. package/ios/XRNTemplate-Bridging-Header.h +2 -1
  74. package/ios/XRNTemplate.xcodeproj/project.pbxproj +68 -77
  75. package/ios/ios_patches/fixed_glog_config.h +195 -0
  76. package/ios/ios_patches/xt_IQKeyboardManager+Position.swift +1341 -0
  77. package/ios/ios_patches/xt_IQKeyboardManager.swift +454 -0
  78. package/ios/subBundles/.gitkeep +0 -0
  79. package/main-bundle/babel.config.js +2 -2
  80. package/main-bundle/package.json +11 -20
  81. package/main-bundle/yarn.lock +14655 -9651
  82. package/metro.config.js +21 -0
  83. package/package.json +2 -2
  84. package/react-native.config.js +3 -45
  85. package/src/.gitkeep +0 -0
  86. package/sub-bundle/babel.config.js +2 -2
  87. package/sub-bundle/package.json +11 -20
  88. package/sub-bundle/react-native.config.js +4 -0
  89. package/sub-bundle/yarn.lock +14655 -9651
  90. package/xrn.config.json +12 -12
  91. package/android/app/src/main/java/com/xrn/template/multibundle/XDevSupportParams.kt +0 -6
  92. package/android/app/src/main/java/com/xrn/template/multibundle/XRNHostParams.kt +0 -82
  93. package/harmony/entry/src/main/cpp/generated/ConfigNativeModule.cpp +0 -21
  94. package/harmony/entry/src/main/cpp/generated/ConfigNativeModule.h +0 -21
  95. package/harmony/entry/src/main/cpp/generated/GetRandomValuesNativeModule.cpp +0 -21
  96. package/harmony/entry/src/main/cpp/generated/GetRandomValuesNativeModule.h +0 -21
  97. package/harmony/entry/src/main/cpp/generated/NativeHarmonyTouchId.cpp +0 -22
  98. package/harmony/entry/src/main/cpp/generated/NativeHarmonyTouchId.h +0 -21
  99. package/harmony/entry/src/main/cpp/generated/OreitationLockerNativeModule.cpp +0 -31
  100. package/harmony/entry/src/main/cpp/generated/OreitationLockerNativeModule.h +0 -21
  101. package/harmony/entry/src/main/cpp/generated/RNCCameraRoll.cpp +0 -28
  102. package/harmony/entry/src/main/cpp/generated/RNCCameraRoll.h +0 -21
  103. package/harmony/entry/src/main/cpp/generated/RNCCameraRollPermission.cpp +0 -26
  104. package/harmony/entry/src/main/cpp/generated/RNCCameraRollPermission.h +0 -21
  105. package/harmony/entry/src/main/cpp/generated/RNCWebViewJSIBinder.h +0 -120
  106. package/harmony/entry/src/main/cpp/generated/RNDeviceInfo.cpp +0 -164
  107. package/harmony/entry/src/main/cpp/generated/RNDeviceInfo.h +0 -21
  108. package/harmony/entry/src/main/cpp/generated/RNDocumentPicker.cpp +0 -24
  109. package/harmony/entry/src/main/cpp/generated/RNDocumentPicker.h +0 -21
  110. package/harmony/entry/src/main/cpp/generated/RNGestureHandlerButtonComponentDescriptor.h +0 -43
  111. package/harmony/entry/src/main/cpp/generated/RNGestureHandlerButtonJSIBinder.h +0 -38
  112. package/harmony/entry/src/main/cpp/generated/RNGestureHandlerModule.cpp +0 -28
  113. package/harmony/entry/src/main/cpp/generated/RNGestureHandlerModule.h +0 -21
  114. package/harmony/entry/src/main/cpp/generated/RNGestureHandlerRootViewComponentDescriptor.h +0 -43
  115. package/harmony/entry/src/main/cpp/generated/RNGestureHandlerRootViewJSIBinder.h +0 -31
  116. package/harmony/entry/src/main/cpp/generated/RNLocalize.cpp +0 -31
  117. package/harmony/entry/src/main/cpp/generated/ReactNativeBlobUtil.cpp +0 -51
  118. package/harmony/entry/src/main/cpp/generated/ReactNativeBlobUtil.h +0 -21
  119. package/harmony/entry/src/main/cpp/generated/XRNAssetLoaderModule.cpp +0 -21
  120. package/harmony/entry/src/main/cpp/generated/XRNAssetLoaderModule.h +0 -21
  121. package/harmony/entry/src/main/cpp/generated/XRNFileModule.cpp +0 -22
  122. package/harmony/entry/src/main/cpp/generated/XRNFileModule.h +0 -21
  123. package/ios/BundleEventCenter/bundleController/XTBundleViewController.m +0 -35
  124. package/ios/BundleEventCenter/bundleController/XTMainBundleViewController.m +0 -41
  125. package/main-bundle/.watchmanconfig +0 -1
  126. package/sub-bundle/.watchmanconfig +0 -1
package/ios/Podfile CHANGED
@@ -1,26 +1,19 @@
1
+ ENV['RCT_NEW_ARCH_ENABLED'] = '1'
2
+ ENV['USE_FABRIC'] = '1'
3
+
1
4
  require_relative '../node_modules/react-native/scripts/react_native_pods'
2
- require_relative '../node_modules/@react-native-community/cli-platform-ios/native_modules'
3
5
  require_relative '../node_modules/react-native-permissions/scripts/setup'
4
6
 
5
7
  # Resolve react_native_pods.rb with node to allow for hoisting
6
8
  require Pod::Executable.execute_command('node', ['-p',
7
- 'require.resolve(
8
- "react-native/scripts/react_native_pods.rb",
9
- {paths: [process.argv[1]]},
10
- )', __dir__]).strip
9
+ 'require.resolve(
10
+ "react-native/scripts/react_native_pods.rb",
11
+ {paths: [process.argv[1]]},
12
+ )', __dir__]).strip
11
13
 
12
- platform :ios, '13'
14
+ platform :ios, '15.1'
13
15
  prepare_react_native_project!
14
16
 
15
- # If you are using a `react-native-flipper` your iOS build will fail when `NO_FLIPPER=1` is set.
16
- # because `react-native-flipper` depends on (FlipperKit,...) that will be excluded
17
- #
18
- # To fix this you can also exclude `react-native-flipper` using a `react-native.config.js`
19
- # ```js
20
- # module.exports = {
21
- # dependencies: {
22
- # ...(process.env.NO_FLIPPER ? { 'react-native-flipper': { platforms: { ios: null } } } : {}),
23
- # ```
24
17
  linkage = ENV['USE_FRAMEWORKS']
25
18
  if linkage != nil
26
19
  Pod::UI.puts "Configuring Pod with #{linkage}ally linked Frameworks".green
@@ -35,52 +28,9 @@ target 'XRNTemplate' do
35
28
 
36
29
  use_react_native!(
37
30
  :path => config[:reactNativePath],
38
- # Hermes is now enabled by default. Disable by setting this flag to false.
39
- # Upcoming versions of React Native may rely on get_default_flags(), but
40
- # we make it explicit here to aid in the React Native upgrade process.
41
- :hermes_enabled => false,
42
- :fabric_enabled => flags[:fabric_enabled],
43
- # Enables Flipper.
44
- #
45
- # Note that if you have use_frameworks! enabled, Flipper will not work and
46
- # you should disable the next line.
47
- :flipper_configuration => FlipperConfiguration.enabled(["Debug"], { 'Flipper' => '0.182.0' }),
48
- # An absolute path to your application root.
31
+ :hermes_enabled => true,
49
32
  :app_path => "#{Pod::Config.instance.installation_root}/.."
50
33
  )
51
-
52
- # Pods for react-native
53
- pod 'FBLazyVector', :path => "../node_modules/react-native/Libraries/FBLazyVector"
54
- # pod 'FBReactNativeSpec', :path => "../node_modules/react-native/Libraries/FBReactNativeSpec"
55
- pod 'RCTRequired', :path => "../node_modules/react-native/Libraries/RCTRequired"
56
- pod 'RCTTypeSafety', :path => "../node_modules/react-native/Libraries/TypeSafety"
57
- pod 'React', :path => '../node_modules/react-native/'
58
- pod 'React-Core', :path => '../node_modules/react-native/'
59
- pod 'React-CoreModules', :path => '../node_modules/react-native/React/CoreModules'
60
- pod 'React-Core/DevSupport', :path => '../node_modules/react-native/'
61
- pod 'React-RCTActionSheet', :path => '../node_modules/react-native/Libraries/ActionSheetIOS'
62
- pod 'React-RCTAnimation', :path => '../node_modules/react-native/Libraries/NativeAnimation'
63
- # pod 'React-RCTBlob', :patoh => '../node_modules/react-native/Libraries/Blob'
64
- pod 'React-RCTImage', :path => '../node_modules/react-native/Libraries/Image'
65
- pod 'React-RCTLinking', :path => '../node_modules/react-native/Libraries/LinkingIOS'
66
- pod 'React-RCTNetwork', :path => '../node_modules/react-native/Libraries/Network'
67
- pod 'React-RCTSettings', :path => '../node_modules/react-native/Libraries/Settings'
68
- pod 'React-RCTText', :path => '../node_modules/react-native/Libraries/Text'
69
- pod 'React-RCTVibration', :path => '../node_modules/react-native/Libraries/Vibration'
70
- pod 'React-Core/RCTWebSocket', :path => '../node_modules/react-native/'
71
-
72
- pod 'React-cxxreact', :path => '../node_modules/react-native/ReactCommon/cxxreact'
73
- pod 'React-jsi', :path => '../node_modules/react-native/ReactCommon/jsi'
74
- # pod 'React-jsiexecutor', :path => '../node_modules/react-native/ReactCommon/jsiexecutor'
75
- pod 'React-callinvoker', :path => "../node_modules/react-native/ReactCommon/callinvoker"
76
- # pod 'React-jsinspector', :path => '../node_modules/react-native/ReactCommon'
77
- # pod 'ReactCommon/jscallinvoker', :path => "../node_modules/react-native/ReactCommon"
78
- pod 'ReactCommon/turbomodule/core', :path => "../node_modules/react-native/ReactCommon"
79
-
80
- pod 'Yoga', :path => '../node_modules/react-native/ReactCommon/yoga'
81
- pod 'DoubleConversion', :podspec => '../node_modules/react-native/third-party-podspecs/DoubleConversion.podspec'
82
- pod 'glog', :podspec => '../node_modules/react-native/third-party-podspecs/glog.podspec'
83
- pod 'RCT-Folly', :podspec => '../node_modules/react-native/third-party-podspecs/RCT-Folly.podspec'
84
34
 
85
35
  # 三方包
86
36
  pod 'SDWebImage', '5.20.0', :modular_headers => true
@@ -89,23 +39,186 @@ target 'XRNTemplate' do
89
39
  pod 'SDWebImageSVGCoder', '1.7.0', :modular_headers => true
90
40
  pod 'libavif/libdav1d', '0.11.1', :modular_headers => true
91
41
  pod 'MBProgressHUD', '1.2.0', :modular_headers => true
92
-
42
+
93
43
  pod 'RNCAsyncStorage', :path => '../node_modules/@react-native-async-storage/async-storage', :modular_headers => true
94
44
  pod 'RNDeviceInfo', :path => '../node_modules/react-native-device-info', :modular_headers => true
95
- pod 'RNFS', :path => '../node_modules/react-native-fs'
96
- pod 'react-native-config', :path => '../node_modules/react-native-config'
97
-
45
+
98
46
  pod 'SnapKit', '5.7.1'
99
47
  pod 'JRSwizzle'
100
48
  pod 'YYCache', '1.0.4'
101
49
  pod 'swiftScan', '1.2.1', :configurations => ['Debug']
102
-
50
+ pod 'JWT', '3.0.0-beta.12', :modular_headers => true
51
+ pod 'Base64', '1.1.2', :modular_headers => true
52
+
103
53
  # 二方包
104
- pod 'CodePush', :path => '../node_modules/@xrnjs/react-native-code-push'
105
- pod 'react-native-xrn-app-utils', :path => '../node_modules/@xrnjs/app-utils'
106
54
  pod 'react-native-xrn-multi-bundle', :path => '../node_modules/@xrnjs/multi-bundle', :modular_headers => true
55
+ pod 'react-native-xrn-bundle', :path => '../node_modules/@xrnjs/bundle', :modular_headers => true
107
56
  pod 'react-native-xrn-navigation', :path => '../node_modules/@xrnjs/navigation', :modular_headers => true
108
-
57
+ pod 'CodePush', :path => '../node_modules/@xrnjs/react-native-code-push',:modular_headers => true
58
+
59
+
60
+ post_install do |installer|
61
+ # https://github.com/facebook/react-native/blob/main/packages/react-native/scripts/react_native_pods.rb#L197-L202
62
+ react_native_post_install(
63
+ installer,
64
+ config[:reactNativePath],
65
+ :mac_catalyst_enabled => false,
66
+ # :ccache_enabled => true
67
+ )
68
+ # __apply_Xcode_12_5_M1_post_install_workaround(installer)
69
+
70
+ # 修复 RCTAppSetupUtils.h 中 USE_HERMES 宏未定义导致走到 JSCExecutorFactory 分支的问题
71
+ rct_setup_path = "../node_modules/react-native/Libraries/AppDelegate/RCTAppSetupUtils.h"
72
+ if File.exist?(rct_setup_path)
73
+ content = File.read(rct_setup_path)
74
+ unless content.include?('#define USE_HERMES')
75
+ modified = content.sub('#if USE_HERMES', "#define USE_HERMES 1\n\n#if USE_HERMES")
76
+ if content != modified
77
+ File.write(rct_setup_path, modified)
78
+ puts "[PATCH-RCTAppSetupUtils] >>>添加 #define USE_HERMES 1"
79
+ end
80
+ else
81
+ puts "[PATCH-RCTAppSetupUtils] >>>已添加过"
82
+ end
83
+ end
84
+
85
+ ## Fix for XCode 12.5
86
+ find_and_replace(
87
+ "../node_modules/react-native/React/CxxBridge/RCTCxxBridge.mm",
88
+ "_initializeModules:(NSArray<id<RCTBridgeModule>> *)modules",
89
+ "_initializeModules:(NSArray<Class> *)modules")
90
+
91
+ find_and_replace(
92
+ "../node_modules/react-native/ReactCommon/turbomodule/core/platform/ios/RCTTurboModuleManager.mm",
93
+ "RCTBridgeModuleNameForClass(module))",
94
+ "RCTBridgeModuleNameForClass(Class(module)))")
95
+
96
+ # Fix Sentry 8.x 在 Xcode 26 libc++ 下 std::allocator<const T> 编译失败
97
+ # (vector<const ThreadHandleMetadataPair> -> vector<ThreadHandleMetadataPair>)
98
+ find_and_replace(
99
+ "Pods/Sentry/Sources/Sentry/include/SentryThreadMetadataCache.hpp",
100
+ "std::vector<const ThreadHandleMetadataPair>",
101
+ "std::vector<ThreadHandleMetadataPair>")
102
+
103
+ ## 解决Hermes bitcode 问题
104
+ bitcode_strip_path = `xcrun --find bitcode_strip`.chop!
105
+ def strip_bitcode_from_framework(bitcode_strip_path, framework_relative_path)
106
+ framework_path = File.join(Dir.pwd, framework_relative_path)
107
+ command = "#{bitcode_strip_path} #{framework_path} -r -o #{framework_path}"
108
+ puts "Stripping bitcode: #{command}"
109
+ system(command)
110
+ end
111
+
112
+ framework_paths = [
113
+ "Pods/hermes-engine/destroot/Library/Frameworks/macosx/hermes.framework/hermes",
114
+ "Pods/hermes-engine/destroot/Library/Frameworks/macosx/hermes.framework/Versions/Current/hermes",
115
+ "Pods/hermes-engine/destroot/Library/Frameworks/universal/hermes.xcframework/ios-arm64/hermes.framework/hermes",
116
+ "Pods/hermes-engine/destroot/Library/Frameworks/universal/hermes.xcframework/ios-arm64_x86_64-maccatalyst/hermes.framework/hermes"
117
+ ]
118
+
119
+ framework_paths.each do |framework_relative_path|
120
+ strip_bitcode_from_framework(bitcode_strip_path, framework_relative_path)
121
+ end
122
+
123
+ # 兼容Xcode16.2 Flipper报错
124
+ installer.pods_project.targets.each do |target|
125
+ if target.name == 'Flipper'
126
+ file_path = 'Pods/Flipper/xplat/Flipper/FlipperTransportTypes.h'
127
+ if File.exist?(file_path)
128
+ contents = File.read(file_path)
129
+ unless contents.include?('#include <functional>')
130
+ File.chmod(0755, file_path)
131
+ File.open(file_path, 'w') do |file|
132
+ file.puts('#include <functional>')
133
+ file.puts(contents)
134
+ end
135
+ end
136
+ end
137
+ end
138
+ end
139
+
140
+ # 适配xcode15报错`No template named 'unary_function' in namespace 'std'; did you mean '__unary_function'?`
141
+ installer.pods_project.targets.each do |target|
142
+ target.build_configurations.each do |config|
143
+ config.build_settings['GCC_PREPROCESSOR_DEFINITIONS'] ||= ['$(inherited)', '_LIBCPP_ENABLE_CXX17_REMOVED_UNARY_BINARY_FUNCTION']
144
+ end
145
+ end
146
+
147
+ # 解决 glog 在 iOS 15+ 上编译报错(config.h 未生成 GOOGLE_NAMESPACE 等)
148
+ installer.pods_project.targets.each do |target|
149
+ if target.name == 'glog'
150
+ config_path = "Pods/glog/src/config.h"
151
+ patch_file_path = File.join(__dir__, "ios_patches", "fixed_glog_config.h")
152
+ if File.exist?(patch_file_path)
153
+ fixed_config = File.read(patch_file_path)
154
+ File.open(config_path, "w") { |f| f.puts fixed_config }
155
+ puts "[PATCH-glog] >>>成功"
156
+ else
157
+ puts "[PATCH-glog] >>>跳过:ios_patches目录不存在"
158
+ end
159
+ end
160
+ end
161
+
162
+ # 解决 Xcode 26 编译 fmt 报错:Apple Clang consteval 与 fmt 11.0.2 不兼容
163
+ installer.pods_project.targets.each do |target|
164
+ if target.name == 'fmt'
165
+ target.build_configurations.each do |config|
166
+ config.build_settings['CLANG_CXX_LANGUAGE_STANDARD'] = 'c++17'
167
+ end
168
+ end
169
+ end
170
+
171
+ fmt_base = File.join(__dir__, 'Pods/fmt/include/fmt/base.h')
172
+ if File.exist?(fmt_base)
173
+ contents = File.read(fmt_base)
174
+ old = "#elif defined(__apple_build_version__) && __apple_build_version__ < 14000029L\n# define FMT_USE_CONSTEVAL 0 // consteval is broken in Apple clang < 14."
175
+ new = "#elif defined(__apple_build_version__)\n# define FMT_USE_CONSTEVAL 0 // consteval is broken in Apple clang (incl. Xcode 26)."
176
+ if contents.include?(old)
177
+ File.chmod(0644, fmt_base)
178
+ File.write(fmt_base, contents.sub(old, new))
179
+ puts "[PATCH-fmt] >>>成功:关闭 Apple Clang consteval"
180
+ else
181
+ puts "[PATCH-fmt] >>>跳过:已修复或源码不匹配"
182
+ end
183
+ end
184
+
185
+ installer.pods_project.targets.each do |target|
186
+ if target.respond_to?(:product_type) and target.product_type == "com.apple.product-type.bundle"
187
+ target.build_configurations.each do |config|
188
+ config.build_settings['CODE_SIGNING_ALLOWED'] = 'NO'
189
+ end
190
+ end
191
+ end
192
+
193
+ # 键盘适配:用自定义版 IQKeyboardManagerSwift(支持 viewSoftInputMode / clearViewPositionInfo)
194
+ installer.pods_project.targets.each do |target|
195
+ if target.name == 'IQKeyboardManagerSwift'
196
+ config_path1 = "Pods/IQKeyboardManagerSwift/IQKeyboardManagerSwift/IQKeyboardManager.swift"
197
+ patch_file_path1 = File.join(__dir__, "ios_patches", "xt_IQKeyboardManager.swift")
198
+ if File.exist?(patch_file_path1)
199
+ fixed_config1 = File.read(patch_file_path1)
200
+ File.chmod(0755, config_path1)
201
+ File.open(config_path1, "w") { |f| f.puts fixed_config1 }
202
+ puts "[PATCH-IQKeyboardManagerSwift] >>>成功"
203
+ else
204
+ puts "[PATCH-IQKeyboardManagerSwift] >>>跳过:ios_patches目录不存在"
205
+ end
206
+
207
+ config_path2 = "Pods/IQKeyboardManagerSwift/IQKeyboardManagerSwift/IQKeyboardManager+Position.swift"
208
+ patch_file_path2 = File.join(__dir__, "ios_patches", "xt_IQKeyboardManager+Position.swift")
209
+ if File.exist?(patch_file_path2)
210
+ fixed_config2 = File.read(patch_file_path2)
211
+ File.chmod(0755, config_path2)
212
+ File.open(config_path2, "w") { |f| f.puts fixed_config2 }
213
+ puts "[PATCH-IQKeyboardManager+Position] >>>成功"
214
+ else
215
+ puts "[PATCH-IQKeyboardManager+Position] >>>跳过:ios_patches目录不存在"
216
+ end
217
+ end
218
+ end
219
+
220
+ end
221
+
109
222
  setup_permissions([
110
223
  'AppTrackingTransparency',
111
224
  # 'Bluetooth',
@@ -133,89 +246,59 @@ target 'XRNTemplate' do
133
246
  inherit! :complete
134
247
  # Pods for testing
135
248
  end
249
+ end
136
250
 
137
- post_install do |installer|
138
- react_native_post_install(
139
- installer,
140
- config[:reactNativePath],
141
- :mac_catalyst_enabled => false
142
- )
143
- __apply_Xcode_12_5_M1_post_install_workaround(installer)
144
-
145
- # 兼容Xcode16.2 Flipper报错
146
- installer.pods_project.targets.each do |target|
147
- if target.name == 'Flipper'
148
- file_path = 'Pods/Flipper/xplat/Flipper/FlipperTransportTypes.h'
149
- contents = File.read(file_path)
150
- unless contents.include?('#include <functional>')
151
- File.chmod(0755, file_path)
152
- File.open(file_path, 'w') do |file|
153
- file.puts('#include <functional>')
154
- file.puts(contents)
155
- end
156
- end
157
- end
158
- end
159
-
160
- # 兼容Xcode16.2 Sentry报错(https://github.com/getsentry/sentry-cocoa/pull/4051)
161
- installer.pods_project.targets.each do |target|
162
- if target.name == 'Sentry'
163
- file_path = 'Pods/Sentry/Sources/SentryCrash/Recording/Monitors/SentryCrashMonitor_CPPException.cpp'
164
- contents = File.read(file_path)
165
- unless contents.include?('#include <exception>')
166
- File.chmod(0755, file_path)
167
- File.open(file_path, 'w') do |file|
168
- file.puts('#include <exception>')
169
- file.puts(contents)
170
- end
171
- end
172
- end
173
- end
174
-
175
- # 兼容Xcode16.2 Sentry报错 (https://github.com/getsentry/sentry-dart/issues/2222)
176
- installer.pods_project.targets.each do |target|
177
- if target.name == 'Sentry'
178
- file_path = 'Pods/Sentry/Sources/SentryCrash/Recording/Tools/SentryCrashMachineContext.c'
179
- if File.exist?(file_path)
180
- contents = File.read(file_path)
181
-
182
- # 检查是否已经插入过
183
- unless contents.include?('#include <sys/_types/_ucontext64.h>')
184
- # 查找 "#ifdef __arm64__" 并插入下一行
185
- lines = contents.lines
186
- index = lines.find_index { |line| line.include?('#ifdef __arm64__') }
187
-
188
- if index
189
- lines.insert(index + 1, "#include <sys/_types/_ucontext64.h>\n")
190
- File.write(file_path, lines.join)
191
- puts "[PATCH] >>>成功"
192
- else
193
- puts "[PATCH] >>>失败:'#ifdef __arm64__' 不存在"
194
- end
195
- else
196
- puts "[PATCH] >>>失败:已存在patch"
197
- end
198
- else
199
- puts "[PATCH] >>>失败:SentryCrashMachineContext文件不存在"
200
- end
201
- end
202
- end
203
-
204
- # 适配xcode15报错`No template named 'unary_function' in namespace 'std'; did you mean '__unary_function'?`
205
- installer.pods_project.targets.each do |target|
206
- target.build_configurations.each do |config|
207
- config.build_settings['GCC_PREPROCESSOR_DEFINITIONS'] ||= ['$(inherited)', '_LIBCPP_ENABLE_CXX17_REMOVED_UNARY_BINARY_FUNCTION']
208
- end
209
- end
210
-
211
- installer.pods_project.targets.each do |target|
212
- if target.respond_to?(:product_type) and target.product_type == "com.apple.product-type.bundle"
213
- target.build_configurations.each do |config|
214
- config.build_settings['CODE_SIGNING_ALLOWED'] = 'NO'
215
- end
216
- end
217
- end
218
-
219
-
220
- end
251
+ # Keep the app's own `XRNTemplate/PrivacyInfo.xcprivacy`.
252
+ # Must run in post_integrate: post_install filters the lists, then CocoaPods
253
+ # "Integrating client project" regenerates the xcfilelists and the conflict returns.
254
+ def patch_xrngo_privacy_info_copy_conflict
255
+ privacy_src = "IQKeyboardManagerSwift/IQKeyboardManagerSwift/PrivacyInfo.xcprivacy"
256
+ privacy_dst = "${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/PrivacyInfo.xcprivacy"
257
+
258
+ support_files = [
259
+ "Pods/Target Support Files/Pods-XRNTemplate/Pods-XRNTemplate-resources.sh",
260
+ "Pods/Target Support Files/Pods-XRNTemplate/Pods-XRNTemplate-resources-Debug-input-files.xcfilelist",
261
+ "Pods/Target Support Files/Pods-XRNTemplate/Pods-XRNTemplate-resources-Release-input-files.xcfilelist",
262
+ "Pods/Target Support Files/Pods-XRNTemplate/Pods-XRNTemplate-resources-Debug-output-files.xcfilelist",
263
+ "Pods/Target Support Files/Pods-XRNTemplate/Pods-XRNTemplate-resources-Release-output-files.xcfilelist",
264
+ "Pods/Target Support Files/Pods-XRNTemplate-XRNTemplateTests/Pods-XRNTemplate-XRNTemplateTests-resources.sh",
265
+ "Pods/Target Support Files/Pods-XRNTemplate-XRNTemplateTests/Pods-XRNTemplate-XRNTemplateTests-resources-Debug-input-files.xcfilelist",
266
+ "Pods/Target Support Files/Pods-XRNTemplate-XRNTemplateTests/Pods-XRNTemplate-XRNTemplateTests-resources-Release-input-files.xcfilelist",
267
+ "Pods/Target Support Files/Pods-XRNTemplate-XRNTemplateTests/Pods-XRNTemplate-XRNTemplateTests-resources-Debug-output-files.xcfilelist",
268
+ "Pods/Target Support Files/Pods-XRNTemplate-XRNTemplateTests/Pods-XRNTemplate-XRNTemplateTests-resources-Release-output-files.xcfilelist",
269
+ ]
270
+
271
+ support_files.each do |relative_path|
272
+ file_path = File.join(__dir__, relative_path)
273
+ next unless File.exist?(file_path)
274
+
275
+ contents = File.read(file_path)
276
+ filtered = contents.lines.reject do |line|
277
+ line.include?(privacy_src) || line.include?(privacy_dst)
278
+ end.join
279
+
280
+ if filtered != contents
281
+ File.write(file_path, filtered)
282
+ puts "[PATCH-PrivacyInfo] filtered: #{relative_path}"
283
+ end
284
+ end
285
+ end
286
+
287
+ post_integrate do |_installer|
288
+ patch_xrngo_privacy_info_copy_conflict
289
+ end
290
+
291
+
292
+ ##fix for xcode 12.5
293
+ def find_and_replace(dir, findstr, replacestr)
294
+ Dir[dir].each do |name|
295
+ text = File.read(name)
296
+ replace = text.gsub(findstr,replacestr)
297
+ if text != replace
298
+ puts "Fix: " + name
299
+ File.open(name, "w") { |file| file.puts replace }
300
+ STDOUT.flush
301
+ end
302
+ end
303
+ Dir[dir + '*/'].each(&method(:find_and_replace))
221
304
  end