From 2a7ed34cb77f7eced0852b96290c1fde45ff6459 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Matthias=20Hu=CC=88hne?= Date: Thu, 26 Nov 2020 14:16:32 +0100 Subject: [PATCH 1/2] show the AppStore review request dialog in faster time interval --- ownCloudAppShared/Tools/VendorServices.swift | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/ownCloudAppShared/Tools/VendorServices.swift b/ownCloudAppShared/Tools/VendorServices.swift index f1fb38709..da5b1b4f7 100644 --- a/ownCloudAppShared/Tools/VendorServices.swift +++ b/ownCloudAppShared/Tools/VendorServices.swift @@ -260,14 +260,14 @@ public class VendorServices : NSObject { // Make sure there is at least one bookmark configured, to not bother users who have never configured any accounts guard OCBookmarkManager.shared.bookmarks.count > 0 else { return } - // Make sure at least 14 days have elapsed since the first launch of the app - guard AppStatistics.shared.timeIntervalSinceFirstLaunch.days >= 14 else { return } + // Make sure at least 7 days have elapsed since the first launch of the app + guard AppStatistics.shared.timeIntervalSinceFirstLaunch.days >= 7 else { return } // Make sure at least 7 days have elapsed since first launch of current version guard AppStatistics.shared.timeIntervalSinceUpdate.days >= 7 else { return } - // Make sure at least 230 have elapsed since last prompting - AppStatistics.shared.requestAppStoreReview(onceInDays: 230) + // Make sure at least 122 have elapsed since last prompting (Apple allows to show the dialog 3 times per 365 days) + AppStatistics.shared.requestAppStoreReview(onceInDays: 122) } } From 48cdc8af40a3e691c0a0e5342ed81b2812fe1c35 Mon Sep 17 00:00:00 2001 From: Felix Schwarz Date: Mon, 25 Jan 2021 14:08:46 +0100 Subject: [PATCH 2/2] - AppStatistics: fix overwrite of .launchDate with .updateDate and constant refresh of .updateDate because it was never saved, resulting in review prompts never appearing --- ownCloudAppShared/Tools/AppStatistics.swift | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/ownCloudAppShared/Tools/AppStatistics.swift b/ownCloudAppShared/Tools/AppStatistics.swift index 61932c6c0..5ef78240e 100644 --- a/ownCloudAppShared/Tools/AppStatistics.swift +++ b/ownCloudAppShared/Tools/AppStatistics.swift @@ -80,16 +80,16 @@ public class AppStatistics { } // Reset update launch date if current version is different compared to stored ones - if let lastVersion = userDefaults.object(forKey: UserDefaultsKeys.lastInstalledVersion.rawValue) as? String { - if lastVersion != appVersion { + if let lastInstalledVersion = userDefaults.object(forKey: UserDefaultsKeys.lastInstalledVersion.rawValue) as? String { + if lastInstalledVersion != appVersion { self.updateDate = Date() } } // Update user defaults except for review prompt time stamp updated separately - userDefaults.set(self.launchDate, forKey: UserDefaultsKeys.firstLaunchDate.rawValue) + userDefaults.set(self.launchDate, forKey: UserDefaultsKeys.firstLaunchDate.rawValue) + userDefaults.set(self.updateDate, forKey: UserDefaultsKeys.updateDate.rawValue) userDefaults.set(self.appVersion, forKey: UserDefaultsKeys.lastInstalledVersion.rawValue) - userDefaults.set(self.updateDate, forKey: UserDefaultsKeys.firstLaunchDate.rawValue) // Persist user defaults userDefaults.synchronize()