Skip to content

Commit

Permalink
Fixed bug introduced in one of the recent commits which caused old Eu…
Browse files Browse the repository at this point in the history
…ro-based Gumroad licenses to not be accepted. Not sure when we introduced that bug. The bug was caused by the 'Map non-success server response to error' code being executed after we check the error for the message 'That license does not exist for the provided product.' which is sent by the Gumroad server.
  • Loading branch information
noah-nuebling committed Oct 8, 2024
1 parent 8e129e2 commit 1113b33
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 9 deletions.
2 changes: 1 addition & 1 deletion App/SupportFiles/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
</dict>
</array>
<key>CFBundleVersion</key>
<string>22963</string>
<string>22966</string>
<key>LSApplicationCategoryType</key>
<string>public.app-category.utilities</string>
<key>NSHumanReadableCopyright</key>
Expand Down
2 changes: 1 addition & 1 deletion Helper/SupportFiles/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
<key>CFBundleShortVersionString</key>
<string>$(MARKETING_VERSION)</string>
<key>CFBundleVersion</key>
<string>22963</string>
<string>22966</string>
<key>LSApplicationCategoryType</key>
<string>public.app-category.utilities</string>
<key>LSBackgroundOnly</key>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -320,8 +320,8 @@
filePath = "Shared/License/License.swift"
startingColumnNumber = "9223372036854775807"
endingColumnNumber = "9223372036854775807"
startingLineNumber = "349"
endingLineNumber = "349"
startingLineNumber = "351"
endingLineNumber = "351"
landmarkName = "_checkLicense(key:licenseConfig:incrementUsageCount:)"
landmarkType = "7">
</BreakpointContent>
Expand All @@ -336,8 +336,8 @@
filePath = "Shared/License/License.swift"
startingColumnNumber = "9223372036854775807"
endingColumnNumber = "9223372036854775807"
startingLineNumber = "339"
endingLineNumber = "339"
startingLineNumber = "341"
endingLineNumber = "341"
landmarkName = "_checkLicense(key:licenseConfig:incrementUsageCount:)"
landmarkType = "7">
</BreakpointContent>
Expand Down
8 changes: 5 additions & 3 deletions Shared/License/License.swift
Original file line number Diff line number Diff line change
Expand Up @@ -257,10 +257,12 @@ extension MFLicenseAndTrialState: Equatable {
"license_key": key,
"increment_uses_count": incrementUsageCount ? "true" : "false"])

if let message = error?.userInfo["message"] as? NSString,
if
let message = serverResponse?["message"] as? NSString,
message == "That license does not exist for the provided product." {

/// !!! TODO: @bug This is broken now, since we moved the "Map non-success response to error" step below. Dangeroussss. I hope we didn't break anything else during the refactors.

/// Validate
assert((serverResponse?["success"] as? Bool) == false)

/// If license doesn't exist for new product, try old product
(serverResponse, error, urlResponse) = await sendDictionaryBasedAPIRequest(requestURL: gumroadAPIURL.appending("/licenses/verify"),
Expand Down

0 comments on commit 1113b33

Please sign in to comment.