diff --git a/AppIcon/FeelsAppIcon.pxd/QuickLook/Icon.tiff b/AppIcon/FeelsAppIcon.pxd/QuickLook/Icon.tiff index 5147160..5ce6b41 100644 Binary files a/AppIcon/FeelsAppIcon.pxd/QuickLook/Icon.tiff and b/AppIcon/FeelsAppIcon.pxd/QuickLook/Icon.tiff differ diff --git a/AppIcon/FeelsAppIcon.pxd/QuickLook/Thumbnail.tiff b/AppIcon/FeelsAppIcon.pxd/QuickLook/Thumbnail.tiff index e56928b..e6218e8 100644 Binary files a/AppIcon/FeelsAppIcon.pxd/QuickLook/Thumbnail.tiff and b/AppIcon/FeelsAppIcon.pxd/QuickLook/Thumbnail.tiff differ diff --git a/AppIcon/FeelsAppIcon.pxd/data/037FC241-C7B6-48CD-8B9E-A6209F15D855 b/AppIcon/FeelsAppIcon.pxd/data/037FC241-C7B6-48CD-8B9E-A6209F15D855 index 5ee56d3..cb77528 100644 Binary files a/AppIcon/FeelsAppIcon.pxd/data/037FC241-C7B6-48CD-8B9E-A6209F15D855 and b/AppIcon/FeelsAppIcon.pxd/data/037FC241-C7B6-48CD-8B9E-A6209F15D855 differ diff --git a/AppIcon/FeelsAppIcon.pxd/data/09165E94-16D5-437F-B70A-C9F7723D01B1 b/AppIcon/FeelsAppIcon.pxd/data/09165E94-16D5-437F-B70A-C9F7723D01B1 new file mode 100644 index 0000000..2db2eb1 Binary files /dev/null and b/AppIcon/FeelsAppIcon.pxd/data/09165E94-16D5-437F-B70A-C9F7723D01B1 differ diff --git a/AppIcon/FeelsAppIcon.pxd/data/1A34A5C2-1741-4AF4-98C7-7CFE2B66987C b/AppIcon/FeelsAppIcon.pxd/data/1A34A5C2-1741-4AF4-98C7-7CFE2B66987C new file mode 100644 index 0000000..d79a091 Binary files /dev/null and b/AppIcon/FeelsAppIcon.pxd/data/1A34A5C2-1741-4AF4-98C7-7CFE2B66987C differ diff --git a/AppIcon/FeelsAppIcon.pxd/data/283CA5EB-5B98-42AA-9FFA-A0DC14F6F4BF b/AppIcon/FeelsAppIcon.pxd/data/283CA5EB-5B98-42AA-9FFA-A0DC14F6F4BF new file mode 100644 index 0000000..37f7654 Binary files /dev/null and b/AppIcon/FeelsAppIcon.pxd/data/283CA5EB-5B98-42AA-9FFA-A0DC14F6F4BF differ diff --git a/AppIcon/FeelsAppIcon.pxd/data/2D18F047-8AE5-4611-A699-5ABE7F32FC7C b/AppIcon/FeelsAppIcon.pxd/data/2D18F047-8AE5-4611-A699-5ABE7F32FC7C new file mode 100644 index 0000000..9508984 Binary files /dev/null and b/AppIcon/FeelsAppIcon.pxd/data/2D18F047-8AE5-4611-A699-5ABE7F32FC7C differ diff --git a/AppIcon/FeelsAppIcon.pxd/data/384D344C-123D-4D0F-9E29-8E866B282B51 b/AppIcon/FeelsAppIcon.pxd/data/384D344C-123D-4D0F-9E29-8E866B282B51 index caae857..67397e4 100644 Binary files a/AppIcon/FeelsAppIcon.pxd/data/384D344C-123D-4D0F-9E29-8E866B282B51 and b/AppIcon/FeelsAppIcon.pxd/data/384D344C-123D-4D0F-9E29-8E866B282B51 differ diff --git a/AppIcon/FeelsAppIcon.pxd/data/4D9D089B-C708-4C19-8FB3-F90FBAB7B807 b/AppIcon/FeelsAppIcon.pxd/data/4D9D089B-C708-4C19-8FB3-F90FBAB7B807 new file mode 100644 index 0000000..ab3b778 Binary files /dev/null and b/AppIcon/FeelsAppIcon.pxd/data/4D9D089B-C708-4C19-8FB3-F90FBAB7B807 differ diff --git a/AppIcon/FeelsAppIcon.pxd/data/55784A79-D244-4C8E-84D4-0A347A9CAF12 b/AppIcon/FeelsAppIcon.pxd/data/55784A79-D244-4C8E-84D4-0A347A9CAF12 new file mode 100644 index 0000000..8a40c25 Binary files /dev/null and b/AppIcon/FeelsAppIcon.pxd/data/55784A79-D244-4C8E-84D4-0A347A9CAF12 differ diff --git a/AppIcon/FeelsAppIcon.pxd/data/60364F33-5665-4C06-8924-ED11E0ADB394 b/AppIcon/FeelsAppIcon.pxd/data/60364F33-5665-4C06-8924-ED11E0ADB394 new file mode 100644 index 0000000..a94e424 Binary files /dev/null and b/AppIcon/FeelsAppIcon.pxd/data/60364F33-5665-4C06-8924-ED11E0ADB394 differ diff --git a/AppIcon/FeelsAppIcon.pxd/data/6CEB1E43-7AF0-4BD6-876E-2FED69B30D0E b/AppIcon/FeelsAppIcon.pxd/data/6CEB1E43-7AF0-4BD6-876E-2FED69B30D0E new file mode 100644 index 0000000..1167c95 Binary files /dev/null and b/AppIcon/FeelsAppIcon.pxd/data/6CEB1E43-7AF0-4BD6-876E-2FED69B30D0E differ diff --git a/AppIcon/FeelsAppIcon.pxd/data/715C86B5-90B6-4ECF-8CDD-7472E91CF9AE b/AppIcon/FeelsAppIcon.pxd/data/715C86B5-90B6-4ECF-8CDD-7472E91CF9AE index 0bc4b89..7ca8e0e 100644 Binary files a/AppIcon/FeelsAppIcon.pxd/data/715C86B5-90B6-4ECF-8CDD-7472E91CF9AE and b/AppIcon/FeelsAppIcon.pxd/data/715C86B5-90B6-4ECF-8CDD-7472E91CF9AE differ diff --git a/AppIcon/FeelsAppIcon.pxd/data/73A7C754-F8A9-4A1B-ABE5-B8DB69B75BE8 b/AppIcon/FeelsAppIcon.pxd/data/73A7C754-F8A9-4A1B-ABE5-B8DB69B75BE8 index b6d5311..7285d00 100644 Binary files a/AppIcon/FeelsAppIcon.pxd/data/73A7C754-F8A9-4A1B-ABE5-B8DB69B75BE8 and b/AppIcon/FeelsAppIcon.pxd/data/73A7C754-F8A9-4A1B-ABE5-B8DB69B75BE8 differ diff --git a/AppIcon/FeelsAppIcon.pxd/data/76B29D53-8D03-476F-B233-0AE4A3C065BE b/AppIcon/FeelsAppIcon.pxd/data/76B29D53-8D03-476F-B233-0AE4A3C065BE new file mode 100644 index 0000000..bf9d022 Binary files /dev/null and b/AppIcon/FeelsAppIcon.pxd/data/76B29D53-8D03-476F-B233-0AE4A3C065BE differ diff --git a/AppIcon/FeelsAppIcon.pxd/data/87DD9A84-9FFE-4720-8E1D-703EE60AF1CF b/AppIcon/FeelsAppIcon.pxd/data/87DD9A84-9FFE-4720-8E1D-703EE60AF1CF index b0d2b7e..9b35dd5 100644 Binary files a/AppIcon/FeelsAppIcon.pxd/data/87DD9A84-9FFE-4720-8E1D-703EE60AF1CF and b/AppIcon/FeelsAppIcon.pxd/data/87DD9A84-9FFE-4720-8E1D-703EE60AF1CF differ diff --git a/AppIcon/FeelsAppIcon.pxd/data/B51463E0-0E90-4F7D-BB96-093741506B1F b/AppIcon/FeelsAppIcon.pxd/data/B51463E0-0E90-4F7D-BB96-093741506B1F new file mode 100644 index 0000000..6be0bdf Binary files /dev/null and b/AppIcon/FeelsAppIcon.pxd/data/B51463E0-0E90-4F7D-BB96-093741506B1F differ diff --git a/AppIcon/FeelsAppIcon.pxd/data/C6CA7D3A-361D-4C3F-8DE4-4EB4E9C4FA41 b/AppIcon/FeelsAppIcon.pxd/data/C6CA7D3A-361D-4C3F-8DE4-4EB4E9C4FA41 new file mode 100644 index 0000000..1c6ee72 Binary files /dev/null and b/AppIcon/FeelsAppIcon.pxd/data/C6CA7D3A-361D-4C3F-8DE4-4EB4E9C4FA41 differ diff --git a/AppIcon/FeelsAppIcon.pxd/data/CA1CB11B-005F-444E-8DF6-2C6EF5D01F51 b/AppIcon/FeelsAppIcon.pxd/data/CA1CB11B-005F-444E-8DF6-2C6EF5D01F51 index a39e26a..42817d0 100644 Binary files a/AppIcon/FeelsAppIcon.pxd/data/CA1CB11B-005F-444E-8DF6-2C6EF5D01F51 and b/AppIcon/FeelsAppIcon.pxd/data/CA1CB11B-005F-444E-8DF6-2C6EF5D01F51 differ diff --git a/AppIcon/FeelsAppIcon.pxd/data/CBE8716A-CBDD-4ED9-9AC1-365BC24B53E6 b/AppIcon/FeelsAppIcon.pxd/data/CBE8716A-CBDD-4ED9-9AC1-365BC24B53E6 new file mode 100644 index 0000000..270aa8e Binary files /dev/null and b/AppIcon/FeelsAppIcon.pxd/data/CBE8716A-CBDD-4ED9-9AC1-365BC24B53E6 differ diff --git a/AppIcon/FeelsAppIcon.pxd/data/EBC2EDC1-6121-4DAD-87E2-EF679A5C96AB b/AppIcon/FeelsAppIcon.pxd/data/EBC2EDC1-6121-4DAD-87E2-EF679A5C96AB index 291be02..83d5873 100644 Binary files a/AppIcon/FeelsAppIcon.pxd/data/EBC2EDC1-6121-4DAD-87E2-EF679A5C96AB and b/AppIcon/FeelsAppIcon.pxd/data/EBC2EDC1-6121-4DAD-87E2-EF679A5C96AB differ diff --git a/AppIcon/FeelsAppIcon.pxd/data/F01996E9-1E73-458C-888A-EBCE0913FDBF b/AppIcon/FeelsAppIcon.pxd/data/F01996E9-1E73-458C-888A-EBCE0913FDBF new file mode 100644 index 0000000..a8ec140 Binary files /dev/null and b/AppIcon/FeelsAppIcon.pxd/data/F01996E9-1E73-458C-888A-EBCE0913FDBF differ diff --git a/AppIcon/FeelsAppIcon.pxd/metadata.info b/AppIcon/FeelsAppIcon.pxd/metadata.info index 6bf31ca..aa26ed3 100644 Binary files a/AppIcon/FeelsAppIcon.pxd/metadata.info and b/AppIcon/FeelsAppIcon.pxd/metadata.info differ diff --git a/Feels.xcodeproj/xcshareddata/xcschemes/Feels (iOS).xcscheme b/Feels.xcodeproj/xcshareddata/xcschemes/Feels (iOS).xcscheme new file mode 100644 index 0000000..0022d41 --- /dev/null +++ b/Feels.xcodeproj/xcshareddata/xcschemes/Feels (iOS).xcscheme @@ -0,0 +1,88 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Feels.xcodeproj/xcshareddata/xcschemes/FeelsWidgetExtension.xcscheme b/Feels.xcodeproj/xcshareddata/xcschemes/FeelsWidgetExtension.xcscheme new file mode 100644 index 0000000..825ae8a --- /dev/null +++ b/Feels.xcodeproj/xcshareddata/xcschemes/FeelsWidgetExtension.xcscheme @@ -0,0 +1,124 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Feels.xcodeproj/xcuserdata/treyt.xcuserdatad/xcschemes/xcschememanagement.plist b/Feels.xcodeproj/xcuserdata/treyt.xcuserdatad/xcschemes/xcschememanagement.plist index 48ab2ec..8f6b7bc 100644 --- a/Feels.xcodeproj/xcuserdata/treyt.xcuserdatad/xcschemes/xcschememanagement.plist +++ b/Feels.xcodeproj/xcuserdata/treyt.xcuserdatad/xcschemes/xcschememanagement.plist @@ -24,7 +24,7 @@ isShown orderHint - 5 + 4 PlaygroundChart (Playground) 10.xcscheme @@ -66,7 +66,7 @@ isShown orderHint - 6 + 5 PlaygroundChart (Playground) 3.xcscheme @@ -122,7 +122,25 @@ isShown orderHint - 4 + 3 + + + SuppressBuildableAutocreation + + 1CD90AF4278C7DE0001C4FEA + + primary + + + 1CD90B01278C7DE0001C4FEA + + primary + + + 1CD90B44278C7E7A001C4FEA + + primary + diff --git a/FeelsWidget/Assets.xcassets/AverageGraphic.imageset/AverageGraphic.png b/FeelsWidget/Assets.xcassets/AverageGraphic.imageset/AverageGraphic.png new file mode 100644 index 0000000..e17b2d2 Binary files /dev/null and b/FeelsWidget/Assets.xcassets/AverageGraphic.imageset/AverageGraphic.png differ diff --git a/FeelsWidget/Assets.xcassets/AverageGraphic.imageset/Contents.json b/FeelsWidget/Assets.xcassets/AverageGraphic.imageset/Contents.json new file mode 100644 index 0000000..e806476 --- /dev/null +++ b/FeelsWidget/Assets.xcassets/AverageGraphic.imageset/Contents.json @@ -0,0 +1,21 @@ +{ + "images" : [ + { + "filename" : "AverageGraphic.png", + "idiom" : "universal", + "scale" : "1x" + }, + { + "idiom" : "universal", + "scale" : "2x" + }, + { + "idiom" : "universal", + "scale" : "3x" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/FeelsWidget/Assets.xcassets/BadGraphic.imageset/BadGraphic.png b/FeelsWidget/Assets.xcassets/BadGraphic.imageset/BadGraphic.png new file mode 100644 index 0000000..78c8f7a Binary files /dev/null and b/FeelsWidget/Assets.xcassets/BadGraphic.imageset/BadGraphic.png differ diff --git a/FeelsWidget/Assets.xcassets/BadGraphic.imageset/Contents.json b/FeelsWidget/Assets.xcassets/BadGraphic.imageset/Contents.json new file mode 100644 index 0000000..faecdfe --- /dev/null +++ b/FeelsWidget/Assets.xcassets/BadGraphic.imageset/Contents.json @@ -0,0 +1,21 @@ +{ + "images" : [ + { + "filename" : "BadGraphic.png", + "idiom" : "universal", + "scale" : "1x" + }, + { + "idiom" : "universal", + "scale" : "2x" + }, + { + "idiom" : "universal", + "scale" : "3x" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/FeelsWidget/Assets.xcassets/GoodGraphic.imageset/Contents.json b/FeelsWidget/Assets.xcassets/GoodGraphic.imageset/Contents.json new file mode 100644 index 0000000..6ca5ed9 --- /dev/null +++ b/FeelsWidget/Assets.xcassets/GoodGraphic.imageset/Contents.json @@ -0,0 +1,21 @@ +{ + "images" : [ + { + "filename" : "GoodGraphic.png", + "idiom" : "universal", + "scale" : "1x" + }, + { + "idiom" : "universal", + "scale" : "2x" + }, + { + "idiom" : "universal", + "scale" : "3x" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/FeelsWidget/Assets.xcassets/GoodGraphic.imageset/GoodGraphic.png b/FeelsWidget/Assets.xcassets/GoodGraphic.imageset/GoodGraphic.png new file mode 100644 index 0000000..7966bf5 Binary files /dev/null and b/FeelsWidget/Assets.xcassets/GoodGraphic.imageset/GoodGraphic.png differ diff --git a/FeelsWidget/Assets.xcassets/GreatGraphic.imageset/Contents.json b/FeelsWidget/Assets.xcassets/GreatGraphic.imageset/Contents.json new file mode 100644 index 0000000..ef72680 --- /dev/null +++ b/FeelsWidget/Assets.xcassets/GreatGraphic.imageset/Contents.json @@ -0,0 +1,21 @@ +{ + "images" : [ + { + "filename" : "GreatGraphic.png", + "idiom" : "universal", + "scale" : "1x" + }, + { + "idiom" : "universal", + "scale" : "2x" + }, + { + "idiom" : "universal", + "scale" : "3x" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/FeelsWidget/Assets.xcassets/GreatGraphic.imageset/GreatGraphic.png b/FeelsWidget/Assets.xcassets/GreatGraphic.imageset/GreatGraphic.png new file mode 100644 index 0000000..928b1e2 Binary files /dev/null and b/FeelsWidget/Assets.xcassets/GreatGraphic.imageset/GreatGraphic.png differ diff --git a/FeelsWidget/Assets.xcassets/HorribleGraphic.imageset/Contents.json b/FeelsWidget/Assets.xcassets/HorribleGraphic.imageset/Contents.json new file mode 100644 index 0000000..be59341 --- /dev/null +++ b/FeelsWidget/Assets.xcassets/HorribleGraphic.imageset/Contents.json @@ -0,0 +1,21 @@ +{ + "images" : [ + { + "filename" : "HorribleGraphic.png", + "idiom" : "universal", + "scale" : "1x" + }, + { + "idiom" : "universal", + "scale" : "2x" + }, + { + "idiom" : "universal", + "scale" : "3x" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/FeelsWidget/Assets.xcassets/HorribleGraphic.imageset/HorribleGraphic.png b/FeelsWidget/Assets.xcassets/HorribleGraphic.imageset/HorribleGraphic.png new file mode 100644 index 0000000..72d1da5 Binary files /dev/null and b/FeelsWidget/Assets.xcassets/HorribleGraphic.imageset/HorribleGraphic.png differ diff --git a/FeelsWidget/Assets.xcassets/MissingGraphic.imageset/Contents.json b/FeelsWidget/Assets.xcassets/MissingGraphic.imageset/Contents.json new file mode 100644 index 0000000..8c0053c --- /dev/null +++ b/FeelsWidget/Assets.xcassets/MissingGraphic.imageset/Contents.json @@ -0,0 +1,21 @@ +{ + "images" : [ + { + "filename" : "MissingGraphic.png", + "idiom" : "universal", + "scale" : "1x" + }, + { + "idiom" : "universal", + "scale" : "2x" + }, + { + "idiom" : "universal", + "scale" : "3x" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/FeelsWidget/Assets.xcassets/MissingGraphic.imageset/MissingGraphic.png b/FeelsWidget/Assets.xcassets/MissingGraphic.imageset/MissingGraphic.png new file mode 100644 index 0000000..6945715 Binary files /dev/null and b/FeelsWidget/Assets.xcassets/MissingGraphic.imageset/MissingGraphic.png differ diff --git a/FeelsWidget/FeelsWidget.swift b/FeelsWidget/FeelsWidget.swift index ab0b98a..7c0663c 100644 --- a/FeelsWidget/FeelsWidget.swift +++ b/FeelsWidget/FeelsWidget.swift @@ -13,13 +13,15 @@ import CoreData class WatchTimelineView: Identifiable { let id = UUID() let image: Image + let graphic: Image let date: Date let color: Color - init(image: Image, date: Date, color: Color) { + init(image: Image, date: Date, color: Color, graphic: Image) { self.image = image self.date = date self.color = color + self.graphic = graphic } } @@ -51,13 +53,20 @@ struct TimeLineCreator { return day == entryDay && month == entryMonth && year == entryYear }).first { - let timeLineView = WatchTimelineView(image: item.mood.icon, date: pastDate, color: item.mood.color) + let timeLineView = WatchTimelineView(image: item.mood.icon, + date: pastDate, + color: item.mood.color, + graphic: item.mood.graphic) returnViews.append(timeLineView) } else { - let timeLineView = WatchTimelineView(image: Mood.missing.icon, date: pastDate, color: Mood.missing.color) + let timeLineView = WatchTimelineView(image: Mood.missing.icon, + date: pastDate, + color: Mood.missing.color, + graphic: Mood.missing.graphic) returnViews.append(timeLineView) } } + returnViews = returnViews.sorted(by: { $0.date > $1.date }) return returnViews } } @@ -72,7 +81,7 @@ struct Provider: IntentTimelineProvider { for pastDay in 0...10 { let pastDate = Calendar.current.date(byAdding: .day, value: -pastDay, to: Date())! let mood = Mood.allValues.randomElement()! - sampleViews.append( WatchTimelineView(image: mood.icon, date: pastDate, color: mood.color) ) + sampleViews.append(WatchTimelineView(image: mood.icon, date: pastDate, color: mood.color, graphic: mood.graphic)) } return SimpleEntry(date: Date(), configuration: ConfigurationIntent(), timeLineViews: sampleViews) } @@ -84,7 +93,7 @@ struct Provider: IntentTimelineProvider { for pastDay in 0...10 { let pastDate = Calendar.current.date(byAdding: .day, value: -pastDay, to: Date())! let mood = Mood.allValues.randomElement()! - timeLineViews.append( WatchTimelineView(image: mood.icon, date: pastDate, color: mood.color) ) + timeLineViews.append( WatchTimelineView(image: mood.icon, date: pastDate, color: mood.color, graphic: mood.graphic)) } } else { let data = TimeLineCreator.getData() @@ -148,6 +157,22 @@ struct FeelsWidgetEntryView : View { } } +struct FeelsGraphicWidgetEntryView : View { + @Environment(\.sizeCategory) var sizeCategory + @Environment(\.widgetFamily) var family + + var entry: Provider.Entry + + @ViewBuilder + var body: some View { + SmallGraphicWidgetView(entry: entry) + .onReceive(NotificationCenter.default.publisher(for: .NSPersistentStoreRemoteChange)) { _ in + // make sure you don't call this too often + WidgetCenter.shared.reloadAllTimelines() + } + } +} + struct SmallWidgetView: View { var entry: Provider.Entry @@ -167,6 +192,18 @@ struct SmallWidgetView: View { } } +struct SmallGraphicWidgetView: View { + var entry: Provider.Entry + + var body: some View { + GeometryReader { geo in + entry.timeLineViews.first!.graphic + .resizable() + .scaledToFit() + } + } +} + struct TimeHeaderView: View { let startDate: Date let endDate: Date @@ -275,6 +312,13 @@ struct EntryCard: View { } @main +struct FeelsBundle: WidgetBundle { + var body: some Widget { + FeelsWidget() + FeelsGraphicWidget() + } +} + struct FeelsWidget: Widget { let kind: String = "FeelsWidget" @@ -290,6 +334,21 @@ struct FeelsWidget: Widget { } } +struct FeelsGraphicWidget: Widget { + let kind: String = "FeelsGraphicWidget" + + var body: some WidgetConfiguration { + IntentConfiguration(kind: kind, + intent: ConfigurationIntent.self, + provider: Provider()) { entry in + FeelsGraphicWidgetEntryView(entry: entry) + } + .configurationDisplayName("Feels") + .description("") + .supportedFamilies([.systemSmall]) + } +} + struct FeelsWidget_Previews: PreviewProvider { static var data: [WatchTimelineView] { var data = PersistenceController.shared.randomEntries(count: 10) diff --git a/Shared/Assets.xcassets/AverageGraphic.imageset/AverageGraphic.png b/Shared/Assets.xcassets/AverageGraphic.imageset/AverageGraphic.png new file mode 100644 index 0000000..e17b2d2 Binary files /dev/null and b/Shared/Assets.xcassets/AverageGraphic.imageset/AverageGraphic.png differ diff --git a/Shared/Assets.xcassets/AverageGraphic.imageset/Contents.json b/Shared/Assets.xcassets/AverageGraphic.imageset/Contents.json new file mode 100644 index 0000000..e806476 --- /dev/null +++ b/Shared/Assets.xcassets/AverageGraphic.imageset/Contents.json @@ -0,0 +1,21 @@ +{ + "images" : [ + { + "filename" : "AverageGraphic.png", + "idiom" : "universal", + "scale" : "1x" + }, + { + "idiom" : "universal", + "scale" : "2x" + }, + { + "idiom" : "universal", + "scale" : "3x" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/Shared/Assets.xcassets/BadGraphic.imageset/BadGraphic.png b/Shared/Assets.xcassets/BadGraphic.imageset/BadGraphic.png new file mode 100644 index 0000000..78c8f7a Binary files /dev/null and b/Shared/Assets.xcassets/BadGraphic.imageset/BadGraphic.png differ diff --git a/Shared/Assets.xcassets/BadGraphic.imageset/Contents.json b/Shared/Assets.xcassets/BadGraphic.imageset/Contents.json new file mode 100644 index 0000000..faecdfe --- /dev/null +++ b/Shared/Assets.xcassets/BadGraphic.imageset/Contents.json @@ -0,0 +1,21 @@ +{ + "images" : [ + { + "filename" : "BadGraphic.png", + "idiom" : "universal", + "scale" : "1x" + }, + { + "idiom" : "universal", + "scale" : "2x" + }, + { + "idiom" : "universal", + "scale" : "3x" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/Shared/Assets.xcassets/GoodGraphic.imageset/Contents.json b/Shared/Assets.xcassets/GoodGraphic.imageset/Contents.json new file mode 100644 index 0000000..6ca5ed9 --- /dev/null +++ b/Shared/Assets.xcassets/GoodGraphic.imageset/Contents.json @@ -0,0 +1,21 @@ +{ + "images" : [ + { + "filename" : "GoodGraphic.png", + "idiom" : "universal", + "scale" : "1x" + }, + { + "idiom" : "universal", + "scale" : "2x" + }, + { + "idiom" : "universal", + "scale" : "3x" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/Shared/Assets.xcassets/GoodGraphic.imageset/GoodGraphic.png b/Shared/Assets.xcassets/GoodGraphic.imageset/GoodGraphic.png new file mode 100644 index 0000000..7966bf5 Binary files /dev/null and b/Shared/Assets.xcassets/GoodGraphic.imageset/GoodGraphic.png differ diff --git a/Shared/Assets.xcassets/GreatGraphic.imageset/Contents.json b/Shared/Assets.xcassets/GreatGraphic.imageset/Contents.json new file mode 100644 index 0000000..ef72680 --- /dev/null +++ b/Shared/Assets.xcassets/GreatGraphic.imageset/Contents.json @@ -0,0 +1,21 @@ +{ + "images" : [ + { + "filename" : "GreatGraphic.png", + "idiom" : "universal", + "scale" : "1x" + }, + { + "idiom" : "universal", + "scale" : "2x" + }, + { + "idiom" : "universal", + "scale" : "3x" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/Shared/Assets.xcassets/GreatGraphic.imageset/GreatGraphic.png b/Shared/Assets.xcassets/GreatGraphic.imageset/GreatGraphic.png new file mode 100644 index 0000000..928b1e2 Binary files /dev/null and b/Shared/Assets.xcassets/GreatGraphic.imageset/GreatGraphic.png differ diff --git a/Shared/Assets.xcassets/HorribleGraphic.imageset/Contents.json b/Shared/Assets.xcassets/HorribleGraphic.imageset/Contents.json new file mode 100644 index 0000000..be59341 --- /dev/null +++ b/Shared/Assets.xcassets/HorribleGraphic.imageset/Contents.json @@ -0,0 +1,21 @@ +{ + "images" : [ + { + "filename" : "HorribleGraphic.png", + "idiom" : "universal", + "scale" : "1x" + }, + { + "idiom" : "universal", + "scale" : "2x" + }, + { + "idiom" : "universal", + "scale" : "3x" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/Shared/Assets.xcassets/HorribleGraphic.imageset/HorribleGraphic.png b/Shared/Assets.xcassets/HorribleGraphic.imageset/HorribleGraphic.png new file mode 100644 index 0000000..72d1da5 Binary files /dev/null and b/Shared/Assets.xcassets/HorribleGraphic.imageset/HorribleGraphic.png differ diff --git a/Shared/Assets.xcassets/MissingGraphic.imageset/Contents.json b/Shared/Assets.xcassets/MissingGraphic.imageset/Contents.json new file mode 100644 index 0000000..8c0053c --- /dev/null +++ b/Shared/Assets.xcassets/MissingGraphic.imageset/Contents.json @@ -0,0 +1,21 @@ +{ + "images" : [ + { + "filename" : "MissingGraphic.png", + "idiom" : "universal", + "scale" : "1x" + }, + { + "idiom" : "universal", + "scale" : "2x" + }, + { + "idiom" : "universal", + "scale" : "3x" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/Shared/Assets.xcassets/MissingGraphic.imageset/MissingGraphic.png b/Shared/Assets.xcassets/MissingGraphic.imageset/MissingGraphic.png new file mode 100644 index 0000000..6945715 Binary files /dev/null and b/Shared/Assets.xcassets/MissingGraphic.imageset/MissingGraphic.png differ diff --git a/Shared/Models/Mood.swift b/Shared/Models/Mood.swift index cc24bb3..a615add 100644 --- a/Shared/Models/Mood.swift +++ b/Shared/Models/Mood.swift @@ -71,6 +71,24 @@ enum Mood: Int { return Image("missing", bundle: .main) } } + + var graphic: Image { + switch self { + + case .horrible: + return Image("HorribleGraphic", bundle: .main) + case .bad: + return Image("BadGraphic", bundle: .main) + case .average: + return Image("AverageGraphic", bundle: .main) + case .good: + return Image("GoodGraphic", bundle: .main) + case .great: + return Image("GreatGraphic", bundle: .main) + case .missing: + return Image("MissingGraphic", bundle: .main) + } + } } extension Mood: Identifiable { diff --git a/Shared/Persistence.swift b/Shared/Persistence.swift index e6e5909..a3d4733 100644 --- a/Shared/Persistence.swift +++ b/Shared/Persistence.swift @@ -62,11 +62,6 @@ class PersistenceController { try! viewContext.setQueryGenerationFrom(.current) viewContext.refreshAllObjects() - let fakeRequest = NSFetchRequest(entityName: "MoodEntry") - let fakeData = try! viewContext.fetch(fakeRequest) - for item in fakeData { - print(item.forDate!) - } var includedDays16 = [Int16]() if includedDays.isEmpty {