mirror of
https://gitee.com/mafgwo/stackedit
synced 2024-11-16 11:42:23 +08:00
Fixed payment success modal
This commit is contained in:
parent
cf18184e26
commit
da0ccf8d82
|
@ -32,7 +32,7 @@ export default {
|
|||
'Yes, add suffix',
|
||||
),
|
||||
paymentSuccess: simpleModal(
|
||||
'<p>Thank you for your payment! Your sponsorship will be active in a minute.</p>',
|
||||
'<h3>Thank you for your payment!</h3><p>Your sponsorship will be active in a minute.</p>',
|
||||
'Ok',
|
||||
),
|
||||
providerRedirection: simpleModal(
|
||||
|
|
|
@ -11,7 +11,6 @@ const { exportWorkspace } = utils.queryParams;
|
|||
const { silent } = utils.queryParams;
|
||||
const resetApp = utils.queryParams.reset;
|
||||
const deleteMarkerMaxAge = 1000;
|
||||
const checkSponsorshipAfter = (5 * 60 * 1000) + (30 * 1000); // tokenExpirationMargin + 30 sec
|
||||
|
||||
class Connection {
|
||||
constructor() {
|
||||
|
@ -384,22 +383,6 @@ const localDbSvc = {
|
|||
.forEach(file => workspaceSvc.deleteFile(file.id));
|
||||
}
|
||||
|
||||
// Enable sponsorship
|
||||
if (utils.queryParams.paymentSuccess) {
|
||||
window.location.hash = ''; // PaymentSuccess param is always on its own
|
||||
store.dispatch('modal/open', 'paymentSuccess')
|
||||
.catch(() => { /* Cancel */ });
|
||||
const sponsorToken = store.getters['workspace/sponsorToken'];
|
||||
// Force check sponsorship after a few seconds
|
||||
const currentDate = Date.now();
|
||||
if (sponsorToken && sponsorToken.expiresOn > currentDate - checkSponsorshipAfter) {
|
||||
store.dispatch('data/addGoogleToken', {
|
||||
...sponsorToken,
|
||||
expiresOn: currentDate - checkSponsorshipAfter,
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
// Sync local DB periodically
|
||||
utils.setInterval(() => localDbSvc.sync(), 1000);
|
||||
|
||||
|
|
|
@ -17,6 +17,7 @@ const minAutoSyncEvery = 60 * 1000; // 60 sec
|
|||
const inactivityThreshold = 3 * 1000; // 3 sec
|
||||
const restartSyncAfter = 30 * 1000; // 30 sec
|
||||
const restartContentSyncAfter = 1000; // Enough to detect an authorize pop up
|
||||
const checkSponsorshipAfter = (5 * 60 * 1000) + (30 * 1000); // tokenExpirationMargin + 30 sec
|
||||
const maxContentHistory = 20;
|
||||
|
||||
const LAST_SEEN = 0;
|
||||
|
@ -879,11 +880,27 @@ export default {
|
|||
}
|
||||
const workspace = await workspaceProvider.initWorkspace();
|
||||
// Fix the URL hash
|
||||
const { paymentSuccess } = utils.queryParams;
|
||||
utils.setQueryParams(workspaceProvider.getWorkspaceParams(workspace));
|
||||
|
||||
store.dispatch('workspace/setCurrentWorkspaceId', workspace.id);
|
||||
await localDbSvc.init();
|
||||
|
||||
// Enable sponsorship
|
||||
if (paymentSuccess) {
|
||||
store.dispatch('modal/open', 'paymentSuccess')
|
||||
.catch(() => { /* Cancel */ });
|
||||
const sponsorToken = store.getters['workspace/sponsorToken'];
|
||||
// Force check sponsorship after a few seconds
|
||||
const currentDate = Date.now();
|
||||
if (sponsorToken && sponsorToken.expiresOn > currentDate - checkSponsorshipAfter) {
|
||||
store.dispatch('data/addGoogleToken', {
|
||||
...sponsorToken,
|
||||
expiresOn: currentDate - checkSponsorshipAfter,
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
// Try to find a suitable action provider
|
||||
actionProvider = providerRegistry.providersById[utils.queryParams.providerId] || actionProvider;
|
||||
if (actionProvider && actionProvider.performAction) {
|
||||
|
|
Loading…
Reference in New Issue
Block a user