diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 3d5c90f38..41251bf53 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -2,57 +2,46 @@ name: build on: push: - branches-ignore: - - master - - release + branches: [ master, develop ] + pull_request: + branches: [ master, develop ] jobs: + build: + runs-on: macOS-latest + + steps: + - uses: actions/checkout@v2 + + - name: Switch to Xcode 11.5 + run: sudo xcode-select --switch /Applications/Xcode_11.5.app + + # Compile project and run tests + - name: Compile and run tests + run: fastlane scan --scheme "Debug" + build_release_prod: runs-on: macOS-latest steps: - uses: actions/checkout@v2 - - name: Switch to Xcode 11.4.1 - run: sudo xcode-select --switch /Applications/Xcode_11.4.app - - - name: Sets up bundler - run: bundle update --bundler + - name: Switch to Xcode 11.5 + run: sudo xcode-select --switch /Applications/Xcode_11.5.app - - name: Sign and build - env: - MATCH_GIT_URL: ${{ secrets.MATCH_GIT_URL }} - MATCH_PASSWORD: ${{ secrets.MATCH_PASSWORD }} - MATCH_GIT_BASIC_AUTHORIZATION: ${{ secrets.MATCH_GIT_BASIC_AUTHORIZATION }} - MATCH_GIT_BRANCH: ${{ secrets.MATCH_GIT_BRANCH }} - APP_SCHEME: "Release-Prod" - APP_IDENTIFIER: ${{ secrets.APP_IDENTIFIER_PROD }} - FASTLANE_TEAM_ID: ${{ secrets.TEAM_ID }} - SKIP_ADD_BADGE: true - BADGE_TITLE: "" - run: bundle exec fastlane sign_and_build - - build_release_dev: + # Compile "Release-Prod" for iOS Simulator (no signing) + - name: Compile and run tests + run: fastlane gym --scheme "Release-Prod" --skip_package_ipa true --destination "generic/platform=iOS Simulator" + + build_release_dev_calibration: runs-on: macOS-latest steps: - uses: actions/checkout@v2 - - name: Switch to Xcode 11.4.1 - run: sudo xcode-select --switch /Applications/Xcode_11.4.app - - - name: Sets up bundler - run: bundle update --bundler - - - name: Sign and build - env: - MATCH_GIT_URL: ${{ secrets.MATCH_GIT_URL }} - MATCH_PASSWORD: ${{ secrets.MATCH_PASSWORD }} - MATCH_GIT_BASIC_AUTHORIZATION: ${{ secrets.MATCH_GIT_BASIC_AUTHORIZATION }} - MATCH_GIT_BRANCH: ${{ secrets.MATCH_GIT_BRANCH }} - APP_SCHEME: "Release-Internal" - APP_IDENTIFIER: ${{ secrets.APP_IDENTIFIER_PROD }} - FASTLANE_TEAM_ID: ${{ secrets.TEAM_ID }} - SKIP_ADD_BADGE: true - BADGE_TITLE: "" - run: bundle exec fastlane sign_and_build + - name: Switch to Xcode 11.5 + run: sudo xcode-select --switch /Applications/Xcode_11.5.app + + # Compile "Release-Dev-Calibration" for iOS Simulator (no signing) + - name: Compile and run tests + run: fastlane gym --scheme "Release-Dev-Calibration" --skip_package_ipa true --destination "generic/platform=iOS Simulator" \ No newline at end of file diff --git a/.github/workflows/distribute.yml b/.github/workflows/distribute.yml index 5e4c6f122..a6c314346 100644 --- a/.github/workflows/distribute.yml +++ b/.github/workflows/distribute.yml @@ -2,22 +2,27 @@ name: testflight on: push: - branches: - - master - - release - pull_request: - branches: - - master + branches-ignore: + - '**' + +#on: +# push: +# branches: +# - master +# - release +# pull_request: +# branches: +# - master jobs: - testflight_internal: + testflight_dev: runs-on: macOS-latest steps: - uses: actions/checkout@v2 - - name: Switch to Xcode 11.4.1 - run: sudo xcode-select --switch /Applications/Xcode_11.4.app + - name: Switch to Xcode 11.5 + run: sudo xcode-select --switch /Applications/Xcode_11.5.app - name: Installs librsvg run: brew install librsvg @@ -34,8 +39,8 @@ jobs: MATCH_PASSWORD: ${{ secrets.MATCH_PASSWORD }} MATCH_GIT_BASIC_AUTHORIZATION: ${{ secrets.MATCH_GIT_BASIC_AUTHORIZATION }} MATCH_GIT_BRANCH: ${{ secrets.MATCH_GIT_BRANCH }} - APP_SCHEME: "Release-Internal" - APP_IDENTIFIER: ${{ secrets.APP_IDENTIFIER_INTERNAL }} + APP_SCHEME: "Release-Dev" + APP_IDENTIFIER: ${{ secrets.APP_IDENTIFIER_DEV }} FASTLANE_TEAM_ID: ${{ secrets.TEAM_ID }} BADGE_TITLE: "DEV" run: bundle exec fastlane sign_and_build @@ -54,8 +59,8 @@ jobs: steps: - uses: actions/checkout@v2 - - name: Switch to Xcode 11.4.1 - run: sudo xcode-select --switch /Applications/Xcode_11.4.app + - name: Switch to Xcode 11.5 + run: sudo xcode-select --switch /Applications/Xcode_11.5.app - name: Installs librsvg run: brew install librsvg @@ -92,8 +97,8 @@ jobs: steps: - uses: actions/checkout@v2 - - name: Switch to Xcode 11.4.1 - run: sudo xcode-select --switch /Applications/Xcode_11.4.app + - name: Switch to Xcode 11.5 + run: sudo xcode-select --switch /Applications/Xcode_11.5.app - name: Installs librsvg run: brew install librsvg @@ -130,8 +135,8 @@ jobs: steps: - uses: actions/checkout@v2 - - name: Switch to Xcode 11.4.1 - run: sudo xcode-select --switch /Applications/Xcode_11.4.app + - name: Switch to Xcode 11.5 + run: sudo xcode-select --switch /Applications/Xcode_11.5.app - name: Sets up bundler run: bundle update --bundler diff --git a/DP3TApp.xcodeproj/project.pbxproj b/DP3TApp.xcodeproj/project.pbxproj index dd6636f30..369d05331 100644 --- a/DP3TApp.xcodeproj/project.pbxproj +++ b/DP3TApp.xcodeproj/project.pbxproj @@ -259,7 +259,7 @@ 8E81CC99241FCC7D006F2437 /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 8E81CC98241FCC7D006F2437 /* AppDelegate.swift */; }; 8E81CC9D241FCC7D006F2437 /* NSViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 8E81CC9C241FCC7D006F2437 /* NSViewController.swift */; }; 8E81CCA2241FCC7F006F2437 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 8E81CCA1241FCC7F006F2437 /* Assets.xcassets */; }; - 8E81CCB0241FCC7F006F2437 /* DP3TAppTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 8E81CCAF241FCC7F006F2437 /* DP3TAppTests.swift */; }; + 8E81CCB0241FCC7F006F2437 /* FakePublishManagerTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 8E81CCAF241FCC7F006F2437 /* FakePublishManagerTests.swift */; }; 8E81CCCF241FD813006F2437 /* SnapKit in Frameworks */ = {isa = PBXBuildFile; productRef = 8E81CCCE241FD813006F2437 /* SnapKit */; }; 8EB23D78245AF2C30073E83A /* RandomGenerators.swift in Sources */ = {isa = PBXBuildFile; fileRef = 8EB23D77245AF2C30073E83A /* RandomGenerators.swift */; }; A6BBA110246BFCBC00E42EE7 /* UIDevice+ScreenType.swift in Sources */ = {isa = PBXBuildFile; fileRef = A6BBA10F246BFCBC00E42EE7 /* UIDevice+ScreenType.swift */; }; @@ -371,6 +371,18 @@ 2485F47B2458625F00C3D8C3 /* DatabaseSyncer.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DatabaseSyncer.swift; sourceTree = ""; }; 2485F47D2458AC9000C3D8C3 /* FakePublishManager.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = FakePublishManager.swift; sourceTree = ""; }; 2485F47F2459631A00C3D8C3 /* NetworkError.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = NetworkError.swift; sourceTree = ""; }; + 24D33D902487B7FE0068E509 /* sq */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = sq; path = sq.lproj/Localizable.strings; sourceTree = ""; }; + 24D33D912487B7FE0068E509 /* sq */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = sq; path = sq.lproj/InfoPlist.strings; sourceTree = ""; }; + 24D33D922487B8140068E509 /* es */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = es; path = es.lproj/Localizable.strings; sourceTree = ""; }; + 24D33D932487B8140068E509 /* es */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = es; path = es.lproj/InfoPlist.strings; sourceTree = ""; }; + 24D33D942487B8590068E509 /* pt */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = pt; path = pt.lproj/Localizable.strings; sourceTree = ""; }; + 24D33D952487B8590068E509 /* pt */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = pt; path = pt.lproj/InfoPlist.strings; sourceTree = ""; }; + 24D33D9B24880D880068E509 /* sr */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = sr; path = sr.lproj/Localizable.strings; sourceTree = ""; }; + 24D33D9C24880D880068E509 /* sr */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = sr; path = sr.lproj/InfoPlist.strings; sourceTree = ""; }; + 24D33D9D24880D9A0068E509 /* bs */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = bs; path = bs.lproj/Localizable.strings; sourceTree = ""; }; + 24D33D9E24880D9A0068E509 /* bs */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = bs; path = bs.lproj/InfoPlist.strings; sourceTree = ""; }; + 24D33D9F24880F6C0068E509 /* hr */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = "hr"; path = "hr.lproj/Localizable.strings"; sourceTree = ""; }; + 24D33DA024880F6C0068E509 /* hr */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = "hr"; path = "hr.lproj/InfoPlist.strings"; sourceTree = ""; }; 24D5EF672448CAB900C197D6 /* UIStateManager.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = UIStateManager.swift; sourceTree = ""; }; 24D5EF692448CAE800C197D6 /* UIStateModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = UIStateModel.swift; sourceTree = ""; }; 48E967992473478100E4A5D6 /* codegen-service-t.bag.admin.ch.der */ = {isa = PBXFileReference; lastKnownFileType = file; path = "codegen-service-t.bag.admin.ch.der"; sourceTree = ""; }; @@ -445,7 +457,7 @@ 8E81CCA1241FCC7F006F2437 /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = ""; }; 8E81CCA6241FCC7F006F2437 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 8E81CCAB241FCC7F006F2437 /* DP3TAppTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = DP3TAppTests.xctest; sourceTree = BUILT_PRODUCTS_DIR; }; - 8E81CCAF241FCC7F006F2437 /* DP3TAppTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DP3TAppTests.swift; sourceTree = ""; }; + 8E81CCAF241FCC7F006F2437 /* FakePublishManagerTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = FakePublishManagerTests.swift; sourceTree = ""; }; 8E81CCB1241FCC7F006F2437 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 8EB23D77245AF2C30073E83A /* RandomGenerators.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = RandomGenerators.swift; sourceTree = ""; }; A6BBA10F246BFCBC00E42EE7 /* UIDevice+ScreenType.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "UIDevice+ScreenType.swift"; sourceTree = ""; }; @@ -995,7 +1007,7 @@ 8E81CCAE241FCC7F006F2437 /* DP3TAppTests */ = { isa = PBXGroup; children = ( - 8E81CCAF241FCC7F006F2437 /* DP3TAppTests.swift */, + 8E81CCAF241FCC7F006F2437 /* FakePublishManagerTests.swift */, 8E81CCB1241FCC7F006F2437 /* Info.plist */, ); path = DP3TAppTests; @@ -1226,6 +1238,12 @@ de, it, Base, + sq, + es, + pt, + sr, + bs, + "hr", ); mainGroup = 8E81CC8C241FCC7D006F2437; packageReferences = ( @@ -1708,7 +1726,7 @@ isa = PBXSourcesBuildPhase; buildActionMask = 2147483647; files = ( - 8E81CCB0241FCC7F006F2437 /* DP3TAppTests.swift in Sources */, + 8E81CCB0241FCC7F006F2437 /* FakePublishManagerTests.swift in Sources */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -1730,6 +1748,12 @@ DC9A81A5242CE5E000AD1548 /* en */, DC9A81A7242CE5E000AD1548 /* it */, DC9A81A9242CE5E000AD1548 /* fr */, + 24D33D902487B7FE0068E509 /* sq */, + 24D33D922487B8140068E509 /* es */, + 24D33D942487B8590068E509 /* pt */, + 24D33D9B24880D880068E509 /* sr */, + 24D33D9D24880D9A0068E509 /* bs */, + 24D33D9F24880F6C0068E509 /* hr */, ); name = Localizable.strings; sourceTree = ""; @@ -1741,6 +1765,12 @@ DC9A81A6242CE5E000AD1548 /* en */, DC9A81A8242CE5E000AD1548 /* it */, DC9A81AA242CE5E000AD1548 /* fr */, + 24D33D912487B7FE0068E509 /* sq */, + 24D33D932487B8140068E509 /* es */, + 24D33D952487B8590068E509 /* pt */, + 24D33D9C24880D880068E509 /* sr */, + 24D33D9E24880D9A0068E509 /* bs */, + 24D33DA024880F6C0068E509 /* hr */, ); name = InfoPlist.strings; sourceTree = ""; diff --git a/DP3TApp.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved b/DP3TApp.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved index 86a528d63..3dc767f42 100644 --- a/DP3TApp.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved +++ b/DP3TApp.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved @@ -33,7 +33,7 @@ "repositoryURL": "https://github.com/DP-3T/dp3t-sdk-ios.git", "state": { "branch": "develop", - "revision": "25de2a202bba99c4f58ac9b441f6d31a8114aa0b", + "revision": "dcc2318c5a1e514dabccb2fc635ea2b7acf1524b", "version": null } }, diff --git a/DP3TApp.xcodeproj/xcshareddata/IDETemplateMacros.plist b/DP3TApp.xcodeproj/xcshareddata/IDETemplateMacros.plist index 0a90f2068..2bcd773fd 100644 --- a/DP3TApp.xcodeproj/xcshareddata/IDETemplateMacros.plist +++ b/DP3TApp.xcodeproj/xcshareddata/IDETemplateMacros.plist @@ -3,6 +3,15 @@ FILEHEADER - / + +/* + * Copyright (c) 2020 Ubique Innovation AG <https://www.ubique.ch> + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at https://mozilla.org/MPL/2.0/. + * + * SPDX-License-Identifier: MPL-2.0 + */ diff --git a/DP3TApp/Logic/AppDelegate.swift b/DP3TApp/Logic/AppDelegate.swift index 582cf2edd..a3c79979f 100644 --- a/DP3TApp/Logic/AppDelegate.swift +++ b/DP3TApp/Logic/AppDelegate.swift @@ -1,7 +1,11 @@ /* - * Created by Ubique Innovation AG - * https://www.ubique.ch - * Copyright (c) 2020. All rights reserved. + * Copyright (c) 2020 Ubique Innovation AG + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at https://mozilla.org/MPL/2.0/. + * + * SPDX-License-Identifier: MPL-2.0 */ import UIKit @@ -81,7 +85,7 @@ class AppDelegate: UIResponder, UIApplicationDelegate { _ = jumpToMessageIfRequired(onlyFirst: false) } - FakePublishManager.shared.runForegroundTask() + FakePublishManager.shared.runTask() } func jumpToMessageIfRequired(onlyFirst: Bool) -> Bool { diff --git a/DP3TApp/Logic/Config/ConfigLoadOperation.swift b/DP3TApp/Logic/Config/ConfigLoadOperation.swift index 3e4b053f0..7b18802b9 100644 --- a/DP3TApp/Logic/Config/ConfigLoadOperation.swift +++ b/DP3TApp/Logic/Config/ConfigLoadOperation.swift @@ -1,7 +1,11 @@ /* - * Created by Ubique Innovation AG - * https://www.ubique.ch - * Copyright (c) 2020. All rights reserved. + * Copyright (c) 2020 Ubique Innovation AG + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at https://mozilla.org/MPL/2.0/. + * + * SPDX-License-Identifier: MPL-2.0 */ import BackgroundTasks @@ -12,6 +16,8 @@ class ConfigLoadOperation: Operation { static var presentedConfigForVersion: String? override func main() { + guard isCancelled == false else { return } + let semaphore = DispatchSemaphore(value: 0) ConfigManager().loadConfig { config in if let c = config, c.forceUpdate { diff --git a/DP3TApp/Logic/Config/ConfigManager.swift b/DP3TApp/Logic/Config/ConfigManager.swift index 16f1ca931..0c2afe0e4 100644 --- a/DP3TApp/Logic/Config/ConfigManager.swift +++ b/DP3TApp/Logic/Config/ConfigManager.swift @@ -1,7 +1,11 @@ /* - * Created by Ubique Innovation AG - * https://www.ubique.ch - * Copyright (c) 2020. All rights reserved. + * Copyright (c) 2020 Ubique Innovation AG + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at https://mozilla.org/MPL/2.0/. + * + * SPDX-License-Identifier: MPL-2.0 */ import DP3TSDK diff --git a/DP3TApp/Logic/Config/ConfigResponseBody.swift b/DP3TApp/Logic/Config/ConfigResponseBody.swift index 9e034058e..1fa1ff7ce 100644 --- a/DP3TApp/Logic/Config/ConfigResponseBody.swift +++ b/DP3TApp/Logic/Config/ConfigResponseBody.swift @@ -1,7 +1,11 @@ /* - * Created by Ubique Innovation AG - * https://www.ubique.ch - * Copyright (c) 2020. All rights reserved. + * Copyright (c) 2020 Ubique Innovation AG + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at https://mozilla.org/MPL/2.0/. + * + * SPDX-License-Identifier: MPL-2.0 */ import UIKit diff --git a/DP3TApp/Logic/Helpers/DateFormatter.swift b/DP3TApp/Logic/Helpers/DateFormatter.swift index 134b3aa2c..735c1dada 100644 --- a/DP3TApp/Logic/Helpers/DateFormatter.swift +++ b/DP3TApp/Logic/Helpers/DateFormatter.swift @@ -1,7 +1,11 @@ /* - * Created by Ubique Innovation AG - * https://www.ubique.ch - * Copyright (c) 2020. All rights reserved. + * Copyright (c) 2020 Ubique Innovation AG + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at https://mozilla.org/MPL/2.0/. + * + * SPDX-License-Identifier: MPL-2.0 */ import Foundation diff --git a/DP3TApp/Logic/Helpers/Language.swift b/DP3TApp/Logic/Helpers/Language.swift index c7e51097c..06eed3662 100644 --- a/DP3TApp/Logic/Helpers/Language.swift +++ b/DP3TApp/Logic/Helpers/Language.swift @@ -1,7 +1,11 @@ /* - * Created by Ubique Innovation AG - * https://www.ubique.ch - * Copyright (c) 2020. All rights reserved. + * Copyright (c) 2020 Ubique Innovation AG + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at https://mozilla.org/MPL/2.0/. + * + * SPDX-License-Identifier: MPL-2.0 */ import Foundation diff --git a/DP3TApp/Logic/Helpers/Logger.swift b/DP3TApp/Logic/Helpers/Logger.swift index 02cf60170..49ba7c90c 100644 --- a/DP3TApp/Logic/Helpers/Logger.swift +++ b/DP3TApp/Logic/Helpers/Logger.swift @@ -1,7 +1,11 @@ /* - * Created by Ubique Innovation AG - * https://www.ubique.ch - * Copyright (c) 2020. All rights reserved. + * Copyright (c) 2020 Ubique Innovation AG + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at https://mozilla.org/MPL/2.0/. + * + * SPDX-License-Identifier: MPL-2.0 */ import Foundation diff --git a/DP3TApp/Logic/Helpers/PhoneCallHelper.swift b/DP3TApp/Logic/Helpers/PhoneCallHelper.swift index 8ba2b6437..07f2c7aff 100644 --- a/DP3TApp/Logic/Helpers/PhoneCallHelper.swift +++ b/DP3TApp/Logic/Helpers/PhoneCallHelper.swift @@ -1,7 +1,11 @@ /* - * Created by Ubique Innovation AG - * https://www.ubique.ch - * Copyright (c) 2020. All rights reserved. + * Copyright (c) 2020 Ubique Innovation AG + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at https://mozilla.org/MPL/2.0/. + * + * SPDX-License-Identifier: MPL-2.0 */ import UIKit diff --git a/DP3TApp/Logic/Helpers/RandomGenerators.swift b/DP3TApp/Logic/Helpers/RandomGenerators.swift index 26fe676cd..dcf00fe74 100644 --- a/DP3TApp/Logic/Helpers/RandomGenerators.swift +++ b/DP3TApp/Logic/Helpers/RandomGenerators.swift @@ -1,7 +1,11 @@ /* - * Created by Ubique Innovation AG - * https://www.ubique.ch - * Copyright (c) 2020. All rights reserved. + * Copyright (c) 2020 Ubique Innovation AG + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at https://mozilla.org/MPL/2.0/. + * + * SPDX-License-Identifier: MPL-2.0 */ import Foundation diff --git a/DP3TApp/Logic/Networking/Base/Backend.swift b/DP3TApp/Logic/Networking/Base/Backend.swift index 3c3c8abe2..77fa534a5 100644 --- a/DP3TApp/Logic/Networking/Base/Backend.swift +++ b/DP3TApp/Logic/Networking/Base/Backend.swift @@ -1,7 +1,11 @@ /* - * Created by Ubique Innovation AG - * https://www.ubique.ch - * Copyright (c) 2020. All rights reserved. + * Copyright (c) 2020 Ubique Innovation AG + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at https://mozilla.org/MPL/2.0/. + * + * SPDX-License-Identifier: MPL-2.0 */ import Foundation diff --git a/DP3TApp/Logic/Networking/Base/Endpoint+Request.swift b/DP3TApp/Logic/Networking/Base/Endpoint+Request.swift index 5b9fe4bf1..15f8bec47 100644 --- a/DP3TApp/Logic/Networking/Base/Endpoint+Request.swift +++ b/DP3TApp/Logic/Networking/Base/Endpoint+Request.swift @@ -1,7 +1,11 @@ /* - * Created by Ubique Innovation AG - * https://www.ubique.ch - * Copyright (c) 2020. All rights reserved. + * Copyright (c) 2020 Ubique Innovation AG + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at https://mozilla.org/MPL/2.0/. + * + * SPDX-License-Identifier: MPL-2.0 */ import Foundation diff --git a/DP3TApp/Logic/Networking/Base/Endpoint.swift b/DP3TApp/Logic/Networking/Base/Endpoint.swift index b940d6b8f..824983308 100644 --- a/DP3TApp/Logic/Networking/Base/Endpoint.swift +++ b/DP3TApp/Logic/Networking/Base/Endpoint.swift @@ -1,7 +1,11 @@ /* - * Created by Ubique Innovation AG - * https://www.ubique.ch - * Copyright (c) 2020. All rights reserved. + * Copyright (c) 2020 Ubique Innovation AG + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at https://mozilla.org/MPL/2.0/. + * + * SPDX-License-Identifier: MPL-2.0 */ import Foundation diff --git a/DP3TApp/Logic/Networking/Base/NetworkError.swift b/DP3TApp/Logic/Networking/Base/NetworkError.swift index 10d75bb56..628573e8e 100644 --- a/DP3TApp/Logic/Networking/Base/NetworkError.swift +++ b/DP3TApp/Logic/Networking/Base/NetworkError.swift @@ -1,7 +1,11 @@ /* - * Created by Ubique Innovation AG - * https://www.ubique.ch - * Copyright (c) 2020. All rights reserved. + * Copyright (c) 2020 Ubique Innovation AG + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at https://mozilla.org/MPL/2.0/. + * + * SPDX-License-Identifier: MPL-2.0 */ import Foundation diff --git a/DP3TApp/Logic/Networking/Base/URLSession+pinning.swift b/DP3TApp/Logic/Networking/Base/URLSession+pinning.swift index 37ddb0fcc..fe403caa4 100644 --- a/DP3TApp/Logic/Networking/Base/URLSession+pinning.swift +++ b/DP3TApp/Logic/Networking/Base/URLSession+pinning.swift @@ -1,7 +1,11 @@ /* - * Created by Ubique Innovation AG - * https://www.ubique.ch - * Copyright (c) 2020. All rights reserved. + * Copyright (c) 2020 Ubique Innovation AG + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at https://mozilla.org/MPL/2.0/. + * + * SPDX-License-Identifier: MPL-2.0 */ import Foundation diff --git a/DP3TApp/Logic/Networking/Environment+Endpoints.swift b/DP3TApp/Logic/Networking/Environment+Endpoints.swift index 6d667765d..e69f455ad 100644 --- a/DP3TApp/Logic/Networking/Environment+Endpoints.swift +++ b/DP3TApp/Logic/Networking/Environment+Endpoints.swift @@ -1,7 +1,11 @@ /* - * Created by Ubique Innovation AG - * https://www.ubique.ch - * Copyright (c) 2020. All rights reserved. + * Copyright (c) 2020 Ubique Innovation AG + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at https://mozilla.org/MPL/2.0/. + * + * SPDX-License-Identifier: MPL-2.0 */ import Foundation diff --git a/DP3TApp/Logic/Networking/Environment+PublicKeys.swift b/DP3TApp/Logic/Networking/Environment+PublicKeys.swift index 8da6185e7..03a0e29c6 100644 --- a/DP3TApp/Logic/Networking/Environment+PublicKeys.swift +++ b/DP3TApp/Logic/Networking/Environment+PublicKeys.swift @@ -1,7 +1,11 @@ /* - * Created by Ubique Innovation AG - * https://www.ubique.ch - * Copyright (c) 2020. All rights reserved. + * Copyright (c) 2020 Ubique Innovation AG + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at https://mozilla.org/MPL/2.0/. + * + * SPDX-License-Identifier: MPL-2.0 */ import Foundation diff --git a/DP3TApp/Logic/Networking/Environment.swift b/DP3TApp/Logic/Networking/Environment.swift index c4ecc81ce..c4eb57105 100644 --- a/DP3TApp/Logic/Networking/Environment.swift +++ b/DP3TApp/Logic/Networking/Environment.swift @@ -1,7 +1,11 @@ /* - * Created by Ubique Innovation AG - * https://www.ubique.ch - * Copyright (c) 2020. All rights reserved. + * Copyright (c) 2020 Ubique Innovation AG + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at https://mozilla.org/MPL/2.0/. + * + * SPDX-License-Identifier: MPL-2.0 */ import Foundation diff --git a/DP3TApp/Logic/Tracing/DatabaseSyncer.swift b/DP3TApp/Logic/Tracing/DatabaseSyncer.swift index b0e6aae78..627448a91 100644 --- a/DP3TApp/Logic/Tracing/DatabaseSyncer.swift +++ b/DP3TApp/Logic/Tracing/DatabaseSyncer.swift @@ -1,7 +1,11 @@ /* - * Created by Ubique Innovation AG - * https://www.ubique.ch - * Copyright (c) 2020. All rights reserved. + * Copyright (c) 2020 Ubique Innovation AG + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at https://mozilla.org/MPL/2.0/. + * + * SPDX-License-Identifier: MPL-2.0 */ import Foundation diff --git a/DP3TApp/Logic/Tracing/Reporting/AuthorizationModels.swift b/DP3TApp/Logic/Tracing/Reporting/AuthorizationModels.swift index 96bea2ca3..37cfce03c 100644 --- a/DP3TApp/Logic/Tracing/Reporting/AuthorizationModels.swift +++ b/DP3TApp/Logic/Tracing/Reporting/AuthorizationModels.swift @@ -1,7 +1,11 @@ /* - * Created by Ubique Innovation AG - * https://www.ubique.ch - * Copyright (c) 2020. All rights reserved. + * Copyright (c) 2020 Ubique Innovation AG + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at https://mozilla.org/MPL/2.0/. + * + * SPDX-License-Identifier: MPL-2.0 */ import Foundation diff --git a/DP3TApp/Logic/Tracing/Reporting/CodeValidator.swift b/DP3TApp/Logic/Tracing/Reporting/CodeValidator.swift index 4b9dabba0..2dcdbce7b 100644 --- a/DP3TApp/Logic/Tracing/Reporting/CodeValidator.swift +++ b/DP3TApp/Logic/Tracing/Reporting/CodeValidator.swift @@ -1,7 +1,11 @@ /* - * Created by Ubique Innovation AG - * https://www.ubique.ch - * Copyright (c) 2020. All rights reserved. + * Copyright (c) 2020 Ubique Innovation AG + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at https://mozilla.org/MPL/2.0/. + * + * SPDX-License-Identifier: MPL-2.0 */ import Foundation diff --git a/DP3TApp/Logic/Tracing/Reporting/FakePublishManager.swift b/DP3TApp/Logic/Tracing/Reporting/FakePublishManager.swift index 40c3dfc50..5955ee104 100644 --- a/DP3TApp/Logic/Tracing/Reporting/FakePublishManager.swift +++ b/DP3TApp/Logic/Tracing/Reporting/FakePublishManager.swift @@ -1,7 +1,11 @@ /* - * Created by Ubique Innovation AG - * https://www.ubique.ch - * Copyright (c) 2020. All rights reserved. + * Copyright (c) 2020 Ubique Innovation AG + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at https://mozilla.org/MPL/2.0/. + * + * SPDX-License-Identifier: MPL-2.0 */ import BackgroundTasks @@ -10,10 +14,28 @@ import Foundation class FakePublishManager { static let shared = FakePublishManager() + private let queue = DispatchQueue(label: "org.dpppt.fakepublishmanager") + + private let operationQueue: OperationQueue = { + let queue = OperationQueue() + queue.maxConcurrentOperationCount = 1 + return queue + }() + @UBOptionalUserDefault(key: "nextScheduledFakeRequestDate") - private(set) var nextScheduledFakeRequestDate: Date? + private var nextScheduledFakeRequestDateStore: Date? + + var nextScheduledFakeRequestDate: Date? { + queue.sync { + self.nextScheduledFakeRequestDateStore + } + } - func syncInterval() -> TimeInterval { + var now: Date { + .init() + } + + private func syncInterval() -> TimeInterval { // Rate corresponding to 1 dummy per 5 days let randomDay = ExponentialDistribution.sample(rate: 0.2) let secondsInADay = Double(24 * 60 * 60) @@ -21,34 +43,44 @@ class FakePublishManager { } private func getNewScheduleDate() -> Date { - Date(timeIntervalSinceNow: syncInterval()) + Date(timeInterval: syncInterval(), since: now) } @discardableResult func rescheduleFakeRequest(force: Bool = false) -> Date { - var nextDate = nextScheduledFakeRequestDate ?? getNewScheduleDate() + queue.sync { + var nextDate = nextScheduledFakeRequestDateStore ?? getNewScheduleDate() - if nextDate <= Date() || force { - nextDate = getNewScheduleDate() - } + if nextDate <= now || force { + nextDate = getNewScheduleDate() + } - nextScheduledFakeRequestDate = nextDate - return nextDate + nextScheduledFakeRequestDateStore = nextDate + return nextDate + } } - func runForegroundTask() { - rescheduleFakeRequest() + @discardableResult + func runTask(completionBlock: (() -> Void)? = nil) -> Operation { + let operation = FakePublishOperation(manager: self) + operation.completionBlock = completionBlock + operationQueue.addOperation(operation) + return operation + } +} - let queue = OperationQueue() - queue.maxConcurrentOperationCount = 1 +private class FakePublishOperation: Operation { + weak var manager: FakePublishManager! - queue.addOperation(FakePublishOperation()) + init(manager: FakePublishManager) { + self.manager = manager + super.init() } -} -class FakePublishOperation: Operation { override func main() { - guard let startDate = FakePublishManager.shared.nextScheduledFakeRequestDate, + guard isCancelled == false else { return } + + guard let startDate = manager.nextScheduledFakeRequestDate, Date() >= startDate else { Logger.log("Too early for fake request") return @@ -58,14 +90,16 @@ class FakePublishOperation: Operation { let delay = Double.random(in: 20 ... 30) let group = DispatchGroup() group.enter() - DispatchQueue.global(qos: .background).asyncAfter(deadline: .now() + delay) { + DispatchQueue.global(qos: .background).asyncAfter(deadline: .now() + delay) { [weak self] in Logger.log("Start Fake Publish", appState: true) - ReportingManager.shared.report(isFakeRequest: true) { error in + ReportingManager.shared.report(isFakeRequest: true) { [weak self] error in + guard let self = self else { return } if error != nil { self.cancel() Logger.log("Fake request failed") } else { Logger.log("Fake request success") + self.manager.rescheduleFakeRequest() } group.leave() } diff --git a/DP3TApp/Logic/Tracing/Reporting/ReportingManager.swift b/DP3TApp/Logic/Tracing/Reporting/ReportingManager.swift index 9ac090e1f..f3103c575 100644 --- a/DP3TApp/Logic/Tracing/Reporting/ReportingManager.swift +++ b/DP3TApp/Logic/Tracing/Reporting/ReportingManager.swift @@ -1,7 +1,11 @@ /* - * Created by Ubique Innovation AG - * https://www.ubique.ch - * Copyright (c) 2020. All rights reserved. + * Copyright (c) 2020 Ubique Innovation AG + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at https://mozilla.org/MPL/2.0/. + * + * SPDX-License-Identifier: MPL-2.0 */ import DP3TSDK diff --git a/DP3TApp/Logic/Tracing/TracingLocalPush.swift b/DP3TApp/Logic/Tracing/TracingLocalPush.swift index 172b7da20..ed73197a3 100644 --- a/DP3TApp/Logic/Tracing/TracingLocalPush.swift +++ b/DP3TApp/Logic/Tracing/TracingLocalPush.swift @@ -1,7 +1,11 @@ /* - * Created by Ubique Innovation AG - * https://www.ubique.ch - * Copyright (c) 2020. All rights reserved. + * Copyright (c) 2020 Ubique Innovation AG + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at https://mozilla.org/MPL/2.0/. + * + * SPDX-License-Identifier: MPL-2.0 */ import Foundation diff --git a/DP3TApp/Logic/Tracing/TracingManager.swift b/DP3TApp/Logic/Tracing/TracingManager.swift index 9d9559db2..5b35c443f 100644 --- a/DP3TApp/Logic/Tracing/TracingManager.swift +++ b/DP3TApp/Logic/Tracing/TracingManager.swift @@ -1,7 +1,11 @@ /* - * Created by Ubique Innovation AG - * https://www.ubique.ch - * Copyright (c) 2020. All rights reserved. + * Copyright (c) 2020 Ubique Innovation AG + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at https://mozilla.org/MPL/2.0/. + * + * SPDX-License-Identifier: MPL-2.0 */ import Foundation @@ -246,14 +250,12 @@ extension TracingManager: DP3TBackgroundHandler { group.leave() } - let fakePublishOperation = FakePublishOperation() group.enter() - fakePublishOperation.completionBlock = { + let fakePublishOperation = FakePublishManager.shared.runTask { group.leave() } queue.addOperation(configOperation) - queue.addOperation(fakePublishOperation) group.notify(queue: .global(qos: .background)) { completionHandler(!configOperation.isCancelled && !fakePublishOperation.isCancelled) diff --git a/DP3TApp/Logic/Tracing/UIState/Errors+Localized.swift b/DP3TApp/Logic/Tracing/UIState/Errors+Localized.swift index c1097ca2a..7bab283b2 100644 --- a/DP3TApp/Logic/Tracing/UIState/Errors+Localized.swift +++ b/DP3TApp/Logic/Tracing/UIState/Errors+Localized.swift @@ -1,8 +1,12 @@ /* - * Created by Ubique Innovation AG - * https://www.ubique.ch - * Copyright (c) 2020. All rights reserved. + * Copyright (c) 2020 Ubique Innovation AG + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at https://mozilla.org/MPL/2.0/. + * + * SPDX-License-Identifier: MPL-2.0 */ import DP3TSDK @@ -103,8 +107,8 @@ extension DP3TNetworkingError: LocalizedError, CodedError { return "IBRTMM" case .timeInconsistency(shift: _): return "ITIMIN" - case .jwtSignatureError(code: _, debugDescription: _): - return "IJWTSE" + case let .jwtSignatureError(code: code, debugDescription: _): + return "IJWTSE\(code)" } } } diff --git a/DP3TApp/Logic/Tracing/UIState/UIStateLogic.swift b/DP3TApp/Logic/Tracing/UIState/UIStateLogic.swift index c08edd73e..5039e0a18 100644 --- a/DP3TApp/Logic/Tracing/UIState/UIStateLogic.swift +++ b/DP3TApp/Logic/Tracing/UIState/UIStateLogic.swift @@ -1,7 +1,11 @@ /* - * Created by Ubique Innovation AG - * https://www.ubique.ch - * Copyright (c) 2020. All rights reserved. + * Copyright (c) 2020 Ubique Innovation AG + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at https://mozilla.org/MPL/2.0/. + * + * SPDX-License-Identifier: MPL-2.0 */ import Foundation diff --git a/DP3TApp/Logic/Tracing/UIState/UIStateManager.swift b/DP3TApp/Logic/Tracing/UIState/UIStateManager.swift index d8d0e59bf..a3702482d 100644 --- a/DP3TApp/Logic/Tracing/UIState/UIStateManager.swift +++ b/DP3TApp/Logic/Tracing/UIState/UIStateManager.swift @@ -1,7 +1,11 @@ /* - * Created by Ubique Innovation AG - * https://www.ubique.ch - * Copyright (c) 2020. All rights reserved. + * Copyright (c) 2020 Ubique Innovation AG + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at https://mozilla.org/MPL/2.0/. + * + * SPDX-License-Identifier: MPL-2.0 */ import Foundation diff --git a/DP3TApp/Logic/Tracing/UIState/UIStateModel.swift b/DP3TApp/Logic/Tracing/UIState/UIStateModel.swift index 9a4b5abbe..1dd883d0c 100644 --- a/DP3TApp/Logic/Tracing/UIState/UIStateModel.swift +++ b/DP3TApp/Logic/Tracing/UIState/UIStateModel.swift @@ -1,7 +1,11 @@ /* - * Created by Ubique Innovation AG - * https://www.ubique.ch - * Copyright (c) 2020. All rights reserved. + * Copyright (c) 2020 Ubique Innovation AG + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at https://mozilla.org/MPL/2.0/. + * + * SPDX-License-Identifier: MPL-2.0 */ import Foundation diff --git a/DP3TApp/Logic/User/UserStorage.swift b/DP3TApp/Logic/User/UserStorage.swift index 2c1fe7ee0..f992311c2 100644 --- a/DP3TApp/Logic/User/UserStorage.swift +++ b/DP3TApp/Logic/User/UserStorage.swift @@ -1,7 +1,11 @@ /* - * Created by Ubique Innovation AG - * https://www.ubique.ch - * Copyright (c) 2020. All rights reserved. + * Copyright (c) 2020 Ubique Innovation AG + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at https://mozilla.org/MPL/2.0/. + * + * SPDX-License-Identifier: MPL-2.0 */ import UIKit diff --git a/DP3TApp/Resources/Impressum/de/impressum.html b/DP3TApp/Resources/Impressum/de/impressum.html index aebdda29d..e574aaf97 100644 --- a/DP3TApp/Resources/Impressum/de/impressum.html +++ b/DP3TApp/Resources/Impressum/de/impressum.html @@ -1,6 +1,6 @@ - DP^3T + SwissCovid @@ -14,47 +14,47 @@

Herausgeber

- +

Kontakt

Technische Hilfe

Rechtliches

Forschung und Entwicklung

- + - +

Umsetzung

- + @@ -63,7 +63,7 @@

Umsetzung

DP3T

Die App basiert auf DP3T, einem Projekt lizenziert unter den Bedingungen der MPL 2 Lizenz.

@@ -72,7 +72,7 @@

DP3T

Lizenzen & Credits

- +