closed #90
This commit is contained in:
@@ -45,7 +45,9 @@ class LocalNotification {
|
||||
let _ = LocalNotification.createNotificationCategory()
|
||||
|
||||
let notificationContent = UNMutableNotificationContent()
|
||||
notificationContent.title = UserDefaultsStore.personalityPackable().randomPushNotificationTitle()
|
||||
let strings = UserDefaultsStore.personalityPackable().randomPushNotificationStrings()
|
||||
notificationContent.title = strings.title
|
||||
notificationContent.body = strings.body
|
||||
|
||||
notificationContent.badge = NSNumber(value: 1)
|
||||
notificationContent.sound = .default
|
||||
@@ -65,7 +67,8 @@ class LocalNotification {
|
||||
print(theError.localizedDescription)
|
||||
}
|
||||
}
|
||||
case .failure(_):
|
||||
case .failure(let error):
|
||||
print(error)
|
||||
// Todo: show enable this
|
||||
break
|
||||
}
|
||||
|
||||
@@ -8,9 +8,10 @@
|
||||
import Foundation
|
||||
|
||||
protocol PersonalityPackable {
|
||||
static var notificationTitlesToday: [String] { get }
|
||||
static var notificationTitlesYesterday: [String] { get }
|
||||
static var notificationTitlesTwoDaysAgo: [String] { get }
|
||||
static var notificationTitles: [String] { get }
|
||||
static var notificationBodyToday: [String] { get }
|
||||
static var notificationBodyYesterday: [String] { get }
|
||||
static var notificationBodyTwoDaysAgo: [String] { get }
|
||||
|
||||
static var title: String { get }
|
||||
}
|
||||
@@ -19,12 +20,12 @@ enum PersonalityPack: Int, CaseIterable {
|
||||
case Default
|
||||
case Rude
|
||||
|
||||
func randomPushNotificationTitle() -> String {
|
||||
func randomPushNotificationStrings() -> (title: String, body: String) {
|
||||
switch self {
|
||||
case .Default:
|
||||
return DefaultTitles.notificationTitlesToday.randomElement()!
|
||||
return (DefaultTitles.notificationTitles.randomElement()!, DefaultTitles.notificationBodyToday.randomElement()!)
|
||||
case .Rude:
|
||||
return RudeTitles.notificationTitlesToday.randomElement()!
|
||||
return (RudeTitles.notificationTitles.randomElement()!, RudeTitles.notificationBodyToday.randomElement()!)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -41,7 +42,7 @@ enum PersonalityPack: Int, CaseIterable {
|
||||
final class DefaultTitles: PersonalityPackable {
|
||||
static var title = "Nice"
|
||||
|
||||
static var notificationTitlesToday: [String] {
|
||||
static var notificationTitles: [String] {
|
||||
[
|
||||
"How was your day",
|
||||
"Don't forget to rate your day",
|
||||
@@ -49,14 +50,22 @@ final class DefaultTitles: PersonalityPackable {
|
||||
]
|
||||
}
|
||||
|
||||
static var notificationTitlesYesterday: [String] {
|
||||
static var notificationBodyToday: [String] {
|
||||
[
|
||||
"How was your day",
|
||||
"Don't forget to rate your day",
|
||||
"Please rate your day"
|
||||
]
|
||||
}
|
||||
|
||||
static var notificationBodyYesterday: [String] {
|
||||
[
|
||||
"How was your day",
|
||||
"Don't forget to rate your day"
|
||||
]
|
||||
}
|
||||
|
||||
static var notificationTitlesTwoDaysAgo: [String] {
|
||||
static var notificationBodyTwoDaysAgo: [String] {
|
||||
[
|
||||
"How was your day",
|
||||
"Don't forget to rate your day"
|
||||
@@ -67,22 +76,29 @@ final class DefaultTitles: PersonalityPackable {
|
||||
final class RudeTitles: PersonalityPackable {
|
||||
static var title = "Rude"
|
||||
|
||||
static var notificationTitlesToday: [String] {
|
||||
static var notificationTitles: [String] {
|
||||
[
|
||||
"How the fuck was your day",
|
||||
"Hey asshat, tell me how your day was",
|
||||
"Hey, lazy dickbag, rate your day"
|
||||
"Hey asshat",
|
||||
"Hey lazy dickbag, "
|
||||
]
|
||||
}
|
||||
|
||||
static var notificationTitlesYesterday: [String] {
|
||||
static var notificationBodyToday: [String] {
|
||||
[
|
||||
"How the fuck was your day",
|
||||
"tell me how your day was",
|
||||
"rate your day"
|
||||
]
|
||||
}
|
||||
|
||||
static var notificationBodyYesterday: [String] {
|
||||
[
|
||||
"How was your day",
|
||||
"Don't forget to rate your day"
|
||||
]
|
||||
}
|
||||
|
||||
static var notificationTitlesTwoDaysAgo: [String] {
|
||||
static var notificationBodyTwoDaysAgo: [String] {
|
||||
[
|
||||
"How was your day",
|
||||
"Don't forget to rate your day"
|
||||
|
||||
@@ -267,8 +267,10 @@ struct CustomizeView: View {
|
||||
.font(.body)
|
||||
.foregroundColor(theme.currentTheme.labelColor)
|
||||
|
||||
|
||||
Text(aPack.randomPushNotificationTitle())
|
||||
Text(aPack.randomPushNotificationStrings().title)
|
||||
.font(.body)
|
||||
.foregroundColor(Color(UIColor.systemGray))
|
||||
Text(aPack.randomPushNotificationStrings().body)
|
||||
.font(.body)
|
||||
.foregroundColor(Color(UIColor.systemGray))
|
||||
}
|
||||
@@ -279,7 +281,6 @@ struct CustomizeView: View {
|
||||
RoundedRectangle(cornerRadius: 10, style: .continuous)
|
||||
.fill(personalityPack == aPack ? theme.currentTheme.bgColor : .clear)
|
||||
.padding(5)
|
||||
|
||||
)
|
||||
.onTapGesture {
|
||||
let impactMed = UIImpactFeedbackGenerator(style: .heavy)
|
||||
|
||||
Reference in New Issue
Block a user