mirror of
https://github.com/leonboe1/QuickDrop.git
synced 2026-11-11 02:51:11 +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)
|
||||
// Enable full functionality if app distributed directly
|
||||
return DistributionDetector.isDirectDistributionEnabled || Settings.shared.isPlusVersion
|
||||
return Settings.shared.gotPlus || DistributionDetector.isDirectDistributionEnabled
|
||||
#else
|
||||
// iOS
|
||||
return true
|
||||
@@ -123,5 +123,5 @@ public func isPlusVersion() -> 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() {
|
||||
|
||||
if isPlusVersion() {
|
||||
if fullVersion() {
|
||||
do {
|
||||
let fileManager = FileManager.default
|
||||
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
|
||||
if !Settings.shared.isEligibleForIap {
|
||||
log("[AppDelegate] Granting QuickDrop+ for old user")
|
||||
Settings.shared.isPlusVersion = true
|
||||
Settings.shared.gotPlus = true
|
||||
} else {
|
||||
if !isPlusVersion() {
|
||||
if !fullVersion() {
|
||||
log("[AppDelegate] New user - QuickDrop+ not available")
|
||||
}
|
||||
else {
|
||||
|
||||
@@ -115,7 +115,7 @@ struct PlusView: View {
|
||||
if success {
|
||||
log("[LUI] Restored purchases successfully")
|
||||
withAnimation {
|
||||
settings.isPlusVersion = true
|
||||
settings.gotPlus = true
|
||||
}
|
||||
boughtSuccessAlert = true
|
||||
} else {
|
||||
@@ -146,7 +146,7 @@ struct PlusView: View {
|
||||
|
||||
if success {
|
||||
withAnimation {
|
||||
settings.isPlusVersion = true
|
||||
settings.gotPlus = true
|
||||
}
|
||||
|
||||
boughtSuccessAlert = true
|
||||
@@ -193,7 +193,7 @@ struct PlusView: View {
|
||||
case .success(_):
|
||||
|
||||
withAnimation {
|
||||
settings.isPlusVersion = true
|
||||
settings.gotPlus = true
|
||||
boughtSuccessAlert = true
|
||||
warning = false
|
||||
}
|
||||
|
||||
@@ -16,8 +16,8 @@ class Settings: ObservableObject {
|
||||
|
||||
// MARK: - Published UserDefaults Backed Properties
|
||||
|
||||
@Published var isPlusVersion = UserDefaults.standard.bool(forKey: UserDefaultsKeys.plusVersion.rawValue)
|
||||
{ didSet { UserDefaults.standard.set(isPlusVersion, forKey: UserDefaultsKeys.plusVersion.rawValue) }}
|
||||
@Published var gotPlus = UserDefaults.standard.bool(forKey: UserDefaultsKeys.plusVersion.rawValue)
|
||||
{ didSet { UserDefaults.standard.set(gotPlus, forKey: UserDefaultsKeys.plusVersion.rawValue) }}
|
||||
|
||||
|
||||
@Published var automaticallyAcceptFiles: Bool = UserDefaults.standard.bool(forKey: UserDefaultsKeys.automaticallyAcceptFiles.rawValue)
|
||||
|
||||
@@ -40,7 +40,7 @@ struct TutorialView: View {
|
||||
}
|
||||
.buttonStyle(.plain)
|
||||
|
||||
if !settings.isPlusVersion {
|
||||
if !settings.gotPlus {
|
||||
Button {
|
||||
openPlus()
|
||||
} label: {
|
||||
|
||||
Reference in new issue
Block a user