@extscreen/es-core 2.2.28 → 2.2.30

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.
Files changed (2) hide show
  1. package/dist/index.js +242 -84
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -116,23 +116,23 @@ var ESDevelopManager$1 = new ESDevelopManager();
116
116
  */
117
117
  class ESDeviceModule {
118
118
 
119
- getAndroidDevice() {
119
+ getDevice() {
120
120
  return Vue.Native.callNativeWithPromise('AndroidDeviceModule', 'getAndroidDevice');
121
121
  }
122
122
 
123
- getWifiMac() {
124
- return Vue.Native.callNativeWithPromise('AndroidDeviceModule', 'getWifiMac');
123
+ getDeviceEthMac() {
124
+ return Vue.Native.callNativeWithPromise('AndroidDeviceModule', 'getEthMac');
125
125
  }
126
126
 
127
- getEthMac() {
128
- return Vue.Native.callNativeWithPromise('AndroidDeviceModule', 'getEthMac');
127
+ getDeviceWifiMac() {
128
+ return Vue.Native.callNativeWithPromise('AndroidDeviceModule', 'getWifiMac');
129
129
  }
130
130
 
131
- getTotalMemory() {
131
+ getDeviceTotalMemory() {
132
132
  return Vue.Native.callNativeWithPromise('AndroidDeviceModule', 'getTotalMemory');
133
133
  }
134
134
 
135
- getAvailableMemory() {
135
+ getDeviceAvailMemory() {
136
136
  return Vue.Native.callNativeWithPromise('AndroidDeviceModule', 'getAvailableMemory');
137
137
  }
138
138
 
@@ -198,29 +198,6 @@ var ESDeviceModule$1 = new ESDeviceModule();
198
198
  /**
199
199
  * 设备信息管理
200
200
  *
201
- * {
202
- "screenWidth": 1920,
203
- "clientType": "MiBOX4",
204
- "buildBoard": "transformers",
205
- "scaledDensity": "1.0",
206
- "mac": null,
207
- "uuid": null,
208
- "buildVersionRelease": "6.0.1",
209
- "buildManufacturer": "Xiaomi",
210
- "windowWidth": 0,
211
- "density": "1.0",
212
- "buildDevice": "transformers",
213
- "availableMemory": 0,
214
- "buildHardware": "amlogic",
215
- "screenHeight": 1080,
216
- "buildModel": "MiBOX4",
217
- "buildBrand": null,
218
- "densityDpi": "160.0",
219
- "resolution": "1920*1080",
220
- "totalMemory": 0,
221
- "buildProduct": "transformers"
222
- }
223
-
224
201
  */
225
202
  class ESDeviceManager {
226
203
 
@@ -254,23 +231,37 @@ class ESDeviceManager {
254
231
  _buildDevice = '';
255
232
  _buildProduct = '';
256
233
  _buildHardware = '';
257
- _buildSDKVersion = 1;
234
+
235
+ _buildBoard = '';
236
+ _buildTags = '';
237
+ _buildId = '';
238
+ _buildTime = '';
239
+ _buildType = '';
240
+ _buildUser = '';
241
+ _buildBootloader = '';
242
+ _buildDisplay = '';
243
+ _buildFingerPrint = '';
244
+ _buildVersionIncremental = '';
245
+ _buildVersionBaseOS = '';
246
+ _buildVersionCodeName = '';
247
+ _buildVersionSecurityPatch = '';
248
+ _buildVersionPreviewSDKInt = '';
249
+ _buildVersionSDKInt = '';
258
250
 
259
251
  _device = null;
260
252
 
261
253
  init() {
262
254
  return new Promise((resolve, reject) => {
263
255
  this.initAndroidDevice();
264
- ESDeviceModule$1.getAndroidDevice().then(
256
+ ESDeviceModule$1.getDevice().then(
265
257
  (device) => {
266
258
  this._device = device;
267
259
 
268
260
  try {
269
261
  if (device) {
270
- this._buildSDKVersion = device.buildSDKVersion;
271
262
 
272
263
  this._deviceId = device.deviceId;
273
- this._deviceType = device._deviceType;
264
+ this._deviceType = device.deviceType;
274
265
 
275
266
  this._deviceEthMac = device.ethMac;
276
267
  this._deviceWifiMac = device.wifiMac;
@@ -286,20 +277,35 @@ class ESDeviceManager {
286
277
  this._densityDpi = device.densityDpi;
287
278
  this._scaledDensity = device.scaledDensity;
288
279
 
289
- this._buildVersionRelease = device.buildVersionRelease;
280
+ this._ipAddress = device.ipAddress;
281
+
290
282
  this._buildModel = device.buildModel;
291
283
  this._buildBrand = device.buildBrand;
284
+ this._buildBoard = device.buildBoard;
292
285
  this._buildDevice = device.buildDevice;
293
286
  this._buildProduct = device.buildProduct;
294
287
  this._buildHardware = device.buildHardware;
295
288
  this._buildManufacturer = device.buildManufacturer;
296
289
  this._buildSerial = device.buildSerial;
297
290
 
298
- this._ipAddress = device.ipAddress;
291
+ this._buildTags = device.buildTags;
292
+ this._buildId = device.buildId;
293
+ this._buildTime = device.buildTime;
294
+ this._buildType = device.buildType;
295
+ this._buildUser = device.buildUser;
296
+ this._buildBootloader = device.buildBootloader;
297
+ this._buildDisplay = device.buildDisplay;
298
+ this._buildFingerPrint = device.buildFingerPrint;
299
+ this._buildVersionIncremental = device.buildVersionIncremental;
300
+ this._buildVersionBaseOS = device.buildVersionBaseOS;
301
+ this._buildVersionCodeName = device.buildVersionCodeName;
302
+ this._buildVersionSecurityPatch = device.buildVersionSecurityPatch;
303
+ this._buildVersionPreviewSDKInt = device.buildVersionPreviewSDKInt;
304
+ this._buildVersionSDKInt = device.buildVersionSDKInt;
305
+ this._buildVersionRelease = device.buildVersionRelease;
299
306
  }
300
307
  } catch (e) {
301
308
  }
302
-
303
309
  resolve(device);
304
310
  },
305
311
  //
@@ -323,24 +329,17 @@ class ESDeviceManager {
323
329
  return this._androidAPILevel;
324
330
  }
325
331
 
326
- getDeviceTotalMemory() {
327
- return this._totalMemory;
328
- }
329
-
330
- getDeviceAvailMemory() {
331
- return this._availMemory;
332
- }
333
-
334
332
  getDevice() {
335
333
  return this._device;
336
334
  }
337
335
 
338
- getBuildVersionRelease() {
339
- return this._buildVersionRelease;
336
+
337
+ getDeviceId() {
338
+ return this._deviceId;
340
339
  }
341
340
 
342
- getBuildManufacturer() {
343
- return this._buildManufacturer;
341
+ getDeviceType() {
342
+ return this._deviceType;
344
343
  }
345
344
 
346
345
  getDeviceEthMac() {
@@ -351,32 +350,53 @@ class ESDeviceManager {
351
350
  return this._deviceWifiMac;
352
351
  }
353
352
 
354
- getDeviceId() {
355
- return this._deviceId;
353
+ getDeviceTotalMemory() {
354
+ return this._totalMemory;
356
355
  }
357
356
 
358
- getDeviceType() {
359
- return this._deviceType;
357
+ getDeviceAvailMemory() {
358
+ return this._availMemory;
359
+ }
360
+
361
+
362
+ getScreenWidth() {
363
+ return this._screenWidth;
364
+ }
365
+
366
+ getScreenHeight() {
367
+ return this._screenHeight
360
368
  }
361
369
 
362
370
  getResolution() {
363
371
  return this._resolution;
364
372
  }
365
373
 
366
- getIpAddress() {
374
+ getDensity() {
375
+ return this._density;
376
+ }
377
+
378
+ getDensityDpi() {
379
+ return this._densityDpi;
380
+ }
381
+
382
+ getScaledDensity() {
383
+ return this._scaledDensity;
384
+ }
385
+
386
+ getIPAddress() {
367
387
  return this._ipAddress;
368
388
  }
369
389
 
370
- getBuildSerial() {
371
- return this._buildSerial;
390
+ getBuildModel() {
391
+ return this._buildModel;
372
392
  }
373
393
 
374
394
  getBuildBrand() {
375
395
  return this._buildBrand;
376
396
  }
377
397
 
378
- getBuildModel() {
379
- return this._buildModel;
398
+ getBuildBoard() {
399
+ return this._buildBoard;
380
400
  }
381
401
 
382
402
  getBuildDevice() {
@@ -391,28 +411,73 @@ class ESDeviceManager {
391
411
  return this._buildHardware;
392
412
  }
393
413
 
394
- getBuildSDKVersion() {
395
- return this._buildSDKVersion;
414
+ getBuildManufacturer() {
415
+ return this._buildManufacturer;
396
416
  }
397
417
 
398
- getScreenWidth() {
399
- return this._screenWidth;
418
+ getBuildSerial() {
419
+ return this._buildSerial;
400
420
  }
401
421
 
402
- getScreenHeight() {
403
- return this._screenHeight
422
+ getBuildTags() {
423
+ return this._buildTags;
404
424
  }
405
425
 
406
- getDensity() {
407
- return this._density;
426
+ getBuildId() {
427
+ return this._buildId;
408
428
  }
409
429
 
410
- getDensityDpi() {
411
- return this._densityDpi;
430
+ getBuildTime() {
431
+ return this._buildTime;
412
432
  }
413
433
 
414
- getScaledDensity() {
415
- return this._scaledDensity;
434
+ getBuildType() {
435
+ return this._buildType;
436
+ }
437
+
438
+ getBuildUser() {
439
+ return this._buildUser;
440
+ }
441
+
442
+ getBuildBootloader() {
443
+ return this._buildBootloader;
444
+ }
445
+
446
+ getBuildDisplay() {
447
+ return this._buildDisplay;
448
+ }
449
+
450
+
451
+ getBuildFingerPrint() {
452
+ return this._buildFingerPrint;
453
+ }
454
+
455
+ getBuildVersionIncremental() {
456
+ return this._buildVersionIncremental;
457
+ }
458
+
459
+ getBuildVersionBaseOS() {
460
+ return this._buildVersionBaseOS;
461
+ }
462
+
463
+ getBuildVersionCodeName() {
464
+ return this._buildVersionCodeName;
465
+ }
466
+
467
+ getBuildVersionSecurityPatch() {
468
+ return this._buildVersionSecurityPatch;
469
+ }
470
+
471
+ getBuildVersionPreviewSDKInt() {
472
+ return this._buildVersionPreviewSDKInt;
473
+ }
474
+
475
+ getBuildVersionSDKInt() {
476
+ return this._buildVersionSDKInt;
477
+ }
478
+
479
+ getBuildVersionRelease() {
480
+ return this._buildVersionRelease;
416
481
  }
417
482
  }
418
483
 
@@ -1662,50 +1727,86 @@ var ESSharedPreferencesModule$1 = new ESSharedPreferencesModule();
1662
1727
 
1663
1728
  class ESSharedPreferencesManager {
1664
1729
 
1730
+ _sharedPreferencesName = ''
1731
+
1665
1732
  init() {
1666
1733
  return Promise.resolve();
1667
1734
  }
1668
1735
 
1669
1736
  initSharedPreferences(name) {
1737
+ this._sharedPreferencesName = name;
1670
1738
  return ESSharedPreferencesModule$1.initSharedPreferences(name);
1671
1739
  }
1672
1740
 
1673
1741
  //----------------------------------------------------
1674
1742
  getBoolean(key, defValue) {
1675
- return ESSharedPreferencesModule$1.getBoolean(key, defValue);
1743
+ if (!this._sharedPreferencesName) {
1744
+ return Promise.reject('sharedPreferencesName is null');
1745
+ }
1746
+ return ESSharedPreferencesModule$1.initSharedPreferences(this._sharedPreferencesName)
1747
+ .then(() => ESSharedPreferencesModule$1.getBoolean(key, defValue));
1676
1748
  }
1677
1749
 
1678
1750
  putBoolean(key, value) {
1679
- return ESSharedPreferencesModule$1.putBoolean(key, value);
1751
+ if (!this._sharedPreferencesName) {
1752
+ return Promise.reject('sharedPreferencesName is null');
1753
+ }
1754
+ return ESSharedPreferencesModule$1.initSharedPreferences(this._sharedPreferencesName)
1755
+ .then(() => ESSharedPreferencesModule$1.putBoolean(key, value));
1680
1756
  }
1681
1757
 
1682
1758
  //----------------------------------------------------
1683
1759
 
1684
1760
  getInt(key, defValue) {
1685
- return ESSharedPreferencesModule$1.getInt(key, defValue);
1761
+ if (!this._sharedPreferencesName) {
1762
+ return Promise.reject('sharedPreferencesName is null');
1763
+ }
1764
+ return ESSharedPreferencesModule$1.initSharedPreferences(this._sharedPreferencesName)
1765
+ .then(() => ESSharedPreferencesModule$1.getInt(key, defValue));
1686
1766
  }
1687
1767
 
1688
1768
  putInt(key, value) {
1689
- return ESSharedPreferencesModule$1.putInt(key, value);
1769
+ if (!this._sharedPreferencesName) {
1770
+ return Promise.reject('sharedPreferencesName is null');
1771
+ }
1772
+
1773
+ return ESSharedPreferencesModule$1.initSharedPreferences(this._sharedPreferencesName)
1774
+ .then(() => ESSharedPreferencesModule$1.putInt(key, value));
1690
1775
  }
1691
1776
 
1692
1777
  //----------------------------------------------------
1693
1778
 
1694
1779
  getLong(key, defValue) {
1695
- return ESSharedPreferencesModule$1.getLong(key, defValue);
1780
+ if (!this._sharedPreferencesName) {
1781
+ return Promise.reject('sharedPreferencesName is null');
1782
+ }
1783
+ return ESSharedPreferencesModule$1.initSharedPreferences(this._sharedPreferencesName)
1784
+ .then(() => ESSharedPreferencesModule$1.getLong(key, defValue));
1696
1785
  }
1697
1786
 
1698
1787
  putLong(key, value) {
1699
- return ESSharedPreferencesModule$1.putLong(key, value);
1788
+ if (!this._sharedPreferencesName) {
1789
+ return Promise.reject('sharedPreferencesName is null');
1790
+ }
1791
+ return ESSharedPreferencesModule$1.initSharedPreferences(this._sharedPreferencesName)
1792
+ .then(() => ESSharedPreferencesModule$1.putLong(key, value));
1700
1793
  }
1701
1794
 
1702
1795
  //----------------------------------------------------
1703
1796
  getString(key, defValue) {
1704
- return ESSharedPreferencesModule$1.getString(key, defValue);
1797
+ if (!this._sharedPreferencesName) {
1798
+ return Promise.reject('sharedPreferencesName is null');
1799
+ }
1800
+ return ESSharedPreferencesModule$1.initSharedPreferences(this._sharedPreferencesName)
1801
+ .then(() => ESSharedPreferencesModule$1.getString(key, defValue));
1705
1802
  }
1706
1803
 
1707
1804
  putString(key, value) {
1708
- return ESSharedPreferencesModule$1.putString(key, value);
1805
+ if (!this._sharedPreferencesName) {
1806
+ return Promise.reject('sharedPreferencesName is null');
1807
+ }
1808
+ return ESSharedPreferencesModule$1.initSharedPreferences(this._sharedPreferencesName)
1809
+ .then(() => ESSharedPreferencesModule$1.putString(key, value));
1709
1810
  }
1710
1811
 
1711
1812
  //----------------------------------------------------
@@ -2282,6 +2383,8 @@ class ESLaunchManager {
2282
2383
  _ESPageRouterViewSupported = false;
2283
2384
  _launchLimit = 10;
2284
2385
 
2386
+ _routeListener = null;
2387
+
2285
2388
  init(router) {
2286
2389
  try {
2287
2390
  this._ESRouter = router;
@@ -2338,6 +2441,22 @@ class ESLaunchManager {
2338
2441
  }
2339
2442
  }
2340
2443
 
2444
+ //-----------------------------------------------------------
2445
+ setRouteListener(routeListener) {
2446
+ this._routeListener = routeListener;
2447
+ }
2448
+
2449
+ _notifyListeners(url, params) {
2450
+ if (this._routeListener && this.isFunction(this._routeListener)) {
2451
+ this._routeListener(url, params);
2452
+ }
2453
+ }
2454
+
2455
+ isFunction(func) {
2456
+ return Object.prototype.toString.call(func) === '[object Function]';
2457
+ }
2458
+
2459
+ //-----------------------------------------------------------
2341
2460
  launchNativeApp(paramsArray) {
2342
2461
  return ESModule$1.launchNativeApp(paramsArray);
2343
2462
  }
@@ -2349,25 +2468,46 @@ class ESLaunchManager {
2349
2468
  }
2350
2469
 
2351
2470
  launchESPage(intent) {
2471
+ if (!intent || !intent.url) {
2472
+ return;
2473
+ }
2474
+ let url = intent.url;
2475
+ let params = intent.params;
2476
+
2352
2477
  if (this.isESRouterEnabled()
2353
2478
  && this.isESRouterSupported()
2354
2479
  && this._ESRouter) {
2480
+ //
2481
+ this._notifyListeners(url, params);
2482
+ //
2355
2483
  this._ESRouter.push({
2356
- name: intent.url,
2357
- params: intent.params,
2484
+ name: url,
2485
+ params: params,
2358
2486
  });
2359
2487
  }
2360
2488
  //
2361
2489
  else {
2490
+ //
2491
+ this._notifyListeners(url, params);
2492
+ //
2362
2493
  this.launchNativePage(intent);
2363
2494
  }
2364
2495
  }
2365
2496
 
2366
2497
  launchAfterFinishESPage(intent) {
2498
+ if (!intent || !intent.url) {
2499
+ return;
2500
+ }
2501
+ let url = intent.url;
2502
+ let params = intent.params;
2503
+
2367
2504
  if (this.isESRouterEnabled()
2368
2505
  && this.isESRouterSupported()
2369
2506
  && this._ESRouter) {
2370
2507
  this._ESRouter.back();
2508
+ //
2509
+ this._notifyListeners(url, params);
2510
+
2371
2511
  this._ESRouter.push({
2372
2512
  name: intent.url,
2373
2513
  params: intent.params,
@@ -2383,6 +2523,9 @@ class ESLaunchManager {
2383
2523
  }
2384
2524
  //1.finish
2385
2525
  ESModule$1.finish();
2526
+ //
2527
+ this._notifyListeners(url, params);
2528
+
2386
2529
  //2.launch
2387
2530
  this.launchNativePage(intent);
2388
2531
  }
@@ -4192,13 +4335,20 @@ var ESApplication = {
4192
4335
  })
4193
4336
  )
4194
4337
  .then((result) => {
4195
- this._initESAppParams();
4338
+ this._initESApplication();
4196
4339
  },
4197
4340
  error => {
4198
- this._initESAppParams();
4341
+ this._initESApplication();
4199
4342
  }
4200
4343
  );
4201
4344
  },
4345
+ _initESApplication() {
4346
+ ESLaunchManager$1.setRouteListener(this._routeListener);
4347
+ this._initESAppParams();
4348
+ },
4349
+ _routeListener(url, params) {
4350
+ this.onLaunchESPage(url, params);
4351
+ },
4202
4352
  _initESAppParams() {
4203
4353
  //
4204
4354
  this.appInitProps = ESApp.$options.$superProps;
@@ -4246,13 +4396,17 @@ var ESApplication = {
4246
4396
  this._initPage();
4247
4397
  }
4248
4398
  );
4249
- } else {
4399
+ }
4400
+ //
4401
+ else {
4250
4402
  if (ESLog.isLoggable(ESLog.DEBUG)) {
4251
4403
  ESLog.d(TAG, '---------onESCreate--return-Not Promise----->>>>');
4252
4404
  }
4253
4405
  this._initPage();
4254
4406
  }
4255
- } else {
4407
+ }
4408
+ //
4409
+ else {
4256
4410
  if (ESLog.isLoggable(ESLog.DEBUG)) {
4257
4411
  ESLog.d(TAG, '---------onESCreate---Not Function----->>>>');
4258
4412
  }
@@ -4290,6 +4444,10 @@ var ESApplication = {
4290
4444
  }
4291
4445
  return false;
4292
4446
  },
4447
+ //---------------------------下面的方法给使用者覆写-----------------------------
4448
+ onLaunchESPage(url, params) {
4449
+
4450
+ }
4293
4451
  },
4294
4452
  };
4295
4453
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@extscreen/es-core",
3
- "version": "2.2.28",
3
+ "version": "2.2.30",
4
4
  "description": "",
5
5
  "main": "dist/index.js",
6
6
  "scripts": {