Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Domain Management: Implement add new freestanding domain flow #21979

Merged
merged 28 commits into from
Nov 8, 2023
Merged
Show file tree
Hide file tree
Changes from 26 commits
Commits
Show all changes
28 commits
Select commit Hold shift + click to select a range
44c2d94
Update: correctly hook up add domain button to common function
hassaanelgarem Nov 3, 2023
6cefb09
Update: refactor domain suggestions to handle not passing a site
hassaanelgarem Nov 3, 2023
195d449
Update: introduce new domain selection type
hassaanelgarem Nov 3, 2023
70d35a0
Update: refactor `RegisterDomainDetailsServiceProxy` to accept nil as…
hassaanelgarem Nov 3, 2023
6bcb7b9
Update: refactor RegisterDomainSuggestionsVC's helpers to handle no s…
hassaanelgarem Nov 6, 2023
d77f52d
Add: Basic implementation of `AllDomainsAddDomainCoordinator`
hassaanelgarem Nov 6, 2023
7144701
Update: add public function to reload domains list after purchase
hassaanelgarem Nov 6, 2023
cf8bf05
Update: add ability to customize title of suggestions view
hassaanelgarem Nov 6, 2023
536cdcd
Update: Add support for custom title in checkout
hassaanelgarem Nov 6, 2023
5d7359a
Update: change string key to use convention
hassaanelgarem Nov 6, 2023
6b63115
Add: helper func for starting checkout for no site domains
hassaanelgarem Nov 6, 2023
dde989e
Merge branch 'trunk' into task/21778-search-for-new-domain
hassaanelgarem Nov 6, 2023
5d17c8b
Fix typo
hassaanelgarem Nov 6, 2023
73095a4
Refactor: introduce coordinator logic into `RegisterDomainSuggestions…
hassaanelgarem Nov 6, 2023
085756f
Update: move `RegisterDomainCoordinator` to its own file
hassaanelgarem Nov 6, 2023
2534170
Update: Move callbacks to coordinator
hassaanelgarem Nov 6, 2023
5d81e1f
Update: hookup new flow to all domains screen
hassaanelgarem Nov 6, 2023
61ae067
Update: integrate right version of WPKit
hassaanelgarem Nov 6, 2023
d5ba657
Refactor: remove duplicate code
hassaanelgarem Nov 6, 2023
8d61f2c
Fix: lint errors
hassaanelgarem Nov 6, 2023
422c787
Update: fix build error
hassaanelgarem Nov 6, 2023
012caac
Tests: fix build error
hassaanelgarem Nov 6, 2023
42c5b70
Update: remove redundant domain params inside coordinator
hassaanelgarem Nov 6, 2023
243562a
Update: track error messages
hassaanelgarem Nov 6, 2023
0dc2c8a
Update: point to latest WPKit commit
hassaanelgarem Nov 7, 2023
a580351
Update: point WPKit to trunk
hassaanelgarem Nov 7, 2023
b7af8bb
Merge branch 'trunk' into task/21778-search-for-new-domain
hassaanelgarem Nov 8, 2023
ac5cbec
Update Podfile.lock
hassaanelgarem Nov 8, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions Podfile
Original file line number Diff line number Diff line change
Expand Up @@ -51,9 +51,9 @@ end

def wordpress_kit
# Anything compatible with 8.9, starting from 8.9.1 which has a breaking change fix
pod 'WordPressKit', '~> 8.10'
# pod 'WordPressKit', '~> 8.10'
# pod 'WordPressKit', git: 'https://github.com/wordpress-mobile/WordPressKit-iOS.git', tag: ''
# pod 'WordPressKit', git: 'https://github.com/wordpress-mobile/WordPressKit-iOS.git', branch: ''
pod 'WordPressKit', git: 'https://github.com/wordpress-mobile/WordPressKit-iOS.git', branch: 'trunk'
# pod 'WordPressKit', git: 'https://github.com/wordpress-mobile/WordPressKit-iOS.git', commit: ''
# pod 'WordPressKit', path: '../WordPressKit-iOS'
end
Expand Down
14 changes: 9 additions & 5 deletions Podfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -126,16 +126,14 @@ DEPENDENCIES:
- SwiftLint (~> 0.50)
- WordPress-Editor-iOS (~> 1.19.9)
- WordPressAuthenticator (>= 7.2.1, ~> 7.2)
- WordPressKit (~> 8.10)
- WordPressKit (from `https://github.com/wordpress-mobile/WordPressKit-iOS.git`, branch `trunk`)
- WordPressShared (~> 2.2)
- WordPressUI (~> 1.15)
- WPMediaPicker (>= 1.8.10, ~> 1.8)
- ZendeskSupportSDK (= 5.3.0)
- ZIPFoundation (~> 0.9.8)

SPEC REPOS:
https://github.com/wordpress-mobile/cocoapods-specs.git:
- WordPressKit
trunk:
- Alamofire
- AlamofireImage
Expand Down Expand Up @@ -185,11 +183,17 @@ EXTERNAL SOURCES:
:tag: 0.2.0
Gutenberg:
:podspec: https://cdn.a8c-ci.services/gutenberg-mobile/Gutenberg-v1.107.0.podspec
WordPressKit:
:branch: trunk
:git: https://github.com/wordpress-mobile/WordPressKit-iOS.git

CHECKOUT OPTIONS:
FSInteractiveMap:
:git: https://github.com/wordpress-mobile/FSInteractiveMap.git
:tag: 0.2.0
WordPressKit:
:commit: 1ed1cddc0d17d79be190a201ae645c525b874eb4
:git: https://github.com/wordpress-mobile/WordPressKit-iOS.git

SPEC CHECKSUMS:
Alamofire: 3ec537f71edc9804815215393ae2b1a8ea33a844
Expand Down Expand Up @@ -223,7 +227,7 @@ SPEC CHECKSUMS:
WordPress-Aztec-iOS: fbebd569c61baa252b3f5058c0a2a9a6ada686bb
WordPress-Editor-iOS: bda9f7f942212589b890329a0cb22547311749ef
WordPressAuthenticator: eb60491871a2b8819017deed2970b054d2678547
WordPressKit: 30510174ad90a997acef42a5880bdda45c5c66e9
WordPressKit: ef52a8d69434c0b81799999e8b19e68dc6a377b2
WordPressShared: 87f3ee89b0a3e83106106f13a8b71605fb8eb6d2
WordPressUI: a491454affda3b0fb812812e637dc5e8f8f6bd06
WPMediaPicker: 332812329cbdc672cdb385b8ac3a389f668d3012
Expand All @@ -237,6 +241,6 @@ SPEC CHECKSUMS:
ZendeskSupportSDK: 3a8e508ab1d9dd22dc038df6c694466414e037ba
ZIPFoundation: d170fa8e270b2a32bef9dcdcabff5b8f1a5deced

PODFILE CHECKSUM: 87283d92c99164bd6b27423cd2474decb698219e
PODFILE CHECKSUM: 32668955e63d88fa5e19b00553baefae59c2a879

COCOAPODS: 1.14.2
6 changes: 4 additions & 2 deletions WordPress/Classes/Utility/WebKitViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -513,8 +513,10 @@ class WebKitViewController: UIViewController, WebKitAuthenticatable {
assertionFailure("Observed change to web view that we are not handling")
}

// Set the title for the HUD which shows up on tap+hold w/ accessibile font sizes enabled
navigationItem.title = "\(titleView.titleLabel.text ?? "")\n\n\(String(describing: titleView.subtitleLabel.text ?? ""))"
if customTitle == nil {
// Set the title for the HUD which shows up on tap+hold w/ accessible font sizes enabled
navigationItem.title = "\(titleView.titleLabel.text ?? "")\n\n\(String(describing: titleView.subtitleLabel.text ?? ""))"
}

// Accessibility values which emulate those found in Safari
navigationItem.accessibilityLabel = NSLocalizedString("Title", comment: "Accessibility label for web page preview title")
Expand Down
5 changes: 4 additions & 1 deletion WordPress/Classes/Utility/WebViewControllerFactory.swift
Original file line number Diff line number Diff line change
Expand Up @@ -45,10 +45,13 @@ class WebViewControllerFactory: NSObject {
return controller(configuration: configuration, source: source)
}

static func controllerWithDefaultAccountAndSecureInteraction(url: URL, source: String) -> WebKitViewController {
static func controllerWithDefaultAccountAndSecureInteraction(url: URL,
source: String,
title: String? = nil) -> WebKitViewController {
let configuration = WebViewControllerConfiguration(url: url)
configuration.authenticateWithDefaultAccount()
configuration.secureInteraction = true
configuration.customTitle = title

return controller(configuration: configuration, source: source)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,9 @@ import SwiftUI
source: String,
blog: Blog
) {
let coordinator = RegisterDomainCoordinator(site: blog)
let domainSuggestionsViewController = RegisterDomainSuggestionsViewController.instance(
site: blog,
coordinator: coordinator,
domainSelectionType: .purchaseWithPaidPlan,
includeSupportButton: false
)
Expand Down Expand Up @@ -39,15 +40,15 @@ import SwiftUI
}
}

let domainAddedToCart = { (domainViewController: RegisterDomainSuggestionsViewController, domainName: String) in
let domainAddedToCart = { (domainViewController: UIViewController, domainName: String) in
guard let viewModel = PlanSelectionViewModel(blog: blog) else { return }
let planSelectionViewController = PlanSelectionViewController(viewModel: viewModel)
planSelectionViewController.planSelectedCallback = { planSelectionViewController, checkoutURL in
planSelected(planSelectionViewController, domainName, checkoutURL)
}
domainViewController.navigationController?.pushViewController(planSelectionViewController, animated: true)
}
domainSuggestionsViewController.domainAddedToCartCallback = domainAddedToCart
coordinator.domainAddedToCartCallback = domainAddedToCart

let navigationController = UINavigationController(rootViewController: domainSuggestionsViewController)
dashboardViewController.present(navigationController, animated: true)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,15 @@ extension BlogDetailsViewController {
}

@objc func showDomainCreditRedemption() {
let coordinator = RegisterDomainCoordinator(site: blog,
domainPurchasedCallback: { [weak self] _, domain in
WPAnalytics.track(.domainCreditRedemptionSuccess)
self?.presentDomainCreditRedemptionSuccess(domain: domain)
})
let controller = RegisterDomainSuggestionsViewController
.instance(site: blog, domainSelectionType: .registerWithPaidPlan, domainPurchasedCallback: { [weak self] _, domain in
WPAnalytics.track(.domainCreditRedemptionSuccess)
self?.presentDomainCreditRedemptionSuccess(domain: domain)
})
.instance(coordinator: coordinator,
domainSelectionType: .registerWithPaidPlan)

let navigationController = UINavigationController(rootViewController: controller)
present(navigationController, animated: true)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,13 +34,13 @@ protocol RegisterDomainDetailsServiceProxyProtocol {
failure: @escaping (Error) -> Void)

func createTemporaryDomainShoppingCart(
siteID: Int,
siteID: Int?,
domainSuggestion: DomainSuggestion,
privacyProtectionEnabled: Bool,
success: @escaping (CartResponseProtocol) -> Void,
failure: @escaping (Error) -> Void)

func createPersistentDomainShoppingCart(siteID: Int,
func createPersistentDomainShoppingCart(siteID: Int?,
domainSuggestion: DomainSuggestion,
privacyProtectionEnabled: Bool,
success: @escaping (CartResponseProtocol) -> Void,
Expand Down Expand Up @@ -164,7 +164,7 @@ class RegisterDomainDetailsServiceProxy: RegisterDomainDetailsServiceProxyProtoc
}

func createTemporaryDomainShoppingCart(
siteID: Int,
siteID: Int?,
domainSuggestion: DomainSuggestion,
privacyProtectionEnabled: Bool,
success: @escaping (CartResponseProtocol) -> Void,
Expand All @@ -177,7 +177,7 @@ class RegisterDomainDetailsServiceProxy: RegisterDomainDetailsServiceProxyProtoc
failure: failure)
}

func createPersistentDomainShoppingCart(siteID: Int,
func createPersistentDomainShoppingCart(siteID: Int?,
domainSuggestion: DomainSuggestion,
privacyProtectionEnabled: Bool,
success: @escaping (CartResponseProtocol) -> Void,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ class DomainSuggestionsTableViewController: UITableViewController {
weak var delegate: DomainSuggestionsTableViewControllerDelegate?
var domainSuggestionType: DomainsServiceRemote.DomainSuggestionType = .noWordpressDotCom
var domainSelectionType: DomainSelectionType?
var primaryDomainAddress: String = ""
var primaryDomainAddress: String?

var useFadedColorForParentDomains: Bool {
return false
Expand Down Expand Up @@ -287,7 +287,8 @@ extension DomainSuggestionsTableViewController {

private func topBannerCell() -> UITableViewCell {
let cell = UITableViewCell()
guard let textLabel = cell.textLabel else {
guard let textLabel = cell.textLabel,
let primaryDomainAddress else {
return cell
}

Expand Down Expand Up @@ -377,7 +378,8 @@ extension DomainSuggestionsTableViewController {
let attributedString = NSMutableAttributedString()

let hasDomainCredit = blog?.hasDomainCredit ?? false
let freeForFirstYear = hasDomainCredit || domainSelectionType == .purchaseWithPaidPlan
let supportsPlans = domainSelectionType == .purchaseWithPaidPlan || domainSelectionType == .purchaseFromDomainManagement
let freeForFirstYear = hasDomainCredit || supportsPlans

if freeForFirstYear {
attributedString.append(attributedFreeForTheFirstYear())
Expand Down
Loading