Skip to content

Commit

Permalink
Merge pull request #21701 from wordpress-mobile/21425-my-domains-and-…
Browse files Browse the repository at this point in the history
…menu

[Domain Management] Add My Domains to Me Screen
  • Loading branch information
alpavanoglu authored Oct 24, 2023
2 parents abed555 + 0084f27 commit 47e98ba
Show file tree
Hide file tree
Showing 4 changed files with 70 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ enum RemoteFeatureFlag: Int, CaseIterable {
case .jetpackSocialImprovements:
return AppConfiguration.isJetpack
case .domainManagement:
return false
return false // TODO: Update as `AppConfiguration.isJetpack`
case .plansInSiteCreation:
return false
case .readerImprovements:
Expand Down
43 changes: 33 additions & 10 deletions WordPress/Classes/ViewRelated/Me/Me Main/MeViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -182,9 +182,8 @@ class MeViewController: UITableViewController {

let shouldShowQRLoginRow = AppConfiguration.qrLoginEnabled && !(account?.settings?.twoStepEnabled ?? false)

return ImmuTable(sections: [
// first section
.init(rows: {
var sections: [ImmuTableSection] = [
ImmuTableSection(rows: {
var rows: [ImmuTableRow] = [appSettingsRow]
if loggedIn {
var loggedInRows = [myProfile, accountSettings]
Expand All @@ -196,9 +195,8 @@ class MeViewController: UITableViewController {
}
return rows
}()),

// middle section
.init(rows: {
ImmuTableSection(rows: {
var rows: [ImmuTableRow] = [helpAndSupportIndicator]

rows.append(NavigationItemRow(title: ShareAppContentPresenter.RowConstants.buttonTitle,
Expand All @@ -214,13 +212,33 @@ class MeViewController: UITableViewController {
accessibilityIdentifier: "About"))

return rows
}()),
}())
]

#if JETPACK
if RemoteFeatureFlag.domainManagement.enabled() {
sections.append(.init(headerText: HeaderTitles.products, rows: {
return [
ButtonRow(title: MyDomainsViewController.Strings.title) { action in
let controller = MyDomainsViewController()
let navigationController = UINavigationController(rootViewController: controller)
self.present(navigationController, animated: true) {
self.tableView.deselectSelectedRowWithAnimation(true)
}
}
]
}()))
}
#endif

// last section
// last section
sections.append(
.init(headerText: wordPressComAccount, rows: {
return [loggedIn ? logOut : logIn]
}())
])
)

return ImmuTable(sections: sections)
}

// MARK: - UITableViewDelegate
Expand Down Expand Up @@ -374,8 +392,8 @@ class MeViewController: UITableViewController {
}

if let sections = handler?.viewModel.sections,
let section = sections.firstIndex(where: { $0.rows.contains(where: matchRow) }),
let row = sections[section].rows.firstIndex(where: matchRow) {
let section = sections.firstIndex(where: { $0.rows.contains(where: matchRow) }),
let row = sections[section].rows.firstIndex(where: matchRow) {
let indexPath = IndexPath(row: row, section: section)

tableView.selectRow(at: indexPath, animated: true, scrollPosition: .middle)
Expand Down Expand Up @@ -574,6 +592,11 @@ private extension MeViewController {

enum HeaderTitles {
static let wpAccount = NSLocalizedString("WordPress.com Account", comment: "WordPress.com sign-in/sign-out section header title")
static let products = NSLocalizedString(
"me.products.header",
value: "Products",
comment: "Products header text in Me Screen."
)
}

enum LogoutAlert {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
import UIKit

final class MyDomainsViewController: UIViewController {
override func viewDidLoad() {
super.viewDidLoad()
title = Strings.title

WPStyleGuide.configureColors(view: view, tableView: nil)
let action = UIAction { _ in
// Present add domain screen.
}
navigationItem.rightBarButtonItem = .init(systemItem: .add, primaryAction: action)
}
}

extension MyDomainsViewController {
enum Strings {
static let title = NSLocalizedString(
"domain.management.title",
value: "My Domains",
comment: "Domain Management Screen Title"
)
}
}
12 changes: 12 additions & 0 deletions WordPress/WordPress.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -234,6 +234,7 @@
03216ECD27995F3500D444CA /* SchedulingViewControllerPresenter.swift in Sources */ = {isa = PBXBuildFile; fileRef = 03216ECB27995F3500D444CA /* SchedulingViewControllerPresenter.swift */; };
069A4AA62664448F00413FA9 /* GutenbergFeaturedImageHelper.swift in Sources */ = {isa = PBXBuildFile; fileRef = 069A4AA52664448F00413FA9 /* GutenbergFeaturedImageHelper.swift */; };
069A4AA72664448F00413FA9 /* GutenbergFeaturedImageHelper.swift in Sources */ = {isa = PBXBuildFile; fileRef = 069A4AA52664448F00413FA9 /* GutenbergFeaturedImageHelper.swift */; };
080544722AD06667001E1A36 /* MyDomainsViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 08D61F202AD0635100BF3D00 /* MyDomainsViewController.swift */; };
0807CB721CE670A800CDBDAC /* WPContentSearchHelper.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0807CB711CE670A800CDBDAC /* WPContentSearchHelper.swift */; };
080C44A91CE14A9F00B3A02F /* MenuDetailsViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 080C449E1CE14A9F00B3A02F /* MenuDetailsViewController.m */; };
0815CF461E96F22600069916 /* MediaImportService.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0815CF451E96F22600069916 /* MediaImportService.swift */; };
Expand Down Expand Up @@ -6022,6 +6023,7 @@
08D499661CDD20450004809A /* Menus.storyboard */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.storyboard; path = Menus.storyboard; sourceTree = "<group>"; };
08D4C0E61C76F14E002E5BF6 /* WordPress 47.xcdatamodel */ = {isa = PBXFileReference; lastKnownFileType = wrapper.xcdatamodel; path = "WordPress 47.xcdatamodel"; sourceTree = "<group>"; };
08D553652821286300AA1E8D /* Tooltip.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Tooltip.swift; sourceTree = "<group>"; };
08D61F202AD0635100BF3D00 /* MyDomainsViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MyDomainsViewController.swift; sourceTree = "<group>"; };
08D9784B1CD2AF7D0054F19A /* Menu+ViewDesign.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "Menu+ViewDesign.h"; sourceTree = "<group>"; };
08D9784C1CD2AF7D0054F19A /* Menu+ViewDesign.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "Menu+ViewDesign.m"; sourceTree = "<group>"; };
08D9784D1CD2AF7D0054F19A /* MenuItem+ViewDesign.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "MenuItem+ViewDesign.h"; sourceTree = "<group>"; };
Expand Down Expand Up @@ -10112,6 +10114,14 @@
name = "View Models";
sourceTree = "<group>";
};
08D61F1F2AD0633600BF3D00 /* MyDomains */ = {
isa = PBXGroup;
children = (
08D61F202AD0635100BF3D00 /* MyDomainsViewController.swift */,
);
path = MyDomains;
sourceTree = "<group>";
};
08D978491CD2AF7D0054F19A /* Menus */ = {
isa = PBXGroup;
children = (
Expand Down Expand Up @@ -10987,6 +10997,7 @@
3F29EB6F2404218E005313DE /* Help & Support */,
3F29EB6B24041FFC005313DE /* Me Main */,
3F29EB6D24042093005313DE /* My Profile */,
08D61F1F2AD0633600BF3D00 /* MyDomains */,
);
path = Me;
sourceTree = "<group>";
Expand Down Expand Up @@ -24134,6 +24145,7 @@
FABB21FD2602FC2C00C8785C /* ActivityUtils.swift in Sources */,
FABB21FE2602FC2C00C8785C /* WPLogger.m in Sources */,
FABB21FF2602FC2C00C8785C /* JetpackBackupStatusCoordinator.swift in Sources */,
080544722AD06667001E1A36 /* MyDomainsViewController.swift in Sources */,
3F720C222889B65B00519938 /* JetpackBrandingVisibility.swift in Sources */,
0C35FFF729CBB5DE00D224EB /* BlogDashboardEmptyStateCell.swift in Sources */,
FABB22012602FC2C00C8785C /* RevisionDiff.swift in Sources */,
Expand Down

0 comments on commit 47e98ba

Please sign in to comment.