Skip to content

Commit

Permalink
Merge branch 'main' into jacek/xcode15
Browse files Browse the repository at this point in the history
* main:
  deps BrowserServicesKit 100.0.3 + content-scope-scripts 4.59.0 (#2304)
  bookmarks migration refactor (#2236)
  respect system theme on launch (#2302)
  remove unused pixels (#2303)
  Bump submodules/privacy-reference-tests from `a3acc21` to `6b7ad1e` (#2285)
  Update Sync End-to-End tests (#2300)
  Allow calculations in the address bar (#2298)
  Remove trailing space in unableToCreateRecoveryPDF error (#2297)
  Update errors (#2283)
  BSK update for autofill never prompt to save for site feature (#2280)
  Add timeouts to the alpha job.
  • Loading branch information
samsymons committed Jan 8, 2024
2 parents f761958 + e62c7ea commit 51a48fe
Show file tree
Hide file tree
Showing 23 changed files with 376 additions and 251 deletions.
1 change: 1 addition & 0 deletions .github/workflows/alpha.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ jobs:
make-alpha:
runs-on: macos-13
name: Make TestFlight Alpha Build
timeout-minutes: 30

env:
destination: ${{ github.event.inputs.destination || inputs.destination }}
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/sync-end-to-end.yml
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ jobs:
name: Sync End To End Tests
needs: build-for-sync-end-to-end-tests
runs-on: macos-13
timeout-minutes: 30
timeout-minutes: 60
strategy:
matrix:
os-version: [15, 16, 17]
Expand Down
2 changes: 1 addition & 1 deletion .maestro/sync_tests/05_delete_account.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -35,5 +35,5 @@ tags:
- assertVisible: Scan QR Code
- tapOn: Manually Enter Code
- tapOn: Paste
- assertVisible: Sync Error
- assertVisible: Sync & Backup Error
- tapOn: OK
1 change: 1 addition & 0 deletions .swiftlint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -95,3 +95,4 @@ excluded:
- vendor
- LocalPackages/*/Package.swift
- PacketTunnelProvider/ProxyServer
- .ruby-lsp
1 change: 1 addition & 0 deletions Core/Pixel.swift
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,7 @@ public struct PixelParameters {
public static let emailKeychainKeychainOperation = "keychain_operation"

public static let bookmarkErrorOrphanedFolderCount = "bookmark_error_orphaned_count"
public static let bookmarksLastGoodVersion = "previous_app_version"

// Remote messaging
public static let message = "message"
Expand Down
114 changes: 5 additions & 109 deletions Core/PixelEvent.swift
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,6 @@ extension Pixel {
case dashboardProtectionAllowlistRemove

case privacyDashboardReportBrokenSite
case privacyDashboardPixelFromJS(rawPixel: String)

case tabSwitcherNewLayoutSeen
case tabSwitcherListEnabled
Expand All @@ -59,7 +58,6 @@ extension Pixel {
case settingsAutoconsentOff

case browsingMenuOpened
case browsingMenuRefresh
case browsingMenuNewTab
case browsingMenuAddToBookmarks
case browsingMenuEditBookmark
Expand Down Expand Up @@ -98,11 +96,7 @@ extension Pixel {
case tabBarTabSwitcherPressed

case homeScreenShown
case homeScreenSearchTapped
case homeScreenFavouriteLaunched
case homeScreenAddFavorite
case homeScreenAddFavoriteOK
case homeScreenAddFavoriteCancel
case homeScreenEditFavorite
case homeScreenDeleteFavorite

Expand All @@ -111,38 +105,7 @@ extension Pixel {

case feedbackPositive
case feedbackNegativePrefix(category: String)

case feedbackNegativeBrokenSites
case feedbackNegativeOther

case feedbackNegativeBrowserFeaturesNav
case feedbackNegativeBrowserFeaturesTabs
case feedbackNegativeBrowserFeaturesAds
case feedbackNegativeBrowserFeaturesVideos
case feedbackNegativeBrowserFeaturesImages
case feedbackNegativeBrowserFeaturesBookmarks
case feedbackNegativeBrowserFeaturesOther

case feedbackNegativeBadResultsTechnical
case feedbackNegativeBadResultsLayout
case feedbackNegativeBadResultsSpeed
case feedbackNegativeBadResultsLangOrRegion
case feedbackNegativeBadResultsAutocomplete
case feedbackNegativeBadResultsOther

case feedbackNegativeCustomizationHome
case feedbackNegativeCustomizationTabs
case feedbackNegativeCustomizationUI
case feedbackNegativeCustomizationWhatCleared
case feedbackNegativeCustomizationWhenCleared
case feedbackNegativeCustomizationBookmarks
case feedbackNegativeCustomizationOther

case feedbackNegativePerformanceSlow
case feedbackNegativePerformanceCrash
case feedbackNegativePerformanceVideo
case feedbackNegativePerformanceOther


case brokenSiteReport

case daxDialogsSerp
Expand Down Expand Up @@ -176,14 +139,6 @@ extension Pixel {
case openVoiceSearch
case voiceSearchCancelled

case bookmarksFolderCreated

case bookmarkCreatedAtTopLevel
case bookmarkCreatedInSubfolder

case bookmarkEditedAtTopLevel
case bookmarkEditedInSubfolder

case bookmarkImportSuccess
case bookmarkImportFailure
case bookmarkImportFailureParsingDL
Expand All @@ -210,7 +165,6 @@ extension Pixel {

case downloadsSharingPredownloadedLocalFile

case downloadPreparingToStart
case downloadAttemptToOpenBLOBviaJS

case jsAlertShown
Expand Down Expand Up @@ -255,7 +209,6 @@ extension Pixel {
case autofillSettingsOpened
case autofillLoginsSettingsEnabled
case autofillLoginsSettingsDisabled
case autofillLoginsSettingsAddNewLoginErrorAttemptedToCreateDuplicate
case autofillLoginsSettingsResetExcludedDisplayed
case autofillLoginsSettingsResetExcludedConfirmed
case autofillLoginsSettingsResetExcludedDismissed
Expand All @@ -266,7 +219,6 @@ extension Pixel {

case autofillJSPixelFired(_ pixel: AutofillUserScript.JSPixel)

case secureVaultInitError
case secureVaultError

case secureVaultInitFailedError
Expand Down Expand Up @@ -295,7 +247,6 @@ extension Pixel {
case appTPFailedToAccessPreferencesDuringSetup
case appTPFailedToStartTunnel

case appTPVPNCrash
case appTPVPNDisconnect
case appTPVPNMemoryWarning
case appTPVPNMemoryCritical
Expand Down Expand Up @@ -435,7 +386,6 @@ extension Pixel {
case contentBlockingCompilationFailed(listType: CompileRulesListType,
component: ContentBlockerDebugEvents.Component)

case contentBlockingErrorReportingIssue
case contentBlockingCompilationTime

case ampBlockingRulesCompilationFailed
Expand Down Expand Up @@ -489,9 +439,9 @@ extension Pixel {
case debugCantSaveBookmarkFix

case debugCannotClearObservationsDatabase
case debugBookmarksMigratedMoreThanOnce

// Return user measurement
case debugReturnUserReadATB
case debugReturnUserAddATB
case debugReturnUserUpdateATB

Expand All @@ -512,7 +462,6 @@ extension Pixel {
case bookmarksMigrationFailed
case bookmarksMigrationCouldNotPrepareDatabase
case bookmarksMigrationCouldNotPrepareDatabaseOnFailedMigration
case bookmarksMigrationCouldNotValidateDatabase
case bookmarksMigrationCouldNotRemoveOldStore
case bookmarksMigrationCouldNotPrepareMultipleFavoriteFolders

Expand All @@ -533,7 +482,6 @@ extension Pixel {

case syncSentUnauthenticatedRequest
case syncMetadataCouldNotLoadDatabase
case syncBookmarksProviderInitializationFailed
case syncBookmarksFailed
case syncCredentialsProviderInitializationFailed
case syncCredentialsFailed
Expand Down Expand Up @@ -585,7 +533,6 @@ extension Pixel.Event {
case .dashboardProtectionAllowlistRemove: return "mp_wlr"

case .privacyDashboardReportBrokenSite: return "mp_rb"
case .privacyDashboardPixelFromJS(let rawPixel): return rawPixel

case .tabSwitcherNewLayoutSeen: return "m_ts_n"
case .tabSwitcherListEnabled: return "m_ts_l"
Expand All @@ -600,7 +547,6 @@ extension Pixel.Event {
case .settingsAutoconsentOff: return "m_settings_autoconsent_off"

case .browsingMenuOpened: return "mb"
case .browsingMenuRefresh: return "mb_rf"
case .browsingMenuNewTab: return "mb_tb"
case .browsingMenuAddToBookmarks: return "mb_abk"
case .browsingMenuEditBookmark: return "mb_ebk"
Expand Down Expand Up @@ -639,11 +585,7 @@ extension Pixel.Event {
case .tabBarTabSwitcherPressed: return "mt_tb"

case .homeScreenShown: return "mh"
case .homeScreenSearchTapped: return "mh_st"
case .homeScreenFavouriteLaunched: return "mh_fl"
case .homeScreenAddFavorite: return "mh_af"
case .homeScreenAddFavoriteOK: return "mh_af_o"
case .homeScreenAddFavoriteCancel: return "mh_af_c"
case .homeScreenEditFavorite: return "mh_ef"
case .homeScreenDeleteFavorite: return "mh_df"

Expand All @@ -652,38 +594,7 @@ extension Pixel.Event {

case .feedbackPositive: return "mfbs_positive_submit"
case .feedbackNegativePrefix(category: let category): return "mfbs_negative_\(category)"

case .feedbackNegativeBrokenSites: return "mfbs_negative_brokenSites_submit"
case .feedbackNegativeOther: return "mfbs_negative_other_submit"

case .feedbackNegativeBrowserFeaturesNav: return "mfbs_negative_browserFeatures_navigation"
case .feedbackNegativeBrowserFeaturesTabs: return "mfbs_negative_browserFeatures_tabs"
case .feedbackNegativeBrowserFeaturesAds: return "mfbs_negative_browserFeatures_ads"
case .feedbackNegativeBrowserFeaturesVideos: return "mfbs_negative_browserFeatures_videos"
case .feedbackNegativeBrowserFeaturesImages: return "mfbs_negative_browserFeatures_images"
case .feedbackNegativeBrowserFeaturesBookmarks: return "mfbs_negative_browserFeatures_bookmarks"
case .feedbackNegativeBrowserFeaturesOther: return "mfbs_negative_browserFeatures_other"

case .feedbackNegativeBadResultsTechnical: return "mfbs_negative_badResults_technical"
case .feedbackNegativeBadResultsLayout: return "mfbs_negative_badResults_layout"
case .feedbackNegativeBadResultsSpeed: return "mfbs_negative_badResults_speed"
case .feedbackNegativeBadResultsLangOrRegion: return "mfbs_negative_badResults_langRegion"
case .feedbackNegativeBadResultsAutocomplete: return "mfbs_negative_badResults_autocomplete"
case .feedbackNegativeBadResultsOther: return "mfbs_negative_badResults_other"

case .feedbackNegativeCustomizationHome: return "mfbs_negative_customization_home"
case .feedbackNegativeCustomizationTabs: return "mfbs_negative_customization_tabs"
case .feedbackNegativeCustomizationUI: return "mfbs_negative_customization_ui"
case .feedbackNegativeCustomizationWhatCleared: return "mfbs_negative_customization_whichDataCleared"
case .feedbackNegativeCustomizationWhenCleared: return "mfbs_negative_customization_whenDataCleared"
case .feedbackNegativeCustomizationBookmarks: return "mfbs_negative_customization_bookmarks"
case .feedbackNegativeCustomizationOther: return "mfbs_negative_customization_other"

case .feedbackNegativePerformanceSlow: return "mfbs_negative_performance_slow"
case .feedbackNegativePerformanceCrash: return "mfbs_negative_performance_crash"
case .feedbackNegativePerformanceVideo: return "mfbs_negative_performance_video"
case .feedbackNegativePerformanceOther: return "mfbs_negative_performance_other"


case .brokenSiteReport: return "epbf"

case .daxDialogsSerp: return "m_dx_s"
Expand Down Expand Up @@ -717,14 +628,6 @@ extension Pixel.Event {
case .openVoiceSearch: return "m_open_voice_search"
case .voiceSearchCancelled: return "m_voice_search_cancelled"

case .bookmarksFolderCreated: return "m_bookmarks_folder_created"

case .bookmarkCreatedAtTopLevel: return "m_bookmark_created_at_top_level"
case .bookmarkCreatedInSubfolder: return "m_bookmark_created_in_subfolder"

case .bookmarkEditedAtTopLevel: return "m_bookmark_edited_at_top_level"
case .bookmarkEditedInSubfolder: return "m_bookmark_edited_in_subfolder"

case .bookmarkImportSuccess: return "m_bi_s"
case .bookmarkImportFailure: return "m_bi_e"
case .bookmarkImportFailureParsingDL: return "m_bi_e_parsing_dl"
Expand All @@ -751,7 +654,6 @@ extension Pixel.Event {

case .downloadsSharingPredownloadedLocalFile: return "m_downloads_sharing_predownloaded_local_file"

case .downloadPreparingToStart: return "m_download_preparing_to_start"
case .downloadAttemptToOpenBLOBviaJS: return "m_download_attempt_to_open_blob_js"

case .jsAlertShown: return "m_js_alert_shown"
Expand Down Expand Up @@ -802,8 +704,6 @@ extension Pixel.Event {
case .autofillSettingsOpened: return "m_autofill_settings_opened"
case .autofillLoginsSettingsEnabled: return "m_autofill_logins_settings_enabled"
case .autofillLoginsSettingsDisabled: return "m_autofill_logins_settings_disabled"
case .autofillLoginsSettingsAddNewLoginErrorAttemptedToCreateDuplicate:
return "m_autofill_logins_settings_add-new-login_error_attempted-to-create-duplicate"
case .autofillLoginsSettingsResetExcludedDisplayed: return "m_autofill_settings_reset_excluded_displayed"
case .autofillLoginsSettingsResetExcludedConfirmed: return "m_autofill_settings_reset_excluded_confirmed"
case .autofillLoginsSettingsResetExcludedDismissed: return "m_autofill_settings_reset_excluded_dismissed"
Expand All @@ -815,7 +715,6 @@ extension Pixel.Event {
case .autofillJSPixelFired(let pixel):
return "m_ios_\(pixel.pixelName)"

case .secureVaultInitError: return "m_secure_vault_init_error"
case .secureVaultError: return "m_secure_vault_error"

case .secureVaultInitFailedError: return "m_secure-vault_error_init-failed"
Expand All @@ -842,7 +741,6 @@ extension Pixel.Event {
case .appTPFailedToAccessPreferences: return "m_apptp_failed_to_access_preferences"
case .appTPFailedToAccessPreferencesDuringSetup: return "m_apptp_failed_to_access_preferences_during_setup"
case .appTPFailedToStartTunnel: return "m_apptp_failed_to_start_tunnel"
case .appTPVPNCrash: return "m_apptp_vpn_crash"
case .appTPVPNDisconnect: return "m_apptp_vpn_disconnect"
case .appTPVPNMemoryWarning: return "m_apptp_vpn_memory_warning"
case .appTPVPNMemoryCritical: return "m_apptp_vpn_memory_critical"
Expand Down Expand Up @@ -956,6 +854,8 @@ extension Pixel.Event {
case .dbRemoteMessagingDeleteScheduledMessageError: return "m_d_db_rm_delete_scheduled_message"
case .dbLocalAuthenticationError: return "m_d_local_auth_error"

case .debugBookmarksMigratedMoreThanOnce: return "m_debug_bookmarks_migrated-more-than-once"

case .configurationFetchInfo: return "m_d_cfgfetch"

case .trackerDataParseFailed: return "m_d_tds_p"
Expand All @@ -969,7 +869,6 @@ extension Pixel.Event {
case .contentBlockingCompilationFailed(let listType, let component):
return "m_d_content_blocking_\(listType)_\(component)_compilation_failed"

case .contentBlockingErrorReportingIssue: return "m_content_blocking_error_reporting_issue"
case .contentBlockingCompilationTime: return "m_content_blocking_compilation_time"

case .ampBlockingRulesCompilationFailed: return "m_debug_amp_rules_compilation_failed"
Expand Down Expand Up @@ -1043,7 +942,6 @@ extension Pixel.Event {
case .bookmarksMigrationCouldNotPrepareDatabase: return "m_d_bookmarks_migration_could_not_prepare_database"
case .bookmarksMigrationCouldNotPrepareDatabaseOnFailedMigration:
return "m_d_bookmarks_migration_could_not_prepare_database_on_failed_migration"
case .bookmarksMigrationCouldNotValidateDatabase: return "m_d_bookmarks_migration_could_not_validate_database"
case .bookmarksMigrationCouldNotRemoveOldStore: return "m_d_bookmarks_migration_could_not_remove_old_store"
case .bookmarksMigrationCouldNotPrepareMultipleFavoriteFolders: return "m_d_bookmarks_migration_could_not_prepare_multiple_favorite_folders"

Expand All @@ -1064,7 +962,6 @@ extension Pixel.Event {

case .syncSentUnauthenticatedRequest: return "m_d_sync_sent_unauthenticated_request"
case .syncMetadataCouldNotLoadDatabase: return "m_d_sync_metadata_could_not_load_database"
case .syncBookmarksProviderInitializationFailed: return "m_d_sync_bookmarks_provider_initialization_failed"
case .syncBookmarksFailed: return "m_d_sync_bookmarks_failed"
case .syncCredentialsProviderInitializationFailed: return "m_d_sync_credentials_provider_initialization_failed"
case .syncCredentialsFailed: return "m_d_sync_credentials_failed"
Expand Down Expand Up @@ -1096,7 +993,6 @@ extension Pixel.Event {
case .compilationFailed: return "m_d_compilation_failed"
// MARK: - Return user measurement
case .debugReturnUserAddATB: return "m_debug_return_user_add_atb"
case .debugReturnUserReadATB: return "m_debug_return_user_read_atb"
case .debugReturnUserUpdateATB: return "m_debug_return_user_update_atb"
}

Expand Down
18 changes: 14 additions & 4 deletions Core/URLExtension.swift
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
import Foundation
import JavaScriptCore
import BrowserServicesKit
import Network

extension URL {

Expand Down Expand Up @@ -48,10 +49,19 @@ extension URL {
break
case .none:
// assume http by default
guard let urlWithScheme = URL(string: URLProtocol.http.scheme + text),
// only allow 2nd+ level domains or "localhost" without scheme
urlWithScheme.host?.contains(".") == true || urlWithScheme.host == .localhost
else { return nil }
guard let urlWithScheme = URL(string: URLProtocol.http.scheme + text), let host = urlWithScheme.host else {
return nil
}
// only allow 2nd+ level domains or "localhost" without scheme
guard host.contains(".") == true || host == .localhost else {
return nil
}
if IPv4Address(host) != nil {
// Require 4 octets specified explicitly for an IPv4 address (avoid 1.4 -> 1.0.0.4 expansion)
guard host.split(separator: ".").count == 4 else {
return nil
}
}
url = urlWithScheme

default:
Expand Down
4 changes: 3 additions & 1 deletion Core/UserDefaultsPropertyWrapper.swift
Original file line number Diff line number Diff line change
Expand Up @@ -115,8 +115,10 @@ public struct UserDefaultsWrapper<T> {
case addressBarPosition = "com.duckduckgo.ios.addressbarposition"
case showFullSiteAddress = "com.duckduckgo.ios.showfullsiteaddress"

case bookmarksLastGoodVersion = "com.duckduckgo.ios.bookmarksLastGoodVersion"
case bookmarksMigrationVersion = "com.duckduckgo.ios.bookmarksMigrationVersion"

case privacyConfigCustomURL = "com.duckduckgo.ios.privacyConfigCustomURL"

}

private let key: Key
Expand Down
Loading

0 comments on commit 51a48fe

Please sign in to comment.