remove notification title stuff from onboarding
This commit is contained in:
@@ -31,12 +31,11 @@ class LocalNotification {
|
|||||||
public class func rescheduleNotifiations() {
|
public class func rescheduleNotifiations() {
|
||||||
if let data = GroupUserDefaults.groupDefaults.object(forKey: UserDefaultsStore.Keys.savedOnboardingData.rawValue) as? Data,
|
if let data = GroupUserDefaults.groupDefaults.object(forKey: UserDefaultsStore.Keys.savedOnboardingData.rawValue) as? Data,
|
||||||
let model = try? JSONDecoder().decode(OnboardingData.self, from: data) {
|
let model = try? JSONDecoder().decode(OnboardingData.self, from: data) {
|
||||||
LocalNotification.scheduleReminder(atTime: model.date,
|
LocalNotification.scheduleReminder(atTime: model.date)
|
||||||
withTitle: model.title)
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public class func scheduleReminder(atTime time: Date, withTitle title: String) {
|
public class func scheduleReminder(atTime time: Date) {
|
||||||
self.removeNotificaiton()
|
self.removeNotificaiton()
|
||||||
|
|
||||||
LocalNotification.testIfEnabled(completion: { result in
|
LocalNotification.testIfEnabled(completion: { result in
|
||||||
|
|||||||
@@ -15,6 +15,6 @@ final class OnboardingDataDataManager: ObservableObject {
|
|||||||
public func updateOnboardingData(onboardingData: OnboardingData) {
|
public func updateOnboardingData(onboardingData: OnboardingData) {
|
||||||
let onboardingData = UserDefaultsStore.saveOnboarding(onboardingData: onboardingData)
|
let onboardingData = UserDefaultsStore.saveOnboarding(onboardingData: onboardingData)
|
||||||
savedOnboardingData = onboardingData
|
savedOnboardingData = onboardingData
|
||||||
LocalNotification.scheduleReminder(atTime: onboardingData.date, withTitle: onboardingData.title)
|
LocalNotification.scheduleReminder(atTime: onboardingData.date)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -13,10 +13,9 @@ import UserNotifications
|
|||||||
final class OnboardingData: NSObject, ObservableObject, Codable {
|
final class OnboardingData: NSObject, ObservableObject, Codable {
|
||||||
@Published var date: Date = Date()
|
@Published var date: Date = Date()
|
||||||
@Published var inputDay: DayOptions = .Today
|
@Published var inputDay: DayOptions = .Today
|
||||||
@Published var title: String = OnboardingTitle.titleOptions[0]
|
|
||||||
|
|
||||||
enum CodingKeys: CodingKey {
|
enum CodingKeys: CodingKey {
|
||||||
case date, inputDay, title
|
case date, inputDay
|
||||||
}
|
}
|
||||||
|
|
||||||
func encode(to encoder: Encoder) throws {
|
func encode(to encoder: Encoder) throws {
|
||||||
@@ -24,7 +23,6 @@ final class OnboardingData: NSObject, ObservableObject, Codable {
|
|||||||
|
|
||||||
try container.encode(date, forKey: .date)
|
try container.encode(date, forKey: .date)
|
||||||
try container.encode(inputDay, forKey: .inputDay)
|
try container.encode(inputDay, forKey: .inputDay)
|
||||||
try container.encode(title, forKey: .title)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
required init(from decoder: Decoder) throws {
|
required init(from decoder: Decoder) throws {
|
||||||
@@ -32,7 +30,6 @@ final class OnboardingData: NSObject, ObservableObject, Codable {
|
|||||||
|
|
||||||
date = try container.decode(Date.self, forKey: .date)
|
date = try container.decode(Date.self, forKey: .date)
|
||||||
inputDay = try container.decode(DayOptions.self, forKey: .inputDay)
|
inputDay = try container.decode(DayOptions.self, forKey: .inputDay)
|
||||||
title = try container.decode(String.self, forKey: .title)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func ableToVoteBasedOnCurentTime() -> Bool {
|
func ableToVoteBasedOnCurentTime() -> Bool {
|
||||||
@@ -70,7 +67,6 @@ extension OnboardingData: RawRepresentable {
|
|||||||
|
|
||||||
self.date = result.date
|
self.date = result.date
|
||||||
self.inputDay = result.inputDay
|
self.inputDay = result.inputDay
|
||||||
self.title = result.title
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public var rawValue: String {
|
public var rawValue: String {
|
||||||
|
|||||||
@@ -19,7 +19,7 @@ struct OnboardingMain: View {
|
|||||||
|
|
||||||
OnboardingDay(onboardingData: onboardingData)
|
OnboardingDay(onboardingData: onboardingData)
|
||||||
|
|
||||||
OnboardingTitle(onboardingData: onboardingData)
|
// OnboardingTitle(onboardingData: onboardingData)
|
||||||
|
|
||||||
OnboardingWrapup(onboardingData: onboardingData,
|
OnboardingWrapup(onboardingData: onboardingData,
|
||||||
completionClosure: { _ in
|
completionClosure: { _ in
|
||||||
|
|||||||
@@ -34,7 +34,7 @@ struct OnboardingTitle: View {
|
|||||||
|
|
||||||
ForEach(OnboardingTitle.titleOptions, id: \.self) { option in
|
ForEach(OnboardingTitle.titleOptions, id: \.self) { option in
|
||||||
Button(action: {
|
Button(action: {
|
||||||
onboardingData.title = option
|
// onboardingData.title = option
|
||||||
}, label: {
|
}, label: {
|
||||||
Text(option)
|
Text(option)
|
||||||
.font(.system(size: 15))
|
.font(.system(size: 15))
|
||||||
@@ -54,15 +54,15 @@ struct OnboardingTitle: View {
|
|||||||
.padding([.top], 25)
|
.padding([.top], 25)
|
||||||
.padding([.trailing, .leading], 55)
|
.padding([.trailing, .leading], 55)
|
||||||
|
|
||||||
TextField("Notification", text: $onboardingData.title)
|
// TextField("Notification", text: $onboardingData.title)
|
||||||
.frame(height: 44)
|
// .frame(height: 44)
|
||||||
.foregroundColor(Color(UIColor.white))
|
// .foregroundColor(Color(UIColor.white))
|
||||||
.textFieldStyle(PlainTextFieldStyle())
|
// .textFieldStyle(PlainTextFieldStyle())
|
||||||
.padding([.leading, .trailing], 4)
|
// .padding([.leading, .trailing], 4)
|
||||||
.cornerRadius(16)
|
// .cornerRadius(16)
|
||||||
.overlay(RoundedRectangle(cornerRadius: 16).stroke(Color.white))
|
// .overlay(RoundedRectangle(cornerRadius: 16).stroke(Color.white))
|
||||||
.padding([.leading, .trailing], 75)
|
// .padding([.leading, .trailing], 75)
|
||||||
.padding([.top], 45)
|
// .padding([.top], 45)
|
||||||
|
|
||||||
Spacer()
|
Spacer()
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -44,18 +44,18 @@ struct OnboardingWrapup: View {
|
|||||||
.padding([.trailing, .leading], 55)
|
.padding([.trailing, .leading], 55)
|
||||||
.padding([.top], 15)
|
.padding([.top], 15)
|
||||||
|
|
||||||
Text(String(localized: "onboarding_wrap_up_2"))
|
// Text(String(localized: "onboarding_wrap_up_2"))
|
||||||
.font(.title)
|
// .font(.title)
|
||||||
.foregroundColor(Color(UIColor.white))
|
// .foregroundColor(Color(UIColor.white))
|
||||||
.padding([.trailing, .leading], 55)
|
// .padding([.trailing, .leading], 55)
|
||||||
.padding([.top], 15)
|
// .padding([.top], 15)
|
||||||
|
|
||||||
Text(onboardingData.title)
|
// Text(onboardingData.title)
|
||||||
.font(.title)
|
// .font(.title)
|
||||||
.fontWeight(.bold)
|
// .fontWeight(.bold)
|
||||||
.foregroundColor(Color(UIColor.white))
|
// .foregroundColor(Color(UIColor.white))
|
||||||
.padding([.trailing, .leading], 55)
|
// .padding([.trailing, .leading], 55)
|
||||||
.padding([.top], 15)
|
// .padding([.top], 15)
|
||||||
|
|
||||||
Text(String(localized: "onboarding_wrap_up_3"))
|
Text(String(localized: "onboarding_wrap_up_3"))
|
||||||
.font(.title)
|
.font(.title)
|
||||||
|
|||||||
Reference in New Issue
Block a user