Request store rating when publishing a post

This commit is contained in:
Thomas Ricouard 2023-02-16 12:14:57 +01:00
parent 41fdb3adde
commit ab0b207596
2 changed files with 9 additions and 0 deletions

View file

@ -50,6 +50,8 @@ public class UserPreferences: ObservableObject {
@AppStorage("font_use_sf_rounded") public var useSFRoundedFont = false @AppStorage("font_use_sf_rounded") public var useSFRoundedFont = false
@AppStorage("requested_review") public var requestedReview = false
public enum SwipeActionsIconStyle: String, CaseIterable { public enum SwipeActionsIconStyle: String, CaseIterable {
case iconWithText, iconOnly case iconWithText, iconOnly

View file

@ -9,8 +9,11 @@ import NukeUI
import PhotosUI import PhotosUI
import SwiftUI import SwiftUI
import UIKit import UIKit
import StoreKit
public struct StatusEditorView: View { public struct StatusEditorView: View {
@Environment(\.requestReview) var requestReview
@EnvironmentObject private var preferences: UserPreferences @EnvironmentObject private var preferences: UserPreferences
@EnvironmentObject private var theme: Theme @EnvironmentObject private var theme: Theme
@EnvironmentObject private var client: Client @EnvironmentObject private var client: Client
@ -195,6 +198,10 @@ public struct StatusEditorView: View {
dismiss() dismiss()
NotificationCenter.default.post(name: NotificationsName.shareSheetClose, NotificationCenter.default.post(name: NotificationsName.shareSheetClose,
object: nil) object: nil)
if !viewModel.mode.isInShareExtension && !preferences.requestedReview {
requestReview()
preferences.requestedReview = true
}
} }
} }