popup for nsfw content

This commit is contained in:
Trey t
2022-03-10 11:29:47 -06:00
parent b2519dcd2d
commit 612483e7f0
4 changed files with 33 additions and 7 deletions

View File

@@ -18,11 +18,13 @@ class AppDelegate: NSObject, UIApplicationDelegate {
func application(_ application: UIApplication, willFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey : Any]? = nil) -> Bool {
// PersistenceController.shared.clearDB()
// PersistenceController.shared.deleteLast(numberOfEntries: 5)
// GroupUserDefaults.groupDefaults.set(false, forKey: UserDefaultsStore.Keys.showNSFW.rawValue)
PersistenceController.shared.removeNoForDates()
PersistenceController.shared.fillInMissingDates()
UNUserNotificationCenter.current().delegate = self
let theme = UserDefaultsStore.theme()
UIPageControl.appearance().currentPageIndicatorTintColor = UIColor(textColor)
UIPageControl.appearance().pageIndicatorTintColor = UIColor.systemGray

View File

@@ -22,6 +22,7 @@ class UserDefaultsStore {
case customMoodTint
case customMoodTintUpdateNumber
case textColor
case showNSFW
case contentViewCurrentSelectedHeaderViewBackDays
case contentViewHeaderTag

View File

@@ -19,8 +19,11 @@ struct CustomizeView: View {
@AppStorage(UserDefaultsStore.Keys.customMoodTintUpdateNumber.rawValue, store: GroupUserDefaults.groupDefaults) private var customMoodTintUpdateNumber: Int = 0
@AppStorage(UserDefaultsStore.Keys.textColor.rawValue, store: GroupUserDefaults.groupDefaults) private var textColor: Color = .black
@AppStorage(UserDefaultsStore.Keys.showNSFW.rawValue, store: GroupUserDefaults.groupDefaults) private var showNSFW: Bool = false
@State private var sampleListEntry = PersistenceController.shared.randomEntries(count: 1).first!
@State private var showOver18Alert = false
@StateObject private var customMoodTint = UserDefaultsStore.getCustomMoodTint()
@@ -213,7 +216,6 @@ struct CustomizeView: View {
RoundedRectangle(cornerRadius: 10, style: .continuous)
.fill(imagePack == images ? theme.currentTheme.bgColor : .clear)
.padding([.top, .bottom], -3)
)
.onTapGesture {
let impactMed = UIImpactFeedbackGenerator(style: .heavy)
@@ -403,10 +405,27 @@ struct CustomizeView: View {
.padding(5)
)
.onTapGesture {
let impactMed = UIImpactFeedbackGenerator(style: .heavy)
impactMed.impactOccurred()
personalityPack = aPack
LocalNotification.rescheduleNotifiations()
if aPack.rawValue == PersonalityPack.Rude.rawValue && !showNSFW {
showOver18Alert = true
} else {
let impactMed = UIImpactFeedbackGenerator(style: .heavy)
impactMed.impactOccurred()
personalityPack = aPack
LocalNotification.rescheduleNotifiations()
}
}
.blur(radius: aPack.rawValue == PersonalityPack.Rude.rawValue && !showNSFW ? 5 : 0)
.alert(isPresented: $showOver18Alert) {
let primaryButton = Alert.Button.default(Text(String(localized: "customize_view_over18alert_ok"))) {
showNSFW = true
}
let secondaryButton = Alert.Button.cancel(Text(String(localized: "customize_view_over18alert_no"))) {
showNSFW = false
}
return Alert(title: Text(String(localized: "customize_view_over18alert_title")),
message: Text(String(localized: "customize_view_over18alert_body")),
primaryButton: primaryButton,
secondaryButton: secondaryButton)
}
if aPack.rawValue != (PersonalityPack.allCases.sorted(by: { $0.rawValue > $1.rawValue }).first?.rawValue) ?? 0 {
Divider()

View File

@@ -78,6 +78,10 @@
"customize_view_view_change_icon" = "Change App Icon";
"customize_view_view_text_color" = "Text Color";
"customize_view_view_example_row" = "Example row";
"customize_view_over18alert_title" = "Are you over 18?";
"customize_view_over18alert_body" = "Some of this is explicit, are you over 18?";
"customize_view_over18alert_ok" = "Sure";
"customize_view_over18alert_no" = "Nah, I'm good";
"create_widget_view_left_eye" = "Left Eye";
"create_widget_view_right_eye" = "Right Eye";