Skip to content

Commit afde20f

Browse files
authored
Merge branch 'trunk' into disable-jp-features-stock-photos-tenor
2 parents 3005b74 + cb040ad commit afde20f

34 files changed

+425
-155
lines changed

RELEASE-NOTES.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
21.5
22
-----
33
* [***] [internal] A significant refactor to the app’s architecture was made to allow for the new simplified UI. Regression testing on the app’s main flows is needed. [#19817]
4+
* [**] [internal] Disable Story posts when Jetpack features are removed [#19823]
45
* [**] [internal] Disable StockPhoto and Tenor media sources when Jetpack features are removed [#19826]
56

67
21.4

WordPress/Classes/Models/Blog.m

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -694,7 +694,8 @@ - (BOOL)supportsPluginManagement
694694
- (BOOL)supportsStories
695695
{
696696
BOOL hasRequiredJetpack = [self hasRequiredJetpackVersion:@"9.1"];
697-
return hasRequiredJetpack || self.isHostedAtWPcom;
697+
// Stories are disabled in iPad until this Kanvas issue is solved: https://github.com/tumblr/kanvas-ios/issues/104
698+
return (hasRequiredJetpack || self.isHostedAtWPcom) && ![UIDevice isPad] && [JetpackFeaturesRemovalCoordinator jetpackFeaturesEnabled];
698699
}
699700

700701
- (BOOL)supportsContactInfo

WordPress/Classes/Stores/UserPersistentRepository.swift

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -23,17 +23,3 @@ protocol UserPersistentRepositoryWriter: KeyValueDatabase {
2323
typealias UserPersistentRepository = UserPersistentRepositoryReader & UserPersistentRepositoryWriter & UserPersistentRepositoryUtility
2424

2525
extension UserDefaults: UserPersistentRepository {}
26-
27-
extension UserPersistentStore {
28-
private static var isOneOffMigrationCompleteKey: String {
29-
"defaults_one_off_migration"
30-
}
31-
32-
var isOneOffMigrationComplete: Bool {
33-
get {
34-
bool(forKey: Self.isOneOffMigrationCompleteKey)
35-
} set {
36-
set(newValue, forKey: Self.isOneOffMigrationCompleteKey)
37-
}
38-
}
39-
}

WordPress/Classes/System/WordPressAppDelegate.swift

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -329,22 +329,6 @@ class WordPressAppDelegate: UIResponder, UIApplicationDelegate {
329329

330330
setupWordPressExtensions()
331331

332-
if AppConfiguration.isWordPress,
333-
FeatureFlag.contentMigration.enabled {
334-
// To prevent race condition, initialize the shared instance synchronously so it can listen to account change notifications.
335-
let _ = ContentMigrationCoordinator.shared
336-
337-
let launchUrl = launchOptions[.url] as? URL
338-
let exportUrl = URL(string: "\(AppScheme.wordpressMigrationV1.rawValue)\(WordPressExportRoute().path.removingPrefix("/"))")
339-
if launchUrl != exportUrl {
340-
// Start proactively exporting WP data in the background if the conditions are fulfilled.
341-
// This needs to be called after `setupWordPressExtensions` because it updates the stored data.
342-
DispatchQueue.global().async {
343-
ContentMigrationCoordinator.shared.startOnceIfNeeded()
344-
}
345-
}
346-
}
347-
348332
shortcutCreator.createShortcutsIf3DTouchAvailable(AccountHelper.isLoggedIn)
349333

350334
AccountService.loadDefaultAccountCookies()

WordPress/Classes/Utility/ContentCoordinator.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ struct DefaultContentCoordinator: ContentCoordinator {
8989
func displayBackupWithSiteID(_ siteID: NSNumber?) throws {
9090
guard let siteID = siteID,
9191
let blog = Blog.lookup(withID: siteID, in: mainContext),
92-
let backupListViewController = BackupListViewController(blog: blog)
92+
let backupListViewController = BackupListViewController.withJPBannerForBlog(blog)
9393
else {
9494
throw DisplayError.missingParameter
9595
}

WordPress/Classes/Utility/Migration/ContentMigrationCoordinator.swift

Lines changed: 0 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -97,28 +97,6 @@
9797
}
9898
}
9999

100-
/// Starts the content migration process from WordPress to Jetpack.
101-
/// This method ensures that the migration will only be executed once per installation,
102-
/// and only performed when all the conditions are fulfilled.
103-
///
104-
/// Note: If the conditions are not fulfilled, this method will attempt to migrate
105-
/// again on the next call.
106-
///
107-
func startOnceIfNeeded(completion: (() -> Void)? = nil) {
108-
if userPersistentRepository.bool(forKey: .oneOffMigrationKey) {
109-
completion?()
110-
return
111-
}
112-
113-
startAndDo { [weak self] result in
114-
if case .success = result {
115-
self?.userPersistentRepository.set(true, forKey: .oneOffMigrationKey)
116-
}
117-
118-
completion?()
119-
}
120-
}
121-
122100
/// Attempts to clean up the exported data by re-exporting user content if they're still eligible, or deleting them otherwise.
123101
/// Re-exporting user content ensures that the exported data will match the latest state of Account and Blogs.
124102
///
@@ -215,6 +193,5 @@ extension AppConfiguration: ContentMigrationEligibilityProvider {
215193
// MARK: - Constants
216194

217195
private extension String {
218-
static let oneOffMigrationKey = "wordpress_one_off_export"
219196
static let exportErrorSharedKey = "wordpress_shared_export_error"
220197
}
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
import Foundation
2+
3+
@objc
4+
extension BackupListViewController {
5+
static func withJPBannerForBlog(_ blog: Blog) -> UIViewController? {
6+
guard let backupListVC = BackupListViewController(blog: blog) else {
7+
return nil
8+
}
9+
return JetpackBannerWrapperViewController(childVC: backupListVC, analyticsId: .backup)
10+
}
11+
}
12+
13+
extension BackupListViewController: JPScrollViewDelegate {
14+
override func scrollViewDidScroll(_ scrollView: UIScrollView) {
15+
super.scrollViewDidScroll(scrollView)
16+
processJetpackBannerVisibility(scrollView)
17+
}
18+
}

WordPress/Classes/ViewRelated/Activity/Backup/BackupListViewController.swift

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,10 @@
11
import Foundation
2+
import Combine
23

34
class BackupListViewController: BaseActivityListViewController {
5+
/// Needed for JPScrollViewDelegate conformance.
6+
let scrollViewTranslationPublisher = PassthroughSubject<Bool, Never>()
7+
48
override init(site: JetpackSiteRef, store: ActivityStore, isFreeWPCom: Bool = false) {
59
store.onlyRestorableItems = true
610

WordPress/Classes/ViewRelated/Blog/Blog Details/BlogDetailsViewController.m

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1602,7 +1602,7 @@ - (void)showScan
16021602

16031603
- (void)showBackup
16041604
{
1605-
BackupListViewController *controller = [[BackupListViewController alloc] initWithBlog:self.blog];
1605+
UIViewController *controller = [BackupListViewController withJPBannerForBlog:self.blog];
16061606
controller.navigationItem.largeTitleDisplayMode = UINavigationItemLargeTitleDisplayModeNever;
16071607
[self.presentationDelegate presentBlogDetailsViewController:controller];
16081608
}

WordPress/Classes/ViewRelated/Blog/My Site/MySiteViewController+FAB.swift

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ extension MySiteViewController {
2828

2929
var actions: [ActionSheetItem] = []
3030

31-
if shouldShowNewStory {
31+
if blog?.supports(.stories) ?? false {
3232
actions.append(StoryAction(handler: newStory, source: source))
3333
}
3434

@@ -38,8 +38,4 @@ extension MySiteViewController {
3838
let coordinator = CreateButtonCoordinator(self, actions: actions, source: source, blog: blog)
3939
return coordinator
4040
}
41-
42-
private var shouldShowNewStory: Bool {
43-
return (blog?.supports(.stories) ?? false) && !UIDevice.isPad()
44-
}
4541
}

0 commit comments

Comments
 (0)