|
|
|
@ -187,7 +187,7 @@ |
|
|
|
}, |
|
|
|
getRegistrationID(options = {}) { |
|
|
|
const cachedClientId = this.getStoredClientId(); |
|
|
|
if (cachedClientId) { |
|
|
|
if (!options.force && cachedClientId) { |
|
|
|
return Promise.resolve(cachedClientId); |
|
|
|
} |
|
|
|
|
|
|
|
@ -199,8 +199,10 @@ |
|
|
|
if (isResolved) return; |
|
|
|
isResolved = true; |
|
|
|
if (timer) clearTimeout(timer); |
|
|
|
this.saveClientId(clientId); |
|
|
|
resolve(clientId || this.getStoredClientId()); |
|
|
|
if (clientId) { |
|
|
|
this.saveClientId(clientId); |
|
|
|
} |
|
|
|
resolve(clientId || (options.force ? '' : this.getStoredClientId())); |
|
|
|
}; |
|
|
|
timer = setTimeout(() => { |
|
|
|
finish(''); |
|
|
|
@ -441,10 +443,11 @@ |
|
|
|
let clientId = '' |
|
|
|
try { |
|
|
|
clientId = await this.getRegistrationID({ |
|
|
|
timeout: 800 |
|
|
|
force: true, |
|
|
|
timeout: 2000 |
|
|
|
}); |
|
|
|
} catch (e) { |
|
|
|
clientId = this.getStoredClientId() |
|
|
|
clientId = '' |
|
|
|
} |
|
|
|
let url; |
|
|
|
let data; |
|
|
|
|