Refactoring

This commit is contained in:
Leon Böttger committed 2025-09-09 14:35:25 +02:00
1 parent fcc0ce0818
commit 6def7dbc9f
5 files changed
+24 -17

No files matched your search

+2 -2
View File
@@ -1221,7 +1221,7 @@
MTL_FAST_MATH = YES;
ONLY_ACTIVE_ARCH = YES;
SDKROOT = macosx;
SHARED_BUILD = 70;
SHARED_BUILD = 71;
SHARED_VERSION = 2.3;
SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG;
SWIFT_EMIT_LOC_STRINGS = YES;
@@ -1283,7 +1283,7 @@
MTL_ENABLE_DEBUG_INFO = NO;
MTL_FAST_MATH = YES;
SDKROOT = macosx;
SHARED_BUILD = 70;
SHARED_BUILD = 71;
SHARED_VERSION = 2.3;
SWIFT_COMPILATION_MODE = wholemodule;
SWIFT_EMIT_LOC_STRINGS = YES;
@@ -43,7 +43,7 @@
"location" : "https://github.com/leonboe1/LUI.git",
"state" : {
"branch" : "main",
"revision" : "23696658386572725bc8a8e38ad3675829185921"
"revision" : "85f746ee449d85a36722c3cafe9403525ef3a719"
}
},
{
+2
View File
@@ -10,6 +10,8 @@ import LUI
let configuration = LUIConfiguration(
appName: "QuickDrop",
inAppPurchaseName: "plusversion",
hasRoundedFont: false,
copyrightInformation: licenseText,
+5 -14
View File
@@ -12,6 +12,7 @@ import StoreKit
struct ContentView: View {
@ObservedObject var luiSettings = LUISettings.sharedInstance
@ObservedObject var settings = Settings.shared
var body: some View {
AppRootView(isPlus: .constant(true), phoneView: {
@@ -44,7 +45,6 @@ struct DeviceListView: View {
#endif
@Environment(\.scenePhase) var scenePhase
@AppStorage("requestedReview") private var requestedReview = false
@ObservedObject var nearbyConnectionManager = NearbyConnectionManager.shared
var body: some View {
@@ -156,23 +156,14 @@ struct DeviceListView: View {
if newValue == .active {
log("App became active")
log("[ScenePhase] App became active")
NearbyConnectionManager.shared.startDeviceDiscovery()
#if !EXTENSION
NearbyConnectionManager.shared.becomeVisible()
if Settings.shared.incomingTransmissionCount > 0 && !requestedReview {
if Settings.shared.incomingTransmissionCount > 0 {
runAfter(seconds: 0.3) {
if let scene = UIApplication.shared.connectedScenes.first(where: { $0.activationState == .foregroundActive }) as? UIWindowScene {
log("Requesting Review...")
SKStoreReviewController.requestReview(in: scene)
requestedReview = true
}
else {
log("Error Requesting Review!")
}
requestReviewOnce()
}
}
#endif
@@ -180,7 +171,7 @@ struct DeviceListView: View {
if newValue == .background {
log("App went to background")
log("[ScenePhase] App went to background")
#if !EXTENSION
NearbyConnectionManager.shared.becomeInvisible()
#endif
+14
View File
@@ -24,29 +24,34 @@ class SendModel: ObservableObject, OutboundAppDelegate {
private var connectionEstablished = false
private var timeoutDispatchWorkItem: DispatchWorkItem? = nil
init() {
NearbyConnectionManager.shared.startDeviceDiscovery()
NearbyConnectionManager.shared.addShareExtensionDelegate(self)
}
func addDevice(device: RemoteDeviceInfo) {
withAnimation(.smooth) {
foundDevices.append(device)
}
}
func removeDevice(id: String) {
withAnimation(.smooth) {
foundDevices.removeAll { $0.id == id }
}
}
func connectionWasEstablished(pinCode: String) {
connectionEstablished = true
progressState = String(format: "PinCode".localized(), arguments: [pinCode])
progressValue = 0
}
func connectionFailed(error: any Error) {
#if os(iOS)
@@ -59,14 +64,17 @@ class SendModel: ObservableObject, OutboundAppDelegate {
selectedDevice = nil
}
func transferAccepted() {
progressState = "Sending".localized()
}
func transferProgress(progress: Double) {
progressValue = progress
}
func transferFinished() {
#if os(iOS)
@@ -78,12 +86,18 @@ class SendModel: ObservableObject, OutboundAppDelegate {
progressState = "TransferFinished".localized()
NearbyConnectionManager.shared.attachments?.closeView?()
#if !EXTENSION
requestReviewOnce()
#endif
}
func startTransferWithQrCode(device: RemoteDeviceInfo) {
selectDevice(device: device)
}
func selectDevice(device: RemoteDeviceInfo) {
// already selected, cancel transfer