mirror of
https://github.com/leonboe1/QuickDrop.git
synced 2026-11-22 14:26:01 +00:00
Refactoring
This commit is contained in:
1 parent
11afc232ab
commit
2b272c81c1
6 files changed
+12
-12
No files matched your search
@@ -110,11 +110,11 @@ extension String {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public func isPlusVersion() -> Bool {
|
public func fullVersion() -> Bool {
|
||||||
|
|
||||||
#if os(macOS)
|
#if os(macOS)
|
||||||
// Enable full functionality if app distributed directly
|
// Enable full functionality if app distributed directly
|
||||||
return DistributionDetector.isDirectDistributionEnabled || Settings.shared.isPlusVersion
|
return Settings.shared.gotPlus || DistributionDetector.isDirectDistributionEnabled
|
||||||
#else
|
#else
|
||||||
// iOS
|
// iOS
|
||||||
return true
|
return true
|
||||||
@@ -123,5 +123,5 @@ public func isPlusVersion() -> Bool {
|
|||||||
|
|
||||||
|
|
||||||
public func isFileTransferRestricted() -> Bool {
|
public func isFileTransferRestricted() -> Bool {
|
||||||
(!isPlusVersion() && Settings.shared.incomingTransmissionCount > 1)
|
(!fullVersion() && Settings.shared.incomingTransmissionCount > 1)
|
||||||
}
|
}
|
||||||
@@ -59,7 +59,7 @@ public class SaveFilesManager {
|
|||||||
|
|
||||||
public func movePendingFilesToTarget() {
|
public func movePendingFilesToTarget() {
|
||||||
|
|
||||||
if isPlusVersion() {
|
if fullVersion() {
|
||||||
do {
|
do {
|
||||||
let fileManager = FileManager.default
|
let fileManager = FileManager.default
|
||||||
let files = try fileManager.contentsOfDirectory(at: tempDirectory, includingPropertiesForKeys: nil)
|
let files = try fileManager.contentsOfDirectory(at: tempDirectory, includingPropertiesForKeys: nil)
|
||||||
|
|||||||
@@ -84,9 +84,9 @@ class AppDelegate: NSObject, NSApplicationDelegate, UNUserNotificationCenterDele
|
|||||||
// user installed the app before the IAP was implemented, grant the plus version
|
// user installed the app before the IAP was implemented, grant the plus version
|
||||||
if !Settings.shared.isEligibleForIap {
|
if !Settings.shared.isEligibleForIap {
|
||||||
log("[AppDelegate] Granting QuickDrop+ for old user")
|
log("[AppDelegate] Granting QuickDrop+ for old user")
|
||||||
Settings.shared.isPlusVersion = true
|
Settings.shared.gotPlus = true
|
||||||
} else {
|
} else {
|
||||||
if !isPlusVersion() {
|
if !fullVersion() {
|
||||||
log("[AppDelegate] New user - QuickDrop+ not available")
|
log("[AppDelegate] New user - QuickDrop+ not available")
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
|||||||
@@ -115,7 +115,7 @@ struct PlusView: View {
|
|||||||
if success {
|
if success {
|
||||||
log("[LUI] Restored purchases successfully")
|
log("[LUI] Restored purchases successfully")
|
||||||
withAnimation {
|
withAnimation {
|
||||||
settings.isPlusVersion = true
|
settings.gotPlus = true
|
||||||
}
|
}
|
||||||
boughtSuccessAlert = true
|
boughtSuccessAlert = true
|
||||||
} else {
|
} else {
|
||||||
@@ -146,7 +146,7 @@ struct PlusView: View {
|
|||||||
|
|
||||||
if success {
|
if success {
|
||||||
withAnimation {
|
withAnimation {
|
||||||
settings.isPlusVersion = true
|
settings.gotPlus = true
|
||||||
}
|
}
|
||||||
|
|
||||||
boughtSuccessAlert = true
|
boughtSuccessAlert = true
|
||||||
@@ -193,7 +193,7 @@ struct PlusView: View {
|
|||||||
case .success(_):
|
case .success(_):
|
||||||
|
|
||||||
withAnimation {
|
withAnimation {
|
||||||
settings.isPlusVersion = true
|
settings.gotPlus = true
|
||||||
boughtSuccessAlert = true
|
boughtSuccessAlert = true
|
||||||
warning = false
|
warning = false
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -16,8 +16,8 @@ class Settings: ObservableObject {
|
|||||||
|
|
||||||
// MARK: - Published UserDefaults Backed Properties
|
// MARK: - Published UserDefaults Backed Properties
|
||||||
|
|
||||||
@Published var isPlusVersion = UserDefaults.standard.bool(forKey: UserDefaultsKeys.plusVersion.rawValue)
|
@Published var gotPlus = UserDefaults.standard.bool(forKey: UserDefaultsKeys.plusVersion.rawValue)
|
||||||
{ didSet { UserDefaults.standard.set(isPlusVersion, forKey: UserDefaultsKeys.plusVersion.rawValue) }}
|
{ didSet { UserDefaults.standard.set(gotPlus, forKey: UserDefaultsKeys.plusVersion.rawValue) }}
|
||||||
|
|
||||||
|
|
||||||
@Published var automaticallyAcceptFiles: Bool = UserDefaults.standard.bool(forKey: UserDefaultsKeys.automaticallyAcceptFiles.rawValue)
|
@Published var automaticallyAcceptFiles: Bool = UserDefaults.standard.bool(forKey: UserDefaultsKeys.automaticallyAcceptFiles.rawValue)
|
||||||
|
|||||||
@@ -40,7 +40,7 @@ struct TutorialView: View {
|
|||||||
}
|
}
|
||||||
.buttonStyle(.plain)
|
.buttonStyle(.plain)
|
||||||
|
|
||||||
if !settings.isPlusVersion {
|
if !settings.gotPlus {
|
||||||
Button {
|
Button {
|
||||||
openPlus()
|
openPlus()
|
||||||
} label: {
|
} label: {
|
||||||
|
|||||||
Reference in new issue
Block a user