Skip to content

Commit 34a4250

Browse files
committed
fix: address PR review — extract pricing URL constant, add access control, log errors
1 parent b73d46f commit 34a4250

4 files changed

Lines changed: 130 additions & 7 deletions

File tree

TablePro/Models/Settings/License.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,7 @@ struct LicenseAPIErrorResponse: Codable {
132132
}
133133

134134
/// Information about a single license activation (machine)
135-
struct LicenseActivationInfo: Codable, Identifiable {
135+
internal struct LicenseActivationInfo: Codable, Identifiable {
136136
var id: String { machineId }
137137
let machineId: String
138138
let machineName: String
@@ -152,7 +152,7 @@ struct LicenseActivationInfo: Codable, Identifiable {
152152
}
153153

154154
/// Response from the list activations endpoint
155-
struct ListActivationsResponse: Codable {
155+
internal struct ListActivationsResponse: Codable {
156156
let activations: [LicenseActivationInfo]
157157
let maxActivations: Int
158158

TablePro/Resources/Localizable.xcstrings

Lines changed: 116 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -303,6 +303,9 @@
303303
}
304304
}
305305
}
306+
},
307+
"(this Mac)" : {
308+
306309
},
307310
"/path/to/agent.sock" : {
308311
"localizations" : {
@@ -371,6 +374,16 @@
371374
}
372375
}
373376
},
377+
"%@ (%@@%@)" : {
378+
"localizations" : {
379+
"en" : {
380+
"stringUnit" : {
381+
"state" : "new",
382+
"value" : "%1$@ (%2$@@%3$@)"
383+
}
384+
}
385+
}
386+
},
374387
"%@ (%lld/%lld)" : {
375388
"localizations" : {
376389
"en" : {
@@ -901,6 +914,9 @@
901914
}
902915
}
903916
}
917+
},
918+
"%lld connection(s) use this profile. They will fall back to no SSH tunnel." : {
919+
904920
},
905921
"%lld in · %lld out" : {
906922
"localizations" : {
@@ -2375,6 +2391,16 @@
23752391
}
23762392
}
23772393
},
2394+
"Activations (%lld of %lld)" : {
2395+
"localizations" : {
2396+
"en" : {
2397+
"stringUnit" : {
2398+
"state" : "new",
2399+
"value" : "Activations (%1$lld of %2$lld)"
2400+
}
2401+
}
2402+
}
2403+
},
23782404
"Active" : {
23792405
"localizations" : {
23802406
"tr" : {
@@ -3699,6 +3725,9 @@
36993725
}
37003726
}
37013727
}
3728+
},
3729+
"Auth Method" : {
3730+
37023731
},
37033732
"Authenticate to execute database operations" : {
37043733
"localizations" : {
@@ -4159,6 +4188,9 @@
41594188
}
41604189
}
41614190
}
4191+
},
4192+
"Billing:" : {
4193+
41624194
},
41634195
"Blue" : {
41644196
"localizations" : {
@@ -4774,6 +4806,9 @@
47744806
}
47754807
}
47764808
}
4809+
},
4810+
"Check Status" : {
4811+
47774812
},
47784813
"Choose a query from the list\nto see its full content here." : {
47794814
"localizations" : {
@@ -5893,6 +5928,9 @@
58935928
}
58945929
}
58955930
}
5931+
},
5932+
"Connect to the internet to verify your license." : {
5933+
58965934
},
58975935
"Connected" : {
58985936
"localizations" : {
@@ -7007,6 +7045,9 @@
70077045
}
70087046
}
70097047
}
7048+
},
7049+
"Create New Profile..." : {
7050+
70107051
},
70117052
"Create New Tag" : {
70127053
"localizations" : {
@@ -8587,6 +8628,12 @@
85878628
}
85888629
}
85898630
}
8631+
},
8632+
"Delete Profile" : {
8633+
8634+
},
8635+
"Delete SSH Profile?" : {
8636+
85908637
},
85918638
"Delete Theme" : {
85928639
"localizations" : {
@@ -9369,6 +9416,9 @@
93699416
}
93709417
}
93719418
}
9419+
},
9420+
"Edit Profile..." : {
9421+
93729422
},
93739423
"Edit Provider" : {
93749424
"localizations" : {
@@ -10239,6 +10289,9 @@
1023910289
}
1024010290
}
1024110291
}
10292+
},
10293+
"Expires:" : {
10294+
1024210295
},
1024310296
"Explain" : {
1024410297
"localizations" : {
@@ -13294,6 +13347,9 @@
1329413347
}
1329513348
}
1329613349
}
13350+
},
13351+
"Inline Configuration" : {
13352+
1329713353
},
1329813354
"Inline Suggestions" : {
1329913355
"localizations" : {
@@ -14549,6 +14605,9 @@
1454914605
}
1455014606
}
1455114607
}
14608+
},
14609+
"License expires in %lld day(s)" : {
14610+
1455214611
},
1455314612
"License Key:" : {
1455414613
"localizations" : {
@@ -14571,6 +14630,12 @@
1457114630
}
1457214631
}
1457314632
}
14633+
},
14634+
"License validation failed" : {
14635+
14636+
},
14637+
"Lifetime" : {
14638+
1457414639
},
1457514640
"Light" : {
1457614641
"localizations" : {
@@ -15516,6 +15581,9 @@
1551615581
}
1551715582
}
1551815583
}
15584+
},
15585+
"My Server" : {
15586+
1551915587
},
1552015588
"Name" : {
1552115589
"localizations" : {
@@ -16084,6 +16152,9 @@
1608416152
}
1608516153
}
1608616154
}
16155+
},
16156+
"No activations found" : {
16157+
1608716158
},
1608816159
"No active connection" : {
1608916160
"localizations" : {
@@ -19737,6 +19808,12 @@
1973719808
}
1973819809
}
1973919810
}
19811+
},
19812+
"Profile" : {
19813+
19814+
},
19815+
"Profile Settings" : {
19816+
1974019817
},
1974119818
"Prompt at Connect" : {
1974219819
"localizations" : {
@@ -19804,6 +19881,9 @@
1980419881
}
1980519882
}
1980619883
}
19884+
},
19885+
"Purchase License" : {
19886+
1980719887
},
1980819888
"Purple" : {
1980919889
"localizations" : {
@@ -20739,6 +20819,9 @@
2073920819
}
2074020820
}
2074120821
}
20822+
},
20823+
"Refresh license status from server" : {
20824+
2074220825
},
2074320826
"Refreshing will discard all unsaved changes." : {
2074420827
"localizations" : {
@@ -20903,6 +20986,12 @@
2090320986
}
2090420987
}
2090520988
}
20989+
},
20990+
"Renew" : {
20991+
20992+
},
20993+
"Renew License" : {
20994+
2090620995
},
2090720996
"Renew License..." : {
2090820997
"localizations" : {
@@ -21143,6 +21232,9 @@
2114321232
}
2114421233
}
2114521234
}
21235+
},
21236+
"Retry Validation" : {
21237+
2114621238
},
2114721239
"Reuse clean table tab" : {
2114821240
"extractionState" : "stale",
@@ -21778,6 +21870,9 @@
2177821870
}
2177921871
}
2178021872
}
21873+
},
21874+
"Save Current as Profile..." : {
21875+
2178121876
},
2178221877
"Save Failed" : {
2178321878
"localizations" : {
@@ -22629,6 +22724,9 @@
2262922724
}
2263022725
}
2263122726
}
22727+
},
22728+
"Selected SSH profile no longer exists." : {
22729+
2263222730
},
2263322731
"Selection" : {
2263422732
"localizations" : {
@@ -23954,6 +24052,12 @@
2395424052
}
2395524053
}
2395624054
}
24055+
},
24056+
"SSH Profile" : {
24057+
24058+
},
24059+
"SSH Profiles:" : {
24060+
2395724061
},
2395824062
"SSH Tunnel" : {
2395924063
"extractionState" : "stale",
@@ -24335,6 +24439,9 @@
2433524439
}
2433624440
}
2433724441
}
24442+
},
24443+
"Status:" : {
24444+
2433824445
},
2433924446
"Stop" : {
2434024447
"localizations" : {
@@ -24634,6 +24741,9 @@
2463424741
}
2463524742
}
2463624743
}
24744+
},
24745+
"Switch to Inline Configuration" : {
24746+
2463724747
},
2463824748
"Sync" : {
2463924749
"localizations" : {
@@ -25671,6 +25781,9 @@
2567125781
}
2567225782
}
2567325783
}
25784+
},
25785+
"This profile will be permanently deleted." : {
25786+
2567425787
},
2567525788
"This query may permanently modify or delete data." : {
2567625789
"localizations" : {
@@ -25860,6 +25973,9 @@
2586025973
}
2586125974
}
2586225975
}
25976+
},
25977+
"Tier:" : {
25978+
2586325979
},
2586425980
"TIMESTAMPS" : {
2586525981
"localizations" : {

TablePro/Views/Components/ProFeatureGate.swift

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@ struct ProFeatureGateModifier: ViewModifier {
1212
let feature: ProFeature
1313

1414
private let licenseManager = LicenseManager.shared
15+
// swiftlint:disable:next force_unwrapping
16+
private static let pricingURL = URL(string: "https://tablepro.app/#pricing")!
1517

1618
func body(content: Content) -> some View {
1719
let available = licenseManager.isFeatureAvailable(feature)
@@ -51,7 +53,7 @@ struct ProFeatureGateModifier: ViewModifier {
5153
openLicenseSettings()
5254
}
5355
.buttonStyle(.borderedProminent)
54-
Link(String(localized: "Renew License"), destination: URL(string: "https://tablepro.app/pricing")!)
56+
Link(String(localized: "Renew License"), destination: Self.pricingURL)
5557
.font(.subheadline)
5658
case .validationFailed:
5759
Text("License validation failed")
@@ -73,7 +75,7 @@ struct ProFeatureGateModifier: ViewModifier {
7375
openLicenseSettings()
7476
}
7577
.buttonStyle(.borderedProminent)
76-
Link(String(localized: "Purchase License"), destination: URL(string: "https://tablepro.app/pricing")!)
78+
Link(String(localized: "Purchase License"), destination: Self.pricingURL)
7779
.font(.subheadline)
7880
}
7981
}

0 commit comments

Comments
 (0)