-
Notifications
You must be signed in to change notification settings - Fork 2
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Safer check of .appStore vs .testFlight build, and enables TESTFLIGHT deployment #76
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -153,8 +153,10 @@ public final class AbacusStateManager: NSObject { | |
switch Installation.source { | ||
case .appStore: | ||
deployment = "MAINNET" | ||
case .testFlight, .debug, .jailBroken: | ||
case .debug, .jailBroken: | ||
deployment = "TESTNET" | ||
case .testFlight: | ||
deployment = "TESTFLIGHT" | ||
Comment on lines
+158
to
+159
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. what is the value/benefit of I am assuming the If app store review build results in There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. TESTFLIGHT deployment would have both mainnet and testnet, and default to mainnet, so unless reviewer enables debug and then switch to testnet environment, he is on mainnet. It should be something like:
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Ah, right. I am forgetting that the menu is hidden unless the Debug flag is enabled via QR code. I will get this updated in v4-web as well. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I am doing a PR on v4-web for this |
||
} | ||
appConfigs = AppConfigs.companion.forApp | ||
} | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i think my PR has the same logical outcomes, but without using the checkResourceIsReachableAndReturnError API (which is a synchronous round trip)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The only different is with app reviewer.
We don't know what receipt file URL they have. If it is "sandboxReceipt", with previous logic, they will end up in.appStore. But if we check if it is reachable (essentially check if the receipt file is present), then reviewer will end up in .testFlight.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
from my PR
if
Bundle.main.appStoreReceiptURL?.lastPathComponent == "sandboxReceipt"
is true, then outcome is.testfFlight
✅if
Bundle.main.appStoreReceiptURL?.lastPathComponent != "sandboxReceipt"
is true, then outcome is.appStore
unlessjailbroken
orisDebug
is true✅if
Bundle.main.appStoreReceiptURL?.lastPathComponent == nil
is true, then outcome is.appStore
unlessjailbroken
orisDebug
is true. To be safe in the case that app review does not have anappStoreReceiptURL
, this outcome should be.testFlight
so this is incorrect ❌so my PR has a potential issue depending on app review binary
for your PR
if
Bundle.main.appStoreReceiptURL?.lastPathComponent == "sandboxReceipt"
is true, then outcome is.appStore
ifcheckResourceIsReachableAndReturnError
is true (i think this might be incorrectly true? since theappStoreReceiptURL
might still be reachable withcheckResourceIsReachableAndReturnError
) ❌if
Bundle.main.appStoreReceiptURL?.lastPathComponent != "sandboxReceipt"
is true, then outcome is.appStore
ifcheckResourceIsReachableAndReturnError
is true ✅if
Bundle.main.appStoreReceiptURL?.lastPathComponent == nil
is true, then outcome is.testFlight
ifcheckResourceIsReachableAndReturnError
is true ✅so your PR has a potential issue depending on app review binary as well. This is only if the sandbox receipt url is reachable
I think we might need to combine both of ours to be 100% safe?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
additionally, I cannot think of a scenario where
Bundle.main.appStoreReceiptURL != nil && checkResourceIsReachableAndReturnError == false
so maybe we can remove the synchronous
checkResourceIsReachableAndReturnError
to reduce app start-up time?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The difference is checkResourceIsReachableAndReturnError, which is true if the receipt file exists. This is battle tested, in our v3 (and many apps before I used it in dYdX)
"sandboxReceipt" is undocumented and can change anytime.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@mike-dydx Like I said in Huddle, I think using "sandboxReceipt" should work. Worst case is that if Apple changes the receipt name (or Apple review has a different receipt name), the TestFlight/Reviewer app behaves like App Store download. If that happens, we can deal with it later. I reverted my changes back to use "sandboxReceipt" check