Skip to content
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
9 changes: 9 additions & 0 deletions WordPress/Classes/Utility/Analytics/WPAnalyticsEvent.swift
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,9 @@ import WordPressShared

// Media
case siteMediaShareTapped
case mediaStorageDetailsViewed
case mediaStorageDetailsActionTapped
case mediaStorageDetailsPurchaseCompleted

// Settings and Prepublishing Nudges
case editorPostPublishTap
Expand Down Expand Up @@ -720,6 +723,12 @@ import WordPressShared
// Media
case .siteMediaShareTapped:
return "site_media_shared_tapped"
case .mediaStorageDetailsViewed:
return "media_storage_details_viewed"
case .mediaStorageDetailsActionTapped:
return "media_storage_details_action_tapped"
case .mediaStorageDetailsPurchaseCompleted:
return "media_storage_details_purchase_completed"
// Editor
case .editorPostPublishTap:
return "editor_post_publish_tapped"
Expand Down
4 changes: 0 additions & 4 deletions WordPress/Classes/Utility/BuildInformation/FeatureFlag.swift
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@ public enum FeatureFlag: Int, CaseIterable {
case readerGutenbergCommentComposer
case pluginManagementOverhaul
case newStats
case mediaQuotaView
case intelligence
case newSupport
case nativeBlockInserter
Expand Down Expand Up @@ -80,8 +79,6 @@ public enum FeatureFlag: Int, CaseIterable {
return false
case .newStats:
return false
case .mediaQuotaView:
return false
case .intelligence:
let languageCode = Locale.current.language.languageCode?.identifier
return (languageCode ?? "en").hasPrefix("en")
Expand Down Expand Up @@ -130,7 +127,6 @@ extension FeatureFlag {
case .pluginManagementOverhaul: "Plugin Management Overhaul"
case .readerGutenbergCommentComposer: "Gutenberg Comment Composer"
case .newStats: "New Stats"
case .mediaQuotaView: "Media Quota"
case .intelligence: "Intelligence"
case .newSupport: "New Support"
case .nativeBlockInserter: "Native Block Inserter"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,18 +35,12 @@ final class SiteMediaAddMediaMenuController: NSObject, PHPickerViewControllerDel
UIMenu(options: [.displayInline], children: freeMediaActions)
]
}
if let quotaUsageDescription = blog.quotaUsageDescription {
if FeatureFlag.mediaQuotaView.enabled {
children += [
UIAction(title: Strings.viewUsage, subtitle: blog.quotaUsageShortDescription, image: UIImage(systemName: "opticaldiscdrive"), handler: { _ in
self.showQuotaView(from: viewController)
})
]
} else {
children += [
UIAction(subtitle: quotaUsageDescription, handler: { _ in })
]
}
if blog.isHostedAtWPcom, blog.isQuotaAvailable {
children += [
UIAction(title: Strings.viewUsage, subtitle: blog.quotaUsageShortDescription, image: UIImage(systemName: "opticaldiscdrive"), handler: { _ in
self.showQuotaView(from: viewController)
})
]
}
return UIMenu(options: [.displayInline], children: children)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import SVProgressHUD
import WordPressAPI
import WordPressCore
import WordPressData
import WordPressShared

struct MediaStorageDetailsView: View {
@State private var purchase: WebPurchase?
Expand Down Expand Up @@ -54,6 +55,7 @@ struct MediaStorageDetailsView: View {
}
.sheet(item: $purchase) { purchase in
WebPurchaseView(url: purchase.url, customTitle: purchase.title) { _ in
WPAnalytics.track(.mediaStorageDetailsPurchaseCompleted, properties: ["type": purchase.purchaseType])
SVProgressHUD.showSuccess(withStatus: purchase.successMessage)

self.purchase = nil
Expand All @@ -67,6 +69,7 @@ struct MediaStorageDetailsView: View {
}
}
.task {
WPAnalytics.track(.mediaStorageDetailsViewed)
await viewModel.refresh()
}
}
Expand All @@ -77,10 +80,12 @@ struct MediaStorageDetailsView: View {
switch action.kind {
case .buyStorage:
ActionSection(action: action) {
WPAnalytics.track(.mediaStorageDetailsActionTapped, properties: ["action": "storage"])
self.purchase = .storage(blog: viewModel.blog)
}
case .upgradePlan:
ActionSection(action: action) {
WPAnalytics.track(.mediaStorageDetailsActionTapped, properties: ["action": "upgrade-plan"])
self.purchase = .upgradePlan(blog: viewModel.blog)
}
}
Expand Down Expand Up @@ -158,6 +163,7 @@ private struct WebPurchase: Identifiable {
var url: URL
var title: String
var successMessage: String
var purchaseType: String

var id: URL {
url
Expand All @@ -169,15 +175,17 @@ private struct WebPurchase: Identifiable {
.appending(path: blog.primaryDomainAddress)
.appending(queryItems: [.init(name: "product", value: "storage")]),
title: Strings.buyStorageTitle,
successMessage: Strings.storageUpgradeSuccessMessage
successMessage: Strings.storageUpgradeSuccessMessage,
purchaseType: "storage"
)
}

static func upgradePlan(blog: Blog) -> Self {
WebPurchase(
url: URL(string: "https://wordpress.com/plans/yearly/")!.appending(path: blog.primaryDomainAddress),
title: Strings.upgradePlanTitle,
successMessage: Strings.planUpgradeSuccessMessage
successMessage: Strings.planUpgradeSuccessMessage,
purchaseType: "upgrade-plan"
)
}
}
Expand Down