-
Notifications
You must be signed in to change notification settings - Fork 20
feat: port Wire Android services & use cases - WPB-16148 #2920
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
43 commits
Select commit
Hold shift + click to select a range
a71c332
feat: port most Android kalium models & interfaces
El-Fitz 34e09e9
feat: implement persistency for conversations attributes, boilerplate…
El-Fitz ef217d8
feat: port & implement S3 client & upload manager
El-Fitz d61ba98
style: fix formatting
El-Fitz 0af8aad
Comment out non-compiling code
samwyndham 013ed95
Fix `MessageAttachmentDraftDataSource.add(conversationID:node:mimeTyp…
samwyndham a195a25
Comment out non-compiling code
samwyndham a8a9565
Fix compile issue
samwyndham 67ff48a
Comment broken tests
samwyndham 7052223
Make `Aws` uppercase
samwyndham 588329b
Change `cellsApi` to `cellsAPI`
samwyndham 60d1f2e
Change `Dao` to `DAO`
samwyndham 2004156
Fix WireCellsCellsDataSource concurrency issues
samwyndham 27ece32
Rename `Dto` to `DTO`
samwyndham 7b4d9e1
Fix file naming
samwyndham 5d4d55c
Remove TODO
samwyndham 810e124
Delete stray commented code
samwyndham 2cc64e2
Make `WireCellsMessageAttachmentDraftRepository.observe(conversationI…
samwyndham 2c852ab
Implement `WireCellsAWSClientImplementation.getPreSignedUrl(objectKey:)`
samwyndham f5bea45
Report download progress
samwyndham 6493154
Update cells SDK
samwyndham 95b68f0
Create todo comment
samwyndham 1bbb808
Merge branch 'develop' into feat/wire-cells-upgrade-service
samwyndham 7804585
Store upload status as Int16
samwyndham a53ed76
Create `zmessaging2.126.0` model
samwyndham 9140363
Update data model schema
samwyndham c9decb8
Fix compile errors
samwyndham f635115
Update file names ...Dao -> ...DAO
samwyndham 4510e39
Don't use WireCellsAPI model directly in core data
samwyndham e9f79d1
Commit auto generated mocks
samwyndham 5752bbd
Fix core data not finding `WireCellsMessageAttachmentDraftEntity` class
samwyndham 5408260
Test creating a `WireCellsMessageAttachmentDraftEntity`
samwyndham 797adab
Delete unused tests
samwyndham 654a478
Lint & format
samwyndham adef6d1
Fix compile errors
samwyndham 47b501a
Update Databases changelog
samwyndham 9cbbe26
Fix DatabaseMigrationTests
samwyndham bda2386
Rename `Cell` types to `Node`
samwyndham 9b8a4fb
Rename `Cell` types to `Node` in file names
samwyndham bd5f9f1
Rename `WireCellsNodesApiImpl` to `WireCellsNodesAPIImpl`
samwyndham 11f060d
Merge branch 'develop' into feat/wire-cells-upgrade-service
samwyndham 28dcf84
Merge branch 'develop' into feat/wire-cells-upgrade-service
samwyndham 0361c26
Fix data model tests
samwyndham File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
// | ||
// 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/. | ||
// | ||
|
||
// This is used to erase the type of an `AsyncSequence` to a generic one. | ||
// This is useful because since iOS 18, `AsyncSequence` takes two associated types: | ||
// `Element` and `Failure`. | ||
// This means that if you target iOS 17 and earlier, you can't use `AsyncSequence`, | ||
// as the second argument for `AsyncSequence` is only available in iOS 18 and later. | ||
// | ||
// see https://forums.swift.org/t/possible-to-return-an-asyncsequence-t-for-ios-17-when-building-against-ios-18/76107/2 | ||
public struct AnyAsyncSequence<Element, Failure: Error>: AsyncSequence { | ||
public typealias AsyncIterator = AnyAsyncIterator<Element, Failure> | ||
|
||
private let _makeAsyncIterator: () -> AsyncIterator | ||
|
||
public init<S: AsyncSequence>(_ base: S) where S.Element == Element { | ||
var baseIterator = base.makeAsyncIterator() | ||
self._makeAsyncIterator = { | ||
AnyAsyncIterator { | ||
try? await baseIterator.next() | ||
} | ||
} | ||
} | ||
|
||
public func makeAsyncIterator() -> AsyncIterator { | ||
_makeAsyncIterator() | ||
} | ||
} | ||
|
||
public struct AnyAsyncIterator<Element, Failure: Error>: AsyncIteratorProtocol { | ||
private let _next: () async throws(Failure) -> Element? | ||
|
||
public init(_ next: @escaping () async -> Element?) { | ||
self._next = next | ||
} | ||
|
||
public func next() async throws(Failure) -> Element? { | ||
try await _next() | ||
} | ||
} |
52 changes: 52 additions & 0 deletions
52
WireCells/Sources/WireCellsAPI/Model/WireCellsAssetMetadata.swift
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
// | ||
// 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 import Foundation | ||
|
||
public enum WireCellsAssetMetadata: Equatable, Hashable, Sendable { | ||
case image(width: Int, height: Int) | ||
case video(width: Int?, height: Int?, durationMs: Int64?) | ||
case audio(durationMs: Int64?, normalizedLoudness: Data?) | ||
|
||
public var width: Int? { | ||
switch self { | ||
case let .image(width, _), let .video(width?, _, _): | ||
width | ||
case .video, .audio: | ||
nil | ||
} | ||
} | ||
|
||
public var height: Int? { | ||
switch self { | ||
case let .image(_, height), let .video(_, height?, _): | ||
height | ||
case .video, .audio: | ||
nil | ||
} | ||
} | ||
|
||
public var durationMs: Int64? { | ||
switch self { | ||
case .image: | ||
nil | ||
case let .video(_, _, durationMs), let .audio(durationMs, _): | ||
durationMs | ||
} | ||
} | ||
} |
60 changes: 60 additions & 0 deletions
60
WireCells/Sources/WireCellsAPI/Model/WireCellsConversationID.swift
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
// | ||
// 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 import Foundation | ||
|
||
public struct WireCellsConversationID: Codable, Equatable, Hashable, Identifiable, Sendable { | ||
|
||
public let domain: String | ||
public let uuid: UUID | ||
|
||
public var id: String { | ||
"\(uuid.uuidString)@\(domain)" | ||
} | ||
|
||
public var pydioQualifiedID: String { | ||
"\(uuid.uuidString)@\(domain)" | ||
} | ||
|
||
package init(domain: String, uuid: UUID) { | ||
self.domain = domain | ||
self.uuid = uuid | ||
} | ||
|
||
public init?(string: String) { | ||
// The CellsSDK provides the qualifiedID as a string in the format `uuid@domain` | ||
let components = string.split(separator: "@") | ||
guard components.count == 2, let uuid = UUID(uuidString: String(components[1])) else { | ||
return nil | ||
} | ||
self.domain = String(components[0]) | ||
self.uuid = uuid | ||
} | ||
} | ||
|
||
extension WireCellsConversationID: CustomStringConvertible { | ||
public var description: String { | ||
"\(uuid.uuidString)@\(domain)" | ||
} | ||
} | ||
|
||
extension WireCellsConversationID: CustomDebugStringConvertible { | ||
public var debugDescription: String { | ||
"ConversationID(domain: \(domain), uuid: \(uuid.uuidString))" | ||
} | ||
} |
31 changes: 31 additions & 0 deletions
31
WireCells/Sources/WireCellsAPI/Model/WireCellsCredentials.swift
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
// | ||
// 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 import Foundation | ||
|
||
public struct WireCellsCredentials: Equatable, Hashable, Sendable { | ||
public let serverUrl: URL | ||
public let accessToken: String | ||
public let gatewaySecret: String | ||
|
||
package init(serverUrl: URL, accessToken: String, gatewaySecret: String) { | ||
self.serverUrl = serverUrl | ||
self.accessToken = accessToken | ||
self.gatewaySecret = gatewaySecret | ||
} | ||
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
92 changes: 92 additions & 0 deletions
92
WireCells/Sources/WireCellsAPI/Model/WireCellsMessageAttachmentDraft.swift
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,92 @@ | ||
// | ||
// 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 import Foundation | ||
|
||
public struct WireCellsMessageAttachmentDraftID: Equatable, Hashable, Identifiable, Sendable { | ||
public let uuid: UUID | ||
public let versionID: String | ||
|
||
public var id: String { | ||
"\(uuid.uuidString)/\(versionID)" | ||
} | ||
|
||
package init(uuid: UUID, versionID: String) { | ||
self.uuid = uuid | ||
self.versionID = versionID | ||
} | ||
} | ||
|
||
extension WireCellsMessageAttachmentDraftID: CustomStringConvertible { | ||
public var description: String { | ||
"\(uuid.uuidString)/\(versionID)" | ||
} | ||
} | ||
|
||
extension WireCellsMessageAttachmentDraftID: CustomDebugStringConvertible { | ||
public var debugDescription: String { | ||
"WireCellsMessageAttachmentDraftID(uuid: \(uuid), versionID: \(versionID))" | ||
} | ||
} | ||
|
||
public struct WireCellsMessageAttachmentDraft: Sendable, Hashable, Identifiable { | ||
public let id: WireCellsMessageAttachmentDraftID | ||
public let fileName: String | ||
public let remoteFilePath: String | ||
public let localFilePath: String | ||
public let fileSize: UInt64 | ||
public let uploadStatus: WireCellsAttachmentUploadStatus | ||
public let mimeType: String | ||
public let assetWidth: UInt64? | ||
public let assetHeight: UInt64? | ||
public let assetDuration: UInt64? | ||
|
||
public init( | ||
uuid: UUID, | ||
versionID: String, | ||
fileName: String, | ||
remoteFilePath: String, | ||
localFilePath: String, | ||
fileSize: UInt64, | ||
uploadStatus: WireCellsAttachmentUploadStatus, | ||
mimeType: String, | ||
assetWidth: UInt64?, | ||
assetHeight: UInt64?, | ||
assetDuration: UInt64? | ||
) { | ||
self.id = WireCellsMessageAttachmentDraftID( | ||
uuid: uuid, | ||
versionID: versionID | ||
) | ||
self.fileName = fileName | ||
self.remoteFilePath = remoteFilePath | ||
self.localFilePath = localFilePath | ||
self.fileSize = fileSize | ||
self.uploadStatus = uploadStatus | ||
self.mimeType = mimeType | ||
self.assetWidth = assetWidth | ||
self.assetHeight = assetHeight | ||
self.assetDuration = assetDuration | ||
} | ||
} | ||
|
||
public enum WireCellsAttachmentUploadStatus: Sendable, Hashable { | ||
case uploading | ||
case uploaded | ||
case failed | ||
} |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.