WIP
This commit is contained in:
@@ -25,7 +25,7 @@ struct FeelsApp: App {
|
||||
}
|
||||
UIApplication.shared.applicationIconBadgeNumber = 0
|
||||
// PersistenceController.shared.clearDB()
|
||||
PersistenceController.shared.populateMemory()
|
||||
// PersistenceController.shared.populateMemory()
|
||||
}
|
||||
|
||||
var body: some Scene {
|
||||
|
||||
@@ -23,6 +23,8 @@ class IAPManager: ObservableObject {
|
||||
@Published private(set) var subscriptions = [Product: (status: [Product.SubscriptionInfo.Status], renewalInfo: RenewalInfo)?]()
|
||||
@AppStorage(UserDefaultsStore.Keys.firstLaunchDate.rawValue, store: GroupUserDefaults.groupDefaults) private var firstLaunchDate = Date()
|
||||
|
||||
@Published private(set) var isLoadingSubscriptions = false
|
||||
|
||||
public var sortedSubscriptionKeysByPriceOptions: [Product] {
|
||||
subscriptions.keys.sorted(by: {
|
||||
$0.price < $1.price
|
||||
@@ -89,7 +91,7 @@ class IAPManager: ObservableObject {
|
||||
}
|
||||
|
||||
private let iapIdentifiers = Set([
|
||||
"com.88oakapps.ifeel.IAP.subscriptions.weekly",
|
||||
// "com.88oakapps.ifeel.IAP.subscriptions.weekly",
|
||||
"com.88oakapps.ifeel.IAP.subscriptions.monthly",
|
||||
"com.88oakapps.ifeel.IAP.subscriptions.yearly"
|
||||
])
|
||||
@@ -97,6 +99,8 @@ class IAPManager: ObservableObject {
|
||||
var expireOnTimer: Timer?
|
||||
|
||||
init() {
|
||||
isLoadingSubscriptions = true
|
||||
|
||||
//Start a transaction listener as close to app launch as possible so you don't miss any transactions.
|
||||
updateListenerTask = listenForTransactions()
|
||||
|
||||
@@ -133,6 +137,9 @@ class IAPManager: ObservableObject {
|
||||
|
||||
decideShowIAP()
|
||||
decideShowIAPWarning()
|
||||
DispatchQueue.main.async {
|
||||
self.isLoadingSubscriptions = false
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -26,6 +26,7 @@ extension PersistenceController {
|
||||
}
|
||||
|
||||
func populateMemory() {
|
||||
#if debug
|
||||
for idx in 1..<255 {
|
||||
let newItem = MoodEntry(context: viewContext)
|
||||
newItem.timestamp = Calendar.current.date(byAdding: .day, value: -idx, to: Date())
|
||||
@@ -48,6 +49,7 @@ extension PersistenceController {
|
||||
let nsError = error as NSError
|
||||
fatalError("Unresolved error \(nsError), \(nsError.userInfo)")
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
func generateObjectNotInArray(forDate date: Date = Date(), withMood mood: Mood = .placeholder) -> MoodEntry {
|
||||
@@ -88,10 +90,10 @@ extension PersistenceController {
|
||||
}
|
||||
|
||||
func longestStreak() -> [MoodEntry] {
|
||||
// let predicate = NSPredicate(format: "forDate == %@", date as NSDate)
|
||||
// let predicate = NSPredicate(format: "forDate == %@", date as NSDate)
|
||||
|
||||
let fetchRequest = NSFetchRequest<MoodEntry>(entityName: "MoodEntry")
|
||||
// fetchRequest.predicate = predicate
|
||||
// fetchRequest.predicate = predicate
|
||||
fetchRequest.sortDescriptors = [NSSortDescriptor(key: "forDate", ascending: true)]
|
||||
let data = try! viewContext.fetch(fetchRequest)
|
||||
return data
|
||||
|
||||
@@ -17,6 +17,7 @@ struct IAPWarningView: View {
|
||||
|
||||
private let height: Float
|
||||
private let showManageSubClosure: (() -> Void)?
|
||||
|
||||
@State private var showSettings = false
|
||||
|
||||
public init(height: Float, iapManager: IAPManager, showManageSubClosure: (() -> Void)? = nil, showCountdownTimer: Bool = false) {
|
||||
@@ -27,25 +28,31 @@ struct IAPWarningView: View {
|
||||
|
||||
var body: some View {
|
||||
VStack {
|
||||
Text(String(format: String(localized: "iap_warning_view_title"), iapManager.daysLeftBeforeIAP))
|
||||
.font(.body)
|
||||
.frame(minWidth: 0, maxWidth: .infinity)
|
||||
.background(theme.currentTheme.secondaryBGColor)
|
||||
|
||||
Button(action: {
|
||||
showSettings.toggle()
|
||||
}, label: {
|
||||
Text(String(localized: "iap_warning_view_buy_button"))
|
||||
.foregroundColor(.white)
|
||||
if let date = Calendar.current.date(byAdding: .day, value: 30, to: firstLaunchDate) {
|
||||
Text(String(localized: "iap_warning_view_title"))
|
||||
.font(.body)
|
||||
.frame(minWidth: 0, maxWidth: .infinity)
|
||||
.background(theme.currentTheme.secondaryBGColor)
|
||||
|
||||
Text(date, style: .relative)
|
||||
.font(.body)
|
||||
.bold()
|
||||
.frame(maxWidth: .infinity)
|
||||
.contentShape(Rectangle())
|
||||
})
|
||||
.frame(maxWidth: .infinity)
|
||||
.frame(height: 50)
|
||||
.background(RoundedRectangle(cornerRadius: 10).fill(DefaultMoodTint.color(forMood: .great)))
|
||||
.foregroundColor(textColor)
|
||||
|
||||
Button(action: {
|
||||
showSettings.toggle()
|
||||
}, label: {
|
||||
Text(String(localized: "iap_warning_view_buy_button"))
|
||||
.foregroundColor(.white)
|
||||
.bold()
|
||||
.frame(maxWidth: .infinity)
|
||||
.contentShape(Rectangle())
|
||||
})
|
||||
.frame(maxWidth: .infinity)
|
||||
.frame(height: 50)
|
||||
.background(RoundedRectangle(cornerRadius: 10).fill(DefaultMoodTint.color(forMood: .great)))
|
||||
}
|
||||
}
|
||||
// .frame(height: CGFloat(height))
|
||||
.frame(minWidth: 0, maxWidth: .infinity)
|
||||
.padding()
|
||||
.background(theme.currentTheme.secondaryBGColor)
|
||||
|
||||
@@ -116,7 +116,6 @@ struct MonthView: View {
|
||||
}
|
||||
}
|
||||
.onPreferenceChange(ViewOffsetKey.self) { value in
|
||||
print(value)
|
||||
iAPWarningViewHidden = value < 0
|
||||
}
|
||||
}
|
||||
|
||||
@@ -100,65 +100,77 @@ struct PurchaseButtonView: View {
|
||||
VStack {
|
||||
ZStack {
|
||||
theme.currentTheme.secondaryBGColor
|
||||
VStack(spacing: 20) {
|
||||
Text(String(localized: "purchase_view_title"))
|
||||
.font(.body)
|
||||
.bold()
|
||||
.foregroundColor(textColor)
|
||||
.frame(minWidth: 0, maxWidth: .infinity, alignment: .leading)
|
||||
|
||||
if showCountdownTimer {
|
||||
if let date = Calendar.current.date(byAdding: .day, value: 30, to: firstLaunchDate) {
|
||||
HStack {
|
||||
if iapManager.daysLeftBeforeIAP > 0 {
|
||||
Text(String(localized: "purchase_view_current_subscription_expires_in"))
|
||||
.font(.body)
|
||||
.bold()
|
||||
.foregroundColor(textColor)
|
||||
|
||||
Text(date, style: .relative)
|
||||
.font(.body)
|
||||
.bold()
|
||||
.foregroundColor(textColor)
|
||||
} else {
|
||||
Text(String(localized: "purchase_view_current_subscription_expired_on"))
|
||||
.font(.body)
|
||||
.bold()
|
||||
.foregroundColor(textColor)
|
||||
|
||||
Text(date, style: .date)
|
||||
.font(.body)
|
||||
.bold()
|
||||
.foregroundColor(textColor)
|
||||
}
|
||||
}
|
||||
.frame(minWidth: 0, maxWidth: .infinity, alignment: .leading)
|
||||
}
|
||||
}
|
||||
HStack {
|
||||
ForEach(iapManager.sortedSubscriptionKeysByPriceOptions) { product in
|
||||
Button(action: {
|
||||
purchase(product: product)
|
||||
}, label: {
|
||||
Text("\(product.displayPrice)\n\(product.displayName)")
|
||||
.foregroundColor(.white)
|
||||
.bold()
|
||||
.frame(maxWidth: .infinity)
|
||||
.contentShape(Rectangle())
|
||||
})
|
||||
.padding()
|
||||
.frame(maxWidth: .infinity)
|
||||
.background(RoundedRectangle(cornerRadius: 10).fill(iapManager.colorForIAPButton(iapIdentifier: product.id)))
|
||||
}
|
||||
}
|
||||
}
|
||||
.padding([.leading, .trailing])
|
||||
.frame(minWidth: 0, maxWidth: .infinity)
|
||||
|
||||
if iapManager.isLoadingSubscriptions {
|
||||
VStack(spacing: 20) {
|
||||
Text(String(localized: "purchase_view_loading"))
|
||||
.font(.body)
|
||||
.bold()
|
||||
.frame(minWidth: 0, maxWidth: .infinity, alignment: .center)
|
||||
ProgressView()
|
||||
}
|
||||
} else {
|
||||
|
||||
VStack(spacing: 20) {
|
||||
Text(String(localized: "purchase_view_title"))
|
||||
.font(.body)
|
||||
.bold()
|
||||
.foregroundColor(textColor)
|
||||
.frame(minWidth: 0, maxWidth: .infinity, alignment: .leading)
|
||||
|
||||
if showCountdownTimer {
|
||||
if let date = Calendar.current.date(byAdding: .day, value: 30, to: firstLaunchDate) {
|
||||
HStack {
|
||||
if iapManager.daysLeftBeforeIAP > 0 {
|
||||
Text(String(localized: "purchase_view_current_subscription_expires_in"))
|
||||
.font(.body)
|
||||
.bold()
|
||||
.foregroundColor(textColor)
|
||||
|
||||
Text(date, style: .relative)
|
||||
.font(.body)
|
||||
.bold()
|
||||
.foregroundColor(textColor)
|
||||
} else {
|
||||
Text(String(localized: "purchase_view_current_subscription_expired_on"))
|
||||
.font(.body)
|
||||
.bold()
|
||||
.foregroundColor(textColor)
|
||||
|
||||
Text(date, style: .date)
|
||||
.font(.body)
|
||||
.bold()
|
||||
.foregroundColor(textColor)
|
||||
}
|
||||
}
|
||||
.frame(minWidth: 0, maxWidth: .infinity, alignment: .leading)
|
||||
}
|
||||
}
|
||||
HStack {
|
||||
ForEach(iapManager.sortedSubscriptionKeysByPriceOptions) { product in
|
||||
Button(action: {
|
||||
purchase(product: product)
|
||||
}, label: {
|
||||
Text("\(product.displayPrice)\n\(product.displayName)")
|
||||
.foregroundColor(.white)
|
||||
.bold()
|
||||
.frame(maxWidth: .infinity)
|
||||
.contentShape(Rectangle())
|
||||
})
|
||||
.padding()
|
||||
.frame(maxWidth: .infinity)
|
||||
.background(RoundedRectangle(cornerRadius: 10).fill(iapManager.colorForIAPButton(iapIdentifier: product.id)))
|
||||
}
|
||||
}
|
||||
}
|
||||
.padding([.leading, .trailing])
|
||||
.frame(minWidth: 0, maxWidth: .infinity)
|
||||
|
||||
}
|
||||
}
|
||||
.background(.ultraThinMaterial)
|
||||
.frame(minWidth: 0, maxWidth: .infinity)
|
||||
}
|
||||
.background(.ultraThinMaterial)
|
||||
.frame(minWidth: 0, maxWidth: .infinity)
|
||||
.background(.clear)
|
||||
}
|
||||
|
||||
|
||||
@@ -19,7 +19,7 @@ struct SettingsView: View {
|
||||
@State private var importContent = ""
|
||||
|
||||
@State private var showOnboarding = false
|
||||
|
||||
|
||||
@State private var showSpecialThanks = false
|
||||
@State private var showWhyBGMode = false
|
||||
@ObservedObject var syncMonitor = SyncMonitor.shared
|
||||
@@ -29,7 +29,7 @@ struct SettingsView: View {
|
||||
@AppStorage(UserDefaultsStore.Keys.theme.rawValue, store: GroupUserDefaults.groupDefaults) private var theme: Theme = .system
|
||||
@AppStorage(UserDefaultsStore.Keys.textColor.rawValue, store: GroupUserDefaults.groupDefaults) private var textColor: Color = DefaultTextColor.textColor
|
||||
@AppStorage(UserDefaultsStore.Keys.firstLaunchDate.rawValue, store: GroupUserDefaults.groupDefaults) private var firstLaunchDate = Date()
|
||||
|
||||
|
||||
var body: some View {
|
||||
ScrollView {
|
||||
VStack {
|
||||
@@ -37,24 +37,25 @@ struct SettingsView: View {
|
||||
closeButtonView
|
||||
.padding()
|
||||
|
||||
// cloudKitEnable
|
||||
// cloudKitEnable
|
||||
subscriptionInfoView
|
||||
canDelete
|
||||
showOnboardingButton
|
||||
specialThanksCell
|
||||
// specialThanksCell
|
||||
}
|
||||
|
||||
#if DEBUG
|
||||
Group {
|
||||
Divider()
|
||||
Text("Test builds only")
|
||||
addTestDataCell
|
||||
clearDB
|
||||
// randomIcons
|
||||
// randomIcons
|
||||
|
||||
if useCloudKit {
|
||||
cloudKitStatus
|
||||
}
|
||||
// fixWeekday
|
||||
// fixWeekday
|
||||
exportData
|
||||
importData
|
||||
editFirstLaunchDatePast
|
||||
@@ -62,7 +63,7 @@ struct SettingsView: View {
|
||||
Divider()
|
||||
}
|
||||
Spacer()
|
||||
|
||||
#endif
|
||||
Text("\(Bundle.main.appName) v \(Bundle.main.versionNumber) (Build \(Bundle.main.buildNumber))")
|
||||
.font(.body)
|
||||
}
|
||||
@@ -126,7 +127,7 @@ struct SettingsView: View {
|
||||
|
||||
let localTime = dateFormatter.date(from: columns[3])!
|
||||
moodEntry.weekDay = Int16(Calendar.current.component(.weekday, from: localTime))
|
||||
// let _ = print("import info: ", columns[3], dateFormatter.date(from: columns[3]), localTime, Int16(Calendar.current.component(.weekday, from: localTime)))
|
||||
// let _ = print("import info: ", columns[3], dateFormatter.date(from: columns[3]), localTime, Int16(Calendar.current.component(.weekday, from: localTime)))
|
||||
try! PersistenceController.shared.viewContext.save()
|
||||
}
|
||||
PersistenceController.shared.saveAndRunDataListerners()
|
||||
@@ -184,7 +185,7 @@ struct SettingsView: View {
|
||||
Text(String(localized: "settings_view_special_thanks_to_title"))
|
||||
.foregroundColor(textColor)
|
||||
})
|
||||
.padding()
|
||||
.padding()
|
||||
|
||||
if showSpecialThanks {
|
||||
Divider()
|
||||
@@ -213,7 +214,7 @@ struct SettingsView: View {
|
||||
Text("Add test data")
|
||||
.foregroundColor(textColor)
|
||||
})
|
||||
.padding()
|
||||
.padding()
|
||||
}
|
||||
.fixedSize(horizontal: false, vertical: true)
|
||||
.cornerRadius(Constants.viewsCornerRaidus, corners: [.topLeft, .topRight, .bottomLeft, .bottomRight])
|
||||
@@ -263,7 +264,7 @@ struct SettingsView: View {
|
||||
Text("Clear DB")
|
||||
.foregroundColor(textColor)
|
||||
})
|
||||
.padding()
|
||||
.padding()
|
||||
}
|
||||
.fixedSize(horizontal: false, vertical: true)
|
||||
.cornerRadius(Constants.viewsCornerRaidus, corners: [.topLeft, .topRight, .bottomLeft, .bottomRight])
|
||||
@@ -278,7 +279,7 @@ struct SettingsView: View {
|
||||
Text("Fix Weekday")
|
||||
.foregroundColor(textColor)
|
||||
})
|
||||
.padding()
|
||||
.padding()
|
||||
}
|
||||
.fixedSize(horizontal: false, vertical: true)
|
||||
.cornerRadius(Constants.viewsCornerRaidus, corners: [.topLeft, .topRight, .bottomLeft, .bottomRight])
|
||||
@@ -296,7 +297,7 @@ struct SettingsView: View {
|
||||
Text(String(localized: "settings_view_why_bg_mode_title"))
|
||||
.foregroundColor(textColor)
|
||||
})
|
||||
.padding()
|
||||
.padding()
|
||||
if showWhyBGMode {
|
||||
Text(String(localized: "settings_view_why_bg_mode_body"))
|
||||
.foregroundColor(textColor)
|
||||
@@ -318,7 +319,7 @@ struct SettingsView: View {
|
||||
Text(String(localized: "settings_view_show_onboarding"))
|
||||
.foregroundColor(textColor)
|
||||
})
|
||||
.padding()
|
||||
.padding()
|
||||
}
|
||||
.fixedSize(horizontal: false, vertical: true)
|
||||
.cornerRadius(Constants.viewsCornerRaidus, corners: [.topLeft, .topRight, .bottomLeft, .bottomRight])
|
||||
@@ -332,10 +333,10 @@ struct SettingsView: View {
|
||||
Text(String(localized: "settings_use_cloudkit_title"))
|
||||
.foregroundColor(textColor)
|
||||
})
|
||||
.onChange(of: useCloudKit) { newValue in
|
||||
EventLogger.log(event: "toggle_use_cloudkit", withData: ["value": newValue])
|
||||
}
|
||||
.padding()
|
||||
.onChange(of: useCloudKit) { newValue in
|
||||
EventLogger.log(event: "toggle_use_cloudkit", withData: ["value": newValue])
|
||||
}
|
||||
.padding()
|
||||
Text(String(localized: "settings_use_cloudkit_body"))
|
||||
.foregroundColor(textColor)
|
||||
}
|
||||
@@ -366,11 +367,11 @@ struct SettingsView: View {
|
||||
VStack {
|
||||
Toggle(String(localized: "settings_use_delete_enable"),
|
||||
isOn: $deleteEnabled)
|
||||
.onChange(of: deleteEnabled) { newValue in
|
||||
EventLogger.log(event: "toggle_can_delete", withData: ["value": newValue])
|
||||
}
|
||||
.foregroundColor(textColor)
|
||||
.padding()
|
||||
.onChange(of: deleteEnabled) { newValue in
|
||||
EventLogger.log(event: "toggle_can_delete", withData: ["value": newValue])
|
||||
}
|
||||
.foregroundColor(textColor)
|
||||
.padding()
|
||||
}
|
||||
}
|
||||
.fixedSize(horizontal: false, vertical: true)
|
||||
@@ -387,12 +388,12 @@ struct SettingsView: View {
|
||||
Text("Export")
|
||||
.foregroundColor(textColor)
|
||||
})
|
||||
.padding()
|
||||
.padding()
|
||||
}
|
||||
.fixedSize(horizontal: false, vertical: true)
|
||||
.cornerRadius(Constants.viewsCornerRaidus, corners: [.topLeft, .topRight, .bottomLeft, .bottomRight])
|
||||
}
|
||||
|
||||
|
||||
private var importData: some View {
|
||||
ZStack {
|
||||
theme.currentTheme.secondaryBGColor
|
||||
@@ -403,7 +404,7 @@ struct SettingsView: View {
|
||||
Text("Import")
|
||||
.foregroundColor(textColor)
|
||||
})
|
||||
.padding()
|
||||
.padding()
|
||||
}
|
||||
.fixedSize(horizontal: false, vertical: true)
|
||||
.cornerRadius(Constants.viewsCornerRaidus, corners: [.topLeft, .topRight, .bottomLeft, .bottomRight])
|
||||
@@ -414,17 +415,17 @@ struct SettingsView: View {
|
||||
theme.currentTheme.secondaryBGColor
|
||||
Button(action: {
|
||||
var iconViews = [UIImage]()
|
||||
|
||||
// for _ in 0...300 {
|
||||
// iconViews.append(
|
||||
// IconView(iconViewModel: IconViewModel(
|
||||
// backgroundImage: MoodImages.FontAwesome.icon(forMood: .great),
|
||||
// bgColor: Color.random(),
|
||||
// bgOverlayColor: Color.random(),
|
||||
// centerImage: MoodImages.FontAwesome.icon(forMood: .great),
|
||||
// innerColor: Color.random())
|
||||
// ).asImage(size: CGSize(width: 1024, height: 1024)))
|
||||
// }
|
||||
|
||||
// for _ in 0...300 {
|
||||
// iconViews.append(
|
||||
// IconView(iconViewModel: IconViewModel(
|
||||
// backgroundImage: MoodImages.FontAwesome.icon(forMood: .great),
|
||||
// bgColor: Color.random(),
|
||||
// bgOverlayColor: Color.random(),
|
||||
// centerImage: MoodImages.FontAwesome.icon(forMood: .great),
|
||||
// innerColor: Color.random())
|
||||
// ).asImage(size: CGSize(width: 1024, height: 1024)))
|
||||
// }
|
||||
|
||||
iconViews.append(
|
||||
IconView(iconViewModel: IconViewModel(
|
||||
@@ -433,7 +434,7 @@ struct SettingsView: View {
|
||||
bgOverlayColor: IconViewModel.great.bgOverlayColor,
|
||||
centerImage: MoodImages.FontAwesome.icon(forMood: .great),
|
||||
innerColor: IconViewModel.great.innerColor)
|
||||
).asImage(size: CGSize(width: 1024, height: 1024))
|
||||
).asImage(size: CGSize(width: 1024, height: 1024))
|
||||
)
|
||||
|
||||
iconViews.append(
|
||||
@@ -443,7 +444,7 @@ struct SettingsView: View {
|
||||
bgOverlayColor: IconViewModel.good.bgOverlayColor,
|
||||
centerImage: MoodImages.FontAwesome.icon(forMood: .great),
|
||||
innerColor: IconViewModel.good.innerColor)
|
||||
).asImage(size: CGSize(width: 1024, height: 1024))
|
||||
).asImage(size: CGSize(width: 1024, height: 1024))
|
||||
)
|
||||
|
||||
iconViews.append(
|
||||
@@ -453,7 +454,7 @@ struct SettingsView: View {
|
||||
bgOverlayColor: IconViewModel.average.bgOverlayColor,
|
||||
centerImage: MoodImages.FontAwesome.icon(forMood: .great),
|
||||
innerColor: IconViewModel.average.innerColor)
|
||||
).asImage(size: CGSize(width: 1024, height: 1024))
|
||||
).asImage(size: CGSize(width: 1024, height: 1024))
|
||||
)
|
||||
|
||||
iconViews.append(
|
||||
@@ -463,7 +464,7 @@ struct SettingsView: View {
|
||||
bgOverlayColor: IconViewModel.bad.bgOverlayColor,
|
||||
centerImage: MoodImages.FontAwesome.icon(forMood: .great),
|
||||
innerColor: IconViewModel.bad.innerColor)
|
||||
).asImage(size: CGSize(width: 1024, height: 1024))
|
||||
).asImage(size: CGSize(width: 1024, height: 1024))
|
||||
)
|
||||
|
||||
iconViews.append(
|
||||
@@ -473,49 +474,49 @@ struct SettingsView: View {
|
||||
bgOverlayColor: IconViewModel.horrible.bgOverlayColor,
|
||||
centerImage: MoodImages.FontAwesome.icon(forMood: .great),
|
||||
innerColor: IconViewModel.horrible.innerColor)
|
||||
).asImage(size: CGSize(width: 1024, height: 1024))
|
||||
).asImage(size: CGSize(width: 1024, height: 1024))
|
||||
)
|
||||
|
||||
|
||||
// iconViews.append(
|
||||
// IconView(iconViewModel: IconViewModel(
|
||||
// backgroundImage: MoodImages.FontAwesome.icon(forMood: .great),
|
||||
// bgColor: Color(hex: "EF0CF3"),
|
||||
// bgOverlayColor: Color(hex: "EF0CF3").darker(by: 40),
|
||||
// centerImage: MoodImages.FontAwesome.icon(forMood: .great),
|
||||
// innerColor: Color(hex: "EF0CF3"))
|
||||
// ).asImage(size: CGSize(width: 1024, height: 1024))
|
||||
// )
|
||||
//
|
||||
// iconViews.append(
|
||||
// IconView(iconViewModel: IconViewModel(
|
||||
// backgroundImage: MoodImages.FontAwesome.icon(forMood: .great),
|
||||
// bgColor: Color(hex: "1AE5D6"),
|
||||
// bgOverlayColor: Color(hex: "1AE5D6").darker(by: 40),
|
||||
// centerImage: MoodImages.FontAwesome.icon(forMood: .great),
|
||||
// innerColor: Color(hex: "1AE5D6"))
|
||||
// ).asImage(size: CGSize(width: 1024, height: 1024))
|
||||
// )
|
||||
//
|
||||
// iconViews.append(
|
||||
// IconView(iconViewModel: IconViewModel(
|
||||
// backgroundImage: MoodImages.FontAwesome.icon(forMood: .great),
|
||||
// bgColor: Color(hex: "633EC1"),
|
||||
// bgOverlayColor: Color(hex: "633EC1").darker(by: 40),
|
||||
// centerImage: MoodImages.FontAwesome.icon(forMood: .great),
|
||||
// innerColor: Color(hex: "633EC1"))
|
||||
// ).asImage(size: CGSize(width: 1024, height: 1024))
|
||||
// )
|
||||
//
|
||||
// iconViews.append(
|
||||
// IconView(iconViewModel: IconViewModel(
|
||||
// backgroundImage: MoodImages.FontAwesome.icon(forMood: .great),
|
||||
// bgColor: Color(hex: "10F30C"),
|
||||
// bgOverlayColor: Color(hex: "10F30C").darker(by: 40),
|
||||
// centerImage: MoodImages.FontAwesome.icon(forMood: .great),
|
||||
// innerColor: Color(hex: "10F30C"))
|
||||
// ).asImage(size: CGSize(width: 1024, height: 1024))
|
||||
// )
|
||||
// iconViews.append(
|
||||
// IconView(iconViewModel: IconViewModel(
|
||||
// backgroundImage: MoodImages.FontAwesome.icon(forMood: .great),
|
||||
// bgColor: Color(hex: "EF0CF3"),
|
||||
// bgOverlayColor: Color(hex: "EF0CF3").darker(by: 40),
|
||||
// centerImage: MoodImages.FontAwesome.icon(forMood: .great),
|
||||
// innerColor: Color(hex: "EF0CF3"))
|
||||
// ).asImage(size: CGSize(width: 1024, height: 1024))
|
||||
// )
|
||||
//
|
||||
// iconViews.append(
|
||||
// IconView(iconViewModel: IconViewModel(
|
||||
// backgroundImage: MoodImages.FontAwesome.icon(forMood: .great),
|
||||
// bgColor: Color(hex: "1AE5D6"),
|
||||
// bgOverlayColor: Color(hex: "1AE5D6").darker(by: 40),
|
||||
// centerImage: MoodImages.FontAwesome.icon(forMood: .great),
|
||||
// innerColor: Color(hex: "1AE5D6"))
|
||||
// ).asImage(size: CGSize(width: 1024, height: 1024))
|
||||
// )
|
||||
//
|
||||
// iconViews.append(
|
||||
// IconView(iconViewModel: IconViewModel(
|
||||
// backgroundImage: MoodImages.FontAwesome.icon(forMood: .great),
|
||||
// bgColor: Color(hex: "633EC1"),
|
||||
// bgOverlayColor: Color(hex: "633EC1").darker(by: 40),
|
||||
// centerImage: MoodImages.FontAwesome.icon(forMood: .great),
|
||||
// innerColor: Color(hex: "633EC1"))
|
||||
// ).asImage(size: CGSize(width: 1024, height: 1024))
|
||||
// )
|
||||
//
|
||||
// iconViews.append(
|
||||
// IconView(iconViewModel: IconViewModel(
|
||||
// backgroundImage: MoodImages.FontAwesome.icon(forMood: .great),
|
||||
// bgColor: Color(hex: "10F30C"),
|
||||
// bgOverlayColor: Color(hex: "10F30C").darker(by: 40),
|
||||
// centerImage: MoodImages.FontAwesome.icon(forMood: .great),
|
||||
// innerColor: Color(hex: "10F30C"))
|
||||
// ).asImage(size: CGSize(width: 1024, height: 1024))
|
||||
// )
|
||||
|
||||
for (idx, image) in iconViews.enumerated() {
|
||||
let paths = FileManager.default.urls(for: .documentDirectory, in: .userDomainMask)
|
||||
@@ -534,7 +535,7 @@ struct SettingsView: View {
|
||||
Text("Create random icons")
|
||||
.foregroundColor(textColor)
|
||||
})
|
||||
.padding()
|
||||
.padding()
|
||||
}
|
||||
.fixedSize(horizontal: false, vertical: true)
|
||||
.cornerRadius(Constants.viewsCornerRaidus, corners: [.topLeft, .topRight, .bottomLeft, .bottomRight])
|
||||
@@ -555,10 +556,10 @@ struct SettingsView: View {
|
||||
struct TextFile: FileDocument {
|
||||
// tell the system we support only plain text
|
||||
static var readableContentTypes = [UTType.plainText]
|
||||
|
||||
|
||||
// by default our document is empty
|
||||
var text = ""
|
||||
|
||||
|
||||
// a simple initializer that creates new, empty documents
|
||||
init() {
|
||||
let entries = PersistenceController.shared.getData(startDate: Date(timeIntervalSince1970: 0),
|
||||
@@ -576,19 +577,19 @@ struct TextFile: FileDocument {
|
||||
let weekDay = entry.weekDay
|
||||
|
||||
let dataString = "\(canDelete),\(canEdit),\(entryType),\(String(describing: forDate)),\(moodValue),\(String(describing:timestamp)),\(weekDay)\n"
|
||||
// print("DATA: \(dataString)")
|
||||
// print("DATA: \(dataString)")
|
||||
csvString = csvString.appending(dataString)
|
||||
}
|
||||
text = csvString
|
||||
}
|
||||
|
||||
|
||||
// this initializer loads data that has been saved previously
|
||||
init(configuration: ReadConfiguration) throws {
|
||||
if let data = configuration.file.regularFileContents {
|
||||
text = String(decoding: data, as: UTF8.self)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// this will be called when the system wants to write our data to disk
|
||||
func fileWrapper(configuration: WriteConfiguration) throws -> FileWrapper {
|
||||
let data = Data(text.utf8)
|
||||
|
||||
@@ -81,7 +81,6 @@ struct YearView: View {
|
||||
.edgesIgnoringSafeArea(.all)
|
||||
)
|
||||
.onPreferenceChange(ViewOffsetKey.self) { value in
|
||||
print(value)
|
||||
iAPWarningViewHidden = value < 0
|
||||
}
|
||||
}
|
||||
|
||||
@@ -114,8 +114,9 @@
|
||||
"purchase_view_current_subscription" = "Current Subscription";
|
||||
"purchase_view_current_subscription_expires_in" = "Trial expires in:";
|
||||
"purchase_view_current_subscription_expired_on" = "Trial expired on:";
|
||||
"purchase_view_loading" = "Loading subscription options";
|
||||
|
||||
"iap_warning_view_title" = "In %d day(s) this view will no longer scroll";
|
||||
"iap_warning_view_title" = "This view will no longer scroll in ";
|
||||
"iap_warning_view_buy_button" = "Subscribe Now";
|
||||
/* not used */
|
||||
"onboarding_title_title" = "What would you like the reminder to say?";
|
||||
|
||||
Reference in New Issue
Block a user