Skip to content

Bugfix FXIOS-12617 #27494 ⁃ App crashes on siri shortcut open new tab #27496

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking β€œSign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions BrowserKit/Sources/Common/Logger/LoggerCategory.swift
Original file line number Diff line number Diff line change
@@ -51,6 +51,9 @@ public enum LoggerCategory: String {
/// Related to redux library or integration
case redux

/// Related to the settings
case settings

/// Related to the setup of services on app launch.
case setup

16 changes: 13 additions & 3 deletions firefox-ios/Client/Frontend/Extensions/SiriShortcuts.swift
Original file line number Diff line number Diff line change
@@ -2,6 +2,7 @@
// License, v. 2.0. If a copy of the MPL was not distributed with this
// file, You can obtain one at http://mozilla.org/MPL/2.0/

import Common
import Foundation
import Intents
import IntentsUI
@@ -44,9 +45,11 @@ class SiriShortcuts {
}

@MainActor
static func manageSiri(for activityType: SiriShortcuts.activityType, in viewController: UIViewController) {
INVoiceShortcutCenter.shared.getAllVoiceShortcuts { (voiceShortcuts, error) in
guard let voiceShortcuts = voiceShortcuts else { return }
static func manageSiri(for activityType: SiriShortcuts.activityType,
in viewController: UIViewController,
logger: Logger = DefaultLogger.shared) async {
do {
let voiceShortcuts = try await INVoiceShortcutCenter.shared.allVoiceShortcuts()
let foundShortcut = voiceShortcuts.first(where: { (attempt) in
attempt.shortcut.userActivity?.activityType == activityType.rawValue
})
@@ -56,6 +59,13 @@ class SiriShortcuts {
} else {
self.displayAddToSiri(for: activityType, in: viewController)
}
} catch {
logger.log(
"Could not get voice shortcurts: \(error.localizedDescription)",
level: .warning,
category: .settings,
extra: nil
)
}
}
}
Original file line number Diff line number Diff line change
@@ -53,7 +53,7 @@ class SiriOpenURLSetting: Setting {
override func onClick(_ navigationController: UINavigationController?) {
guard let controller = navigationController?.topViewController else { return }
Task { @MainActor in
SiriShortcuts.manageSiri(for: SiriShortcuts.activityType.openURL, in: controller)
await SiriShortcuts.manageSiri(for: SiriShortcuts.activityType.openURL, in: controller)
}
}
}