react-native-orientation-director 2.1.0 → 2.3.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 (76) hide show
  1. package/README.md +40 -6
  2. package/android/build.gradle +7 -12
  3. package/android/gradle.properties +5 -5
  4. package/android/src/main/java/com/orientationdirector/OrientationDirectorPackage.kt +2 -3
  5. package/android/src/main/java/com/orientationdirector/implementation/Orientation.kt +1 -0
  6. package/android/src/main/java/com/orientationdirector/implementation/OrientationDirectorModuleImpl.kt +32 -2
  7. package/android/src/main/java/com/orientationdirector/implementation/Utils.kt +10 -0
  8. package/android/src/test/java/com/orientationdirector/implementation/OrientationDirectorModuleImplTest.kt +11 -0
  9. package/app.plugin.js +1 -0
  10. package/ios/implementation/EventManager.swift +7 -7
  11. package/ios/implementation/Orientation.swift +1 -1
  12. package/ios/implementation/OrientationDirectorImpl.swift +27 -12
  13. package/ios/implementation/SensorListener.swift +1 -1
  14. package/ios/implementation/Utils.swift +9 -5
  15. package/lib/commonjs/RNOrientationDirector.js +1 -0
  16. package/lib/commonjs/RNOrientationDirector.js.map +1 -1
  17. package/lib/commonjs/package.json +1 -0
  18. package/lib/commonjs/types/Orientation.enum.js +3 -2
  19. package/lib/commonjs/types/Orientation.enum.js.map +1 -1
  20. package/lib/module/EventEmitter.js +2 -0
  21. package/lib/module/EventEmitter.js.map +1 -1
  22. package/lib/module/NativeOrientationDirector.js +2 -0
  23. package/lib/module/NativeOrientationDirector.js.map +1 -1
  24. package/lib/module/RNOrientationDirector.js +3 -0
  25. package/lib/module/RNOrientationDirector.js.map +1 -1
  26. package/lib/module/hooks/useDeviceOrientation.hook.js +2 -0
  27. package/lib/module/hooks/useDeviceOrientation.hook.js.map +1 -1
  28. package/lib/module/hooks/useInterfaceOrientation.hook.js +2 -0
  29. package/lib/module/hooks/useInterfaceOrientation.hook.js.map +1 -1
  30. package/lib/module/hooks/useIsInterfaceOrientationLocked.hook.js +2 -0
  31. package/lib/module/hooks/useIsInterfaceOrientationLocked.hook.js.map +1 -1
  32. package/lib/module/index.js +2 -0
  33. package/lib/module/index.js.map +1 -1
  34. package/lib/module/module.js +2 -0
  35. package/lib/module/module.js.map +1 -1
  36. package/lib/module/package.json +1 -0
  37. package/lib/module/types/AutoRotation.enum.js +2 -0
  38. package/lib/module/types/AutoRotation.enum.js.map +1 -1
  39. package/lib/module/types/Event.enum.js +2 -0
  40. package/lib/module/types/Event.enum.js.map +1 -1
  41. package/lib/module/types/HumanReadableAutoRotationsResource.type.js +2 -0
  42. package/lib/module/types/HumanReadableOrientationsResource.type.js +2 -0
  43. package/lib/module/types/LockableOrientation.type.js +2 -0
  44. package/lib/module/types/LockedEvent.interface.js +1 -1
  45. package/lib/module/types/Orientation.enum.js +5 -2
  46. package/lib/module/types/Orientation.enum.js.map +1 -1
  47. package/lib/module/types/OrientationEvent.interface.js +2 -0
  48. package/lib/module/types/OrientationType.enum.js +2 -0
  49. package/lib/module/types/OrientationType.enum.js.map +1 -1
  50. package/lib/typescript/plugin/src/custom-mod/withBridgingHeader.d.ts +13 -0
  51. package/lib/typescript/plugin/src/custom-mod/withBridgingHeader.d.ts.map +1 -0
  52. package/lib/typescript/plugin/src/index.d.ts +4 -0
  53. package/lib/typescript/plugin/src/index.d.ts.map +1 -0
  54. package/lib/typescript/plugin/src/withRNOrientationAppDelegate.d.ts +5 -0
  55. package/lib/typescript/plugin/src/withRNOrientationAppDelegate.d.ts.map +1 -0
  56. package/lib/typescript/plugin/src/withRNOrientationBridgingHeader.d.ts +4 -0
  57. package/lib/typescript/plugin/src/withRNOrientationBridgingHeader.d.ts.map +1 -0
  58. package/lib/typescript/src/RNOrientationDirector.d.ts.map +1 -1
  59. package/lib/typescript/src/types/LockableOrientation.type.d.ts +1 -1
  60. package/lib/typescript/src/types/LockableOrientation.type.d.ts.map +1 -1
  61. package/lib/typescript/src/types/Orientation.enum.d.ts +3 -2
  62. package/lib/typescript/src/types/Orientation.enum.d.ts.map +1 -1
  63. package/package.json +35 -9
  64. package/plugin/build/custom-mod/withBridgingHeader.d.ts +12 -0
  65. package/plugin/build/custom-mod/withBridgingHeader.js +107 -0
  66. package/plugin/build/index.d.ts +3 -0
  67. package/plugin/build/index.js +25 -0
  68. package/plugin/build/withRNOrientationAppDelegate.d.ts +4 -0
  69. package/plugin/build/withRNOrientationAppDelegate.js +71 -0
  70. package/plugin/build/withRNOrientationBridgingHeader.d.ts +3 -0
  71. package/plugin/build/withRNOrientationBridgingHeader.js +27 -0
  72. package/plugin/tsconfig.json +9 -0
  73. package/react-native-orientation-director.podspec +2 -1
  74. package/src/RNOrientationDirector.ts +1 -0
  75. package/src/types/LockableOrientation.type.ts +2 -1
  76. package/src/types/Orientation.enum.ts +3 -2
@@ -0,0 +1,27 @@
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
+ }
@@ -0,0 +1,9 @@
1
+ {
2
+ "extends": "expo-module-scripts/tsconfig.plugin",
3
+ "compilerOptions": {
4
+ "outDir": "build",
5
+ "rootDir": "src"
6
+ },
7
+ "include": ["./src"],
8
+ "exclude": ["**/__mocks__/*", "**/__tests__/*"]
9
+ }
@@ -14,7 +14,8 @@ Pod::Spec.new do |s|
14
14
  s.platforms = { :ios => min_ios_version_supported }
15
15
  s.source = { :git => "https://github.com/gladiuscode/react-native-orientation-director.git", :tag => "#{s.version}" }
16
16
 
17
- s.source_files = "ios/**/*.{h,m,mm,swift}"
17
+ s.source_files = "ios/**/*.{h,m,mm,cpp,swift}"
18
+ s.private_header_files = "ios/generated/**/*.h"
18
19
 
19
20
  # Use install_modules_dependencies helper to install the dependencies if React Native version >=0.71.0.
20
21
  # See https://github.com/facebook/react-native/blob/febf6b7f33fdb4904669f99d795eba4c0f95d7bf/scripts/cocoapods/new_architecture.rb#L79.
@@ -18,6 +18,7 @@ class RNOrientationDirector {
18
18
  [Orientation.portraitUpsideDown]: 'Portrait Upside Down',
19
19
  [Orientation.landscapeLeft]: 'Landscape Left',
20
20
  [Orientation.landscapeRight]: 'Landscape Right',
21
+ [Orientation.landscape]: 'Landscape',
21
22
  [Orientation.faceUp]: 'Face Up',
22
23
  [Orientation.faceDown]: 'Face Down',
23
24
  };
@@ -4,4 +4,5 @@ export type LockableOrientation =
4
4
  | Orientation.portrait
5
5
  | Orientation.portraitUpsideDown
6
6
  | Orientation.landscapeLeft
7
- | Orientation.landscapeRight;
7
+ | Orientation.landscapeRight
8
+ | Orientation.landscape;
@@ -4,6 +4,7 @@ export enum Orientation {
4
4
  landscapeRight = 2,
5
5
  portraitUpsideDown = 3,
6
6
  landscapeLeft = 4,
7
- faceUp = 5,
8
- faceDown = 6,
7
+ landscape = 5,
8
+ faceUp = 6,
9
+ faceDown = 7,
9
10
  }