Remote Command Error Shows When Successful
Describe the bug
When the app is force killed by the user, and a remote command is delivered (i.e. bolus), it is received twice by Loop. The first one will succeed and be followed by an immediate failure for the second. This is confusing to users as they will see a successful delivery and error in Nightscout.
To Reproduce Steps to reproduce the behavior:
- From dev Loop branch, force close the app.
- Send a remote bolus
- The bolus will be delivered
- Wait 30 seconds - NS will show an error and also a successful bolus deliver at the same time.
Expected behavior
Expected for just 1 bolus to deliver.
Screenshots If applicable, add screenshots to help explain your problem.
Phone
- Hardware: iPhone 15
- OS Version: [e.g. iOS 12.0.1]
Loop Version
- Version Number: dev
- Repo: LoopKit/Loop
The issue is the notification is received both in the app launch options and as a delegate callback.
handleRemoteNotificationFromLaunchOptions
func application(_ application: UIApplication, didReceiveRemoteNotification userInfo: [AnyHashable : Any], fetchCompletionHandler completionHandler: @escaping (UIBackgroundFetchResult) -> Void) {
log.default(#function)
completionHandler(loopAppManager.handleRemoteNotification(userInfo as? [String: AnyObject]) ? .noData : .failed)
}
This was fixed in main and dev. It was added with v3.4 of Loop. Please close this issue.