Skip to content
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

chore: Bump Multiplatform SwissTransfer to 0.8.2 #43

Merged
merged 5 commits into from
Nov 15, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
2 changes: 1 addition & 1 deletion SwissTransferCore/Settings/DownloadLimit+Extension.swift
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ import SwiftUI

extension DownloadLimit: SettingSelectable {
public var title: String {
return value
return "\(value)"
}

public var icon: Image? {
Expand Down
3 changes: 2 additions & 1 deletion SwissTransferCore/TargetAssembly.swift
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
private let appGroupIdentifier = "group.com.infomaniak.swisstransfer"

public extension UserDefaults {
static let shared = UserDefaults(suiteName: appGroupIdentifier)!

Check warning on line 29 in SwissTransferCore/TargetAssembly.swift

View workflow job for this annotation

GitHub Actions / Build and Test project

static property 'shared' is not concurrency-safe because non-'Sendable' type 'UserDefaults' may have shared mutable state; this is an error in the Swift 6 language mode

Check warning on line 29 in SwissTransferCore/TargetAssembly.swift

View workflow job for this annotation

GitHub Actions / Build and Test project

static property 'shared' is not concurrency-safe because non-'Sendable' type 'UserDefaults' may have shared mutable state; this is an error in the Swift 6 language mode

Check warning on line 29 in SwissTransferCore/TargetAssembly.swift

View workflow job for this annotation

GitHub Actions / Build and Test project

static property 'shared' is not concurrency-safe because non-'Sendable' type 'UserDefaults' may have shared mutable state; this is an error in the Swift 6 language mode
}

extension [Factory] {
Expand All @@ -49,7 +49,8 @@
AccountManager()
},
Factory(type: SwissTransferInjection.self) { _, _ in
SwissTransferInjection()
// FIXME: Use the UserAgentBuilder once SwissTransfer has whitelisted it
SwissTransferInjection(userAgent: "Ktor client")
},
Factory(type: AppSettingsManager.self) { _, resolver in
let stInjection = try resolver.resolve(type: SwissTransferInjection.self,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,35 +16,31 @@
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/

import STCore
import STResources
import SwiftUI

public enum TransferType: String, CaseIterable {
case link
case qrcode
case proximity
case mail

public var title: String {
public extension TransferType {
var title: String {
switch self {
case .link:
STResourcesStrings.Localizable.transferTypeLink
case .mail:
STResourcesStrings.Localizable.transferTypeEmail
case .qrcode:
case .qrCode:
STResourcesStrings.Localizable.transferTypeQrCode
case .proximity:
STResourcesStrings.Localizable.transferTypeProximity
}
}

public var icon: Image {
var icon: Image {
switch self {
case .link:
STResourcesAsset.Images.hyperlink.swiftUIImage
case .mail:
STResourcesAsset.Images.envelope.swiftUIImage
case .qrcode:
case .qrCode:
STResourcesAsset.Images.qrCode.swiftUIImage
case .proximity:
STResourcesAsset.Images.wifi.swiftUIImage
Expand Down
4 changes: 2 additions & 2 deletions SwissTransferCore/Utils/PreviewHelper.swift
Original file line number Diff line number Diff line change
Expand Up @@ -51,11 +51,11 @@ public enum PreviewHelper {
)

public static let sampleNewUploadSession = NewUploadSession(
duration: "30",
duration: ValidityPeriod.thirty,
authorEmail: "",
password: "",
message: "Coucou",
numberOfDownload: 250,
numberOfDownload: DownloadLimit.twoHundredFifty,
language: .english,
recipientsEmails: [],
files: []
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
import Foundation
import InfomaniakCore
import OSLog
import STCore
import SwiftUI
import SwissTransferCore

Expand All @@ -43,7 +44,7 @@ enum TmpDirType: String {

@MainActor
class NewTransferManager: ObservableObject {
@Published var transferType: TransferType = .qrcode
@Published var transferType: TransferType = .qrCode

init() {
cleanTmpDir(type: .upload)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ struct NewTransferSettingsView: View {
NewTransferSettingCell(
title: STResourcesStrings.Localizable.settingsOptionDownloadLimit,
icon: STResourcesAsset.Images.fileDownload.swiftUIImage,
value: limit.value
value: limit.title
) {
isShowingDownloadLimitSetting = true
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,9 @@
*/

import InfomaniakCoreSwiftUI
import STCore
import STResources
import SwiftUI
import SwissTransferCore

struct NewTransferTypeView: View {
@EnvironmentObject private var newTransferManager: NewTransferManager
Expand All @@ -33,7 +33,7 @@ struct NewTransferTypeView: View {

ScrollView(.horizontal) {
HStack {
ForEach(TransferType.allCases, id: \.rawValue) { type in
ForEach(TransferType.allCases, id: \.name) { type in
Button {
withAnimation(.easeIn(duration: 0.1)) {
newTransferManager.transferType = type
Expand Down
6 changes: 3 additions & 3 deletions SwissTransferFeatures/NewTransferView/NewTransferView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ public struct NewTransferView: View {
.stNavigationBarNewTransfer(title: STResourcesStrings.Localizable.importFilesScreenTitle)
.stNavigationBarStyle()
.navigationDestination(for: NewUploadSession.self) { newUploadSession in
RootUploadProgressView(transferType: .qrcode, uploadSession: newUploadSession, dismiss: dismiss.callAsFunction)
RootUploadProgressView(transferType: .qrCode, uploadSession: newUploadSession, dismiss: dismiss.callAsFunction)
}
.navigationDestination(for: DisplayableFile.self) { file in
FileListView(parentFolder: file)
Expand All @@ -100,11 +100,11 @@ public struct NewTransferView: View {
do {
let filesToUpload = try newTransferManager.filesToUpload()
let newUploadSession = NewUploadSession(
duration: "30",
duration: ValidityPeriod.thirty,
authorEmail: "",
password: "",
message: "",
numberOfDownload: 250,
numberOfDownload: DownloadLimit.twoHundredFifty,
language: .english,
recipientsEmails: [],
files: filesToUpload
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@
*/

import InfomaniakCoreSwiftUI
import STCore
import SwiftUI
import SwissTransferCore
import SwissTransferCoreUI

struct TransferTypeCell: View {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ import SwissTransferCore

struct DateSection: Identifiable, Equatable {
static func == (lhs: DateSection, rhs: DateSection) -> Bool {
lhs.id == rhs.id && lhs.title == rhs.title // && lhs.transfers == rhs.transfers
lhs.id == rhs.id && lhs.title == rhs.title && lhs.transfers == rhs.transfers
}

let id: String
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,17 +60,5 @@ public struct RootUploadProgressView: View {
}

#Preview {
RootUploadProgressView(
transferType: .qrcode,
uploadSession: NewUploadSession(
duration: "30",
authorEmail: "",
password: "",
message: "Coucou",
numberOfDownload: 250,
language: .english,
recipientsEmails: [],
files: []
)
) {}
RootUploadProgressView(transferType: .qrCode, uploadSession: PreviewHelper.sampleNewUploadSession) {}
}
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ struct SuccessfulLinkTransferView: View {
.frame(width: Self.qrCodeSize, height: Self.qrCodeSize)
}

if type != .qrcode {
if type != .qrCode {
Text(STResourcesStrings.Localizable.uploadSuccessLinkDescription)
.font(.ST.body)
.foregroundStyle(Color.ST.textSecondary)
Expand Down Expand Up @@ -99,7 +99,7 @@ struct SuccessfulLinkTransferView: View {
}

#Preview("QR Code") {
SuccessfulLinkTransferView(type: .qrcode, transferUUID: PreviewHelper.sampleTransfer.uuid)
SuccessfulLinkTransferView(type: .qrCode, transferUUID: PreviewHelper.sampleTransfer.uuid)
}

#Preview("Link") {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,9 @@
*/

import InfomaniakCoreSwiftUI
import STCore
import STResources
import SwiftUI
import SwissTransferCore
import SwissTransferCoreUI

struct SuccessfulMailTransferView: View {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ extension TransferType {
switch self {
case .link:
return STResourcesStrings.Localizable.uploadSuccessLinkTitle
case .qrcode, .proximity:
case .qrCode, .proximity:
return STResourcesStrings.Localizable.uploadSuccessQrTitle
case .mail:
return STResourcesStrings.Localizable.uploadSuccessEmailTitle
Expand All @@ -43,7 +43,7 @@ public struct SuccessfulTransferView: View {
public var body: some View {
Group {
switch type {
case .link, .qrcode, .proximity:
case .link, .qrCode, .proximity:
SuccessfulLinkTransferView(type: type, transferUUID: transferUUID)
case .mail:
SuccessfulMailTransferView(recipients: recipientsEmails)
Expand All @@ -60,7 +60,7 @@ public struct SuccessfulTransferView: View {
}

#Preview("QR Code") {
SuccessfulTransferView(type: .qrcode, transferUUID: PreviewHelper.sampleTransfer.uuid, recipientsEmails: [])
SuccessfulTransferView(type: .qrCode, transferUUID: PreviewHelper.sampleTransfer.uuid, recipientsEmails: [])
}

#Preview("Link") {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,11 +69,6 @@ struct UploadProgressView: View {
@Sendable private func startUpload() async {
do {
let transferUUID = try await transferSessionManager.startUpload(session: uploadSession)

// FIXME: Remove next two lines waiting for virus check
try await Task.sleep(for: .seconds(2))
try await transferManager.addTransferByLinkUUID(linkUUID: transferUUID)

withAnimation {
self.transferUUID = transferUUID
}
Expand All @@ -94,7 +89,7 @@ struct UploadProgressView: View {
UploadProgressView(
transferUUID: .constant(nil),
error: .constant(nil),
transferType: .qrcode,
transferType: .qrCode,
uploadSession: PreviewHelper.sampleNewUploadSession
)
}
12 changes: 6 additions & 6 deletions Tuist/Package.resolved
Original file line number Diff line number Diff line change
Expand Up @@ -23,17 +23,17 @@
"kind" : "remoteSourceControl",
"location" : "https://github.com/Infomaniak/ios-core",
"state" : {
"revision" : "830b0d383b443196b2e9ad1dcec2089a694523e0",
"version" : "12.5.1"
"revision" : "57997b754ed76d1ec912d44d21014da64ceb19f5",
"version" : "12.5.2"
}
},
{
"identity" : "ios-core-ui",
"kind" : "remoteSourceControl",
"location" : "https://github.com/Infomaniak/ios-core-ui",
"state" : {
"revision" : "95265cad8e0fcb09268573c22e0098eac8ce7451",
"version" : "14.0.0"
"revision" : "ebb347ef1ea69e595179ba7162da6be925dbea98",
"version" : "14.0.1"
}
},
{
Expand Down Expand Up @@ -77,8 +77,8 @@
"kind" : "remoteSourceControl",
"location" : "https://github.com/Infomaniak/multiplatform-SwissTransfer",
"state" : {
"revision" : "bd4bf654bff4162b2832576ddc9fc9d652fcbf07",
"version" : "0.7.0"
"revision" : "1696a30f91a2b7e60620a3596cfdc11548e46003",
"version" : "0.8.2"
}
},
{
Expand Down
Loading