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.
Files changed (178) hide show
  1. package/README.md +11 -33
  2. package/android/build.gradle +19 -79
  3. package/android/src/main/AndroidManifest.xml +1 -2
  4. package/android/src/{newarch → main/java/com/orientationdirector}/OrientationDirectorModule.kt +20 -11
  5. package/android/src/main/java/com/orientationdirector/OrientationDirectorPackage.kt +15 -20
  6. package/android/src/main/java/com/orientationdirector/implementation/EventManager.kt +4 -17
  7. package/android/src/main/java/com/orientationdirector/implementation/EventManagerDelegate.kt +9 -0
  8. package/android/src/main/java/com/orientationdirector/implementation/OrientationDirectorModuleImpl.kt +23 -24
  9. package/android/src/main/java/com/orientationdirector/implementation/OrientationSensorsEventListener.kt +73 -80
  10. package/android/src/main/java/com/orientationdirector/implementation/Utils.kt +0 -54
  11. package/app.plugin.js +1 -1
  12. package/ios/OrientationDirector.h +1 -18
  13. package/ios/OrientationDirector.mm +35 -35
  14. package/ios/SharedOrientationDirectorImpl.swift +12 -0
  15. package/ios/implementation/EventManager.swift +12 -37
  16. package/ios/implementation/OrientationDirectorImpl.swift +6 -6
  17. package/lib/module/EventEmitter.js +15 -9
  18. package/lib/module/EventEmitter.js.map +1 -1
  19. package/lib/module/NativeOrientationDirector.js.map +1 -1
  20. package/lib/module/module.js +1 -2
  21. package/lib/module/module.js.map +1 -1
  22. package/lib/plugin/index.d.ts +3 -0
  23. package/lib/plugin/index.js +10 -0
  24. package/lib/plugin/withAndroidConfiguration.d.ts +3 -0
  25. package/{plugin/build/withRNOrientationMainActivity.js → lib/plugin/withAndroidConfiguration.js} +3 -3
  26. package/lib/plugin/withIosConfiguration.d.ts +3 -0
  27. package/lib/plugin/withIosConfiguration.js +62 -0
  28. package/lib/typescript/{commonjs/src → src}/EventEmitter.d.ts +5 -4
  29. package/lib/typescript/src/EventEmitter.d.ts.map +1 -0
  30. package/lib/typescript/{commonjs/src → src}/NativeOrientationDirector.d.ts +10 -3
  31. package/lib/typescript/src/NativeOrientationDirector.d.ts.map +1 -0
  32. package/lib/typescript/{module/src → src}/RNOrientationDirector.d.ts +3 -3
  33. package/lib/typescript/src/RNOrientationDirector.d.ts.map +1 -0
  34. package/lib/typescript/src/hooks/useDeviceOrientation.hook.d.ts.map +1 -0
  35. package/lib/typescript/src/hooks/useInterfaceOrientation.hook.d.ts.map +1 -0
  36. package/lib/typescript/src/hooks/useIsInterfaceOrientationLocked.hook.d.ts.map +1 -0
  37. package/lib/typescript/src/index.d.ts.map +1 -0
  38. package/lib/typescript/src/module.d.ts +4 -0
  39. package/lib/typescript/src/module.d.ts.map +1 -0
  40. package/lib/typescript/src/types/AutoRotation.enum.d.ts.map +1 -0
  41. package/lib/typescript/src/types/Event.enum.d.ts.map +1 -0
  42. package/lib/typescript/src/types/HumanReadableAutoRotationsResource.type.d.ts.map +1 -0
  43. package/lib/typescript/src/types/HumanReadableOrientationsResource.type.d.ts.map +1 -0
  44. package/lib/typescript/src/types/LockableOrientation.type.d.ts.map +1 -0
  45. package/lib/typescript/src/types/LockedEvent.interface.d.ts.map +1 -0
  46. package/lib/typescript/src/types/Orientation.enum.d.ts.map +1 -0
  47. package/lib/typescript/src/types/OrientationEvent.interface.d.ts.map +1 -0
  48. package/lib/typescript/src/types/OrientationType.enum.d.ts.map +1 -0
  49. package/package.json +72 -77
  50. package/react-native-orientation-director.podspec +4 -24
  51. package/src/EventEmitter.ts +21 -24
  52. package/src/NativeOrientationDirector.ts +8 -3
  53. package/src/module.ts +1 -3
  54. package/android/gradle.properties +0 -17
  55. package/android/src/main/AndroidManifestNew.xml +0 -2
  56. package/android/src/oldarch/OrientationDirectorModule.kt +0 -66
  57. package/android/src/test/java/com/orientationdirector/implementation/OrientationDirectorModuleImplTest.kt +0 -199
  58. package/android/src/test/java/com/orientationdirector/implementation/UtilsTest.kt +0 -314
  59. package/ios/react-native-orientation-director-Bridging-Header.h +0 -6
  60. package/lib/commonjs/EventEmitter.js +0 -48
  61. package/lib/commonjs/NativeOrientationDirector.js +0 -8
  62. package/lib/commonjs/RNOrientationDirector.js +0 -126
  63. package/lib/commonjs/hooks/useDeviceOrientation.hook.js +0 -37
  64. package/lib/commonjs/hooks/useInterfaceOrientation.hook.js +0 -37
  65. package/lib/commonjs/hooks/useIsInterfaceOrientationLocked.hook.js +0 -27
  66. package/lib/commonjs/index.js +0 -51
  67. package/lib/commonjs/module.js +0 -22
  68. package/lib/commonjs/package.json +0 -1
  69. package/lib/commonjs/types/AutoRotation.enum.js +0 -12
  70. package/lib/commonjs/types/Event.enum.js +0 -13
  71. package/lib/commonjs/types/HumanReadableAutoRotationsResource.type.js +0 -5
  72. package/lib/commonjs/types/HumanReadableOrientationsResource.type.js +0 -5
  73. package/lib/commonjs/types/LockableOrientation.type.js +0 -5
  74. package/lib/commonjs/types/LockedEvent.interface.js +0 -1
  75. package/lib/commonjs/types/Orientation.enum.js +0 -17
  76. package/lib/commonjs/types/OrientationEvent.interface.js +0 -5
  77. package/lib/commonjs/types/OrientationType.enum.js +0 -11
  78. package/lib/typescript/commonjs/example/src/App.d.ts +0 -2
  79. package/lib/typescript/commonjs/example/src/App.d.ts.map +0 -1
  80. package/lib/typescript/commonjs/example/src/AppNavigationContainer.d.ts +0 -3
  81. package/lib/typescript/commonjs/example/src/AppNavigationContainer.d.ts.map +0 -1
  82. package/lib/typescript/commonjs/example/src/screens/Explore.d.ts +0 -3
  83. package/lib/typescript/commonjs/example/src/screens/Explore.d.ts.map +0 -1
  84. package/lib/typescript/commonjs/example/src/screens/Home.d.ts +0 -3
  85. package/lib/typescript/commonjs/example/src/screens/Home.d.ts.map +0 -1
  86. package/lib/typescript/commonjs/example/src/screens/InnerExplore.d.ts +0 -3
  87. package/lib/typescript/commonjs/example/src/screens/InnerExplore.d.ts.map +0 -1
  88. package/lib/typescript/commonjs/example/src/screens/styles.d.ts +0 -51
  89. package/lib/typescript/commonjs/example/src/screens/styles.d.ts.map +0 -1
  90. package/lib/typescript/commonjs/package.json +0 -1
  91. package/lib/typescript/commonjs/src/EventEmitter.d.ts.map +0 -1
  92. package/lib/typescript/commonjs/src/NativeOrientationDirector.d.ts.map +0 -1
  93. package/lib/typescript/commonjs/src/RNOrientationDirector.d.ts +0 -62
  94. package/lib/typescript/commonjs/src/RNOrientationDirector.d.ts.map +0 -1
  95. package/lib/typescript/commonjs/src/hooks/useDeviceOrientation.hook.d.ts.map +0 -1
  96. package/lib/typescript/commonjs/src/hooks/useInterfaceOrientation.hook.d.ts.map +0 -1
  97. package/lib/typescript/commonjs/src/hooks/useIsInterfaceOrientationLocked.hook.d.ts.map +0 -1
  98. package/lib/typescript/commonjs/src/index.d.ts.map +0 -1
  99. package/lib/typescript/commonjs/src/module.d.ts +0 -6
  100. package/lib/typescript/commonjs/src/module.d.ts.map +0 -1
  101. package/lib/typescript/commonjs/src/types/AutoRotation.enum.d.ts.map +0 -1
  102. package/lib/typescript/commonjs/src/types/Event.enum.d.ts.map +0 -1
  103. package/lib/typescript/commonjs/src/types/HumanReadableAutoRotationsResource.type.d.ts.map +0 -1
  104. package/lib/typescript/commonjs/src/types/HumanReadableOrientationsResource.type.d.ts.map +0 -1
  105. package/lib/typescript/commonjs/src/types/LockableOrientation.type.d.ts.map +0 -1
  106. package/lib/typescript/commonjs/src/types/LockedEvent.interface.d.ts.map +0 -1
  107. package/lib/typescript/commonjs/src/types/Orientation.enum.d.ts.map +0 -1
  108. package/lib/typescript/commonjs/src/types/OrientationEvent.interface.d.ts.map +0 -1
  109. package/lib/typescript/commonjs/src/types/OrientationType.enum.d.ts.map +0 -1
  110. package/lib/typescript/module/example/src/App.d.ts +0 -2
  111. package/lib/typescript/module/example/src/App.d.ts.map +0 -1
  112. package/lib/typescript/module/example/src/AppNavigationContainer.d.ts +0 -3
  113. package/lib/typescript/module/example/src/AppNavigationContainer.d.ts.map +0 -1
  114. package/lib/typescript/module/example/src/screens/Explore.d.ts +0 -3
  115. package/lib/typescript/module/example/src/screens/Explore.d.ts.map +0 -1
  116. package/lib/typescript/module/example/src/screens/Home.d.ts +0 -3
  117. package/lib/typescript/module/example/src/screens/Home.d.ts.map +0 -1
  118. package/lib/typescript/module/example/src/screens/InnerExplore.d.ts +0 -3
  119. package/lib/typescript/module/example/src/screens/InnerExplore.d.ts.map +0 -1
  120. package/lib/typescript/module/example/src/screens/styles.d.ts +0 -51
  121. package/lib/typescript/module/example/src/screens/styles.d.ts.map +0 -1
  122. package/lib/typescript/module/src/EventEmitter.d.ts +0 -11
  123. package/lib/typescript/module/src/EventEmitter.d.ts.map +0 -1
  124. package/lib/typescript/module/src/NativeOrientationDirector.d.ts +0 -17
  125. package/lib/typescript/module/src/NativeOrientationDirector.d.ts.map +0 -1
  126. package/lib/typescript/module/src/RNOrientationDirector.d.ts.map +0 -1
  127. package/lib/typescript/module/src/hooks/useDeviceOrientation.hook.d.ts +0 -8
  128. package/lib/typescript/module/src/hooks/useDeviceOrientation.hook.d.ts.map +0 -1
  129. package/lib/typescript/module/src/hooks/useInterfaceOrientation.hook.d.ts +0 -8
  130. package/lib/typescript/module/src/hooks/useInterfaceOrientation.hook.d.ts.map +0 -1
  131. package/lib/typescript/module/src/hooks/useIsInterfaceOrientationLocked.hook.d.ts +0 -7
  132. package/lib/typescript/module/src/hooks/useIsInterfaceOrientationLocked.hook.d.ts.map +0 -1
  133. package/lib/typescript/module/src/index.d.ts +0 -12
  134. package/lib/typescript/module/src/index.d.ts.map +0 -1
  135. package/lib/typescript/module/src/module.d.ts +0 -6
  136. package/lib/typescript/module/src/module.d.ts.map +0 -1
  137. package/lib/typescript/module/src/types/AutoRotation.enum.d.ts +0 -6
  138. package/lib/typescript/module/src/types/AutoRotation.enum.d.ts.map +0 -1
  139. package/lib/typescript/module/src/types/Event.enum.d.ts +0 -7
  140. package/lib/typescript/module/src/types/Event.enum.d.ts.map +0 -1
  141. package/lib/typescript/module/src/types/HumanReadableAutoRotationsResource.type.d.ts +0 -3
  142. package/lib/typescript/module/src/types/HumanReadableAutoRotationsResource.type.d.ts.map +0 -1
  143. package/lib/typescript/module/src/types/HumanReadableOrientationsResource.type.d.ts +0 -3
  144. package/lib/typescript/module/src/types/HumanReadableOrientationsResource.type.d.ts.map +0 -1
  145. package/lib/typescript/module/src/types/LockableOrientation.type.d.ts +0 -3
  146. package/lib/typescript/module/src/types/LockableOrientation.type.d.ts.map +0 -1
  147. package/lib/typescript/module/src/types/LockedEvent.interface.d.ts +0 -4
  148. package/lib/typescript/module/src/types/LockedEvent.interface.d.ts.map +0 -1
  149. package/lib/typescript/module/src/types/Orientation.enum.d.ts +0 -11
  150. package/lib/typescript/module/src/types/Orientation.enum.d.ts.map +0 -1
  151. package/lib/typescript/module/src/types/OrientationEvent.interface.d.ts +0 -5
  152. package/lib/typescript/module/src/types/OrientationEvent.interface.d.ts.map +0 -1
  153. package/lib/typescript/module/src/types/OrientationType.enum.d.ts +0 -5
  154. package/lib/typescript/module/src/types/OrientationType.enum.d.ts.map +0 -1
  155. package/plugin/build/custom-mod/withBridgingHeader.d.ts +0 -12
  156. package/plugin/build/custom-mod/withBridgingHeader.js +0 -107
  157. package/plugin/build/index.d.ts +0 -3
  158. package/plugin/build/index.js +0 -27
  159. package/plugin/build/withRNOrientationAppDelegate.d.ts +0 -4
  160. package/plugin/build/withRNOrientationAppDelegate.js +0 -102
  161. package/plugin/build/withRNOrientationBridgingHeader.d.ts +0 -3
  162. package/plugin/build/withRNOrientationBridgingHeader.js +0 -27
  163. package/plugin/build/withRNOrientationMainActivity.d.ts +0 -3
  164. package/plugin/tsconfig.json +0 -9
  165. /package/lib/typescript/{module/package.json → package.json} +0 -0
  166. /package/lib/typescript/{commonjs/src → src}/hooks/useDeviceOrientation.hook.d.ts +0 -0
  167. /package/lib/typescript/{commonjs/src → src}/hooks/useInterfaceOrientation.hook.d.ts +0 -0
  168. /package/lib/typescript/{commonjs/src → src}/hooks/useIsInterfaceOrientationLocked.hook.d.ts +0 -0
  169. /package/lib/typescript/{commonjs/src → src}/index.d.ts +0 -0
  170. /package/lib/typescript/{commonjs/src → src}/types/AutoRotation.enum.d.ts +0 -0
  171. /package/lib/typescript/{commonjs/src → src}/types/Event.enum.d.ts +0 -0
  172. /package/lib/typescript/{commonjs/src → src}/types/HumanReadableAutoRotationsResource.type.d.ts +0 -0
  173. /package/lib/typescript/{commonjs/src → src}/types/HumanReadableOrientationsResource.type.d.ts +0 -0
  174. /package/lib/typescript/{commonjs/src → src}/types/LockableOrientation.type.d.ts +0 -0
  175. /package/lib/typescript/{commonjs/src → src}/types/LockedEvent.interface.d.ts +0 -0
  176. /package/lib/typescript/{commonjs/src → src}/types/Orientation.enum.d.ts +0 -0
  177. /package/lib/typescript/{commonjs/src → src}/types/OrientationEvent.interface.d.ts +0 -0
  178. /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,2 +0,0 @@
1
- export default function App(): import("react/jsx-runtime").JSX.Element;
2
- //# sourceMappingURL=App.d.ts.map
@@ -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,3 +0,0 @@
1
- declare function AppNavigationContainer(): import("react/jsx-runtime").JSX.Element;
2
- export default AppNavigationContainer;
3
- //# sourceMappingURL=AppNavigationContainer.d.ts.map
@@ -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,3 +0,0 @@
1
- declare function Explore(): import("react/jsx-runtime").JSX.Element;
2
- export default Explore;
3
- //# sourceMappingURL=Explore.d.ts.map
@@ -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,3 +0,0 @@
1
- declare function Home(): import("react/jsx-runtime").JSX.Element;
2
- export default Home;
3
- //# sourceMappingURL=Home.d.ts.map
@@ -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,3 +0,0 @@
1
- declare function InnerExplore(): import("react/jsx-runtime").JSX.Element;
2
- export default InnerExplore;
3
- //# sourceMappingURL=InnerExplore.d.ts.map
@@ -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,6 +0,0 @@
1
- export declare enum AutoRotation {
2
- unknown = 0,
3
- enabled = 1,
4
- disabled = 2
5
- }
6
- //# sourceMappingURL=AutoRotation.enum.d.ts.map
@@ -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,7 +0,0 @@
1
- declare enum Event {
2
- DeviceOrientationDidChange = "DeviceOrientationDidChange",
3
- InterfaceOrientationDidChange = "InterfaceOrientationDidChange",
4
- LockDidChange = "LockDidChange"
5
- }
6
- export default Event;
7
- //# sourceMappingURL=Event.enum.d.ts.map
@@ -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,3 +0,0 @@
1
- import type { AutoRotation } from './AutoRotation.enum';
2
- export type HumanReadableAutoRotationsResource = Record<AutoRotation, string>;
3
- //# sourceMappingURL=HumanReadableAutoRotationsResource.type.d.ts.map
@@ -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,3 +0,0 @@
1
- import type { Orientation } from './Orientation.enum';
2
- export type HumanReadableOrientationsResource = Record<Orientation, string>;
3
- //# sourceMappingURL=HumanReadableOrientationsResource.type.d.ts.map
@@ -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,4 +0,0 @@
1
- export interface LockedEvent {
2
- locked: boolean;
3
- }
4
- //# sourceMappingURL=LockedEvent.interface.d.ts.map
@@ -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,11 +0,0 @@
1
- export declare enum Orientation {
2
- unknown = 0,
3
- portrait = 1,
4
- landscapeRight = 2,
5
- portraitUpsideDown = 3,
6
- landscapeLeft = 4,
7
- landscape = 5,
8
- faceUp = 6,
9
- faceDown = 7
10
- }
11
- //# sourceMappingURL=Orientation.enum.d.ts.map
@@ -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,5 +0,0 @@
1
- import type { Orientation } from './Orientation.enum';
2
- export interface OrientationEvent {
3
- orientation: Orientation;
4
- }
5
- //# sourceMappingURL=OrientationEvent.interface.d.ts.map
@@ -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,5 +0,0 @@
1
- export declare enum OrientationType {
2
- device = "device",
3
- interface = "interface"
4
- }
5
- //# sourceMappingURL=OrientationType.enum.d.ts.map
@@ -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
- }
@@ -1,3 +0,0 @@
1
- import { type ConfigPlugin } from '@expo/config-plugins';
2
- declare const _default: ConfigPlugin<void>;
3
- export default _default;
@@ -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,3 +0,0 @@
1
- import { type ConfigPlugin } from '@expo/config-plugins';
2
- export declare const withRNOrientationBridgingHeader: ConfigPlugin;
3
- export declare function bridgingHeaderUpdater(originalContents: string): string;
@@ -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
- }
@@ -1,3 +0,0 @@
1
- import { type ConfigPlugin } from '@expo/config-plugins';
2
- export declare const withRNOrientationMainActivity: ConfigPlugin;
3
- export declare function ktFileUpdater(originalContents: string): string;