From ab0b207596bb29efc81dae7d35dd09a9f6d567a6 Mon Sep 17 00:00:00 2001 From: Thomas Ricouard Date: Thu, 16 Feb 2023 12:14:57 +0100 Subject: [PATCH] Request store rating when publishing a post --- Packages/Env/Sources/Env/UserPreferences.swift | 2 ++ .../Status/Sources/Status/Editor/StatusEditorView.swift | 7 +++++++ 2 files changed, 9 insertions(+) diff --git a/Packages/Env/Sources/Env/UserPreferences.swift b/Packages/Env/Sources/Env/UserPreferences.swift index 98d937e8..dc990dc6 100644 --- a/Packages/Env/Sources/Env/UserPreferences.swift +++ b/Packages/Env/Sources/Env/UserPreferences.swift @@ -49,6 +49,8 @@ public class UserPreferences: ObservableObject { @AppStorage("swipeactions-icon-style") public var swipeActionsIconStyle: SwipeActionsIconStyle = .iconWithText @AppStorage("font_use_sf_rounded") public var useSFRoundedFont = false + + @AppStorage("requested_review") public var requestedReview = false public enum SwipeActionsIconStyle: String, CaseIterable { case iconWithText, iconOnly diff --git a/Packages/Status/Sources/Status/Editor/StatusEditorView.swift b/Packages/Status/Sources/Status/Editor/StatusEditorView.swift index 2c79e6e3..ef5160cd 100644 --- a/Packages/Status/Sources/Status/Editor/StatusEditorView.swift +++ b/Packages/Status/Sources/Status/Editor/StatusEditorView.swift @@ -9,8 +9,11 @@ import NukeUI import PhotosUI import SwiftUI import UIKit +import StoreKit public struct StatusEditorView: View { + @Environment(\.requestReview) var requestReview + @EnvironmentObject private var preferences: UserPreferences @EnvironmentObject private var theme: Theme @EnvironmentObject private var client: Client @@ -195,6 +198,10 @@ public struct StatusEditorView: View { dismiss() NotificationCenter.default.post(name: NotificationsName.shareSheetClose, object: nil) + if !viewModel.mode.isInShareExtension && !preferences.requestedReview { + requestReview() + preferences.requestedReview = true + } } }