@exezt-/webamp 1.5.0-0x724 → 1.5.0-0x726

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.
@@ -3436,10 +3436,14 @@ module.exports = {
3436
3436
 
3437
3437
  class WinampTelegramCustomHandler {
3438
3438
  constructor(emit, options) {
3439
+ var _window, _window$Telegram;
3440
+
3439
3441
  _babel_runtime_helpers_defineProperty__WEBPACK_IMPORTED_MODULE_0___default()(this, "webamp", void 0);
3440
3442
 
3441
3443
  _babel_runtime_helpers_defineProperty__WEBPACK_IMPORTED_MODULE_0___default()(this, "maxFileSize", 0x1400000);
3442
3444
 
3445
+ _babel_runtime_helpers_defineProperty__WEBPACK_IMPORTED_MODULE_0___default()(this, "applicationStorage", (_window = window) === null || _window === void 0 ? void 0 : (_window$Telegram = _window.Telegram) === null || _window$Telegram === void 0 ? void 0 : _window$Telegram.WebApp.DeviceStorage);
3446
+
3443
3447
  _babel_runtime_helpers_defineProperty__WEBPACK_IMPORTED_MODULE_0___default()(this, "telegram", void 0);
3444
3448
 
3445
3449
  _babel_runtime_helpers_defineProperty__WEBPACK_IMPORTED_MODULE_0___default()(this, "loadCustomTracks", tracks => {
@@ -3449,6 +3453,7 @@ class WinampTelegramCustomHandler {
3449
3453
  });
3450
3454
 
3451
3455
  _babel_runtime_helpers_defineProperty__WEBPACK_IMPORTED_MODULE_0___default()(this, "updateAppState", () => {
3456
+ this.applicationStorage.setItem("appState", JSON.stringify(this.webamp.__getSerializedState()));
3452
3457
  localStorage.setItem("appState", JSON.stringify(this.webamp.__getSerializedState()));
3453
3458
  });
3454
3459
 
@@ -3636,11 +3641,19 @@ class WinampTelegramCustomHandler {
3636
3641
 
3637
3642
  if (typeof localStorage.getItem('app-state') !== "undefined") {
3638
3643
  this.loadOptions(JSON.parse(localStorage.getItem('app-state')));
3644
+ } else {
3645
+ try {
3646
+ typeof this.applicationStorage.getItem("app-state", v => {
3647
+ this.loadOptions(JSON.parse(v));
3648
+ });
3649
+ } catch (e) {
3650
+ console.log(e);
3651
+ }
3639
3652
  } // emit
3640
3653
 
3641
3654
 
3642
3655
  if (emit !== false) {
3643
- var _window, _window$Telegram;
3656
+ var _window2, _window2$Telegram;
3644
3657
 
3645
3658
  const lastList = this.getCookie('lastlist');
3646
3659
 
@@ -3649,13 +3662,13 @@ class WinampTelegramCustomHandler {
3649
3662
  } // @ts-ignore | because no global var telegram avail in project types
3650
3663
 
3651
3664
 
3652
- if (!((_window = window) !== null && _window !== void 0 && (_window$Telegram = _window.Telegram) !== null && _window$Telegram !== void 0 && _window$Telegram.WebApp)) {
3665
+ if (!((_window2 = window) !== null && _window2 !== void 0 && (_window2$Telegram = _window2.Telegram) !== null && _window2$Telegram !== void 0 && _window2$Telegram.WebApp)) {
3653
3666
  console.error("Telegram is undefined!! Skipping Telegram.WebApp event handler...");
3654
3667
  } else {
3655
- var _window2, _window2$Telegram;
3668
+ var _window3, _window3$Telegram;
3656
3669
 
3657
3670
  // @ts-ignore | because no global var telegram avail in project types
3658
- this.telegram = (_window2 = window) === null || _window2 === void 0 ? void 0 : (_window2$Telegram = _window2.Telegram) === null || _window2$Telegram === void 0 ? void 0 : _window2$Telegram.WebApp;
3671
+ this.telegram = (_window3 = window) === null || _window3 === void 0 ? void 0 : (_window3$Telegram = _window3.Telegram) === null || _window3$Telegram === void 0 ? void 0 : _window3$Telegram.WebApp;
3659
3672
  this.initializeTelegramWebAppEvents();
3660
3673
  }
3661
3674