Skip to content

Commit

Permalink
💫 Update: ModalFocusEventNotifiable.notifyForModalFocusStateChange
Browse files Browse the repository at this point in the history
  • Loading branch information
dominicstop committed Oct 2, 2024
1 parent b7c49ba commit 84cf3e4
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 0 deletions.
1 change: 1 addition & 0 deletions ios/RNIModalSheetView/RNIModalSheetViewDelegate.swift
Original file line number Diff line number Diff line change
Expand Up @@ -459,6 +459,7 @@ extension RNIModalSheetViewDelegate: ModalSheetViewControllerEventsNotifiable {
extension RNIModalSheetViewDelegate: ModalFocusEventNotifiable {

public func notifyForModalFocusStateChange(
forViewController viewController: UIViewController,
prevState: ModalFocusState?,
currentState: ModalFocusState,
nextState: ModalFocusState
Expand Down
2 changes: 2 additions & 0 deletions ios/Temp/ModalEventManager/ModalFocusEventNotifiable.swift
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import Foundation
public protocol ModalFocusEventNotifiable: AnyObject {

func notifyForModalFocusStateChange(
forViewController viewController: UIViewController,
prevState: ModalFocusState?,
currentState: ModalFocusState,
nextState: ModalFocusState
Expand All @@ -22,6 +23,7 @@ public protocol ModalFocusEventNotifiable: AnyObject {
public extension ModalFocusEventNotifiable {

func notifyForModalFocusStateChange(
forViewController viewController: UIViewController,
prevState: ModalFocusState?,
currentState: ModalFocusState,
nextState: ModalFocusState
Expand Down
5 changes: 5 additions & 0 deletions ios/Temp/ModalEventManager/ModalRegistryEntry.swift
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,10 @@ public class ModalRegistryEntry {
};

public func setModalFocusState(_ modalStateNext: ModalFocusState){
guard let viewController = self.viewController else {
return;
};

let modalStatePrev = self.modalFocusStatePrev;
let modalStateCurrent = self.modalFocusState;

Expand All @@ -47,6 +51,7 @@ public class ModalRegistryEntry {

if let eventDelegate = self.viewController as? ModalFocusEventNotifiable {
eventDelegate.notifyForModalFocusStateChange(
forViewController: viewController,
prevState: modalStatePrev,
currentState: modalStateCurrent,
nextState: modalStateNext
Expand Down
2 changes: 2 additions & 0 deletions ios/Temp/ModalViewControllerLifecycleNotifier.swift
Original file line number Diff line number Diff line change
Expand Up @@ -164,12 +164,14 @@ open class ModalViewControllerLifecycleNotifier: ViewControllerLifecycleNotifier
extension ModalViewControllerLifecycleNotifier: ModalFocusEventNotifiable {

public func notifyForModalFocusStateChange(
forViewController viewController: UIViewController,
prevState: ModalFocusState?,
currentState: ModalFocusState,
nextState: ModalFocusState
) {
self.modalFocusEventDelegates.invoke {
$0.notifyForModalFocusStateChange(
forViewController: viewController,
prevState: prevState,
currentState: currentState,
nextState: nextState
Expand Down

0 comments on commit 84cf3e4

Please sign in to comment.