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