@exezt-/webamp 1.5.0-0x724 → 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.
@@ -3436,10 +3436,14 @@ module.exports = {
3436
3436
 
3437
3437
  class WinampTelegramCustomHandler {
3438
3438
  constructor(emit, options) {
3439
+ var _window$Telegram$WebA, _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$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);
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,17 @@ 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) {}
3639
3650
  } // emit
3640
3651
 
3641
3652
 
3642
3653
  if (emit !== false) {
3643
- var _window, _window$Telegram;
3654
+ var _window2, _window2$Telegram;
3644
3655
 
3645
3656
  const lastList = this.getCookie('lastlist');
3646
3657
 
@@ -3649,13 +3660,13 @@ class WinampTelegramCustomHandler {
3649
3660
  } // @ts-ignore | because no global var telegram avail in project types
3650
3661
 
3651
3662
 
3652
- if (!((_window = window) !== null && _window !== void 0 && (_window$Telegram = _window.Telegram) !== null && _window$Telegram !== void 0 && _window$Telegram.WebApp)) {
3663
+ if (!((_window2 = window) !== null && _window2 !== void 0 && (_window2$Telegram = _window2.Telegram) !== null && _window2$Telegram !== void 0 && _window2$Telegram.WebApp)) {
3653
3664
  console.error("Telegram is undefined!! Skipping Telegram.WebApp event handler...");
3654
3665
  } else {
3655
- var _window2, _window2$Telegram;
3666
+ var _window3, _window3$Telegram;
3656
3667
 
3657
3668
  // @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;
3669
+ 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
3670
  this.initializeTelegramWebAppEvents();
3660
3671
  }
3661
3672