Skip to content

Commit

Permalink
Merge pull request #4980 from wikimedia/T374879
Browse files Browse the repository at this point in the history
Add profile icon to Settings (when in tab bar)
  • Loading branch information
l-olson1214 authored Sep 19, 2024
2 parents 1bbf820 + 10e56bb commit edba179
Show file tree
Hide file tree
Showing 5 changed files with 110 additions and 85 deletions.
3 changes: 0 additions & 3 deletions Wikipedia/Code/ExploreViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -204,12 +204,9 @@ class ExploreViewController: ColumnarCollectionViewController, ExploreCardViewCo
}()

@objc func userDidTapProfile() {
DonateFunnel.shared.logSettingsDidTapSettingsIcon()

let coordinator = ProfileCoordinator(navigationController: self.navigationController!, theme: theme, dataStore: dataStore)
self.profileCoordinator = coordinator
coordinator.start()

}

open override func refresh() {
Expand Down
7 changes: 4 additions & 3 deletions Wikipedia/Code/ProfileCoordinator.swift
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@ import UIKit
import SwiftUI
import WMFComponents

class ProfileCoordinator: Coordinator, ProfileCoordinatorDelegate {
@objc(WMFProfileCoordinator)
class ProfileCoordinator: NSObject, Coordinator, ProfileCoordinatorDelegate {

// MARK: Coordinator Protocol Properties

Expand All @@ -15,15 +16,15 @@ class ProfileCoordinator: Coordinator, ProfileCoordinatorDelegate {

// MARK: Lifecycle

init(navigationController: UINavigationController, theme: Theme, dataStore: MWKDataStore) {
@objc init(navigationController: UINavigationController, theme: Theme, dataStore: MWKDataStore) {
self.navigationController = navigationController
self.theme = theme
self.dataStore = dataStore
}

// MARK: Coordinator Protocol Methods

func start() {
@objc func start() {
let isLoggedIn = dataStore.authenticationManager.authStateIsPermanent

let pageTitle = WMFLocalizedString("profile-page-title-logged-out", value: "Account", comment: "Page title for non-logged in users")
Expand Down
7 changes: 7 additions & 0 deletions Wikipedia/Code/SettingsCoordinator.swift
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,13 @@ public class SettingsCoordinator: Coordinator {
// MARK: Coordinator Protocol Methods

public func start() {

// If navigation controller already has WMFSettingsViewController as it's root view controller, no need to navigate anywhere
if navigationController.viewControllers.count == 1,
(navigationController.viewControllers.first as? WMFSettingsViewController) != nil {
return
}

let settingsViewController = WMFSettingsViewController(dataStore: dataStore)
settingsViewController.theme = theme
let navVC = WMFThemeableNavigationController(rootViewController: settingsViewController, theme: theme)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import Foundation
import SwiftUI
import WMFComponents
import WMF
import WMFData
Expand Down
Loading

0 comments on commit edba179

Please sign in to comment.