Skip to content

Commit

Permalink
feat: preparations for universal backup/restore - WPB-14616 (#2523)
Browse files Browse the repository at this point in the history
Co-authored-by: François Benaiteau <[email protected]>
Co-authored-by: KaterinaWire <[email protected]>
Co-authored-by: Christoph Aldrian <[email protected]>
Co-authored-by: Christoph Aldrian <[email protected]>
Co-authored-by: Jullian Mercier <[email protected]>
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: François Benaiteau <[email protected]>
  • Loading branch information
7 people authored Feb 13, 2025
1 parent be487a5 commit fbef37e
Show file tree
Hide file tree
Showing 208 changed files with 4,073 additions and 1,601 deletions.
2 changes: 1 addition & 1 deletion Cartfile.resolved
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
binary "wire-avs.json" "10.0.4"
binary "wire-avs.json" "10.0.5"
github "wireapp/ZipArchive" "v2.4.2"
github "wireapp/core-crypto" "v3.0.2"
github "wireapp/cryptobox-ios" "v1.1.0_xcframework_arm64simulator"
Expand Down
2 changes: 1 addition & 1 deletion WireDomain/Package.swift
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ let package = Package(
.target(
name: "WireDomainPkg",
path: "./Sources/WireDomain",
sources: ["./UseCases/Protocols/IndividualToTeamMigrationUseCaseProtocol.swift"]
sources: ["./UseCases/Protocols"]
)
]
)
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
//
// Wire
// Copyright (C) 2025 Wire Swiss GmbH
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program. If not, see http://www.gnu.org/licenses/.
//

public enum CreateLegacyBackupError: Error {
case noActiveAccountForExport
case compressionError
/// Failed to create `InputStream` or `OutputStream` from `URL`.
case failedToCreateStreamsForEncryption
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
//
// Wire
// Copyright (C) 2025 Wire Swiss GmbH
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program. If not, see http://www.gnu.org/licenses/.
//

public enum ImportBackupError: Error, Equatable, CaseIterable {
case noActiveAccountForImport
/// The backup file is encrypted and a password is needed for decryption.
case passwordRequired
/// E.g. if the file to import was created with a different (incompatible) version of the app.
case incompatibleFileFormat
case invalidAccountID
case compressionError
case invalidFileExtension
case keyCreationFailed
case decryptionError
case faildToBackUpUserClient
/// Failed to create `InputStream` or `OutputStream` from `URL`.
case failedToCreateStreamForDecryption
}
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,7 @@
// along with this program. If not, see http://www.gnu.org/licenses/.
//

enum BackupRestoreError: Error {
case noActiveAccount
case compressionError
case invalidFileExtension
case keyCreationFailed
case decryptionError
case unknown
public enum ImportBackupProgress: Equatable, Sendable {
case progress(Float)
case done
}
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,6 @@
import Foundation

// sourcery: AutoMockable
public protocol ImportBackupUseCaseProtocol {
func invoke(url: URL, password: String) async throws
public protocol ImportBackupUseCaseProtocol: Sendable {
func invoke(url: URL, password: String) -> AsyncThrowingStream<ImportBackupProgress, any Error>
}

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

11 changes: 9 additions & 2 deletions WireDomain/WireDomain Project.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
5904B1B32D31582700E866D1 /* WireDomainSupport.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 017F67822C207A3200B6E02D /* WireDomainSupport.framework */; };
591B6E452C8B09BA009F8A7B /* WireDataModel.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 01D0DCC32C1C8CC20076CB1C /* WireDataModel.framework */; };
591B6E472C8B09BD009F8A7B /* WireDataModelSupport.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 01BDA5442C20762200636E50 /* WireDataModelSupport.framework */; };
59202AD22D54D3D500143413 /* WireDomainPackage in Frameworks */ = {isa = PBXBuildFile; productRef = 59202AD12D54D3D500143413 /* WireDomainPackage */; };
594904952D0710BF00238104 /* WireAnalytics in Frameworks */ = {isa = PBXBuildFile; productRef = 594904942D0710BF00238104 /* WireAnalytics */; };
598D042D2C89C63100B64D71 /* WireFoundation in Frameworks */ = {isa = PBXBuildFile; productRef = 598D042C2C89C63100B64D71 /* WireFoundation */; };
59909A5E2C5BBEA8009C41DE /* WireAPI in Frameworks */ = {isa = PBXBuildFile; productRef = 59909A5D2C5BBEA8009C41DE /* WireAPI */; };
Expand Down Expand Up @@ -70,7 +71,7 @@
59DBDB312D395B620069C64C /* PBXFileSystemSynchronizedBuildFileExceptionSet */ = {
isa = PBXFileSystemSynchronizedBuildFileExceptionSet;
membershipExceptions = (
UseCases/Protocols/IndividualToTeamMigrationUseCaseProtocol.swift,
UseCases/Protocols,
);
target = 01D0DCA52C1C8C870076CB1C /* WireDomain */;
};
Expand All @@ -80,7 +81,7 @@
5904B7822D315AAC00E866D1 /* TestPlans */ = {isa = PBXFileSystemSynchronizedRootGroup; explicitFileTypes = {}; explicitFolders = (); path = TestPlans; sourceTree = "<group>"; };
59EA78992D00CF1C002CA0B8 /* WireDomainTests */ = {isa = PBXFileSystemSynchronizedRootGroup; explicitFileTypes = {}; explicitFolders = (); path = WireDomainTests; sourceTree = "<group>"; };
59EA78D42D00CF22002CA0B8 /* WireDomainSupport */ = {isa = PBXFileSystemSynchronizedRootGroup; exceptions = (5904B1B92D31586500E866D1 /* PBXFileSystemSynchronizedBuildFileExceptionSet */, ); explicitFileTypes = {}; explicitFolders = (); path = WireDomainSupport; sourceTree = "<group>"; };
59EA7A282D00CFB2002CA0B8 /* WireDomain */ = {isa = PBXFileSystemSynchronizedRootGroup; exceptions = (59DBDB312D395B620069C64C /* PBXFileSystemSynchronizedBuildFileExceptionSet */, ); explicitFileTypes = {}; explicitFolders = (); path = WireDomain; sourceTree = "<group>"; };
59EA7A282D00CFB2002CA0B8 /* WireDomain */ = {isa = PBXFileSystemSynchronizedRootGroup; exceptions = (59DBDB312D395B620069C64C /* PBXFileSystemSynchronizedBuildFileExceptionSet */, ); explicitFileTypes = {}; explicitFolders = (UseCases/Protocols, ); path = WireDomain; sourceTree = "<group>"; };
/* End PBXFileSystemSynchronizedRootGroup section */

/* Begin PBXFrameworksBuildPhase section */
Expand All @@ -89,6 +90,7 @@
buildActionMask = 2147483647;
files = (
C97BCCAA2C98704B004F2D0D /* WireDomain.framework in Frameworks */,
59202AD22D54D3D500143413 /* WireDomainPackage in Frameworks */,
59909A692C5BC001009C41DE /* WireAPI in Frameworks */,
);
runOnlyForDeploymentPostprocessing = 0;
Expand Down Expand Up @@ -193,6 +195,7 @@
name = WireDomainSupport;
packageProductDependencies = (
59909A682C5BC001009C41DE /* WireAPI */,
59202AD12D54D3D500143413 /* WireDomainPackage */,
);
productName = WireDomainSupport;
productReference = 017F67822C207A3200B6E02D /* WireDomainSupport.framework */;
Expand Down Expand Up @@ -741,6 +744,10 @@
/* End XCConfigurationList section */

/* Begin XCSwiftPackageProductDependency section */
59202AD12D54D3D500143413 /* WireDomainPackage */ = {
isa = XCSwiftPackageProductDependency;
productName = WireDomainPackage;
};
594904942D0710BF00238104 /* WireAnalytics */ = {
isa = XCSwiftPackageProductDependency;
productName = WireAnalytics;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
// along with this program. If not, see http://www.gnu.org/licenses/.
//

import XCTest
public import XCTest

public extension XCTestCase {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
// along with this program. If not, see http://www.gnu.org/licenses/.
//

import XCTest
public import XCTest

public extension XCTestExpectation {

Expand Down
4 changes: 3 additions & 1 deletion WireLogging/Sources/WireLogging/WireLogger+Instances.swift
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,11 @@ public extension WireLogger {
static let appLock = WireLogger(tag: "AppLock")
static let assets = WireLogger(tag: "assets")
static let authentication = WireLogger(tag: "authentication")
static let backend = WireLogger(tag: "backend")
static let backupExport = WireLogger(tag: "backup-export")
static let backupImport = WireLogger(tag: "backup-import")
static let backgroundActivity = WireLogger(tag: "background-activity")
static let badgeCount = WireLogger(tag: "badge-count")
static let backend = WireLogger(tag: "backend")
static let calling = WireLogger(tag: "calling")
static let conversation = WireLogger(tag: "conversation")
static let coreCrypto = WireLogger(tag: "core-crypto")
Expand Down
23 changes: 21 additions & 2 deletions WireUI/Package.swift
Original file line number Diff line number Diff line change
Expand Up @@ -20,13 +20,15 @@ let package = Package(
.library(name: "WireMoveToFolderUISupport", targets: ["WireMoveToFolderUISupport"]),
.library(name: "WireReusableUIComponents", targets: ["WireReusableUIComponents"]),
.library(name: "WireSettingsUI", targets: ["WireSettingsUI"]),
.library(name: "WireSettingsUISupport", targets: ["WireSettingsUISupport"]),
.library(name: "WireSidebarUI", targets: ["WireSidebarUI"]),
],
dependencies: [
.package(url: "https://github.com/swiftlang/swift-docc-plugin", from: "1.1.0"),
.package(path: "../WireAnalytics"),
.package(name: "WireDomainPackage", path: "../WireDomain"),
.package(name: "WireFoundation", path: "../WireFoundation"),
.package(path: "../WireLogging"),
.package(path: "../WirePlugins")
],
targets: [
Expand Down Expand Up @@ -78,8 +80,25 @@ let package = Package(
),
.testTarget(name: "WireReusableUIComponentsTests", dependencies: ["WireReusableUIComponents"]),

.target(name: "WireSettingsUI"),
.testTarget(name: "WireSettingsUITests", dependencies: ["WireSettingsUI"]),
.target(
name: "WireSettingsUI",
dependencies: [
"WireDesign",
.product(name: "WireDomainPackage", package: "WireDomainPackage"),
"WireFoundation",
"WireLogging",
"WireReusableUIComponents",
],
plugins: [.plugin(name: "SwiftGenPlugin", package: "WirePlugins")]
),
.target(
name: "WireSettingsUISupport",
dependencies: ["WireSettingsUI"],
plugins: [
.plugin(name: "SourceryPlugin", package: "WirePlugins")
]
),
.testTarget(name: "WireSettingsUITests", dependencies: ["WireSettingsUI", "WireSettingsUISupport"]),

.target(
name: "WireSidebarUI",
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
//
// Wire
// Copyright (C) 2025 Wire Swiss GmbH
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program. If not, see http://www.gnu.org/licenses/.
//

import UIKit
import WireFoundation

public extension UIButton.Configuration {

static var primary: Self {

var configuration = shared
configuration.baseBackgroundColor = ColorTheme.Buttons.Primary.enabled
return configuration

}

private static var shared: Self {

var configuration = UIButton.Configuration.filled()
configuration.buttonSize = .large
configuration.titleTextAttributesTransformer = .init { attributeContainer in
var attributeContainer = attributeContainer
attributeContainer.font = .preferredFont(forTextStyle: .headline)
return attributeContainer
}
return configuration

}

}
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ private extension UIView {
}
}

private var stateKey = 0
@MainActor private var stateKey = 0

// MARK: - Previews

Expand Down
15 changes: 15 additions & 0 deletions WireUI/Sources/WireSettingsUI/.swiftgen.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# Every input/output paths in the rest of the config will then be expressed relative to these.

input_dir: ./
output_dir: ${GENERATED}/

# Generate constants for your localized strings.

strings:
inputs:
- Resources/en.lproj/Accessibility.strings
- Resources/en.lproj/Localizable.strings
filter:
outputs:
- templateName: structured-swift5
output: Strings+Generated.swift
Loading

0 comments on commit fbef37e

Please sign in to comment.