react-native-orientation-director 2.6.4 → 3.0.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.
- 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 +23 -24
- 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 +35 -35
- package/ios/SharedOrientationDirectorImpl.swift +12 -0
- package/ios/implementation/EventManager.swift +12 -37
- package/ios/implementation/OrientationDirectorImpl.swift +6 -6
- package/lib/module/EventEmitter.js +15 -9
- package/lib/module/EventEmitter.js.map +1 -1
- package/lib/module/NativeOrientationDirector.js.map +1 -1
- package/lib/module/module.js +1 -2
- package/lib/module/module.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/module.d.ts +4 -0
- package/lib/typescript/src/module.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 +21 -24
- package/src/NativeOrientationDirector.ts +8 -3
- package/src/module.ts +1 -3
- 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/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/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
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"OrientationType.enum.d.ts","sourceRoot":"","sources":["../../../../../src/types/OrientationType.enum.ts"],"names":[],"mappings":"AAAA,oBAAY,eAAe;IACzB,MAAM,WAAW;IACjB,SAAS,cAAc;CACxB"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"App.d.ts","sourceRoot":"","sources":["../../../../../example/src/App.tsx"],"names":[],"mappings":"AAEA,MAAM,CAAC,OAAO,UAAU,GAAG,4CAE1B"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"AppNavigationContainer.d.ts","sourceRoot":"","sources":["../../../../../example/src/AppNavigationContainer.tsx"],"names":[],"mappings":"AAOA,iBAAS,sBAAsB,4CA8B9B;AAED,eAAe,sBAAsB,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"Explore.d.ts","sourceRoot":"","sources":["../../../../../../example/src/screens/Explore.tsx"],"names":[],"mappings":"AASA,iBAAS,OAAO,4CAwCf;AAED,eAAe,OAAO,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"Home.d.ts","sourceRoot":"","sources":["../../../../../../example/src/screens/Home.tsx"],"names":[],"mappings":"AAOA,iBAAS,IAAI,4CAmHZ;AAED,eAAe,IAAI,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"InnerExplore.d.ts","sourceRoot":"","sources":["../../../../../../example/src/screens/InnerExplore.tsx"],"names":[],"mappings":"AAMA,iBAAS,YAAY,4CAkBpB;AAED,eAAe,YAAY,CAAC"}
|
|
@@ -1,51 +0,0 @@
|
|
|
1
|
-
export declare const homepageStyle: {
|
|
2
|
-
container: {
|
|
3
|
-
flexGrow: number;
|
|
4
|
-
padding: number;
|
|
5
|
-
};
|
|
6
|
-
marginBottom: {
|
|
7
|
-
marginBottom: number;
|
|
8
|
-
};
|
|
9
|
-
buttonsContainer: {
|
|
10
|
-
flex: number;
|
|
11
|
-
justifyContent: "center";
|
|
12
|
-
};
|
|
13
|
-
text: {
|
|
14
|
-
color: string;
|
|
15
|
-
};
|
|
16
|
-
};
|
|
17
|
-
export declare const exploreStyle: {
|
|
18
|
-
container: {
|
|
19
|
-
flexGrow: number;
|
|
20
|
-
padding: number;
|
|
21
|
-
};
|
|
22
|
-
marginBottom: {
|
|
23
|
-
marginBottom: number;
|
|
24
|
-
};
|
|
25
|
-
text: {
|
|
26
|
-
color: string;
|
|
27
|
-
};
|
|
28
|
-
body: {
|
|
29
|
-
flex: number;
|
|
30
|
-
justifyContent: "center";
|
|
31
|
-
alignItems: "center";
|
|
32
|
-
};
|
|
33
|
-
};
|
|
34
|
-
export declare const innerExploreStyle: {
|
|
35
|
-
container: {
|
|
36
|
-
flexGrow: number;
|
|
37
|
-
padding: number;
|
|
38
|
-
};
|
|
39
|
-
marginBottom: {
|
|
40
|
-
marginBottom: number;
|
|
41
|
-
};
|
|
42
|
-
text: {
|
|
43
|
-
color: string;
|
|
44
|
-
};
|
|
45
|
-
body: {
|
|
46
|
-
flex: number;
|
|
47
|
-
justifyContent: "center";
|
|
48
|
-
alignItems: "center";
|
|
49
|
-
};
|
|
50
|
-
};
|
|
51
|
-
//# sourceMappingURL=styles.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"styles.d.ts","sourceRoot":"","sources":["../../../../../../example/src/screens/styles.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,aAAa;;;;;;;;;;;;;;;CAexB,CAAC;AAEH,eAAO,MAAM,YAAY;;;;;;;;;;;;;;;;CASvB,CAAC;AAEH,eAAO,MAAM,iBAAiB;;;;;;;;;;;;;;;;CAE5B,CAAC"}
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import { type EmitterSubscription } from 'react-native';
|
|
2
|
-
import type { OrientationEvent } from './types/OrientationEvent.interface';
|
|
3
|
-
import type { LockedEvent } from './types/LockedEvent.interface';
|
|
4
|
-
declare class EventEmitter {
|
|
5
|
-
static addDeviceOrientationDidChangeListener(callback: (orientation: OrientationEvent) => void): EmitterSubscription;
|
|
6
|
-
static addInterfaceOrientationDidChangeListener(callback: (orientation: OrientationEvent) => void): EmitterSubscription;
|
|
7
|
-
static addLockDidChangeListener(callback: (event: LockedEvent) => void): EmitterSubscription;
|
|
8
|
-
private static createDeviceOrientationListenerProxy;
|
|
9
|
-
}
|
|
10
|
-
export default EventEmitter;
|
|
11
|
-
//# sourceMappingURL=EventEmitter.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"EventEmitter.d.ts","sourceRoot":"","sources":["../../../../src/EventEmitter.ts"],"names":[],"mappings":"AAAA,OAAO,EAAY,KAAK,mBAAmB,EAAE,MAAM,cAAc,CAAC;AAGlE,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,oCAAoC,CAAC;AAC3E,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,+BAA+B,CAAC;AAEjE,cAAM,YAAY;IAChB,MAAM,CAAC,qCAAqC,CAC1C,QAAQ,EAAE,CAAC,WAAW,EAAE,gBAAgB,KAAK,IAAI;IAsBnD,MAAM,CAAC,wCAAwC,CAC7C,QAAQ,EAAE,CAAC,WAAW,EAAE,gBAAgB,KAAK,IAAI;IAQnD,MAAM,CAAC,wBAAwB,CAAC,QAAQ,EAAE,CAAC,KAAK,EAAE,WAAW,KAAK,IAAI;IAItE,OAAO,CAAC,MAAM,CAAC,oCAAoC;CAwBpD;AAED,eAAe,YAAY,CAAC"}
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import type { TurboModule } from 'react-native';
|
|
2
|
-
export interface Spec extends TurboModule {
|
|
3
|
-
getInterfaceOrientation(): Promise<number>;
|
|
4
|
-
getDeviceOrientation(): Promise<number>;
|
|
5
|
-
lockTo(orientation: number): void;
|
|
6
|
-
unlock(): void;
|
|
7
|
-
isLocked(): boolean;
|
|
8
|
-
resetSupportedInterfaceOrientations(): void;
|
|
9
|
-
isAutoRotationEnabled(): boolean;
|
|
10
|
-
enableOrientationSensors(): void;
|
|
11
|
-
disableOrientationSensors(): void;
|
|
12
|
-
addListener: (eventType: string) => void;
|
|
13
|
-
removeListeners: (count: number) => void;
|
|
14
|
-
}
|
|
15
|
-
declare const _default: Spec;
|
|
16
|
-
export default _default;
|
|
17
|
-
//# sourceMappingURL=NativeOrientationDirector.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"NativeOrientationDirector.d.ts","sourceRoot":"","sources":["../../../../src/NativeOrientationDirector.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAGhD,MAAM,WAAW,IAAK,SAAQ,WAAW;IACvC,uBAAuB,IAAI,OAAO,CAAC,MAAM,CAAC,CAAC;IAC3C,oBAAoB,IAAI,OAAO,CAAC,MAAM,CAAC,CAAC;IACxC,MAAM,CAAC,WAAW,EAAE,MAAM,GAAG,IAAI,CAAC;IAClC,MAAM,IAAI,IAAI,CAAC;IACf,QAAQ,IAAI,OAAO,CAAC;IACpB,mCAAmC,IAAI,IAAI,CAAC;IAO5C,qBAAqB,IAAI,OAAO,CAAC;IACjC,wBAAwB,IAAI,IAAI,CAAC;IACjC,yBAAyB,IAAI,IAAI,CAAC;IAKlC,WAAW,EAAE,CAAC,SAAS,EAAE,MAAM,KAAK,IAAI,CAAC;IACzC,eAAe,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;CAC1C;;AAED,wBAA6E"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"RNOrientationDirector.d.ts","sourceRoot":"","sources":["../../../../src/RNOrientationDirector.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,iCAAiC,EAAE,MAAM,gDAAgD,CAAC;AACxG,OAAO,EAAE,WAAW,EAAE,MAAM,0BAA0B,CAAC;AACvD,OAAO,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAC;AACzD,OAAO,EAAE,eAAe,EAAE,MAAM,8BAA8B,CAAC;AAC/D,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,oCAAoC,CAAC;AAC3E,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,kCAAkC,CAAC;AAC5E,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,+BAA+B,CAAC;AACjE,OAAO,KAAK,EAAE,kCAAkC,EAAE,MAAM,iDAAiD,CAAC;AAG1G,cAAM,qBAAqB;IACzB,OAAO,CAAC,MAAM,CAAC,kCAAkC,CAU7C;IAEJ,OAAO,CAAC,MAAM,CAAC,mCAAmC,CAK9C;IAEJ,4BAA4B,CAAC,QAAQ,EAAE,iCAAiC;IAIxE,6BAA6B,CAAC,QAAQ,EAAE,kCAAkC;IAI1E,MAAM,CAAC,uBAAuB,IAAI,OAAO,CAAC,WAAW,CAAC;IAItD,MAAM,CAAC,oBAAoB,IAAI,OAAO,CAAC,WAAW,CAAC;IAInD;;;;;;;;;;;;;;;;;OAiBG;IACH,MAAM,CAAC,MAAM,CACX,WAAW,EAAE,mBAAmB,EAChC,eAAe,GAAE,eAA2C;IAoB9D,MAAM,CAAC,MAAM;IAIb,MAAM,CAAC,QAAQ;IAIf,MAAM,CAAC,qBAAqB;IAS5B,MAAM,CAAC,mCAAmC;IAI1C,MAAM,CAAC,iCAAiC,CACtC,QAAQ,EAAE,CAAC,WAAW,EAAE,gBAAgB,KAAK,IAAI;IAKnD,MAAM,CAAC,oCAAoC,CACzC,QAAQ,EAAE,CAAC,WAAW,EAAE,gBAAgB,KAAK,IAAI;IAKnD,MAAM,CAAC,oBAAoB,CAAC,QAAQ,EAAE,CAAC,KAAK,EAAE,WAAW,KAAK,IAAI;IAIlE,MAAM,CAAC,uCAAuC,CAAC,WAAW,EAAE,WAAW;IAMvE,MAAM,CAAC,wCAAwC,CAAC,YAAY,EAAE,YAAY;IAM1E;;;;;;;;;;;;;;OAcG;IACH,MAAM,CAAC,qBAAqB,CAC1B,WAAW,EAAE,WAAW,GACvB,WAAW,IAAI,mBAAmB;CAOtC;AAED,eAAe,qBAAqB,CAAC"}
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import { Orientation } from '../types/Orientation.enum';
|
|
2
|
-
/**
|
|
3
|
-
* Hook that returns the current device orientation.
|
|
4
|
-
* It listens for orientation changes and updates the state accordingly.
|
|
5
|
-
*/
|
|
6
|
-
declare const useDeviceOrientation: () => Orientation;
|
|
7
|
-
export default useDeviceOrientation;
|
|
8
|
-
//# sourceMappingURL=useDeviceOrientation.hook.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"useDeviceOrientation.hook.d.ts","sourceRoot":"","sources":["../../../../../src/hooks/useDeviceOrientation.hook.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,WAAW,EAAE,MAAM,2BAA2B,CAAC;AAExD;;;GAGG;AACH,QAAA,MAAM,oBAAoB,mBA4BzB,CAAC;AAEF,eAAe,oBAAoB,CAAC"}
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import { Orientation } from '../types/Orientation.enum';
|
|
2
|
-
/**
|
|
3
|
-
* Hook that returns the current interface orientation.
|
|
4
|
-
* It listens for orientation changes and updates the state accordingly.
|
|
5
|
-
*/
|
|
6
|
-
declare const useInterfaceOrientation: () => Orientation;
|
|
7
|
-
export default useInterfaceOrientation;
|
|
8
|
-
//# sourceMappingURL=useInterfaceOrientation.hook.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"useInterfaceOrientation.hook.d.ts","sourceRoot":"","sources":["../../../../../src/hooks/useInterfaceOrientation.hook.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,WAAW,EAAE,MAAM,2BAA2B,CAAC;AAExD;;;GAGG;AACH,QAAA,MAAM,uBAAuB,mBA4B5B,CAAC;AAEF,eAAe,uBAAuB,CAAC"}
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Hook that returns whether the interface is locked.
|
|
3
|
-
* It listens for changes and updates the state accordingly.
|
|
4
|
-
*/
|
|
5
|
-
declare const useIsInterfaceOrientationLocked: () => boolean;
|
|
6
|
-
export default useIsInterfaceOrientationLocked;
|
|
7
|
-
//# sourceMappingURL=useIsInterfaceOrientationLocked.hook.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"useIsInterfaceOrientationLocked.hook.d.ts","sourceRoot":"","sources":["../../../../../src/hooks/useIsInterfaceOrientationLocked.hook.ts"],"names":[],"mappings":"AAIA;;;GAGG;AACH,QAAA,MAAM,+BAA+B,eAiBpC,CAAC;AAEF,eAAe,+BAA+B,CAAC"}
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
export { Orientation } from './types/Orientation.enum';
|
|
2
|
-
export { AutoRotation } from './types/AutoRotation.enum';
|
|
3
|
-
export { OrientationType } from './types/OrientationType.enum';
|
|
4
|
-
import useDeviceOrientation from './hooks/useDeviceOrientation.hook';
|
|
5
|
-
export { useDeviceOrientation };
|
|
6
|
-
import useInterfaceOrientation from './hooks/useInterfaceOrientation.hook';
|
|
7
|
-
export { useInterfaceOrientation };
|
|
8
|
-
import useIsInterfaceOrientationLocked from './hooks/useIsInterfaceOrientationLocked.hook';
|
|
9
|
-
export { useIsInterfaceOrientationLocked };
|
|
10
|
-
import RNOrientationDirector from './RNOrientationDirector';
|
|
11
|
-
export default RNOrientationDirector;
|
|
12
|
-
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/index.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,0BAA0B,CAAC;AACvD,OAAO,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAC;AACzD,OAAO,EAAE,eAAe,EAAE,MAAM,8BAA8B,CAAC;AAE/D,OAAO,oBAAoB,MAAM,mCAAmC,CAAC;AACrE,OAAO,EAAE,oBAAoB,EAAE,CAAC;AAEhC,OAAO,uBAAuB,MAAM,sCAAsC,CAAC;AAC3E,OAAO,EAAE,uBAAuB,EAAE,CAAC;AAEnC,OAAO,+BAA+B,MAAM,8CAA8C,CAAC;AAC3F,OAAO,EAAE,+BAA+B,EAAE,CAAC;AAE3C,OAAO,qBAAqB,MAAM,yBAAyB,CAAC;AAC5D,eAAe,qBAAqB,CAAC"}
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
import { NativeEventEmitter } from 'react-native';
|
|
2
|
-
import type { Spec } from './NativeOrientationDirector';
|
|
3
|
-
export declare const ModuleEventEmitter: NativeEventEmitter;
|
|
4
|
-
declare const _default: Spec;
|
|
5
|
-
export default _default;
|
|
6
|
-
//# sourceMappingURL=module.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"module.d.ts","sourceRoot":"","sources":["../../../../src/module.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAA2B,MAAM,cAAc,CAAC;AAC3E,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,6BAA6B,CAAC;AA0BxD,eAAO,MAAM,kBAAkB,oBAAiC,CAAC;wBAErB,IAAI;AAAhD,wBAAiD"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"AutoRotation.enum.d.ts","sourceRoot":"","sources":["../../../../../src/types/AutoRotation.enum.ts"],"names":[],"mappings":"AAAA,oBAAY,YAAY;IACtB,OAAO,IAAI;IACX,OAAO,IAAI;IACX,QAAQ,IAAI;CACb"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"Event.enum.d.ts","sourceRoot":"","sources":["../../../../../src/types/Event.enum.ts"],"names":[],"mappings":"AAAA,aAAK,KAAK;IACR,0BAA0B,+BAA+B;IACzD,6BAA6B,kCAAkC;IAC/D,aAAa,kBAAkB;CAChC;AAED,eAAe,KAAK,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"HumanReadableAutoRotationsResource.type.d.ts","sourceRoot":"","sources":["../../../../../src/types/HumanReadableAutoRotationsResource.type.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AAExD,MAAM,MAAM,kCAAkC,GAAG,MAAM,CAAC,YAAY,EAAE,MAAM,CAAC,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"HumanReadableOrientationsResource.type.d.ts","sourceRoot":"","sources":["../../../../../src/types/HumanReadableOrientationsResource.type.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AAEtD,MAAM,MAAM,iCAAiC,GAAG,MAAM,CAAC,WAAW,EAAE,MAAM,CAAC,CAAC"}
|
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
import { Orientation } from './Orientation.enum';
|
|
2
|
-
export type LockableOrientation = Orientation.portrait | Orientation.portraitUpsideDown | Orientation.landscapeLeft | Orientation.landscapeRight | Orientation.landscape;
|
|
3
|
-
//# sourceMappingURL=LockableOrientation.type.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"LockableOrientation.type.d.ts","sourceRoot":"","sources":["../../../../../src/types/LockableOrientation.type.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AAEjD,MAAM,MAAM,mBAAmB,GAC3B,WAAW,CAAC,QAAQ,GACpB,WAAW,CAAC,kBAAkB,GAC9B,WAAW,CAAC,aAAa,GACzB,WAAW,CAAC,cAAc,GAC1B,WAAW,CAAC,SAAS,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"LockedEvent.interface.d.ts","sourceRoot":"","sources":["../../../../../src/types/LockedEvent.interface.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,WAAW;IAC1B,MAAM,EAAE,OAAO,CAAC;CACjB"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"Orientation.enum.d.ts","sourceRoot":"","sources":["../../../../../src/types/Orientation.enum.ts"],"names":[],"mappings":"AAAA,oBAAY,WAAW;IACrB,OAAO,IAAI;IACX,QAAQ,IAAI;IACZ,cAAc,IAAI;IAClB,kBAAkB,IAAI;IACtB,aAAa,IAAI;IACjB,SAAS,IAAI;IACb,MAAM,IAAI;IACV,QAAQ,IAAI;CACb"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"OrientationEvent.interface.d.ts","sourceRoot":"","sources":["../../../../../src/types/OrientationEvent.interface.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AAEtD,MAAM,WAAW,gBAAgB;IAC/B,WAAW,EAAE,WAAW,CAAC;CAC1B"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"OrientationType.enum.d.ts","sourceRoot":"","sources":["../../../../../src/types/OrientationType.enum.ts"],"names":[],"mappings":"AAAA,oBAAY,eAAe;IACzB,MAAM,WAAW;IACjB,SAAS,cAAc;CACxB"}
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import { type ConfigPlugin, IOSConfig, type Mod, type ExportedConfig } from '@expo/config-plugins';
|
|
2
|
-
/**
|
|
3
|
-
* This plugin adds a new mod to the prebuild that is the appBridgingHeader.
|
|
4
|
-
* This allows us to update it when the user launches the prebuild script.
|
|
5
|
-
*/
|
|
6
|
-
export declare function withAppBridgingHeaderMod(config: ExportedConfig): ExportedConfig;
|
|
7
|
-
/**
|
|
8
|
-
* This mod provides the app bridging header for modifications
|
|
9
|
-
* @param config
|
|
10
|
-
* @param action
|
|
11
|
-
*/
|
|
12
|
-
export declare const withAppBridgingHeader: ConfigPlugin<Mod<IOSConfig.Paths.AppDelegateProjectFile>>;
|
|
@@ -1,107 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
-
if (k2 === undefined) k2 = k;
|
|
4
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
-
}
|
|
8
|
-
Object.defineProperty(o, k2, desc);
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
-
}) : function(o, v) {
|
|
16
|
-
o["default"] = v;
|
|
17
|
-
});
|
|
18
|
-
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
-
var ownKeys = function(o) {
|
|
20
|
-
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
-
var ar = [];
|
|
22
|
-
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
-
return ar;
|
|
24
|
-
};
|
|
25
|
-
return ownKeys(o);
|
|
26
|
-
};
|
|
27
|
-
return function (mod) {
|
|
28
|
-
if (mod && mod.__esModule) return mod;
|
|
29
|
-
var result = {};
|
|
30
|
-
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
-
__setModuleDefault(result, mod);
|
|
32
|
-
return result;
|
|
33
|
-
};
|
|
34
|
-
})();
|
|
35
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
|
-
exports.withAppBridgingHeader = void 0;
|
|
37
|
-
exports.withAppBridgingHeaderMod = withAppBridgingHeaderMod;
|
|
38
|
-
const config_plugins_1 = require("@expo/config-plugins");
|
|
39
|
-
const glob_1 = require("glob");
|
|
40
|
-
const fs = __importStar(require("node:fs"));
|
|
41
|
-
/**
|
|
42
|
-
* Reference: https://github.com/expo/expo/blob/cb38337d37c35a26ac9a39eac2268c4735f488ad/packages/%40expo/config-plugins/src/ios/Paths.ts#L10C1-L10C69
|
|
43
|
-
*/
|
|
44
|
-
const ignoredPaths = ['**/@(Carthage|Pods|vendor|node_modules)/**'];
|
|
45
|
-
/**
|
|
46
|
-
* This plugin adds a new mod to the prebuild that is the appBridgingHeader.
|
|
47
|
-
* This allows us to update it when the user launches the prebuild script.
|
|
48
|
-
*/
|
|
49
|
-
function withAppBridgingHeaderMod(config) {
|
|
50
|
-
return config_plugins_1.BaseMods.withGeneratedBaseMods(config, {
|
|
51
|
-
platform: 'ios',
|
|
52
|
-
providers: {
|
|
53
|
-
// Append a custom rule to supply AppDelegate header data to mods on `mods.ios.appBridgingHeader`
|
|
54
|
-
appBridgingHeader: config_plugins_1.BaseMods.provider({
|
|
55
|
-
// Get the local filepath that should be passed to the `read` method.
|
|
56
|
-
getFilePath({ modRequest: { projectRoot } }) {
|
|
57
|
-
return getBridgingHeaderFilePath(projectRoot);
|
|
58
|
-
},
|
|
59
|
-
// Read the input file from the filesystem.
|
|
60
|
-
async read(filePath) {
|
|
61
|
-
return config_plugins_1.IOSConfig.Paths.getFileInfo(filePath);
|
|
62
|
-
},
|
|
63
|
-
// Write the resulting output to the filesystem.
|
|
64
|
-
async write(filePath, { modResults: { contents } }) {
|
|
65
|
-
await fs.promises.writeFile(filePath, contents);
|
|
66
|
-
},
|
|
67
|
-
}),
|
|
68
|
-
},
|
|
69
|
-
});
|
|
70
|
-
}
|
|
71
|
-
/**
|
|
72
|
-
* This mod provides the app bridging header for modifications
|
|
73
|
-
* @param config
|
|
74
|
-
* @param action
|
|
75
|
-
*/
|
|
76
|
-
const withAppBridgingHeader = (config, action) => {
|
|
77
|
-
return (0, config_plugins_1.withMod)(config, {
|
|
78
|
-
platform: 'ios',
|
|
79
|
-
mod: 'appBridgingHeader',
|
|
80
|
-
action,
|
|
81
|
-
});
|
|
82
|
-
};
|
|
83
|
-
exports.withAppBridgingHeader = withAppBridgingHeader;
|
|
84
|
-
/**
|
|
85
|
-
* Reference: https://github.com/expo/expo/blob/cb38337d37c35a26ac9a39eac2268c4735f488ad/packages/%40expo/config-plugins/src/ios/Paths.ts#L23
|
|
86
|
-
* @param projectRoot
|
|
87
|
-
*/
|
|
88
|
-
function getBridgingHeaderFilePath(projectRoot) {
|
|
89
|
-
const [using, ...extra] = withSortedGlobResult((0, glob_1.globSync)('ios/*/*-Bridging-Header.h', {
|
|
90
|
-
absolute: true,
|
|
91
|
-
cwd: projectRoot,
|
|
92
|
-
ignore: ignoredPaths,
|
|
93
|
-
}));
|
|
94
|
-
if (!using) {
|
|
95
|
-
throw new Error(`Could not locate a valid Bridging-Header at root: "${projectRoot}"`);
|
|
96
|
-
}
|
|
97
|
-
if (extra.length) {
|
|
98
|
-
throw new Error(`Multiple Bridging-Header found at root: "${projectRoot}"`);
|
|
99
|
-
}
|
|
100
|
-
return using;
|
|
101
|
-
}
|
|
102
|
-
/**
|
|
103
|
-
* Reference: https://github.com/expo/expo/blob/main/packages/%40expo/config-plugins/src/utils/glob.ts
|
|
104
|
-
*/
|
|
105
|
-
function withSortedGlobResult(glob) {
|
|
106
|
-
return glob.sort((a, b) => a.localeCompare(b));
|
|
107
|
-
}
|
package/plugin/build/index.d.ts
DELETED
package/plugin/build/index.js
DELETED
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
const config_plugins_1 = require("@expo/config-plugins");
|
|
4
|
-
const withBridgingHeader_1 = require("./custom-mod/withBridgingHeader");
|
|
5
|
-
const withRNOrientationAppDelegate_1 = require("./withRNOrientationAppDelegate");
|
|
6
|
-
const withRNOrientationBridgingHeader_1 = require("./withRNOrientationBridgingHeader");
|
|
7
|
-
const withRNOrientationMainActivity_1 = require("./withRNOrientationMainActivity");
|
|
8
|
-
/**
|
|
9
|
-
* So, expo config plugin are awesome and the documentation is well written, but I still needed to look around to see
|
|
10
|
-
* how other projects actually modify the AppDelegate. I've found react-native-firebase to implement a plugin config
|
|
11
|
-
* that changes the AppDelegate, so I'll leave their link as reference:
|
|
12
|
-
* https://github.com/invertase/react-native-firebase/blob/main/packages/app/plugin/src/ios/appDelegate.ts
|
|
13
|
-
*
|
|
14
|
-
* Kudos to them, because this stuff is hard!
|
|
15
|
-
*
|
|
16
|
-
* @param config
|
|
17
|
-
*/
|
|
18
|
-
const withRNOrientationDirector = (config) => {
|
|
19
|
-
return (0, config_plugins_1.withPlugins)(config, [
|
|
20
|
-
withRNOrientationAppDelegate_1.withRNOrientationAppDelegate,
|
|
21
|
-
withRNOrientationBridgingHeader_1.withRNOrientationBridgingHeader,
|
|
22
|
-
withRNOrientationMainActivity_1.withRNOrientationMainActivity,
|
|
23
|
-
withBridgingHeader_1.withAppBridgingHeaderMod,
|
|
24
|
-
]);
|
|
25
|
-
};
|
|
26
|
-
const pak = require('react-native-orientation-director/package.json');
|
|
27
|
-
exports.default = (0, config_plugins_1.createRunOncePlugin)(withRNOrientationDirector, pak.name, pak.version);
|
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
import { type ConfigPlugin } from '@expo/config-plugins';
|
|
2
|
-
export declare const withRNOrientationAppDelegate: ConfigPlugin;
|
|
3
|
-
export declare function swiftFileUpdater(originalContents: string, sdkVersion?: string): string;
|
|
4
|
-
export declare function objCFileUpdater(originalContents: string): string;
|
|
@@ -1,102 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.withRNOrientationAppDelegate = void 0;
|
|
4
|
-
exports.swiftFileUpdater = swiftFileUpdater;
|
|
5
|
-
exports.objCFileUpdater = objCFileUpdater;
|
|
6
|
-
const config_plugins_1 = require("@expo/config-plugins");
|
|
7
|
-
const generateCode_1 = require("@expo/config-plugins/build/utils/generateCode");
|
|
8
|
-
const withRNOrientationAppDelegate = (config) => {
|
|
9
|
-
return (0, config_plugins_1.withAppDelegate)(config, readAppDelegateFileAndUpdateContents);
|
|
10
|
-
};
|
|
11
|
-
exports.withRNOrientationAppDelegate = withRNOrientationAppDelegate;
|
|
12
|
-
async function readAppDelegateFileAndUpdateContents(config) {
|
|
13
|
-
const { modResults: appDelegateFile } = config;
|
|
14
|
-
const fileUpdater = getCompatibleFileUpdater(appDelegateFile.language);
|
|
15
|
-
if (fileUpdater.language === 'swift') {
|
|
16
|
-
const { worker } = fileUpdater;
|
|
17
|
-
appDelegateFile.contents = worker(appDelegateFile.contents, config.sdkVersion);
|
|
18
|
-
}
|
|
19
|
-
else {
|
|
20
|
-
const { worker } = fileUpdater;
|
|
21
|
-
appDelegateFile.contents = worker(appDelegateFile.contents);
|
|
22
|
-
}
|
|
23
|
-
return config;
|
|
24
|
-
}
|
|
25
|
-
function getCompatibleFileUpdater(language) {
|
|
26
|
-
switch (language) {
|
|
27
|
-
case 'objc':
|
|
28
|
-
case 'objcpp': {
|
|
29
|
-
return {
|
|
30
|
-
language,
|
|
31
|
-
worker: objCFileUpdater,
|
|
32
|
-
};
|
|
33
|
-
}
|
|
34
|
-
case 'swift':
|
|
35
|
-
return {
|
|
36
|
-
language,
|
|
37
|
-
worker: swiftFileUpdater,
|
|
38
|
-
};
|
|
39
|
-
default:
|
|
40
|
-
throw new Error(`Cannot add React Native Orientation Director code to AppDelegate of language "${language}"`);
|
|
41
|
-
}
|
|
42
|
-
}
|
|
43
|
-
function swiftFileUpdater(originalContents, sdkVersion) {
|
|
44
|
-
const methodPrefix = computeMethodPrefix(sdkVersion);
|
|
45
|
-
const supportedInterfaceOrientationsForCodeBlock = `\n ${methodPrefix} func application(_ application: UIApplication, supportedInterfaceOrientationsFor window: UIWindow?) -> UIInterfaceOrientationMask {
|
|
46
|
-
return OrientationDirector.getSupportedInterfaceOrientationsForWindow()
|
|
47
|
-
}\n`;
|
|
48
|
-
const rightBeforeLastClosingBrace = /didFinishLaunchingWithOptions:\s*launchOptions\)/g;
|
|
49
|
-
const pasteInTheListJustAfterTheClosingBracket = 2;
|
|
50
|
-
const results = (0, generateCode_1.mergeContents)({
|
|
51
|
-
tag: '@react-native-orientation-director/supportedInterfaceOrientationsFor-implementation',
|
|
52
|
-
src: originalContents,
|
|
53
|
-
newSrc: supportedInterfaceOrientationsForCodeBlock,
|
|
54
|
-
anchor: rightBeforeLastClosingBrace,
|
|
55
|
-
offset: pasteInTheListJustAfterTheClosingBracket,
|
|
56
|
-
comment: '// React Native Orientation Director',
|
|
57
|
-
});
|
|
58
|
-
return results.contents;
|
|
59
|
-
function computeMethodPrefix(_sdkVersion) {
|
|
60
|
-
if (!_sdkVersion) {
|
|
61
|
-
return '';
|
|
62
|
-
}
|
|
63
|
-
const rawMajor = _sdkVersion.split('.').at(0);
|
|
64
|
-
if (!rawMajor) {
|
|
65
|
-
return '';
|
|
66
|
-
}
|
|
67
|
-
const major = Number(rawMajor);
|
|
68
|
-
if (Number.isNaN(major)) {
|
|
69
|
-
return '';
|
|
70
|
-
}
|
|
71
|
-
if (major === 53) {
|
|
72
|
-
return '';
|
|
73
|
-
}
|
|
74
|
-
return 'public override';
|
|
75
|
-
}
|
|
76
|
-
}
|
|
77
|
-
function objCFileUpdater(originalContents) {
|
|
78
|
-
const libraryHeaderImportCodeBlock = '#import "OrientationDirector.h"\n';
|
|
79
|
-
const rightBeforeAppDelegateImplementation = /@implementation\s+\w+/g;
|
|
80
|
-
const headerImportMergeResults = (0, generateCode_1.mergeContents)({
|
|
81
|
-
tag: '@react-native-orientation-director/library-header-import',
|
|
82
|
-
src: originalContents,
|
|
83
|
-
newSrc: libraryHeaderImportCodeBlock,
|
|
84
|
-
anchor: rightBeforeAppDelegateImplementation,
|
|
85
|
-
offset: 0,
|
|
86
|
-
comment: '// React Native Orientation Director',
|
|
87
|
-
});
|
|
88
|
-
const supportedInterfaceOrientationsForCodeBlock = `- (UIInterfaceOrientationMask)application:(UIApplication *)application supportedInterfaceOrientationsForWindow:(UIWindow *)window
|
|
89
|
-
{
|
|
90
|
-
return [OrientationDirector getSupportedInterfaceOrientationsForWindow];
|
|
91
|
-
}\n`;
|
|
92
|
-
const rightBeforeLastClosingEnd = /@end[^@]*$/g;
|
|
93
|
-
const implementationMergeResults = (0, generateCode_1.mergeContents)({
|
|
94
|
-
tag: '@react-native-orientation-director/supportedInterfaceOrientationsFor-implementation',
|
|
95
|
-
src: headerImportMergeResults.contents,
|
|
96
|
-
newSrc: supportedInterfaceOrientationsForCodeBlock,
|
|
97
|
-
anchor: rightBeforeLastClosingEnd,
|
|
98
|
-
offset: 0,
|
|
99
|
-
comment: '// React Native Orientation Director',
|
|
100
|
-
});
|
|
101
|
-
return implementationMergeResults.contents;
|
|
102
|
-
}
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.withRNOrientationBridgingHeader = void 0;
|
|
4
|
-
exports.bridgingHeaderUpdater = bridgingHeaderUpdater;
|
|
5
|
-
const config_plugins_1 = require("@expo/config-plugins");
|
|
6
|
-
const withBridgingHeader_1 = require("./custom-mod/withBridgingHeader");
|
|
7
|
-
const withRNOrientationBridgingHeader = (config) => {
|
|
8
|
-
return (0, withBridgingHeader_1.withAppBridgingHeader)(config, readBridgingHeaderFileAndUpdateContents);
|
|
9
|
-
};
|
|
10
|
-
exports.withRNOrientationBridgingHeader = withRNOrientationBridgingHeader;
|
|
11
|
-
async function readBridgingHeaderFileAndUpdateContents(config) {
|
|
12
|
-
const { projectRoot } = config.modRequest;
|
|
13
|
-
if (isObjCTemplate(projectRoot)) {
|
|
14
|
-
return config;
|
|
15
|
-
}
|
|
16
|
-
const { modResults: bridgingHeaderFile } = config;
|
|
17
|
-
bridgingHeaderFile.contents = bridgingHeaderUpdater(bridgingHeaderFile.contents);
|
|
18
|
-
return config;
|
|
19
|
-
}
|
|
20
|
-
function bridgingHeaderUpdater(originalContents) {
|
|
21
|
-
const libraryHeaderImport = '#import "OrientationDirector.h"';
|
|
22
|
-
return originalContents.concat(`\n${libraryHeaderImport}`);
|
|
23
|
-
}
|
|
24
|
-
function isObjCTemplate(projectRoot) {
|
|
25
|
-
const appDelegateFile = config_plugins_1.IOSConfig.Paths.getAppDelegate(projectRoot);
|
|
26
|
-
return appDelegateFile.language !== 'swift';
|
|
27
|
-
}
|