Skip to content

Commit

Permalink
Merge branch 'develop' into brindy/allow-delete-from-edit-screen
Browse files Browse the repository at this point in the history
# Conflicts:
#	DuckDuckGo.xcodeproj/project.pbxproj
#	DuckDuckGo.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved
  • Loading branch information
brindy committed Sep 15, 2023
2 parents 35751f2 + f4a3db0 commit 39a7791
Show file tree
Hide file tree
Showing 8 changed files with 69 additions and 19 deletions.
19 changes: 11 additions & 8 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -73,20 +73,21 @@ jobs:
APPLE_API_KEY_ISSUER: ${{ secrets.APPLE_API_KEY_ISSUER }}
MATCH_PASSWORD: ${{ secrets.MATCH_PASSWORD }}
run: |
bundle exec fastlane release_${{ steps.destination.outputs.destination }}
app_version="$(cut -d ' ' -f 3 < Configuration/Version.xcconfig)"
echo "dsyms_path=${{ github.workspace }}/DuckDuckGo.app.dSYM.zip" >> $GITHUB_ENV
echo "app_version=${app_version}" >> $GITHUB_ENV
bundle exec fastlane release_${{ steps.destination.outputs.destination }}
- name: Upload dSYMs artifact
if: always()
uses: actions/upload-artifact@v3
with:
name: DuckDuckGo-${{ steps.destination.outputs.destination }}-dSYM-${{ env.app_version }}
path: ${{ env.dsyms_path }}

- name: Get Asana Task ID
id: get-task-id
if: github.event.inputs.asana-task-url
if: ${{ always() && github.event.inputs.asana-task-url }}
run: |
task_url_regex='^https://app.asana.com/[0-9]/[0-9]*/([0-9]*)/f$'
if [[ "${{ github.event.inputs.asana-task-url }}" =~ ${task_url_regex} ]]; then
Expand All @@ -96,16 +97,18 @@ jobs:
fi
- name: Upload debug symbols to Asana
if: github.event.inputs.asana-task-url
if: ${{ always() && github.event.inputs.asana-task-url }}
env:
ASANA_ACCESS_TOKEN: ${{ secrets.ASANA_ACCESS_TOKEN }}
run: |
asana_dsyms_path="${{ github.workspace }}/DuckDuckGo-${{ env.app_version }}-dSYM.zip"
mv -f "${{ env.dsyms_path }}" "$asana_dsyms_path"
if [[ -f ${{ env.dsyms_path }} ]]; then
asana_dsyms_path="${{ github.workspace }}/DuckDuckGo-${{ env.app_version }}-dSYM.zip"
mv -f "${{ env.dsyms_path }}" "$asana_dsyms_path"
curl -s "https://app.asana.com/api/1.0/tasks/${{ steps.get-task-id.outputs.task_id }}/attachments" \
-H "Authorization: Bearer ${{ secrets.ASANA_ACCESS_TOKEN }}" \
--form "file=@${asana_dsyms_path};type=application/zip"
curl -s "https://app.asana.com/api/1.0/tasks/${{ steps.get-task-id.outputs.task_id }}/attachments" \
-H "Authorization: Bearer ${{ secrets.ASANA_ACCESS_TOKEN }}" \
--form "file=@${asana_dsyms_path};type=application/zip"
fi
- name: Send Mattermost message
env:
Expand Down
2 changes: 2 additions & 0 deletions Core/UserDefaultsPropertyWrapper.swift
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,8 @@ public struct UserDefaultsWrapper<T> {
case appTPUsed = "com.duckduckgo.ios.appTrackingProtection.appTPUsed"

case defaultBrowserUsageLastSeen = "com.duckduckgo.ios.default-browser-usage-last-seen"

case syncEnvironment = "com.duckduckgo.ios.sync-environment"
}

private let key: Key
Expand Down
6 changes: 4 additions & 2 deletions DuckDuckGo.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -1217,6 +1217,7 @@
317045BF2858C6B90016ED1F /* AutofillInterfaceEmailTruncatorTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AutofillInterfaceEmailTruncatorTests.swift; sourceTree = "<group>"; };
31794BFF2821DFB600F18633 /* DuckUI */ = {isa = PBXFileReference; lastKnownFileType = wrapper; path = DuckUI; sourceTree = "<group>"; };
31951E8D2823003200CAF535 /* AutofillLoginDetailsHeaderView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AutofillLoginDetailsHeaderView.swift; sourceTree = "<group>"; };
31951E94282310FF00CAF535 /* WebsiteAccountExtension.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = WebsiteAccountExtension.swift; sourceTree = "<group>"; };
319A370F28299A850079FBCE /* PasswordHider.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PasswordHider.swift; sourceTree = "<group>"; };
319A37142829A55F0079FBCE /* AutofillListItemTableViewCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AutofillListItemTableViewCell.swift; sourceTree = "<group>"; };
319A37162829C8AD0079FBCE /* UITableViewExtension.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = UITableViewExtension.swift; sourceTree = "<group>"; };
Expand Down Expand Up @@ -5084,6 +5085,7 @@
C13B32D12A0E750700A59236 /* AutofillSettingStatus.swift */,
319A370F28299A850079FBCE /* PasswordHider.swift */,
31C70B5428045E3500FB6AD1 /* SecureVaultErrorReporter.swift */,
31951E94282310FF00CAF535 /* WebsiteAccountExtension.swift */,
F407605328131910006B1E0B /* AutofillLoginUI */,
310C4B4A281B69BC00BA79A9 /* Management */,
C17B59552A03AAC40055F2D1 /* PasswordGeneration */,
Expand Down Expand Up @@ -8875,8 +8877,8 @@
isa = XCRemoteSwiftPackageReference;
repositoryURL = "https://github.com/DuckDuckGo/BrowserServicesKit";
requirement = {
kind = revision;
revision = 7486b544bdff589169901c51fb429fa4806ff71c;
kind = exactVersion;
version = 78.0.0;
};
};
C14882EB27F211A000D59F0C /* XCRemoteSwiftPackageReference "SwiftSoup" */ = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@
"repositoryURL": "https://github.com/DuckDuckGo/BrowserServicesKit",
"state": {
"branch": null,
"revision": "7486b544bdff589169901c51fb429fa4806ff71c",
"version": null
"revision": "2a3dc29c9f0a2d90465a75afe47083a78ecaafe8",
"version": "78.0.0"
}
},
{
Expand Down Expand Up @@ -156,7 +156,7 @@
},
{
"package": "TrackerRadarKit",
"repositoryURL": "https://github.com/duckduckgo/TrackerRadarKit.git",
"repositoryURL": "https://github.com/duckduckgo/TrackerRadarKit",
"state": {
"branch": null,
"revision": "4684440d03304e7638a2c8086895367e90987463",
Expand Down
19 changes: 16 additions & 3 deletions DuckDuckGo/AppDelegate.swift
Original file line number Diff line number Diff line change
Expand Up @@ -191,9 +191,22 @@ class AppDelegate: UIResponder, UIApplicationDelegate {

// MARK: Sync initialisation

#if DEBUG
let defaultEnvironment = ServerEnvironment.development
#else
let defaultEnvironment = ServerEnvironment.production
#endif

let environment = ServerEnvironment(
UserDefaultsWrapper(
key: .syncEnvironment,
defaultValue: defaultEnvironment.description
).wrappedValue
) ?? defaultEnvironment

syncDataProviders = SyncDataProviders(bookmarksDatabase: bookmarksDatabase, secureVaultErrorReporter: SecureVaultErrorReporter.shared)
let syncService = DDGSync(dataProvidersSource: syncDataProviders, errorEvents: SyncErrorHandler(), log: .syncLog)
syncService.initializeIfNeeded(isInternalUser: InternalUserStore().isInternalUser)
let syncService = DDGSync(dataProvidersSource: syncDataProviders, errorEvents: SyncErrorHandler(), log: .syncLog, environment: environment)
syncService.initializeIfNeeded()
self.syncService = syncService

let storyboard: UIStoryboard = UIStoryboard(name: "Main", bundle: Bundle.main)
Expand Down Expand Up @@ -260,7 +273,7 @@ class AppDelegate: UIResponder, UIApplicationDelegate {
func applicationDidBecomeActive(_ application: UIApplication) {
guard !testing else { return }

syncService.initializeIfNeeded(isInternalUser: InternalUserStore().isInternalUser)
syncService.initializeIfNeeded()
syncDataProviders.setUpDatabaseCleanersIfNeeded(syncService: syncService)

if !(overlayWindow?.rootViewController is AuthenticationViewController) {
Expand Down
32 changes: 31 additions & 1 deletion DuckDuckGo/SyncDebugViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -29,13 +29,15 @@ class SyncDebugViewController: UITableViewController {

private let titles = [
Sections.info: "Info",
Sections.models: "Models"
Sections.models: "Models",
Sections.environment: "Environment"
]

enum Sections: Int, CaseIterable {

case info
case models
case environment

}

Expand All @@ -51,6 +53,12 @@ class SyncDebugViewController: UITableViewController {

}

enum EnvironmentRows: Int, CaseIterable {

case toggle

}

private let bookmarksDatabase: CoreDataDatabase
private let sync: DDGSyncing

Expand Down Expand Up @@ -85,6 +93,7 @@ class SyncDebugViewController: UITableViewController {
return titles[section]
}

// swiftlint:disable:next cyclomatic_complexity
override func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
let cell = tableView.dequeueReusableCell(withIdentifier: "Cell", for: indexPath)

Expand Down Expand Up @@ -120,6 +129,17 @@ class SyncDebugViewController: UITableViewController {
break
}

case .environment:
switch EnvironmentRows(rawValue: indexPath.row) {
case .toggle:
let targetEnvironment: ServerEnvironment = sync.serverEnvironment == .production ? .development : .production
cell.textLabel?.text = sync.serverEnvironment.description
cell.detailTextLabel?.text = "Click to switch to \(targetEnvironment)"

case .none:
break
}

default: break
}

Expand All @@ -130,6 +150,7 @@ class SyncDebugViewController: UITableViewController {
switch Sections(rawValue: section) {
case .info: return InfoRows.allCases.count
case .models: return ModelRows.allCases.count
case .environment: return EnvironmentRows.allCases.count
case .none: return 0
}
}
Expand All @@ -142,6 +163,15 @@ class SyncDebugViewController: UITableViewController {
sync.scheduler.requestSyncImmediately()
default: break
}
case .environment:
switch EnvironmentRows(rawValue: indexPath.row) {
case .toggle:
let targetEnvironment: ServerEnvironment = sync.serverEnvironment == .production ? .development : .production
sync.updateServerEnvironment(targetEnvironment)
UserDefaults.standard.set(targetEnvironment.description, forKey: UserDefaultsWrapper<String>.Key.syncEnvironment.rawValue)
tableView.reloadSections(.init(integer: indexPath.section), with: .automatic)
default: break
}
default: break
}

Expand Down
2 changes: 1 addition & 1 deletion DuckDuckGoTests/AutoconsentMessageProtocolTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ final class AutoconsentMessageProtocolTests: XCTestCase {
},
message: message
)
waitForExpectations(timeout: 5.0)
waitForExpectations(timeout: 15.0)
}

@MainActor
Expand Down
2 changes: 1 addition & 1 deletion IntegrationTests/AutoconsentBackgroundTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ final class AutoconsentBackgroundTests: XCTestCase {
waitForExpectations(timeout: 4)

let expectation = expectation(description: "Async call")
DispatchQueue.main.asyncAfter(deadline: .now() + 1) {
DispatchQueue.main.asyncAfter(deadline: .now() + 2) {
webview.evaluateJavaScript("window.getComputedStyle(banner).display === 'none'", in: nil, in: .page,
completionHandler: { result in
switch result {
Expand Down

0 comments on commit 39a7791

Please sign in to comment.