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

Feature: #2227: Siri Shortcuts (Activity/Custom Intents) #3579

Merged
merged 36 commits into from
Jul 16, 2021

Conversation

soner-yuksel
Copy link
Contributor

@soner-yuksel soner-yuksel commented Apr 26, 2021

This PR is adding wide-variety support for Shortcuts and Siri Integration in Brave to surface in Spotlight as well as command Siri with voice.

The implementation supports both Activity and Custom Intent based Shortcut / Donation from Brave.

First part is adding the User Activities that allows user to expose certain things a user can do for app hand-off and Spotlight searches. This activity options are used for user to go from Siri into your app to complete a task. And these actions should provide easy way to access some frequent functionality in the application. These shortcuts are designed to be accessed inside the application and inside Settings an easy way is provided to user to add update and delete these shortcuts.

User Activity Shortcut list is as follows:

  • Open New Tab
  • Open New Private Tab
  • Clear Browser History
  • Enable VPN
  • Open Brave Today
  • Open Playlist

In Addition to these 6 Activity Based Shortcuts, we also added 3 different type of Custom Intent based Shortcuts inside the application.

Custom Intents are used so we can also add shortcuts that supports parameters and success/fail responses to these parameters. In addition we can also provide smart donations to the system so a repeated action would be indexed properly by the iOS.

Custom Intent Shortcut list is as follows

  • Open Website (with certain website URL)
  • Open Website from History (with certain website URL)
  • Open Website from Bookmarks (with certain website URL)

Open Website Shortcuts is designed so websiteURL parameter can be user-configurable inside shortcuts App and Add to Siri. When configured this parameter will be validated and a response will be shown to user before shortcuts is executed.

Custom Intent Shortcuts are very important to help and enhance user interaction with the application. A repeated re-direction of same URL will eventually seen as a suggestion on home page and spotlight.

All these activity and custom intents are donated to the iOS so a behaviour that turn into a habit will be suggested to user in various places which actually is the most important part of the Shortcut implementation.

Also the basic functionality of using shortcuts itself, for instance "Open Brave Today" will be helpful for some advanced user base.

Summary of Changes

This pull request fixes #2227

Security Ticket :https://github.com/brave/security/issues/471

Submitter Checklist:

  • Unit Tests are updated to cover new or changed functionality
  • User-facing strings use NSLocalizableString()

Test Plan:

First Part of the test should be testing basic functionality of Activity Based Shortcuts (Add/Update them inside The Brave App and use them with Siri)

  • Navigate Settings - General - Siri Shortcuts
  • Test functionality of "Add to Siri", "Delete Shortcut", and editing When I say field and update shortcut details
  • Use them with Siri and check out all 6 different Activity based typed mentioned in description is working as expected
    (Like when you add Open Playlist does it open the application and displays Playlist) etc.

Second Part of the test should be testing all 9 different shortcuts (Activity/Intent Based) inside Shortcuts application

  • Find shortcuts application and check Brave Shortcuts.
  • Try them using shortcuts app including custom intent ones like Open Website
  • For custom Intent shortcuts try editing websiteURL parameter

Third Part of the test should be testing donations to the system is actually working as suggestions on Home Screen / Lock Screen / While Searching (Spotlight)

  • We dont have any control over how suggestions are working in iOS. We can only donate it to operating system. The display algorithm and discoverability is controlled by iOS.

However to test shortcuts are appearing as suggestions, under Settings -> Siri & Search -> Siri Suggestions, different suggestion toggles should be enabled to see them in different places in the phone. (default should be on)

In addition under Settings -> Developer -> Shortcuts Testing

Display Recent Shortcuts / Display Upcoming Media / Display Donations on Lock Screen should be enabled so most recent donations can appear in places mentioned above. Lets not forget these are developer settings fo rtesting, in a real life scenario these donations might not appear as suggestions anywhere until they are marked as a habit by the system and criteria about this is unknown.

Screenshots:

In-App Activity Based Shortcut Setup:

1

Shortcut App / Intent Based Customization/Spotlight

2 2

Custom Intent Execution Example:

RPReplay_Final1622213795.MP4

Run a shortcut using Sri 😄

RPReplay_Final1622218063.MP4

Reviewer Checklist:

  • Issues include necessary QA labels:
    • QA/(Yes|No)
    • release-notes/(include|exclude)
    • bug / enhancement
  • Necessary security reviews have taken place.
  • Adequate unit test coverage exists to prevent regressions.
  • Adequate test plan exists for QA to validate (if applicable).
  • Issue is assigned to a milestone (should happen at merge time).

@soner-yuksel soner-yuksel added this to the 1.26 milestone Apr 26, 2021
@soner-yuksel soner-yuksel self-assigned this Apr 26, 2021
@iccub iccub modified the milestones: 1.26, 1.27 May 5, 2021
@iccub iccub modified the milestones: 1.27, 1.28 May 26, 2021
@soner-yuksel soner-yuksel requested review from Brandon-T, kylehickinson and iccub and removed request for Brandon-T May 28, 2021 16:29
@soner-yuksel soner-yuksel marked this pull request as ready for review May 28, 2021 16:29
@soner-yuksel soner-yuksel changed the title [WIP] Feature: #2227: Siri Shortcuts (Activity/Custom Intents) Feature: #2227: Siri Shortcuts (Activity/Custom Intents) May 28, 2021
Copy link
Contributor

@iccub iccub left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Small code style review

BraveShared/BraveStrings.swift Outdated Show resolved Hide resolved
BraveShared/BraveStrings.swift Outdated Show resolved Hide resolved
BraveShared/BraveStrings.swift Outdated Show resolved Hide resolved
BraveShared/BraveStrings.swift Outdated Show resolved Hide resolved
Client/Application/Shortcuts/ActivityShortcutManager.swift Outdated Show resolved Hide resolved
Client/Application/Shortcuts/ActivityShortcutManager.swift Outdated Show resolved Hide resolved
Client/Application/Shortcuts/ActivityShortcutManager.swift Outdated Show resolved Hide resolved
Client/Application/Shortcuts/ActivityShortcutManager.swift Outdated Show resolved Hide resolved
@soner-yuksel soner-yuksel requested a review from iccub June 22, 2021 17:17
@iccub iccub modified the milestones: 1.28, 1.29 Jun 25, 2021
Copy link
Contributor

@iccub iccub left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code looks good, left functional review offline

@iccub iccub merged commit 3a040a8 into development Jul 16, 2021
@iccub iccub deleted the feature/some-siri-shortcuts branch July 16, 2021 14:58
iccub added a commit that referenced this pull request Jul 16, 2021
Enterprise profile will be handled at later point.
iccub added a commit that referenced this pull request Jul 16, 2021
Enterprise profile will be handled at later point.
iccub added a commit that referenced this pull request Jul 19, 2021
@soner-yuksel soner-yuksel restored the feature/some-siri-shortcuts branch August 5, 2021 16:30
@soner-yuksel soner-yuksel deleted the feature/some-siri-shortcuts branch November 28, 2022 17:03
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Implement Siri Shortcuts
4 participants