Skip to content

Commit ba84376

Browse files
committed
Update SyncNowSetting to use Notifiable.
1 parent 32fa3f6 commit ba84376

File tree

1 file changed

+14
-9
lines changed

1 file changed

+14
-9
lines changed

firefox-ios/Client/Frontend/Settings/Main/Account/SyncNowSetting.swift

Lines changed: 14 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,8 @@ import Common
66
import Foundation
77
import Shared
88

9-
class SyncNowSetting: WithAccountSetting {
9+
class SyncNowSetting: WithAccountSetting,
10+
Notifiable {
1011
private weak var settingsDelegate: AccountSettingsDelegate?
1112
private var notificationCenter: NotificationProtocol
1213

@@ -27,11 +28,13 @@ class SyncNowSetting: WithAccountSetting {
2728
self.notificationCenter = notificationCenter
2829
super.init(settings: settings)
2930

30-
// FIXME: FXIOS-12995 Use Notifiable
31-
notificationCenter.addObserver(self,
32-
selector: #selector(stopRotateSyncIcon),
33-
name: .ProfileDidFinishSyncing,
34-
object: nil)
31+
startObservingNotifications(
32+
withNotificationCenter: notificationCenter,
33+
forObserver: self,
34+
observing: [
35+
.ProfileDidFinishSyncing
36+
]
37+
)
3538
}
3639

3740
private lazy var timestampFormatter: DateFormatter = {
@@ -70,9 +73,11 @@ class SyncNowSetting: WithAccountSetting {
7073
}
7174
}
7275

73-
@objc
74-
func stopRotateSyncIcon() {
75-
DispatchQueue.main.async {
76+
// MARK: Notifiable
77+
func handleNotifications(_ notification: Notification) {
78+
guard notification.name == .ProfileDidFinishSyncing else { return }
79+
80+
ensureMainThread {
7681
self.imageView.layer.removeAllAnimations()
7782
}
7883
}

0 commit comments

Comments
 (0)