decord/alpha/source/modules/spotify/SpotifyActionCreators.tsx

546 lines
24 KiB
TypeScript
Raw Normal View History

// Module ID: 12002
// Function ID: 12003
// Name: SpotifyActionCreators
// Dependencies: [12001, 8610, 1074, 2036, 1271, 573, 1091, 1364, 8954, 2]
2026-07-29 08:29:29 +00:00
// Exports: fetchIsSpotifyProtocolRegistered, getAccessToken, getDevices, getProfile, pause, play, setActiveDevice, subscribePlayerStateNotifications
2026-07-20 16:05:17 +00:00
// Module 12002 (SpotifyActionCreators)
import DispatcherDefault from "Dispatcher" /* 573 */;
import PlatformUtils from "PlatformUtils" /* 1364 */;
import GameUtilsDefault from "GameUtils" /* 8954 */;
import SpotifyProtocolStore from "SpotifyProtocolStore" /* 12001 */;
2026-07-23 10:11:24 +00:00
const require = globalThis.__r;
require = fn;
function apiRequest(fn, arg1, arg2, arg3) {
closure_0 = fn;
2026-08-24 06:08:38 +00:00
closure_1 = arg1;
obj = arg3;
2026-07-23 10:11:24 +00:00
obj = {};
2026-07-20 16:05:17 +00:00
const merged = Object.assign(arg3);
obj.headers = { authorization: "Bearer " + arg2 };
const obj2 = { authorization: "Bearer " + arg2 };
const promise = fn(obj);
return fn(obj).then((status) => {
2026-07-20 16:05:17 +00:00
let rejectResult = status;
if (202 === status.status) {
rejectResult = Promise.reject(status);
}
return rejectResult;
}).catch((error) => {
2026-07-20 16:05:17 +00:00
let tmp = true !== obj.onlyRetryOnAuthorizationErrors;
if (tmp) {
tmp = 202 === error.status;
2026-07-20 16:05:17 +00:00
}
if (401 === error.status) {
2026-08-24 06:08:38 +00:00
if (closure_3 > 0) {
if (202 === error.status) {
obj = closure_2_0(closure_2_2[3]);
2026-07-20 16:05:17 +00:00
let timeoutPromiseResult = obj.timeoutPromise(5000);
} else {
timeoutPromiseResult = Promise.resolve();
}
2026-07-29 08:29:29 +00:00
let nextPromise = timeoutPromiseResult.then(() => {
closure_0 = closure_1_1;
const HTTP = closure_0(obj[4]).HTTP;
obj = { url: closure_2_7.CONNECTION_ACCESS_TOKEN(constants.SPOTIFY, closure_1_1), oldFormErrors: true, rejectWithError: false };
const value = HTTP.get(obj);
return value.catch((error) => {
let body = error.body;
2026-07-29 08:29:29 +00:00
let code;
if (body != null) {
code = body.code;
}
if (code === closure_2_6.CONNECTION_REVOKED) {
let obj3 = { type: "SPOTIFY_ACCOUNT_ACCESS_TOKEN_REVOKE", accountId };
closure_2_1(closure_2_2[5]).dispatch(obj3);
let obj2 = closure_2_1(closure_2_2[5]);
} else if (429 === error.status) {
let result = error.headers["retry-after"] * closure_2_1(closure_2_2[6]).Millis.SECOND;
2026-07-29 08:29:29 +00:00
let _isNaN = isNaN;
let num2 = 5000;
if (!isNaN(result)) {
num2 = 5000;
if (0 !== result) {
num2 = result;
}
}
let obj = closure_2_0(closure_2_2[3]);
return closure_2_0(closure_2_2[3]).timeoutPromise(num2).then(() => {
let HTTP = closure_2_0(closure_2_2[4]).HTTP;
let value = HTTP.get({ url: closure_2_7.CONNECTION_ACCESS_TOKEN(closure_2_8.SPOTIFY, accountId), oldFormErrors: true, rejectWithError: false });
let obj = { url: closure_2_7.CONNECTION_ACCESS_TOKEN(closure_2_8.SPOTIFY, accountId), oldFormErrors: true, rejectWithError: false };
2026-07-29 08:29:29 +00:00
return value.catch(() => { ... }).then(() => { ... });
});
}
return Promise.reject(error);
2026-07-29 08:29:29 +00:00
}).then((accessToken) => {
closure_2_1(closure_2_2[5]).dispatch({ type: "SPOTIFY_ACCOUNT_ACCESS_TOKEN", accountId, accessToken: accessToken.body.access_token });
2026-07-29 08:29:29 +00:00
return accessToken;
});
});
timeoutPromiseResult.then(() => {
closure_0 = closure_1_1;
const HTTP = closure_0(obj[4]).HTTP;
obj = { url: closure_2_7.CONNECTION_ACCESS_TOKEN(constants.SPOTIFY, closure_1_1), oldFormErrors: true, rejectWithError: false };
const value = HTTP.get(obj);
return value.catch((error) => {
let body = error.body;
2026-07-29 08:29:29 +00:00
let code;
if (body != null) {
code = body.code;
}
if (code === closure_2_6.CONNECTION_REVOKED) {
let obj3 = { type: "SPOTIFY_ACCOUNT_ACCESS_TOKEN_REVOKE", accountId };
closure_2_1(closure_2_2[5]).dispatch(obj3);
let obj2 = closure_2_1(closure_2_2[5]);
} else if (429 === error.status) {
let result = error.headers["retry-after"] * closure_2_1(closure_2_2[6]).Millis.SECOND;
2026-07-29 08:29:29 +00:00
let _isNaN = isNaN;
let num2 = 5000;
if (!isNaN(result)) {
num2 = 5000;
if (0 !== result) {
num2 = result;
}
}
let obj = closure_2_0(closure_2_2[3]);
return closure_2_0(closure_2_2[3]).timeoutPromise(num2).then(() => {
let HTTP = closure_2_0(closure_2_2[4]).HTTP;
let value = HTTP.get({ url: closure_2_7.CONNECTION_ACCESS_TOKEN(closure_2_8.SPOTIFY, accountId), oldFormErrors: true, rejectWithError: false });
let obj = { url: closure_2_7.CONNECTION_ACCESS_TOKEN(closure_2_8.SPOTIFY, accountId), oldFormErrors: true, rejectWithError: false };
2026-07-29 08:29:29 +00:00
return value.catch(() => { ... }).then(() => { ... });
});
}
return Promise.reject(error);
2026-07-29 08:29:29 +00:00
}).then((accessToken) => {
closure_2_1(closure_2_2[5]).dispatch({ type: "SPOTIFY_ACCOUNT_ACCESS_TOKEN", accountId, accessToken: accessToken.body.access_token });
2026-07-29 08:29:29 +00:00
return accessToken;
});
}).then((body) => {
closure_0 = closure_1_0;
closure_1 = closure_1_1;
closure_3 = closure_1_3 - 1;
2026-08-24 06:08:38 +00:00
obj = {};
let merged = Object.assign(closure_1_2);
obj.headers = { authorization: "Bearer " + body.body.access_token };
let obj2 = { authorization: "Bearer " + body.body.access_token };
let promise = closure_1_0(obj);
return closure_1_0(obj).then((status) => {
2026-07-29 08:29:29 +00:00
let rejectResult = status;
if (202 === status.status) {
rejectResult = Promise.reject(status);
}
return rejectResult;
}).catch((error) => {
2026-07-29 08:29:29 +00:00
let tmp = true !== obj.onlyRetryOnAuthorizationErrors;
if (tmp) {
tmp = 202 === error.status;
2026-07-29 08:29:29 +00:00
}
if (401 === error.status) {
2026-08-24 06:08:38 +00:00
if (closure_3 > 0) {
if (202 === error.status) {
obj = closure_2_0(closure_2_2[3]);
2026-07-29 08:29:29 +00:00
let timeoutPromiseResult = obj.timeoutPromise(5000);
} else {
timeoutPromiseResult = Promise.resolve();
}
let nextPromise = timeoutPromiseResult.then(() => {
closure_0 = closure_1_1;
const HTTP = closure_0(obj[4]).HTTP;
obj = { url: closure_2_7.CONNECTION_ACCESS_TOKEN(constants.SPOTIFY, closure_1_1), oldFormErrors: true, rejectWithError: false };
const value = HTTP.get(obj);
2026-07-29 08:29:29 +00:00
return value.catch(() => { ... }).then(() => { ... });
});
timeoutPromiseResult.then(() => {
closure_0 = closure_1_1;
const HTTP = closure_0(obj[4]).HTTP;
obj = { url: closure_2_7.CONNECTION_ACCESS_TOKEN(constants.SPOTIFY, closure_1_1), oldFormErrors: true, rejectWithError: false };
const value = HTTP.get(obj);
2026-07-29 08:29:29 +00:00
return value.catch(() => { ... }).then(() => { ... });
}).then((body) => {
closure_0 = closure_1_0;
closure_1 = closure_1_1;
closure_3 = closure_1_3 - 1;
2026-08-24 06:08:38 +00:00
obj = {};
let merged = Object.assign(closure_1_2);
obj.headers = { authorization: "Bearer " + body.body.access_token };
let obj2 = { authorization: "Bearer " + body.body.access_token };
let promise = closure_1_0(obj);
return closure_1_0(obj).then(() => { ... }).catch(() => { ... });
}).then((result) => {
closure_0 = result;
2026-07-29 08:29:29 +00:00
return new Promise(() => { ... });
});
let nextPromise1 = timeoutPromiseResult.then(() => {
closure_0 = closure_1_1;
const HTTP = closure_0(obj[4]).HTTP;
obj = { url: closure_2_7.CONNECTION_ACCESS_TOKEN(constants.SPOTIFY, closure_1_1), oldFormErrors: true, rejectWithError: false };
const value = HTTP.get(obj);
2026-07-29 08:29:29 +00:00
return value.catch(() => { ... }).then(() => { ... });
}).then((body) => {
closure_0 = closure_1_0;
closure_1 = closure_1_1;
closure_3 = closure_1_3 - 1;
2026-08-24 06:08:38 +00:00
obj = {};
let merged = Object.assign(closure_1_2);
obj.headers = { authorization: "Bearer " + body.body.access_token };
let obj2 = { authorization: "Bearer " + body.body.access_token };
let promise = closure_1_0(obj);
return closure_1_0(obj).then(() => { ... }).catch(() => { ... });
2026-07-29 08:29:29 +00:00
});
}
}
return Promise.reject(error);
2026-07-29 08:29:29 +00:00
});
}).then((result) => {
closure_0 = result;
2026-07-23 10:11:24 +00:00
return new Promise((arg0) => {
2026-08-24 06:08:38 +00:00
closure_0 = arg0;
return setImmediate(() => closure_0(closure_0));
2026-07-23 10:11:24 +00:00
});
});
2026-07-29 08:29:29 +00:00
let nextPromise1 = timeoutPromiseResult.then(() => {
closure_0 = closure_1_1;
const HTTP = closure_0(obj[4]).HTTP;
obj = { url: closure_2_7.CONNECTION_ACCESS_TOKEN(constants.SPOTIFY, closure_1_1), oldFormErrors: true, rejectWithError: false };
const value = HTTP.get(obj);
return value.catch((error) => {
let body = error.body;
2026-07-29 08:29:29 +00:00
let code;
if (body != null) {
code = body.code;
}
if (code === closure_2_6.CONNECTION_REVOKED) {
let obj3 = { type: "SPOTIFY_ACCOUNT_ACCESS_TOKEN_REVOKE", accountId };
closure_2_1(closure_2_2[5]).dispatch(obj3);
let obj2 = closure_2_1(closure_2_2[5]);
} else if (429 === error.status) {
let result = error.headers["retry-after"] * closure_2_1(closure_2_2[6]).Millis.SECOND;
2026-07-29 08:29:29 +00:00
let _isNaN = isNaN;
let num2 = 5000;
if (!isNaN(result)) {
num2 = 5000;
if (0 !== result) {
num2 = result;
}
}
let obj = closure_2_0(closure_2_2[3]);
return closure_2_0(closure_2_2[3]).timeoutPromise(num2).then(() => {
let HTTP = closure_2_0(closure_2_2[4]).HTTP;
let value = HTTP.get({ url: closure_2_7.CONNECTION_ACCESS_TOKEN(closure_2_8.SPOTIFY, accountId), oldFormErrors: true, rejectWithError: false });
let obj = { url: closure_2_7.CONNECTION_ACCESS_TOKEN(closure_2_8.SPOTIFY, accountId), oldFormErrors: true, rejectWithError: false };
2026-07-29 08:29:29 +00:00
return value.catch(() => { ... }).then(() => { ... });
});
}
return Promise.reject(error);
2026-07-29 08:29:29 +00:00
}).then((accessToken) => {
closure_2_1(closure_2_2[5]).dispatch({ type: "SPOTIFY_ACCOUNT_ACCESS_TOKEN", accountId, accessToken: accessToken.body.access_token });
2026-07-29 08:29:29 +00:00
return accessToken;
});
}).then((body) => {
closure_0 = closure_1_0;
closure_1 = closure_1_1;
closure_3 = closure_1_3 - 1;
2026-08-24 06:08:38 +00:00
obj = {};
let merged = Object.assign(closure_1_2);
obj.headers = { authorization: "Bearer " + body.body.access_token };
let obj2 = { authorization: "Bearer " + body.body.access_token };
let promise = closure_1_0(obj);
return closure_1_0(obj).then((status) => {
2026-07-29 08:29:29 +00:00
let rejectResult = status;
if (202 === status.status) {
rejectResult = Promise.reject(status);
}
return rejectResult;
}).catch((error) => {
2026-07-29 08:29:29 +00:00
let tmp = true !== obj.onlyRetryOnAuthorizationErrors;
if (tmp) {
tmp = 202 === error.status;
2026-07-29 08:29:29 +00:00
}
if (401 === error.status) {
2026-08-24 06:08:38 +00:00
if (closure_3 > 0) {
if (202 === error.status) {
obj = closure_2_0(closure_2_2[3]);
2026-07-29 08:29:29 +00:00
let timeoutPromiseResult = obj.timeoutPromise(5000);
} else {
timeoutPromiseResult = Promise.resolve();
}
let nextPromise = timeoutPromiseResult.then(() => {
closure_0 = closure_1_1;
const HTTP = closure_0(obj[4]).HTTP;
obj = { url: closure_2_7.CONNECTION_ACCESS_TOKEN(constants.SPOTIFY, closure_1_1), oldFormErrors: true, rejectWithError: false };
const value = HTTP.get(obj);
2026-07-29 08:29:29 +00:00
return value.catch(() => { ... }).then(() => { ... });
});
timeoutPromiseResult.then(() => {
closure_0 = closure_1_1;
const HTTP = closure_0(obj[4]).HTTP;
obj = { url: closure_2_7.CONNECTION_ACCESS_TOKEN(constants.SPOTIFY, closure_1_1), oldFormErrors: true, rejectWithError: false };
const value = HTTP.get(obj);
2026-07-29 08:29:29 +00:00
return value.catch(() => { ... }).then(() => { ... });
}).then((body) => {
closure_0 = closure_1_0;
closure_1 = closure_1_1;
closure_3 = closure_1_3 - 1;
2026-08-24 06:08:38 +00:00
obj = {};
let merged = Object.assign(closure_1_2);
obj.headers = { authorization: "Bearer " + body.body.access_token };
let obj2 = { authorization: "Bearer " + body.body.access_token };
let promise = closure_1_0(obj);
return closure_1_0(obj).then(() => { ... }).catch(() => { ... });
}).then((result) => {
closure_0 = result;
2026-07-29 08:29:29 +00:00
return new Promise(() => { ... });
});
let nextPromise1 = timeoutPromiseResult.then(() => {
closure_0 = closure_1_1;
const HTTP = closure_0(obj[4]).HTTP;
obj = { url: closure_2_7.CONNECTION_ACCESS_TOKEN(constants.SPOTIFY, closure_1_1), oldFormErrors: true, rejectWithError: false };
const value = HTTP.get(obj);
2026-07-29 08:29:29 +00:00
return value.catch(() => { ... }).then(() => { ... });
}).then((body) => {
closure_0 = closure_1_0;
closure_1 = closure_1_1;
closure_3 = closure_1_3 - 1;
2026-08-24 06:08:38 +00:00
obj = {};
let merged = Object.assign(closure_1_2);
obj.headers = { authorization: "Bearer " + body.body.access_token };
let obj2 = { authorization: "Bearer " + body.body.access_token };
let promise = closure_1_0(obj);
return closure_1_0(obj).then(() => { ... }).catch(() => { ... });
2026-07-29 08:29:29 +00:00
});
}
}
return Promise.reject(error);
2026-07-29 08:29:29 +00:00
});
});
2026-07-20 16:05:17 +00:00
}
}
return Promise.reject(error);
2026-07-20 16:05:17 +00:00
});
}
const SpotifyConstants = fn(8610);
({ SPOTIFY_APP_PROTOCOL: closure_4, SpotifyEndpoints: hasOwnProperty } = SpotifyConstants);
const Constants = fn(1074);
({ AbortCodes: metroRequire, Endpoints: closure_7, PlatformTypes: closure_8 } = Constants);
const SpotifyAPI = { get: apiRequest.bind(null, fn(1271).HTTP.get), put: apiRequest.bind(null, fn(1271).HTTP.put) };
const size = fn(2);
const result = size.fileFinishedImporting("modules/spotify/SpotifyActionCreators.tsx");
2026-07-29 08:29:29 +00:00
export { SpotifyAPI };
2026-07-29 08:29:29 +00:00
export const getAccessToken = function getAccessToken(id) {
_require = id;
const HTTP = require("HTTPUtils").HTTP;
value = HTTP.get({ url: closure_7.CONNECTION_ACCESS_TOKEN(constants.SPOTIFY, id), oldFormErrors: true, rejectWithError: false });
2026-08-24 06:08:38 +00:00
obj = { url: closure_7.CONNECTION_ACCESS_TOKEN(constants.SPOTIFY, id), oldFormErrors: true, rejectWithError: false };
return value.catch((error) => {
let body = error.body;
2026-07-20 16:05:17 +00:00
let code;
2026-07-29 08:29:29 +00:00
if (body != null) {
2026-07-20 16:05:17 +00:00
code = body.code;
}
if (code === closure_2_6.CONNECTION_REVOKED) {
let obj3 = { type: "SPOTIFY_ACCOUNT_ACCESS_TOKEN_REVOKE", accountId };
closure_2_1(closure_2_2[5]).dispatch(obj3);
let obj2 = closure_2_1(closure_2_2[5]);
} else if (429 === error.status) {
let result = error.headers["retry-after"] * closure_2_1(closure_2_2[6]).Millis.SECOND;
2026-07-29 08:29:29 +00:00
let _isNaN = isNaN;
2026-07-20 16:05:17 +00:00
let num2 = 5000;
if (!isNaN(result)) {
num2 = 5000;
if (0 !== result) {
num2 = result;
}
}
let obj = closure_2_0(closure_2_2[3]);
return closure_2_0(closure_2_2[3]).timeoutPromise(num2).then(() => {
let HTTP = closure_2_0(closure_2_2[4]).HTTP;
let value = HTTP.get({ url: closure_2_7.CONNECTION_ACCESS_TOKEN(closure_2_8.SPOTIFY, accountId), oldFormErrors: true, rejectWithError: false });
let obj = { url: closure_2_7.CONNECTION_ACCESS_TOKEN(closure_2_8.SPOTIFY, accountId), oldFormErrors: true, rejectWithError: false };
return value.catch((error) => {
let body = error.body;
2026-07-29 08:29:29 +00:00
let code;
if (body != null) {
code = body.code;
}
if (code === closure_2_6.CONNECTION_REVOKED) {
let obj3 = { type: "SPOTIFY_ACCOUNT_ACCESS_TOKEN_REVOKE", accountId };
closure_2_1(closure_2_2[5]).dispatch(obj3);
let obj2 = closure_2_1(closure_2_2[5]);
} else if (429 === error.status) {
let result = error.headers["retry-after"] * closure_2_1(closure_2_2[6]).Millis.SECOND;
2026-07-29 08:29:29 +00:00
let _isNaN = isNaN;
let num2 = 5000;
if (!isNaN(result)) {
num2 = 5000;
if (0 !== result) {
num2 = result;
}
}
let obj = closure_2_0(closure_2_2[3]);
return closure_2_0(closure_2_2[3]).timeoutPromise(num2).then(() => {
let HTTP = closure_2_0(closure_2_2[4]).HTTP;
let value = HTTP.get({ url: closure_2_7.CONNECTION_ACCESS_TOKEN(closure_2_8.SPOTIFY, accountId), oldFormErrors: true, rejectWithError: false });
let obj = { url: closure_2_7.CONNECTION_ACCESS_TOKEN(closure_2_8.SPOTIFY, accountId), oldFormErrors: true, rejectWithError: false };
2026-07-29 08:29:29 +00:00
return value.catch(() => { ... }).then(() => { ... });
});
}
return Promise.reject(error);
2026-07-29 08:29:29 +00:00
}).then((accessToken) => {
closure_2_1(closure_2_2[5]).dispatch({ type: "SPOTIFY_ACCOUNT_ACCESS_TOKEN", accountId, accessToken: accessToken.body.access_token });
2026-07-29 08:29:29 +00:00
return accessToken;
});
});
2026-07-20 16:05:17 +00:00
}
return Promise.reject(error);
2026-07-20 16:05:17 +00:00
}).then((accessToken) => {
closure_2_1(closure_2_2[5]).dispatch({ type: "SPOTIFY_ACCOUNT_ACCESS_TOKEN", accountId, accessToken: accessToken.body.access_token });
2026-07-20 16:05:17 +00:00
return accessToken;
});
2026-07-29 08:29:29 +00:00
};
export const subscribePlayerStateNotifications = function subscribePlayerStateNotifications(accountId, accessToken, connectionId) {
2026-08-24 06:08:38 +00:00
closure_0 = accountId;
closure_1 = accessToken;
closure_2 = connectionId;
const request = { url: closure_5.NOTIFICATIONS_PLAYER, query: { connection_id: connectionId } };
return obj.put(accountId, accessToken, request).catch((error) => {
2026-08-24 06:08:38 +00:00
if (closure_3 <= 0) {
let rejectResult = Promise.reject(error);
2026-07-20 16:05:17 +00:00
} else {
let obj = closure_2_0(closure_2_2[3]);
rejectResult = closure_2_0(closure_2_2[3]).timeoutPromise(5000).then(() => {
closure_0 = closure_1_0;
closure_1 = closure_1_1;
closure_2 = connection_id;
closure_3 = closure_1_3 - 1;
let request = { url: closure_2_5.NOTIFICATIONS_PLAYER, query: { connection_id } };
return closure_2_9.put(closure_1_0, closure_1_1, request).catch((error) => {
2026-08-24 06:08:38 +00:00
if (closure_3 <= 0) {
let rejectResult = Promise.reject(error);
2026-07-29 08:29:29 +00:00
} else {
let obj = closure_2_0(closure_2_2[3]);
rejectResult = closure_2_0(closure_2_2[3]).timeoutPromise(5000).then(() => {
closure_0 = closure_1_0;
closure_1 = closure_1_1;
closure_2 = connection_id;
closure_3 = closure_1_3 - 1;
let request = { url: closure_2_5.NOTIFICATIONS_PLAYER, query: { connection_id } };
return closure_2_9.put(closure_1_0, closure_1_1, request).catch(() => { ... });
2026-07-29 08:29:29 +00:00
});
let timeoutPromiseResult = closure_2_0(closure_2_2[3]).timeoutPromise(5000);
2026-07-29 08:29:29 +00:00
}
return rejectResult;
});
});
let timeoutPromiseResult = closure_2_0(closure_2_2[3]).timeoutPromise(5000);
2026-07-20 16:05:17 +00:00
}
return rejectResult;
});
2026-07-29 08:29:29 +00:00
};
export const getProfile = function getProfile(accountId, arg1) {
2026-08-24 06:08:38 +00:00
obj = { url: closure_5.PROFILE };
value = obj.get(accountId, arg1, obj);
2026-07-20 16:05:17 +00:00
return value.then((body) => {
DispatcherDefault.dispatch({ type: "SPOTIFY_PROFILE_UPDATE", accountId, isPremium: "premium" === body.body.product });
2026-07-20 16:05:17 +00:00
return body;
});
};
export const getDevices = function getDevices(accountId, accessToken) {
2026-08-24 06:08:38 +00:00
obj = { url: closure_5.PLAYER_DEVICES };
value = obj.get(accountId, accessToken, obj);
2026-07-20 16:05:17 +00:00
return value.then((body) => {
if (body.body) {
const obj2 = { type: "SPOTIFY_SET_DEVICES", accountId, devices: body.body.devices };
DispatcherDefault.dispatch(obj2);
2026-07-20 16:05:17 +00:00
}
return body;
});
};
export const play = function play(arg0, arg1, sync_id, TRACK) {
2026-08-24 06:08:38 +00:00
closure_0 = arg0;
closure_1 = arg1;
const id = sync_id;
2026-08-24 06:08:38 +00:00
obj = arg4;
2026-07-20 16:05:17 +00:00
if (arg4 === undefined) {
obj = {};
}
2026-07-23 10:11:24 +00:00
c5 = undefined;
const PLAYER_OPENResult = c5.PLAYER_OPEN(TRACK, sync_id, false);
const deviceId = obj.deviceId;
const position = obj.position;
2026-07-23 10:11:24 +00:00
({ contextUri, repeat: c5 } = obj);
let request = { url: c5.PLAYER_PLAY, query: { device_id: deviceId }, body: null };
2026-07-20 16:05:17 +00:00
let tmp3;
if (null != contextUri) {
tmp3 = contextUri;
}
let obj2 = { context_uri: tmp3, uris: null, offset: null, position_ms: null };
2026-07-20 16:05:17 +00:00
let tmp4;
if (null == contextUri) {
const items = [PLAYER_OPENResult];
tmp4 = items;
}
obj2.uris = tmp4;
2026-07-20 16:05:17 +00:00
let tmp5;
if (null != contextUri) {
const obj3 = { uri: PLAYER_OPENResult };
tmp5 = obj3;
2026-07-20 16:05:17 +00:00
}
obj2.offset = tmp5;
2026-07-20 16:05:17 +00:00
let num = 0;
if (null != position) {
num = position;
}
obj2.position_ms = num;
request.body = obj2;
let putResult = obj.put(arg0, arg1, request);
return obj.put(arg0, arg1, request).then((result) => {
let putResult = result;
if (null != c5) {
const request = { url: hasOwnProperty.PLAYER_REPEAT, query: null };
const query = { device_id: deviceId, state: null };
2026-07-20 16:05:17 +00:00
let str = "off";
2026-07-29 08:29:29 +00:00
if (tmp2) {
2026-07-20 16:05:17 +00:00
str = "context";
}
query.state = str;
request.query = query;
putResult = query.put(closure_0, closure_1, request);
2026-07-20 16:05:17 +00:00
}
return putResult;
}).then((result) => {
const obj2 = { type: "SPOTIFY_PLAYER_PLAY", id, position: null };
2026-07-20 16:05:17 +00:00
let num = 0;
if (null != position) {
num = position;
}
obj2.position = num;
DispatcherDefault.dispatch(obj2);
return result;
2026-07-20 16:05:17 +00:00
});
};
export const pause = function pause(arg0, arg1) {
obj = { url: hasOwnProperty.PLAYER_PAUSE };
return obj.put(arg0, arg1, obj).then((result) => {
DispatcherDefault.dispatch({ type: "SPOTIFY_PLAYER_PAUSE" });
return result;
2026-07-20 16:05:17 +00:00
});
};
export const fetchIsSpotifyProtocolRegistered = function fetchIsSpotifyProtocolRegistered() {
if (!SpotifyProtocolStore.isProtocolRegistered()) {
2026-07-20 16:05:17 +00:00
if (obj.isDesktop()) {
GameUtilsDefault.isProtocolRegistered(React4).then((isRegistered) => {
DispatcherDefault.dispatch({ type: "SPOTIFY_SET_PROTOCOL_REGISTERED", isRegistered });
2026-07-20 16:05:17 +00:00
});
const isProtocolRegisteredResult = GameUtilsDefault.isProtocolRegistered(React4);
2026-07-20 16:05:17 +00:00
}
obj = PlatformUtils;
2026-07-20 16:05:17 +00:00
}
};
export const setActiveDevice = function setActiveDevice(accountId, deviceId) {
DispatcherDefault.dispatch({ type: "SPOTIFY_SET_ACTIVE_DEVICE", accountId, deviceId });
2026-07-20 16:05:17 +00:00
};