Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Disable Stock Photo and Tenor media sources when Jetpack features are removed #19826

Merged
merged 7 commits into from
Jan 5, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions RELEASE-NOTES.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
-----
* [***] [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]
* [**] [internal] Disable Story posts when Jetpack features are removed [#19823]
* [**] [internal] Disable StockPhoto and Tenor media sources when Jetpack features are removed [#19826]

21.4
-----
Expand Down
2 changes: 2 additions & 0 deletions WordPress/Classes/Models/Blog.h
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,8 @@ typedef NS_ENUM(NSUInteger, BlogFeature) {
BlogFeatureMediaDeletion,
/// Does the blog support Stock Photos feature (free photos library)
BlogFeatureStockPhotos,
/// Does the blog support Tenor feature (free GIF library)
BlogFeatureTenor,
/// Does the blog support setting the homepage type and pages?
BlogFeatureHomepageSettings,
/// Does the blog support stories?
Expand Down
5 changes: 4 additions & 1 deletion WordPress/Classes/Models/Blog.m
Original file line number Diff line number Diff line change
Expand Up @@ -535,8 +535,11 @@ - (BOOL)supports:(BlogFeature)feature
case BlogFeatureWPComRESTAPI:
case BlogFeatureCommentLikes:
case BlogFeatureStats:
case BlogFeatureStockPhotos:
return [self supportsRestApi];
case BlogFeatureStockPhotos:
return [self supportsRestApi] && [JetpackFeaturesRemovalCoordinator jetpackFeaturesEnabled];
case BlogFeatureTenor:
return [JetpackFeaturesRemovalCoordinator jetpackFeaturesEnabled];
case BlogFeatureSharing:
return [self supportsSharing];
case BlogFeatureOAuth2Login:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1182,7 +1182,7 @@ extension GutenbergViewController: GutenbergBridgeDataSource {
func gutenbergMediaSources() -> [Gutenberg.MediaSource] {
return [
post.blog.supports(.stockPhotos) ? .stockPhotos : nil,
.tenor,
post.blog.supports(.tenor) ? .tenor : nil,
.otherApps,
.allFiles,
].compactMap { $0 }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,10 @@ final class MediaLibraryMediaPickingCoordinator {
if blog.supports(.stockPhotos) {
menuAlert.addAction(freePhotoAction(origin: origin, blog: blog))
}
if blog.supports(.tenor) {
menuAlert.addAction(tenorAction(origin: origin, blog: blog))
}

menuAlert.addAction(tenorAction(origin: origin, blog: blog))
menuAlert.addAction(otherAppsAction(origin: origin, blog: blog))
menuAlert.addAction(cancelAction())

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,10 @@ final class AztecMediaPickingCoordinator {
if blog.supports(.stockPhotos) {
alertController.addAction(freePhotoAction(origin: origin, blog: blog))
}
if blog.supports(.tenor) {
alertController.addAction(tenorAction(origin: origin, blog: blog))
}

alertController.addAction(tenorAction(origin: origin, blog: blog))
alertController.addAction(otherAppsAction(origin: origin, blog: blog))
alertController.addAction(cancelAction())

Expand Down