Loop icon indicating copy to clipboard operation
Loop copied to clipboard

Remote Command Error Shows When Successful

Open gestrich opened this issue 1 year ago • 1 comments

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:

  1. From dev Loop branch, force close the app.
  2. Send a remote bolus
  3. The bolus will be delivered
  4. 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

gestrich avatar Jun 12 '24 22:06 gestrich

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)
    }

gestrich avatar Jun 13 '24 09:06 gestrich

This was fixed in main and dev. It was added with v3.4 of Loop. Please close this issue.

marionbarker avatar Mar 14 '25 19:03 marionbarker