Skip to content

Commit a757ef6

Browse files
authored
Merge branch 'master' into feature/268-do-not-let-screen-sleep-when-timer-running
2 parents 42a3e54 + 7571f7d commit a757ef6

File tree

18 files changed

+255
-221
lines changed

18 files changed

+255
-221
lines changed

BeeKit/Info.plist

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,8 @@
1515
<key>CFBundlePackageType</key>
1616
<string>$(PRODUCT_BUNDLE_PACKAGE_TYPE)</string>
1717
<key>CFBundleShortVersionString</key>
18-
<string>6.7</string>
18+
<string>6.8</string>
1919
<key>CFBundleVersion</key>
20-
<string>53</string>
20+
<string>55</string>
2121
</dict>
2222
</plist>

BeeKitTests/Info.plist

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,8 @@
1515
<key>CFBundlePackageType</key>
1616
<string>$(PRODUCT_BUNDLE_PACKAGE_TYPE)</string>
1717
<key>CFBundleShortVersionString</key>
18-
<string>6.7</string>
18+
<string>6.8</string>
1919
<key>CFBundleVersion</key>
20-
<string>53</string>
20+
<string>55</string>
2121
</dict>
2222
</plist>

BeeSwift.xcodeproj/project.pbxproj

Lines changed: 12 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
objects = {
88

99
/* Begin PBXBuildFile section */
10+
9B65F2322CFA6427009674A7 /* DeeplinkGenerator.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9B65F2312CFA6418009674A7 /* DeeplinkGenerator.swift */; };
1011
9B8CA57D24B120CA009C86C2 /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 9B8CA57C24B120CA009C86C2 /* LaunchScreen.storyboard */; };
1112
A10D4E931B07948500A72D29 /* DatapointsTableView.swift in Sources */ = {isa = PBXBuildFile; fileRef = A10D4E921B07948500A72D29 /* DatapointsTableView.swift */; };
1213
A10DC2DF207BFCBA00FB7B3A /* RemoveHKMetricViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = A10DC2DE207BFCBA00FB7B3A /* RemoveHKMetricViewController.swift */; };
@@ -24,7 +25,6 @@
2425
A17E930C1B09032F0098FCA0 /* QuartzCore.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = A17E930B1B09032F0098FCA0 /* QuartzCore.framework */; };
2526
A196CB1A1AE4142E00B90A3E /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = A196CB191AE4142E00B90A3E /* AppDelegate.swift */; };
2627
A196CB1F1AE4142F00B90A3E /* GalleryViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = A196CB1E1AE4142F00B90A3E /* GalleryViewController.swift */; };
27-
A196CB221AE4142F00B90A3E /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = A196CB201AE4142F00B90A3E /* Main.storyboard */; };
2828
A196CB241AE4142F00B90A3E /* Images.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = A196CB231AE4142F00B90A3E /* Images.xcassets */; };
2929
A196CB331AE4142F00B90A3E /* BeeSwiftTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = A196CB321AE4142F00B90A3E /* BeeSwiftTests.swift */; };
3030
A1A8BDE61FEAE8DD007D61D6 /* ConfigureNotificationsViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = A1A8BDE51FEAE8DD007D61D6 /* ConfigureNotificationsViewController.swift */; };
@@ -38,6 +38,7 @@
3838
A1E618E41E7934C700D8ED93 /* HealthKitConfigTableViewCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = A1E618E31E7934C700D8ED93 /* HealthKitConfigTableViewCell.swift */; };
3939
A1EA154D1B01E6EC0052A6E6 /* DatapointTableViewCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = A1EA154C1B01E6EC0052A6E6 /* DatapointTableViewCell.swift */; };
4040
A1F9D1EA211B9B7600E2BC93 /* EditDatapointViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = A1F9D1E9211B9B7600E2BC93 /* EditDatapointViewController.swift */; };
41+
E4015D9F2D10DC4D00F58D94 /* SceneDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = E4015D9E2D10DC4D00F58D94 /* SceneDelegate.swift */; };
4142
E41286F12A62E6840093D598 /* KeychainSwift in Frameworks */ = {isa = PBXBuildFile; productRef = E41286F02A62E6840093D598 /* KeychainSwift */; };
4243
E41286F32A62E97B0093D598 /* KeychainSwift in Frameworks */ = {isa = PBXBuildFile; productRef = E41286F22A62E97B0093D598 /* KeychainSwift */; };
4344
E412DADF2B869E1E0099E483 /* BeeLemniscateView.swift in Sources */ = {isa = PBXBuildFile; fileRef = E412DADE2B869E1E0099E483 /* BeeLemniscateView.swift */; };
@@ -168,13 +169,6 @@
168169
remoteGlobalIDString = A196CB131AE4142E00B90A3E;
169170
remoteInfo = BeeSwift;
170171
};
171-
E57BE6F32655EBE000BA540B /* PBXContainerItemProxy */ = {
172-
isa = PBXContainerItemProxy;
173-
containerPortal = A196CB0C1AE4142E00B90A3E /* Project object */;
174-
proxyType = 1;
175-
remoteGlobalIDString = E57BE6DF2655EBD900BA540B;
176-
remoteInfo = BeeKit;
177-
};
178172
E57BE7122655F00200BA540B /* PBXContainerItemProxy */ = {
179173
isa = PBXContainerItemProxy;
180174
containerPortal = A196CB0C1AE4142E00B90A3E /* Project object */;
@@ -224,6 +218,7 @@
224218
/* End PBXCopyFilesBuildPhase section */
225219

226220
/* Begin PBXFileReference section */
221+
9B65F2312CFA6418009674A7 /* DeeplinkGenerator.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DeeplinkGenerator.swift; sourceTree = "<group>"; };
227222
9B8CA57C24B120CA009C86C2 /* LaunchScreen.storyboard */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; path = LaunchScreen.storyboard; sourceTree = "<group>"; };
228223
A10D4E921B07948500A72D29 /* DatapointsTableView.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = DatapointsTableView.swift; sourceTree = "<group>"; };
229224
A10DC2DE207BFCBA00FB7B3A /* RemoveHKMetricViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = RemoveHKMetricViewController.swift; sourceTree = "<group>"; };
@@ -253,7 +248,6 @@
253248
A196CB181AE4142E00B90A3E /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
254249
A196CB191AE4142E00B90A3E /* AppDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = "<group>"; };
255250
A196CB1E1AE4142F00B90A3E /* GalleryViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = GalleryViewController.swift; sourceTree = "<group>"; };
256-
A196CB211AE4142F00B90A3E /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = "<group>"; };
257251
A196CB231AE4142F00B90A3E /* Images.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Images.xcassets; sourceTree = "<group>"; };
258252
A196CB2C1AE4142F00B90A3E /* BeeSwiftTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = BeeSwiftTests.xctest; sourceTree = BUILT_PRODUCTS_DIR; };
259253
A196CB311AE4142F00B90A3E /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
@@ -275,6 +269,7 @@
275269
A1E618FF1E86980900D8ED93 /* HealthKitConfig.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = HealthKitConfig.swift; sourceTree = "<group>"; };
276270
A1EA154C1B01E6EC0052A6E6 /* DatapointTableViewCell.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = DatapointTableViewCell.swift; sourceTree = "<group>"; };
277271
A1F9D1E9211B9B7600E2BC93 /* EditDatapointViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = EditDatapointViewController.swift; sourceTree = "<group>"; };
272+
E4015D9E2D10DC4D00F58D94 /* SceneDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SceneDelegate.swift; sourceTree = "<group>"; };
278273
E4040D732A7B5F0E008E7D0E /* WorkoutMinutesHealthKitMetric.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = WorkoutMinutesHealthKitMetric.swift; sourceTree = "<group>"; };
279274
E41286ED2A62DF330093D598 /* BeeminderModel.xcdatamodel */ = {isa = PBXFileReference; lastKnownFileType = wrapper.xcdatamodel; path = BeeminderModel.xcdatamodel; sourceTree = "<group>"; };
280275
E412DADE2B869E1E0099E483 /* BeeLemniscateView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = BeeLemniscateView.swift; sourceTree = "<group>"; };
@@ -483,6 +478,7 @@
483478
A196CB161AE4142E00B90A3E /* BeeSwift */ = {
484479
isa = PBXGroup;
485480
children = (
481+
9B65F2312CFA6418009674A7 /* DeeplinkGenerator.swift */,
486482
A1E618E51E79E01900D8ED93 /* Cells */,
487483
E46071002B43DA7100305DB4 /* Gallery */,
488484
E46070FF2B43DA3D00305DB4 /* GoalView */,
@@ -497,8 +493,8 @@
497493
A196CB231AE4142F00B90A3E /* Images.xcassets */,
498494
9B8CA57C24B120CA009C86C2 /* LaunchScreen.storyboard */,
499495
E43BEA832A036A9C00FC3A38 /* LogReader.swift */,
500-
A196CB201AE4142F00B90A3E /* Main.storyboard */,
501496
A1453B3E1AEDFCC8006F48DA /* SignInViewController.swift */,
497+
E4015D9E2D10DC4D00F58D94 /* SceneDelegate.swift */,
502498
);
503499
path = BeeSwift;
504500
sourceTree = "<group>";
@@ -732,7 +728,6 @@
732728
);
733729
dependencies = (
734730
E5F7C4A9260FC5300095684F /* PBXTargetDependency */,
735-
E57BE6F42655EBE000BA540B /* PBXTargetDependency */,
736731
E57BE7132655F00200BA540B /* PBXTargetDependency */,
737732
);
738733
name = BeeSwift;
@@ -967,7 +962,6 @@
967962
buildActionMask = 2147483647;
968963
files = (
969964
E5DF493724DC69A200260560 /* Config.swift.sample in Resources */,
970-
A196CB221AE4142F00B90A3E /* Main.storyboard in Resources */,
971965
9B8CA57D24B120CA009C86C2 /* LaunchScreen.storyboard in Resources */,
972966
A196CB241AE4142F00B90A3E /* Images.xcassets in Resources */,
973967
);
@@ -1022,9 +1016,11 @@
10221016
A1E618E41E7934C700D8ED93 /* HealthKitConfigTableViewCell.swift in Sources */,
10231017
E4B083392932F90400A71564 /* ConfigureHKMetricViewController.swift in Sources */,
10241018
E43BEA842A036A9C00FC3A38 /* LogReader.swift in Sources */,
1019+
9B65F2322CFA6427009674A7 /* DeeplinkGenerator.swift in Sources */,
10251020
A196CB1F1AE4142F00B90A3E /* GalleryViewController.swift in Sources */,
10261021
A1BE73AA1E8B45BF00DEC4DB /* ChooseHKMetricViewController.swift in Sources */,
10271022
A149147B1BE79FD50060600A /* EditNotificationsViewController.swift in Sources */,
1023+
E4015D9F2D10DC4D00F58D94 /* SceneDelegate.swift in Sources */,
10281024
A1BE73AC1E8B47E700DEC4DB /* HealthKitMetricTableViewCell.swift in Sources */,
10291025
E43833942AC1473E0098A38F /* InlineDatePicker.swift in Sources */,
10301026
E55760F526549D310076B95A /* AddDataIntentHandler.swift in Sources */,
@@ -1168,11 +1164,6 @@
11681164
target = A196CB131AE4142E00B90A3E /* BeeSwift */;
11691165
targetProxy = E57BE6EC2655EBE000BA540B /* PBXContainerItemProxy */;
11701166
};
1171-
E57BE6F42655EBE000BA540B /* PBXTargetDependency */ = {
1172-
isa = PBXTargetDependency;
1173-
target = E57BE6DF2655EBD900BA540B /* BeeKit */;
1174-
targetProxy = E57BE6F32655EBE000BA540B /* PBXContainerItemProxy */;
1175-
};
11761167
E57BE7132655F00200BA540B /* PBXTargetDependency */ = {
11771168
isa = PBXTargetDependency;
11781169
target = E57BE6DF2655EBD900BA540B /* BeeKit */;
@@ -1190,17 +1181,6 @@
11901181
};
11911182
/* End PBXTargetDependency section */
11921183

1193-
/* Begin PBXVariantGroup section */
1194-
A196CB201AE4142F00B90A3E /* Main.storyboard */ = {
1195-
isa = PBXVariantGroup;
1196-
children = (
1197-
A196CB211AE4142F00B90A3E /* Base */,
1198-
);
1199-
name = Main.storyboard;
1200-
sourceTree = "<group>";
1201-
};
1202-
/* End PBXVariantGroup section */
1203-
12041184
/* Begin XCBuildConfiguration section */
12051185
A196CB341AE4142F00B90A3E /* Debug */ = {
12061186
isa = XCBuildConfiguration;
@@ -1235,7 +1215,7 @@
12351215
CODE_SIGN_IDENTITY = "iPhone Developer";
12361216
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
12371217
COPY_PHASE_STRIP = NO;
1238-
CURRENT_PROJECT_VERSION = 53;
1218+
CURRENT_PROJECT_VERSION = 55;
12391219
DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
12401220
ENABLE_STRICT_OBJC_MSGSEND = YES;
12411221
ENABLE_TESTABILITY = YES;
@@ -1300,7 +1280,7 @@
13001280
CODE_SIGN_IDENTITY = "iPhone Distribution";
13011281
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Distribution";
13021282
COPY_PHASE_STRIP = NO;
1303-
CURRENT_PROJECT_VERSION = 53;
1283+
CURRENT_PROJECT_VERSION = 55;
13041284
DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
13051285
ENABLE_NS_ASSERTIONS = NO;
13061286
ENABLE_STRICT_OBJC_MSGSEND = YES;
@@ -1467,7 +1447,7 @@
14671447
DEFINES_MODULE = YES;
14681448
DEVELOPMENT_TEAM = 8TW9V9HVES;
14691449
DYLIB_COMPATIBILITY_VERSION = 1;
1470-
DYLIB_CURRENT_VERSION = 53;
1450+
DYLIB_CURRENT_VERSION = 55;
14711451
DYLIB_INSTALL_NAME_BASE = "@rpath";
14721452
ENABLE_MODULE_VERIFIER = YES;
14731453
EXCLUDED_ARCHS = "";
@@ -1514,7 +1494,7 @@
15141494
DEFINES_MODULE = YES;
15151495
DEVELOPMENT_TEAM = 8TW9V9HVES;
15161496
DYLIB_COMPATIBILITY_VERSION = 1;
1517-
DYLIB_CURRENT_VERSION = 53;
1497+
DYLIB_CURRENT_VERSION = 55;
15181498
DYLIB_INSTALL_NAME_BASE = "@rpath";
15191499
ENABLE_MODULE_VERIFIER = YES;
15201500
EXCLUDED_ARCHS = "";

BeeSwift/AppDelegate.swift

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,6 @@ class AppDelegate: UIResponder, UIApplicationDelegate, UNUserNotificationCenterD
2121
let logger = Logger(subsystem: "com.beeminder.beeminder", category: "AppDelegate")
2222
let backgroundUpdates = BackgroundUpdates()
2323

24-
var window: UIWindow?
25-
2624
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
2725
logger.notice("application:didFinishLaunchingWithOptions")
2826

@@ -43,8 +41,8 @@ class AppDelegate: UIResponder, UIApplicationDelegate, UNUserNotificationCenterD
4341

4442
NetworkActivityIndicatorManager.shared.isEnabled = true
4543

46-
NotificationCenter.default.addObserver(self, selector: #selector(self.updateBadgeCount), name: NSNotification.Name(rawValue: GoalManager.goalsUpdatedNotificationName), object: nil)
47-
NotificationCenter.default.addObserver(self, selector: #selector(self.updateBadgeCount), name: NSNotification.Name(rawValue: CurrentUserManager.signedOutNotificationName), object: nil)
44+
NotificationCenter.default.addObserver(self, selector: #selector(self.handleGoalsUpdated), name: NSNotification.Name(rawValue: GoalManager.goalsUpdatedNotificationName), object: nil)
45+
NotificationCenter.default.addObserver(self, selector: #selector(self.handleUserSignedOut), name: NSNotification.Name(rawValue: CurrentUserManager.signedOutNotificationName), object: nil)
4846

4947
backgroundUpdates.startUpdatingRegularlyInBackground()
5048

@@ -128,9 +126,9 @@ class AppDelegate: UIResponder, UIApplicationDelegate, UNUserNotificationCenterD
128126
func application(_ application: UIApplication, didFailToRegisterForRemoteNotificationsWithError error: Error) {
129127
logger.notice("application:didFailToRegisterForRemoteNotificationsWithError")
130128
}
131-
132-
@objc func updateBadgeCount() {
133-
assert(Thread.isMainThread, "updateBadgeCount must be run on the main thread")
129+
130+
@objc private func handleGoalsUpdated() {
131+
assert(Thread.isMainThread, "\(#function) must be run on the main thread")
134132

135133
let context = ServiceLocator.persistentContainer.viewContext
136134
guard let goals = ServiceLocator.goalManager.staleGoals(context: context) else { return }
@@ -139,6 +137,14 @@ class AppDelegate: UIResponder, UIApplicationDelegate, UNUserNotificationCenterD
139137

140138
UNUserNotificationCenter.current().setBadgeCount(beemergencyCount)
141139
}
140+
141+
@objc private func handleUserSignedOut() {
142+
assert(Thread.isMainThread, "\(#function) must be run on the main thread")
143+
144+
logger.notice("User signed out; updating Beemergency badge count to 0")
145+
146+
UNUserNotificationCenter.current().setBadgeCount(0)
147+
}
142148

143149
private func refreshGoalsAndLogErrors() {
144150
Task { @MainActor in

BeeSwift/Base.lproj/Main.storyboard

Lines changed: 0 additions & 53 deletions
This file was deleted.

BeeSwift/DeeplinkGenerator.swift

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
//
2+
// DeeplinkGenerator.swift
3+
// BeeSwift
4+
//
5+
// Created by krugerk on 2024-11-29.
6+
//
7+
8+
9+
struct DeeplinkGenerator {
10+
public static func generateDeepLinkToGoalCommitment(username: String, goalName: String) -> URL {
11+
URL(string: "https://www.beeminder.com/\(username)/\(goalName)#commitment")!
12+
}
13+
14+
public static func generateDeepLinkToGoalStop(username: String, goalName: String) -> URL {
15+
URL(string: "https://www.beeminder.com/\(username)/\(goalName)#stop")!
16+
}
17+
18+
public static func generateDeepLinkToGoalData(username: String, goalName: String) -> URL {
19+
URL(string: "https://www.beeminder.com/\(username)/\(goalName)#data")!
20+
}
21+
22+
public static func generateDeepLinkToGoalStatistics(username: String, goalName: String) -> URL {
23+
URL(string: "https://www.beeminder.com/\(username)/\(goalName)#statistics")!
24+
}
25+
26+
public static func generateDeepLinkToGoalSettings(username: String, goalName: String) -> URL {
27+
URL(string: "https://www.beeminder.com/\(username)/\(goalName)#settings")!
28+
}
29+
30+
public static func generateDeepLinkToUrl(accessToken: String, username: String, url: URL) -> URL {
31+
let baseUrlString = "https://www.beeminder.com/api/v1/users/\(username).json"
32+
33+
var components = URLComponents(string: baseUrlString)!
34+
35+
components.queryItems = [
36+
URLQueryItem(name: "access_token", value: accessToken),
37+
URLQueryItem(name: "redirect_to_url", value: url.absoluteString)
38+
]
39+
40+
return components.url!
41+
}
42+
}

0 commit comments

Comments
 (0)