1
- diff --git a/Loop/Loop/Managers/ProfileExpirationAlerter.swift b/Loop/Managers/ProfileExpirationAlerter.swift
2
- index a28d4527..068e6327 100644
1
+ Submodule Loop contains modified content
2
+ diff --git a/Loop/Loop/Managers/ProfileExpirationAlerter.swift b/Loop/Loop/Managers/ProfileExpirationAlerter.swift
3
+ index a28d4527..62f458fb 100644
3
4
--- a/Loop/Loop/Managers/ProfileExpirationAlerter.swift
4
5
+++ b/Loop/Loop/Managers/ProfileExpirationAlerter.swift
5
6
@@ -19,13 +19,19 @@ class ProfileExpirationAlerter {
@@ -88,7 +89,7 @@ index a28d4527..068e6327 100644
88
89
let relativeTimeRemaining: String = readableRelativeTime ?? NSLocalizedString("Unknown time", comment: "Unknown amount of time in settings' profile expiration section")
89
90
let verboseMessage = createVerboseAlertMessage(timeUntilExpirationStr: relativeTimeRemaining)
90
91
let conciseMessage = relativeTimeRemaining + NSLocalizedString(" remaining", comment: "remaining time in setting's profile expiration section")
91
- @@ -81,6 +104,50 @@ class ProfileExpirationAlerter {
92
+ @@ -81,6 +104,56 @@ class ProfileExpirationAlerter {
92
93
formatter.unitsStyle = .full
93
94
formatter.zeroFormattingBehavior = .dropLeading
94
95
formatter.maximumUnitCount = maxUnitCount
@@ -111,6 +112,12 @@ index a28d4527..068e6327 100644
111
112
+ }
112
113
+
113
114
+ static func isTestFlightBuild() -> Bool {
115
+ + // If the target environment is a simulator, then
116
+ + // this is not a TestFlight distribution. Return false.
117
+ + #if targetEnvironment(simulator)
118
+ + return false
119
+ + #endif
120
+ +
114
121
+ // If an "embedded.mobileprovision" is present in the main bundle, then
115
122
+ // this is an Xcode, Ad-Hoc, or Enterprise distribution. Return false.
116
123
+ if Bundle.main.url(forResource: "embedded", withExtension: "mobileprovision") != nil {
@@ -141,10 +148,10 @@ index a28d4527..068e6327 100644
141
148
}
142
149
}
143
150
diff --git a/Loop/Loop/Views/SettingsView.swift b/Loop/Loop/Views/SettingsView.swift
144
- index 90859273..e41ebfa2 100644
151
+ index 90859273..4021e5d4 100644
145
152
--- a/Loop/Loop/Views/SettingsView.swift
146
153
+++ b/Loop/Loop/Views/SettingsView.swift
147
- @@ -343,25 +343,48 @@ extension SettingsView {
154
+ @@ -343,23 +343,50 @@ extension SettingsView {
148
155
DIY loop specific component to show users the amount of time remaining on their build before a rebuild is necessary.
149
156
*/
150
157
private func profileExpirationSection(profileExpiration:Date) -> some View {
@@ -158,54 +165,50 @@ index 90859273..e41ebfa2 100644
158
165
- footer: Text(NSLocalizedString("Profile expires ", comment: "Time that profile expires") + readableExpirationTime)) {
159
166
- if(nearExpiration) {
160
167
- Text(profileExpirationMsg).foregroundColor(.red)
161
- - } else {
162
- - HStack {
163
- - Text("Profile Expiration", comment: "Settings App Profile expiration view")
164
- - Spacer()
165
- - Text(profileExpirationMsg).foregroundColor(Color.secondary)
166
168
+ let nearExpiration : Bool = ProfileExpirationAlerter.isNearExpiration(expirationDate: expirationDate)
167
169
+ let profileExpirationMsg = ProfileExpirationAlerter.createProfileExpirationSettingsMessage(expirationDate: expirationDate)
168
170
+ let readableExpirationTime = Self.dateFormatter.string(from: expirationDate)
169
171
+
170
172
+ if isTestFlight {
171
- + return Section(header: SectionHeader(label: NSLocalizedString("TestFlight", comment: "Settings app TestFlight section")),
172
- + footer: Text(NSLocalizedString("TestFlight expires ", comment: "Time that build expires") + readableExpirationTime)) {
173
- + if(nearExpiration) {
174
- + Text(profileExpirationMsg).foregroundColor(.red)
175
- + } else {
176
- + HStack {
177
- + Text("TestFlight Expiration", comment: "Settings TestFlight expiration view")
178
- + Spacer()
179
- + Text(profileExpirationMsg).foregroundColor(Color.secondary)
180
- + }
181
- + }
182
- + Button(action: {
183
- + UIApplication.shared.open(URL(string: "https://loopkit.github.io/loopdocs/gh-actions/gh-update/")!)
184
- + }) {
185
- + Text(NSLocalizedString("How to update (LoopDocs)", comment: "The title text for how to update"))
173
+ + return createAppExpirationSection(
174
+ + headerLabel: NSLocalizedString("TestFlight", comment: "Settings app TestFlight section"),
175
+ + footerLabel: NSLocalizedString("TestFlight expires ", comment: "Time that build expires") + readableExpirationTime,
176
+ + expirationLabel: NSLocalizedString("TestFlight Expiration", comment: "Settings TestFlight expiration view"),
177
+ + updateURL: "https://loopkit.github.io/loopdocs/gh-actions/gh-update/",
178
+ + nearExpiration: nearExpiration,
179
+ + expirationMessage: profileExpirationMsg
180
+ + )
181
+ + } else {
182
+ + return createAppExpirationSection(
183
+ + headerLabel: NSLocalizedString("App Profile", comment: "Settings app profile section"),
184
+ + footerLabel: NSLocalizedString("Profile expires ", comment: "Time that profile expires") + readableExpirationTime,
185
+ + expirationLabel: NSLocalizedString("Profile Expiration", comment: "Settings App Profile expiration view"),
186
+ + updateURL: "https://loopkit.github.io/loopdocs/build/updating/",
187
+ + nearExpiration: nearExpiration,
188
+ + expirationMessage: profileExpirationMsg
189
+ + )
190
+ + }
191
+ + }
192
+ +
193
+ + private func createAppExpirationSection(headerLabel: String, footerLabel: String, expirationLabel: String, updateURL: String, nearExpiration: Bool, expirationMessage: String) -> some View {
194
+ + return Section(
195
+ + header: SectionHeader(label: headerLabel),
196
+ + footer: Text(footerLabel)
197
+ + ) {
198
+ + if nearExpiration {
199
+ + Text(expirationMessage).foregroundColor(.red)
200
+ } else {
201
+ HStack {
202
+ - Text("Profile Expiration", comment: "Settings App Profile expiration view")
203
+ + Text(expirationLabel)
204
+ Spacer()
205
+ - Text(profileExpirationMsg).foregroundColor(Color.secondary)
206
+ + Text(expirationMessage).foregroundColor(Color.secondary)
186
207
}
187
208
}
188
- - Button(action: {
209
+ Button(action: {
189
210
- UIApplication.shared.open(URL(string: "https://loopkit.github.io/loopdocs/build/updating/")!)
190
- - }) {
191
- - Text(NSLocalizedString("How to update (LoopDocs)", comment: "The title text for how to update"))
192
- + } else {
193
- + return Section(header: SectionHeader(label: NSLocalizedString("App Profile", comment: "Settings app profile section")),
194
- + footer: Text(NSLocalizedString("Profile expires ", comment: "Time that profile expires") + readableExpirationTime)) {
195
- + if(nearExpiration) {
196
- + Text(profileExpirationMsg).foregroundColor(.red)
197
- + } else {
198
- + HStack {
199
- + Text("Profile Expiration", comment: "Settings App Profile expiration view")
200
- + Spacer()
201
- + Text(profileExpirationMsg).foregroundColor(Color.secondary)
202
- + }
203
- + }
204
- + Button(action: {
205
- + UIApplication.shared.open(URL(string: "https://loopkit.github.io/loopdocs/build/updating/")!)
206
- + }) {
207
- + Text(NSLocalizedString("How to update (LoopDocs)", comment: "The title text for how to update"))
208
- + }
211
+ + UIApplication.shared.open(URL(string: updateURL)!)
212
+ }) {
213
+ Text(NSLocalizedString("How to update (LoopDocs)", comment: "The title text for how to update"))
209
214
}
210
- }
211
- }
0 commit comments