Skip to content

Commit 8ecadf1

Browse files
committed
Improved Localizes for subs
1 parent 3d20d3d commit 8ecadf1

12 files changed

Lines changed: 62 additions & 14 deletions

File tree

nightguard WatchKit App/Info.plist

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
<key>CFBundleSignature</key>
2222
<string>????</string>
2323
<key>CFBundleVersion</key>
24-
<string>962</string>
24+
<string>964</string>
2525
<key>NSAppTransportSecurity</key>
2626
<dict>
2727
<key>NSAllowsArbitraryLoads</key>

nightguard Widget Extension/NightguardTimelineProvider.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ struct NightguardTimelineProvider: TimelineProvider {
3333

3434
var entries: [NightscoutDataEntry] = []
3535
entries.append(nightscoutDataEntry)
36-
// ask for a refresh after 5 Minutes:
36+
// ask for a refresh after 10 Minutes:
3737
completion(Timeline(entries: entries, policy:
3838
.after(Calendar.current.date(byAdding: .minute, value: 10, to: Date()) ?? Date())))
3939
}

nightguard.xcodeproj/project.pbxproj

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2152,7 +2152,7 @@
21522152
CODE_SIGN_ENTITLEMENTS = "nightguard WatchKit App/nightguard.entitlements";
21532153
CODE_SIGN_IDENTITY = "iPhone Developer";
21542154
CODE_SIGN_STYLE = Automatic;
2155-
CURRENT_PROJECT_VERSION = 962;
2155+
CURRENT_PROJECT_VERSION = 964;
21562156
DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
21572157
INFOPLIST_FILE = "nightguard WatchKit App/Info.plist";
21582158
LD_RUNPATH_SEARCH_PATHS = (
@@ -2182,7 +2182,7 @@
21822182
CODE_SIGN_ENTITLEMENTS = "nightguard WatchKit App/nightguard.entitlements";
21832183
CODE_SIGN_IDENTITY = "iPhone Developer";
21842184
CODE_SIGN_STYLE = Automatic;
2185-
CURRENT_PROJECT_VERSION = 962;
2185+
CURRENT_PROJECT_VERSION = 964;
21862186
DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
21872187
INFOPLIST_FILE = "nightguard WatchKit App/Info.plist";
21882188
LD_RUNPATH_SEARCH_PATHS = (
@@ -2209,7 +2209,7 @@
22092209
CODE_SIGN_ENTITLEMENTS = nightguard/scoutwatch.entitlements;
22102210
CODE_SIGN_IDENTITY = "iPhone Developer";
22112211
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
2212-
CURRENT_PROJECT_VERSION = 962;
2212+
CURRENT_PROJECT_VERSION = 964;
22132213
DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
22142214
ENABLE_BITCODE = NO;
22152215
EXCLUDED_ARCHS = "";
@@ -2238,7 +2238,7 @@
22382238
CODE_SIGN_ENTITLEMENTS = nightguard/scoutwatch.entitlements;
22392239
CODE_SIGN_IDENTITY = "iPhone Developer";
22402240
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
2241-
CURRENT_PROJECT_VERSION = 962;
2241+
CURRENT_PROJECT_VERSION = 964;
22422242
DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
22432243
ENABLE_BITCODE = NO;
22442244
INFOPLIST_FILE = nightguard/Info.plist;
@@ -2351,7 +2351,7 @@
23512351
CODE_SIGN_IDENTITY = "iPhone Developer";
23522352
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
23532353
CODE_SIGN_STYLE = Automatic;
2354-
CURRENT_PROJECT_VERSION = 962;
2354+
CURRENT_PROJECT_VERSION = 964;
23552355
GCC_C_LANGUAGE_STANDARD = gnu11;
23562356
GENERATE_INFOPLIST_FILE = YES;
23572357
INFOPLIST_FILE = "nightguard Widget Extension/Info.plist";
@@ -2391,7 +2391,7 @@
23912391
CODE_SIGN_IDENTITY = "iPhone Developer";
23922392
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
23932393
CODE_SIGN_STYLE = Automatic;
2394-
CURRENT_PROJECT_VERSION = 962;
2394+
CURRENT_PROJECT_VERSION = 964;
23952395
GCC_C_LANGUAGE_STANDARD = gnu11;
23962396
GENERATE_INFOPLIST_FILE = YES;
23972397
INFOPLIST_FILE = "nightguard Widget Extension/Info.plist";
@@ -2428,7 +2428,7 @@
24282428
CODE_SIGN_ENTITLEMENTS = "nightguard ComplicationExtension.entitlements";
24292429
CODE_SIGN_IDENTITY = "Apple Development";
24302430
CODE_SIGN_STYLE = Automatic;
2431-
CURRENT_PROJECT_VERSION = 962;
2431+
CURRENT_PROJECT_VERSION = 964;
24322432
GCC_C_LANGUAGE_STANDARD = gnu11;
24332433
GENERATE_INFOPLIST_FILE = YES;
24342434
INFOPLIST_FILE = "nightguard Complication/Info.plist";
@@ -2470,7 +2470,7 @@
24702470
CODE_SIGN_ENTITLEMENTS = "nightguard ComplicationExtension.entitlements";
24712471
CODE_SIGN_IDENTITY = "Apple Development";
24722472
CODE_SIGN_STYLE = Automatic;
2473-
CURRENT_PROJECT_VERSION = 962;
2473+
CURRENT_PROJECT_VERSION = 964;
24742474
GCC_C_LANGUAGE_STANDARD = gnu11;
24752475
GENERATE_INFOPLIST_FILE = YES;
24762476
INFOPLIST_FILE = "nightguard Complication/Info.plist";

nightguard/AppDelegate.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -138,7 +138,7 @@ class AppDelegate: UIResponder, UIApplicationDelegate {
138138
func scheduleBackgroundProcessing() {
139139
let request = BGProcessingTaskRequest(identifier: appProcessingTaskId)
140140
request.requiresNetworkConnectivity = true
141-
request.earliestBeginDate = Date(timeIntervalSinceNow: 15 * 60)
141+
request.earliestBeginDate = Date(timeIntervalSinceNow: 10 * 60)
142142

143143
do {
144144
BGTaskScheduler.shared.cancelAllTaskRequests()

nightguard/Info.plist

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525
<key>CFBundleSignature</key>
2626
<string>????</string>
2727
<key>CFBundleVersion</key>
28-
<string>962</string>
28+
<string>964</string>
2929
<key>ITSAppUsesNonExemptEncryption</key>
3030
<false/>
3131
<key>LSApplicationCategoryType</key>

nightguard/app/PurchaseManager.swift

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,11 @@ class PurchaseManager: NSObject, ObservableObject {
4343
@Published var isProAccessAvailable: Bool = false
4444
@Published var products: [SKProduct] = []
4545

46+
@Published var restoreAlertMessage: String?
47+
@Published var showingRestoreAlert = false
48+
49+
private var isRestoring = false
50+
4651
private override init() {
4752
super.init()
4853
SKPaymentQueue.default().add(self)
@@ -71,6 +76,7 @@ class PurchaseManager: NSObject, ObservableObject {
7176
}
7277

7378
func restorePurchases() {
79+
isRestoring = true
7480
SKPaymentQueue.default().restoreCompletedTransactions()
7581
}
7682

@@ -87,6 +93,17 @@ class PurchaseManager: NSObject, ObservableObject {
8793
// AlarmNotificationService.singleton.cancelAgeNotifications()
8894
}
8995
}
96+
97+
if self.isRestoring {
98+
self.isRestoring = false
99+
if !active {
100+
self.restoreAlertMessage = NSLocalizedString("No active subscription found to restore.", comment: "Restore error message")
101+
self.showingRestoreAlert = true
102+
} else {
103+
self.restoreAlertMessage = NSLocalizedString("Purchases restored successfully.", comment: "Restore success message")
104+
self.showingRestoreAlert = true
105+
}
106+
}
90107
}
91108
}
92109

@@ -233,5 +250,12 @@ extension PurchaseManager: SKPaymentTransactionObserver {
233250

234251
func paymentQueue(_ queue: SKPaymentQueue, restoreCompletedTransactionsFailedWithError error: Error) {
235252
print("Restore failed: \(error.localizedDescription)")
253+
if isRestoring {
254+
isRestoring = false
255+
DispatchQueue.main.async {
256+
self.restoreAlertMessage = String(format: NSLocalizedString("Restore failed: %@", comment: "Restore failed error"), error.localizedDescription)
257+
self.showingRestoreAlert = true
258+
}
259+
}
236260
}
237261
}

nightguard/resources/Base.lproj/Localizable.strings

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -655,3 +655,9 @@
655655
"Save & Start" = "Save & Start";
656656
"Enter later" = "Enter later";
657657
"Skip" = "Skip";
658+
659+
/* New strings */
660+
"Manage Subscription" = "Manage Subscription";
661+
"No active subscription found to restore." = "No active subscription found to restore.";
662+
"Purchases restored successfully." = "Purchases restored successfully.";
663+
"Restore failed: %@" = "Restore failed: %@";

nightguard/resources/de.lproj/Localizable.strings

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -715,3 +715,9 @@ Damit diese funktionieren, müssen Nightguard Widgets auf dem Lock-Screen platzi
715715
"Save & Start" = "Speichern & Starten";
716716
"Enter later" = "Später eingeben";
717717
"Skip" = "Überspringen";
718+
719+
/* New strings */
720+
"Manage Subscription" = "Abo verwalten";
721+
"No active subscription found to restore." = "Kein aktives Abonnement zum Wiederherstellen gefunden.";
722+
"Purchases restored successfully." = "Käufe erfolgreich wiederhergestellt.";
723+
"Restore failed: %@" = "Wiederherstellung fehlgeschlagen: %@";

nightguard/resources/fi-FI.lproj/Localizable.strings

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -777,3 +777,9 @@
777777
"Save & Start" = "Tallenna ja aloita";
778778
"Enter later" = "Syötä myöhemmin";
779779
"Skip" = "Ohita";
780+
781+
/* New strings */
782+
"Manage Subscription" = "Hallitse tilausta";
783+
"No active subscription found to restore." = "Aktiivista tilausta ei löytynyt palautettavaksi.";
784+
"Purchases restored successfully." = "Ostot palautettu onnistuneesti.";
785+
"Restore failed: %@" = "Palautus epäonnistui: %@";

nightguard/views/prefs/ProFeaturesSectionView.swift

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ struct ProFeaturesSectionView: View {
3131
.foregroundColor(.green)
3232
Text(NSLocalizedString("Pro Version Unlocked", comment: "Pro Version Unlocked Text"))
3333
}
34+
Link(NSLocalizedString("Manage Subscription", comment: "Link to manage subscription"), destination: URL(string: "https://apps.apple.com/account/subscriptions")!)
3435
} else {
3536
Button(action: {
3637
showProPromotion = true
@@ -44,6 +45,11 @@ struct ProFeaturesSectionView: View {
4445
}
4546
}
4647
}
48+
.alert(NSLocalizedString("Restore Purchases", comment: "Restore Purchases Alert Title"), isPresented: $purchaseManager.showingRestoreAlert) {
49+
Button("OK", role: .cancel) { }
50+
} message: {
51+
Text(purchaseManager.restoreAlertMessage ?? "")
52+
}
4753
}
4854
}
4955

0 commit comments

Comments
 (0)