Skip to content
This repository has been archived by the owner on Mar 6, 2024. It is now read-only.

Commit

Permalink
Fixes #1545: Set SiriShortcuts correctly (#1584)
Browse files Browse the repository at this point in the history
  • Loading branch information
Meng-Wei authored and sblatz committed Nov 21, 2018
1 parent a306479 commit 9c24468
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
10 changes: 5 additions & 5 deletions Blockzilla/SettingsViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -510,11 +510,11 @@ class SettingsViewController: UIViewController, UITableViewDataSource, UITableVi
siriCell.accessoryLabel.text = result ? UIConstants.strings.Edit : UIConstants.strings.addToSiri
}
} else if indexPath.row == 1 {
siriCell.labelText = UIConstants.strings.eraseAndOpenSiri
siriCell.accessibilityIdentifier = "settingsViewController.siriEraseAndOpenCell"
SiriShortcuts().hasAddedActivity(type: .eraseAndOpen) { (result: Bool) in
siriCell.accessoryLabel.text = result ? UIConstants.strings.Edit : UIConstants.strings.addToSiri
}
siriCell.labelText = UIConstants.strings.eraseAndOpenSiri
siriCell.accessibilityIdentifier = "settingsViewController.siriEraseAndOpenCell"
SiriShortcuts().hasAddedActivity(type: .eraseAndOpen) { (result: Bool) in
siriCell.accessoryLabel.text = result ? UIConstants.strings.Edit : UIConstants.strings.addToSiri
}
} else {
siriCell.labelText = UIConstants.strings.openUrlSiri
siriCell.accessibilityIdentifier = "settingsViewController.siriOpenURLCell"
Expand Down
4 changes: 2 additions & 2 deletions Blockzilla/SiriShortcuts.swift
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ class SiriShortcuts {
attempt.shortcut.userActivity?.activityType == type.rawValue
}.first
// Next, check for intent, which is used for shortcuts that work in the background
if foundShortcut == nil {
if type == SiriShortcuts.activityType.erase && foundShortcut == nil {
foundShortcut = voiceShortcuts.filter { (attempt) in
attempt.shortcut.intent as? EraseIntent != nil
}.first
Expand Down Expand Up @@ -107,7 +107,7 @@ class SiriShortcuts {
var foundShortcut = voiceShortcuts.filter { (attempt) in
attempt.shortcut.userActivity?.activityType == activityType.rawValue
}.first
if foundShortcut == nil {
if activityType == SiriShortcuts.activityType.erase && foundShortcut == nil {
foundShortcut = voiceShortcuts.filter { (attempt) in
attempt.shortcut.intent as? EraseIntent != nil
}.first
Expand Down

0 comments on commit 9c24468

Please sign in to comment.