Skip to content

Commit 29051e7

Browse files
rm constant strings and use computed properties
1 parent 2c57d97 commit 29051e7

File tree

1 file changed

+12
-33
lines changed

1 file changed

+12
-33
lines changed

FirebaseSwiftUI/FirebaseAuthSwiftUI/Sources/Utils/StringUtils.swift

Lines changed: 12 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,6 @@
11
import FirebaseAuth
22
import SwiftUI
33

4-
// Auth Picker (not signed-in)
5-
let kAuthPickerTitle = "AuthPickerTitle"
6-
7-
// Used across multiple Views
8-
let kEnterYourEmail = "EnterYourEmail"
9-
let kEnterYourPassword = "EnterYourPassword"
10-
let kOK = "OK"
11-
let kBack = "Back"
12-
13-
// Signed-in
14-
let kSignedInTitle = "SignedIn"
15-
16-
let kForgotPasswordButtonLabel = "ForgotPasswordTitle"
17-
let kForgotPasswordInputLabel = "ForgotPassword"
18-
19-
// Password recovery
20-
let kPasswordRecoveryTitle = "PasswordRecoveryTitle"
21-
let kPasswordRecoveryEmailSentTitle = "PasswordRecoveryEmailSentTitle"
22-
let kPasswordRecoveryMessage = "PasswordRecoveryMessage"
23-
let kPasswordRecoveryEmailSentMessage = "PasswordRecoveryEmailSentMessage"
24-
254
let kKeyNotFound = "Key not found"
265

276
// Errors
@@ -84,84 +63,84 @@ public class StringUtils {
8463
/// found in:
8564
/// - AuthPickerView
8665
public var authPickerTitle: String {
87-
return localizedString(for: kAuthPickerTitle)
66+
return localizedString(for: "AuthPickerTitle")
8867
}
8968

9069
/// Email input label
9170
/// found in:
9271
/// - EmailAuthView
9372
/// - PasswordRecoveryView
9473
public var emailInputLabel: String {
95-
return localizedString(for: kEnterYourEmail)
74+
return localizedString(for: "EnterYourEmail")
9675
}
9776

9877
/// Password button action label
9978
/// found in:
10079
/// - EmailAuthView
10180
public var passwordButtonLabel: String {
102-
return localizedString(for: kForgotPasswordButtonLabel)
81+
return localizedString(for: "ForgotPasswordTitle")
10382
}
10483

10584
/// Password input label
10685
/// found in:
10786
/// - EmailAuthView
10887
public var passwordInputLabel: String {
109-
return localizedString(for: kEnterYourPassword)
88+
return localizedString(for: "EnterYourPassword")
11089
}
11190

11291
/// Password recovery title
11392
/// found in:
11493
/// - PasswordRecoveryView
11594
public var passwordRecoveryTitle: String {
116-
return localizedString(for: kPasswordRecoveryTitle)
95+
return localizedString(for: "PasswordRecoveryTitle")
11796
}
11897

11998
/// Password recovery email sent title
12099
/// found in:
121100
/// - PasswordRecoveryView
122101
public var passwordRecoveryEmailSentTitle: String {
123-
return localizedString(for: kPasswordRecoveryEmailSentTitle)
102+
return localizedString(for: "PasswordRecoveryEmailSentTitle")
124103
}
125104

126105
/// Password recovery helper message
127106
/// found in:
128107
/// - PasswordRecoveryView
129108
public var passwordRecoveryHelperMessage: String {
130-
return localizedString(for: kPasswordRecoveryMessage)
109+
return localizedString(for: "PasswordRecoveryMessage")
131110
}
132111

133112
/// Password recovery email sent message
134113
/// found in:
135114
/// - PasswordRecoveryView
136115
public var passwordRecoveryEmailSentMessage: String {
137-
return localizedString(for: kPasswordRecoveryEmailSentMessage)
116+
return localizedString(for: "PasswordRecoveryEmailSentMessage")
138117
}
139118

140119
/// Forgot password input label
141120
/// found in:
142121
/// - PasswordRecoveryView
143122
public var forgotPasswordInputLabel: String {
144-
return localizedString(for: kForgotPasswordInputLabel)
123+
return localizedString(for: "ForgotPassword")
145124
}
146125

147126
/// Signed in title
148127
/// found in:
149128
/// - SignedInView
150129
public var signedInTitle: String {
151-
return localizedString(for: kSignedInTitle)
130+
return localizedString(for: "SignedIn")
152131
}
153132

154133
/// General string - Back button label
155134
/// found in:
156135
/// - PasswordRecoveryView
157136
public var backButtonLabel: String {
158-
return localizedString(for: kBack)
137+
return localizedString(for: "Back")
159138
}
160139

161140
/// General string - OK button label
162141
/// found in:
163142
/// - PasswordRecoveryView
164143
public var okButtonLabel: String {
165-
return localizedString(for: kOK)
144+
return localizedString(for: "OK")
166145
}
167146
}

0 commit comments

Comments
 (0)