Skip to content

Commit 3e42498

Browse files
authored
Merge pull request #19826 from wordpress-mobile/disable-jp-features-stock-photos-tenor
Disable Stock Photo and Tenor media sources when Jetpack features are removed
2 parents ad84869 + afde20f commit 3e42498

File tree

6 files changed

+14
-4
lines changed

6 files changed

+14
-4
lines changed

RELEASE-NOTES.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
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]
44
* [**] [internal] Disable Story posts when Jetpack features are removed [#19823]
5+
* [**] [internal] Disable StockPhoto and Tenor media sources when Jetpack features are removed [#19826]
56

67
21.4
78
-----

WordPress/Classes/Models/Blog.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,8 @@ typedef NS_ENUM(NSUInteger, BlogFeature) {
7777
BlogFeatureMediaDeletion,
7878
/// Does the blog support Stock Photos feature (free photos library)
7979
BlogFeatureStockPhotos,
80+
/// Does the blog support Tenor feature (free GIF library)
81+
BlogFeatureTenor,
8082
/// Does the blog support setting the homepage type and pages?
8183
BlogFeatureHomepageSettings,
8284
/// Does the blog support stories?

WordPress/Classes/Models/Blog.m

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -535,8 +535,11 @@ - (BOOL)supports:(BlogFeature)feature
535535
case BlogFeatureWPComRESTAPI:
536536
case BlogFeatureCommentLikes:
537537
case BlogFeatureStats:
538-
case BlogFeatureStockPhotos:
539538
return [self supportsRestApi];
539+
case BlogFeatureStockPhotos:
540+
return [self supportsRestApi] && [JetpackFeaturesRemovalCoordinator jetpackFeaturesEnabled];
541+
case BlogFeatureTenor:
542+
return [JetpackFeaturesRemovalCoordinator jetpackFeaturesEnabled];
540543
case BlogFeatureSharing:
541544
return [self supportsSharing];
542545
case BlogFeatureOAuth2Login:

WordPress/Classes/ViewRelated/Gutenberg/GutenbergViewController.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1182,7 +1182,7 @@ extension GutenbergViewController: GutenbergBridgeDataSource {
11821182
func gutenbergMediaSources() -> [Gutenberg.MediaSource] {
11831183
return [
11841184
post.blog.supports(.stockPhotos) ? .stockPhotos : nil,
1185-
.tenor,
1185+
post.blog.supports(.tenor) ? .tenor : nil,
11861186
.otherApps,
11871187
.allFiles,
11881188
].compactMap { $0 }

WordPress/Classes/ViewRelated/Media/MediaLibraryMediaPickingCoordinator.swift

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,8 +38,10 @@ final class MediaLibraryMediaPickingCoordinator {
3838
if blog.supports(.stockPhotos) {
3939
menuAlert.addAction(freePhotoAction(origin: origin, blog: blog))
4040
}
41+
if blog.supports(.tenor) {
42+
menuAlert.addAction(tenorAction(origin: origin, blog: blog))
43+
}
4144

42-
menuAlert.addAction(tenorAction(origin: origin, blog: blog))
4345
menuAlert.addAction(otherAppsAction(origin: origin, blog: blog))
4446
menuAlert.addAction(cancelAction())
4547

WordPress/Classes/ViewRelated/Media/StockPhotos/AztecMediaPickingCoordinator.swift

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,10 @@ final class AztecMediaPickingCoordinator {
2525
if blog.supports(.stockPhotos) {
2626
alertController.addAction(freePhotoAction(origin: origin, blog: blog))
2727
}
28+
if blog.supports(.tenor) {
29+
alertController.addAction(tenorAction(origin: origin, blog: blog))
30+
}
2831

29-
alertController.addAction(tenorAction(origin: origin, blog: blog))
3032
alertController.addAction(otherAppsAction(origin: origin, blog: blog))
3133
alertController.addAction(cancelAction())
3234

0 commit comments

Comments
 (0)