Skip to content

Commit

Permalink
Merge beta 21.3.0.2 (#19742)
Browse files Browse the repository at this point in the history
  • Loading branch information
mokagio authored Dec 6, 2022
2 parents 8f88d03 + fa14718 commit eb7da67
Show file tree
Hide file tree
Showing 30 changed files with 150 additions and 38 deletions.
2 changes: 0 additions & 2 deletions RELEASE-NOTES.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,6 @@

21.3
-----
* [***] Adds a smooth, opt-in transition to the Jetpack app. [#19714]
* [*] [internal] When a user migrates to the Jetpack app and allows notifications, WordPress app notifications are disabled. This is released disabled and is behind a feature flag. [#19616, #19611, #19590]
* [*] Fixed a minor UI issue where the segmented control under My SIte was being clipped when "Home" is selected. [#19595]
* [*] Fixed an issue where the site wasn't removed and the app wasn't refreshed after disconnecting the site from WordPress.com. [#19634]
* [*] [internal] Fixed an issue where Jetpack extensions were conflicting with WordPress extensions. [#19665]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ final class JetpackNotificationMigrationService: JetpackNotificationMigrationSer
private let jetpackNotificationMigrationDefaultsKey = "jetpackNotificationMigrationDefaultsKey"

private var jetpackMigrationPreventDuplicateNotifications: Bool {
return featureFlagStore.value(for: FeatureFlag.jetpackMigrationPreventDuplicateNotifications)
return FeatureFlag.jetpackMigrationPreventDuplicateNotifications.enabled
}

var wordPressNotificationsEnabled: Bool {
Expand Down
10 changes: 6 additions & 4 deletions WordPress/Classes/System/WordPressAppDelegate.swift
Original file line number Diff line number Diff line change
Expand Up @@ -329,10 +329,12 @@ class WordPressAppDelegate: UIResponder, UIApplicationDelegate {

setupWordPressExtensions()

// Start proactively exporting WP data in the background if the conditions are fulfilled.
// This needs to be called after `setupWordPressExtensions` because it updates the stored data.
DispatchQueue.global().async {
ContentMigrationCoordinator.shared.startOnceIfNeeded()
if FeatureFlag.contentMigration.enabled {
// Start proactively exporting WP data in the background if the conditions are fulfilled.
// This needs to be called after `setupWordPressExtensions` because it updates the stored data.
DispatchQueue.global().async {
ContentMigrationCoordinator.shared.startOnceIfNeeded()
}
}

shortcutCreator.createShortcutsIf3DTouchAvailable(AccountHelper.isLoggedIn)
Expand Down
6 changes: 3 additions & 3 deletions WordPress/Classes/Utility/BuildInformation/FeatureFlag.swift
Original file line number Diff line number Diff line change
Expand Up @@ -113,17 +113,17 @@ enum FeatureFlag: Int, CaseIterable, OverrideableFlag {
case .jetpackPowered:
return true
case .jetpackPoweredBottomSheet:
return true
return false
case .contentMigration:
return true
return false
case .newJetpackLandingScreen:
return true
case .newWordPressLandingScreen:
return false
case .newCoreDataContext:
return true
case .jetpackMigrationPreventDuplicateNotifications:
return true
return false
case .jetpackFeaturesRemovalPhaseOne:
return false
case .jetpackFeaturesRemovalPhaseTwo:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,21 +12,32 @@ class ContentMigrationCoordinator {
private let dataMigrator: ContentDataMigrating
private let userPersistentRepository: UserPersistentRepository
private let eligibilityProvider: ContentMigrationEligibilityProvider
private let tracker: MigrationAnalyticsTracker

init(coreDataStack: CoreDataStack = ContextManager.shared,
dataMigrator: ContentDataMigrating = DataMigrator(),
userPersistentRepository: UserPersistentRepository = UserDefaults.standard,
eligibilityProvider: ContentMigrationEligibilityProvider = AppConfiguration()) {
eligibilityProvider: ContentMigrationEligibilityProvider = AppConfiguration(),
tracker: MigrationAnalyticsTracker = .init()) {
self.coreDataStack = coreDataStack
self.dataMigrator = dataMigrator
self.userPersistentRepository = userPersistentRepository
self.eligibilityProvider = eligibilityProvider
self.tracker = tracker
}

enum ContentMigrationCoordinatorError: Error {
enum ContentMigrationCoordinatorError: LocalizedError {
case ineligible
case exportFailure
case localDraftsNotSynced

var errorDescription: String? {
switch self {
case .ineligible: return "Content export is ineligible"
case .exportFailure: return "Content export failed"
case .localDraftsNotSynced: return "Local drafts not synced"
}
}
}

// MARK: Methods
Expand All @@ -41,22 +52,27 @@ class ContentMigrationCoordinator {
/// - Parameter completion: Closure called after the export process completes.
func startAndDo(completion: ((Result<Void, ContentMigrationCoordinatorError>) -> Void)? = nil) {
guard eligibilityProvider.isEligibleForMigration else {
tracker.trackContentExportEligibility(eligible: false)
completion?(.failure(.ineligible))
return
}

guard isLocalPostsSynced() else {
completion?(.failure(.localDraftsNotSynced))
let error = ContentMigrationCoordinatorError.localDraftsNotSynced
tracker.trackContentExportFailed(reason: error.localizedDescription)
completion?(.failure(error))
return
}

dataMigrator.exportData { result in
dataMigrator.exportData { [weak self] result in
switch result {
case .success:
self?.tracker.trackContentExportSucceeded()
completion?(.success(()))

case .failure(let error):
DDLogError("[Jetpack Migration] Error exporting data: \(error)")
self?.tracker.trackContentExportFailed(reason: error.localizedDescription)
completion?(.failure(.exportFailure))
}
}
Expand Down
42 changes: 27 additions & 15 deletions WordPress/Jetpack/Classes/System/JetpackWindowManager.swift
Original file line number Diff line number Diff line change
Expand Up @@ -9,25 +9,32 @@ class JetpackWindowManager: WindowManager {
private let migrationTracker = MigrationAnalyticsTracker()

var shouldImportMigrationData: Bool {
return !AccountHelper.isLoggedIn && !UserPersistentStoreFactory.instance().isJPContentImportComplete
return FeatureFlag.contentMigration.enabled
&& !AccountHelper.isLoggedIn
&& !UserPersistentStoreFactory.instance().isJPContentImportComplete
}

override func showUI(for blog: Blog?) {
// If the user is logged in and has blogs sync'd to their account
if AccountHelper.isLoggedIn && AccountHelper.hasBlogs {
showAppUI(for: blog)
return
if AccountHelper.isLoggedIn {
if AccountHelper.hasBlogs {
// If the user is logged in and has blogs sync'd to their account
showAppUI(for: blog)
return
} else {
// If the user doesn't have any blogs, but they're still logged in, log them out
// the `logOutDefaultWordPressComAccount` method will trigger the `showSignInUI` automatically
AccountHelper.logOutDefaultWordPressComAccount()
return
}
}

guard AccountHelper.isLoggedIn else {
self.migrationTracker.trackContentImportEligibility(eligible: shouldImportMigrationData)
shouldImportMigrationData ? importAndShowMigrationContent(blog) : showSignInUI()
guard FeatureFlag.contentMigration.enabled else {
showSignInUI()
return
}

// If the user doesn't have any blogs, but they're still logged in, log them out
// the `logOutDefaultWordPressComAccount` method will trigger the `showSignInUI` automatically
AccountHelper.logOutDefaultWordPressComAccount()
self.migrationTracker.trackContentImportEligibility(eligible: shouldImportMigrationData)
shouldImportMigrationData ? importAndShowMigrationContent(blog) : showSignInUI()
}

func importAndShowMigrationContent(_ blog: Blog? = nil) {
Expand Down Expand Up @@ -101,12 +108,17 @@ private extension JetpackWindowManager {
func showLoadWordPressUI(schemeUrl: URL) {
let actions = MigrationLoadWordPressViewModel.Actions()
let loadWordPressViewModel = MigrationLoadWordPressViewModel(actions: actions)
let loadWordPressViewController = MigrationLoadWordPressViewController(viewModel: loadWordPressViewModel)
actions.primary = {
let loadWordPressViewController = MigrationLoadWordPressViewController(
viewModel: loadWordPressViewModel,
tracker: migrationTracker
)
actions.primary = { [weak self] in
self?.migrationTracker.track(.loadWordPressScreenOpenTapped)
UIApplication.shared.open(schemeUrl)
}
actions.secondary = { [weak self] in
loadWordPressViewController.dismiss(animated: true) {
actions.secondary = { [weak self, weak loadWordPressViewController] in
self?.migrationTracker.track(.loadWordPressScreenNoThanksTapped)
loadWordPressViewController?.dismiss(animated: true) {
self?.showSignInUI()
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,22 @@ struct MigrationAnalyticsTracker {
WPAnalytics.track(event)
}

// MARK: - Content Export

func trackContentExportEligibility(eligible: Bool) {
let properties = ["eligible": String(eligible)]
self.track(.contentExportEligibility, properties: properties)
}

func trackContentExportSucceeded() {
self.track(.contentExportSucceeded)
}

func trackContentExportFailed(reason: String) {
let properties = ["error_type": reason]
self.track(.contentExportFailed, properties: properties)
}

// MARK: - Content Import

func trackContentImportEligibility(eligible: Bool) {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
import Foundation

enum MigrationEvent: String {
// Content Export
case contentExportEligibility = "migration_content_export_eligibility"
case contentExportSucceeded = "migration_content_export_succeeded"
case contentExportFailed = "migration_content_export_failed"

// Content Import
case contentImportEligibility = "migration_content_import_eligibility"
case contentImportSucceeded = "migration_content_import_succeeded"
Expand Down Expand Up @@ -37,6 +42,11 @@ enum MigrationEvent: String {
case pleaseDeleteWordPressScreenHelpTapped = "migration_please_delete_wordpress_screen_help_tapped"
case pleaseDeleteWordPressScreenCloseTapped = "migration_please_delete_wordpress_screen_close_tapped"

// WordPress Migratable Stat
// Load WordPress
case loadWordPressScreenShown = "migration_load_wordpress_screen_shown"
case loadWordPressScreenOpenTapped = "migration_load_wordpress_screen_open_tapped"
case loadWordPressScreenNoThanksTapped = "migration_load_wordpress_screen_no_thanks_tapped"

// WordPress Migratable State
case wordPressDetected = "migration_wordpressapp_detected"
}
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,13 @@ class MigrationLoadWordPressViewController: UIViewController {
// MARK: - Dependencies

private let viewModel: MigrationLoadWordPressViewModel
private let tracker: MigrationAnalyticsTracker

// MARK: - Init

init(viewModel: MigrationLoadWordPressViewModel) {
init(viewModel: MigrationLoadWordPressViewModel, tracker: MigrationAnalyticsTracker = .init()) {
self.viewModel = viewModel
self.tracker = tracker
super.init(nibName: nil, bundle: nil)
}

Expand All @@ -32,4 +34,9 @@ class MigrationLoadWordPressViewController: UIViewController {
super.viewDidLoad()
self.view.backgroundColor = MigrationAppearance.backgroundColor
}

override func viewDidAppear(_ animated: Bool) {
super.viewDidAppear(animated)
self.tracker.track(.loadWordPressScreenShown)
}
}
4 changes: 2 additions & 2 deletions WordPress/Resources/ro.lproj/Localizable.strings
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/* Translation-Revision-Date: 2022-11-29 15:27:05+0000 */
/* Translation-Revision-Date: 2022-12-02 21:16:36+0000 */
/* Plural-Forms: nplurals=3; plural=(n == 1) ? 0 : ((n == 0 || n % 100 >= 2 && n % 100 <= 19) ? 1 : 2); */
/* Generator: GlotPress/4.0.0-alpha.3 */
/* Language: ro */
Expand Down Expand Up @@ -5811,7 +5811,7 @@ translators: %s: Select control button label e.g. \"Button width\" */
"Preview Device" = "Dispozitiv de previzualizare";

/* Title on display preview error */
"Preview Unavailable" = "Previzualizare indisponibilă";
"Preview Unavailable" = "Previzualizarea nu este disponibilă";

/* Accessibility label for media item preview for user's viewing an item in their media library */
"Preview media" = "Previzualizează elementul media";
Expand Down
4 changes: 2 additions & 2 deletions WordPress/Resources/zh-Hant.lproj/Localizable.strings
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/* Translation-Revision-Date: 2022-11-30 14:54:27+0000 */
/* Translation-Revision-Date: 2022-12-03 05:25:36+0000 */
/* Plural-Forms: nplurals=1; plural=0; */
/* Generator: GlotPress/4.0.0-alpha.3 */
/* Language: zh_TW */
Expand Down Expand Up @@ -8080,7 +8080,7 @@ translators: %s: Select control option value e.g: \"Auto, 25%\". */
Button title for Trash comment state.
Trashes a comment
Trashes the comment */
"Trash" = "移至垃圾桶";
"Trash" = "移至回收桶";

/* Accessibility hint for trash button to delete items from the user's media library */
"Trash selected media" = "將選取的媒體移至垃圾桶";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,11 @@ private class RemoteNotificationRegisterMock: RemoteNotificationRegister {
}

private class RemoteFeatureFlagStoreMock: RemoteFeatureFlagStore {
var value = false
var value = false {
didSet {
try? FeatureFlagOverrideStore().override(FeatureFlag.jetpackMigrationPreventDuplicateNotifications, withValue: value)
}
}

override func value(for flag: OverrideableFlag) -> Bool {
return value
Expand Down
2 changes: 1 addition & 1 deletion config/Version.internal.xcconfig
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
VERSION_SHORT=21.3

// Internal long version example: VERSION_LONG=9.9.0.20180423
VERSION_LONG=21.3.0.20221202
VERSION_LONG=21.3.0.20221206
2 changes: 1 addition & 1 deletion config/Version.public.xcconfig
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
VERSION_SHORT=21.3

// Public long version example: VERSION_LONG=9.9.0.0
VERSION_LONG=21.3.0.1
VERSION_LONG=21.3.0.2
3 changes: 3 additions & 0 deletions fastlane/jetpack_metadata/ar-SA/release_notes.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
أصلحنا مشكلة بصرية طفيفة من خلال عنصر التحكم في الصفحة الرئيسية والقائمة ضمن لوحة تحكم موقعي.

عالجنا أيضًا مشكلة في موقعي. يتم الآن قطع اتصال زر "قطع الاتصال من ووردبريس.كوم" الآن عند النقر عليه، وسيتم تحديث التطبيق.
3 changes: 3 additions & 0 deletions fastlane/jetpack_metadata/de-DE/release_notes.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
Ein geringfügiges visuelles Problem mit dem Home- und Menü-Steuerelement im Dashboard „Meine Website“ wurde behoben.

Wir haben ebenfalls einige Fehler im Bereich „Meine Website“ beseitigt. Der Button „Verbindung mit WordPress.com trennen“ trennt jetzt bei Antippen die Verbindung und lädt daraufhin die App erneut.
3 changes: 3 additions & 0 deletions fastlane/jetpack_metadata/es-ES/release_notes.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
Hemos solucionado un pequeño problema visual con el control de inicio y del menú en el escritorio de Mi sitio.

También hemos eliminado un error en Mi sitio. Ahora, el botón "Desconectar de WordPress.com" lo desconecta al tocarlo y actualiza la aplicación.
3 changes: 3 additions & 0 deletions fastlane/jetpack_metadata/id/release_notes.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
Kami memperbaiki sedikit masalah tampilan pada kontrol Beranda dan Menu di dasbor Situs Saya.

Kami juga mengatasi bug di Situs Saya. Sekarang mengetuk tombol "Putuskan koneksi dari WordPress.com” akan segera memutuskan koneksi dan menyegarkan aplikasi.
3 changes: 3 additions & 0 deletions fastlane/jetpack_metadata/it/release_notes.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
Abbiamo risolto un piccolo problema visuale con il controllo della Home e del Menu nella bacheca Il mio sito.

Abbiamo anche risolto un bug in Il mio sito. Il pulsante "Disconnetti da WordPress.com" ora disconnette quando viene toccato e aggiorna l'app.
3 changes: 3 additions & 0 deletions fastlane/jetpack_metadata/ja/release_notes.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
サイトの管理画面のホームとメニューの操作で発生する小さな問題を修正しました。

また、参加サイトのバグも修正しました。 「WordPress.com との連携を解除」ボタンをタップすると連携が解除され、アプリが更新されるようになりました。
3 changes: 3 additions & 0 deletions fastlane/jetpack_metadata/ru/release_notes.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
Мы устранили небольшую проблему с отображением элемента управления на главной странице и в меню на консоли «Мой сайт».

Мы также устранили ошибку в разделе «Мой сайт». Кнопка «Отключить от WordPress.com» теперь прерывает подключение и обновляет приложение.
3 changes: 3 additions & 0 deletions fastlane/jetpack_metadata/zh-Hant/release_notes.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
我們修正了「我的網站」控制台首頁和選單控制項目在視覺上的一個小問題,

也修正了「我的網站」中的一個錯誤。 現在點選「中斷與 WordPress.com 的連結」按鈕會中斷連結並重新整理應用程式。
3 changes: 3 additions & 0 deletions fastlane/metadata/ar-SA/release_notes.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
أصلحنا مشكلة بصرية طفيفة من خلال عنصر التحكم في الصفحة الرئيسية والقائمة ضمن لوحة تحكم موقعي.

عالجنا أيضًا مشكلة في موقعي. يتم الآن قطع اتصال زر "قطع الاتصال من ووردبريس.كوم" الآن عند النقر عليه، وسيتم تحديث التطبيق.
3 changes: 3 additions & 0 deletions fastlane/metadata/de-DE/release_notes.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
Ein geringfügiges visuelles Problem mit dem Home- und Menü-Steuerelement im Dashboard „Meine Website“ wurde behoben.

Wir haben ebenfalls einige Fehler im Bereich „Meine Website“ beseitigt. Der Button „Verbindung mit WordPress.com trennen“ trennt jetzt bei Antippen die Verbindung und lädt daraufhin die App erneut.
2 changes: 2 additions & 0 deletions fastlane/metadata/default/release_notes.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
You can now migrate your site content to the Jetpack app without a hitch.

We fixed a small visual issue with the Home and Menu control in the My Site dashboard.

We also squashed a bug in My Site. The "Disconnect from WordPress.com” button now disconnects when tapped and will refresh the app.
3 changes: 3 additions & 0 deletions fastlane/metadata/en-GB/release_notes.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
We fixed a small visual issue with the Home and Menu control in the My Site dashboard.

We also squashed a bug in My Site. The "Disconnect from WordPress.com” button now disconnects when tapped and will refresh the app.
3 changes: 3 additions & 0 deletions fastlane/metadata/es-ES/release_notes.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
Hemos corregido un pequeño problema visual con el control de inicio y menú en el escritorio de «Mi sitio».

También hemos corregido un fallo en «Mi sitio». El botón de «Desconectar de WordPress.com» ahora desconecta cuando se toca y recargará la aplicación.
3 changes: 3 additions & 0 deletions fastlane/metadata/id/release_notes.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
Kami memperbaiki sedikit masalah tampilan pada kontrol Beranda dan Menu di dasbor Situs Saya.

Kami juga mengatasi bug di Situs Saya. Sekarang mengetuk tombol "Putuskan koneksi dari WordPress.com” akan segera memutuskan koneksi dan menyegarkan aplikasi.
3 changes: 3 additions & 0 deletions fastlane/metadata/ru/release_notes.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
Мы устранили небольшую проблему с отображением элемента управления на главной странице и в меню на консоли «Мой сайт».

Мы также устранили ошибку в разделе «Мой сайт». Кнопка «Отключить от WordPress.com» теперь прерывает подключение и обновляет приложение.
3 changes: 3 additions & 0 deletions fastlane/metadata/sv/release_notes.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
Vi har rättat ett litet visuellt problem med reglaget för startsida och meny i adminpanelen “Min webbplats“.

Dessutom har vi fixat ett fel under “Min webbplats”. Om du trycker på ”Koppla bort från WordPress.com” bryts nu anslutningen, varefter appen laddas om.

0 comments on commit eb7da67

Please sign in to comment.