diff --git a/Feels (iOS)Dev.entitlements b/Feels (iOS)Dev.entitlements
index 1662af0..6a36e63 100644
--- a/Feels (iOS)Dev.entitlements
+++ b/Feels (iOS)Dev.entitlements
@@ -6,7 +6,7 @@
development
com.apple.developer.icloud-container-identifiers
- iCloud.com.88oak.feelsDev
+ iCloud.com.88oak.feelsDebug
com.apple.developer.icloud-services
diff --git a/Feels.xcodeproj/project.pbxproj b/Feels.xcodeproj/project.pbxproj
index f9433dc..fbd9f26 100644
--- a/Feels.xcodeproj/project.pbxproj
+++ b/Feels.xcodeproj/project.pbxproj
@@ -51,7 +51,6 @@
1CD90B71278C80CA001C4FEA /* Feels.xcdatamodeld in Sources */ = {isa = PBXBuildFile; fileRef = 1CD90AEB278C7DDF001C4FEA /* Feels.xcdatamodeld */; };
1CD90B76278C8119001C4FEA /* LocalNotification.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1CD90B75278C8119001C4FEA /* LocalNotification.swift */; };
1CD90B77278C8119001C4FEA /* LocalNotification.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1CD90B75278C8119001C4FEA /* LocalNotification.swift */; };
- 1CD90B78278C8119001C4FEA /* LocalNotification.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1CD90B75278C8119001C4FEA /* LocalNotification.swift */; };
1CD90B7B278C8146001C4FEA /* Charts in Frameworks */ = {isa = PBXBuildFile; productRef = 1CD90B7A278C8146001C4FEA /* Charts */; };
/* End PBXBuildFile section */
@@ -249,11 +248,11 @@
1CD90B31278C7E38001C4FEA /* views */ = {
isa = PBXGroup;
children = (
- 1CD90B32278C7E38001C4FEA /* SettingsView.swift */,
- 1CD90B33278C7E38001C4FEA /* GraphView.swift */,
1CD90B34278C7E38001C4FEA /* AddMoodHeaderView.swift */,
1CD90B35278C7E38001C4FEA /* ContentView.swift */,
+ 1CD90B33278C7E38001C4FEA /* GraphView.swift */,
1CD90B36278C7E38001C4FEA /* HeaderStatsView.swift */,
+ 1CD90B32278C7E38001C4FEA /* SettingsView.swift */,
);
path = views;
sourceTree = "";
@@ -429,10 +428,10 @@
projectRoot = "";
targets = (
1CD90AF4278C7DE0001C4FEA /* Feels (iOS) */,
+ 1CD90B44278C7E7A001C4FEA /* FeelsWidgetExtension */,
1CD90AFA278C7DE0001C4FEA /* Feels (macOS) */,
1CD90B01278C7DE0001C4FEA /* Tests iOS */,
1CD90B0D278C7DE0001C4FEA /* Tests macOS */,
- 1CD90B44278C7E7A001C4FEA /* FeelsWidgetExtension */,
);
};
/* End PBXProject section */
@@ -544,7 +543,6 @@
1CD90B5F278C7EAD001C4FEA /* Random.swift in Sources */,
1CD90B5B278C7E91001C4FEA /* Persistence.swift in Sources */,
1CD90B68278C7EBA001C4FEA /* MoodEntryExtension.swift in Sources */,
- 1CD90B78278C8119001C4FEA /* LocalNotification.swift in Sources */,
1CD90B71278C80CA001C4FEA /* Feels.xcdatamodeld in Sources */,
1CD90B52278C7E7A001C4FEA /* FeelsWidget.intentdefinition in Sources */,
1CD90B4D278C7E7A001C4FEA /* FeelsWidget.swift in Sources */,
@@ -692,6 +690,7 @@
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor;
CODE_SIGN_ENTITLEMENTS = "Feels (iOS)Dev.entitlements";
+ CODE_SIGN_IDENTITY = "Apple Development";
CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 1;
DEVELOPMENT_TEAM = V3PF3M6B6U;
@@ -709,8 +708,9 @@
"@executable_path/Frameworks",
);
MARKETING_VERSION = 1.0;
- PRODUCT_BUNDLE_IDENTIFIER = com.88oak.FeelsDev;
+ PRODUCT_BUNDLE_IDENTIFIER = com.88oak.FeelsDebug;
PRODUCT_NAME = Feels;
+ PROVISIONING_PROFILE_SPECIFIER = "";
SDKROOT = iphoneos;
SWIFT_EMIT_LOC_STRINGS = YES;
SWIFT_VERSION = 5.0;
@@ -725,6 +725,7 @@
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor;
CODE_SIGN_ENTITLEMENTS = "Feels (iOS).entitlements";
+ CODE_SIGN_IDENTITY = "Apple Development";
CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 1;
DEVELOPMENT_TEAM = V3PF3M6B6U;
@@ -744,6 +745,7 @@
MARKETING_VERSION = 1.0;
PRODUCT_BUNDLE_IDENTIFIER = com.88oak.Feels;
PRODUCT_NAME = Feels;
+ PROVISIONING_PROFILE_SPECIFIER = "";
SDKROOT = iphoneos;
SWIFT_EMIT_LOC_STRINGS = YES;
SWIFT_VERSION = 5.0;
@@ -893,6 +895,7 @@
ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor;
ASSETCATALOG_COMPILER_WIDGET_BACKGROUND_COLOR_NAME = WidgetBackground;
CODE_SIGN_ENTITLEMENTS = FeelsWidgetExtensionDev.entitlements;
+ CODE_SIGN_IDENTITY = "Apple Development";
CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 1;
DEVELOPMENT_TEAM = V3PF3M6B6U;
@@ -907,8 +910,9 @@
"@executable_path/../../Frameworks",
);
MARKETING_VERSION = 1.0;
- PRODUCT_BUNDLE_IDENTIFIER = com.88oak.FeelsDev.FeelsWidgetDev;
+ PRODUCT_BUNDLE_IDENTIFIER = com.88oak.FeelsDebug.FeelsWidgetDebug;
PRODUCT_NAME = "$(TARGET_NAME)";
+ PROVISIONING_PROFILE_SPECIFIER = "";
SDKROOT = iphoneos;
SKIP_INSTALL = YES;
SWIFT_EMIT_LOC_STRINGS = YES;
@@ -923,6 +927,7 @@
ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor;
ASSETCATALOG_COMPILER_WIDGET_BACKGROUND_COLOR_NAME = WidgetBackground;
CODE_SIGN_ENTITLEMENTS = FeelsWidgetExtension.entitlements;
+ CODE_SIGN_IDENTITY = "Apple Development";
CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 1;
DEVELOPMENT_TEAM = V3PF3M6B6U;
@@ -939,6 +944,7 @@
MARKETING_VERSION = 1.0;
PRODUCT_BUNDLE_IDENTIFIER = com.88oak.Feels.FeelsWidget;
PRODUCT_NAME = "$(TARGET_NAME)";
+ PROVISIONING_PROFILE_SPECIFIER = "";
SDKROOT = iphoneos;
SKIP_INSTALL = YES;
SWIFT_EMIT_LOC_STRINGS = YES;
diff --git a/FeelsWidget/FeelsWidget.swift b/FeelsWidget/FeelsWidget.swift
index 9fd536b..c46edfd 100644
--- a/FeelsWidget/FeelsWidget.swift
+++ b/FeelsWidget/FeelsWidget.swift
@@ -17,7 +17,7 @@ struct Provider: IntentTimelineProvider {
*/
func placeholder(in context: Context) -> SimpleEntry {
let date = Date()
- let moodEntry = PersistenceController.shared.moodEntries(forStartDate: date, count: 5)
+ let moodEntry = PersistenceController.shared.moodEntries(forStartDate: date, count: 10)
return SimpleEntry(date: date, configuration: ConfigurationIntent(), mood: moodEntry)
}
@@ -25,15 +25,6 @@ struct Provider: IntentTimelineProvider {
if context.isPreview {
}
- let date = Date()
- let moodEntry = PersistenceController.shared.moodEntries(forStartDate: date, count: 5)
-
- let entry = SimpleEntry(date: date, configuration: configuration, mood: moodEntry)
- completion(entry)
- }
-
- func getTimeline(for configuration: ConfigurationIntent, in context: Context, completion: @escaping (Timeline) -> ()) {
- var entries: [SimpleEntry] = []
var calendar = Calendar.current
calendar.timeZone = NSTimeZone.local
@@ -41,9 +32,17 @@ struct Provider: IntentTimelineProvider {
let userEntries = PersistenceController.shared.moodEntries(forStartDate: todayStart, count: 10)
let entry = SimpleEntry(date: Date(), configuration: configuration, mood: userEntries)
- entries.append(entry)
+ completion(entry)
+ }
+
+ func getTimeline(for configuration: ConfigurationIntent, in context: Context, completion: @escaping (Timeline) -> ()) {
+ var calendar = Calendar.current
+ calendar.timeZone = NSTimeZone.local
+ let todayStart = calendar.startOfDay(for: Date())
+ let userEntries = PersistenceController.shared.moodEntries(forStartDate: todayStart, count: 10)
- let timeline = Timeline(entries: entries, policy: .after(Random.widgetUpdateTime))
+ let entry = SimpleEntry(date: Date(), configuration: configuration, mood: userEntries)
+ let timeline = Timeline(entries: [entry], policy: .after(Random.widgetUpdateTime))
completion(timeline)
}
}
@@ -94,8 +93,13 @@ struct SmallWidgetView: View {
var body: some View {
VStack {
- EntryCardCollectionView(moodEntries: Array([entry.mood.first!]))
- .padding()
+ if let first = entry.mood.first {
+ EntryCardCollectionView(moodEntries: Array([first]))
+ .padding()
+ } else {
+ Text("🤷♂️")
+ .font(.system(size: 50))
+ }
}
}
}
diff --git a/FeelsWidgetExtensionDev.entitlements b/FeelsWidgetExtensionDev.entitlements
index 1662af0..6a36e63 100644
--- a/FeelsWidgetExtensionDev.entitlements
+++ b/FeelsWidgetExtensionDev.entitlements
@@ -6,7 +6,7 @@
development
com.apple.developer.icloud-container-identifiers
- iCloud.com.88oak.feelsDev
+ iCloud.com.88oak.feelsDebug
com.apple.developer.icloud-services
diff --git a/Shared/Persistence.swift b/Shared/Persistence.swift
index 70b8df5..d4024a1 100644
--- a/Shared/Persistence.swift
+++ b/Shared/Persistence.swift
@@ -43,15 +43,13 @@ struct PersistenceController {
fetchRequest.fetchLimit = count
fetchRequest.sortDescriptors = [NSSortDescriptor(key: "date", ascending: false)]
- var calendar = Calendar.current
- calendar.timeZone = NSTimeZone.local
-
- let dateFrom = calendar.startOfDay(for: Date())
-
+// var calendar = Calendar.current
+// calendar.timeZone = NSTimeZone.local
+// let dateFrom = calendar.startOfDay(for: Date())
// Set predicate as date being today's date
- let fromPredicate = NSPredicate(format: "date <= %@", dateFrom as NSDate)
- let datePredicate = NSCompoundPredicate(andPredicateWithSubpredicates: [fromPredicate])
- fetchRequest.predicate = datePredicate
+// let fromPredicate = NSPredicate(format: "date <= %@", dateFrom as NSDate)
+// let datePredicate = NSCompoundPredicate(andPredicateWithSubpredicates: [fromPredicate])
+// fetchRequest.predicate = datePredicate
let entries = try! viewContext.fetch(fetchRequest)
if entries.count >= count {
diff --git a/Shared/views/ContentView.swift b/Shared/views/ContentView.swift
index c77051b..9fa94a8 100644
--- a/Shared/views/ContentView.swift
+++ b/Shared/views/ContentView.swift
@@ -20,6 +20,8 @@ struct ContentView: View {
animation: .spring())
private var items: FetchedResults
+ init(){ }
+
var body: some View {
TabView {
mainView