Skip to content

Commit

Permalink
🛠 Refactor: Rename to modalNativeID
Browse files Browse the repository at this point in the history
Related:
* TODO:2023-03-04-06-34-28 - Library Native Cleanup
* TODO:2023-03-04-15-39-46 - Impl. `RNIModalManager`

Summary:
* Rename symbols in `ios/src_library/React Native/RNIModal` with "modalD" to "modalNativeID".
* Rename `RNIModal.modalID` to `modalNativeID`.
* Rename `RNIModalManager.counterModalID` to `counterModalNativeID`.
* Rename `RNIModalManager.createModalID` to `createModalNativeID`.
  • Loading branch information
dominicstop committed Mar 21, 2023
1 parent 5ef2cad commit d2bae76
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 12 deletions.
2 changes: 1 addition & 1 deletion ios/src_library/React Native/RNIModal/RNIModal.swift
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ public protocol RNIModalIdentity: AnyObject {

var modalIndex: Int? { set get };

var modalID: String? { set get };
var modalNativeID: String? { set get };
};

/// Specifies that the "adoptee/delegate" that conforms to this protocol must
Expand Down
22 changes: 11 additions & 11 deletions ios/src_library/React Native/RNIModal/RNIModalManager.swift
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ public class RNIModalManager {
// MARK: - Properties
// ------------------

private var counterModalID: UInt = 0;
private var counterModalNativeID: UInt = 0;

private(set) public var currentModalIndex = -1;

Expand Down Expand Up @@ -43,17 +43,17 @@ public class RNIModalManager {
// MARK: - Methods
// ---------------

private func createModalID() -> String {
let modalID = self.counterModalID;
self.counterModalID += 1;
private func createModalNativeID() -> String {
let modalNativeID = self.counterModalNativeID;
self.counterModalNativeID += 1;

return "modal-id:\(modalID)";
return "modal-native-id:\(modalNativeID)";
};

public func register(modal: RNIModal) {
let key = self.createModalID();
let key = self.createModalNativeID();

modal.modalID = key;
modal.modalNativeID = key;
modal.modalIndex = -1;

modal.isModalPresented = false;
Expand All @@ -79,7 +79,7 @@ extension RNIModalManager: RNIModalFocusNotifiable {

for modalItem in self.modalInstances {
// skip the modal that sent the notification
guard modalItem.modalID != modal.modalID
guard modalItem.modalNativeID != modal.modalNativeID
else { continue };

modalItem.onModalWillFocusNotification(sender: modal);
Expand All @@ -92,7 +92,7 @@ extension RNIModalManager: RNIModalFocusNotifiable {

for modalItem in self.modalInstances {
// skip the modal that sent the notification
guard modalItem.modalID != modal.modalID
guard modalItem.modalNativeID != modal.modalNativeID
else { continue };

modalItem.onModalDidFocusNotification(sender: modal);
Expand All @@ -105,7 +105,7 @@ extension RNIModalManager: RNIModalFocusNotifiable {

for modalItem in self.modalInstances {
// skip the modal that sent the notification
guard modalItem.modalID != modal.modalID
guard modalItem.modalNativeID != modal.modalNativeID
else { continue };

modalItem.onModalWillBlurNotification(sender: modal);
Expand All @@ -118,7 +118,7 @@ extension RNIModalManager: RNIModalFocusNotifiable {

for modalItem in self.modalInstances {
// skip the modal that sent the notification
guard modalItem.modalID != modal.modalID
guard modalItem.modalNativeID != modal.modalNativeID
else { continue };

modalItem.onModalDidBlurNotification(sender: modal);
Expand Down

0 comments on commit d2bae76

Please sign in to comment.