Skip to content

Commit

Permalink
changes for alex
Browse files Browse the repository at this point in the history
  • Loading branch information
adudenamedruby committed Oct 17, 2024
1 parent 1b5f84d commit e644c07
Show file tree
Hide file tree
Showing 4 changed files with 48 additions and 60 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,12 @@ class MainMenuCoordinator: BaseCoordinator, FeatureFlaggable {
case .settings:
self.navigationHandler?.showSettings(at: .general)
case .syncSignIn:
self.navigationHandler?.showSignInView(fxaParameters: destination.fxaSignInViewParameters)
let fxaParameters = FxASignInViewParameters(
launchParameters: FxALaunchParams(entrypoint: .browserMenu, query: [:]),
flowType: .emailLoginFlow,
referringPage: .appMenu
)
self.navigationHandler?.showSignInView(fxaParameters: fxaParameters)
}

self.parentCoordinator?.didFinish(from: self)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -134,4 +134,44 @@ struct MainMenuState: ScreenState, Equatable {
)
}
}

// Farcaseanu
// we should probably add this somewhere in either the screen showing actionType
// from the VC, or the updateCurrentTabInfo action.
// private func syncMenuButton() -> PhotonRowActions? {
//
// let rustAccount = RustFirefoxAccounts.shared
// let needsReAuth = rustAccount.accountNeedsReauth()
//
// guard let userProfile = rustAccount.userProfile else {
// return SingleActionViewModel(title: .LegacyAppMenu.SyncAndSaveData,
// iconString: StandardImageIdentifiers.Large.sync,
// tapHandler: action).items
// }
//
// let title: String = {
// if rustAccount.accountNeedsReauth() {
// return .FxAAccountVerifyPassword
// }
// return userProfile.displayName ?? userProfile.email
// }()
//
// let warningImage = StandardImageIdentifiers.Large.warningFill
// let avatarImage = StandardImageIdentifiers.Large.avatarCircle
// let iconString = needsReAuth ? warningImage : avatarImage
//
// var iconURL: URL?
// if let str = rustAccount.userProfile?.avatarUrl,
// let url = URL(string: str, invalidCharacters: false) {
// iconURL = url
// }
// let iconType: PhotonActionSheetIconType = needsReAuth ? .Image : .URL
// let syncOption = SingleActionViewModel(title: title,
// iconString: iconString,
// iconURL: iconURL,
// iconType: iconType,
// needsIconActionableTint: needsReAuth,
// tapHandler: action).items
// return syncOption
// }
}
Original file line number Diff line number Diff line change
Expand Up @@ -27,15 +27,12 @@ enum MainMenuDetailsViewType {
struct MenuNavigationDestination: Equatable {
let destination: MainMenuNavigationDestination
let urlToVisit: URL?
let fxaSignInViewParameters: FxASignInViewParameters?

init(
_ destination: MainMenuNavigationDestination,
urlToVisit: URL? = nil,
fxaSingInViewParameters: FxASignInViewParameters? = nil
urlToVisit: URL? = nil
) {
self.destination = destination
self.urlToVisit = urlToVisit
self.fxaSignInViewParameters = fxaSingInViewParameters
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -98,67 +98,13 @@ class MainMenuViewController: UIViewController,
)
}

// private func syncMenuButton() -> PhotonRowActions? {
// let action: (SingleActionViewModel) -> Void = { [weak self] action in
// let fxaParams = FxALaunchParams(entrypoint: .browserMenu, query: [:])
// let parameters = FxASignInViewParameters(launchParameters: fxaParams,
// flowType: .emailLoginFlow,
// referringPage: .appMenu)
// self?.delegate?.showSignInView(fxaParameters: parameters)
// TelemetryWrapper.recordEvent(category: .action, method: .tap, object: .signIntoSync)
// }
//
// let rustAccount = RustFirefoxAccounts.shared
// let needsReAuth = rustAccount.accountNeedsReauth()
//
// guard let userProfile = rustAccount.userProfile else {
// return SingleActionViewModel(title: .LegacyAppMenu.SyncAndSaveData,
// iconString: StandardImageIdentifiers.Large.sync,
// tapHandler: action).items
// }
//
// let title: String = {
// if rustAccount.accountNeedsReauth() {
// return .FxAAccountVerifyPassword
// }
// return userProfile.displayName ?? userProfile.email
// }()
//
// let warningImage = StandardImageIdentifiers.Large.warningFill
// let avatarImage = StandardImageIdentifiers.Large.avatarCircle
// let iconString = needsReAuth ? warningImage : avatarImage
//
// var iconURL: URL?
// if let str = rustAccount.userProfile?.avatarUrl,
// let url = URL(string: str, invalidCharacters: false) {
// iconURL = url
// }
// let iconType: PhotonActionSheetIconType = needsReAuth ? .Image : .URL
// let syncOption = SingleActionViewModel(title: title,
// iconString: iconString,
// iconURL: iconURL,
// iconType: iconType,
// needsIconActionableTint: needsReAuth,
// tapHandler: action).items
// return syncOption
// }
menuContent.accountHeaderView.mainButtonCallback = { [weak self] in
guard let self else { return }
store.dispatch(
MainMenuAction(
windowUUID: self.windowUUID,
actionType: MainMenuActionType.closeMenuAndNavigateToDestination,
navigationDestination: MenuNavigationDestination(
.syncSignIn,
fxaSingInViewParameters: FxASignInViewParameters(
launchParameters: FxALaunchParams(
entrypoint: .browserMenu,
query: [:]
),
flowType: .emailLoginFlow,
referringPage: .appMenu
)
)
navigationDestination: MenuNavigationDestination(.syncSignIn)
)
)
}
Expand Down

0 comments on commit e644c07

Please sign in to comment.