@@ -55,6 +55,7 @@ public class WeLoop: NSObject {
5555 var invocationMethod : WeLoopInvocation = . manual
5656
5757 /// The time interval between each notification refresh call. Must be set using `setNotificationRefreshInterval`
58+ /// This will only be useful is autoAuthentication has been set to true.
5859 var refreshInterval : TimeInterval = 30.0
5960
6061 // MARK: Object references
@@ -248,11 +249,13 @@ public class WeLoop: NSObject {
248249 weLoopViewController? . window. becomeKey ( )
249250 weLoopViewController? . window. isHidden = false
250251 previousWindow = keyWindow
252+ stopNotificationPolling ( )
251253 }
252254
253255 /// Close the widget, and show the previous window instead
254256 func closeWidget( ) {
255257 guard let project = project, let window = previousWindow else { return }
258+ startNotificationPolling ( )
256259 weLoopViewController? . window. resignKey ( )
257260 weLoopViewController? . window. isHidden = true
258261 window. makeKeyAndVisible ( )
@@ -279,6 +282,8 @@ public class WeLoop: NSObject {
279282 // MARK: Notification Badge
280283
281284 @objc private func startNotificationPolling( ) {
285+ guard autoAuthentication else { return }
286+
282287 notificationRefreshTimer? . invalidate ( )
283288 notificationRefreshTimer = Timer ( timeInterval: refreshInterval, target: self , selector: #selector( refreshNotificationBadge) , userInfo: nil , repeats: true )
284289 RunLoop . main. add ( notificationRefreshTimer!, forMode: . default)
0 commit comments