Add "isLivingRoomDeeplink" param to /player payload, and remove auto-refresh of browser based tokens
browser based tokens are fallbacks now.
This commit is contained in:
1 parent
ce32d2f762
commit
5c5fe19440
9 files changed
+14
-77
No files matched your search
@@ -180,8 +180,8 @@ export class PoTokenMinter {
|
||||
return now - device.mintedAt >= REFRESH_AGE_SECONDS;
|
||||
}
|
||||
|
||||
// Mints + uploads a poToken when the device's token needs refreshing, or always when forced.
|
||||
static async ensureDevicePoToken(force = false): Promise<EnsurePoTokenResult> {
|
||||
// Mints + uploads a poToken when the device's token needs refreshing.
|
||||
static async ensureDevicePoToken(): Promise<EnsurePoTokenResult> {
|
||||
let device: DevicePoToken;
|
||||
try {
|
||||
device = await PlayletApi.getDevicePoToken();
|
||||
@@ -194,7 +194,7 @@ export class PoTokenMinter {
|
||||
if (!identity) {
|
||||
return { status: "no-session" };
|
||||
}
|
||||
if (!force && !PoTokenMinter.shouldRefresh(device)) {
|
||||
if (!PoTokenMinter.shouldRefresh(device)) {
|
||||
return { status: "current" };
|
||||
}
|
||||
|
||||
|
||||
@@ -14,7 +14,7 @@
|
||||
<div class="m-5">
|
||||
<div class={textSizes[level]}>{$translate(displayText)}</div>
|
||||
<div class="text-xs text-gray-500">{@html $translate(description)}</div>
|
||||
<button class="btn m-1" on:click={() => ensureDevicePoTokenWithToast(true)}
|
||||
<button class="btn m-1" on:click={() => ensureDevicePoTokenWithToast()}
|
||||
>{$translate("Mint PoToken")}</button
|
||||
>
|
||||
</div>
|
||||
@@ -2,8 +2,8 @@ import { PoTokenMinter } from "lib/Api/PoTokenMinter";
|
||||
import { addToast } from "lib/Toast";
|
||||
|
||||
// Mints for the current identity if needed, surfacing the outcome as a toast.
|
||||
export async function ensureDevicePoTokenWithToast(force = false) {
|
||||
const result = await PoTokenMinter.ensureDevicePoToken(force);
|
||||
export async function ensureDevicePoTokenWithToast() {
|
||||
const result = await PoTokenMinter.ensureDevicePoToken();
|
||||
switch (result.status) {
|
||||
case "minted":
|
||||
addToast("PoToken minted on device", "success");
|
||||
|
||||
Reference in new issue
Block a user