Skip to content

feat: drop old arch support#102

Open
gladiuscode wants to merge 17 commits intomainfrom
feature/drop-old-arch-support
Open

feat: drop old arch support#102
gladiuscode wants to merge 17 commits intomainfrom
feature/drop-old-arch-support

Conversation

@gladiuscode
Copy link
Owner

@gladiuscode gladiuscode commented Mar 12, 2026

Summary by CodeRabbit

  • Refactor

    • Simplified Android build/config and removed legacy architecture branching; unified module initialization on iOS. Event handling now uses explicit, strongly-typed event emitters for device/interface orientation and lock changes.
  • Documentation

    • README iOS setup streamlined; bridging-header instructions removed and guidance consolidated for new architecture.
  • Chores

    • Updated codegen and package/pod configuration to reflect the new module surface and naming.
  • Tests

    • Removed multiple platform/unit tests and Android CI test steps.

@gladiuscode gladiuscode self-assigned this Mar 12, 2026
@gladiuscode gladiuscode added the enhancement New feature or request label Mar 12, 2026
@coderabbitai
Copy link

coderabbitai bot commented Mar 12, 2026

Note

Reviews paused

It looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the reviews.auto_review.auto_pause_after_reviewed_commits setting.

Use the following commands to manage reviews:

  • @coderabbitai resume to resume automatic reviews.
  • @coderabbitai review to trigger a single review.

Use the checkboxes below for quick actions:

  • ▶️ Resume reviews
  • 🔍 Trigger review
📝 Walkthrough

Walkthrough

Removes legacy architecture gating and ObjC pathways; converges to new-architecture TurboModule/event-emitter pattern; centralizes event delegation via delegate interfaces and a SharedOrientationDirectorImpl singleton; simplifies Android Gradle config; removes multiple bridging headers, legacy tests, and ObjC plugin updaters.

Changes

Cohort / File(s) Summary
Android build & gradle props
android/build.gradle, android/gradle.properties
Add ext.OrientationDirector and getExtOrDefault; always apply com.facebook.react plugin; remove OrientationDirector_* gradle props, old-arch branching, Kotlin stdlib variable, and simplify sourceSets/lint config.
Android module & event delegation
android/src/main/java/com/orientationdirector/OrientationDirectorModule.kt, android/src/main/java/com/orientationdirector/OrientationDirectorPackage.kt, android/src/main/java/com/orientationdirector/implementation/EventManager.kt, android/src/main/java/com/orientationdirector/implementation/EventManagerDelegate.kt, android/src/main/java/com/orientationdirector/implementation/OrientationDirectorModuleImpl.kt
Convert to TurboModule-style Kotlin module; add EventManagerDelegate interface; delegate event emission through delegate methods; update constructors and module info provider to use new module/turbo configuration.
Android legacy removal
android/src/oldarch/OrientationDirectorModule.kt
Delete legacy ReactContextBaseJavaModule bridge and all @ReactMethod bindings.
Android manifests
android/src/main/AndroidManifest.xml, android/src/main/AndroidManifestNew.xml
Remove package attribute from main manifest and delete the empty manifest file.
iOS native refactor & singleton
ios/OrientationDirector.h, ios/OrientationDirector.mm, ios/SharedOrientationDirectorImpl.swift
Replace conditional RCT bridge with Native spec base; remove RCT export macro and getSupportedInterfaceOrientationsForWindow; add moduleName; introduce SharedOrientationDirectorImpl.shared singleton.
iOS event surface & emitters
ios/implementation/EventManager.swift, ios/implementation/OrientationDirectorImpl.swift, src/NativeOrientationDirector.ts, src/EventEmitter.ts
Replace generic sendEvent/addListener/removeListeners with typed event emitters (onDevice/onInterface/onLock); adjust delegate APIs and JS wiring; add Android listener counting and proxy logic in TS.
iOS bridging/header & example updates
ios/react-native-orientation-director-Bridging-Header.h, example/ios/OrientationDirectorExample-Bridging-Header.h, example/ios/OrientationDirectorExample.xcodeproj/project.pbxproj, example/ios/Podfile, example/ios/OrientationDirectorExample/AppDelegate.swift
Remove bridging headers and project references; enable new-arch in example Podfile; update example AppDelegate to use SharedOrientationDirectorImpl.
CocoaPods & package config
react-native-orientation-director.podspec, package.json
Broaden s.private_header_files to ios/**/*.h, set s.module_name = "OrientationDirector", and add codegenConfig.ios.modulesProvider mapping.
Plugin removals & AppDelegate updater
plugin/src/... (custom-mod/withBridgingHeader.ts, withRNOrientationBridgingHeader.ts, withRNOrientationAppDelegate.ts, index.ts)
Remove bridging-header mods and Objective‑C updater paths; make AppDelegate updater Swift-only; remove related plugin helpers and tests.
Tests removed
android/src/test/..., plugin/__tests__/*
Delete multiple Android Robolectric tests and plugin/Jest test files and fixtures.
CI workflow
.github/workflows/pr.yml, .github/workflows/release.yml
Remove Android example “Run test” step from Android build jobs.
Docs
README.md
Document new-arch-only support, simplify iOS Swift setup guidance, and remove old-arch references.

Sequence Diagram(s)

sequenceDiagram
  rect rgba(220,238,255,0.5)
    participant JS as JavaScript
    participant E as EventEmitter (TS)
  end
  rect rgba(200,255,220,0.5)
    participant TM as TurboModule (OrientationDirector)
    participant EM as EventManager / Delegate
  end
  rect rgba(255,230,230,0.5)
    participant NI as Native Impl (OrientationDirectorImpl / Shared)
  end

  JS->>E: subscribe onDevice/onInterface/onLock
  E->>TM: register emitter (proxy increments android counter)
  NI->>EM: orientation or lock state changes
  EM->>TM: delegate.emitOnDevice/Interface/LockChanged(params)
  TM->>E: deliver typed event to JS subscribers
Loading

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~60 minutes

Possibly related PRs

Suggested labels

Android, iOS

Poem

🐰
I hopped from gradle groves to swift-lit springs,
I stitched events with tiny bounding wings;
Old bridges cleared, a shared director found—
Typed signals leap, native beats and JS resound. 🎶

🚥 Pre-merge checks | ✅ 2 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title 'feat: drop old arch support' clearly and concisely summarizes the main objective of the pull request, which is to remove support for the old React Native architecture.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
  • 📝 Generate docstrings (stacked PR)
  • 📝 Generate docstrings (commit on current branch)
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch feature/drop-old-arch-support
📝 Coding Plan
  • Generate coding plan for human review comments

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 2

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@ios/OrientationDirector.h`:
- Around line 6-10: Add a public Objective-C class method to OrientationDirector
to bridge the Swift implementation so generated ObjC code can call it: declare a
class method
+(UIInterfaceOrientationMask)getSupportedInterfaceOrientationsForWindow in
OrientationDirector (header) and implement it to return the Swift-backed value
(call the Swift singleton's supportedInterfaceOrientations, e.g.
SharedOrientationDirectorImpl or OrientationDirectorImpl shared instance). This
exposes OrientationDirector.getSupportedInterfaceOrientationsForWindow for the
code generated by plugin/src/withRNOrientationAppDelegate.ts.

In `@react-native-orientation-director.podspec`:
- Line 17: The podspec currently marks all iOS headers private which hides
OrientationDirector.h and breaks consumers; update the podspec to explicitly
expose OrientationDirector.h as a public header (e.g., add a public header entry
for "OrientationDirector.h" or use s.public_header_files to include
"ios/OrientationDirector.h") and restrict s.private_header_files to only
generated/internal headers (e.g., generated or internal subpaths) so the
plugin-imported symbol OrientationDirector.h remains on the public surface while
keeping other headers private; ensure references to OrientationDirector.h in
bridging headers/AppDelegate will resolve.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 1ca8a307-6f52-48e0-ac91-66c6227edb51

📥 Commits

Reviewing files that changed from the base of the PR and between 073e134 and 89913ea.

⛔ Files ignored due to path filters (1)
  • example/ios/Podfile.lock is excluded by !**/*.lock
📒 Files selected for processing (16)
  • android/build.gradle
  • android/gradle.properties
  • android/src/main/AndroidManifest.xml
  • android/src/main/AndroidManifestNew.xml
  • android/src/main/java/com/orientationdirector/OrientationDirectorModule.kt
  • android/src/main/java/com/orientationdirector/OrientationDirectorPackage.kt
  • android/src/oldarch/OrientationDirectorModule.kt
  • example/ios/OrientationDirectorExample-Bridging-Header.h
  • example/ios/OrientationDirectorExample.xcodeproj/project.pbxproj
  • example/ios/OrientationDirectorExample/AppDelegate.swift
  • ios/OrientationDirector.h
  • ios/OrientationDirector.mm
  • ios/SharedOrientationDirectorImpl.swift
  • ios/react-native-orientation-director-Bridging-Header.h
  • package.json
  • react-native-orientation-director.podspec
💤 Files with no reviewable changes (5)
  • example/ios/OrientationDirectorExample-Bridging-Header.h
  • ios/react-native-orientation-director-Bridging-Header.h
  • example/ios/OrientationDirectorExample.xcodeproj/project.pbxproj
  • android/src/main/AndroidManifestNew.xml
  • android/src/oldarch/OrientationDirectorModule.kt

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 3

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (2)
ios/implementation/EventManager.swift (1)

13-36: ⚠️ Potential issue | 🔴 Critical

Update all call sites or restore the old external argument label.

Lines 13 and 26 rename the external argument label from orientationValue to value, but ios/implementation/OrientationDirectorImpl.swift still calls the methods with orientationValue:. This breaks the build.

Minimal fix
-    func sendDeviceOrientationDidChange(value: Int) {
+    func sendDeviceOrientationDidChange(orientationValue value: Int) {
@@
-    func sendInterfaceOrientationDidChange(value: Int) {
+    func sendInterfaceOrientationDidChange(orientationValue value: Int) {

Call sites at ios/implementation/OrientationDirectorImpl.swift:179 and 206 need to be updated if you proceed with the signature change.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@ios/implementation/EventManager.swift` around lines 13 - 36, The external
parameter label for sendDeviceOrientationDidChange(_: ) and
sendInterfaceOrientationDidChange(_: ) was changed from orientationValue to
value, breaking callers; fix by restoring the original external label or
updating all callers to the new label — locate the functions
sendDeviceOrientationDidChange(value: Int) and
sendInterfaceOrientationDidChange(value: Int) and either change their signatures
back to sendDeviceOrientationDidChange(orientationValue: Int) /
sendInterfaceOrientationDidChange(orientationValue: Int) or update the call
sites (e.g., in OrientationDirectorImpl where emit calls use orientationValue:)
to call with the new label value: instead of orientationValue: so the method
signatures and all callers match.
src/EventEmitter.ts (1)

39-63: ⚠️ Potential issue | 🟠 Major

Defer sensor cleanup until remove() is actually invoked.

Line 41 updates androidListenerCount when remove is read, not when the subscription is removed. Extracting subscription.remove or calling remove() twice will undercount and can disable sensors while listeners are still active.

🩹 Proposed fix
   private static createDeviceOrientationListenerProxy(
     listener: EventSubscription
   ) {
+    let removed = false;
     const handler: ProxyHandler<EventSubscription> = {
       get(target, propertyKey, receiver) {
-        if (propertyKey === 'remove') {
-          disableOrientationSensorsIfLastListener();
+        if (propertyKey !== 'remove') {
+          return Reflect.get(target, propertyKey, receiver);
         }
-        return Reflect.get(target, propertyKey, receiver);
+
+        return () => {
+          if (removed) {
+            return;
+          }
+
+          removed = true;
+          listener.remove();
+          disableOrientationSensorsIfLastListener();
+        };
       },
     };
@@
     function disableOrientationSensorsIfLastListener() {
-      if (EventEmitter.androidListenerCount === 1) {
-        EventEmitter.androidListenerCount = 0;
-        Module.disableOrientationSensors();
-        return;
-      }
-
       if (EventEmitter.androidListenerCount === 0) {
         return;
       }
 
       EventEmitter.androidListenerCount--;
-      return;
+      if (EventEmitter.androidListenerCount === 0) {
+        Module.disableOrientationSensors();
+      }
     }
   }
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@src/EventEmitter.ts` around lines 39 - 63, The bug is that the Proxy handler
currently calls disableOrientationSensorsIfLastListener when the 'remove'
property is read, decrementing EventEmitter.androidListenerCount too early;
instead, when creating the Proxy for an EventSubscription, wrap the actual
remove method so the cleanup runs only when remove() is invoked (and only once):
grab the original remove function from the listener (e.g., origRemove =
listener.remove), replace listener.remove with a wrapper that checks a called
flag, invokes origRemove(), and then calls
disableOrientationSensorsIfLastListener() to decrement
EventEmitter.androidListenerCount and call Module.disableOrientationSensors() if
it was the last listener; keep the Proxy.get handler from triggering side
effects on property access and ensure the wrapper is idempotent so multiple
remove() calls won't undercount.
🧹 Nitpick comments (2)
ios/implementation/OrientationDirectorImpl.swift (1)

11-11: LGTM! Consider removing redundant @objc annotations.

The change to @objcMembers is appropriate for the new architecture migration. Since @objcMembers automatically exposes all public members to Objective-C, the individual @objc annotations on supportedInterfaceOrientations, init(), setEventManager(delegate:), getInterfaceOrientation(), getDeviceOrientation(), getIsLocked(), lockTo(jsValue:), unlock(), and resetSupportedInterfaceOrientations() are now redundant and could be removed for cleaner code.

,

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@ios/implementation/OrientationDirectorImpl.swift` at line 11, Remove the
redundant per-member `@objc` annotations now that the class is marked with
`@objcMembers`: delete the individual `@objc` attributes on
supportedInterfaceOrientations, init(), setEventManager(delegate:),
getInterfaceOrientation(), getDeviceOrientation(), getIsLocked(),
lockTo(jsValue:), unlock(), and resetSupportedInterfaceOrientations() within the
OrientationDirectorImpl class so members rely on `@objcMembers` for Objective-C
exposure and keep signatures unchanged.
android/src/main/java/com/orientationdirector/implementation/EventManager.kt (1)

4-6: Unused imports should be removed.

ReactApplicationContext and DeviceEventManagerModule are no longer used after the refactoring to the delegate pattern. While this doesn't affect functionality, removing them improves code clarity.

🧹 Remove unused imports
 package com.orientationdirector.implementation

 import com.facebook.react.bridge.Arguments
-import com.facebook.react.bridge.ReactApplicationContext
 import com.facebook.react.bridge.WritableMap
-import com.facebook.react.modules.core.DeviceEventManagerModule
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@android/src/main/java/com/orientationdirector/implementation/EventManager.kt`
around lines 4 - 6, Remove the unused imports in EventManager.kt: delete the
imports for ReactApplicationContext and DeviceEventManagerModule since the class
was refactored to a delegate pattern and those symbols are no longer referenced;
keep the WritableMap import if still used by methods in EventManager.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@android/build.gradle`:
- Around line 2-7: The ext.OrientationDirector map currently sets
compileSdkVersion and targetSdkVersion to 36 which is below the plugin
requirement; update the values in ext.OrientationDirector (keys
compileSdkVersion and targetSdkVersion) to at least 50 (e.g., 50) so the build
uses SDK 50+ and the plugin can run correctly.

In `@ios/OrientationDirector.mm`:
- Around line 119-127: The current stubs hide unsupported behavior; change
-(NSNumber *)isAutoRotationEnabled to return nil (not @(NO)) so JS can detect
"unsupported" vs a real false, and update -disableOrientationSensors and
-enableOrientationSensors to surface an explicit unsupported error (e.g., log
and raise an NSException or use the React Native bridge error mechanism) instead
of silently no-op; modify the implementations of isAutoRotationEnabled,
disableOrientationSensors, and enableOrientationSensors to reflect this behavior
so callers can distinguish unsupported-on-iOS from valid states/actions.

In `@README.md`:
- Around line 123-131: Remove the Objective-C import line `#import
"OrientationDirector.h"` from the Swift code block and replace it with the Swift
style import or omit it if the plugin already adds `import OrientationDirector`;
ensure the Swift snippet around the
application(_:supportedInterfaceOrientationsFor:) implementation uses `import
OrientationDirector` (or no manual import) and keeps the return of
SharedOrientationDirectorImpl.shared.supportedInterfaceOrientations unchanged.

---

Outside diff comments:
In `@ios/implementation/EventManager.swift`:
- Around line 13-36: The external parameter label for
sendDeviceOrientationDidChange(_: ) and sendInterfaceOrientationDidChange(_: )
was changed from orientationValue to value, breaking callers; fix by restoring
the original external label or updating all callers to the new label — locate
the functions sendDeviceOrientationDidChange(value: Int) and
sendInterfaceOrientationDidChange(value: Int) and either change their signatures
back to sendDeviceOrientationDidChange(orientationValue: Int) /
sendInterfaceOrientationDidChange(orientationValue: Int) or update the call
sites (e.g., in OrientationDirectorImpl where emit calls use orientationValue:)
to call with the new label value: instead of orientationValue: so the method
signatures and all callers match.

In `@src/EventEmitter.ts`:
- Around line 39-63: The bug is that the Proxy handler currently calls
disableOrientationSensorsIfLastListener when the 'remove' property is read,
decrementing EventEmitter.androidListenerCount too early; instead, when creating
the Proxy for an EventSubscription, wrap the actual remove method so the cleanup
runs only when remove() is invoked (and only once): grab the original remove
function from the listener (e.g., origRemove = listener.remove), replace
listener.remove with a wrapper that checks a called flag, invokes origRemove(),
and then calls disableOrientationSensorsIfLastListener() to decrement
EventEmitter.androidListenerCount and call Module.disableOrientationSensors() if
it was the last listener; keep the Proxy.get handler from triggering side
effects on property access and ensure the wrapper is idempotent so multiple
remove() calls won't undercount.

---

Nitpick comments:
In
`@android/src/main/java/com/orientationdirector/implementation/EventManager.kt`:
- Around line 4-6: Remove the unused imports in EventManager.kt: delete the
imports for ReactApplicationContext and DeviceEventManagerModule since the class
was refactored to a delegate pattern and those symbols are no longer referenced;
keep the WritableMap import if still used by methods in EventManager.

In `@ios/implementation/OrientationDirectorImpl.swift`:
- Line 11: Remove the redundant per-member `@objc` annotations now that the class
is marked with `@objcMembers`: delete the individual `@objc` attributes on
supportedInterfaceOrientations, init(), setEventManager(delegate:),
getInterfaceOrientation(), getDeviceOrientation(), getIsLocked(),
lockTo(jsValue:), unlock(), and resetSupportedInterfaceOrientations() within the
OrientationDirectorImpl class so members rely on `@objcMembers` for Objective-C
exposure and keep signatures unchanged.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: cde1d342-2a26-44b7-b7ec-0216f0aeed1c

📥 Commits

Reviewing files that changed from the base of the PR and between 89913ea and e6ba69f.

⛔ Files ignored due to path filters (3)
  • example/ios/Podfile.lock is excluded by !**/*.lock
  • plugin/__tests__/__snapshots__/withRNOrientationAppDelegate.spec.ts.snap is excluded by !**/*.snap
  • plugin/__tests__/__snapshots__/withRNOrientationBridgingHeader.spec.ts.snap is excluded by !**/*.snap
📒 Files selected for processing (26)
  • .github/workflows/pr.yml
  • .github/workflows/release.yml
  • README.md
  • android/build.gradle
  • android/gradle.properties
  • android/src/main/java/com/orientationdirector/OrientationDirectorModule.kt
  • android/src/main/java/com/orientationdirector/implementation/EventManager.kt
  • android/src/main/java/com/orientationdirector/implementation/EventManagerDelegate.kt
  • android/src/main/java/com/orientationdirector/implementation/OrientationDirectorModuleImpl.kt
  • android/src/test/java/com/orientationdirector/implementation/OrientationDirectorModuleImplTest.kt
  • android/src/test/java/com/orientationdirector/implementation/UtilsTest.kt
  • example/ios/Podfile
  • ios/OrientationDirector.h
  • ios/OrientationDirector.mm
  • ios/implementation/EventManager.swift
  • ios/implementation/OrientationDirectorImpl.swift
  • plugin/__tests__/fixtures/AppDelegate.mm
  • plugin/__tests__/fixtures/Bridging-Header.h
  • plugin/__tests__/withRNOrientationAppDelegate.spec.ts
  • plugin/__tests__/withRNOrientationBridgingHeader.spec.ts
  • plugin/src/custom-mod/withBridgingHeader.ts
  • plugin/src/index.ts
  • plugin/src/withRNOrientationAppDelegate.ts
  • plugin/src/withRNOrientationBridgingHeader.ts
  • src/EventEmitter.ts
  • src/NativeOrientationDirector.ts
💤 Files with no reviewable changes (12)
  • android/src/test/java/com/orientationdirector/implementation/UtilsTest.kt
  • plugin/src/index.ts
  • .github/workflows/release.yml
  • plugin/tests/fixtures/AppDelegate.mm
  • android/gradle.properties
  • plugin/tests/withRNOrientationAppDelegate.spec.ts
  • .github/workflows/pr.yml
  • plugin/tests/withRNOrientationBridgingHeader.spec.ts
  • plugin/src/withRNOrientationBridgingHeader.ts
  • plugin/src/custom-mod/withBridgingHeader.ts
  • plugin/tests/fixtures/Bridging-Header.h
  • android/src/test/java/com/orientationdirector/implementation/OrientationDirectorModuleImplTest.kt

@gladiuscode
Copy link
Owner Author

I have yet to test everything out properly, so I'll do that and then merge this to finally say goodbye to the old arch.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@README.md`:
- Line 121: Remove the leading word "Then," from the sentence that introduces
implementing supportedInterfaceOrientationsFor in AppDelegate.swift so the
instruction reads directly (e.g., "In your AppDelegate.swift file, implement the
supportedInterfaceOrientationsFor method as follows:"); update the README.md
line that currently starts with "Then," to avoid implying a prior step and
ensure the sentence starts cleanly and flows with the surrounding instructions.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: b19c7469-e7f9-480c-a4d0-93253a3d0e75

📥 Commits

Reviewing files that changed from the base of the PR and between e6ba69f and 70bcc0b.

📒 Files selected for processing (1)
  • README.md

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🧹 Nitpick comments (2)
README.md (2)

9-9: Optional: Consider using Oxford comma for clarity.

The list "Kotlin, Swift and Typescript" could use an Oxford comma: "Kotlin, Swift, and Typescript" for improved readability and consistency with standard English style guides.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@README.md` at line 9, Update the sentence "Written in Kotlin, Swift and
Typescript." to include the Oxford comma by changing it to "Written in Kotlin,
Swift, and Typescript." to improve readability and consistency; locate and edit
that exact line in README.md.

123-131: Optional: Consider adding class context hint.

While the instruction makes it clear this goes "In your AppDelegate.swift file," the code snippet could be slightly more explicit that the method should be added inside the AppDelegate class. This is purely for additional clarity.

📖 Optional documentation enhancement
 ```swift

 import OrientationDirector

+// Add this method to your AppDelegate class:
 func application(_ application: UIApplication, supportedInterfaceOrientationsFor window: UIWindow?) -> UIInterfaceOrientationMask {
   return SharedOrientationDirectorImpl.shared.supportedInterfaceOrientations
 }
</details>

<details>
<summary>🤖 Prompt for AI Agents</summary>

Verify each finding against the current code and only fix it if needed.

In @README.md around lines 123 - 131, Add a brief comment clarifying that the
method belongs inside your AppDelegate class: insert a one-line note above the
application(_:supportedInterfaceOrientationsFor:) method indicating "Add this
method to your AppDelegate class" so readers know the context; ensure the
snippet still imports OrientationDirector and returns
SharedOrientationDirectorImpl.shared.supportedInterfaceOrientations as shown.


</details>

</blockquote></details>

</blockquote></details>

<details>
<summary>🤖 Prompt for all review comments with AI agents</summary>

Verify each finding against the current code and only fix it if needed.

Nitpick comments:
In @README.md:

  • Line 9: Update the sentence "Written in Kotlin, Swift and Typescript." to
    include the Oxford comma by changing it to "Written in Kotlin, Swift, and
    Typescript." to improve readability and consistency; locate and edit that exact
    line in README.md.
  • Around line 123-131: Add a brief comment clarifying that the method belongs
    inside your AppDelegate class: insert a one-line note above the
    application(_:supportedInterfaceOrientationsFor:) method indicating "Add this
    method to your AppDelegate class" so readers know the context; ensure the
    snippet still imports OrientationDirector and returns
    SharedOrientationDirectorImpl.shared.supportedInterfaceOrientations as shown.

</details>

---

<details>
<summary>ℹ️ Review info</summary>

<details>
<summary>⚙️ Run configuration</summary>

**Configuration used**: defaults

**Review profile**: CHILL

**Plan**: Pro

**Run ID**: `1d28c668-f148-4c2c-8366-29e5b734fb24`

</details>

<details>
<summary>📥 Commits</summary>

Reviewing files that changed from the base of the PR and between 70bcc0b3a020104b8593ca3bc58e60b9aab10b63 and a8e4ce21ec1a81ed27883749b036671fda41a658.

</details>

<details>
<summary>📒 Files selected for processing (1)</summary>

* `README.md`

</details>

</details>

<!-- This is an auto-generated comment by CodeRabbit for review status -->

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

♻️ Duplicate comments (1)
ios/OrientationDirector.mm (1)

111-119: ⚠️ Potential issue | 🟠 Major

Don’t present unsupported sensor APIs as successful iOS behavior.

Line 111 returning @(NO) and Lines 116/119 being silent no-ops make JS treat unsupported features as valid false/success paths. Please surface unsupported explicitly (e.g., nullable return + warning/error path) so callers can distinguish capability vs state.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@ios/OrientationDirector.mm` around lines 111 - 119, The current
implementations of isAutoRotationEnabled, disableOrientationSensors, and
enableOrientationSensors silently pretend the APIs are supported; instead make
unsupported behavior explicit by returning nil from isAutoRotationEnabled (use a
nullable NSNumber) and have disableOrientationSensors/enableOrientationSensors
signal failure (e.g., call the module logger/warn method or invoke the JS-facing
error callback) so callers can distinguish "unsupported" from a valid
false/success; update the method signatures to nullable where applicable and
ensure any JS bridge path checks for nil/error rather than assuming a boolean or
success.
🧹 Nitpick comments (2)
src/module.ts (1)

1-1: Document the breaking API change tied to this cleanup.

Line 1 reflects the emitter cleanup, and this file now only default-exports OrientationDirectorModule (no ModuleEventEmitter named export). Please add a migration note/changelog entry so downstream users with import { ModuleEventEmitter } ... don’t get surprised.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@src/module.ts` at line 1, Update the project changelog/release notes to
document the breaking API change where src/module.ts now only default-exports
OrientationDirectorModule and no longer exports ModuleEventEmitter; add a
migration note instructing downstream users to replace imports like "import {
ModuleEventEmitter } from '...'" with the new pattern (import
OrientationDirectorModule as default and use the new internal emitter API or
recommended alternative), include the version bump that introduces this change
and a short example of the before/after import to make migration
straightforward.
ios/implementation/EventManager.swift (1)

18-37: Use dictionary literals instead of Dictionary(dictionaryLiteral:).

Lines 18, 27, and 36 use the compiler-protocol initializer, which SwiftLint flags. Replace with dictionary literals for clarity and compliance.

Proposed refactor
-        let params = Dictionary(dictionaryLiteral: ("orientation", value))
-        delegate.emitOnDeviceOrientationDidChange(params: params as NSDictionary)
+        let params: NSDictionary = ["orientation": value]
+        delegate.emitOnDeviceOrientationDidChange(params: params)

-        let params = Dictionary(dictionaryLiteral: ("orientation", value))
-        delegate.emitOnInterfaceOrientationDidChange(params: params as NSDictionary)
+        let params: NSDictionary = ["orientation": value]
+        delegate.emitOnInterfaceOrientationDidChange(params: params)

-        let params = Dictionary(dictionaryLiteral: ("locked", value))
-        delegate.emitOnLockChanged(params: params as NSDictionary)
+        let params: NSDictionary = ["locked": value]
+        delegate.emitOnLockChanged(params: params)
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@ios/implementation/EventManager.swift` around lines 18 - 37, Replace the
usage of Dictionary(dictionaryLiteral:) with Swift dictionary literals in the
orientation/lock event senders: update sendDeviceOrientationDidChange (the call
to delegate.emitOnDeviceOrientationDidChange), sendInterfaceOrientationDidChange
(delegate.emitOnInterfaceOrientationDidChange) and sendLockDidChange
(delegate.emitOnLockChanged) to construct params using a literal (e.g.
["orientation": value] or ["locked": value]) instead of
Dictionary(dictionaryLiteral:), keeping the same keys and types and passing the
result as an NSDictionary to the delegate.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@ios/OrientationDirector.mm`:
- Around line 80-83: The isLocked accessor reads _director state off the main
thread while writes are dispatched to the main queue, causing a race; change
-(NSNumber *)isLocked to synchronously fetch the value on the main thread (e.g.
use dispatch_sync to dispatch_get_main_queue() or performSelectorOnMainThread:)
and call [_director getIsLocked] inside that main-thread block, then wrap the
retrieved BOOL in an NSNumber before returning so reads are thread-safe with the
existing main-queue writes.

---

Duplicate comments:
In `@ios/OrientationDirector.mm`:
- Around line 111-119: The current implementations of isAutoRotationEnabled,
disableOrientationSensors, and enableOrientationSensors silently pretend the
APIs are supported; instead make unsupported behavior explicit by returning nil
from isAutoRotationEnabled (use a nullable NSNumber) and have
disableOrientationSensors/enableOrientationSensors signal failure (e.g., call
the module logger/warn method or invoke the JS-facing error callback) so callers
can distinguish "unsupported" from a valid false/success; update the method
signatures to nullable where applicable and ensure any JS bridge path checks for
nil/error rather than assuming a boolean or success.

---

Nitpick comments:
In `@ios/implementation/EventManager.swift`:
- Around line 18-37: Replace the usage of Dictionary(dictionaryLiteral:) with
Swift dictionary literals in the orientation/lock event senders: update
sendDeviceOrientationDidChange (the call to
delegate.emitOnDeviceOrientationDidChange), sendInterfaceOrientationDidChange
(delegate.emitOnInterfaceOrientationDidChange) and sendLockDidChange
(delegate.emitOnLockChanged) to construct params using a literal (e.g.
["orientation": value] or ["locked": value]) instead of
Dictionary(dictionaryLiteral:), keeping the same keys and types and passing the
result as an NSDictionary to the delegate.

In `@src/module.ts`:
- Line 1: Update the project changelog/release notes to document the breaking
API change where src/module.ts now only default-exports
OrientationDirectorModule and no longer exports ModuleEventEmitter; add a
migration note instructing downstream users to replace imports like "import {
ModuleEventEmitter } from '...'" with the new pattern (import
OrientationDirectorModule as default and use the new internal emitter API or
recommended alternative), include the version bump that introduces this change
and a short example of the before/after import to make migration
straightforward.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: c3a08c9b-c2f5-4a98-ab8c-1712eaf2a82f

📥 Commits

Reviewing files that changed from the base of the PR and between a8e4ce2 and 682522f.

📒 Files selected for processing (4)
  • ios/OrientationDirector.mm
  • ios/implementation/EventManager.swift
  • ios/implementation/OrientationDirectorImpl.swift
  • src/module.ts
🚧 Files skipped from review as they are similar to previous changes (1)
  • ios/implementation/OrientationDirectorImpl.swift

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant