@alfalab/bridge-to-native 1.3.2-beta.0828f8f → 1.3.2-beta.9b534a8

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.
@@ -1,5 +1,5 @@
1
1
  "use strict";
2
- /* eslint max-lines: ["error", {"max": 360, "skipComments": true}] */
2
+ /* eslint max-lines: ["error", {"max": 400, "skipComments": true}] */
3
3
  Object.defineProperty(exports, "__esModule", { value: true });
4
4
  exports.NativeNavigationAndTitleService = void 0;
5
5
  const query_and_headers_keys_1 = require("../../query-and-headers-keys");
@@ -148,20 +148,26 @@ class NativeNavigationAndTitleService {
148
148
  initializeNativeHistoryStack() {
149
149
  const { nextPageId, title } = this.nativeParamsService;
150
150
  const hasSS = this.hasSavedHistoryStack();
151
+ console.log('-------');
152
+ console.log('Инициализируюсь');
151
153
  if (nextPageId && !hasSS) {
152
154
  // есть nextPageId + нет SS → на этом origin ранее не были.
155
+ console.log('есть nextPageId + нет SS → на этом origin ранее не были.');
153
156
  this.nativeHistoryStack = this.initializeForNewOrigin(nextPageId, title);
154
157
  }
155
158
  else if (nextPageId && hasSS) {
156
159
  // есть nextPageId + есть SS → forward навигация.
160
+ console.log('есть nextPageId + есть SS → forward навигация.');
157
161
  this.nativeHistoryStack = this.initializeForForward(nextPageId, title);
158
162
  }
159
163
  else if (!nextPageId && hasSS) {
160
164
  // нет nextPageId + есть SS → back-навигация или reload.
165
+ console.log('нет nextPageId + есть SS → back-навигация или reload.');
161
166
  this.nativeHistoryStack = this.initializeFromBackwardOrReload(title);
162
167
  }
163
168
  else {
164
169
  // нет nextPageId + нет SS → старт нового WV, назад идти некуда.
170
+ console.log('нет nextPageId + нет SS → старт нового WV, назад идти некуда.');
165
171
  this.nativeHistoryStack = [title];
166
172
  }
167
173
  this.saveNativeHistoryStack();
@@ -171,6 +177,8 @@ class NativeNavigationAndTitleService {
171
177
  initializeForNewOrigin(nextPageId, title) {
172
178
  const stack = new Array(nextPageId).fill(0 /* NativeHistoryStackSpecialValues.ServerSideNavigationStub */);
173
179
  stack[stack.length - 1] = title;
180
+ console.log('nextPageId', nextPageId);
181
+ console.log('newStack', stack);
174
182
  return stack;
175
183
  }
176
184
  initializeForForward(nextPageId, title) {
@@ -184,10 +192,14 @@ class NativeNavigationAndTitleService {
184
192
  stack[i] = savedStack[i];
185
193
  }
186
194
  stack[stack.length - 1] = title;
195
+ console.log('nextPageId', nextPageId);
196
+ console.log('newStack', stack);
187
197
  return stack;
188
198
  }
189
199
  if (savedStack.length === nextPageId) {
190
200
  savedStack[savedStack.length - 1] = title;
201
+ console.log('nextPageId', nextPageId);
202
+ console.log('newStack', savedStack);
191
203
  return savedStack;
192
204
  }
193
205
  return this.initializeForNewOrigin(nextPageId, title);
@@ -203,17 +215,22 @@ class NativeNavigationAndTitleService {
203
215
  if (lastEntry === 1 /* NativeHistoryStackSpecialValues.TemporaryReloadStub */) {
204
216
  savedStack.pop();
205
217
  if (savedStack.length === 0) {
218
+ console.log('newStack', [title]);
206
219
  return [title];
207
220
  }
221
+ console.log('newStack', savedStack);
208
222
  return savedStack;
209
223
  }
210
224
  if (this.stackContainsCrossOriginMarker(savedStack)) {
225
+ console.log('newStack', this.truncateToLastCrossOriginMarker(savedStack));
211
226
  return this.truncateToLastCrossOriginMarker(savedStack);
212
227
  }
213
228
  savedStack.pop();
214
229
  if (savedStack.length === 0) {
230
+ console.log('newStack', [title]);
215
231
  return [title];
216
232
  }
233
+ console.log('newStack', savedStack);
217
234
  return savedStack;
218
235
  }
219
236
  catch (_a) {
@@ -243,6 +260,7 @@ class NativeNavigationAndTitleService {
243
260
  if (!serialized) {
244
261
  throw new Error(`${query_and_headers_keys_1.SS_KEY_BRIDGE_TO_NATIVE_HISTORY_STACK} sessionStorage expected not to be null`);
245
262
  }
263
+ console.log('serializedStack', serialized);
246
264
  return JSON.parse(serialized);
247
265
  }
248
266
  catch (e) {
@@ -282,6 +300,10 @@ class NativeNavigationAndTitleService {
282
300
  */
283
301
  saveNativeHistoryStack() {
284
302
  const serializedNativeHistoryStack = JSON.stringify(this.nativeHistoryStack);
303
+ console.log('-------');
304
+ console.log('сохраняю стек');
305
+ console.log('стек', this.nativeHistoryStack);
306
+ console.log('сериализованный стек', serializedNativeHistoryStack);
285
307
  sessionStorage.setItem(query_and_headers_keys_1.SS_KEY_BRIDGE_TO_NATIVE_HISTORY_STACK, serializedNativeHistoryStack);
286
308
  }
287
309
  /**
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@alfalab/bridge-to-native",
3
- "version": "1.3.2-beta.0828f8f",
3
+ "version": "1.3.2-beta.9b534a8",
4
4
  "license": "MIT",
5
5
  "description": "Утилита для удобной работы веб приложения внутри нативного приложения и коммуникации с ним.",
6
6
  "engines": {