Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
473 commits
Select commit Hold shift + click to select a range
a90ac89
remove references to WireSystem.framework
caldrian Nov 20, 2024
d08fea2
move WireLoggerObjc
caldrian Nov 20, 2024
2753d35
attempt to fix errors by moving files
caldrian Nov 20, 2024
e681153
undo changes
caldrian Nov 20, 2024
8915271
disable module verifier
caldrian Nov 20, 2024
ba13364
fix WireLegacyTests
caldrian Nov 20, 2024
6efda3b
clean up references
caldrian Nov 20, 2024
76656e9
Merge branch 'develop' of github.com:wireapp/wire-ios into chore/prep…
caldrian Nov 20, 2024
2194f90
prepare for fixing WireTesting
caldrian Nov 20, 2024
6a9e89c
Merge branch 'chore/prepare-converting-wire-system-to-package-WPB-730…
caldrian Nov 20, 2024
595269d
update stencil to have public imports
caldrian Nov 20, 2024
3be3a71
various fixes
caldrian Nov 20, 2024
f3606ae
generate code
caldrian Nov 20, 2024
3610c18
fix indentation
caldrian Nov 20, 2024
6218ceb
Merge branch 'develop' of github.com:wireapp/wire-ios into fix/source…
caldrian Nov 20, 2024
fedf7af
fix indentation
caldrian Nov 20, 2024
2d6455f
Merge branch 'develop' of github.com:wireapp/wire-ios into fix/source…
caldrian Nov 20, 2024
043e30a
Merge branch 'develop' of github.com:wireapp/wire-ios into chore/crea…
caldrian Nov 20, 2024
1f259a5
link WireLegacy into WireTesting
caldrian Nov 20, 2024
834569b
move WireLoggerObjC to WireLegacy
caldrian Nov 20, 2024
d4711e2
fix WireLegacyTests
caldrian Nov 20, 2024
039d8f0
prepare for fixing WireTesting
caldrian Nov 20, 2024
30ea1f3
Merge branch 'develop' of github.com:wireapp/wire-ios into chore/crea…
caldrian Nov 21, 2024
d869ce5
try to get rid of WireLoggerObjC in WireLegacy
caldrian Nov 21, 2024
d09fb91
fix WireLegacyTests
caldrian Nov 21, 2024
dd78120
fix WireTesting
caldrian Nov 21, 2024
7435e30
attempt to fix WireTestingTests
caldrian Nov 21, 2024
ee31447
fix WireUtilities
caldrian Nov 21, 2024
cd6b7c6
Merge branch 'release/cycle-3.114' of github.com:wireapp/wire-ios int…
caldrian Nov 21, 2024
cb26ae4
create WireTestingNew
caldrian Nov 21, 2024
ed32cd9
convert to groups
caldrian Nov 21, 2024
c1dac56
move files
caldrian Nov 21, 2024
dfa5412
try fixing verifier errors
caldrian Nov 21, 2024
c6a0f92
undo changes
caldrian Nov 21, 2024
b86adc5
Merge branch 'chore/create-wire-system-package-WPB-7306.todo' into ch…
caldrian Nov 21, 2024
73d3532
convert to folder
caldrian Nov 21, 2024
e62ba6c
try to fix WireTestingTests
caldrian Nov 21, 2024
3ea7aa6
comment Swift tests
caldrian Nov 21, 2024
7d2f8a8
re-create WireTesting
caldrian Nov 21, 2024
e40feac
move files
caldrian Nov 21, 2024
be86f4c
minor corrections
caldrian Nov 21, 2024
77802e3
Merge branch 'chore/create-wire-system-package-WPB-7306.todo' of gith…
caldrian Nov 21, 2024
7bab332
link XCTest
caldrian Nov 21, 2024
ab69879
WireTestingStatic
caldrian Nov 21, 2024
a6f6a50
static WireTesting
caldrian Nov 21, 2024
10ec715
fix WireTestingTests
caldrian Nov 21, 2024
4ea980e
Merge branch 'chore/create-wire-system-package-WPB-7306.todo' into ch…
caldrian Nov 21, 2024
d46cbe4
restore WireTesting
caldrian Nov 21, 2024
46d510b
cleanup
caldrian Nov 21, 2024
1a9c8ce
minor fix
caldrian Nov 21, 2024
53880d5
Merge commit '955a8ee8c26c9e8fbf81c98157cddb0e6fd79e1a' into chore/mo…
caldrian Nov 21, 2024
8217f68
cancel approach, revert changes
caldrian Nov 21, 2024
5ffda1d
Merge branch 'chore/create-wire-system-package-WPB-7306' into chore/m…
caldrian Nov 21, 2024
76b4cc9
revert changes
caldrian Nov 21, 2024
7599734
fix location of WireSystem files
caldrian Nov 21, 2024
da43e6d
move WireLogger into WireFoundation
caldrian Nov 21, 2024
4a6f430
fix WireSystem
caldrian Nov 21, 2024
3259660
add missing imports
caldrian Nov 21, 2024
353fbde
attempt to fix linker error
caldrian Nov 21, 2024
b8bc589
fix WireSystem file localtions
caldrian Nov 21, 2024
ec15f07
clean up WireUtilitiesPackage
caldrian Nov 21, 2024
ded123c
fix package import
caldrian Nov 21, 2024
e0b3991
Trigger CI
caldrian Nov 21, 2024
c75f01d
Merge branch 'chore/cleanup-redundant-swift-packages-WPB-10368' into …
caldrian Nov 21, 2024
41576b5
fix: Missing close button - WPB-14444 (#2182)
samwyndham Nov 22, 2024
fbf33ba
Merge branch 'release/cycle-3.114' into chore/cleanup-redundant-swift…
caldrian Nov 22, 2024
27434d2
chore: cleanup redundant swift packages - WPB-10368 (#2181)
caldrian Nov 22, 2024
b8eeb6e
Merge branch 'release/cycle-3.114' of github.com:wireapp/wire-ios int…
caldrian Nov 22, 2024
e2490d3
Merge branch 'release/cycle-3.114' of github.com:wireapp/wire-ios int…
caldrian Nov 22, 2024
267b3e4
fix: background color backup and settings back button - WPB-14401 (#2…
netbe Nov 22, 2024
2f6cf6b
add TODOs
caldrian Nov 22, 2024
14f9dff
Merge branch 'release/cycle-3.114' of github.com:wireapp/wire-ios int…
caldrian Nov 22, 2024
e76b310
link WireFoundation into WireUtilitiesTests
caldrian Nov 22, 2024
5e6a438
prepare moving CocoaLumberjackLogger to common components
caldrian Nov 22, 2024
a381ce0
Merge branch 'release/cycle-3.114' of github.com:wireapp/wire-ios int…
caldrian Nov 22, 2024
7ee8ee4
Merge branch 'chore/cleanup-redundant-swift-packages-WPB-10368' into …
caldrian Nov 22, 2024
a47b9f2
move CocoaLumberjackLogger to common components
caldrian Nov 22, 2024
530a4ab
link WireFoundation into WireUtilitiesTests
caldrian Nov 22, 2024
14f1919
cleanup
caldrian Nov 22, 2024
d839829
undo adding imports
caldrian Nov 22, 2024
1918d02
undo project file changes
caldrian Nov 22, 2024
df1084d
minor fix
caldrian Nov 22, 2024
88c48cf
Merge branch 'release/cycle-3.114.tmp' into fix/sourcery-stencils-WPB…
caldrian Nov 22, 2024
120b6d7
Merge branch 'fix/sourcery-stencils-WPB-11881' into chore/move-WireLo…
caldrian Nov 22, 2024
43d8af1
fix build error
caldrian Nov 22, 2024
9b41d8e
Merge branch 'fix/sourcery-stencils-WPB-11881' into chore/move-WireLo…
caldrian Nov 22, 2024
77a18eb
fix imports
caldrian Nov 22, 2024
f9d8195
link WireFoundation into WireTransport
caldrian Nov 22, 2024
72a5625
fix: allow for public imports in sourcery generated code - WPB-11881 …
caldrian Nov 22, 2024
fe83965
fix: showing/hiding empty conversation list placeholder - WPB-14386 (…
caldrian Nov 22, 2024
234e41d
fix: network status view background color - WPB-14466 (#2189)
caldrian Nov 22, 2024
1611386
fix: Image selector anchor - WPB-11605 (#2100)
samwyndham Nov 25, 2024
47d5011
fix: status bar appearance on iPad - WPB-14474 (#2191)
caldrian Nov 25, 2024
86f9ba2
Merge branch 'release/cycle-3.114' of github.com:wireapp/wire-ios int…
caldrian Nov 25, 2024
af3ecdc
fix: Applied filter view height - WPB-14421 (#2188)
samwyndham Nov 25, 2024
166d69e
fix: Move to folder picker tappable area - WPB-14469 (#2197)
samwyndham Nov 25, 2024
641f1a6
add existential any
caldrian Nov 25, 2024
bd8e650
fix: Nav bar covers content in Guest & Services views - WPB-14452 (#2…
samwyndham Nov 25, 2024
bec1b44
fix warnings, remove unused global variable
caldrian Nov 25, 2024
9f6ce2b
minor preparations
caldrian Nov 25, 2024
12a4c89
Merge branch 'release/cycle-3.114' of github.com:wireapp/wire-ios int…
caldrian Nov 25, 2024
bbbf99f
brainstorming
caldrian Nov 25, 2024
1ad532d
WireAnalytics.setup()
caldrian Nov 25, 2024
95a3ff9
add Sendable conformance
caldrian Nov 25, 2024
0b6fa8b
Merge branch 'fix/make-WireLogger-Swift6-ready-WPB-11890' into chore/…
caldrian Nov 25, 2024
069d93b
create targets WireLogging etc.
caldrian Nov 25, 2024
6324a5d
move file
caldrian Nov 26, 2024
674d335
Merge branch 'release/cycle-3.114' of github.com:wireapp/wire-ios int…
caldrian Nov 26, 2024
488c20b
attempt to extend WireLogInterpolation from outside
caldrian Nov 26, 2024
30efda2
fix: Crash unwrapping `MainCoordinator.splitViewController` - WPB-145…
samwyndham Nov 26, 2024
c365522
fix: Profile color tappable area - WPB-14525 (#2208)
samwyndham Nov 26, 2024
272750f
chore: delete redundant LICENSE and README files - WPB-14567 (#2214)
caldrian Nov 27, 2024
c58319e
fix: back button style - WPB-14478 (#2213)
netbe Nov 27, 2024
805268b
chore: bump avs to 9.10.16 - WPB-11904 (#2118)
netbe Nov 27, 2024
fd6d0d3
feat: Add scroll view to the passcode setup view - WPB-11836 (#2211)
KaterinaWire Nov 27, 2024
96e3350
Merge branch 'release/cycle-3.114' of github.com:wireapp/wire-ios int…
caldrian Nov 27, 2024
73c5368
fix: remove debug logging of credentials - WPB-14251 (#2205)
caldrian Nov 27, 2024
ecb13d4
add missing imports
caldrian Nov 27, 2024
d2f00e8
chore: unify schemes and test plans - WPB-11406 (#2217)
caldrian Nov 28, 2024
ae81f4e
fix: crash when registering with a registered email - WPB-14566 (#2223)
caldrian Nov 28, 2024
e16329f
Merge branch 'release/cycle-3.114' of github.com:wireapp/wire-ios int…
caldrian Nov 28, 2024
b066604
add notes
caldrian Nov 28, 2024
8f792d3
squashed commit
caldrian Nov 28, 2024
033c4b5
Merge commit 'b0666045b3a660df08cc667bb0b5497154303bc2' into chore/ab…
caldrian Nov 28, 2024
321bc1b
fix merge conflicts
caldrian Nov 28, 2024
77e0625
add debug output
caldrian Nov 29, 2024
a2eb720
Merge branch 'develop' of github.com:wireapp/wire-ios into chore/abst…
caldrian Dec 2, 2024
4c87e8b
some progress
caldrian Dec 2, 2024
2c1e835
restructuring
caldrian Dec 2, 2024
78f9d80
StaticString
caldrian Dec 2, 2024
8f4441e
cleanup
caldrian Dec 2, 2024
9560df1
sendable
caldrian Dec 2, 2024
c7f0e95
rename WireLogger to OldWireLogger
caldrian Dec 2, 2024
27d8588
Merge branch 'develop' of github.com:wireapp/wire-ios into chore/abst…
caldrian Dec 2, 2024
4582f8c
fix build assets reference
caldrian Dec 2, 2024
13a7cd0
start over from abstract-logging branch
caldrian Dec 2, 2024
e2b2254
Merge branch 'chore/abstract-logging' into chore/move-WireLogger-into…
caldrian Dec 2, 2024
80a0873
wip
caldrian Dec 3, 2024
30ed498
some progress
caldrian Dec 3, 2024
4b595af
some more progress
caldrian Dec 3, 2024
0b6b1cd
OSLogLoggingSystem
caldrian Dec 3, 2024
a9f799c
cleanup
caldrian Dec 3, 2024
517695d
code style
caldrian Dec 3, 2024
b071b62
prepare for refactoring
caldrian Dec 3, 2024
ad69777
refactoring
caldrian Dec 3, 2024
8f5ac70
adapters
caldrian Dec 3, 2024
0914924
remove commented code
caldrian Dec 3, 2024
cf1f340
cleanup
caldrian Dec 3, 2024
1014369
additional attributes
caldrian Dec 3, 2024
0925987
further cleanup
caldrian Dec 3, 2024
fd7c357
use logger in WireSystem
caldrian Dec 3, 2024
4108d52
allow for skipping obfuscation for errors
caldrian Dec 3, 2024
ca46e28
finish some tests
caldrian Dec 3, 2024
0a6b541
Merge branch 'develop' of github.com:wireapp/wire-ios into chore/move…
caldrian Dec 3, 2024
e382470
improve directory structure
caldrian Dec 3, 2024
8659503
reduce the number of changes
caldrian Dec 3, 2024
0a037fb
undo changes
caldrian Dec 3, 2024
85d1e25
reverts
caldrian Dec 3, 2024
cb5d765
WireLogger.with(tag:)
caldrian Dec 3, 2024
d85b046
revert changes
caldrian Dec 3, 2024
0306c7f
create target WireLogging
caldrian Dec 3, 2024
c3de44b
move several files
caldrian Dec 3, 2024
eebc803
move SystemLogger
caldrian Dec 3, 2024
3320e12
move all files except objc
caldrian Dec 3, 2024
0c94b20
add missing imports
caldrian Dec 3, 2024
ae4c7cb
fix imports in DataModel
caldrian Dec 3, 2024
328085f
fix imports in WireDomain
caldrian Dec 3, 2024
422d412
Merge branch 'develop' of github.com:wireapp/wire-ios into chore/move…
caldrian Dec 3, 2024
424d4a6
fix imports in RequestStrategy
caldrian Dec 3, 2024
4f42bab
fix imports in SyncEngine
caldrian Dec 3, 2024
4eff7e6
add missing imports
caldrian Dec 3, 2024
c326799
format code
caldrian Dec 3, 2024
4a79500
Trigger CI
caldrian Dec 3, 2024
0ec0fa0
rename WireLoggerObjc to WireLoggerObjC
caldrian Dec 3, 2024
f6d18ff
fix filename
caldrian Dec 3, 2024
090d1f7
move file to avoid issues
caldrian Dec 3, 2024
15556ad
convert groups to folders
caldrian Dec 3, 2024
ca35c2c
undo renaming
caldrian Dec 3, 2024
8a915a1
Merge branch 'chore/move-WireLogger-into-WireFoundation-WPB-10941' in…
caldrian Dec 3, 2024
5b07cd1
move existing files into subdirectory
caldrian Dec 3, 2024
d4a91fd
add Package.resolved to .gitignore
caldrian Dec 4, 2024
fd7c094
link WireLogging to unit tests
caldrian Dec 4, 2024
c571a89
add TODO, clean up (null) in xcodeproj
caldrian Dec 4, 2024
56c82e3
Merge branch 'develop' of github.com:wireapp/wire-ios into chore/move…
caldrian Dec 4, 2024
a5c5fd4
create package WireLogging
caldrian Dec 4, 2024
3bbffa5
WireLoggingAll scheme
caldrian Dec 4, 2024
cdeb6d0
fix framework.rb
caldrian Dec 4, 2024
81d8f28
Merge branch 'develop' of github.com:wireapp/wire-ios into chore/move…
caldrian Dec 4, 2024
18cd558
Merge branch 'develop' of github.com:wireapp/wire-ios into chore/move…
caldrian Dec 4, 2024
3fe7307
fix missing import
caldrian Dec 4, 2024
1200355
revert converting groups to folders
caldrian Dec 4, 2024
65075af
convert groups to folders again
caldrian Dec 4, 2024
3a28219
Merge branch 'develop' of github.com:wireapp/wire-ios into chore/crea…
caldrian Dec 4, 2024
1055921
move files
caldrian Dec 4, 2024
8be0088
move files
caldrian Dec 4, 2024
7fd4b96
Merge branch 'chore/move-WireLogger-into-WireFoundation-WPB-10941.tmp…
caldrian Dec 4, 2024
b4146df
prefix existing types with Legacy
caldrian Dec 5, 2024
f880ddc
Revert "prefix existing types with Legacy"
caldrian Dec 5, 2024
e89de28
move existing code into WireLegacyLogging
caldrian Dec 5, 2024
8f37ecd
revert many renamings
caldrian Dec 5, 2024
b3c187c
revert remaining renamings
caldrian Dec 5, 2024
4d75edb
add WireLogging as dependency of WireAnalytics
caldrian Dec 5, 2024
d4a3153
use WireLogger from AnalyticsService
caldrian Dec 5, 2024
63bbb11
create WireLogLevel
caldrian Dec 5, 2024
ad5e274
fix build errors
caldrian Dec 5, 2024
b71eae4
migrate WireAnalytics to Swift 6
caldrian Dec 5, 2024
b251034
fix more build errors
caldrian Dec 5, 2024
6cf6296
format code
caldrian Dec 5, 2024
b431297
Merge commit 'b2510343bd2e19709bb23066b306afb7f8a0f7b6' into chore/cr…
caldrian Dec 5, 2024
08e91b7
Merge branch 'chore/resolve-todos-WPB-10941' into chore/create-WireLo…
caldrian Dec 5, 2024
cdeb635
sort folders in fastlane/framework.rb
caldrian Dec 5, 2024
ef51717
remove unused import
caldrian Dec 5, 2024
2b9f424
Merge branch 'develop' of github.com:wireapp/wire-ios into chore/move…
caldrian Dec 5, 2024
442c476
Merge branch 'chore/move-WireLogger-into-WireFoundation-WPB-10941' in…
caldrian Dec 5, 2024
e2e1d09
several fixes
caldrian Dec 6, 2024
63fb26f
fix redundant values
caldrian Dec 6, 2024
9251e11
fix filenam
caldrian Dec 6, 2024
7dba17b
Merge branch 'chore/move-WireLogger-into-WireFoundation-WPB-10941' in…
caldrian Dec 6, 2024
b54bc47
fix dependency tracking
caldrian Dec 6, 2024
fa29770
Merge remote-tracking branch 'github/gh-readonly-queue/develop/pr-193…
caldrian Dec 6, 2024
535c42b
Merge branch 'chore/resolve-todos-WPB-10941' into refactor/WireLoggin…
caldrian Dec 6, 2024
fd8449b
remove variadic parameters
caldrian Dec 6, 2024
241a328
WireLoggingProvider.tag
caldrian Dec 6, 2024
53331be
generics
caldrian Dec 6, 2024
d2fdc58
delete aggregated provider builder
caldrian Dec 6, 2024
97714c3
minor fix
caldrian Dec 6, 2024
9ae2812
fix action reference
caldrian Dec 6, 2024
12132b2
Merge commit 'd03ca9769515b6088f45cf81b5b29526e6739a94' into refactor…
caldrian Dec 9, 2024
f7506ea
fix conflict
caldrian Dec 9, 2024
97e0d15
delete dead code
caldrian Dec 9, 2024
62058cf
Merge branch 'develop' of github.com:wireapp/wire-ios into refactor/W…
caldrian Dec 17, 2024
a63cc63
demo - tmp
caldrian Dec 19, 2024
0173673
Revert "demo - tmp"
caldrian Feb 5, 2025
c3512ee
Merge branch 'develop' of github.com:wireapp/wire-ios into refactor/W…
caldrian Feb 5, 2025
b510d00
Merge branch 'develop' of github.com:wireapp/wire-ios into refactor/W…
caldrian Feb 21, 2025
96329d0
fix: Try fix text link color - WPB-17726 (#3047)
caldrian May 21, 2025
b80a871
feat: cross-platform backup - WPB-16658 (#2889)
caldrian May 21, 2025
864c576
fix: unknown symbols issue - WPB-17820 (#3050)
samwyndham May 21, 2025
f7ebc9c
fix: incremental sync observer crash - WPB-17644 (#3046)
github-actions[bot] May 21, 2025
8f4b852
fix: pull self user after pulling known users - WPB-17516 (#3043)
github-actions[bot] May 22, 2025
a734dd3
fix: link `Wire-iOS` with `WireCellsAPI` - WPB-17860 (#3057)
samwyndham May 22, 2025
e06527e
fix: CallKit crashes when in background - WPB-17848 (#3061)
github-actions[bot] May 23, 2025
53ed23f
fix: max participants 2000 formatting with locale - WPB-17344 (#3063)
github-actions[bot] May 23, 2025
ba57cb8
Merge branch 'release/cycle-3.125' of github.com:wireapp/wire-ios int…
caldrian May 23, 2025
89fcdc4
feat: batch decryption - WPB-17614 (#3014)
typfel May 27, 2025
bfad07f
fix: messages not being sent, waiting forever for decryption to finis…
github-actions[bot] May 27, 2025
4fe63d1
feat: add spinner - WPB-17596 (#3069)
KaterinaWire May 27, 2025
fbeee24
fix: push notification connection accepted placeholder - WPB-17903 (#…
github-actions[bot] May 27, 2025
00fece1
chore: delete unused targets and files (WireLoggingSupport/Tests) - W…
caldrian May 27, 2025
339aa0e
Merge branch 'release/cycle-3.125' of github.com:wireapp/wire-ios int…
caldrian May 28, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
//
// Wire
// Copyright (C) 2025 Wire Swiss GmbH
// Copyright (C) 2024 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
Expand All @@ -16,11 +16,6 @@
// along with this program. If not, see http://www.gnu.org/licenses/.
//

import XCTest
import WireLegacyLogging

@testable import WireLogging

final class PlaceholderTests: XCTestCase {

func testNothing() {}
}
typealias WireLogger = WireLegacyLogging.WireLogger
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,9 @@ import KaliumBackup

extension BackupConversation {

convenience init(_ conversation: BackupConversationModel) {
convenience init(_ conversation: ConversationBackupModel) {
self.init(
id: BackupQualifiedId(conversation.id),
id: BackupQualifiedId(conversation.qualifiedID),
name: conversation.name
)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ import KaliumBackup

extension BackupMessage {

convenience init(_ message: BackupMessageModel) {
convenience init(_ message: MessageBackupModel) {
self.init(
id: message.id.lowercased(),
conversationId: BackupQualifiedId(message.conversationID),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,13 @@
//

import KaliumBackup
import WireFoundation

extension BackupUser {

convenience init(_ user: BackupUserModel) {
convenience init(_ user: UserBackupModel) {
self.init(
id: BackupQualifiedId(user.id),
id: BackupQualifiedId(user.qualifiedID),
name: user.name,
handle: user.handle
)
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,112 @@
//
// 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 Foundation
import KaliumBackup
import WireFoundation

/// Abstraction around the multi-platform framework, attempting to improve the interface by using proper types and Swift
/// concurrency and hide the NSObject API.
struct BackupCreator {

private let mpBackupCreator: MPBackupExporter

init(
selfUserID: QualifiedID,
workDirectoryURL: URL,
outputDirectoryURL: URL,
fileArchiver: some FileArchiverProtocol
) {
self.mpBackupCreator = MPBackupExporter(
selfUserId: BackupQualifiedId(selfUserID),
workDirectory: workDirectoryURL.path(),
outputDirectory: outputDirectoryURL.path(),
fileZipper: FileArchiverToFileZipperAdapter(fileArchiver)
)
}

func addUser(_ user: UserBackupModel) {
mpBackupCreator.add(user: BackupUser(user))
}

func addConversation(_ conversation: ConversationBackupModel) {
mpBackupCreator.add(conversation: BackupConversation(conversation))
}

func addMessage(_ message: MessageBackupModel) {
mpBackupCreator.add(message: BackupMessage(message))
}

func finalize(password: String) async throws -> URL {

let result: any BackupExportResult = try await mpBackupCreator.finalize(password: password)

switch result {
case let success as BackupExportResultSuccess:
return URL(filePath: success.pathToOutputFile, directoryHint: .notDirectory)
case let ioError as BackupExportResultFailureIOError:
throw FinalizeBackupFileError.ioError(ioError.message)
case let zipError as BackupExportResultFailureZipError:
throw FinalizeBackupFileError.zipError(zipError.message)
default:
throw FinalizeBackupFileError.unexpectedResultType
}

}

// MARK: -

enum FinalizeBackupFileError: Error {

case success(_ outputFile: String)
case ioError(_ message: String)
case zipError(_ message: String)
case unexpectedResultType

}

}

// MARK: -

private final class FileArchiverToFileZipperAdapter<FileArchiver>: FileZipper
where FileArchiver: FileArchiverProtocol {

let fileArchiver: FileArchiver

init(_ fileArchiver: FileArchiver) {
self.fileArchiver = fileArchiver
}

func zip(entries: [String], outputDirectory: OkioPath) throws -> String {

let outputDirectory = outputDirectory.segments.reduce(URL(fileURLWithPath: "/")) { url, component in
url.appendingPathComponent(component)
}
let targetURLs = entries.map { entry in
URL(filePath: entry, directoryHint: .notDirectory)
}
let destinationURL = outputDirectory.appendingPathComponent("backup.zip", isDirectory: false)

try fileArchiver.zipResources(at: targetURLs, into: destinationURL)

return destinationURL.path()

}

}
Original file line number Diff line number Diff line change
Expand Up @@ -18,17 +18,16 @@

public import WireFoundation

public struct BackupConversationModel {
public typealias ID = QualifiedID
public struct ConversationBackupModel: Codable, Hashable, Sendable {

public var id: ID
public var qualifiedID: QualifiedID
public var name: String

public init(
id: ID,
qualifiedID: QualifiedID,
name: String
) {
self.id = id
self.qualifiedID = qualifiedID
self.name = name
}

Expand Down
28 changes: 14 additions & 14 deletions WireBackup/Sources/WireBackup/Models/BackupMessageModel.swift
Original file line number Diff line number Diff line change
Expand Up @@ -19,18 +19,17 @@
public import Foundation
public import WireFoundation

public struct BackupMessageModel {
public typealias ID = String
public struct MessageBackupModel: Codable, Hashable, Sendable {

public var id: ID
public var id: String
public var conversationID: QualifiedID
public var senderUserID: QualifiedID
public var senderClientID: String?
public var creationDate: Date
public var content: MessageContent

public init(
id: ID,
id: String,
conversationID: QualifiedID,
senderUserID: QualifiedID,
senderClientID: String? = nil,
Expand All @@ -52,7 +51,7 @@ public struct BackupMessageModel {
// The following types replicate the API of the multi-platform backup library in a Swift friendlier way.
// (e.g. enums instead of class hierarchy)

public enum MessageContent {
public enum MessageContent: Codable, Hashable, Sendable {

case text(TextContent)
case location(LocationContent)
Expand All @@ -64,18 +63,18 @@ public enum MessageContent {

public extension MessageContent {

struct TextContent {
struct TextContent: Codable, Hashable, Sendable {
public var text: String
}

struct LocationContent {
struct LocationContent: Codable, Hashable, Sendable {
public var longitude: Float
public var latitude: Float
public var name: String?
public var zoom: Int32?
}

struct AssetContent {
struct AssetContent: Codable, Hashable, Sendable {
public var mimeType: String
public var size: UInt64
public var name: String?
Expand All @@ -87,16 +86,17 @@ public extension MessageContent {
public var encryption: EncryptionAlgorithm?
public var metadata: Metadata?

public enum EncryptionAlgorithm {
public enum EncryptionAlgorithm: Codable, Hashable, Sendable {
case aesCBC
case aesGCM
}

public enum Metadata {
public enum Metadata: Codable, Hashable, Sendable {

case image(ImageMetadata)
case video(VideoMetadata)
case audio(AudioMetadata)
// TODO: [WPB-16658] check if the `.generic` case needs to be used
case generic(GenericMetadata)

}
Expand All @@ -106,24 +106,24 @@ public extension MessageContent {

public extension MessageContent.AssetContent.Metadata {

struct ImageMetadata {
struct ImageMetadata: Codable, Hashable, Sendable {
public var width: Int32
public var height: Int32
public var tag: String?
}

struct VideoMetadata {
struct VideoMetadata: Codable, Hashable, Sendable {
public var width: Int32?
public var height: Int32?
public var duration: UInt64?
}

struct AudioMetadata {
struct AudioMetadata: Codable, Hashable, Sendable {
public var normalization: Data?
public var duration: UInt64?
}

struct GenericMetadata {
struct GenericMetadata: Codable, Hashable, Sendable {
public var name: String?
}

Expand Down
9 changes: 4 additions & 5 deletions WireBackup/Sources/WireBackup/Models/BackupUserModel.swift
Original file line number Diff line number Diff line change
Expand Up @@ -18,19 +18,18 @@

public import WireFoundation

public struct BackupUserModel {
public typealias ID = QualifiedID
public struct UserBackupModel: Codable, Hashable, Sendable {

public var id: ID
public var qualifiedID: QualifiedID
public var name: String
public var handle: String

public init(
id: ID,
qualifiedID: QualifiedID,
name: String,
handle: String
) {
self.id = id
self.qualifiedID = qualifiedID
self.name = name
self.handle = handle
}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
//
// 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 WireFoundation

// sourcery: AutoMockable
public protocol BackupLocalStoreProtocol: Sendable {

/// Returns the number of all stored users, conversations and messages in the local data store, including deleted
/// ones.
func countModels() async throws -> (userCount: Int, conversationCount: Int, messageCount: Int)

// MARK: -

/// Returns all users stored in the local database, including deleted ones.
func fetchAllUsers() -> AsyncThrowingStream<UserBackupModel, any Error>

// MARK: -

/// Returns all conversations stored in the local database, including deleted ones.
func fetchAllConversations() -> AsyncThrowingStream<ConversationBackupModel, any Error>

// MARK: -

/// Returns all messages stored in the local database, including deleted ones.
func fetchAllMessages() -> AsyncThrowingStream<MessageBackupModel, any Error>

}
32 changes: 32 additions & 0 deletions WireBackup/Sources/WireBackup/UseCases/BackupFileExtension.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
//
// 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 BackupFileExtension: String, CaseIterable {

case crossPlatform = "wbu"

// MARK: Legacy

// There are some external apps that users can use to transfer backup files, which can modify their attachments and
// change the underscore with a dash. For this reason, we accept 2 types of file extensions to restore
// conversations.

case fileExtensionWithUnderscore = "ios_wbu"
case fileExtensionWithHyphen = "ios-wbu"

}
Loading