-
Notifications
You must be signed in to change notification settings - Fork 503
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
860aaf6
commit 63106fa
Showing
11 changed files
with
104 additions
and
26 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
import { UsageTest, UsageTestController } from "@tutao/tutanota-usagetests" | ||
import { PaymentMethodType } from "../api/common/TutanotaConstants.js" | ||
import { StorageBehavior, UsageTestModel } from "./UsageTestModel.js" | ||
import { locator } from "../api/main/MainLocator.js" | ||
import { LazyLoaded, lazy } from "@tutao/tutanota-utils" | ||
|
||
export class AppStorePaymentPicker { | ||
private appStorePaymentUsageTest: lazy<UsageTest> = () => { | ||
return locator.usageTestController.getTest("payment.appstore") | ||
} | ||
|
||
async shouldEnableAppStorePayment(currentPaymentMethod: PaymentMethodType | null): Promise<boolean> { | ||
// Prevent users with AppStorePayment from losing the ability to modify their plan | ||
if (currentPaymentMethod === PaymentMethodType.AppStore) { | ||
return true | ||
} | ||
|
||
const appStorePaymentUsageTest = this.appStorePaymentUsageTest() | ||
const shouldEnable = appStorePaymentUsageTest.getVariant({ | ||
[0]: () => false, | ||
[1]: () => true, | ||
}) | ||
|
||
if (shouldEnable) { | ||
await appStorePaymentUsageTest.getStage(0).complete() | ||
} | ||
|
||
return shouldEnable | ||
} | ||
|
||
async markSubscribedStageAsComplete() { | ||
const appStorePaymentUsageTest = this.appStorePaymentUsageTest() | ||
await appStorePaymentUsageTest.getStage(1).complete() | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters