blob: de63bfdfd469b6b1e4752c2adb1af36f903fd8b5 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
|
//
// RESTCreateApplePaymentResponse.swift
// MullvadVPN
//
// Created by Andreas Lif on 2022-08-04.
// Copyright © 2025 Mullvad VPN AB. All rights reserved.
//
import MullvadREST
extension REST.CreateApplePaymentResponse {
enum Context {
case purchase
case restoration
}
func alertTitle(context: Context) -> String {
switch context {
case .purchase:
return NSLocalizedString("Thanks for your purchase", comment: "")
case .restoration:
return NSLocalizedString("Restore purchases", comment: "")
}
}
func alertMessage(context: Context) -> String {
switch context {
case .purchase:
return String(
format: NSLocalizedString("%@ was added to your account.", comment: ""),
formattedTimeAdded ?? ""
)
case .restoration:
switch self {
case .noTimeAdded:
return NSLocalizedString(
"Your previous purchases have already been added to this account.",
comment: ""
)
case .timeAdded:
return String(
format: NSLocalizedString("%@ was added to your account.", comment: ""),
formattedTimeAdded ?? ""
)
}
}
}
}
extension REST.CreateApplePaymentResponse.Context {
var errorTitle: String {
switch self {
case .purchase:
return NSLocalizedString("Cannot complete the purchase", comment: "")
case .restoration:
return NSLocalizedString("Cannot restore purchases", comment: "")
}
}
}
|