react-native-orientation-director 2.6.1 → 2.6.3

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "react-native-orientation-director",
3
- "version": "2.6.1",
3
+ "version": "2.6.3",
4
4
  "description": "A Modern React Native library that allows you to access orientation",
5
5
  "main": "./lib/module/index.js",
6
6
  "types": "./lib/typescript/module/src/index.d.ts",
@@ -41,7 +41,7 @@ function getCompatibleFileUpdater(language) {
41
41
  }
42
42
  }
43
43
  function swiftFileUpdater(originalContents, sdkVersion) {
44
- const methodPrefix = !sdkVersion?.includes('53') ? 'override' : '';
44
+ const methodPrefix = computeMethodPrefix(sdkVersion);
45
45
  const supportedInterfaceOrientationsForCodeBlock = `\n ${methodPrefix} func application(_ application: UIApplication, supportedInterfaceOrientationsFor window: UIWindow?) -> UIInterfaceOrientationMask {
46
46
  return OrientationDirector.getSupportedInterfaceOrientationsForWindow()
47
47
  }\n`;
@@ -56,6 +56,23 @@ function swiftFileUpdater(originalContents, sdkVersion) {
56
56
  comment: '// React Native Orientation Director',
57
57
  });
58
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
+ }
59
76
  }
60
77
  function objCFileUpdater(originalContents) {
61
78
  const libraryHeaderImportCodeBlock = '#import "OrientationDirector.h"\n';