Skip to content

Commit

Permalink
Add support on attached on detached iOS
Browse files Browse the repository at this point in the history
  • Loading branch information
Ortes committed Feb 21, 2023
1 parent 98fe219 commit 0ddbba2
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
11 changes: 10 additions & 1 deletion ios/Classes/FLTUnityWidgetController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,11 @@ public class FLTUnityWidgetController: NSObject, FLTUnityOptionsSink, FlutterPla
data: DataStreamEvent(
eventType: DataStreamEventTypes.OnUnityViewCreated,
data: true))

GetUnityPlayerUtils().notifyFlutter(
data: DataStreamEvent(
eventType: DataStreamEventTypes.OnViewAttached,
data: keyId))
GetUnityPlayerUtils().resume()
}

Expand Down Expand Up @@ -120,7 +125,11 @@ public class FLTUnityWidgetController: NSObject, FLTUnityOptionsSink, FlutterPla

removeViewIfNeeded()
GetUnityPlayerUtils().activeController = globalControllers.last


GetUnityPlayerUtils().notifyFlutter(
data: DataStreamEvent(
eventType: DataStreamEventTypes.OnViewDetached,
data: keyId))
_disposed = true
}

Expand Down
2 changes: 2 additions & 0 deletions ios/Classes/HandleEventSink.swift
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,8 @@ enum DataStreamEventTypes : String {
case OnUnityPlayerQuited
case OnUnitySceneLoaded
case OnUnityMessage
case OnViewAttached
case OnViewDetached
}

struct DataStreamEvent {
Expand Down

0 comments on commit 0ddbba2

Please sign in to comment.