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