Skip to content

Commit

Permalink
[8939] Send UUID in userInfo for consistency. (#20260)
Browse files Browse the repository at this point in the history
  • Loading branch information
mattreaganmozilla committed May 16, 2024
1 parent ea1a7be commit 4a04f21
Show file tree
Hide file tree
Showing 19 changed files with 21 additions and 20 deletions.
5 changes: 3 additions & 2 deletions BrowserKit/Sources/Common/Theming/DefaultThemeManager.swift
Original file line number Diff line number Diff line change
Expand Up @@ -225,8 +225,9 @@ public final class DefaultThemeManager: ThemeManager, Notifiable {
self.windows[window]?.overrideUserInterfaceStyle = style

mainQueue.ensureMainThread { [weak self] in
// TODO: [FXIOS-8939] Send UUID in userInfo payload rather than object for consistency with Client.
self?.notificationCenter.post(name: .ThemeDidChange, withObject: window)
// Eventually WindowUUID and its extensions will be moved into BrowserKit. [FXIOS-9145]
// Once that happens we should replace this string literal with `WindowUUID.userInfoKey`
self?.notificationCenter.post(name: .ThemeDidChange, withUserInfo: ["windowUUID": window])
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ struct AddressAutofillSettingsView: View {
applyTheme(theme: themeManager.currentTheme(for: windowUUID))
}
.onReceive(NotificationCenter.default.publisher(for: .ThemeDidChange)) { notification in
guard let uuid = notification.object as? UUID, uuid == windowUUID else { return }
guard let uuid = notification.windowUUID, uuid == windowUUID else { return }
applyTheme(theme: themeManager.currentTheme(for: windowUUID))
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ struct AddressAutofillToggle: View {
applyTheme(theme: themeManager.currentTheme(for: windowUUID))
}
.onReceive(NotificationCenter.default.publisher(for: .ThemeDidChange)) { notification in
guard let uuid = notification.object as? UUID, uuid == windowUUID else { return }
guard let uuid = notification.windowUUID, uuid == windowUUID else { return }
applyTheme(theme: themeManager.currentTheme(for: windowUUID))
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ struct AddressCellView: View {
applyTheme(theme: themeManager.currentTheme(for: windowUUID))
}
.onReceive(NotificationCenter.default.publisher(for: .ThemeDidChange)) { notification in
guard let uuid = notification.object as? UUID, uuid == windowUUID else { return }
guard let uuid = notification.windowUUID, uuid == windowUUID else { return }
applyTheme(theme: themeManager.currentTheme(for: windowUUID))
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ struct AddressListView: View {
applyTheme(theme: themeManager.currentTheme(for: windowUUID))
}
.onReceive(NotificationCenter.default.publisher(for: .ThemeDidChange)) { notification in
guard let uuid = notification.object as? UUID, uuid == windowUUID else { return }
guard let uuid = notification.windowUUID, uuid == windowUUID else { return }
applyTheme(theme: themeManager.currentTheme(for: windowUUID))
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ struct AddressScrollView: View {
applyTheme(theme: themeManager.currentTheme(for: windowUUID))
}
.onReceive(NotificationCenter.default.publisher(for: .ThemeDidChange)) { notification in
guard let uuid = notification.object as? UUID, uuid == windowUUID else { return }
guard let uuid = notification.windowUUID, uuid == windowUUID else { return }
applyTheme(theme: themeManager.currentTheme(for: windowUUID))
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ struct AutofillFooterView: View {
applyTheme(theme: themeManager.currentTheme(for: windowUUID))
}
.onReceive(NotificationCenter.default.publisher(for: .ThemeDidChange)) { notification in
guard let uuid = notification.object as? UUID, uuid == windowUUID else { return }
guard let uuid = notification.windowUUID, uuid == windowUUID else { return }
applyTheme(theme: themeManager.currentTheme(for: windowUUID))
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ struct AutofillHeaderView: View {
applyTheme(theme: themeManager.currentTheme(for: windowUUID))
}
.onReceive(NotificationCenter.default.publisher(for: .ThemeDidChange)) { notification in
guard let uuid = notification.object as? UUID, uuid == windowUUID else { return }
guard let uuid = notification.windowUUID, uuid == windowUUID else { return }
applyTheme(theme: themeManager.currentTheme(for: windowUUID))
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ struct CreditCardInputView: View {
applyTheme(theme: themeManager.currentTheme(for: windowUUID))
}
.onReceive(NotificationCenter.default.publisher(for: .ThemeDidChange)) { notification in
guard let uuid = notification.object as? UUID, uuid == windowUUID else { return }
guard let uuid = notification.windowUUID, uuid == windowUUID else { return }
applyTheme(theme: themeManager.currentTheme(for: windowUUID))
}
.onReceive(NotificationCenter.default.publisher(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ struct CreditCardItemRow: View {
applyTheme(theme: themeManager.currentTheme(for: windowUUID))
}
.onReceive(NotificationCenter.default.publisher(for: .ThemeDidChange)) { notification in
guard let uuid = notification.object as? UUID, uuid == windowUUID else { return }
guard let uuid = notification.windowUUID, uuid == windowUUID else { return }
applyTheme(theme: themeManager.currentTheme(for: windowUUID))
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ struct CreditCardSectionHeader: View {
applyTheme(theme: themeManager.currentTheme(for: windowUUID))
}
.onReceive(NotificationCenter.default.publisher(for: .ThemeDidChange)) { notification in
guard let uuid = notification.object as? UUID, uuid == windowUUID else { return }
guard let uuid = notification.windowUUID, uuid == windowUUID else { return }
applyTheme(theme: themeManager.currentTheme(for: windowUUID))
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ struct CreditCardSettingsEmptyView: View {
applyTheme(theme: themeManager.currentTheme(for: windowUUID))
}
.onReceive(NotificationCenter.default.publisher(for: .ThemeDidChange)) { notification in
guard let uuid = notification.object as? UUID, uuid == windowUUID else { return }
guard let uuid = notification.windowUUID, uuid == windowUUID else { return }
applyTheme(theme: themeManager.currentTheme(for: windowUUID))
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ struct CreditCardAutofillToggle: View {
applyTheme(theme: themeManager.currentTheme(for: windowUUID))
}
.onReceive(NotificationCenter.default.publisher(for: .ThemeDidChange)) { notification in
guard let uuid = notification.object as? UUID, uuid == windowUUID else { return }
guard let uuid = notification.windowUUID, uuid == windowUUID else { return }
applyTheme(theme: themeManager.currentTheme(for: windowUUID))
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ struct CreditCardInputField: View {
applyTheme(theme: themeManager.currentTheme(for: windowUUID))
}
.onReceive(NotificationCenter.default.publisher(for: .ThemeDidChange)) { notification in
guard let uuid = notification.object as? UUID, uuid == windowUUID else { return }
guard let uuid = notification.windowUUID, uuid == windowUUID else { return }
applyTheme(theme: themeManager.currentTheme(for: windowUUID))
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ struct RemoveCardButton: View {
applyTheme(theme: themeManager.currentTheme(for: windowUUID))
}
.onReceive(NotificationCenter.default.publisher(for: .ThemeDidChange)) { notification in
guard let uuid = notification.object as? UUID, uuid == windowUUID else { return }
guard let uuid = notification.windowUUID, uuid == windowUUID else { return }
applyTheme(theme: themeManager.currentTheme(for: windowUUID))
}
.onReceive(NotificationCenter.default.publisher(for: UIApplication.willResignActiveNotification)) { _ in
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ struct LoginAutofillView: View {
applyTheme(theme: themeManager.currentTheme(for: windowUUID))
}
.onReceive(NotificationCenter.default.publisher(for: .ThemeDidChange)) { notification in
guard let uuid = notification.object as? UUID, uuid == windowUUID else { return }
guard let uuid = notification.windowUUID, uuid == windowUUID else { return }
applyTheme(theme: themeManager.currentTheme(for: windowUUID))
}
}
Expand Down
2 changes: 1 addition & 1 deletion firefox-ios/Client/Frontend/Autofill/LoginCellView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ struct LoginCellView: View {
applyTheme(theme: themeManager.currentTheme(for: windowUUID))
}
.onReceive(NotificationCenter.default.publisher(for: .ThemeDidChange)) { notification in
guard let uuid = notification.object as? UUID, uuid == windowUUID else { return }
guard let uuid = notification.windowUUID, uuid == windowUUID else { return }
applyTheme(theme: themeManager.currentTheme(for: windowUUID))
}
}
Expand Down
2 changes: 1 addition & 1 deletion firefox-ios/Client/Frontend/Autofill/LoginListView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ struct LoginListView: View {
applyTheme(theme: themeManager.currentTheme(for: windowUUID))
}
.onReceive(NotificationCenter.default.publisher(for: .ThemeDidChange)) { notification in
guard let uuid = notification.object as? UUID, uuid == windowUUID else { return }
guard let uuid = notification.windowUUID, uuid == windowUUID else { return }
applyTheme(theme: themeManager.currentTheme(for: windowUUID))
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ struct CircularProgressView: View, ThemeApplicable {
applyTheme(theme: themeManager.currentTheme(for: windowUUID))
}
.onReceive(NotificationCenter.default.publisher(for: .ThemeDidChange)) { notification in
guard let uuid = notification.object as? UUID, uuid == windowUUID else { return }
guard let uuid = notification.windowUUID, uuid == windowUUID else { return }
applyTheme(theme: themeManager.currentTheme(for: windowUUID))
}
}
Expand Down

0 comments on commit 4a04f21

Please sign in to comment.