Skip to content

Commit

Permalink
fix: Crash unwrapping MainCoordinator.splitViewController - WPB-145…
Browse files Browse the repository at this point in the history
…10 (#2209)

Co-authored-by: Sam Wyndham <[email protected]>
  • Loading branch information
github-actions[bot] and samwyndham authored Nov 26, 2024
1 parent 163ce55 commit 4a5aa1e
Show file tree
Hide file tree
Showing 7 changed files with 20 additions and 17 deletions.
18 changes: 9 additions & 9 deletions wire-ios/Tests/Sourcery/generated/AutoMockable.generated.swift

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -341,7 +341,9 @@ extension ConversationListViewController: ConversationListContainerViewModelDele
@objc
private func presentProfile() {
Task {
let selfProfileUI = UINavigationController(rootViewController: selfProfileViewControllerBuilder.build())
let selfProfileUI = UINavigationController(
rootViewController: selfProfileViewControllerBuilder.build(mainCoordinator: mainCoordinator)
)
selfProfileUI.modalPresentationStyle = .formSheet
await mainCoordinator.presentViewController(selfProfileUI)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,9 @@ final class SidebarViewControllerDelegate: WireSidebarUI.SidebarViewControllerDe
@MainActor
public func sidebarViewControllerDidSelectAccountImage(_ viewController: SidebarViewController) {
Task {
let selfProfileUI = UINavigationController(rootViewController: selfProfileUIBuilder.build())
let selfProfileUI = UINavigationController(
rootViewController: selfProfileUIBuilder.build(mainCoordinator: mainCoordinator)
)
selfProfileUI.modalPresentationStyle = .formSheet
await mainCoordinator.presentViewController(selfProfileUI)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -285,8 +285,6 @@ final class ZClientViewController: UIViewController {
mainSplitViewController.borderColor = ColorTheme.Strokes.outline
mainSplitViewController.conversationListUI = conversationListViewController

selfProfileViewControllerBuilder.mainCoordinator = .init(mainCoordinator: mainCoordinator)

settingsViewControllerBuilder.settingsPropertyFactoryDelegate = defaultSettingsPropertyFactoryDelegate
mainTabBarController.archiveUI = archiveUI
mainTabBarController.settingsUI = settingsViewControllerBuilder
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@ final class SelfProfileViewControllerBuilder: SelfProfileViewControllerBuilderPr
var selfUser: SettingsSelfUser
var userRightInterfaceType: UserRightInterface.Type
var userSession: UserSession
var mainCoordinator: AnyMainCoordinator!
var accountSelector: AccountSelector?
var trackingManager: TrackingManager?

Expand All @@ -42,7 +41,7 @@ final class SelfProfileViewControllerBuilder: SelfProfileViewControllerBuilderPr
self.accountSelector = accountSelector
}

func build() -> UIViewController {
func build(mainCoordinator: AnyMainCoordinator) -> UIViewController {
SelfProfileViewController(
selfUser: selfUser,
userRightInterfaceType: userRightInterfaceType,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,5 +21,5 @@ import UIKit
// sourcery: AutoMockable
protocol SelfProfileViewControllerBuilderProtocol {
@MainActor
func build() -> UIViewController
func build(mainCoordinator: AnyMainCoordinator) -> UIViewController
}
Original file line number Diff line number Diff line change
Expand Up @@ -381,7 +381,9 @@ extension ProfileViewController: ProfileFooterViewDelegate, IncomingRequestFoote

private func openSelfProfile() {
Task {
let selfProfileUI = UINavigationController(rootViewController: selfProfileUIBuilder.build())
let selfProfileUI = UINavigationController(
rootViewController: selfProfileUIBuilder.build(mainCoordinator: mainCoordinator)
)
selfProfileUI.modalPresentationStyle = .formSheet
await mainCoordinator.presentViewController(selfProfileUI)
}
Expand Down

0 comments on commit 4a5aa1e

Please sign in to comment.