Skip to content

Commit

Permalink
Update to application-services v73.0.0.
Browse files Browse the repository at this point in the history
This release includes new auto-generated Swift bindings for the FxA Client
component, which come with a few breaking API changes. There should be
no changes in functionality though.
  • Loading branch information
rfk committed Mar 10, 2021
1 parent 22b5fc8 commit d68f5d8
Show file tree
Hide file tree
Showing 6 changed files with 14 additions and 9 deletions.
9 changes: 6 additions & 3 deletions Account/FxAPushMessageHandler.swift
Original file line number Diff line number Diff line change
Expand Up @@ -81,11 +81,11 @@ extension FxAPushMessageHandler {
os_log("%{public}@", log: OSLog(subsystem: "org.mozilla.firefox", category: "firefoxnotificationservice"), type: OSLogType.debug, "Multiple events arrived, only handling the first event.")
}
switch firstEvent {
case .incomingDeviceCommand(let deviceCommand):
case .commandReceived(let deviceCommand):
switch deviceCommand {
case .tabReceived(_, let tabData):
let title = tabData.last?.title ?? ""
let url = tabData.last?.url ?? ""
let title = tabData.entries.last?.title ?? ""
let url = tabData.entries.last?.url ?? ""
let message = PushMessage.commandReceived(tab: ["title": title, "url": url])
if let json = try? accountManager.gatherTelemetry() {
let events = FxATelemetry.parseTelemetry(fromJSONString: json)
Expand Down Expand Up @@ -124,6 +124,9 @@ extension FxAPushMessageHandler {

deferred.fill(Maybe(success: message))
}
default:
// There are other events, but we ignore them at this level.
do {}
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion Cartfile
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,4 @@ github "Leanplum/Leanplum-iOS-SDK" ~> 2.7.2
github "mozilla-services/shavar-prod-lists" "86.0"

# Use release version of application-services
github "mozilla/application-services" "v69.0.0"
github "mozilla/application-services" "v73.0.0"
2 changes: 1 addition & 1 deletion Client/Application/AppDelegate+PushNotifications.swift
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ extension AppDelegate {
// If we see our local device with a pushEndpointExpired flag, clear the APNS token and re-register.
NotificationCenter.default.addObserver(forName: .constellationStateUpdate, object: nil, queue: nil) { notification in
if let newState = notification.userInfo?["newState"] as? ConstellationState {
if newState.localDevice?.subscriptionExpired ?? false {
if newState.localDevice?.pushEndpointExpired ?? false {
KeychainWrapper.sharedAppContainerKeychain.removeObject(forKey: KeychainKey.apnsToken, withAccessibility: .afterFirstUnlock)
NotificationCenter.default.post(name: .RegisterForPushNotifications, object: nil)
}
Expand Down
3 changes: 2 additions & 1 deletion Client/Frontend/Extensions/DevicePickerViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,8 @@ class DevicePickerViewController: UITableViewController {

self.devices = state.remoteDevices.map { d in
let t = "\(d.deviceType)"
return RemoteDevice(id: d.id, name: d.displayName, type: t, isCurrentDevice: d.isCurrentDevice, lastAccessTime: d.lastAccessTime, availableCommands: nil)
let lastAccessTime = d.lastAccessTime == nil ? nil : UInt64(clamping: d.lastAccessTime!)
return RemoteDevice(id: d.id, name: d.displayName, type: t, isCurrentDevice: d.isCurrentDevice, lastAccessTime: lastAccessTime, availableCommands: nil)
}

if self.devices.isEmpty {
Expand Down
3 changes: 2 additions & 1 deletion Providers/Profile.swift
Original file line number Diff line number Diff line change
Expand Up @@ -924,7 +924,8 @@ open class BrowserProfile: Profile {
guard let self = self else { return }
let devices = state.remoteDevices.map { d -> RemoteDevice in
let t = "\(d.deviceType)"
return RemoteDevice(id: d.id, name: d.displayName, type: t, isCurrentDevice: d.isCurrentDevice, lastAccessTime: d.lastAccessTime, availableCommands: nil)
let lastAccessTime = d.lastAccessTime == nil ? nil : UInt64(clamping: d.lastAccessTime!)
return RemoteDevice(id: d.id, name: d.displayName, type: t, isCurrentDevice: d.isCurrentDevice, lastAccessTime: lastAccessTime, availableCommands: nil)
}
let _ = self.profile.remoteClientsAndTabs.replaceRemoteDevices(devices)
}
Expand Down
4 changes: 2 additions & 2 deletions RustFxA/RustFirefoxAccounts.swift
Original file line number Diff line number Diff line change
Expand Up @@ -231,7 +231,7 @@ open class RustFirefoxAccounts {
/// Rust FxA notification handlers can call this to update caches and the UI.
private func update() {
guard let accountManager = accountManager.peek() else { return }
let avatarUrl = accountManager.accountProfile()?.avatar?.url
let avatarUrl = accountManager.accountProfile()?.avatar
if let str = avatarUrl, let url = URL(string: str) {
avatar = Avatar(url: url)
}
Expand Down Expand Up @@ -313,7 +313,7 @@ public struct FxAUserProfile: Codable, Equatable {
init(profile: MozillaAppServices.Profile) {
uid = profile.uid
email = profile.email
avatarUrl = profile.avatar?.url
avatarUrl = profile.avatar
displayName = profile.displayName
}
}

0 comments on commit d68f5d8

Please sign in to comment.