Skip to content

Commit

Permalink
Make voice search opt in (duckduckgo#1227)
Browse files Browse the repository at this point in the history
Task/Issue URL: https://app.asana.com/0/414235014887631/1202533216912528/f

Description:
We're changing the default behavior of voice-search. Before it was always on, now it's an opt-in feature where users can turn it on/off via Settings.
  • Loading branch information
Bunn authored Jul 22, 2022
1 parent 24747fe commit 2b31809
Show file tree
Hide file tree
Showing 159 changed files with 4,813 additions and 1,056 deletions.
3 changes: 2 additions & 1 deletion Core/UserDefaultsPropertyWrapper.swift
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,8 @@ public struct UserDefaultsWrapper<T> {
case autofillFirstTimeUser = "com.duckduckgo.ios.autofillFirstTimeUser"

case featureFlaggingDidVerifyInternalUser = "com.duckduckgo.app.featureFlaggingDidVerifyInternalUser"


case voiceSearchEnabled = "com.duckduckgo.app.voiceSearchEnabled"
}

private let key: Key
Expand Down
4 changes: 4 additions & 0 deletions DuckDuckGo.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,7 @@
31A42564285A09E800049386 /* FaviconView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 31A42563285A09E800049386 /* FaviconView.swift */; };
31A42566285A0A6300049386 /* FaviconViewModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 31A42565285A0A6300049386 /* FaviconViewModel.swift */; };
31B1FA87286EFC5C00CA3C1C /* XCTestCaseExtension.swift in Sources */ = {isa = PBXBuildFile; fileRef = 31B1FA86286EFC5C00CA3C1C /* XCTestCaseExtension.swift */; };
31B2F11F287846320040427A /* NoMicPermissionAlert.swift in Sources */ = {isa = PBXBuildFile; fileRef = 31B2F11E287846320040427A /* NoMicPermissionAlert.swift */; };
31B524572715BB23002225AB /* WebJSAlert.swift in Sources */ = {isa = PBXBuildFile; fileRef = 31B524562715BB23002225AB /* WebJSAlert.swift */; };
31C138A427A3352600FFD4B2 /* DownloadTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 31C138A227A3350A00FFD4B2 /* DownloadTests.swift */; };
31C138A827A3E9C900FFD4B2 /* URLDownloadSession.swift in Sources */ = {isa = PBXBuildFile; fileRef = 31C138A727A3E9C900FFD4B2 /* URLDownloadSession.swift */; };
Expand Down Expand Up @@ -876,6 +877,7 @@
31A42563285A09E800049386 /* FaviconView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = FaviconView.swift; sourceTree = "<group>"; };
31A42565285A0A6300049386 /* FaviconViewModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = FaviconViewModel.swift; sourceTree = "<group>"; };
31B1FA86286EFC5C00CA3C1C /* XCTestCaseExtension.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = XCTestCaseExtension.swift; sourceTree = "<group>"; };
31B2F11E287846320040427A /* NoMicPermissionAlert.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = NoMicPermissionAlert.swift; sourceTree = "<group>"; };
31B524562715BB23002225AB /* WebJSAlert.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = WebJSAlert.swift; sourceTree = "<group>"; };
31C138A227A3350A00FFD4B2 /* DownloadTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DownloadTests.swift; sourceTree = "<group>"; };
31C138A727A3E9C900FFD4B2 /* URLDownloadSession.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = URLDownloadSession.swift; sourceTree = "<group>"; };
Expand Down Expand Up @@ -4011,6 +4013,7 @@
310742A52848CD780012660B /* BackForwardMenuHistoryItem.swift */,
85864FBB24D31EF300E756FF /* SuggestionTrayViewController.swift */,
8577A1C4255D2C0D00D43FCD /* HitTestingToolbar.swift */,
31B2F11E287846320040427A /* NoMicPermissionAlert.swift */,
);
name = Main;
sourceTree = "<group>";
Expand Down Expand Up @@ -5040,6 +5043,7 @@
F1617C151E57336D00DEDCAF /* TabManager.swift in Sources */,
85449EF523FDA02800512AAF /* KeyboardSettingsViewController.swift in Sources */,
85C11E4C2090888C00BFFEB4 /* HomeRowReminder.swift in Sources */,
31B2F11F287846320040427A /* NoMicPermissionAlert.swift in Sources */,
310C4B45281B5A9A00BA79A9 /* AutofillLoginDetailsView.swift in Sources */,
1EFDCBC127D2393C00916BC5 /* DownloadsDeleteHelper.swift in Sources */,
85374D3C21AC41E700FF5A1E /* FavoritesHomeViewSectionRenderer.swift in Sources */,
Expand Down
2 changes: 2 additions & 0 deletions DuckDuckGo/AppDelegate.swift
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,8 @@ class AppDelegate: UIResponder, UIApplicationDelegate {
}

clearLegacyAllowedDomainCookies()

AppDependencyProvider.shared.voiceSearchHelper.migrateSettingsFlagIfNecessary()

// Task handler registration needs to happen before the end of `didFinishLaunching`, otherwise submitting a task can throw an exception.
// Having both in `didBecomeActive` can sometimes cause the exception when running on a physical device, so registration happens here.
Expand Down
1 change: 1 addition & 0 deletions DuckDuckGo/AppSettings.swift
Original file line number Diff line number Diff line change
Expand Up @@ -36,4 +36,5 @@ protocol AppSettings: AnyObject {

var autofill: Bool { get set }

var voiceSearchEnabled: Bool { get set }
}
2 changes: 2 additions & 0 deletions DuckDuckGo/AppUserDefaults.swift
Original file line number Diff line number Diff line change
Expand Up @@ -171,6 +171,8 @@ public class AppUserDefaults: AppSettings {
@UserDefaultsWrapper(key: .autofill, defaultValue: true)
var autofill: Bool

@UserDefaultsWrapper(key: .voiceSearchEnabled, defaultValue: false)
var voiceSearchEnabled: Bool
}

extension AppUserDefaults: AppConfigurationFetchStatistics {
Expand Down
13 changes: 7 additions & 6 deletions DuckDuckGo/Base.lproj/OmniBar.xib
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
<?xml version="1.0" encoding="UTF-8"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="19455" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES">
<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="20037" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES">
<device id="ipad12_9rounded" orientation="landscape" layout="fullscreen" appearance="light"/>
<dependencies>
<deployment identifier="iOS"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="19454"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="20020"/>
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
</dependencies>
<customFonts key="customFonts">
Expand Down Expand Up @@ -88,7 +88,7 @@
</constraints>
</imageView>
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="sek-4Y-GoT" customClass="SearchFieldContainerView" customModule="DuckDuckGo" customModuleProvider="target">
<rect key="frame" x="30" y="0.0" width="345" height="40"/>
<rect key="frame" x="30" y="0.0" width="335" height="40"/>
<subviews>
<view clipsSubviews="YES" contentMode="scaleToFill" horizontalHuggingPriority="251" horizontalCompressionResistancePriority="250" translatesAutoresizingMaskIntoConstraints="NO" id="4JV-px-Ypi" customClass="SiteRatingContainerView" customModule="DuckDuckGo" customModuleProvider="target">
<rect key="frame" x="0.0" y="0.0" width="120" height="40"/>
Expand Down Expand Up @@ -153,7 +153,7 @@
</connections>
</view>
<textField opaque="NO" clipsSubviews="YES" contentMode="scaleToFill" contentHorizontalAlignment="left" contentVerticalAlignment="center" textAlignment="natural" adjustsFontSizeToFit="NO" minimumFontSize="17" translatesAutoresizingMaskIntoConstraints="NO" id="fqM-N4-jNd" customClass="TextFieldWithInsets" customModule="DuckDuckGo" customModuleProvider="target">
<rect key="frame" x="30" y="0.0" width="315" height="40"/>
<rect key="frame" x="30" y="0.0" width="305" height="40"/>
<color key="tintColor" red="1" green="1" blue="1" alpha="1" colorSpace="calibratedRGB"/>
<accessibility key="accessibilityConfiguration" identifier="searchEntry">
<accessibilityTraits key="traits" searchField="YES"/>
Expand Down Expand Up @@ -194,10 +194,11 @@
</connections>
</view>
<button opaque="NO" contentMode="scaleToFill" horizontalHuggingPriority="750" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="system" reversesTitleShadowWhenHighlighted="YES" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="ita-iD-8ad" userLabel="Voice Button">
<rect key="frame" x="375" y="8" width="30" height="24"/>
<rect key="frame" x="365" y="0.0" width="40" height="40"/>
<accessibility key="accessibilityConfiguration" label="Voice Search"/>
<constraints>
<constraint firstAttribute="width" priority="900" constant="30" id="80Y-p8-kj7"/>
<constraint firstAttribute="width" priority="900" constant="40" id="80Y-p8-kj7"/>
<constraint firstAttribute="height" constant="40" id="HBn-w2-Tbm"/>
</constraints>
<state key="normal" image="MicrophoneSolid"/>
<connections>
Expand Down
Loading

0 comments on commit 2b31809

Please sign in to comment.