Skip to content

Commit

Permalink
Merge 22.3.0.1 with editorialized release notes (wordpress-mobile#20634)
Browse files Browse the repository at this point in the history
  • Loading branch information
mokagio authored May 4, 2023
2 parents 88e8e7c + 676e103 commit e9c753c
Show file tree
Hide file tree
Showing 78 changed files with 626 additions and 463 deletions.
4 changes: 2 additions & 2 deletions Podfile
Original file line number Diff line number Diff line change
Expand Up @@ -216,7 +216,7 @@ abstract_target 'Apps' do

# Production

pod 'Automattic-Tracks-iOS', '~> 0.13'
pod 'Automattic-Tracks-iOS', '~> 2.2'
# While in PR
# pod 'Automattic-Tracks-iOS', git: 'https://github.com/Automattic/Automattic-Tracks-iOS.git', branch: ''
# Local Development
Expand Down Expand Up @@ -404,7 +404,7 @@ pre_install do |installer|
installer.pod_targets.each do |pod|
# Statically linking Sentry results in a conflict with `NSDictionary.objectAtKeyPath`, but dynamically
# linking it resolves this.
if pod.name == 'Sentry'
if %w[Sentry SentryPrivate].include? pod.name
dynamic << pod
next
end
Expand Down
27 changes: 16 additions & 11 deletions Podfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@ PODS:
- AppCenter/Core
- AppCenter/Distribute (4.4.1):
- AppCenter/Core
- Automattic-Tracks-iOS (0.13.0):
- Sentry (~> 7.25)
- Automattic-Tracks-iOS (2.2.0):
- Sentry (~> 8.0)
- Sodium (>= 0.9.1)
- UIDeviceIdentifier (~> 2.0)
- boost (1.76.0)
Expand Down Expand Up @@ -490,14 +490,17 @@ PODS:
- SDWebImageWebPCoder (0.8.5):
- libwebp (~> 1.0)
- SDWebImage/Core (~> 5.10)
- Sentry (7.27.0):
- Sentry/Core (= 7.27.0)
- Sentry/Core (7.27.0)
- Sentry (8.6.0):
- Sentry/Core (= 8.6.0)
- SentryPrivate (= 8.6.0)
- Sentry/Core (8.6.0):
- SentryPrivate (= 8.6.0)
- SentryPrivate (8.6.0)
- Sodium (0.9.1)
- Starscream (3.0.6)
- SVProgressHUD (2.2.5)
- SwiftLint (0.50.3)
- UIDeviceIdentifier (2.1.0)
- UIDeviceIdentifier (2.3.0)
- WordPress-Aztec-iOS (1.19.8)
- WordPress-Editor-iOS (1.19.8):
- WordPress-Aztec-iOS (= 1.19.8)
Expand Down Expand Up @@ -541,7 +544,7 @@ DEPENDENCIES:
- AlamofireNetworkActivityIndicator (~> 2.4)
- AppCenter (~> 4.1)
- AppCenter/Distribute (~> 4.1)
- Automattic-Tracks-iOS (~> 0.13)
- Automattic-Tracks-iOS (~> 2.2)
- boost (from `https://raw.githubusercontent.com/wordpress-mobile/gutenberg-mobile/v1.94.0/third-party-podspecs/boost.podspec.json`)
- BVLinearGradient (from `https://raw.githubusercontent.com/wordpress-mobile/gutenberg-mobile/v1.94.0/third-party-podspecs/BVLinearGradient.podspec.json`)
- CocoaLumberjack/Swift (~> 3.0)
Expand Down Expand Up @@ -651,6 +654,7 @@ SPEC REPOS:
- SDWebImage
- SDWebImageWebPCoder
- Sentry
- SentryPrivate
- Sodium
- Starscream
- SVProgressHUD
Expand Down Expand Up @@ -800,7 +804,7 @@ SPEC CHECKSUMS:
AlamofireNetworkActivityIndicator: 9acc3de3ca6645bf0efed462396b0df13dd3e7b8
AppAuth: e48b432bb4ba88b10cb2bcc50d7f3af21e78b9c2
AppCenter: b0b6f1190215b5f983c42934db718f3b46fff3c0
Automattic-Tracks-iOS: 63e55654f500b3e8fb35087e64575e00d12eb2f5
Automattic-Tracks-iOS: a1b020ab02f0e5a39c5d4e6870a498273f286158
boost: 32a63928ef0a5bf8b60f6b930c8864113fa28779
BVLinearGradient: 708898fab8f7113d927b0ef611a321e759f6ad3e
CocoaLumberjack: 78abfb691154e2a9df8ded4350d504ee19d90732
Expand Down Expand Up @@ -871,12 +875,13 @@ SPEC CHECKSUMS:
RNTAztecView: 80480c43423929f7e3b7012670787e7375fbac9c
SDWebImage: a7f831e1a65eb5e285e3fb046a23fcfbf08e696d
SDWebImageWebPCoder: 908b83b6adda48effe7667cd2b7f78c897e5111d
Sentry: 026b36fdc09531604db9279e55f047fe652e3f4a
Sentry: d80553ff85ea72def75b792aaa5a71c158e51595
SentryPrivate: ef1c5b3dfe44ec0c70e2eb343a5be2689164c021
Sodium: 23d11554ecd556196d313cf6130d406dfe7ac6da
Starscream: ef3ece99d765eeccb67de105bfa143f929026cf5
SVProgressHUD: 1428aafac632c1f86f62aa4243ec12008d7a51d6
SwiftLint: 77f7cb2b9bb81ab4a12fcc86448ba3f11afa50c6
UIDeviceIdentifier: e6a801d25f4f178de5bdf475ffe29050d0148176
UIDeviceIdentifier: 442b65b4ff1832d4ca9c2a157815cb29ad981b17
WordPress-Aztec-iOS: 7d11d598f14c82c727c08b56bd35fbeb7dafb504
WordPress-Editor-iOS: 9eb9f12f21a5209cb837908d81ffe1e31cb27345
WordPressAuthenticator: b0b900696de5129a215adcd1e9ae6eb89da36ac8
Expand All @@ -895,6 +900,6 @@ SPEC CHECKSUMS:
ZendeskSupportSDK: 3a8e508ab1d9dd22dc038df6c694466414e037ba
ZIPFoundation: ae5b4b813d216d3bf0a148773267fff14bd51d37

PODFILE CHECKSUM: d48e2c793016c27a80eba0bc3b3ccb30ee05ba6f
PODFILE CHECKSUM: ab88bd849ac377484fd7f0c4b079701ce16de5a3

COCOAPODS: 1.11.3
5 changes: 4 additions & 1 deletion WordPress/Classes/Services/SiteAddressService.swift
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,10 @@ final class DomainsServiceAdapter: SiteAddressService {

// MARK: Properties

private let domainPurchasingEnabled = FeatureFlag.siteCreationDomainPurchasing.enabled
/// Checks if the Domain Purchasing Feature Flag and AB Experiment are enabled
private var domainPurchasingEnabled: Bool {
FeatureFlag.siteCreationDomainPurchasing.enabled && ABTest.siteCreationDomainPurchasing.isTreatmentVariation
}

/**
Corresponds to:
Expand Down
22 changes: 16 additions & 6 deletions WordPress/Classes/Utility/AB Testing/ABTest.swift
Original file line number Diff line number Diff line change
Expand Up @@ -4,25 +4,35 @@ import AutomatticTracks
// Jetpack is not supported
enum ABTest: String, CaseIterable {
case unknown = "unknown"
case siteCreationDomainPurchasing = "jpios_site_creation_domain_purchasing_v1"

/// Returns a variation for the given experiment
var variation: Variation {
return ExPlat.shared?.experiment(self.rawValue) ?? .control
}

/// Flag indicating whether the experiment's variation is treament or not.
var isTreatmentVariation: Bool {
switch variation {
case .treatment, .customTreatment: return true
case .control: return false
}
}
}

extension ABTest {
/// Start the AB Testing platform if any experiment exists
///
static func start() {
guard ABTest.allCases.count > 1, AccountHelper.isLoggedIn,
AppConfiguration.isWordPress else {
guard ABTest.allCases.count > 1,
AccountHelper.isLoggedIn,
AppConfiguration.isJetpack,
let exPlat = ExPlat.shared
else {
return
}

let experimentNames = ABTest.allCases.filter { $0 != .unknown }.map { $0.rawValue }
ExPlat.shared?.register(experiments: experimentNames)

ExPlat.shared?.refresh()
exPlat.register(experiments: experimentNames)
exPlat.refresh()
}
}
Original file line number Diff line number Diff line change
@@ -1,6 +1,12 @@
import Foundation

extension WPAnalytics {

/// Checks if the Domain Purchasing Feature Flag and AB Experiment are enabled
private static var domainPurchasingEnabled: Bool {
FeatureFlag.siteCreationDomainPurchasing.enabled && ABTest.siteCreationDomainPurchasing.isTreatmentVariation
}

static func domainsProperties(for blog: Blog) -> [AnyHashable: Any] {
// For now we do not have the `siteCreation` route implemented so hardcoding `menu`
domainsProperties(usingCredit: blog.canRegisterDomainWithPaidPlan, origin: .menu)
Expand All @@ -11,7 +17,7 @@ extension WPAnalytics {
origin: DomainPurchaseWebViewViewOrigin?
) -> [AnyHashable: Any] {
var dict: [AnyHashable: Any] = ["using_credit": usingCredit.stringLiteral]
if FeatureFlag.siteCreationDomainPurchasing.enabled,
if Self.domainPurchasingEnabled,
let origin = origin {
dict["origin"] = origin.rawValue
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ - (instancetype)init
_contextManager = [TracksContextManager new];
_tracksService = [[TracksService alloc] initWithContextManager:_contextManager];
_tracksService.eventNamePrefix = AppConstants.eventNamePrefix;
_tracksService.platform = AppConstants.explatPlatform;
}
return self;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ import WordPressAuthenticator
static let shareAppName: ShareAppName = .wordpress
static let mobileAnnounceAppId = "2"
@objc static let eventNamePrefix = "wpios"
@objc static let explatPlatform = "wpios"
@objc static let authKeychainServiceName = "public-api.wordpress.com"

/// Notifications Constants
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ extension BlogListViewController {
return
}
self.present(wizard, animated: true)
WPAnalytics.track(.enhancedSiteCreationAccessed, withProperties: ["source": source])
SiteCreationAnalyticsHelper.trackSiteCreationAccessed(source: source)
})
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -734,7 +734,7 @@ class MySiteViewController: UIViewController, NoResultsViewHost {
return
}
self.present(wizard, animated: true)
WPAnalytics.track(.enhancedSiteCreationAccessed, withProperties: ["source": source])
SiteCreationAnalyticsHelper.trackSiteCreationAccessed(source: source)
})
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -395,7 +395,7 @@ extension WordPressAuthenticationManager: WordPressAuthenticatorDelegate {
}

navigationController.present(wizard, animated: true)
WPAnalytics.track(.enhancedSiteCreationAccessed, withProperties: ["source": source])
SiteCreationAnalyticsHelper.trackSiteCreationAccessed(source: source)
})
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,7 @@ final class SiteAssemblyContentView: UIView {
label.font = WPStyleGuide.fontForTextStyle(.title1, fontWeight: .bold)
label.textColor = .text

if FeatureFlag.siteCreationDomainPurchasing.enabled {
if siteCreator.domainPurchasingEnabled {
label.textAlignment = .natural
} else {
label.textAlignment = .center
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -159,12 +159,17 @@ final class SiteAssemblyWizardContent: UIViewController {
case .success(let domain):
self.contentView.siteName = domain
self.contentView.isFreeDomain = false
case .failure:
self.contentView.status = .succeeded
case .failure(let error):
self.contentView.isFreeDomain = true
// TODO: We should discuss how to handle domain purchasing errors
break
switch error {
case .unsupportedRedirect, .internal, .invalidInput, .other:
self.installDomainCheckoutErrorStateViewController(domain: domain, site: site)
self.contentView.status = .failed
case .canceled:
self.contentView.status = .succeeded
}
}
self.contentView.status = .succeeded
}
}

Expand All @@ -185,30 +190,63 @@ final class SiteAssemblyWizardContent: UIViewController {
private func installErrorStateViewController(with type: ErrorStateViewType) {
var configuration = ErrorStateViewConfiguration.configuration(type: type)

configuration.contactSupportActionHandler = { [weak self] in
configuration.retryActionHandler = { [weak self] in
guard let self = self else {
return
}
self.contactSupportTapped()
self.retryTapped()
}

self.installErrorStateViewController(with: configuration)
}

private func installDomainCheckoutErrorStateViewController(domain: DomainSuggestion, site: Blog) {
var configuration = ErrorStateViewConfiguration.configuration(type: .domainCheckoutFailed)

configuration.retryActionHandler = { [weak self] in
guard let self = self else {
guard let self else {
return
}
self.retryTapped()
self.contentView.status = .inProgress
self.attemptDomainPurchasing(domain: domain, site: site)
}

configuration.dismissalActionHandler = { [weak self] in
guard let self = self else {
return
self.installErrorStateViewController(with: configuration)
}

private func installErrorStateViewController(with configuration: ErrorStateViewConfiguration) {
var configuration = configuration

if configuration.contactSupportActionHandler == nil {
configuration.contactSupportActionHandler = { [weak self] in
guard let self = self else {
return
}
self.contactSupportTapped()
}
self.dismissTapped()
}

if configuration.dismissalActionHandler == nil {
configuration.dismissalActionHandler = { [weak self] in
guard let self = self else {
return
}
self.dismissTapped()
}
}

// Remove previous error state view controller
if let errorStateViewController {
errorStateViewController.willMove(toParent: nil)
errorStateViewController.view?.removeFromSuperview()
errorStateViewController.removeFromParent()
errorStateViewController.didMove(toParent: nil)
}

// Install new error state view controller
let errorStateViewController = ErrorStateViewController(with: configuration)

contentView.errorStateView = errorStateViewController.view
self.contentView.errorStateView = errorStateViewController.view

errorStateViewController.willMove(toParent: self)
addChild(errorStateViewController)
Expand All @@ -223,9 +261,8 @@ final class SiteAssemblyWizardContent: UIViewController {
private extension SiteAssemblyWizardContent {
func contactSupportTapped() {
// TODO : capture analytics event via #10335

let supportVC = SupportTableViewController()
supportVC.showFromTabBar()
supportVC.show(from: self)
}

func dismissTapped(viaDone: Bool = false, completion: (() -> Void)? = nil) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ enum ErrorStateViewType {
case general
case networkUnreachable
case siteLoading
case domainCheckoutFailed
}

// MARK: ErrorViewConfiguration
Expand Down Expand Up @@ -53,7 +54,7 @@ struct ErrorStateViewConfiguration {
extension ErrorStateViewType {
var localizedTitle: String {
switch self {
case .general, .siteLoading:
case .general, .siteLoading, .domainCheckoutFailed:
return NSLocalizedString("There was a problem",
comment: "This primary message message is displayed if a user encounters a general error.")
case .networkUnreachable:
Expand All @@ -69,6 +70,12 @@ extension ErrorStateViewType {
comment: "This secondary message is displayed if a user encounters a general error.")
case .networkUnreachable:
return nil
case .domainCheckoutFailed:
return NSLocalizedString(
"site.creation.assembly.step.domain.checkout.error.subtitle",
value: "Your website has been created successfully, but we encountered an issue while preparing your custom domain for checkout. Please try again or contact support for assistance.",
comment: "The error message to show in the 'Site Creation > Assembly Step' when the domain checkout fails for unknown reasons."
)
}
}
}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
import Foundation

enum SiteCreationAnalyticsEvent: String {
case domainPurchasingExperiment = "site_creation_domain_purchasing_experiment"
}
Loading

0 comments on commit e9c753c

Please sign in to comment.