@exezt-/webamp 1.5.0-0x723 → 1.5.0-0x725

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -7331,10 +7331,14 @@ if (typeof Object.create === 'function') {
7331
7331
 
7332
7332
  class WinampTelegramCustomHandler {
7333
7333
  constructor(emit, options) {
7334
+ var _window$Telegram$WebA, _window, _window$Telegram;
7335
+
7334
7336
  _babel_runtime_helpers_defineProperty__WEBPACK_IMPORTED_MODULE_0___default()(this, "webamp", void 0);
7335
7337
 
7336
7338
  _babel_runtime_helpers_defineProperty__WEBPACK_IMPORTED_MODULE_0___default()(this, "maxFileSize", 0x1400000);
7337
7339
 
7340
+ _babel_runtime_helpers_defineProperty__WEBPACK_IMPORTED_MODULE_0___default()(this, "applicationStorage", (_window$Telegram$WebA = (_window = window) === null || _window === void 0 ? void 0 : (_window$Telegram = _window.Telegram) === null || _window$Telegram === void 0 ? void 0 : _window$Telegram.WebApp.DeviceStorage) !== null && _window$Telegram$WebA !== void 0 ? _window$Telegram$WebA : window.localStorage);
7341
+
7338
7342
  _babel_runtime_helpers_defineProperty__WEBPACK_IMPORTED_MODULE_0___default()(this, "telegram", void 0);
7339
7343
 
7340
7344
  _babel_runtime_helpers_defineProperty__WEBPACK_IMPORTED_MODULE_0___default()(this, "loadCustomTracks", tracks => {
@@ -7344,6 +7348,7 @@ class WinampTelegramCustomHandler {
7344
7348
  });
7345
7349
 
7346
7350
  _babel_runtime_helpers_defineProperty__WEBPACK_IMPORTED_MODULE_0___default()(this, "updateAppState", () => {
7351
+ this.applicationStorage.setItem("appState", JSON.stringify(this.webamp.__getSerializedState()));
7347
7352
  localStorage.setItem("appState", JSON.stringify(this.webamp.__getSerializedState()));
7348
7353
  });
7349
7354
 
@@ -7453,7 +7458,7 @@ class WinampTelegramCustomHandler {
7453
7458
  });
7454
7459
 
7455
7460
  _babel_runtime_helpers_defineProperty__WEBPACK_IMPORTED_MODULE_0___default()(this, "saveLastPlaylist", playlistLink => {
7456
- document.cookie = `lastlist=${playlistLink}; path=/;`;
7461
+ document.cookie = `lastlist=${playlistLink}; path=/; expires=Tue, 19 Jan 2038 03:14:07 GMT; domain=win-amp.ru; secure`;
7457
7462
  });
7458
7463
 
7459
7464
  _babel_runtime_helpers_defineProperty__WEBPACK_IMPORTED_MODULE_0___default()(this, "getCookie", name => {
@@ -7531,11 +7536,17 @@ class WinampTelegramCustomHandler {
7531
7536
 
7532
7537
  if (typeof localStorage.getItem('app-state') !== "undefined") {
7533
7538
  this.loadOptions(JSON.parse(localStorage.getItem('app-state')));
7539
+ } else {
7540
+ try {
7541
+ typeof this.applicationStorage.getItem("app-state", v => {
7542
+ this.loadOptions(JSON.parse(v));
7543
+ });
7544
+ } catch (e) {}
7534
7545
  } // emit
7535
7546
 
7536
7547
 
7537
7548
  if (emit !== false) {
7538
- var _window, _window$Telegram;
7549
+ var _window2, _window2$Telegram;
7539
7550
 
7540
7551
  const lastList = this.getCookie('lastlist');
7541
7552
 
@@ -7544,13 +7555,13 @@ class WinampTelegramCustomHandler {
7544
7555
  } // @ts-ignore | because no global var telegram avail in project types
7545
7556
 
7546
7557
 
7547
- if (!((_window = window) !== null && _window !== void 0 && (_window$Telegram = _window.Telegram) !== null && _window$Telegram !== void 0 && _window$Telegram.WebApp)) {
7558
+ if (!((_window2 = window) !== null && _window2 !== void 0 && (_window2$Telegram = _window2.Telegram) !== null && _window2$Telegram !== void 0 && _window2$Telegram.WebApp)) {
7548
7559
  console.error("Telegram is undefined!! Skipping Telegram.WebApp event handler...");
7549
7560
  } else {
7550
- var _window2, _window2$Telegram;
7561
+ var _window3, _window3$Telegram;
7551
7562
 
7552
7563
  // @ts-ignore | because no global var telegram avail in project types
7553
- this.telegram = (_window2 = window) === null || _window2 === void 0 ? void 0 : (_window2$Telegram = _window2.Telegram) === null || _window2$Telegram === void 0 ? void 0 : _window2$Telegram.WebApp;
7564
+ this.telegram = (_window3 = window) === null || _window3 === void 0 ? void 0 : (_window3$Telegram = _window3.Telegram) === null || _window3$Telegram === void 0 ? void 0 : _window3$Telegram.WebApp;
7554
7565
  this.initializeTelegramWebAppEvents();
7555
7566
  }
7556
7567