Skip to content
This repository was archived by the owner on Jun 4, 2025. It is now read-only.

Commit ec0b653

Browse files
committed
start and stop polling when showing widget
1 parent 3d48881 commit ec0b653

File tree

2 files changed

+6
-1
lines changed

2 files changed

+6
-1
lines changed

WeLoop.podspec

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88

99
Pod::Spec.new do |s|
1010
s.name = 'WeLoop'
11-
s.version = '0.2.3'
11+
s.version = '1.0.0'
1212
s.summary = 'Integrate WeLoop to your iOS project'
1313

1414
s.description = <<-DESC

WeLoop/Classes/WeLoop.swift

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -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

Comments
 (0)