File tree Expand file tree Collapse file tree 1 file changed +17
-3
lines changed Expand file tree Collapse file tree 1 file changed +17
-3
lines changed Original file line number Diff line number Diff line change @@ -104,7 +104,7 @@ class AppExpirationAlerter {
104
104
formatter. unitsStyle = . full
105
105
formatter. zeroFormattingBehavior = . dropLeading
106
106
formatter. maximumUnitCount = maxUnitCount
107
- return formatter;
107
+ return formatter
108
108
}
109
109
110
110
static func buildDate( ) -> Date ? {
@@ -122,9 +122,23 @@ class AppExpirationAlerter {
122
122
}
123
123
124
124
static func isTestFlightBuild( ) -> Bool {
125
- return BuildDetails . default. isGitHubBuild ?? false
125
+ // If an "embedded.mobileprovision" is present in the main bundle, then
126
+ // this is an Xcode, Ad-Hoc, or Enterprise distribution. Return false.
127
+ if Bundle . main. url ( forResource: " embedded " , withExtension: " mobileprovision " ) != nil {
128
+ return false
129
+ }
130
+
131
+ // If an app store receipt is not present in the main bundle, then we cannot
132
+ // say whether this is a TestFlight or App Store distribution. Return false.
133
+ guard let receiptName = Bundle . main. appStoreReceiptURL? . lastPathComponent else {
134
+ return false
135
+ }
136
+
137
+ // A TestFlight distribution presents a "sandboxReceipt", while an App Store
138
+ // distribution presents a "receipt". Return true if we have a TestFlight receipt.
139
+ return " sandboxReceipt " . caseInsensitiveCompare ( receiptName) == . orderedSame
126
140
}
127
-
141
+
128
142
static func calculateExpirationDate( profileExpiration: Date ) -> Date {
129
143
let isTestFlight = isTestFlightBuild ( )
130
144
You can’t perform that action at this time.
0 commit comments