diff --git a/apple/OmnivoreKit/Sources/App/AppExtensions/Share/ShareExtensionScene.swift b/apple/OmnivoreKit/Sources/App/AppExtensions/Share/ShareExtensionScene.swift index a51dbb871..b525b5a97 100644 --- a/apple/OmnivoreKit/Sources/App/AppExtensions/Share/ShareExtensionScene.swift +++ b/apple/OmnivoreKit/Sources/App/AppExtensions/Share/ShareExtensionScene.swift @@ -22,7 +22,7 @@ public extension PlatformViewController { final class ShareExtensionViewModel: ObservableObject { @Published var title: String? - @Published var status = ShareExtensionStatus.successfullySaved + @Published var status = ShareExtensionStatus.processing @Published var debugText: String? var subscriptions = Set() @@ -75,7 +75,7 @@ final class ShareExtensionViewModel: ObservableObject { self?.debugText = "saveArticleError: \(error)" self?.status = .failed(error: error) } receiveValue: { [weak self] _ in - self?.status = .successfullySaved + self?.status = .success } .store(in: &subscriptions) diff --git a/apple/OmnivoreKit/Sources/Utils/FeatureFlags.swift b/apple/OmnivoreKit/Sources/Utils/FeatureFlags.swift index 7b5d0f704..5642e89eb 100644 --- a/apple/OmnivoreKit/Sources/Utils/FeatureFlags.swift +++ b/apple/OmnivoreKit/Sources/Utils/FeatureFlags.swift @@ -10,6 +10,7 @@ public enum FeatureFlag { public static let showAccountDeletion = false public static let enableSnoozeFromShareExtension = false public static let enableRemindersFromShareExtension = false + public static let enableReadNow = false public static let enablePushNotifications = false public static let enableShareButton = false public static let enableSnooze = false diff --git a/apple/OmnivoreKit/Sources/Views/LocalText.swift b/apple/OmnivoreKit/Sources/Views/LocalText.swift index 3e7b9d015..861532879 100644 --- a/apple/OmnivoreKit/Sources/Views/LocalText.swift +++ b/apple/OmnivoreKit/Sources/Views/LocalText.swift @@ -13,7 +13,6 @@ public enum LocalText { static let networkError = localText(key: "error.network") static let genericError = localText(key: "error.generic") static let invalidCredsLoginError = localText(key: "loginError.invalidCreds") - static let saveArticleSavingState = localText(key: "saveArticleSavingState") static let saveArticleSavedState = localText(key: "saveArticleSavedState") static let saveArticleProcessingState = localText(key: "saveArticleProcessingState") static let extensionAppUnauthorized = localText(key: "extensionAppUnauthorized") diff --git a/apple/OmnivoreKit/Sources/Views/ShareExtensionView.swift b/apple/OmnivoreKit/Sources/Views/ShareExtensionView.swift index badcc27dc..8cfa95fbb 100644 --- a/apple/OmnivoreKit/Sources/Views/ShareExtensionView.swift +++ b/apple/OmnivoreKit/Sources/Views/ShareExtensionView.swift @@ -3,16 +3,13 @@ import SwiftUI import Utils public enum ShareExtensionStatus { - case saving case processing - case successfullySaved + case success case failed(error: SaveArticleError) var displayMessage: String { switch self { - case .saving: - return LocalText.saveArticleSavingState - case .successfullySaved: + case .success: return LocalText.saveArticleSavedState case let .failed(error: error): return error.displayMessage @@ -140,19 +137,17 @@ public struct ShareExtensionChildView: View { Spacer() - if case ShareExtensionStatus.successfullySaved = status { - HStack { - Spacer() - IconButtonView( - title: "Read Now", - systemIconName: "book", - action: { - readNowButtonAction() - } - ) - Spacer() + if case ShareExtensionStatus.success = status { + HStack(spacing: 4) { + Text("Saved to Omnivore") + .font(.appTitleThree) + .foregroundColor(.appGrayText) + .padding(.trailing, 16) + .multilineTextAlignment(.center) + .fixedSize(horizontal: false, vertical: true) + .lineLimit(nil) } - .padding(.horizontal, 8) + .padding() } else if case let ShareExtensionStatus.failed(error) = status { HStack { Spacer() @@ -207,16 +202,29 @@ public struct ShareExtensionChildView: View { } .padding(.horizontal) - Button( - action: { - dismissButtonTappedAction(reminderTime, hideUntilReminded) - }, - label: { - Text("Dismiss") - .frame(maxWidth: .infinity) + HStack { + if case ShareExtensionStatus.success = status, FeatureFlag.enableReadNow { + Button( + action: { readNowButtonAction() }, + label: { Text("Read Now").frame(maxWidth: .infinity) } + ) + .buttonStyle(RoundedRectButtonStyle()) } - ) - .buttonStyle(RoundedRectButtonStyle()) + if case ShareExtensionStatus.processing = status, FeatureFlag.enableReadNow { + Button(action: {}, label: { ProgressView().frame(maxWidth: .infinity) }) + .buttonStyle(RoundedRectButtonStyle()) + } + Button( + action: { + dismissButtonTappedAction(reminderTime, hideUntilReminded) + }, + label: { + Text("Dismiss") + .frame(maxWidth: .infinity) + } + ) + .buttonStyle(RoundedRectButtonStyle()) + } .padding(.horizontal) .padding(.bottom) }