Skip to content

Commit

Permalink
Merge pull request #21979 from wordpress-mobile/task/21778-search-for…
Browse files Browse the repository at this point in the history
…-new-domain

Domain Management: Implement add new freestanding domain flow
  • Loading branch information
hassaanelgarem authored Nov 8, 2023
2 parents c2cedd3 + ac5cbec commit 0c8b031
Show file tree
Hide file tree
Showing 16 changed files with 367 additions and 168 deletions.
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: 5a6208e4373a98b208f7e59607508adb19f4eb5f
PODFILE CHECKSUM: 946b818d64b969f6bab98fbac41a475970efa079

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

0 comments on commit 0c8b031

Please sign in to comment.