Skip to content

Commit

Permalink
Add sunrise/sunset times to widget timeline (fixes #60)
Browse files Browse the repository at this point in the history
  • Loading branch information
daneden committed Jan 5, 2022
1 parent de291f9 commit 78104ef
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 13 deletions.
20 changes: 10 additions & 10 deletions Solstice.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -874,7 +874,7 @@
"@executable_path/Frameworks",
"@executable_path/../../Frameworks",
);
MARKETING_VERSION = 1.4.1;
MARKETING_VERSION = 1.4.2;
PRODUCT_BUNDLE_IDENTIFIER = me.daneden.Solstice.SolsticeIntents;
PRODUCT_NAME = "$(TARGET_NAME)";
SDKROOT = iphoneos;
Expand All @@ -899,7 +899,7 @@
"@executable_path/Frameworks",
"@executable_path/../../Frameworks",
);
MARKETING_VERSION = 1.4.1;
MARKETING_VERSION = 1.4.2;
PRODUCT_BUNDLE_IDENTIFIER = me.daneden.Solstice.SolsticeIntents;
PRODUCT_NAME = "$(TARGET_NAME)";
SDKROOT = iphoneos;
Expand Down Expand Up @@ -933,7 +933,7 @@
"@executable_path/Frameworks",
"@executable_path/../../Frameworks",
);
MARKETING_VERSION = 1.4.1;
MARKETING_VERSION = 1.4.2;
PRODUCT_BUNDLE_IDENTIFIER = me.daneden.Solstice.watchkitapp.watchkitextension;
PRODUCT_NAME = "${TARGET_NAME}";
SDKROOT = watchos;
Expand Down Expand Up @@ -967,7 +967,7 @@
"@executable_path/Frameworks",
"@executable_path/../../Frameworks",
);
MARKETING_VERSION = 1.4.1;
MARKETING_VERSION = 1.4.2;
PRODUCT_BUNDLE_IDENTIFIER = me.daneden.Solstice.watchkitapp.watchkitextension;
PRODUCT_NAME = "${TARGET_NAME}";
SDKROOT = watchos;
Expand Down Expand Up @@ -995,7 +995,7 @@
IBSC_MODULE = WatchSolstice_WatchKit_Extension;
INFOPLIST_KEY_UISupportedInterfaceOrientations = "UIInterfaceOrientationPortrait UIInterfaceOrientationPortraitUpsideDown";
INFOPLIST_KEY_WKCompanionAppBundleIdentifier = me.daneden.Solstice;
MARKETING_VERSION = 1.4.1;
MARKETING_VERSION = 1.4.2;
PRODUCT_BUNDLE_IDENTIFIER = me.daneden.Solstice.watchkitapp;
PRODUCT_NAME = Solstice;
SDKROOT = watchos;
Expand All @@ -1022,7 +1022,7 @@
IBSC_MODULE = WatchSolstice_WatchKit_Extension;
INFOPLIST_KEY_UISupportedInterfaceOrientations = "UIInterfaceOrientationPortrait UIInterfaceOrientationPortraitUpsideDown";
INFOPLIST_KEY_WKCompanionAppBundleIdentifier = me.daneden.Solstice;
MARKETING_VERSION = 1.4.1;
MARKETING_VERSION = 1.4.2;
PRODUCT_BUNDLE_IDENTIFIER = me.daneden.Solstice.watchkitapp;
PRODUCT_NAME = Solstice;
SDKROOT = watchos;
Expand Down Expand Up @@ -1163,7 +1163,7 @@
"$(inherited)",
"@executable_path/Frameworks",
);
MARKETING_VERSION = 1.4.1;
MARKETING_VERSION = 1.4.2;
PRODUCT_BUNDLE_IDENTIFIER = me.daneden.Solstice;
PRODUCT_NAME = Solstice;
SDKROOT = iphoneos;
Expand All @@ -1190,7 +1190,7 @@
"$(inherited)",
"@executable_path/Frameworks",
);
MARKETING_VERSION = 1.4.1;
MARKETING_VERSION = 1.4.2;
PRODUCT_BUNDLE_IDENTIFIER = me.daneden.Solstice;
PRODUCT_NAME = Solstice;
SDKROOT = iphoneos;
Expand All @@ -1217,7 +1217,7 @@
"@executable_path/Frameworks",
"@executable_path/../../Frameworks",
);
MARKETING_VERSION = 1.4.1;
MARKETING_VERSION = 1.4.2;
PRODUCT_BUNDLE_IDENTIFIER = me.daneden.Solstice.Widget;
PRODUCT_NAME = "$(TARGET_NAME)";
SDKROOT = iphoneos;
Expand All @@ -1244,7 +1244,7 @@
"@executable_path/Frameworks",
"@executable_path/../../Frameworks",
);
MARKETING_VERSION = 1.4.1;
MARKETING_VERSION = 1.4.2;
PRODUCT_BUNDLE_IDENTIFIER = me.daneden.Solstice.Widget;
PRODUCT_NAME = "$(TARGET_NAME)";
SDKROOT = iphoneos;
Expand Down
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
<key>SolsticeIntents.xcscheme_^#shared#^_</key>
<dict>
<key>orderHint</key>
<integer>3</integer>
<integer>2</integer>
</dict>
<key>SolsticeIntentsUI.xcscheme_^#shared#^_</key>
<dict>
Expand Down Expand Up @@ -58,7 +58,7 @@
<key>WatchSolstice.xcscheme_^#shared#^_</key>
<dict>
<key>orderHint</key>
<integer>2</integer>
<integer>3</integer>
</dict>
<key>WidgetExtension.xcscheme_^#shared#^_</key>
<dict>
Expand Down
13 changes: 12 additions & 1 deletion Widget/Widget.swift
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,19 @@ struct SolsticeWidgetTimelineProvider: TimelineProvider {
)
}

entries.append(contentsOf: [
SolsticeWidgetTimelineEntry(
date: solarCalculator.today.begins.addingTimeInterval(1),
relevance: .init(score: 10, duration: 60 * 10)
),
SolsticeWidgetTimelineEntry(
date: solarCalculator.today.ends.addingTimeInterval(1),
relevance: .init(score: 10, duration: 60 * 10)
),
])

let timeline = Timeline(
entries: entries,
entries: entries.sorted(by: { $0.date < $1.date }),
policy: .atEnd
)

Expand Down

0 comments on commit 78104ef

Please sign in to comment.