when saving onboarding data update notification time and title
This commit is contained in:
@@ -28,11 +28,12 @@ class LocalNotification {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public class func scheduleReminder(atTime time: Date) {
|
public class func scheduleReminder(atTime time: Date, withTitle title: String) {
|
||||||
let _ = LocalNotification.createNotificationCategory()
|
let _ = LocalNotification.createNotificationCategory()
|
||||||
|
|
||||||
let notificationContent = UNMutableNotificationContent()
|
let notificationContent = UNMutableNotificationContent()
|
||||||
notificationContent.title = "How was your day?"
|
notificationContent.title = title
|
||||||
|
|
||||||
notificationContent.badge = NSNumber(value: 1)
|
notificationContent.badge = NSNumber(value: 1)
|
||||||
notificationContent.sound = .default
|
notificationContent.sound = .default
|
||||||
notificationContent.categoryIdentifier = LocalNotification.categoryName
|
notificationContent.categoryIdentifier = LocalNotification.categoryName
|
||||||
|
|||||||
@@ -26,6 +26,7 @@ class ContentModeViewModel: ObservableObject {
|
|||||||
|
|
||||||
public func updateOnboardingData(onboardingData: OnboardingData) {
|
public func updateOnboardingData(onboardingData: OnboardingData) {
|
||||||
self.savedOnboardingData = UserDefaultsStore.saveOnboarding(onboardingData: onboardingData)
|
self.savedOnboardingData = UserDefaultsStore.saveOnboarding(onboardingData: onboardingData)
|
||||||
|
LocalNotification.scheduleReminder(atTime: onboardingData.date, withTitle: onboardingData.title)
|
||||||
}
|
}
|
||||||
|
|
||||||
private func isMissingCurrentVote() -> Bool {
|
private func isMissingCurrentVote() -> Bool {
|
||||||
|
|||||||
@@ -151,12 +151,6 @@ struct SettingsView: View {
|
|||||||
.clipShape(RoundedRectangle(cornerRadius: 25, style: .continuous))
|
.clipShape(RoundedRectangle(cornerRadius: 25, style: .continuous))
|
||||||
}
|
}
|
||||||
|
|
||||||
private func updateNotificationTimes(toDate date: Date) {
|
|
||||||
LocalNotification.removeNotificaiton()
|
|
||||||
|
|
||||||
LocalNotification.scheduleReminder(atTime: date)
|
|
||||||
}
|
|
||||||
|
|
||||||
private var showOnboardingButton: some View {
|
private var showOnboardingButton: some View {
|
||||||
ZStack {
|
ZStack {
|
||||||
Color(UIColor.systemBackground)
|
Color(UIColor.systemBackground)
|
||||||
|
|||||||
Reference in New Issue
Block a user