From 583a3776554f5a72f454ced06838cf479602f7e6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Leon=20B=C3=B6ttger?= Date: Sun, 12 Jan 2025 19:48:19 +0100 Subject: [PATCH] Only request review every 20 incoming shares --- NearDrop/AppDelegate.swift | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/NearDrop/AppDelegate.swift b/NearDrop/AppDelegate.swift index 3a52ac1..0a8878f 100644 --- a/NearDrop/AppDelegate.swift +++ b/NearDrop/AppDelegate.swift @@ -201,9 +201,15 @@ class AppDelegate: NSObject, NSApplicationDelegate, UNUserNotificationCenterDele UNUserNotificationCenter.current().removeDeliveredNotifications(withIdentifiers: ["transfer_"+id]) self.activeIncomingTransfers.removeValue(forKey: id) - DispatchQueue.main.asyncAfter(deadline: .now() + 2) { - SKStoreReviewController.requestReview() + let currentCount = UserDefaults.standard.integer(forKey: "reviewRequestCountKey") + + if currentCount % 20 == 0 { + DispatchQueue.main.asyncAfter(deadline: .now() + 2) { + SKStoreReviewController.requestReview() + } } + + UserDefaults.standard.set(currentCount + 1, forKey: "reviewRequestCountKey") } }