Skip to content

Commit

Permalink
fixup! Convert ConfirmationView form UIKit to SwiftUI
Browse files Browse the repository at this point in the history
Make orientation manager a part of 'SecureConversations.ConfirmationViewSwiftUI.Model'.
  • Loading branch information
rasmustautsglia committed Sep 21, 2023
1 parent f448682 commit dc39037
Show file tree
Hide file tree
Showing 12 changed files with 53 additions and 12 deletions.
14 changes: 13 additions & 1 deletion GliaWidgets.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -597,6 +597,7 @@
C06A7584296EC9DC006B69A2 /* NumberSlotStyle.Accessibility.swift in Sources */ = {isa = PBXBuildFile; fileRef = C06A7583296EC9DC006B69A2 /* NumberSlotStyle.Accessibility.swift */; };
C06A7586296ECC57006B69A2 /* VisitorCodeStyle.Accessibility.swift in Sources */ = {isa = PBXBuildFile; fileRef = C06A7585296ECC57006B69A2 /* VisitorCodeStyle.Accessibility.swift */; };
C06A7588296ECD75006B69A2 /* Theme+VisitorCode.swift in Sources */ = {isa = PBXBuildFile; fileRef = C06A7587296ECD75006B69A2 /* Theme+VisitorCode.swift */; };
C07F62462ABC322B003EFC97 /* OrientationManager.Mock.swift in Sources */ = {isa = PBXBuildFile; fileRef = C07F62452ABC322B003EFC97 /* OrientationManager.Mock.swift */; };
C07FA04029AF542A00E9FB7F /* ScreenSharingViewStyle+Mock.swift in Sources */ = {isa = PBXBuildFile; fileRef = 84265E0B298AECBA00D65842 /* ScreenSharingViewStyle+Mock.swift */; };
C07FA04329AF551D00E9FB7F /* ScreenSharingView.Mock.swift in Sources */ = {isa = PBXBuildFile; fileRef = C07FA04129AF550500E9FB7F /* ScreenSharingView.Mock.swift */; };
C07FA04629AF560A00E9FB7F /* ScreenSharingViewController.Mock.swift in Sources */ = {isa = PBXBuildFile; fileRef = C07FA04429AF55F600E9FB7F /* ScreenSharingViewController.Mock.swift */; };
Expand Down Expand Up @@ -1334,6 +1335,7 @@
C06A7583296EC9DC006B69A2 /* NumberSlotStyle.Accessibility.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = NumberSlotStyle.Accessibility.swift; sourceTree = "<group>"; };
C06A7585296ECC57006B69A2 /* VisitorCodeStyle.Accessibility.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = VisitorCodeStyle.Accessibility.swift; sourceTree = "<group>"; };
C06A7587296ECD75006B69A2 /* Theme+VisitorCode.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "Theme+VisitorCode.swift"; sourceTree = "<group>"; };
C07F62452ABC322B003EFC97 /* OrientationManager.Mock.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = OrientationManager.Mock.swift; sourceTree = "<group>"; };
C07FA04129AF550500E9FB7F /* ScreenSharingView.Mock.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ScreenSharingView.Mock.swift; sourceTree = "<group>"; };
C07FA04429AF55F600E9FB7F /* ScreenSharingViewController.Mock.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ScreenSharingViewController.Mock.swift; sourceTree = "<group>"; };
C07FA04929AF83A400E9FB7F /* ActionButton.Mock.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ActionButton.Mock.swift; sourceTree = "<group>"; };
Expand Down Expand Up @@ -3535,7 +3537,7 @@
C06152D82AB1BC2F00063BF8 /* Managers */ = {
isa = PBXGroup;
children = (
C06152D92AB1BC4300063BF8 /* OrientationManager.swift */,
C07F62442ABC3218003EFC97 /* OrientationManager */,
);
path = Managers;
sourceTree = "<group>";
Expand All @@ -3558,6 +3560,15 @@
path = NumberSlot;
sourceTree = "<group>";
};
C07F62442ABC3218003EFC97 /* OrientationManager */ = {
isa = PBXGroup;
children = (
C06152D92AB1BC4300063BF8 /* OrientationManager.swift */,
C07F62452ABC322B003EFC97 /* OrientationManager.Mock.swift */,
);
path = OrientationManager;
sourceTree = "<group>";
};
C096B408297EBCEB00F0C552 /* CallVisualizer */ = {
isa = PBXGroup;
children = (
Expand Down Expand Up @@ -4399,6 +4410,7 @@
9A3E1D9427B6C29C005634EB /* ChatEngagementFile.Mock.swift in Sources */,
1A2DA73B25EFC00500032611 /* FileUploadListStyle.swift in Sources */,
7594095A298D386F008B173A /* NSLayoutConstraint+Extensions.swift in Sources */,
C07F62462ABC322B003EFC97 /* OrientationManager.Mock.swift in Sources */,
C0D2F06829A4B71C00803B47 /* VideoCallViewModel.Mock.swift in Sources */,
AFEF5C6F29928DB0005C3D8D /* SecureConversations.FileUploadView.swift in Sources */,
84D5B9622A14F33400807F92 /* QuickLookBased.Live.swift in Sources */,
Expand Down
3 changes: 2 additions & 1 deletion GliaWidgets/Public/Glia/Glia+StartEngagement.swift
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,8 @@ extension Glia {
startSocketObservation: environment.coreSdk.startSocketObservation,
stopSocketObservation: environment.coreSdk.stopSocketObservation,
pushNotifications: environment.coreSdk.pushNotifications,
createSendMessagePayload: environment.coreSdk.createSendMessagePayload
createSendMessagePayload: environment.coreSdk.createSendMessagePayload,
orientationManager: environment.orientationManager
)
)
rootCoordinator?.delegate = { [weak self] event in
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ extension SecureConversations.ConfirmationViewSwiftUI {
self.environment = environment
self.style = style
self.delegate = delegate
self.orientationManager = .init(environment: .init(uiApplication: environment.uiApplication, uiDevice: environment.uiDevice, notificationCenter: environment.notificationCenter))
self.orientationManager = environment.orientationManager
self.orientation = orientationManager.orientation
orientationManager.$orientation.sink { [weak self] orientation in
self?.orientation = orientation
Expand Down Expand Up @@ -93,8 +93,7 @@ extension SecureConversations.ConfirmationViewSwiftUI.Model {
}

struct Environment {
var orientationManager: OrientationManager
var uiApplication: UIKitBased.UIApplication
var uiDevice: UIKitBased.UIDevice
var notificationCenter: FoundationBased.NotificationCenter
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -161,9 +161,8 @@ extension SecureConversations {

func presentSecureConversationsConfirmationViewController() {
let environment: ConfirmationViewSwiftUI.Model.Environment = .init(
uiApplication: environment.uiApplication,
uiDevice: environment.uiDevice,
notificationCenter: environment.notificationCenter
orientationManager: environment.orientationManager,
uiApplication: environment.uiApplication
)

let model = SecureConversations.ConfirmationViewSwiftUI.Model(
Expand Down Expand Up @@ -348,6 +347,7 @@ extension SecureConversations.Coordinator {
var startSocketObservation: CoreSdkClient.StartSocketObservation
var stopSocketObservation: CoreSdkClient.StopSocketObservation
var createSendMessagePayload: CoreSdkClient.CreateSendMessagePayload
var orientationManager: OrientationManager
}

enum DelegateEvent {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,8 @@ extension EngagementCoordinator.Environment {
startSocketObservation: {},
stopSocketObservation: {},
pushNotifications: .mock,
createSendMessagePayload: { _, _ in .mock() }
createSendMessagePayload: { _, _ in .mock() },
orientationManager: .mock()
)
}
#endif
Original file line number Diff line number Diff line change
Expand Up @@ -36,5 +36,6 @@ extension EngagementCoordinator {
var stopSocketObservation: CoreSdkClient.StopSocketObservation
var pushNotifications: CoreSdkClient.PushNotifications
var createSendMessagePayload: CoreSdkClient.CreateSendMessagePayload
var orientationManager: OrientationManager
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -477,7 +477,8 @@ extension EngagementCoordinator {
isAuthenticated: environment.isAuthenticated,
startSocketObservation: environment.startSocketObservation,
stopSocketObservation: environment.stopSocketObservation,
createSendMessagePayload: environment.createSendMessagePayload
createSendMessagePayload: environment.createSendMessagePayload,
orientationManager: environment.orientationManager
)
)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ extension Glia {
var createFileUploadListModel: SecureConversations.FileUploadListViewModel.Create
var screenShareHandler: ScreenShareHandler
var messagesWithUnreadCountLoaderScheduler: CoreSdkClient.ReactiveSwift.DateScheduler
var orientationManager: OrientationManager
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,12 @@ extension Glia.Environment {
createFileUploader: FileUploader.init(maximumUploads:environment:),
createFileUploadListModel: SecureConversations.FileUploadListViewModel.init,
screenShareHandler: ScreenShareHandler.create(),
messagesWithUnreadCountLoaderScheduler: CoreSdkClient.ReactiveSwift.QueueScheduler.main
messagesWithUnreadCountLoaderScheduler: CoreSdkClient.ReactiveSwift.QueueScheduler.main,
orientationManager: .init(environment: .init(
uiApplication: .live,
uiDevice: .live,
notificationCenter: .live
))
)
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,8 @@ extension Glia.Environment {
createFileUploader: FileUploader.mock,
createFileUploadListModel: SecureConversations.FileUploadListViewModel.mock(environment:),
screenShareHandler: .mock,
messagesWithUnreadCountLoaderScheduler: CoreSdkClient.reactiveSwiftDateSchedulerMock
messagesWithUnreadCountLoaderScheduler: CoreSdkClient.reactiveSwiftDateSchedulerMock,
orientationManager: .mock()
)
}

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
import Foundation

#if DEBUG

extension OrientationManager {
static func mock(
uiApplication: UIKitBased.UIApplication = .mock,
uiDevice: UIKitBased.UIDevice = .mock,
notificationCenter: FoundationBased.NotificationCenter = .mock
) -> OrientationManager {
.init(environment: .init(
uiApplication: uiApplication,
uiDevice: uiDevice,
notificationCenter: notificationCenter
))
}
}

#endif

0 comments on commit dc39037

Please sign in to comment.