Skip to content

Commit 4b7331e

Browse files
committed
feat(all): migrate ios to new arch
1 parent 3c39fd3 commit 4b7331e

File tree

15 files changed

+1882
-69
lines changed

15 files changed

+1882
-69
lines changed

android/src/main/java/com/orientationlocker/OrientationLockerModule.kt

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ class OrientationLockerModule internal constructor(context: ReactApplicationCont
6969
}
7070

7171
@ReactMethod
72-
override fun init() {
72+
override fun initial() {
7373
if (mOrientationListener != null) {
7474
return
7575
}
@@ -121,7 +121,7 @@ class OrientationLockerModule internal constructor(context: ReactApplicationCont
121121
}
122122

123123
@ReactMethod
124-
override fun removeInit() {
124+
override fun destroy() {
125125
if (mOrientationListener != null) {
126126
mOrientationListener!!.disable()
127127
mOrientationListener = null
@@ -170,6 +170,7 @@ class OrientationLockerModule internal constructor(context: ReactApplicationCont
170170
}
171171
}
172172

173+
173174
@ReactMethod
174175
override fun lockToLandscape() {
175176
if (currentActivity != null) {
@@ -278,13 +279,13 @@ class OrientationLockerModule internal constructor(context: ReactApplicationCont
278279
// Keep: Required for RN built in Event Emitter Calls.
279280
}
280281

281-
override fun getConstants(): MutableMap<String, Any>? {
282-
val constants = HashMap<String, Any>()
283-
284-
val orientation = getCurrentOrientation()
285-
constants["initialOrientation"] = orientation
282+
@ReactMethod(isBlockingSynchronousMethod = true)
283+
override fun getInitialOrientation(): String {
284+
return getCurrentOrientation()
285+
}
286286

287-
return constants
287+
override fun getConstants(): MutableMap<String, Any>? {
288+
return hashMapOf("initialOrientation" to "orientation")
288289
}
289290

290291
override fun start() {

android/src/oldarch/OrientationLockerSpec.kt

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,13 @@ import com.facebook.react.bridge.ReactContextBaseJavaModule
66
import com.facebook.react.bridge.ReadableMap
77

88
abstract class OrientationLockerSpec internal constructor(context: ReactApplicationContext) :
9-
ReactContextBaseJavaModule(context) {
9+
ReactContextBaseJavaModule(context) {
1010

1111
abstract fun getOrientation(callback: Callback)
1212
abstract fun getDeviceOrientation(callback: Callback)
13-
abstract fun init()
14-
abstract fun removeInit()
13+
abstract fun getInitialOrientation(): String
14+
abstract fun initial()
15+
abstract fun destroy()
1516
abstract fun lockToPortrait()
1617
abstract fun lockToPortraitUpsideDown()
1718
abstract fun lockToLandscape()

example/android/gradle.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ reactNativeArchitectures=armeabi-v7a,arm64-v8a,x86,x86_64
3434
# your application. You should enable this flag either if you want
3535
# to write custom TurboModules/Fabric components OR use libraries that
3636
# are providing them.
37-
newArchEnabled=false
37+
newArchEnabled=true
3838

3939
# Use this property to enable or disable the Hermes JS engine.
4040
# If set to false, you will be using JSC instead.

example/ios/.xcode.env.local

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
export NODE_BINARY=/opt/homebrew/bin/node
2+

example/ios/OrientationLockerExample.xcodeproj/project.pbxproj

Lines changed: 25 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
13B07FBC1A68108700A75B9A /* AppDelegate.mm in Sources */ = {isa = PBXBuildFile; fileRef = 13B07FB01A68108700A75B9A /* AppDelegate.mm */; };
1313
13B07FBF1A68108700A75B9A /* Images.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 13B07FB51A68108700A75B9A /* Images.xcassets */; };
1414
13B07FC11A68108700A75B9A /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 13B07FB71A68108700A75B9A /* main.m */; };
15+
506832DBCAAFA1F4E6DBDF3E /* PrivacyInfo.xcprivacy in Resources */ = {isa = PBXBuildFile; fileRef = 4EC4F52A87C550D226BAE734 /* PrivacyInfo.xcprivacy */; };
1516
7699B88040F8A987B510C191 /* libPods-OrientationLockerExample-OrientationLockerExampleTests.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 19F6CBCC0A4E27FBF8BF4A61 /* libPods-OrientationLockerExample-OrientationLockerExampleTests.a */; };
1617
81AB9BB82411601600AC10FF /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 81AB9BB72411601600AC10FF /* LaunchScreen.storyboard */; };
1718
/* End PBXBuildFile section */
@@ -36,9 +37,10 @@
3637
13B07FB51A68108700A75B9A /* Images.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; name = Images.xcassets; path = OrientationLockerExample/Images.xcassets; sourceTree = "<group>"; };
3738
13B07FB61A68108700A75B9A /* Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; name = Info.plist; path = OrientationLockerExample/Info.plist; sourceTree = "<group>"; };
3839
13B07FB71A68108700A75B9A /* main.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = main.m; path = OrientationLockerExample/main.m; sourceTree = "<group>"; };
39-
13B07FB81A68108700A75B9A /* PrivacyInfo.xcprivacy */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; name = PrivacyInfo.xcprivacy; path = OrientationLockerExample/PrivacyInfo.xcprivacy; sourceTree = "<group>"; };
40+
13B07FB81A68108700A75B9A /* PrivacyInfo.xcprivacy */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; name = PrivacyInfo.xcprivacy; path = OrientationLockerExample/PrivacyInfo.xcprivacy; sourceTree = "<group>"; };
4041
19F6CBCC0A4E27FBF8BF4A61 /* libPods-OrientationLockerExample-OrientationLockerExampleTests.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = "libPods-OrientationLockerExample-OrientationLockerExampleTests.a"; sourceTree = BUILT_PRODUCTS_DIR; };
4142
3B4392A12AC88292D35C810B /* Pods-OrientationLockerExample.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-OrientationLockerExample.debug.xcconfig"; path = "Target Support Files/Pods-OrientationLockerExample/Pods-OrientationLockerExample.debug.xcconfig"; sourceTree = "<group>"; };
43+
4EC4F52A87C550D226BAE734 /* PrivacyInfo.xcprivacy */ = {isa = PBXFileReference; includeInIndex = 1; name = PrivacyInfo.xcprivacy; path = OrientationLockerExample/PrivacyInfo.xcprivacy; sourceTree = "<group>"; };
4244
5709B34CF0A7D63546082F79 /* Pods-OrientationLockerExample.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-OrientationLockerExample.release.xcconfig"; path = "Target Support Files/Pods-OrientationLockerExample/Pods-OrientationLockerExample.release.xcconfig"; sourceTree = "<group>"; };
4345
5B7EB9410499542E8C5724F5 /* Pods-OrientationLockerExample-OrientationLockerExampleTests.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-OrientationLockerExample-OrientationLockerExampleTests.debug.xcconfig"; path = "Target Support Files/Pods-OrientationLockerExample-OrientationLockerExampleTests/Pods-OrientationLockerExample-OrientationLockerExampleTests.debug.xcconfig"; sourceTree = "<group>"; };
4446
5DCACB8F33CDC322A6C60F78 /* libPods-OrientationLockerExample.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = "libPods-OrientationLockerExample.a"; sourceTree = BUILT_PRODUCTS_DIR; };
@@ -94,6 +96,7 @@
9496
81AB9BB72411601600AC10FF /* LaunchScreen.storyboard */,
9597
13B07FB71A68108700A75B9A /* main.m */,
9698
13B07FB81A68108700A75B9A /* PrivacyInfo.xcprivacy */,
99+
4EC4F52A87C550D226BAE734 /* PrivacyInfo.xcprivacy */,
97100
);
98101
name = OrientationLockerExample;
99102
sourceTree = "<group>";
@@ -245,6 +248,7 @@
245248
files = (
246249
81AB9BB82411601600AC10FF /* LaunchScreen.storyboard in Resources */,
247250
13B07FBF1A68108700A75B9A /* Images.xcassets in Resources */,
251+
506832DBCAAFA1F4E6DBDF3E /* PrivacyInfo.xcprivacy in Resources */,
248252
);
249253
runOnlyForDeploymentPostprocessing = 0;
250254
};
@@ -517,6 +521,7 @@
517521
isa = XCBuildConfiguration;
518522
buildSettings = {
519523
ALWAYS_SEARCH_USER_PATHS = NO;
524+
CC = "";
520525
CLANG_ANALYZER_LOCALIZABILITY_NONLOCALIZED = YES;
521526
CLANG_CXX_LANGUAGE_STANDARD = "c++20";
522527
CLANG_CXX_LIBRARY = "libc++";
@@ -544,6 +549,7 @@
544549
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
545550
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
546551
COPY_PHASE_STRIP = NO;
552+
CXX = "";
547553
ENABLE_STRICT_OBJC_MSGSEND = YES;
548554
ENABLE_TESTABILITY = YES;
549555
"EXCLUDED_ARCHS[sdk=iphonesimulator*]" = "";
@@ -563,6 +569,8 @@
563569
GCC_WARN_UNUSED_FUNCTION = YES;
564570
GCC_WARN_UNUSED_VARIABLE = YES;
565571
IPHONEOS_DEPLOYMENT_TARGET = 13.4;
572+
LD = "";
573+
LDPLUSPLUS = "";
566574
LD_RUNPATH_SEARCH_PATHS = (
567575
/usr/lib/swift,
568576
"$(inherited)",
@@ -582,14 +590,21 @@
582590
"-DFOLLY_CFG_NO_COROUTINES=1",
583591
"-DFOLLY_HAVE_CLOCK_GETTIME=1",
584592
);
593+
OTHER_LDFLAGS = (
594+
"$(inherited)",
595+
" ",
596+
);
597+
REACT_NATIVE_PATH = "${PODS_ROOT}/../../node_modules/react-native";
585598
SDKROOT = iphoneos;
599+
USE_HERMES = true;
586600
};
587601
name = Debug;
588602
};
589603
83CBBA211A601CBA00E9B192 /* Release */ = {
590604
isa = XCBuildConfiguration;
591605
buildSettings = {
592606
ALWAYS_SEARCH_USER_PATHS = NO;
607+
CC = "";
593608
CLANG_ANALYZER_LOCALIZABILITY_NONLOCALIZED = YES;
594609
CLANG_CXX_LANGUAGE_STANDARD = "c++20";
595610
CLANG_CXX_LIBRARY = "libc++";
@@ -617,6 +632,7 @@
617632
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
618633
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
619634
COPY_PHASE_STRIP = YES;
635+
CXX = "";
620636
ENABLE_NS_ASSERTIONS = NO;
621637
ENABLE_STRICT_OBJC_MSGSEND = YES;
622638
"EXCLUDED_ARCHS[sdk=iphonesimulator*]" = "";
@@ -629,6 +645,8 @@
629645
GCC_WARN_UNUSED_FUNCTION = YES;
630646
GCC_WARN_UNUSED_VARIABLE = YES;
631647
IPHONEOS_DEPLOYMENT_TARGET = 13.4;
648+
LD = "";
649+
LDPLUSPLUS = "";
632650
LD_RUNPATH_SEARCH_PATHS = (
633651
/usr/lib/swift,
634652
"$(inherited)",
@@ -647,7 +665,13 @@
647665
"-DFOLLY_CFG_NO_COROUTINES=1",
648666
"-DFOLLY_HAVE_CLOCK_GETTIME=1",
649667
);
668+
OTHER_LDFLAGS = (
669+
"$(inherited)",
670+
" ",
671+
);
672+
REACT_NATIVE_PATH = "${PODS_ROOT}/../../node_modules/react-native";
650673
SDKROOT = iphoneos;
674+
USE_HERMES = true;
651675
VALIDATE_PRODUCT = YES;
652676
};
653677
name = Release;

example/ios/OrientationLockerExample.xcworkspace/contents.xcworkspacedata

Lines changed: 10 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
3+
<plist version="1.0">
4+
<dict>
5+
<key>IDEDidComputeMac32BitWarning</key>
6+
<true/>
7+
</dict>
8+
</plist>

example/ios/OrientationLockerExample/PrivacyInfo.xcprivacy

Lines changed: 31 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -2,37 +2,36 @@
22
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
33
<plist version="1.0">
44
<dict>
5-
<key>NSPrivacyCollectedDataTypes</key>
6-
<array>
7-
</array>
8-
<key>NSPrivacyAccessedAPITypes</key>
9-
<array>
10-
<dict>
11-
<key>NSPrivacyAccessedAPIType</key>
12-
<string>NSPrivacyAccessedAPICategoryFileTimestamp</string>
13-
<key>NSPrivacyAccessedAPITypeReasons</key>
14-
<array>
15-
<string>C617.1</string>
16-
</array>
17-
</dict>
18-
<dict>
19-
<key>NSPrivacyAccessedAPIType</key>
20-
<string>NSPrivacyAccessedAPICategoryUserDefaults</string>
21-
<key>NSPrivacyAccessedAPITypeReasons</key>
22-
<array>
23-
<string>CA92.1</string>
24-
</array>
25-
</dict>
26-
<dict>
27-
<key>NSPrivacyAccessedAPIType</key>
28-
<string>NSPrivacyAccessedAPICategorySystemBootTime</string>
29-
<key>NSPrivacyAccessedAPITypeReasons</key>
30-
<array>
31-
<string>35F9.1</string>
32-
</array>
33-
</dict>
34-
</array>
35-
<key>NSPrivacyTracking</key>
36-
<false/>
5+
<key>NSPrivacyAccessedAPITypes</key>
6+
<array>
7+
<dict>
8+
<key>NSPrivacyAccessedAPIType</key>
9+
<string>NSPrivacyAccessedAPICategoryFileTimestamp</string>
10+
<key>NSPrivacyAccessedAPITypeReasons</key>
11+
<array>
12+
<string>C617.1</string>
13+
</array>
14+
</dict>
15+
<dict>
16+
<key>NSPrivacyAccessedAPIType</key>
17+
<string>NSPrivacyAccessedAPICategoryUserDefaults</string>
18+
<key>NSPrivacyAccessedAPITypeReasons</key>
19+
<array>
20+
<string>CA92.1</string>
21+
</array>
22+
</dict>
23+
<dict>
24+
<key>NSPrivacyAccessedAPIType</key>
25+
<string>NSPrivacyAccessedAPICategorySystemBootTime</string>
26+
<key>NSPrivacyAccessedAPITypeReasons</key>
27+
<array>
28+
<string>35F9.1</string>
29+
</array>
30+
</dict>
31+
</array>
32+
<key>NSPrivacyCollectedDataTypes</key>
33+
<array/>
34+
<key>NSPrivacyTracking</key>
35+
<false/>
3736
</dict>
3837
</plist>

example/ios/Podfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ require Pod::Executable.execute_command('node', ['-p',
77

88
platform :ios, min_ios_version_supported
99
prepare_react_native_project!
10-
10+
ENV['RCT_NEW_ARCH_ENABLED'] = '1'
1111
linkage = ENV['USE_FRAMEWORKS']
1212
if linkage != nil
1313
Pod::UI.puts "Configuring Pod with #{linkage}ally linked Frameworks".green

0 commit comments

Comments
 (0)