wip
This commit is contained in:
108
Shared/Models/PersonalityPackable.swift
Normal file
108
Shared/Models/PersonalityPackable.swift
Normal file
@@ -0,0 +1,108 @@
|
||||
//
|
||||
// NotificationTitles.swift
|
||||
// Feels (iOS)
|
||||
//
|
||||
// Created by Trey Tartt on 2/19/22.
|
||||
//
|
||||
|
||||
import Foundation
|
||||
|
||||
protocol PersonalityPackable {
|
||||
static var notificationTitles: [String] { get }
|
||||
static var notificationBodyToday: [String] { get }
|
||||
static var notificationBodyYesterday: [String] { get }
|
||||
|
||||
static var title: String { get }
|
||||
}
|
||||
|
||||
enum PersonalityPack: Int, CaseIterable {
|
||||
case Default
|
||||
case Rude
|
||||
|
||||
func randomPushNotificationStrings() -> (title: String, body: String) {
|
||||
let onboarding = UserDefaultsStore.getOnboarding()
|
||||
|
||||
switch (self, onboarding.inputDay) {
|
||||
case (.Default, .Today):
|
||||
return (DefaultTitles.notificationTitles.randomElement()!,
|
||||
DefaultTitles.notificationBodyToday.randomElement()!)
|
||||
case (.Default, .Previous):
|
||||
return (DefaultTitles.notificationTitles.randomElement()!,
|
||||
DefaultTitles.notificationBodyYesterday.randomElement()!)
|
||||
case (.Rude, .Today):
|
||||
return (RudeTitles.notificationTitles.randomElement()!,
|
||||
RudeTitles.notificationBodyToday.randomElement()!)
|
||||
case (.Rude, .Previous):
|
||||
return (RudeTitles.notificationTitles.randomElement()!,
|
||||
RudeTitles.notificationBodyYesterday.randomElement()!)
|
||||
}
|
||||
}
|
||||
|
||||
func title() -> String {
|
||||
switch self {
|
||||
case .Default:
|
||||
return DefaultTitles.title
|
||||
case .Rude:
|
||||
return RudeTitles.title
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
final class DefaultTitles: PersonalityPackable {
|
||||
static var title = String(localized: "nice")
|
||||
|
||||
static var notificationTitles: [String] {
|
||||
[
|
||||
String(localized: "default_notif_title_one"),
|
||||
String(localized: "default_notif_title_two"),
|
||||
String(localized: "default_notif_title_three")
|
||||
]
|
||||
}
|
||||
|
||||
static var notificationBodyToday: [String] {
|
||||
[
|
||||
String(localized: "default_notif_body_today_one"),
|
||||
String(localized: "default_notif_body_today_two"),
|
||||
String(localized: "default_notif_body_today_three"),
|
||||
String(localized: "default_notif_body_today_four")
|
||||
]
|
||||
}
|
||||
|
||||
static var notificationBodyYesterday: [String] {
|
||||
[
|
||||
String(localized: "default_notif_body_yesterday_one"),
|
||||
String(localized: "default_notif_body_yesterday_two"),
|
||||
String(localized: "default_notif_body_yesterday_three"),
|
||||
String(localized: "default_notif_body_yesterday_four")
|
||||
]
|
||||
}
|
||||
}
|
||||
|
||||
final class RudeTitles: PersonalityPackable {
|
||||
static var title = String(localized: "rude")
|
||||
|
||||
static var notificationTitles: [String] {
|
||||
[
|
||||
String(localized: "rude_notif_title_one"),
|
||||
String(localized: "rude_notif_title_two"),
|
||||
String(localized: "rude_notif_title_three"),
|
||||
String(localized: "rude_notif_title_four")
|
||||
]
|
||||
}
|
||||
|
||||
static var notificationBodyToday: [String] {
|
||||
[
|
||||
String(localized: "rude_notif_body_today_one"),
|
||||
String(localized: "rude_notif_body_today_two"),
|
||||
String(localized: "rude_notif_body_today_three")
|
||||
]
|
||||
}
|
||||
|
||||
static var notificationBodyYesterday: [String] {
|
||||
[
|
||||
String(localized: "rude_notif_body_yesterday_one"),
|
||||
String(localized: "rude_notif_body_yesterday_two"),
|
||||
String(localized: "rude_notif_body_yesterday_three")
|
||||
]
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user