From 9581f2a4e5fe0b128422f0728862cc36cd2638fb Mon Sep 17 00:00:00 2001 From: Jaclyn Chen Date: Tue, 22 Nov 2022 15:41:27 +0800 Subject: [PATCH 1/4] Rename `RemoveAppleID*` to `CloseAccount*`. --- .../Epilogue/EmptyStoresTableViewCell.swift | 18 ++++++------ .../Epilogue/EmptyStoresTableViewCell.xib | 18 ++++++------ .../Epilogue/StorePickerViewController.swift | 20 +++++++------ ...or.swift => CloseAccountCoordinator.swift} | 16 +++++------ .../Settings/SettingsViewController.swift | 28 +++++++++---------- .../Settings/Settings/SettingsViewModel.swift | 8 +++--- .../WooCommerce.xcodeproj/project.pbxproj | 16 +++++------ ...ift => CloseAccountCoordinatorTests.swift} | 4 +-- .../Settings/SettingsViewModelTests.swift | 10 +++---- 9 files changed, 69 insertions(+), 69 deletions(-) rename WooCommerce/Classes/ViewRelated/Dashboard/Settings/{RemoveAppleIDAccessCoordinator.swift => CloseAccountCoordinator.swift} (94%) rename WooCommerce/WooCommerceTests/ViewRelated/Settings/{RemoveAppleIDAccessCoordinatorTests.swift => CloseAccountCoordinatorTests.swift} (88%) diff --git a/WooCommerce/Classes/Authentication/Epilogue/EmptyStoresTableViewCell.swift b/WooCommerce/Classes/Authentication/Epilogue/EmptyStoresTableViewCell.swift index d4fdf58fab5..8eaa27deee2 100644 --- a/WooCommerce/Classes/Authentication/Epilogue/EmptyStoresTableViewCell.swift +++ b/WooCommerce/Classes/Authentication/Epilogue/EmptyStoresTableViewCell.swift @@ -28,19 +28,19 @@ final class EmptyStoresTableViewCell: UITableViewCell { @IBOutlet private weak var stackView: UIStackView! @IBOutlet private weak var emptyStoresImageView: UIImageView! - @IBOutlet private weak var removeAppleIDAccessButton: UIButton! + @IBOutlet private weak var closeAccountButton: UIButton! override func awakeFromNib() { super.awakeFromNib() configureStackView() configureImageView() - configureRemoveAppleIDAccessButton() - updateRemoveAppleIDAccessButtonVisibility(isVisible: false) + configureCloseAccountButton() + updateCloseAccountButtonVisibility(isVisible: false) } - func updateRemoveAppleIDAccessButtonVisibility(isVisible: Bool) { - removeAppleIDAccessButton.isHidden = !isVisible + func updateCloseAccountButtonVisibility(isVisible: Bool) { + closeAccountButton.isHidden = !isVisible } } @@ -57,10 +57,10 @@ private extension EmptyStoresTableViewCell { emptyStoresImageView.image = .emptyStorePickerImage } - func configureRemoveAppleIDAccessButton() { - removeAppleIDAccessButton.applyLinkButtonStyle() - removeAppleIDAccessButton.setTitle(Localization.closeAccountTitle, for: .normal) - removeAppleIDAccessButton.on(.touchUpInside) { [weak self] _ in + func configureCloseAccountButton() { + closeAccountButton.applyLinkButtonStyle() + closeAccountButton.setTitle(Localization.closeAccountTitle, for: .normal) + closeAccountButton.on(.touchUpInside) { [weak self] _ in self?.onCloseAccountButtonTapped?() } } diff --git a/WooCommerce/Classes/Authentication/Epilogue/EmptyStoresTableViewCell.xib b/WooCommerce/Classes/Authentication/Epilogue/EmptyStoresTableViewCell.xib index 396c0d8587b..ab8399e25f2 100644 --- a/WooCommerce/Classes/Authentication/Epilogue/EmptyStoresTableViewCell.xib +++ b/WooCommerce/Classes/Authentication/Epilogue/EmptyStoresTableViewCell.xib @@ -1,9 +1,7 @@ - - + - - + @@ -20,19 +18,19 @@ - + - + @@ -57,9 +55,9 @@ + - diff --git a/WooCommerce/Classes/Authentication/Epilogue/StorePickerViewController.swift b/WooCommerce/Classes/Authentication/Epilogue/StorePickerViewController.swift index 348fa6a739f..021eaa02834 100644 --- a/WooCommerce/Classes/Authentication/Epilogue/StorePickerViewController.swift +++ b/WooCommerce/Classes/Authentication/Epilogue/StorePickerViewController.swift @@ -155,10 +155,10 @@ final class StorePickerViewController: UIViewController { } } - private lazy var removeAppleIDAccessCoordinator: RemoveAppleIDAccessCoordinator = - RemoveAppleIDAccessCoordinator(sourceViewController: self) { [weak self] in - guard let self = self else { return .failure(RemoveAppleIDAccessError.presenterDeallocated) } - return await self.removeAppleIDAccess() + private lazy var closeAccountCoordinator: CloseAccountCoordinator = + CloseAccountCoordinator(sourceViewController: self) { [weak self] in + guard let self = self else { return .failure(CloseAccountError.presenterDeallocated) } + return await self.closeAccount() } onRemoveSuccess: { [weak self] in self?.restartAuthentication() } @@ -679,13 +679,15 @@ extension StorePickerViewController: UITableViewDataSource { guard let site = viewModel.site(at: indexPath) else { hideActionButton() let cell = tableView.dequeueReusableCell(EmptyStoresTableViewCell.self, for: indexPath) - let isRemoveAppleIDAccessButtonVisible = appleIDCredentialChecker.hasAppleUserID() - cell.updateRemoveAppleIDAccessButtonVisibility(isVisible: isRemoveAppleIDAccessButtonVisible) - if isRemoveAppleIDAccessButtonVisible { + let isCloseAccountButtonVisible = appleIDCredentialChecker.hasAppleUserID() + || featureFlagService.isFeatureFlagEnabled(.storeCreationMVP) + || featureFlagService.isFeatureFlagEnabled(.storeCreationM2) + cell.updateCloseAccountButtonVisibility(isVisible: isCloseAccountButtonVisible) + if isCloseAccountButtonVisible { cell.onCloseAccountButtonTapped = { [weak self] in guard let self = self else { return } ServiceLocator.analytics.track(event: .closeAccountTapped(source: .emptyStores)) - self.removeAppleIDAccessCoordinator.start() + self.closeAccountCoordinator.start() } } return cell @@ -758,7 +760,7 @@ extension StorePickerViewController: UITableViewDelegate { } private extension StorePickerViewController { - func removeAppleIDAccess() async -> Result { + func closeAccount() async -> Result { await withCheckedContinuation { [weak self] continuation in guard let self = self else { return } let action = AccountAction.closeAccount { result in diff --git a/WooCommerce/Classes/ViewRelated/Dashboard/Settings/RemoveAppleIDAccessCoordinator.swift b/WooCommerce/Classes/ViewRelated/Dashboard/Settings/CloseAccountCoordinator.swift similarity index 94% rename from WooCommerce/Classes/ViewRelated/Dashboard/Settings/RemoveAppleIDAccessCoordinator.swift rename to WooCommerce/Classes/ViewRelated/Dashboard/Settings/CloseAccountCoordinator.swift index 536e09177be..b7f31ea1157 100644 --- a/WooCommerce/Classes/ViewRelated/Dashboard/Settings/RemoveAppleIDAccessCoordinator.swift +++ b/WooCommerce/Classes/ViewRelated/Dashboard/Settings/CloseAccountCoordinator.swift @@ -1,8 +1,8 @@ import UIKit import protocol Yosemite.StoresManager -/// Coordinates navigation for removing Apple ID access from various entry points (settings and empty stores screens). -@MainActor final class RemoveAppleIDAccessCoordinator { +/// Coordinates navigation for closing a WPCOM account from various entry points (settings and empty stores screens). +@MainActor final class CloseAccountCoordinator { private let sourceViewController: UIViewController private let removeAction: () async -> Result private let onRemoveSuccess: () -> Void @@ -30,7 +30,7 @@ import protocol Yosemite.StoresManager } } -private extension RemoveAppleIDAccessCoordinator { +private extension CloseAccountCoordinator { func presentConfirmationAlert() { // TODO: 7068 - analytics @@ -81,7 +81,7 @@ private extension RemoveAppleIDAccessCoordinator { } func presentInProgressUI() { - let viewProperties = InProgressViewProperties(title: Localization.RemoveAppleIDAccessInProgressView.title, message: "") + let viewProperties = InProgressViewProperties(title: Localization.InProgressView.title, message: "") let inProgressViewController = InProgressViewController(viewProperties: viewProperties) inProgressViewController.modalPresentationStyle = .overFullScreen sourceViewController.present(inProgressViewController, animated: true) @@ -135,9 +135,9 @@ private extension RemoveAppleIDAccessCoordinator { } } -private extension RemoveAppleIDAccessCoordinator { +private extension CloseAccountCoordinator { enum Localization { - enum RemoveAppleIDAccessInProgressView { + enum InProgressView { static let title = NSLocalizedString( "Closing account...", comment: "Title of the Close Account in-progress view." @@ -181,12 +181,12 @@ private extension RemoveAppleIDAccessCoordinator { } } -private extension RemoveAppleIDAccessCoordinator { +private extension CloseAccountCoordinator { enum Constants { static let dotcomAPIErrorCodeKey = "WordPressComRestApiErrorCodeKey" } } -enum RemoveAppleIDAccessError: Error { +enum CloseAccountError: Error { case presenterDeallocated } diff --git a/WooCommerce/Classes/ViewRelated/Dashboard/Settings/Settings/SettingsViewController.swift b/WooCommerce/Classes/ViewRelated/Dashboard/Settings/Settings/SettingsViewController.swift index 0bb75dd7bb3..caf7db8bef2 100644 --- a/WooCommerce/Classes/ViewRelated/Dashboard/Settings/Settings/SettingsViewController.swift +++ b/WooCommerce/Classes/ViewRelated/Dashboard/Settings/Settings/SettingsViewController.swift @@ -29,10 +29,10 @@ final class SettingsViewController: UIViewController { /// private var storePickerCoordinator: StorePickerCoordinator? - private lazy var removeAppleIDAccessCoordinator: RemoveAppleIDAccessCoordinator = - RemoveAppleIDAccessCoordinator(sourceViewController: self) { [weak self] in - guard let self = self else { return .failure(RemoveAppleIDAccessError.presenterDeallocated) } - return await self.removeAppleIDAccess() + private lazy var closeAccountCoordinator: CloseAccountCoordinator = + CloseAccountCoordinator(sourceViewController: self) { [weak self] in + guard let self = self else { return .failure(CloseAccountError.presenterDeallocated) } + return await self.closeAccount() } onRemoveSuccess: { [weak self] in self?.logOutUser() } @@ -154,8 +154,8 @@ private extension SettingsViewController { configureAppSettings(cell: cell) case let cell as BasicTableViewCell where row == .wormholy: configureWormholy(cell: cell) - case let cell as BasicTableViewCell where row == .removeAppleIDAccess: - configureRemoveAppleIDAccess(cell: cell) + case let cell as BasicTableViewCell where row == .closeAccount: + configureCloseAccount(cell: cell) case let cell as BasicTableViewCell where row == .logout: configureLogout(cell: cell) default: @@ -249,7 +249,7 @@ private extension SettingsViewController { cell.textLabel?.text = Localization.whatsNew } - func configureRemoveAppleIDAccess(cell: BasicTableViewCell) { + func configureCloseAccount(cell: BasicTableViewCell) { cell.selectionStyle = .default cell.textLabel?.textAlignment = .center cell.textLabel?.textColor = .error @@ -279,12 +279,12 @@ private extension SettingsViewController { // MARK: - Actions // private extension SettingsViewController { - func removeAppleIDAccessWasPressed() { + func closeAccountWasPressed() { ServiceLocator.analytics.track(event: .closeAccountTapped(source: .settings)) - removeAppleIDAccessCoordinator.start() + closeAccountCoordinator.start() } - func removeAppleIDAccess() async -> Result { + func closeAccount() async -> Result { await withCheckedContinuation { [weak self] continuation in guard let self = self else { return } let action = AccountAction.closeAccount { result in @@ -542,8 +542,8 @@ extension SettingsViewController: UITableViewDelegate { wormholyWasPressed() case .whatsNew: whatsNewWasPressed() - case .removeAppleIDAccess: - removeAppleIDAccessWasPressed() + case .closeAccount: + closeAccountWasPressed() case .logout: logoutWasPressed() default: @@ -621,7 +621,7 @@ extension SettingsViewController { case wormholy // Account deletion - case removeAppleIDAccess + case closeAccount // Logout case logout @@ -651,7 +651,7 @@ extension SettingsViewController { return HostingTableViewCell.self case .installJetpack: return BasicTableViewCell.self - case .logout, .removeAppleIDAccess: + case .logout, .closeAccount: return BasicTableViewCell.self case .privacy: return BasicTableViewCell.self diff --git a/WooCommerce/Classes/ViewRelated/Dashboard/Settings/Settings/SettingsViewModel.swift b/WooCommerce/Classes/ViewRelated/Dashboard/Settings/Settings/SettingsViewModel.swift index cf5cac4d8cf..e1200b161d8 100644 --- a/WooCommerce/Classes/ViewRelated/Dashboard/Settings/Settings/SettingsViewModel.swift +++ b/WooCommerce/Classes/ViewRelated/Dashboard/Settings/Settings/SettingsViewModel.swift @@ -277,13 +277,13 @@ private extension SettingsViewModel { footerHeight: CGFloat.leastNonzeroMagnitude) }() - // Remove Apple ID Access - let removeAppleIDAccessSection: Section? = { + // Close account + let closeAccountSection: Section? = { guard appleIDCredentialChecker.hasAppleUserID() else { return nil } return Section(title: nil, - rows: [.removeAppleIDAccess], + rows: [.closeAccount], footerHeight: CGFloat.leastNonzeroMagnitude) }() @@ -299,7 +299,7 @@ private extension SettingsViewModel { appSettingsSection, aboutTheAppSection, otherSection, - removeAppleIDAccessSection, + closeAccountSection, logoutSection ] .compactMap { $0 } diff --git a/WooCommerce/WooCommerce.xcodeproj/project.pbxproj b/WooCommerce/WooCommerce.xcodeproj/project.pbxproj index 20aff889f70..571a094e510 100644 --- a/WooCommerce/WooCommerce.xcodeproj/project.pbxproj +++ b/WooCommerce/WooCommerce.xcodeproj/project.pbxproj @@ -329,7 +329,7 @@ 02A9A496244D84AB00757B99 /* ProductsSortOrderBottomSheetListSelectorCommandTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 02A9A495244D84AB00757B99 /* ProductsSortOrderBottomSheetListSelectorCommandTests.swift */; }; 02A9BCD42737DE0D00159C79 /* JetpackBenefitsView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 02A9BCD32737DE0D00159C79 /* JetpackBenefitsView.swift */; }; 02A9BCD62737F73C00159C79 /* JetpackBenefitItem.swift in Sources */ = {isa = PBXBuildFile; fileRef = 02A9BCD52737F73C00159C79 /* JetpackBenefitItem.swift */; }; - 02AA586628531D0E0068B6F0 /* RemoveAppleIDAccessCoordinatorTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 02AA586528531D0E0068B6F0 /* RemoveAppleIDAccessCoordinatorTests.swift */; }; + 02AA586628531D0E0068B6F0 /* CloseAccountCoordinatorTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 02AA586528531D0E0068B6F0 /* CloseAccountCoordinatorTests.swift */; }; 02AAD54525023A8300BA1E26 /* ProductFormRemoteActionUseCase.swift in Sources */ = {isa = PBXBuildFile; fileRef = 02AAD54425023A8300BA1E26 /* ProductFormRemoteActionUseCase.swift */; }; 02AB407B27827C9100929CF3 /* ChartPlaceholderView.xib in Resources */ = {isa = PBXBuildFile; fileRef = 02AB407927827C9000929CF3 /* ChartPlaceholderView.xib */; }; 02AB407C27827C9100929CF3 /* ChartPlaceholderView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 02AB407A27827C9100929CF3 /* ChartPlaceholderView.swift */; }; @@ -338,7 +338,7 @@ 02AB82ED27069D5D008D7334 /* Experiments.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = 02AB82EB27069D5D008D7334 /* Experiments.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; }; 02AC30CF2888EC8100146A25 /* WooAnalyticsEvent+LoginOnboarding.swift in Sources */ = {isa = PBXBuildFile; fileRef = 02AC30CE2888EC8100146A25 /* WooAnalyticsEvent+LoginOnboarding.swift */; }; 02AC822C2498BC9700A615FB /* ProductFormViewModel+UpdatesTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 02AC822B2498BC9700A615FB /* ProductFormViewModel+UpdatesTests.swift */; }; - 02ACD25A2852E11700EC928E /* RemoveAppleIDAccessCoordinator.swift in Sources */ = {isa = PBXBuildFile; fileRef = 02ACD2592852E11700EC928E /* RemoveAppleIDAccessCoordinator.swift */; }; + 02ACD25A2852E11700EC928E /* CloseAccountCoordinator.swift in Sources */ = {isa = PBXBuildFile; fileRef = 02ACD2592852E11700EC928E /* CloseAccountCoordinator.swift */; }; 02ADC7CC239762E0008D4BED /* PaginatedListSelectorViewProperties.swift in Sources */ = {isa = PBXBuildFile; fileRef = 02ADC7CB239762E0008D4BED /* PaginatedListSelectorViewProperties.swift */; }; 02ADC7CE23978EAA008D4BED /* PaginatedProductShippingClassListSelectorDataSourceTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 02ADC7CD23978EAA008D4BED /* PaginatedProductShippingClassListSelectorDataSourceTests.swift */; }; 02B1AFEC24BC5AE5005DB1E3 /* LinkedProductListSelectorDataSource.swift in Sources */ = {isa = PBXBuildFile; fileRef = 02B1AFEB24BC5AE5005DB1E3 /* LinkedProductListSelectorDataSource.swift */; }; @@ -2297,7 +2297,7 @@ 02A9A495244D84AB00757B99 /* ProductsSortOrderBottomSheetListSelectorCommandTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ProductsSortOrderBottomSheetListSelectorCommandTests.swift; sourceTree = ""; }; 02A9BCD32737DE0D00159C79 /* JetpackBenefitsView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = JetpackBenefitsView.swift; sourceTree = ""; }; 02A9BCD52737F73C00159C79 /* JetpackBenefitItem.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = JetpackBenefitItem.swift; sourceTree = ""; }; - 02AA586528531D0E0068B6F0 /* RemoveAppleIDAccessCoordinatorTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = RemoveAppleIDAccessCoordinatorTests.swift; sourceTree = ""; }; + 02AA586528531D0E0068B6F0 /* CloseAccountCoordinatorTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CloseAccountCoordinatorTests.swift; sourceTree = ""; }; 02AAD54425023A8300BA1E26 /* ProductFormRemoteActionUseCase.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ProductFormRemoteActionUseCase.swift; sourceTree = ""; }; 02AB407927827C9000929CF3 /* ChartPlaceholderView.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; path = ChartPlaceholderView.xib; sourceTree = ""; }; 02AB407A27827C9100929CF3 /* ChartPlaceholderView.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ChartPlaceholderView.swift; sourceTree = ""; }; @@ -2305,7 +2305,7 @@ 02AB82EB27069D5D008D7334 /* Experiments.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; path = Experiments.framework; sourceTree = BUILT_PRODUCTS_DIR; }; 02AC30CE2888EC8100146A25 /* WooAnalyticsEvent+LoginOnboarding.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "WooAnalyticsEvent+LoginOnboarding.swift"; sourceTree = ""; }; 02AC822B2498BC9700A615FB /* ProductFormViewModel+UpdatesTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "ProductFormViewModel+UpdatesTests.swift"; sourceTree = ""; }; - 02ACD2592852E11700EC928E /* RemoveAppleIDAccessCoordinator.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = RemoveAppleIDAccessCoordinator.swift; sourceTree = ""; }; + 02ACD2592852E11700EC928E /* CloseAccountCoordinator.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CloseAccountCoordinator.swift; sourceTree = ""; }; 02ADC7CB239762E0008D4BED /* PaginatedListSelectorViewProperties.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PaginatedListSelectorViewProperties.swift; sourceTree = ""; }; 02ADC7CD23978EAA008D4BED /* PaginatedProductShippingClassListSelectorDataSourceTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PaginatedProductShippingClassListSelectorDataSourceTests.swift; sourceTree = ""; }; 02B1AFEB24BC5AE5005DB1E3 /* LinkedProductListSelectorDataSource.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = LinkedProductListSelectorDataSource.swift; sourceTree = ""; }; @@ -7392,7 +7392,7 @@ isa = PBXGroup; children = ( BAFEF51D273C2151005F94CC /* SettingsViewModelTests.swift */, - 02AA586528531D0E0068B6F0 /* RemoveAppleIDAccessCoordinatorTests.swift */, + 02AA586528531D0E0068B6F0 /* CloseAccountCoordinatorTests.swift */, ); path = Settings; sourceTree = ""; @@ -8072,7 +8072,7 @@ CE85FD5820F7A59E0080B73E /* Settings */ = { isa = PBXGroup; children = ( - 02ACD2592852E11700EC928E /* RemoveAppleIDAccessCoordinator.swift */, + 02ACD2592852E11700EC928E /* CloseAccountCoordinator.swift */, 0239305F2918F35600B2632F /* Domains */, BAF1B3B32736595A00BA11DC /* Settings */, DE8C9464264698E800C94823 /* Plugins */, @@ -9802,7 +9802,7 @@ DE2FE5882925DD950018040A /* JetpackInstallHeaderView.swift in Sources */, B59D49CD219B587E006BF0AD /* UILabel+OrderStatus.swift in Sources */, 265BCA0C2430E741004E53EE /* ProductCategoryTableViewCell.swift in Sources */, - 02ACD25A2852E11700EC928E /* RemoveAppleIDAccessCoordinator.swift in Sources */, + 02ACD25A2852E11700EC928E /* CloseAccountCoordinator.swift in Sources */, 036CA6F129229C9E00E4DF4F /* IndefiniteCircularProgressViewStyle.swift in Sources */, 451A9973260E39270059D135 /* ShippingLabelPackageNumberRow.swift in Sources */, AEE2610F26E664CE00B142A0 /* EditOrderAddressFormViewModel.swift in Sources */, @@ -11015,7 +11015,7 @@ B57C5C9A21B80E7100FF82B2 /* DataWooTests.swift in Sources */, B53A56A42112483E000776C9 /* Constants.swift in Sources */, 2667BFE72530E78F008099D4 /* RefundItemsValuesCalculationUseCaseTests.swift in Sources */, - 02AA586628531D0E0068B6F0 /* RemoveAppleIDAccessCoordinatorTests.swift in Sources */, + 02AA586628531D0E0068B6F0 /* CloseAccountCoordinatorTests.swift in Sources */, E12AF69B26BA8B2000C371C1 /* CardPresentPaymentsOnboardingUseCaseTests.swift in Sources */, D802549B265531D4001B2CC1 /* CardPresentModalConnectingToReaderTests.swift in Sources */, 4572641B27F1FDF2004E1F95 /* AddEditCouponViewModelTests.swift in Sources */, diff --git a/WooCommerce/WooCommerceTests/ViewRelated/Settings/RemoveAppleIDAccessCoordinatorTests.swift b/WooCommerce/WooCommerceTests/ViewRelated/Settings/CloseAccountCoordinatorTests.swift similarity index 88% rename from WooCommerce/WooCommerceTests/ViewRelated/Settings/RemoveAppleIDAccessCoordinatorTests.swift rename to WooCommerce/WooCommerceTests/ViewRelated/Settings/CloseAccountCoordinatorTests.swift index 0c8644ea6ce..b101749aac6 100644 --- a/WooCommerce/WooCommerceTests/ViewRelated/Settings/RemoveAppleIDAccessCoordinatorTests.swift +++ b/WooCommerce/WooCommerceTests/ViewRelated/Settings/CloseAccountCoordinatorTests.swift @@ -2,7 +2,7 @@ import XCTest @testable import WooCommerce import TestKit -final class RemoveAppleIDAccessCoordinatorTests: XCTestCase { +final class CloseAccountCoordinatorTests: XCTestCase { private var sourceViewController: UIViewController! private var window: UIWindow? @@ -30,7 +30,7 @@ final class RemoveAppleIDAccessCoordinatorTests: XCTestCase { @MainActor func test_alert_is_presented_when_starting_coordinator() throws { // Given - let coordinator = RemoveAppleIDAccessCoordinator(sourceViewController: sourceViewController) { + let coordinator = CloseAccountCoordinator(sourceViewController: sourceViewController) { return .success(()) } onRemoveSuccess: {} diff --git a/WooCommerce/WooCommerceTests/ViewRelated/Settings/SettingsViewModelTests.swift b/WooCommerce/WooCommerceTests/ViewRelated/Settings/SettingsViewModelTests.swift index 7ffc29b3431..dcbaecc491c 100644 --- a/WooCommerce/WooCommerceTests/ViewRelated/Settings/SettingsViewModelTests.swift +++ b/WooCommerce/WooCommerceTests/ViewRelated/Settings/SettingsViewModelTests.swift @@ -136,9 +136,9 @@ final class SettingsViewModelTests: XCTestCase { XCTAssertFalse(viewModel.sections.contains { $0.rows.contains(SettingsViewController.Row.installJetpack) }) } - // MARK: - `removeAppleIDAccess` row visibility + // MARK: - `closeAccount` row visibility - func test_removeAppleIDAccess_section_is_shown_when_user_apple_id_exists() { + func test_closeAccount_section_is_shown_when_user_apple_id_exists() { // Given let appleIDCredentialChecker = MockAppleIDCredentialChecker(hasAppleUserID: true) let viewModel = SettingsViewModel(stores: stores, @@ -149,10 +149,10 @@ final class SettingsViewModelTests: XCTestCase { viewModel.onViewDidLoad() // Then - XCTAssertTrue(viewModel.sections.contains { $0.rows.contains(SettingsViewController.Row.removeAppleIDAccess) }) + XCTAssertTrue(viewModel.sections.contains { $0.rows.contains(SettingsViewController.Row.closeAccount) }) } - func test_removeAppleIDAccess_section_is_not_shown_when_user_apple_id_does_not_exist() { + func test_closeAccount_section_is_hidden_when_apple_id_does_not_exist_and_store_creation_features_disabled() { // Given let appleIDCredentialChecker = MockAppleIDCredentialChecker(hasAppleUserID: false) let viewModel = SettingsViewModel(stores: stores, @@ -163,7 +163,7 @@ final class SettingsViewModelTests: XCTestCase { viewModel.onViewDidLoad() // Then - XCTAssertFalse(viewModel.sections.contains { $0.rows.contains(SettingsViewController.Row.removeAppleIDAccess) }) + XCTAssertFalse(viewModel.sections.contains { $0.rows.contains(SettingsViewController.Row.closeAccount) }) } } From 79809b5d3976641cdbb5093a2a838cc650b056e9 Mon Sep 17 00:00:00 2001 From: Jaclyn Chen Date: Tue, 22 Nov 2022 15:43:09 +0800 Subject: [PATCH 2/4] Show close account CTA when store creation is enabled. --- .../Dashboard/Settings/Settings/SettingsViewModel.swift | 4 +++- .../ViewRelated/Settings/SettingsViewModelTests.swift | 2 ++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/WooCommerce/Classes/ViewRelated/Dashboard/Settings/Settings/SettingsViewModel.swift b/WooCommerce/Classes/ViewRelated/Dashboard/Settings/Settings/SettingsViewModel.swift index e1200b161d8..6d04a9be840 100644 --- a/WooCommerce/Classes/ViewRelated/Dashboard/Settings/Settings/SettingsViewModel.swift +++ b/WooCommerce/Classes/ViewRelated/Dashboard/Settings/Settings/SettingsViewModel.swift @@ -279,7 +279,9 @@ private extension SettingsViewModel { // Close account let closeAccountSection: Section? = { - guard appleIDCredentialChecker.hasAppleUserID() else { + guard appleIDCredentialChecker.hasAppleUserID() + || featureFlagService.isFeatureFlagEnabled(.storeCreationMVP) + || featureFlagService.isFeatureFlagEnabled(.storeCreationM2) else { return nil } return Section(title: nil, diff --git a/WooCommerce/WooCommerceTests/ViewRelated/Settings/SettingsViewModelTests.swift b/WooCommerce/WooCommerceTests/ViewRelated/Settings/SettingsViewModelTests.swift index dcbaecc491c..2c7b033c243 100644 --- a/WooCommerce/WooCommerceTests/ViewRelated/Settings/SettingsViewModelTests.swift +++ b/WooCommerce/WooCommerceTests/ViewRelated/Settings/SettingsViewModelTests.swift @@ -155,8 +155,10 @@ final class SettingsViewModelTests: XCTestCase { func test_closeAccount_section_is_hidden_when_apple_id_does_not_exist_and_store_creation_features_disabled() { // Given let appleIDCredentialChecker = MockAppleIDCredentialChecker(hasAppleUserID: false) + let featureFlagService = MockFeatureFlagService(isStoreCreationMVPEnabled: false, isStoreCreationM2Enabled: false) let viewModel = SettingsViewModel(stores: stores, storageManager: storageManager, + featureFlagService: featureFlagService, appleIDCredentialChecker: appleIDCredentialChecker) // When From fa88f1ddbb6e9e8415555bcb15753f2d2e2ead1e Mon Sep 17 00:00:00 2001 From: Jaclyn Chen Date: Thu, 24 Nov 2022 09:48:43 +0800 Subject: [PATCH 3/4] Update release notes. --- RELEASE-NOTES.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/RELEASE-NOTES.txt b/RELEASE-NOTES.txt index c42de2ab117..9747f52debb 100644 --- a/RELEASE-NOTES.txt +++ b/RELEASE-NOTES.txt @@ -2,7 +2,7 @@ 11.4 ----- - +- [*] Account deletion is now supported for all users in settings or in the empty stores screen. [https://github.com/woocommerce/woocommerce-ios/pull/8179] 11.3 ----- From 028a36af4bb84c01aacba4b6cd071dc05faf1295 Mon Sep 17 00:00:00 2001 From: Jaclyn Chen Date: Wed, 30 Nov 2022 10:34:24 +0800 Subject: [PATCH 4/4] Move the release entry to 11.5 release. --- RELEASE-NOTES.txt | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/RELEASE-NOTES.txt b/RELEASE-NOTES.txt index 351901b75d7..16a39dae0b8 100644 --- a/RELEASE-NOTES.txt +++ b/RELEASE-NOTES.txt @@ -2,11 +2,10 @@ 11.5 ----- - +- [*] Account deletion is now supported for all users in settings or in the empty stores screen. [https://github.com/woocommerce/woocommerce-ios/pull/8179] 11.4 ----- -- [*] Account deletion is now supported for all users in settings or in the empty stores screen. [https://github.com/woocommerce/woocommerce-ios/pull/8179] - [*] In-Person Payments: We removed any references to Simple Payments from Orders, and the red badge from the Menu tab and Menu Payments icon announcing the new Payments section. [https://github.com/woocommerce/woocommerce-ios/pull/8183] - [*] Add System Status Report to ZenDesk support requests. [https://github.com/woocommerce/woocommerce-ios/pull/8171]