react-native-orientation-director 2.6.5 → 3.0.1
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.
- package/README.md +11 -33
- package/android/build.gradle +19 -79
- package/android/src/main/AndroidManifest.xml +1 -2
- package/android/src/{newarch → main/java/com/orientationdirector}/OrientationDirectorModule.kt +20 -11
- package/android/src/main/java/com/orientationdirector/OrientationDirectorPackage.kt +15 -20
- package/android/src/main/java/com/orientationdirector/implementation/EventManager.kt +4 -17
- package/android/src/main/java/com/orientationdirector/implementation/EventManagerDelegate.kt +9 -0
- package/android/src/main/java/com/orientationdirector/implementation/OrientationDirectorModuleImpl.kt +11 -21
- package/android/src/main/java/com/orientationdirector/implementation/OrientationSensorsEventListener.kt +73 -80
- package/android/src/main/java/com/orientationdirector/implementation/Utils.kt +0 -54
- package/app.plugin.js +1 -1
- package/ios/OrientationDirector.h +1 -18
- package/ios/OrientationDirector.mm +50 -35
- package/ios/SharedOrientationDirectorImpl.swift +12 -0
- package/ios/implementation/EventManager.swift +13 -38
- package/ios/implementation/OrientationDirectorImpl.swift +6 -6
- package/lib/module/EventEmitter.js +17 -11
- package/lib/module/EventEmitter.js.map +1 -1
- package/lib/module/NativeOrientationDirector.js.map +1 -1
- package/lib/module/RNOrientationDirector.js +11 -11
- package/lib/module/RNOrientationDirector.js.map +1 -1
- package/lib/plugin/index.d.ts +3 -0
- package/lib/plugin/index.js +10 -0
- package/lib/plugin/withAndroidConfiguration.d.ts +3 -0
- package/{plugin/build/withRNOrientationMainActivity.js → lib/plugin/withAndroidConfiguration.js} +3 -3
- package/lib/plugin/withIosConfiguration.d.ts +3 -0
- package/lib/plugin/withIosConfiguration.js +62 -0
- package/lib/typescript/{commonjs/src → src}/EventEmitter.d.ts +5 -4
- package/lib/typescript/src/EventEmitter.d.ts.map +1 -0
- package/lib/typescript/{commonjs/src → src}/NativeOrientationDirector.d.ts +10 -3
- package/lib/typescript/src/NativeOrientationDirector.d.ts.map +1 -0
- package/lib/typescript/{module/src → src}/RNOrientationDirector.d.ts +3 -3
- package/lib/typescript/src/RNOrientationDirector.d.ts.map +1 -0
- package/lib/typescript/src/hooks/useDeviceOrientation.hook.d.ts.map +1 -0
- package/lib/typescript/src/hooks/useInterfaceOrientation.hook.d.ts.map +1 -0
- package/lib/typescript/src/hooks/useIsInterfaceOrientationLocked.hook.d.ts.map +1 -0
- package/lib/typescript/src/index.d.ts.map +1 -0
- package/lib/typescript/src/types/AutoRotation.enum.d.ts.map +1 -0
- package/lib/typescript/src/types/Event.enum.d.ts.map +1 -0
- package/lib/typescript/src/types/HumanReadableAutoRotationsResource.type.d.ts.map +1 -0
- package/lib/typescript/src/types/HumanReadableOrientationsResource.type.d.ts.map +1 -0
- package/lib/typescript/src/types/LockableOrientation.type.d.ts.map +1 -0
- package/lib/typescript/src/types/LockedEvent.interface.d.ts.map +1 -0
- package/lib/typescript/src/types/Orientation.enum.d.ts.map +1 -0
- package/lib/typescript/src/types/OrientationEvent.interface.d.ts.map +1 -0
- package/lib/typescript/src/types/OrientationType.enum.d.ts.map +1 -0
- package/package.json +72 -77
- package/react-native-orientation-director.podspec +4 -24
- package/src/EventEmitter.ts +23 -25
- package/src/NativeOrientationDirector.ts +8 -3
- package/src/RNOrientationDirector.ts +11 -11
- package/android/gradle.properties +0 -17
- package/android/src/main/AndroidManifestNew.xml +0 -2
- package/android/src/oldarch/OrientationDirectorModule.kt +0 -66
- package/android/src/test/java/com/orientationdirector/implementation/OrientationDirectorModuleImplTest.kt +0 -199
- package/android/src/test/java/com/orientationdirector/implementation/UtilsTest.kt +0 -314
- package/ios/react-native-orientation-director-Bridging-Header.h +0 -6
- package/lib/commonjs/EventEmitter.js +0 -48
- package/lib/commonjs/NativeOrientationDirector.js +0 -8
- package/lib/commonjs/RNOrientationDirector.js +0 -126
- package/lib/commonjs/hooks/useDeviceOrientation.hook.js +0 -37
- package/lib/commonjs/hooks/useInterfaceOrientation.hook.js +0 -37
- package/lib/commonjs/hooks/useIsInterfaceOrientationLocked.hook.js +0 -27
- package/lib/commonjs/index.js +0 -51
- package/lib/commonjs/module.js +0 -22
- package/lib/commonjs/package.json +0 -1
- package/lib/commonjs/types/AutoRotation.enum.js +0 -12
- package/lib/commonjs/types/Event.enum.js +0 -13
- package/lib/commonjs/types/HumanReadableAutoRotationsResource.type.js +0 -5
- package/lib/commonjs/types/HumanReadableOrientationsResource.type.js +0 -5
- package/lib/commonjs/types/LockableOrientation.type.js +0 -5
- package/lib/commonjs/types/LockedEvent.interface.js +0 -1
- package/lib/commonjs/types/Orientation.enum.js +0 -17
- package/lib/commonjs/types/OrientationEvent.interface.js +0 -5
- package/lib/commonjs/types/OrientationType.enum.js +0 -11
- package/lib/module/module.js +0 -19
- package/lib/module/module.js.map +0 -1
- package/lib/typescript/commonjs/example/src/App.d.ts +0 -2
- package/lib/typescript/commonjs/example/src/App.d.ts.map +0 -1
- package/lib/typescript/commonjs/example/src/AppNavigationContainer.d.ts +0 -3
- package/lib/typescript/commonjs/example/src/AppNavigationContainer.d.ts.map +0 -1
- package/lib/typescript/commonjs/example/src/screens/Explore.d.ts +0 -3
- package/lib/typescript/commonjs/example/src/screens/Explore.d.ts.map +0 -1
- package/lib/typescript/commonjs/example/src/screens/Home.d.ts +0 -3
- package/lib/typescript/commonjs/example/src/screens/Home.d.ts.map +0 -1
- package/lib/typescript/commonjs/example/src/screens/InnerExplore.d.ts +0 -3
- package/lib/typescript/commonjs/example/src/screens/InnerExplore.d.ts.map +0 -1
- package/lib/typescript/commonjs/example/src/screens/styles.d.ts +0 -51
- package/lib/typescript/commonjs/example/src/screens/styles.d.ts.map +0 -1
- package/lib/typescript/commonjs/package.json +0 -1
- package/lib/typescript/commonjs/src/EventEmitter.d.ts.map +0 -1
- package/lib/typescript/commonjs/src/NativeOrientationDirector.d.ts.map +0 -1
- package/lib/typescript/commonjs/src/RNOrientationDirector.d.ts +0 -62
- package/lib/typescript/commonjs/src/RNOrientationDirector.d.ts.map +0 -1
- package/lib/typescript/commonjs/src/hooks/useDeviceOrientation.hook.d.ts.map +0 -1
- package/lib/typescript/commonjs/src/hooks/useInterfaceOrientation.hook.d.ts.map +0 -1
- package/lib/typescript/commonjs/src/hooks/useIsInterfaceOrientationLocked.hook.d.ts.map +0 -1
- package/lib/typescript/commonjs/src/index.d.ts.map +0 -1
- package/lib/typescript/commonjs/src/module.d.ts +0 -6
- package/lib/typescript/commonjs/src/module.d.ts.map +0 -1
- package/lib/typescript/commonjs/src/types/AutoRotation.enum.d.ts.map +0 -1
- package/lib/typescript/commonjs/src/types/Event.enum.d.ts.map +0 -1
- package/lib/typescript/commonjs/src/types/HumanReadableAutoRotationsResource.type.d.ts.map +0 -1
- package/lib/typescript/commonjs/src/types/HumanReadableOrientationsResource.type.d.ts.map +0 -1
- package/lib/typescript/commonjs/src/types/LockableOrientation.type.d.ts.map +0 -1
- package/lib/typescript/commonjs/src/types/LockedEvent.interface.d.ts.map +0 -1
- package/lib/typescript/commonjs/src/types/Orientation.enum.d.ts.map +0 -1
- package/lib/typescript/commonjs/src/types/OrientationEvent.interface.d.ts.map +0 -1
- package/lib/typescript/commonjs/src/types/OrientationType.enum.d.ts.map +0 -1
- package/lib/typescript/module/example/src/App.d.ts +0 -2
- package/lib/typescript/module/example/src/App.d.ts.map +0 -1
- package/lib/typescript/module/example/src/AppNavigationContainer.d.ts +0 -3
- package/lib/typescript/module/example/src/AppNavigationContainer.d.ts.map +0 -1
- package/lib/typescript/module/example/src/screens/Explore.d.ts +0 -3
- package/lib/typescript/module/example/src/screens/Explore.d.ts.map +0 -1
- package/lib/typescript/module/example/src/screens/Home.d.ts +0 -3
- package/lib/typescript/module/example/src/screens/Home.d.ts.map +0 -1
- package/lib/typescript/module/example/src/screens/InnerExplore.d.ts +0 -3
- package/lib/typescript/module/example/src/screens/InnerExplore.d.ts.map +0 -1
- package/lib/typescript/module/example/src/screens/styles.d.ts +0 -51
- package/lib/typescript/module/example/src/screens/styles.d.ts.map +0 -1
- package/lib/typescript/module/src/EventEmitter.d.ts +0 -11
- package/lib/typescript/module/src/EventEmitter.d.ts.map +0 -1
- package/lib/typescript/module/src/NativeOrientationDirector.d.ts +0 -17
- package/lib/typescript/module/src/NativeOrientationDirector.d.ts.map +0 -1
- package/lib/typescript/module/src/RNOrientationDirector.d.ts.map +0 -1
- package/lib/typescript/module/src/hooks/useDeviceOrientation.hook.d.ts +0 -8
- package/lib/typescript/module/src/hooks/useDeviceOrientation.hook.d.ts.map +0 -1
- package/lib/typescript/module/src/hooks/useInterfaceOrientation.hook.d.ts +0 -8
- package/lib/typescript/module/src/hooks/useInterfaceOrientation.hook.d.ts.map +0 -1
- package/lib/typescript/module/src/hooks/useIsInterfaceOrientationLocked.hook.d.ts +0 -7
- package/lib/typescript/module/src/hooks/useIsInterfaceOrientationLocked.hook.d.ts.map +0 -1
- package/lib/typescript/module/src/index.d.ts +0 -12
- package/lib/typescript/module/src/index.d.ts.map +0 -1
- package/lib/typescript/module/src/module.d.ts +0 -6
- package/lib/typescript/module/src/module.d.ts.map +0 -1
- package/lib/typescript/module/src/types/AutoRotation.enum.d.ts +0 -6
- package/lib/typescript/module/src/types/AutoRotation.enum.d.ts.map +0 -1
- package/lib/typescript/module/src/types/Event.enum.d.ts +0 -7
- package/lib/typescript/module/src/types/Event.enum.d.ts.map +0 -1
- package/lib/typescript/module/src/types/HumanReadableAutoRotationsResource.type.d.ts +0 -3
- package/lib/typescript/module/src/types/HumanReadableAutoRotationsResource.type.d.ts.map +0 -1
- package/lib/typescript/module/src/types/HumanReadableOrientationsResource.type.d.ts +0 -3
- package/lib/typescript/module/src/types/HumanReadableOrientationsResource.type.d.ts.map +0 -1
- package/lib/typescript/module/src/types/LockableOrientation.type.d.ts +0 -3
- package/lib/typescript/module/src/types/LockableOrientation.type.d.ts.map +0 -1
- package/lib/typescript/module/src/types/LockedEvent.interface.d.ts +0 -4
- package/lib/typescript/module/src/types/LockedEvent.interface.d.ts.map +0 -1
- package/lib/typescript/module/src/types/Orientation.enum.d.ts +0 -11
- package/lib/typescript/module/src/types/Orientation.enum.d.ts.map +0 -1
- package/lib/typescript/module/src/types/OrientationEvent.interface.d.ts +0 -5
- package/lib/typescript/module/src/types/OrientationEvent.interface.d.ts.map +0 -1
- package/lib/typescript/module/src/types/OrientationType.enum.d.ts +0 -5
- package/lib/typescript/module/src/types/OrientationType.enum.d.ts.map +0 -1
- package/plugin/build/custom-mod/withBridgingHeader.d.ts +0 -12
- package/plugin/build/custom-mod/withBridgingHeader.js +0 -107
- package/plugin/build/index.d.ts +0 -3
- package/plugin/build/index.js +0 -27
- package/plugin/build/withRNOrientationAppDelegate.d.ts +0 -4
- package/plugin/build/withRNOrientationAppDelegate.js +0 -102
- package/plugin/build/withRNOrientationBridgingHeader.d.ts +0 -3
- package/plugin/build/withRNOrientationBridgingHeader.js +0 -27
- package/plugin/build/withRNOrientationMainActivity.d.ts +0 -3
- package/plugin/tsconfig.json +0 -9
- package/src/module.ts +0 -30
- /package/lib/typescript/{module/package.json → package.json} +0 -0
- /package/lib/typescript/{commonjs/src → src}/hooks/useDeviceOrientation.hook.d.ts +0 -0
- /package/lib/typescript/{commonjs/src → src}/hooks/useInterfaceOrientation.hook.d.ts +0 -0
- /package/lib/typescript/{commonjs/src → src}/hooks/useIsInterfaceOrientationLocked.hook.d.ts +0 -0
- /package/lib/typescript/{commonjs/src → src}/index.d.ts +0 -0
- /package/lib/typescript/{commonjs/src → src}/types/AutoRotation.enum.d.ts +0 -0
- /package/lib/typescript/{commonjs/src → src}/types/Event.enum.d.ts +0 -0
- /package/lib/typescript/{commonjs/src → src}/types/HumanReadableAutoRotationsResource.type.d.ts +0 -0
- /package/lib/typescript/{commonjs/src → src}/types/HumanReadableOrientationsResource.type.d.ts +0 -0
- /package/lib/typescript/{commonjs/src → src}/types/LockableOrientation.type.d.ts +0 -0
- /package/lib/typescript/{commonjs/src → src}/types/LockedEvent.interface.d.ts +0 -0
- /package/lib/typescript/{commonjs/src → src}/types/Orientation.enum.d.ts +0 -0
- /package/lib/typescript/{commonjs/src → src}/types/OrientationEvent.interface.d.ts +0 -0
- /package/lib/typescript/{commonjs/src → src}/types/OrientationType.enum.d.ts +0 -0
|
@@ -19,51 +19,6 @@ class Utils(private val context: ReactContext) {
|
|
|
19
19
|
}
|
|
20
20
|
}
|
|
21
21
|
|
|
22
|
-
fun convertToDeviceOrientationFrom(orientationAngles: FloatArray): Orientation {
|
|
23
|
-
if (orientationAngles.size < 3) {
|
|
24
|
-
return Orientation.PORTRAIT
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
val (_, pitchRadians, rollRadians) = orientationAngles
|
|
28
|
-
|
|
29
|
-
val pitch = Math.toDegrees(pitchRadians.toDouble()).toFloat()
|
|
30
|
-
val roll = Math.toDegrees(rollRadians.toDouble()).toFloat()
|
|
31
|
-
|
|
32
|
-
val faceUpDownPitchTolerance = 30f
|
|
33
|
-
|
|
34
|
-
fun isValueCloseTo(value: Float, target: Float, tolerance: Float): Boolean {
|
|
35
|
-
return value in (target - tolerance)..(target + tolerance)
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
return when {
|
|
39
|
-
// Face up: device is lying flat with screen up
|
|
40
|
-
isValueCloseTo(pitch, 0f, faceUpDownPitchTolerance) &&
|
|
41
|
-
isValueCloseTo(roll, 0f, faceUpDownPitchTolerance) -> Orientation.FACE_UP
|
|
42
|
-
|
|
43
|
-
// Face down: device is lying flat with screen down
|
|
44
|
-
isValueCloseTo(pitch, 0f, faceUpDownPitchTolerance) &&
|
|
45
|
-
(isValueCloseTo(roll, 180f, faceUpDownPitchTolerance) || isValueCloseTo(
|
|
46
|
-
roll,
|
|
47
|
-
-180f,
|
|
48
|
-
faceUpDownPitchTolerance
|
|
49
|
-
)) -> Orientation.FACE_DOWN
|
|
50
|
-
|
|
51
|
-
// Portrait
|
|
52
|
-
isValueCloseTo(pitch, -90f, 45f) -> Orientation.PORTRAIT
|
|
53
|
-
|
|
54
|
-
// Portrait upside down
|
|
55
|
-
isValueCloseTo(pitch, 90f, 45f) -> Orientation.PORTRAIT_UPSIDE_DOWN
|
|
56
|
-
|
|
57
|
-
// Landscape left
|
|
58
|
-
isValueCloseTo(roll, -90f, 45f) -> Orientation.LANDSCAPE_LEFT
|
|
59
|
-
|
|
60
|
-
// Landscape right
|
|
61
|
-
isValueCloseTo(roll, 90f, 45f) -> Orientation.LANDSCAPE_RIGHT
|
|
62
|
-
|
|
63
|
-
else -> Orientation.UNKNOWN
|
|
64
|
-
}
|
|
65
|
-
}
|
|
66
|
-
|
|
67
22
|
fun convertToActivityOrientationFrom(orientation: Orientation): Int {
|
|
68
23
|
return when (orientation) {
|
|
69
24
|
Orientation.LANDSCAPE_RIGHT -> ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE
|
|
@@ -93,13 +48,4 @@ class Utils(private val context: ReactContext) {
|
|
|
93
48
|
}
|
|
94
49
|
}
|
|
95
50
|
|
|
96
|
-
fun convertToInterfaceOrientationFrom(deviceOrientation: Orientation): Orientation {
|
|
97
|
-
return when (deviceOrientation) {
|
|
98
|
-
Orientation.PORTRAIT -> Orientation.PORTRAIT
|
|
99
|
-
Orientation.LANDSCAPE_RIGHT -> Orientation.LANDSCAPE_LEFT
|
|
100
|
-
Orientation.PORTRAIT_UPSIDE_DOWN -> Orientation.PORTRAIT_UPSIDE_DOWN
|
|
101
|
-
Orientation.LANDSCAPE_LEFT -> Orientation.LANDSCAPE_RIGHT
|
|
102
|
-
else -> Orientation.UNKNOWN
|
|
103
|
-
}
|
|
104
|
-
}
|
|
105
51
|
}
|
package/app.plugin.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
module.exports = require('./plugin
|
|
1
|
+
module.exports = require('./lib/plugin');
|
|
@@ -1,22 +1,5 @@
|
|
|
1
|
-
#import <React/RCTEventEmitter.h>
|
|
2
|
-
|
|
3
|
-
#ifdef RCT_NEW_ARCH_ENABLED
|
|
4
1
|
#import <RNOrientationDirectorSpec/RNOrientationDirectorSpec.h>
|
|
5
2
|
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
@interface OrientationDirector : RCTEventEmitter <NativeOrientationDirectorSpec>
|
|
9
|
-
|
|
10
|
-
NS_ASSUME_NONNULL_END
|
|
11
|
-
|
|
12
|
-
#else
|
|
13
|
-
#import <React/RCTBridgeModule.h>
|
|
14
|
-
|
|
15
|
-
@interface OrientationDirector : RCTEventEmitter <RCTBridgeModule>
|
|
16
|
-
#endif
|
|
17
|
-
|
|
18
|
-
@property (nonatomic, assign) BOOL isJsListening;
|
|
19
|
-
|
|
20
|
-
+(UIInterfaceOrientationMask)getSupportedInterfaceOrientationsForWindow;
|
|
3
|
+
@interface OrientationDirector : NativeOrientationDirectorSpecBase <NativeOrientationDirectorSpec>
|
|
21
4
|
|
|
22
5
|
@end
|
|
@@ -4,24 +4,24 @@
|
|
|
4
4
|
This condition is needed to support use_frameworks.
|
|
5
5
|
https://github.com/callstack/react-native-builder-bob/discussions/412#discussioncomment-6352402
|
|
6
6
|
*/
|
|
7
|
-
#if __has_include("
|
|
8
|
-
#import "
|
|
7
|
+
#if __has_include("OrientationDirector-Swift.h")
|
|
8
|
+
#import "OrientationDirector-Swift.h"
|
|
9
9
|
#else
|
|
10
|
-
#import "
|
|
10
|
+
#import "OrientationDirector/OrientationDirector-Swift.h"
|
|
11
11
|
#endif
|
|
12
12
|
|
|
13
|
-
|
|
13
|
+
#include <exception>
|
|
14
|
+
|
|
15
|
+
static OrientationDirectorImpl *_director = SharedOrientationDirectorImpl.shared;
|
|
14
16
|
|
|
15
17
|
///////////////////////////////////////////////////////////////////////////////////////
|
|
16
18
|
/// EVENT EMITTER SETUP
|
|
17
|
-
///https://github.com/react-native-community/RNNewArchitectureLibraries/tree/feat/swift-event-emitter
|
|
18
19
|
@interface OrientationDirector() <OrientationEventEmitterDelegate>
|
|
19
20
|
@end
|
|
20
21
|
///
|
|
21
22
|
//////////////////////////////////////////////////////////////////////////////////////////
|
|
22
23
|
|
|
23
24
|
@implementation OrientationDirector
|
|
24
|
-
RCT_EXPORT_MODULE()
|
|
25
25
|
|
|
26
26
|
- (instancetype)init
|
|
27
27
|
{
|
|
@@ -41,57 +41,63 @@ RCT_EXPORT_MODULE()
|
|
|
41
41
|
return YES;
|
|
42
42
|
}
|
|
43
43
|
|
|
44
|
-
+ (UIInterfaceOrientationMask)getSupportedInterfaceOrientationsForWindow
|
|
45
|
-
{
|
|
46
|
-
return [_director supportedInterfaceOrientations];
|
|
47
|
-
}
|
|
48
|
-
|
|
49
44
|
///////////////////////////////////////////////////////////////////////////////////////
|
|
50
45
|
/// EVENT EMITTER SETUP
|
|
51
46
|
///
|
|
52
|
-
-(void)startObserving {
|
|
53
|
-
self.isJsListening = YES;
|
|
54
|
-
}
|
|
55
47
|
|
|
56
|
-
-(void)
|
|
57
|
-
|
|
48
|
+
-(void)emitDeviceOrientationChangedWithParams:(NSDictionary*)params {
|
|
49
|
+
try {
|
|
50
|
+
[self emitOnDeviceOrientationChanged:params];
|
|
51
|
+
} catch (std::exception &e) {
|
|
52
|
+
// Ignore if no listeners
|
|
53
|
+
}
|
|
58
54
|
}
|
|
59
55
|
|
|
60
|
-
-
|
|
61
|
-
|
|
56
|
+
-(void)emitInterfaceOrientationChangedWithParams:(NSDictionary*)params {
|
|
57
|
+
try {
|
|
58
|
+
[self emitOnInterfaceOrientationChanged:params];
|
|
59
|
+
} catch (std::exception &e) {
|
|
60
|
+
// Ignore if no listeners
|
|
61
|
+
}
|
|
62
62
|
}
|
|
63
63
|
|
|
64
|
-
-
|
|
65
|
-
|
|
64
|
+
-(void)emitOnLockChangedWithParams:(NSDictionary*)params {
|
|
65
|
+
try {
|
|
66
|
+
[self emitOnLockChanged:params];
|
|
67
|
+
} catch (std::exception &e) {
|
|
68
|
+
// Ignore if no listeners
|
|
69
|
+
}
|
|
66
70
|
}
|
|
71
|
+
|
|
67
72
|
///
|
|
68
73
|
///////////////////////////////////////////////////////////////////////////////////////
|
|
69
74
|
|
|
70
75
|
///////////////////////////////////////////////////////////////////////////////////////
|
|
71
76
|
/// EXPORTED METHODS
|
|
72
77
|
///
|
|
73
|
-
|
|
74
|
-
|
|
78
|
+
|
|
79
|
+
- (void)getInterfaceOrientation:(RCTPromiseResolveBlock)resolve
|
|
80
|
+
reject:(RCTPromiseRejectBlock)reject
|
|
75
81
|
{
|
|
76
82
|
dispatch_async(dispatch_get_main_queue(), ^{
|
|
77
83
|
resolve(@([_director getInterfaceOrientation]));
|
|
78
84
|
});
|
|
79
85
|
}
|
|
80
86
|
|
|
81
|
-
|
|
82
|
-
reject:(RCTPromiseRejectBlock)reject
|
|
87
|
+
- (void)getDeviceOrientation:(RCTPromiseResolveBlock)resolve
|
|
88
|
+
reject:(RCTPromiseRejectBlock)reject
|
|
83
89
|
{
|
|
84
90
|
dispatch_async(dispatch_get_main_queue(), ^{
|
|
85
91
|
resolve(@([_director getDeviceOrientation]));
|
|
86
92
|
});
|
|
87
93
|
}
|
|
88
94
|
|
|
89
|
-
|
|
95
|
+
- (NSNumber *)isLocked
|
|
90
96
|
{
|
|
91
97
|
return @([_director getIsLocked]);
|
|
92
98
|
}
|
|
93
99
|
|
|
94
|
-
|
|
100
|
+
- (void)lockTo:(double)jsOrientation
|
|
95
101
|
{
|
|
96
102
|
NSNumber *jsOrientationNumber = @(jsOrientation);
|
|
97
103
|
dispatch_async(dispatch_get_main_queue(), ^{
|
|
@@ -99,37 +105,46 @@ RCT_EXPORT_METHOD(lockTo:(double)jsOrientation)
|
|
|
99
105
|
});
|
|
100
106
|
}
|
|
101
107
|
|
|
102
|
-
|
|
108
|
+
- (void)unlock
|
|
103
109
|
{
|
|
104
110
|
dispatch_async(dispatch_get_main_queue(), ^{
|
|
105
111
|
[_director unlock];
|
|
106
112
|
});
|
|
107
113
|
}
|
|
108
114
|
|
|
109
|
-
|
|
115
|
+
- (void)resetSupportedInterfaceOrientations
|
|
110
116
|
{
|
|
111
117
|
dispatch_async(dispatch_get_main_queue(), ^{
|
|
112
118
|
[_director resetSupportedInterfaceOrientations];
|
|
113
119
|
});
|
|
114
120
|
}
|
|
115
121
|
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
122
|
+
///////////////////////////////////////////////////////////////////////////////////////
|
|
123
|
+
/// STUBS
|
|
124
|
+
///
|
|
125
|
+
|
|
126
|
+
- (NSNumber *)isAutoRotationEnabled
|
|
120
127
|
{
|
|
121
128
|
return @(NO);
|
|
122
129
|
}
|
|
130
|
+
|
|
131
|
+
- (void)disableOrientationSensors {}
|
|
132
|
+
|
|
133
|
+
|
|
134
|
+
- (void)enableOrientationSensors {}
|
|
135
|
+
|
|
123
136
|
///
|
|
124
137
|
///////////////////////////////////////////////////////////////////////////////////////
|
|
125
138
|
|
|
126
|
-
// Don't compile this code when we build for the old architecture.
|
|
127
|
-
#ifdef RCT_NEW_ARCH_ENABLED
|
|
128
139
|
- (std::shared_ptr<facebook::react::TurboModule>)getTurboModule:
|
|
129
140
|
(const facebook::react::ObjCTurboModule::InitParams &)params
|
|
130
141
|
{
|
|
131
142
|
return std::make_shared<facebook::react::NativeOrientationDirectorSpecJSI>(params);
|
|
132
143
|
}
|
|
133
|
-
|
|
144
|
+
|
|
145
|
+
+ (NSString *)moduleName
|
|
146
|
+
{
|
|
147
|
+
return @"OrientationDirector";
|
|
148
|
+
}
|
|
134
149
|
|
|
135
150
|
@end
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
//
|
|
2
|
+
// SharedOrientationDirectorImpl.swift
|
|
3
|
+
// react-native-orientation-director
|
|
4
|
+
//
|
|
5
|
+
// Created by Mirko Quaglia on 14/03/26.
|
|
6
|
+
//
|
|
7
|
+
|
|
8
|
+
import Foundation
|
|
9
|
+
|
|
10
|
+
@objc public class SharedOrientationDirectorImpl: NSObject {
|
|
11
|
+
@objc public static let shared = OrientationDirectorImpl()
|
|
12
|
+
}
|
|
@@ -7,33 +7,25 @@
|
|
|
7
7
|
|
|
8
8
|
import Foundation
|
|
9
9
|
|
|
10
|
-
|
|
11
|
-
|
|
10
|
+
public class EventManager: NSObject {
|
|
11
|
+
public weak var delegate: OrientationEventEmitterDelegate?
|
|
12
12
|
|
|
13
|
-
func sendDeviceOrientationDidChange(
|
|
13
|
+
func sendDeviceOrientationDidChange(value: Int) {
|
|
14
14
|
guard let delegate = delegate else {
|
|
15
15
|
return
|
|
16
16
|
}
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
let params = Dictionary(dictionaryLiteral: ("orientation", orientationValue))
|
|
23
|
-
delegate.sendEvent(name: Event.DeviceOrientationDidChange.rawValue, params: params as NSDictionary)
|
|
17
|
+
|
|
18
|
+
let params = Dictionary(dictionaryLiteral: ("orientation", value))
|
|
19
|
+
delegate.emitDeviceOrientationChanged(params: params as NSDictionary)
|
|
24
20
|
}
|
|
25
21
|
|
|
26
|
-
func sendInterfaceOrientationDidChange(
|
|
22
|
+
func sendInterfaceOrientationDidChange(value: Int) {
|
|
27
23
|
guard let delegate = delegate else {
|
|
28
24
|
return
|
|
29
25
|
}
|
|
30
26
|
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
let params = Dictionary(dictionaryLiteral: ("orientation", orientationValue))
|
|
36
|
-
delegate.sendEvent(name: Event.InterfaceOrientationDidChange.rawValue, params: params as NSDictionary)
|
|
27
|
+
let params = Dictionary(dictionaryLiteral: ("orientation", value))
|
|
28
|
+
delegate.emitInterfaceOrientationChanged(params: params as NSDictionary)
|
|
37
29
|
}
|
|
38
30
|
|
|
39
31
|
func sendLockDidChange(value: Bool) {
|
|
@@ -41,30 +33,13 @@ import Foundation
|
|
|
41
33
|
return
|
|
42
34
|
}
|
|
43
35
|
|
|
44
|
-
if !delegate.isJsListening {
|
|
45
|
-
return
|
|
46
|
-
}
|
|
47
|
-
|
|
48
36
|
let params = Dictionary(dictionaryLiteral: ("locked", value))
|
|
49
|
-
delegate.
|
|
37
|
+
delegate.emitOnLockChanged(params: params as NSDictionary)
|
|
50
38
|
}
|
|
51
39
|
}
|
|
52
40
|
|
|
53
41
|
@objc public protocol OrientationEventEmitterDelegate {
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
func
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
public extension EventManager {
|
|
60
|
-
|
|
61
|
-
enum Event: String, CaseIterable {
|
|
62
|
-
case DeviceOrientationDidChange
|
|
63
|
-
case InterfaceOrientationDidChange
|
|
64
|
-
case LockDidChange
|
|
65
|
-
}
|
|
66
|
-
|
|
67
|
-
@objc static var supportedEvents: [String] {
|
|
68
|
-
return Event.allCases.map(\.rawValue)
|
|
69
|
-
}
|
|
42
|
+
func emitOnLockChanged(params: NSDictionary)
|
|
43
|
+
func emitDeviceOrientationChanged(params: NSDictionary)
|
|
44
|
+
func emitInterfaceOrientationChanged(params: NSDictionary)
|
|
70
45
|
}
|
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
import Foundation
|
|
9
9
|
import UIKit
|
|
10
10
|
|
|
11
|
-
@
|
|
11
|
+
@objcMembers public class OrientationDirectorImpl: NSObject {
|
|
12
12
|
private static let TAG = "OrientationDirectorImpl"
|
|
13
13
|
|
|
14
14
|
private let bundleManager: BundleManager = BundleManager()
|
|
@@ -19,7 +19,7 @@ import UIKit
|
|
|
19
19
|
private var lastInterfaceOrientation = Orientation.UNKNOWN
|
|
20
20
|
private var lastDeviceOrientation = Orientation.UNKNOWN
|
|
21
21
|
private var isLocked = false
|
|
22
|
-
|
|
22
|
+
|
|
23
23
|
/// # Only on iOS < 16
|
|
24
24
|
/// This variable is needed to prevent a loop where
|
|
25
25
|
/// we lock the interface to a specific orientation
|
|
@@ -174,11 +174,11 @@ import UIKit
|
|
|
174
174
|
|
|
175
175
|
private func onOrientationChanged(uiDeviceOrientation: UIDeviceOrientation) {
|
|
176
176
|
let deviceOrientation = utils.convertToOrientationFrom(deviceOrientation: uiDeviceOrientation)
|
|
177
|
-
|
|
177
|
+
|
|
178
178
|
if (!self.isLocking) {
|
|
179
|
-
self.eventManager.sendDeviceOrientationDidChange(
|
|
179
|
+
self.eventManager.sendDeviceOrientationDidChange(value: deviceOrientation.rawValue)
|
|
180
180
|
}
|
|
181
|
-
|
|
181
|
+
|
|
182
182
|
lastDeviceOrientation = deviceOrientation
|
|
183
183
|
adaptInterfaceTo(deviceOrientation: deviceOrientation)
|
|
184
184
|
}
|
|
@@ -203,7 +203,7 @@ import UIKit
|
|
|
203
203
|
}
|
|
204
204
|
|
|
205
205
|
private func updateLastInterfaceOrientationTo(value: Orientation) {
|
|
206
|
-
|
|
206
|
+
self.eventManager.sendInterfaceOrientationDidChange(value: value.rawValue)
|
|
207
207
|
lastInterfaceOrientation = value
|
|
208
208
|
}
|
|
209
209
|
|
|
@@ -1,25 +1,25 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
import { Platform } from 'react-native';
|
|
4
|
-
import
|
|
5
|
-
import Event from "./types/Event.enum.js";
|
|
4
|
+
import NativeOrientationDirector from "./NativeOrientationDirector.js";
|
|
6
5
|
class EventEmitter {
|
|
6
|
+
static androidListenerCount = 0;
|
|
7
7
|
static addDeviceOrientationDidChangeListener(callback) {
|
|
8
|
-
let listener =
|
|
8
|
+
let listener = NativeOrientationDirector.onDeviceOrientationChanged(callback);
|
|
9
9
|
if (Platform.OS !== 'android') {
|
|
10
10
|
return listener;
|
|
11
11
|
}
|
|
12
|
-
|
|
13
|
-
if (
|
|
14
|
-
|
|
12
|
+
EventEmitter.androidListenerCount++;
|
|
13
|
+
if (EventEmitter.androidListenerCount === 1) {
|
|
14
|
+
NativeOrientationDirector.enableOrientationSensors();
|
|
15
15
|
}
|
|
16
16
|
return EventEmitter.createDeviceOrientationListenerProxy(listener);
|
|
17
17
|
}
|
|
18
18
|
static addInterfaceOrientationDidChangeListener(callback) {
|
|
19
|
-
return
|
|
19
|
+
return NativeOrientationDirector.onInterfaceOrientationChanged(callback);
|
|
20
20
|
}
|
|
21
21
|
static addLockDidChangeListener(callback) {
|
|
22
|
-
return
|
|
22
|
+
return NativeOrientationDirector.onLockChanged(callback);
|
|
23
23
|
}
|
|
24
24
|
static createDeviceOrientationListenerProxy(listener) {
|
|
25
25
|
const handler = {
|
|
@@ -32,10 +32,16 @@ class EventEmitter {
|
|
|
32
32
|
};
|
|
33
33
|
return new Proxy(listener, handler);
|
|
34
34
|
function disableOrientationSensorsIfLastListener() {
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
35
|
+
if (EventEmitter.androidListenerCount === 1) {
|
|
36
|
+
EventEmitter.androidListenerCount = 0;
|
|
37
|
+
NativeOrientationDirector.disableOrientationSensors();
|
|
38
|
+
return;
|
|
38
39
|
}
|
|
40
|
+
if (EventEmitter.androidListenerCount === 0) {
|
|
41
|
+
return;
|
|
42
|
+
}
|
|
43
|
+
EventEmitter.androidListenerCount--;
|
|
44
|
+
return;
|
|
39
45
|
}
|
|
40
46
|
}
|
|
41
47
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["Platform","
|
|
1
|
+
{"version":3,"names":["Platform","NativeOrientationDirector","EventEmitter","androidListenerCount","addDeviceOrientationDidChangeListener","callback","listener","onDeviceOrientationChanged","OS","enableOrientationSensors","createDeviceOrientationListenerProxy","addInterfaceOrientationDidChangeListener","onInterfaceOrientationChanged","addLockDidChangeListener","onLockChanged","handler","get","target","propertyKey","receiver","disableOrientationSensorsIfLastListener","Reflect","Proxy","disableOrientationSensors"],"sourceRoot":"../../src","sources":["EventEmitter.ts"],"mappings":";;AAAA,SAAiCA,QAAQ,QAAQ,cAAc;AAC/D,OAAOC,yBAAyB,MAAM,gCAA6B;AAInE,MAAMC,YAAY,CAAC;EACjB,OAAeC,oBAAoB,GAAG,CAAC;EAEvC,OAAOC,qCAAqCA,CAC1CC,QAAiD,EACjD;IACA,IAAIC,QAAQ,GACVL,yBAAyB,CAACM,0BAA0B,CAACF,QAAQ,CAAC;IAEhE,IAAIL,QAAQ,CAACQ,EAAE,KAAK,SAAS,EAAE;MAC7B,OAAOF,QAAQ;IACjB;IAEAJ,YAAY,CAACC,oBAAoB,EAAE;IACnC,IAAID,YAAY,CAACC,oBAAoB,KAAK,CAAC,EAAE;MAC3CF,yBAAyB,CAACQ,wBAAwB,CAAC,CAAC;IACtD;IAEA,OAAOP,YAAY,CAACQ,oCAAoC,CAACJ,QAAQ,CAAC;EACpE;EAEA,OAAOK,wCAAwCA,CAC7CN,QAAiD,EACjD;IACA,OAAOJ,yBAAyB,CAACW,6BAA6B,CAACP,QAAQ,CAAC;EAC1E;EAEA,OAAOQ,wBAAwBA,CAACR,QAAsC,EAAE;IACtE,OAAOJ,yBAAyB,CAACa,aAAa,CAACT,QAAQ,CAAC;EAC1D;EAEA,OAAeK,oCAAoCA,CACjDJ,QAA2B,EAC3B;IACA,MAAMS,OAAwC,GAAG;MAC/CC,GAAGA,CAACC,MAAM,EAAEC,WAAW,EAAEC,QAAQ,EAAE;QACjC,IAAID,WAAW,KAAK,QAAQ,EAAE;UAC5BE,uCAAuC,CAAC,CAAC;QAC3C;QACA,OAAOC,OAAO,CAACL,GAAG,CAACC,MAAM,EAAEC,WAAW,EAAEC,QAAQ,CAAC;MACnD;IACF,CAAC;IAED,OAAO,IAAIG,KAAK,CAAChB,QAAQ,EAAES,OAAO,CAAC;IAEnC,SAASK,uCAAuCA,CAAA,EAAG;MACjD,IAAIlB,YAAY,CAACC,oBAAoB,KAAK,CAAC,EAAE;QAC3CD,YAAY,CAACC,oBAAoB,GAAG,CAAC;QACrCF,yBAAyB,CAACsB,yBAAyB,CAAC,CAAC;QACrD;MACF;MAEA,IAAIrB,YAAY,CAACC,oBAAoB,KAAK,CAAC,EAAE;QAC3C;MACF;MAEAD,YAAY,CAACC,oBAAoB,EAAE;MACnC;IACF;EACF;AACF;AAEA,eAAeD,YAAY","ignoreList":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["TurboModuleRegistry","getEnforcing"],"sourceRoot":"../../src","sources":["NativeOrientationDirector.ts"],"mappings":";;AACA,SAASA,mBAAmB,QAAQ,cAAc;
|
|
1
|
+
{"version":3,"names":["TurboModuleRegistry","getEnforcing"],"sourceRoot":"../../src","sources":["NativeOrientationDirector.ts"],"mappings":";;AACA,SAASA,mBAAmB,QAAQ,cAAc;AA+BlD,eAAeA,mBAAmB,CAACC,YAAY,CAAO,qBAAqB,CAAC","ignoreList":[]}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
import { Platform } from 'react-native';
|
|
4
|
-
import
|
|
4
|
+
import NativeOrientationDirector from "./NativeOrientationDirector.js";
|
|
5
5
|
import { Orientation } from "./types/Orientation.enum.js";
|
|
6
6
|
import { AutoRotation } from "./types/AutoRotation.enum.js";
|
|
7
7
|
import { OrientationType } from "./types/OrientationType.enum.js";
|
|
@@ -29,10 +29,10 @@ class RNOrientationDirector {
|
|
|
29
29
|
RNOrientationDirector._humanReadableAutoRotationsResource = resource;
|
|
30
30
|
}
|
|
31
31
|
static getInterfaceOrientation() {
|
|
32
|
-
return
|
|
32
|
+
return NativeOrientationDirector.getInterfaceOrientation();
|
|
33
33
|
}
|
|
34
34
|
static getDeviceOrientation() {
|
|
35
|
-
return
|
|
35
|
+
return NativeOrientationDirector.getDeviceOrientation();
|
|
36
36
|
}
|
|
37
37
|
|
|
38
38
|
/**
|
|
@@ -55,33 +55,33 @@ class RNOrientationDirector {
|
|
|
55
55
|
*/
|
|
56
56
|
static lockTo(orientation, orientationType = OrientationType.interface) {
|
|
57
57
|
if (orientationType === OrientationType.interface) {
|
|
58
|
-
|
|
58
|
+
NativeOrientationDirector.lockTo(orientation);
|
|
59
59
|
return;
|
|
60
60
|
}
|
|
61
61
|
if (orientation === Orientation.landscapeLeft) {
|
|
62
|
-
|
|
62
|
+
NativeOrientationDirector.lockTo(Orientation.landscapeRight);
|
|
63
63
|
return;
|
|
64
64
|
}
|
|
65
65
|
if (orientation === Orientation.landscapeRight) {
|
|
66
|
-
|
|
66
|
+
NativeOrientationDirector.lockTo(Orientation.landscapeLeft);
|
|
67
67
|
return;
|
|
68
68
|
}
|
|
69
|
-
|
|
69
|
+
NativeOrientationDirector.lockTo(orientation);
|
|
70
70
|
}
|
|
71
71
|
static unlock() {
|
|
72
|
-
|
|
72
|
+
NativeOrientationDirector.unlock();
|
|
73
73
|
}
|
|
74
74
|
static isLocked() {
|
|
75
|
-
return
|
|
75
|
+
return NativeOrientationDirector.isLocked();
|
|
76
76
|
}
|
|
77
77
|
static isAutoRotationEnabled() {
|
|
78
78
|
if (Platform.OS !== 'android') {
|
|
79
79
|
return AutoRotation.unknown;
|
|
80
80
|
}
|
|
81
|
-
return
|
|
81
|
+
return NativeOrientationDirector.isAutoRotationEnabled() ? AutoRotation.enabled : AutoRotation.disabled;
|
|
82
82
|
}
|
|
83
83
|
static resetSupportedInterfaceOrientations() {
|
|
84
|
-
|
|
84
|
+
NativeOrientationDirector.resetSupportedInterfaceOrientations();
|
|
85
85
|
}
|
|
86
86
|
static listenForDeviceOrientationChanges(callback) {
|
|
87
87
|
return EventEmitter.addDeviceOrientationDidChangeListener(callback);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["Platform","
|
|
1
|
+
{"version":3,"names":["Platform","NativeOrientationDirector","Orientation","AutoRotation","OrientationType","EventEmitter","RNOrientationDirector","_humanReadableOrientationsResource","unknown","portrait","portraitUpsideDown","landscapeLeft","landscapeRight","landscape","faceUp","faceDown","_humanReadableAutoRotationsResource","enabled","disabled","setHumanReadableOrientations","resource","setHumanReadableAutoRotations","getInterfaceOrientation","getDeviceOrientation","lockTo","orientation","orientationType","interface","unlock","isLocked","isAutoRotationEnabled","OS","resetSupportedInterfaceOrientations","listenForDeviceOrientationChanges","callback","addDeviceOrientationDidChangeListener","listenForInterfaceOrientationChanges","addInterfaceOrientationDidChangeListener","listenForLockChanges","addLockDidChangeListener","convertOrientationToHumanReadableString","convertAutoRotationToHumanReadableString","autoRotation","isLockableOrientation"],"sourceRoot":"../../src","sources":["RNOrientationDirector.ts"],"mappings":"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","ignoreList":[]}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const withAndroidConfiguration_1 = require("./withAndroidConfiguration");
|
|
4
|
+
const withIosConfiguration_1 = require("./withIosConfiguration");
|
|
5
|
+
const withYourLibrary = (config) => {
|
|
6
|
+
config = (0, withAndroidConfiguration_1.withAndroidConfiguration)(config);
|
|
7
|
+
config = (0, withIosConfiguration_1.withIosConfiguration)(config);
|
|
8
|
+
return config;
|
|
9
|
+
};
|
|
10
|
+
exports.default = withYourLibrary;
|
package/{plugin/build/withRNOrientationMainActivity.js → lib/plugin/withAndroidConfiguration.js}
RENAMED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.withAndroidConfiguration = void 0;
|
|
4
4
|
exports.ktFileUpdater = ktFileUpdater;
|
|
5
5
|
const config_plugins_1 = require("@expo/config-plugins");
|
|
6
6
|
const generateCode_1 = require("@expo/config-plugins/build/utils/generateCode");
|
|
7
|
-
const
|
|
7
|
+
const withAndroidConfiguration = (config) => {
|
|
8
8
|
return (0, config_plugins_1.withMainActivity)(config, readMainActivityFileAndUpdateContents);
|
|
9
9
|
};
|
|
10
|
-
exports.
|
|
10
|
+
exports.withAndroidConfiguration = withAndroidConfiguration;
|
|
11
11
|
async function readMainActivityFileAndUpdateContents(config) {
|
|
12
12
|
const { modResults: mainActivityFile } = config;
|
|
13
13
|
const worker = getCompatibleFileUpdater(mainActivityFile.language);
|