@appzung/react-native-code-push 10.1.1 → 10.1.2

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 (91) hide show
  1. package/lib/commonjs/CodePush.js +5 -0
  2. package/lib/commonjs/CodePush.js.map +1 -1
  3. package/lib/commonjs/checkForUpdates.js +2 -1
  4. package/lib/commonjs/checkForUpdates.js.map +1 -1
  5. package/lib/commonjs/enums/LogLevel.enum.js +14 -0
  6. package/lib/commonjs/enums/LogLevel.enum.js.map +1 -0
  7. package/lib/commonjs/index.js +24 -0
  8. package/lib/commonjs/index.js.map +1 -1
  9. package/lib/commonjs/internals/RemotePackageImplementation.js +2 -1
  10. package/lib/commonjs/internals/RemotePackageImplementation.js.map +1 -1
  11. package/lib/commonjs/internals/shouldUpdateBeIgnored.js +6 -5
  12. package/lib/commonjs/internals/shouldUpdateBeIgnored.js.map +1 -1
  13. package/lib/commonjs/internals/utils/log.js +6 -1
  14. package/lib/commonjs/internals/utils/log.js.map +1 -1
  15. package/lib/commonjs/internals/utils/requestFetchAdapter.js +5 -0
  16. package/lib/commonjs/internals/utils/requestFetchAdapter.js.map +1 -1
  17. package/lib/commonjs/internals/version.js +1 -1
  18. package/lib/commonjs/logLevel.js +15 -0
  19. package/lib/commonjs/logLevel.js.map +1 -0
  20. package/lib/commonjs/notifyAppReady.js +13 -6
  21. package/lib/commonjs/notifyAppReady.js.map +1 -1
  22. package/lib/commonjs/sync.js +27 -24
  23. package/lib/commonjs/sync.js.map +1 -1
  24. package/lib/module/CodePush.js +5 -0
  25. package/lib/module/CodePush.js.map +1 -1
  26. package/lib/module/checkForUpdates.js +2 -1
  27. package/lib/module/checkForUpdates.js.map +1 -1
  28. package/lib/module/enums/LogLevel.enum.js +10 -0
  29. package/lib/module/enums/LogLevel.enum.js.map +1 -0
  30. package/lib/module/index.js +2 -0
  31. package/lib/module/index.js.map +1 -1
  32. package/lib/module/internals/RemotePackageImplementation.js +2 -1
  33. package/lib/module/internals/RemotePackageImplementation.js.map +1 -1
  34. package/lib/module/internals/shouldUpdateBeIgnored.js +6 -5
  35. package/lib/module/internals/shouldUpdateBeIgnored.js.map +1 -1
  36. package/lib/module/internals/utils/log.js +7 -1
  37. package/lib/module/internals/utils/log.js.map +1 -1
  38. package/lib/module/internals/utils/requestFetchAdapter.js +5 -0
  39. package/lib/module/internals/utils/requestFetchAdapter.js.map +1 -1
  40. package/lib/module/internals/version.js +1 -1
  41. package/lib/module/logLevel.js +9 -0
  42. package/lib/module/logLevel.js.map +1 -0
  43. package/lib/module/notifyAppReady.js +13 -6
  44. package/lib/module/notifyAppReady.js.map +1 -1
  45. package/lib/module/sync.js +27 -24
  46. package/lib/module/sync.js.map +1 -1
  47. package/lib/typescript/commonjs/src/CodePush.d.ts.map +1 -1
  48. package/lib/typescript/commonjs/src/checkForUpdates.d.ts.map +1 -1
  49. package/lib/typescript/commonjs/src/enums/LogLevel.enum.d.ts +7 -0
  50. package/lib/typescript/commonjs/src/enums/LogLevel.enum.d.ts.map +1 -0
  51. package/lib/typescript/commonjs/src/index.d.ts +2 -0
  52. package/lib/typescript/commonjs/src/index.d.ts.map +1 -1
  53. package/lib/typescript/commonjs/src/internals/RemotePackageImplementation.d.ts.map +1 -1
  54. package/lib/typescript/commonjs/src/internals/shouldUpdateBeIgnored.d.ts.map +1 -1
  55. package/lib/typescript/commonjs/src/internals/utils/log.d.ts +2 -1
  56. package/lib/typescript/commonjs/src/internals/utils/log.d.ts.map +1 -1
  57. package/lib/typescript/commonjs/src/internals/utils/requestFetchAdapter.d.ts.map +1 -1
  58. package/lib/typescript/commonjs/src/internals/version.d.ts +1 -1
  59. package/lib/typescript/commonjs/src/logLevel.d.ts +4 -0
  60. package/lib/typescript/commonjs/src/logLevel.d.ts.map +1 -0
  61. package/lib/typescript/commonjs/src/notifyAppReady.d.ts.map +1 -1
  62. package/lib/typescript/commonjs/src/sync.d.ts.map +1 -1
  63. package/lib/typescript/module/src/CodePush.d.ts.map +1 -1
  64. package/lib/typescript/module/src/checkForUpdates.d.ts.map +1 -1
  65. package/lib/typescript/module/src/enums/LogLevel.enum.d.ts +7 -0
  66. package/lib/typescript/module/src/enums/LogLevel.enum.d.ts.map +1 -0
  67. package/lib/typescript/module/src/index.d.ts +2 -0
  68. package/lib/typescript/module/src/index.d.ts.map +1 -1
  69. package/lib/typescript/module/src/internals/RemotePackageImplementation.d.ts.map +1 -1
  70. package/lib/typescript/module/src/internals/shouldUpdateBeIgnored.d.ts.map +1 -1
  71. package/lib/typescript/module/src/internals/utils/log.d.ts +2 -1
  72. package/lib/typescript/module/src/internals/utils/log.d.ts.map +1 -1
  73. package/lib/typescript/module/src/internals/utils/requestFetchAdapter.d.ts.map +1 -1
  74. package/lib/typescript/module/src/internals/version.d.ts +1 -1
  75. package/lib/typescript/module/src/logLevel.d.ts +4 -0
  76. package/lib/typescript/module/src/logLevel.d.ts.map +1 -0
  77. package/lib/typescript/module/src/notifyAppReady.d.ts.map +1 -1
  78. package/lib/typescript/module/src/sync.d.ts.map +1 -1
  79. package/package.json +1 -1
  80. package/src/CodePush.tsx +6 -0
  81. package/src/checkForUpdates.ts +2 -1
  82. package/src/enums/LogLevel.enum.ts +6 -0
  83. package/src/index.ts +2 -0
  84. package/src/internals/RemotePackageImplementation.ts +2 -1
  85. package/src/internals/shouldUpdateBeIgnored.ts +6 -5
  86. package/src/internals/utils/log.ts +9 -1
  87. package/src/internals/utils/requestFetchAdapter.ts +8 -0
  88. package/src/internals/version.ts +1 -1
  89. package/src/logLevel.ts +9 -0
  90. package/src/notifyAppReady.ts +15 -5
  91. package/src/sync.ts +33 -23
@@ -0,0 +1,7 @@
1
+ export declare enum LogLevel {
2
+ DEBUG = 0,
3
+ INFO = 1,
4
+ WARN = 2,
5
+ ERROR = 3
6
+ }
7
+ //# sourceMappingURL=LogLevel.enum.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"LogLevel.enum.d.ts","sourceRoot":"","sources":["../../../../../src/enums/LogLevel.enum.ts"],"names":[],"mappings":"AAAA,oBAAY,QAAQ;IAClB,KAAK,IAAA;IACL,IAAI,IAAA;IACJ,IAAI,IAAA;IACJ,KAAK,IAAA;CACN"}
@@ -10,10 +10,12 @@ export * from './restartApp';
10
10
  export * from './sync';
11
11
  export * from './getClientUniqueId';
12
12
  export * from './resetClientUniqueId';
13
+ export * from './logLevel';
13
14
  export * from './types';
14
15
  export * from './enums/SyncStatus.enum';
15
16
  export * from './enums/InstallMode.enum';
16
17
  export * from './enums/UpdateState.enum';
17
18
  export { DeploymentStatus } from './internals/CodePushApiSdk.types';
18
19
  export * from './enums/CheckFrequency.enum';
20
+ export * from './enums/LogLevel.enum';
19
21
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,gBAAgB,CAAC;AAC/B,cAAc,mBAAmB,CAAC;AAClC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,YAAY,CAAC;AAC3B,OAAO,EAAE,OAAO,EAAE,MAAM,YAAY,CAAC;AACrC,cAAc,mBAAmB,CAAC;AAClC,cAAc,qBAAqB,CAAC;AACpC,cAAc,kBAAkB,CAAC;AACjC,cAAc,cAAc,CAAC;AAC7B,cAAc,QAAQ,CAAC;AACvB,cAAc,qBAAqB,CAAC;AACpC,cAAc,uBAAuB,CAAC;AAEtC,cAAc,SAAS,CAAC;AAExB,cAAc,yBAAyB,CAAC;AACxC,cAAc,0BAA0B,CAAC;AACzC,cAAc,0BAA0B,CAAC;AACzC,OAAO,EAAE,gBAAgB,EAAE,MAAM,kCAAkC,CAAC;AACpE,cAAc,6BAA6B,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,gBAAgB,CAAC;AAC/B,cAAc,mBAAmB,CAAC;AAClC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,YAAY,CAAC;AAC3B,OAAO,EAAE,OAAO,EAAE,MAAM,YAAY,CAAC;AACrC,cAAc,mBAAmB,CAAC;AAClC,cAAc,qBAAqB,CAAC;AACpC,cAAc,kBAAkB,CAAC;AACjC,cAAc,cAAc,CAAC;AAC7B,cAAc,QAAQ,CAAC;AACvB,cAAc,qBAAqB,CAAC;AACpC,cAAc,uBAAuB,CAAC;AACtC,cAAc,YAAY,CAAC;AAE3B,cAAc,SAAS,CAAC;AAExB,cAAc,yBAAyB,CAAC;AACxC,cAAc,0BAA0B,CAAC;AACzC,cAAc,0BAA0B,CAAC;AACzC,OAAO,EAAE,gBAAgB,EAAE,MAAM,kCAAkC,CAAC;AACpE,cAAc,6BAA6B,CAAC;AAC5C,cAAc,uBAAuB,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"RemotePackageImplementation.d.ts","sourceRoot":"","sources":["../../../../../src/internals/RemotePackageImplementation.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,wBAAwB,EAAE,YAAY,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AACtF,OAAO,KAAK,EAAE,+BAA+B,EAAE,MAAM,wBAAwB,CAAC;AAK9E,qBAAa,iBAAkB,YAAW,aAAa;gBAEnD,iBAAiB,EAAE,IAAI,CAAC,aAAa,EAAE,UAAU,CAAC,EAClD,oBAAoB,EAAE,CAAC,iBAAiB,EAAE,+BAA+B,KAAK,OAAO,CAAC,IAAI,CAAC;IA8C7F,QAAQ,EAAE,CAAC,wBAAwB,CAAC,EAAE,wBAAwB,KAAK,OAAO,CAAC,YAAY,CAAC,CAAC;IAEzF,UAAU,EAAG,MAAM,CAAC;IACpB,WAAW,EAAG,MAAM,CAAC;IACrB,WAAW,EAAG,MAAM,CAAC;IACrB,aAAa,EAAG,OAAO,CAAC;IACxB,UAAU,EAAG,OAAO,CAAC;IACrB,WAAW,EAAG,OAAO,CAAC;IACtB,SAAS,UAAS;IAClB,KAAK,EAAG,MAAM,CAAC;IACf,WAAW,EAAG,MAAM,CAAC;IACrB,WAAW,EAAG,MAAM,CAAC;IACrB,sBAAsB,EAAG,MAAM,CAAC;CACjC"}
1
+ {"version":3,"file":"RemotePackageImplementation.d.ts","sourceRoot":"","sources":["../../../../../src/internals/RemotePackageImplementation.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,wBAAwB,EAAE,YAAY,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AACtF,OAAO,KAAK,EAAE,+BAA+B,EAAE,MAAM,wBAAwB,CAAC;AAK9E,qBAAa,iBAAkB,YAAW,aAAa;gBAEnD,iBAAiB,EAAE,IAAI,CAAC,aAAa,EAAE,UAAU,CAAC,EAClD,oBAAoB,EAAE,CAAC,iBAAiB,EAAE,+BAA+B,KAAK,OAAO,CAAC,IAAI,CAAC;IA8C7F,QAAQ,EAAE,CAAC,wBAAwB,CAAC,EAAE,wBAAwB,KAAK,OAAO,CAAC,YAAY,CAAC,CAAC;IAEzF,UAAU,EAAG,MAAM,CAAC;IACpB,WAAW,EAAG,MAAM,CAAC;IACrB,WAAW,EAAG,MAAM,CAAC;IACrB,aAAa,EAAG,OAAO,CAAC;IACxB,UAAU,EAAG,OAAO,CAAC;IACrB,WAAW,EAAG,OAAO,CAAC;IACtB,SAAS,UAAS;IAClB,KAAK,EAAG,MAAM,CAAC;IACf,WAAW,EAAG,MAAM,CAAC;IACrB,WAAW,EAAG,MAAM,CAAC;IACrB,sBAAsB,EAAG,MAAM,CAAC;CACjC"}
@@ -1 +1 @@
1
- {"version":3,"file":"shouldUpdateBeIgnored.d.ts","sourceRoot":"","sources":["../../../../../src/internals/shouldUpdateBeIgnored.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAwB,WAAW,EAAE,MAAM,UAAU,CAAC;AAuCjF,wBAAsB,qBAAqB,CAAC,aAAa,EAAE,aAAa,GAAG,IAAI,GAAG,SAAS,EAAE,WAAW,EAAE,WAAW,oBAoCpH"}
1
+ {"version":3,"file":"shouldUpdateBeIgnored.d.ts","sourceRoot":"","sources":["../../../../../src/internals/shouldUpdateBeIgnored.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,aAAa,EAAwB,WAAW,EAAE,MAAM,UAAU,CAAC;AAuCjF,wBAAsB,qBAAqB,CAAC,aAAa,EAAE,aAAa,GAAG,IAAI,GAAG,SAAS,EAAE,WAAW,EAAE,WAAW,oBAoCpH"}
@@ -1,2 +1,3 @@
1
- export declare function log(message: string): void;
1
+ import type { LogLevel } from '../../enums/LogLevel.enum';
2
+ export declare function log(level: LogLevel, message: string): void;
2
3
  //# sourceMappingURL=log.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"log.d.ts","sourceRoot":"","sources":["../../../../../../src/internals/utils/log.ts"],"names":[],"mappings":"AACA,wBAAgB,GAAG,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI,CAEzC"}
1
+ {"version":3,"file":"log.d.ts","sourceRoot":"","sources":["../../../../../../src/internals/utils/log.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,2BAA2B,CAAC;AAI1D,wBAAgB,GAAG,CAAC,KAAK,EAAE,QAAQ,EAAE,OAAO,EAAE,MAAM,GAAG,IAAI,CAO1D"}
@@ -1 +1 @@
1
- {"version":3,"file":"requestFetchAdapter.d.ts","sourceRoot":"","sources":["../../../../../../src/internals/utils/requestFetchAdapter.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,yBAAyB,CAAC;AAIpD,eAAO,MAAM,mBAAmB,EAAE,IAAI,CAAC,SAuBtC,CAAC"}
1
+ {"version":3,"file":"requestFetchAdapter.d.ts","sourceRoot":"","sources":["../../../../../../src/internals/utils/requestFetchAdapter.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,yBAAyB,CAAC;AAKpD,eAAO,MAAM,mBAAmB,EAAE,IAAI,CAAC,SA6BtC,CAAC"}
@@ -1,2 +1,2 @@
1
- export declare const version = "10.1.1";
1
+ export declare const version = "10.1.2";
2
2
  //# sourceMappingURL=version.d.ts.map
@@ -0,0 +1,4 @@
1
+ import { LogLevel } from './enums/LogLevel.enum';
2
+ export declare const setLogLevel: (level: LogLevel) => void;
3
+ export declare const getLogLevel: () => LogLevel;
4
+ //# sourceMappingURL=logLevel.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"logLevel.d.ts","sourceRoot":"","sources":["../../../../src/logLevel.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAC;AAIjD,eAAO,MAAM,WAAW,UAAW,QAAQ,SAE1C,CAAC;AAEF,eAAO,MAAM,WAAW,gBAAiB,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"notifyAppReady.d.ts","sourceRoot":"","sources":["../../../../src/notifyAppReady.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AAE5C;;;;GAIG;AACH,eAAO,MAAM,cAAc,oCAYvB,CAAC"}
1
+ {"version":3,"file":"notifyAppReady.d.ts","sourceRoot":"","sources":["../../../../src/notifyAppReady.ts"],"names":[],"mappings":"AAOA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AAE5C;;;;GAIG;AACH,eAAO,MAAM,cAAc,oCAYvB,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"sync.d.ts","sourceRoot":"","sources":["../../../../src/sync.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,UAAU,EAAE,MAAM,yBAAyB,CAAC;AAKrD,OAAO,KAAK,EACV,wBAAwB,EACxB,mCAAmC,EACnC,WAAW,EACX,yBAAyB,EACzB,YAAY,EACb,MAAM,SAAS,CAAC;AAEjB;;;GAGG;AACH,eAAO,MAAM,qBAAqB,EAAE,YASnC,CAAC;AAgLF;;;;;;;;;GASG;AACH,eAAO,MAAM,IAAI,aAUH,WAAW,8BACO,yBAAyB,6BAC1B,wBAAwB,wCACb,mCAAmC,KACxE,OAAO,CAAC,UAAU,CA4CnB,CAAC"}
1
+ {"version":3,"file":"sync.d.ts","sourceRoot":"","sources":["../../../../src/sync.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,UAAU,EAAE,MAAM,yBAAyB,CAAC;AAKrD,OAAO,KAAK,EACV,wBAAwB,EACxB,mCAAmC,EACnC,WAAW,EACX,yBAAyB,EACzB,YAAY,EACb,MAAM,SAAS,CAAC;AAEjB;;;GAGG;AACH,eAAO,MAAM,qBAAqB,EAAE,YASnC,CAAC;AAqLF;;;;;;;;;GASG;AACH,eAAO,MAAM,IAAI,aAUH,WAAW,8BACO,yBAAyB,6BAC1B,wBAAwB,wCACb,mCAAmC,KACxE,OAAO,CAAC,UAAU,CAgDnB,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"CodePush.d.ts","sourceRoot":"","sources":["../../../../src/CodePush.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,OAAO,EAAE,cAAc,EAAE,MAAM,6BAA6B,CAAC;AAG7D,OAAO,KAAK,EAGV,WAAW,EAEZ,MAAM,SAAS,CAAC;AAEjB,MAAM,WAAW,eAAgB,SAAQ,WAAW;IAClD;;;;OAIG;IACH,cAAc,CAAC,EAAE,cAAc,CAAC;CACjC;AAED;;;;;;GAMG;AAEH,wBAAgB,YAAY,CAAC,CAAC,SAAS,MAAM,EAAE,SAAS,EAAE,KAAK,CAAC,aAAa,CAAC,CAAC,CAAC,GAAG,KAAK,CAAC,aAAa,CAAC;AAEvG;;;;;;GAMG;AACH,wBAAgB,YAAY,CAAC,CAAC,SAAS,MAAM,EAC3C,OAAO,EAAE,eAAe,GACvB,CAAC,SAAS,EAAE,KAAK,CAAC,aAAa,CAAC,CAAC,CAAC,KAAK,KAAK,CAAC,aAAa,CAAC;AAyE9D,eAAe,YAAY,CAAC"}
1
+ {"version":3,"file":"CodePush.d.ts","sourceRoot":"","sources":["../../../../src/CodePush.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,OAAO,EAAE,cAAc,EAAE,MAAM,6BAA6B,CAAC;AAK7D,OAAO,KAAK,EAGV,WAAW,EAEZ,MAAM,SAAS,CAAC;AAEjB,MAAM,WAAW,eAAgB,SAAQ,WAAW;IAClD;;;;OAIG;IACH,cAAc,CAAC,EAAE,cAAc,CAAC;CACjC;AAED;;;;;;GAMG;AAEH,wBAAgB,YAAY,CAAC,CAAC,SAAS,MAAM,EAAE,SAAS,EAAE,KAAK,CAAC,aAAa,CAAC,CAAC,CAAC,GAAG,KAAK,CAAC,aAAa,CAAC;AAEvG;;;;;;GAMG;AACH,wBAAgB,YAAY,CAAC,CAAC,SAAS,MAAM,EAC3C,OAAO,EAAE,eAAe,GACvB,CAAC,SAAS,EAAE,KAAK,CAAC,aAAa,CAAC,CAAC,CAAC,KAAK,KAAK,CAAC,aAAa,CAAC;AA6E9D,eAAe,YAAY,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"checkForUpdates.d.ts","sourceRoot":"","sources":["../../../../src/checkForUpdates.ts"],"names":[],"mappings":"AAUA,OAAO,KAAK,EAAE,mCAAmC,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AAElF;;;;;GAKG;AACH,wBAAsB,cAAc,CAClC,sBAAsB,CAAC,EAAE,MAAM,EAC/B,mCAAmC,CAAC,EAAE,mCAAmC,GACxE,OAAO,CAAC,aAAa,GAAG,IAAI,CAAC,CAwF/B"}
1
+ {"version":3,"file":"checkForUpdates.d.ts","sourceRoot":"","sources":["../../../../src/checkForUpdates.ts"],"names":[],"mappings":"AAWA,OAAO,KAAK,EAAE,mCAAmC,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AAElF;;;;;GAKG;AACH,wBAAsB,cAAc,CAClC,sBAAsB,CAAC,EAAE,MAAM,EAC/B,mCAAmC,CAAC,EAAE,mCAAmC,GACxE,OAAO,CAAC,aAAa,GAAG,IAAI,CAAC,CAwF/B"}
@@ -0,0 +1,7 @@
1
+ export declare enum LogLevel {
2
+ DEBUG = 0,
3
+ INFO = 1,
4
+ WARN = 2,
5
+ ERROR = 3
6
+ }
7
+ //# sourceMappingURL=LogLevel.enum.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"LogLevel.enum.d.ts","sourceRoot":"","sources":["../../../../../src/enums/LogLevel.enum.ts"],"names":[],"mappings":"AAAA,oBAAY,QAAQ;IAClB,KAAK,IAAA;IACL,IAAI,IAAA;IACJ,IAAI,IAAA;IACJ,KAAK,IAAA;CACN"}
@@ -10,10 +10,12 @@ export * from './restartApp';
10
10
  export * from './sync';
11
11
  export * from './getClientUniqueId';
12
12
  export * from './resetClientUniqueId';
13
+ export * from './logLevel';
13
14
  export * from './types';
14
15
  export * from './enums/SyncStatus.enum';
15
16
  export * from './enums/InstallMode.enum';
16
17
  export * from './enums/UpdateState.enum';
17
18
  export { DeploymentStatus } from './internals/CodePushApiSdk.types';
18
19
  export * from './enums/CheckFrequency.enum';
20
+ export * from './enums/LogLevel.enum';
19
21
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,gBAAgB,CAAC;AAC/B,cAAc,mBAAmB,CAAC;AAClC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,YAAY,CAAC;AAC3B,OAAO,EAAE,OAAO,EAAE,MAAM,YAAY,CAAC;AACrC,cAAc,mBAAmB,CAAC;AAClC,cAAc,qBAAqB,CAAC;AACpC,cAAc,kBAAkB,CAAC;AACjC,cAAc,cAAc,CAAC;AAC7B,cAAc,QAAQ,CAAC;AACvB,cAAc,qBAAqB,CAAC;AACpC,cAAc,uBAAuB,CAAC;AAEtC,cAAc,SAAS,CAAC;AAExB,cAAc,yBAAyB,CAAC;AACxC,cAAc,0BAA0B,CAAC;AACzC,cAAc,0BAA0B,CAAC;AACzC,OAAO,EAAE,gBAAgB,EAAE,MAAM,kCAAkC,CAAC;AACpE,cAAc,6BAA6B,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,gBAAgB,CAAC;AAC/B,cAAc,mBAAmB,CAAC;AAClC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,YAAY,CAAC;AAC3B,OAAO,EAAE,OAAO,EAAE,MAAM,YAAY,CAAC;AACrC,cAAc,mBAAmB,CAAC;AAClC,cAAc,qBAAqB,CAAC;AACpC,cAAc,kBAAkB,CAAC;AACjC,cAAc,cAAc,CAAC;AAC7B,cAAc,QAAQ,CAAC;AACvB,cAAc,qBAAqB,CAAC;AACpC,cAAc,uBAAuB,CAAC;AACtC,cAAc,YAAY,CAAC;AAE3B,cAAc,SAAS,CAAC;AAExB,cAAc,yBAAyB,CAAC;AACxC,cAAc,0BAA0B,CAAC;AACzC,cAAc,0BAA0B,CAAC;AACzC,OAAO,EAAE,gBAAgB,EAAE,MAAM,kCAAkC,CAAC;AACpE,cAAc,6BAA6B,CAAC;AAC5C,cAAc,uBAAuB,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"RemotePackageImplementation.d.ts","sourceRoot":"","sources":["../../../../../src/internals/RemotePackageImplementation.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,wBAAwB,EAAE,YAAY,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AACtF,OAAO,KAAK,EAAE,+BAA+B,EAAE,MAAM,wBAAwB,CAAC;AAK9E,qBAAa,iBAAkB,YAAW,aAAa;gBAEnD,iBAAiB,EAAE,IAAI,CAAC,aAAa,EAAE,UAAU,CAAC,EAClD,oBAAoB,EAAE,CAAC,iBAAiB,EAAE,+BAA+B,KAAK,OAAO,CAAC,IAAI,CAAC;IA8C7F,QAAQ,EAAE,CAAC,wBAAwB,CAAC,EAAE,wBAAwB,KAAK,OAAO,CAAC,YAAY,CAAC,CAAC;IAEzF,UAAU,EAAG,MAAM,CAAC;IACpB,WAAW,EAAG,MAAM,CAAC;IACrB,WAAW,EAAG,MAAM,CAAC;IACrB,aAAa,EAAG,OAAO,CAAC;IACxB,UAAU,EAAG,OAAO,CAAC;IACrB,WAAW,EAAG,OAAO,CAAC;IACtB,SAAS,UAAS;IAClB,KAAK,EAAG,MAAM,CAAC;IACf,WAAW,EAAG,MAAM,CAAC;IACrB,WAAW,EAAG,MAAM,CAAC;IACrB,sBAAsB,EAAG,MAAM,CAAC;CACjC"}
1
+ {"version":3,"file":"RemotePackageImplementation.d.ts","sourceRoot":"","sources":["../../../../../src/internals/RemotePackageImplementation.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,wBAAwB,EAAE,YAAY,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AACtF,OAAO,KAAK,EAAE,+BAA+B,EAAE,MAAM,wBAAwB,CAAC;AAK9E,qBAAa,iBAAkB,YAAW,aAAa;gBAEnD,iBAAiB,EAAE,IAAI,CAAC,aAAa,EAAE,UAAU,CAAC,EAClD,oBAAoB,EAAE,CAAC,iBAAiB,EAAE,+BAA+B,KAAK,OAAO,CAAC,IAAI,CAAC;IA8C7F,QAAQ,EAAE,CAAC,wBAAwB,CAAC,EAAE,wBAAwB,KAAK,OAAO,CAAC,YAAY,CAAC,CAAC;IAEzF,UAAU,EAAG,MAAM,CAAC;IACpB,WAAW,EAAG,MAAM,CAAC;IACrB,WAAW,EAAG,MAAM,CAAC;IACrB,aAAa,EAAG,OAAO,CAAC;IACxB,UAAU,EAAG,OAAO,CAAC;IACrB,WAAW,EAAG,OAAO,CAAC;IACtB,SAAS,UAAS;IAClB,KAAK,EAAG,MAAM,CAAC;IACf,WAAW,EAAG,MAAM,CAAC;IACrB,WAAW,EAAG,MAAM,CAAC;IACrB,sBAAsB,EAAG,MAAM,CAAC;CACjC"}
@@ -1 +1 @@
1
- {"version":3,"file":"shouldUpdateBeIgnored.d.ts","sourceRoot":"","sources":["../../../../../src/internals/shouldUpdateBeIgnored.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAwB,WAAW,EAAE,MAAM,UAAU,CAAC;AAuCjF,wBAAsB,qBAAqB,CAAC,aAAa,EAAE,aAAa,GAAG,IAAI,GAAG,SAAS,EAAE,WAAW,EAAE,WAAW,oBAoCpH"}
1
+ {"version":3,"file":"shouldUpdateBeIgnored.d.ts","sourceRoot":"","sources":["../../../../../src/internals/shouldUpdateBeIgnored.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,aAAa,EAAwB,WAAW,EAAE,MAAM,UAAU,CAAC;AAuCjF,wBAAsB,qBAAqB,CAAC,aAAa,EAAE,aAAa,GAAG,IAAI,GAAG,SAAS,EAAE,WAAW,EAAE,WAAW,oBAoCpH"}
@@ -1,2 +1,3 @@
1
- export declare function log(message: string): void;
1
+ import type { LogLevel } from '../../enums/LogLevel.enum';
2
+ export declare function log(level: LogLevel, message: string): void;
2
3
  //# sourceMappingURL=log.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"log.d.ts","sourceRoot":"","sources":["../../../../../../src/internals/utils/log.ts"],"names":[],"mappings":"AACA,wBAAgB,GAAG,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI,CAEzC"}
1
+ {"version":3,"file":"log.d.ts","sourceRoot":"","sources":["../../../../../../src/internals/utils/log.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,2BAA2B,CAAC;AAI1D,wBAAgB,GAAG,CAAC,KAAK,EAAE,QAAQ,EAAE,OAAO,EAAE,MAAM,GAAG,IAAI,CAO1D"}
@@ -1 +1 @@
1
- {"version":3,"file":"requestFetchAdapter.d.ts","sourceRoot":"","sources":["../../../../../../src/internals/utils/requestFetchAdapter.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,yBAAyB,CAAC;AAIpD,eAAO,MAAM,mBAAmB,EAAE,IAAI,CAAC,SAuBtC,CAAC"}
1
+ {"version":3,"file":"requestFetchAdapter.d.ts","sourceRoot":"","sources":["../../../../../../src/internals/utils/requestFetchAdapter.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,yBAAyB,CAAC;AAKpD,eAAO,MAAM,mBAAmB,EAAE,IAAI,CAAC,SA6BtC,CAAC"}
@@ -1,2 +1,2 @@
1
- export declare const version = "10.1.1";
1
+ export declare const version = "10.1.2";
2
2
  //# sourceMappingURL=version.d.ts.map
@@ -0,0 +1,4 @@
1
+ import { LogLevel } from './enums/LogLevel.enum';
2
+ export declare const setLogLevel: (level: LogLevel) => void;
3
+ export declare const getLogLevel: () => LogLevel;
4
+ //# sourceMappingURL=logLevel.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"logLevel.d.ts","sourceRoot":"","sources":["../../../../src/logLevel.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAC;AAIjD,eAAO,MAAM,WAAW,UAAW,QAAQ,SAE1C,CAAC;AAEF,eAAO,MAAM,WAAW,gBAAiB,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"notifyAppReady.d.ts","sourceRoot":"","sources":["../../../../src/notifyAppReady.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AAE5C;;;;GAIG;AACH,eAAO,MAAM,cAAc,oCAYvB,CAAC"}
1
+ {"version":3,"file":"notifyAppReady.d.ts","sourceRoot":"","sources":["../../../../src/notifyAppReady.ts"],"names":[],"mappings":"AAOA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AAE5C;;;;GAIG;AACH,eAAO,MAAM,cAAc,oCAYvB,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"sync.d.ts","sourceRoot":"","sources":["../../../../src/sync.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,UAAU,EAAE,MAAM,yBAAyB,CAAC;AAKrD,OAAO,KAAK,EACV,wBAAwB,EACxB,mCAAmC,EACnC,WAAW,EACX,yBAAyB,EACzB,YAAY,EACb,MAAM,SAAS,CAAC;AAEjB;;;GAGG;AACH,eAAO,MAAM,qBAAqB,EAAE,YASnC,CAAC;AAgLF;;;;;;;;;GASG;AACH,eAAO,MAAM,IAAI,aAUH,WAAW,8BACO,yBAAyB,6BAC1B,wBAAwB,wCACb,mCAAmC,KACxE,OAAO,CAAC,UAAU,CA4CnB,CAAC"}
1
+ {"version":3,"file":"sync.d.ts","sourceRoot":"","sources":["../../../../src/sync.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,UAAU,EAAE,MAAM,yBAAyB,CAAC;AAKrD,OAAO,KAAK,EACV,wBAAwB,EACxB,mCAAmC,EACnC,WAAW,EACX,yBAAyB,EACzB,YAAY,EACb,MAAM,SAAS,CAAC;AAEjB;;;GAGG;AACH,eAAO,MAAM,qBAAqB,EAAE,YASnC,CAAC;AAqLF;;;;;;;;;GASG;AACH,eAAO,MAAM,IAAI,aAUH,WAAW,8BACO,yBAAyB,6BAC1B,wBAAwB,wCACb,mCAAmC,KACxE,OAAO,CAAC,UAAU,CAgDnB,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@appzung/react-native-code-push",
3
- "version": "10.1.1",
3
+ "version": "10.1.2",
4
4
  "description": "React Native plugin for the CodePush service",
5
5
  "author": "Louis Lagrange <lagrange.louis@gmail.com> (https://github.com/Minishlink)",
6
6
  "license": "MIT",
package/src/CodePush.tsx CHANGED
@@ -2,6 +2,8 @@ import hoistStatics from 'hoist-non-react-statics';
2
2
  import React from 'react';
3
3
  import { AppState } from 'react-native';
4
4
  import { CheckFrequency } from './enums/CheckFrequency.enum';
5
+ import { LogLevel } from './enums/LogLevel.enum';
6
+ import { log } from './internals/utils/log';
5
7
  import { notifyAppReady } from './notifyAppReady';
6
8
  import { sync } from './sync';
7
9
  import type {
@@ -54,6 +56,8 @@ export function withCodePush<P extends object>(optionsOrComponent: CodePushOptio
54
56
  }
55
57
 
56
58
  componentDidMount() {
59
+ log(LogLevel.DEBUG, `withCodePush ${JSON.stringify(options)}`);
60
+
57
61
  if (options.checkFrequency === CheckFrequency.MANUAL) {
58
62
  notifyAppReady();
59
63
  } else {
@@ -75,11 +79,13 @@ export function withCodePush<P extends object>(optionsOrComponent: CodePushOptio
75
79
  rootComponentInstance.codePushOnBinaryVersionMismatch.bind(rootComponentInstance);
76
80
  }
77
81
 
82
+ log(LogLevel.DEBUG, `sync on mount`);
78
83
  sync(options, syncStatusCallback, downloadProgressCallback, handleBinaryVersionMismatchCallback);
79
84
 
80
85
  if (options.checkFrequency === CheckFrequency.ON_APP_RESUME) {
81
86
  AppState.addEventListener('change', (newState: string) => {
82
87
  if (newState === 'active') {
88
+ log(LogLevel.DEBUG, `sync on active appState`);
83
89
  sync(options, syncStatusCallback, downloadProgressCallback);
84
90
  }
85
91
  });
@@ -1,4 +1,5 @@
1
1
  import { Platform } from 'react-native';
2
+ import { LogLevel } from './enums/LogLevel.enum';
2
3
  import { CodePushApiSdk } from './internals/CodePushApiSdk';
3
4
  import type { ApiSdkQueryUpdatePackageInfo } from './internals/CodePushApiSdk.types';
4
5
  import { NativeRNAppZungCodePushModule } from './internals/NativeRNAppZungCodePushModule';
@@ -84,7 +85,7 @@ export async function checkForUpdate(
84
85
  throw new Error('updateAppVersion should never be false');
85
86
  }
86
87
 
87
- log('An update is available but it is not targeting the binary version of your app.');
88
+ log(LogLevel.INFO, 'An update is available but it is not targeting the binary version of your app.');
88
89
  handleBinaryVersionMismatchCallback?.(update);
89
90
 
90
91
  return null;
@@ -0,0 +1,6 @@
1
+ export enum LogLevel {
2
+ DEBUG,
3
+ INFO,
4
+ WARN,
5
+ ERROR,
6
+ }
package/src/index.ts CHANGED
@@ -10,6 +10,7 @@ export * from './restartApp';
10
10
  export * from './sync';
11
11
  export * from './getClientUniqueId';
12
12
  export * from './resetClientUniqueId';
13
+ export * from './logLevel';
13
14
 
14
15
  export * from './types';
15
16
 
@@ -18,3 +19,4 @@ export * from './enums/InstallMode.enum';
18
19
  export * from './enums/UpdateState.enum';
19
20
  export { DeploymentStatus } from './internals/CodePushApiSdk.types';
20
21
  export * from './enums/CheckFrequency.enum';
22
+ export * from './enums/LogLevel.enum';
@@ -1,4 +1,5 @@
1
1
  import { NativeEventEmitter } from 'react-native';
2
+ import { LogLevel } from '../enums/LogLevel.enum';
2
3
  import type { DownloadProgressCallback, LocalPackage, RemotePackage } from '../types';
3
4
  import type { ApiSdkDownloadReportPackageInfo } from './CodePushApiSdk.types';
4
5
  import { LocalPackageImplementation } from './LocalPackageImplementation';
@@ -42,7 +43,7 @@ export class RemotePackageImpl implements RemotePackage {
42
43
  const reportPromise = reportStatusDownload({
43
44
  label: this.label,
44
45
  }).catch((error) => {
45
- log(`Report download status failed: ${error}`);
46
+ log(LogLevel.ERROR, `Report download status failed: ${error}`);
46
47
  });
47
48
  await Promise.race([timeoutPromise, reportPromise]);
48
49
  }
@@ -1,3 +1,4 @@
1
+ import { LogLevel } from '../enums/LogLevel.enum';
1
2
  import type { RemotePackage, RollbackRetryOptions, SyncOptions } from '../types';
2
3
  import { NativeRNAppZungCodePushModule } from './NativeRNAppZungCodePushModule';
3
4
  import type { LatestRollbackInfo } from './types';
@@ -20,17 +21,17 @@ function validateLatestRollbackInfo(latestRollbackInfo: LatestRollbackInfo, pack
20
21
 
21
22
  function validateRollbackRetryOptions(rollbackRetryOptions: RollbackRetryOptions) {
22
23
  if (typeof rollbackRetryOptions.delayInHours !== 'number') {
23
- log("The 'delayInHours' rollback retry parameter must be a number.");
24
+ log(LogLevel.ERROR, "The 'delayInHours' rollback retry parameter must be a number.");
24
25
  return false;
25
26
  }
26
27
 
27
28
  if (typeof rollbackRetryOptions.maxRetryAttempts !== 'number') {
28
- log("The 'maxRetryAttempts' rollback retry parameter must be a number.");
29
+ log(LogLevel.ERROR, "The 'maxRetryAttempts' rollback retry parameter must be a number.");
29
30
  return false;
30
31
  }
31
32
 
32
33
  if (rollbackRetryOptions.maxRetryAttempts < 1) {
33
- log("The 'maxRetryAttempts' rollback retry parameter cannot be less then 1.");
34
+ log(LogLevel.ERROR, "The 'maxRetryAttempts' rollback retry parameter cannot be less then 1.");
34
35
  return false;
35
36
  }
36
37
 
@@ -61,14 +62,14 @@ export async function shouldUpdateBeIgnored(remotePackage: RemotePackage | null
61
62
 
62
63
  const latestRollbackInfo = await NativeRNAppZungCodePushModule.getLatestRollbackInfo();
63
64
  if (!validateLatestRollbackInfo(latestRollbackInfo, remotePackage.packageHash)) {
64
- log('The latest rollback info is not valid.');
65
+ log(LogLevel.ERROR, 'The latest rollback info is not valid.');
65
66
  return true;
66
67
  }
67
68
 
68
69
  const { delayInHours, maxRetryAttempts } = rollbackRetryOptions;
69
70
  const hoursSinceLatestRollback = (Date.now() - latestRollbackInfo.time) / (1000 * 60 * 60);
70
71
  if (hoursSinceLatestRollback >= delayInHours && maxRetryAttempts >= latestRollbackInfo.count) {
71
- log('Previous rollback should be ignored due to rollback retry options.');
72
+ log(LogLevel.INFO, 'Previous rollback should be ignored due to rollback retry options.');
72
73
  return false;
73
74
  }
74
75
 
@@ -1,4 +1,12 @@
1
+ import type { LogLevel } from '../../enums/LogLevel.enum';
2
+ import { getLogLevel } from '../../logLevel';
3
+
1
4
  /* Logs messages to console with the [CodePush] prefix */
2
- export function log(message: string): void {
5
+ export function log(level: LogLevel, message: string): void {
6
+ const currentLogLevel = getLogLevel();
7
+ if (level < currentLogLevel) {
8
+ return;
9
+ }
10
+
3
11
  console.log(`[CodePush] ${message}`);
4
12
  }
@@ -1,6 +1,8 @@
1
+ import { LogLevel } from '../../enums/LogLevel.enum';
1
2
  import type { Http } from '../CodePushApiSdk.types';
2
3
  import { version } from '../version';
3
4
  import { fetchRetry } from './fetchRetry';
5
+ import { log } from './log';
4
6
 
5
7
  export const requestFetchAdapter: Http.Requester = {
6
8
  async request(method, url, requestBody) {
@@ -15,6 +17,9 @@ export const requestFetchAdapter: Http.Requester = {
15
17
  requestBody = JSON.stringify(requestBody);
16
18
  }
17
19
 
20
+ const requestId = Math.round(Math.random() * 10000);
21
+ log(LogLevel.DEBUG, `[${requestId}] Will fetch ${method} ${url}`);
22
+
18
23
  const response = await fetchRetry(url, {
19
24
  method,
20
25
  headers,
@@ -22,6 +27,9 @@ export const requestFetchAdapter: Http.Requester = {
22
27
  });
23
28
 
24
29
  const statusCode = response.status;
30
+
31
+ log(LogLevel.DEBUG, `[${requestId}] Done fetching with status code ${statusCode}`);
32
+
25
33
  const body = await response.text();
26
34
  return { statusCode, body };
27
35
  },
@@ -1,2 +1,2 @@
1
1
  // Generated by genversion.
2
- export const version = '10.1.1';
2
+ export const version = '10.1.2';
@@ -0,0 +1,9 @@
1
+ import { LogLevel } from './enums/LogLevel.enum';
2
+
3
+ let logLevel = LogLevel.INFO;
4
+
5
+ export const setLogLevel = (level: LogLevel) => {
6
+ logLevel = level;
7
+ };
8
+
9
+ export const getLogLevel = () => logLevel;
@@ -1,4 +1,5 @@
1
1
  import { AppState, type NativeEventSubscription } from 'react-native';
2
+ import { LogLevel } from './enums/LogLevel.enum';
2
3
  import { CodePushApiSdk } from './internals/CodePushApiSdk';
3
4
  import { NativeRNAppZungCodePushModule } from './internals/NativeRNAppZungCodePushModule';
4
5
  import { getConfiguration } from './internals/getConfiguration';
@@ -26,9 +27,17 @@ export const notifyAppReady = (() => {
26
27
  })();
27
28
 
28
29
  async function notifyApplicationReadyInternal() {
30
+ log(LogLevel.DEBUG, 'notifyApplicationReady');
31
+
29
32
  await NativeRNAppZungCodePushModule.notifyApplicationReady();
30
33
  const statusReport = await NativeRNAppZungCodePushModule.getNewStatusReport();
31
- statusReport && tryReportStatus(statusReport); // Don't wait for this to complete.
34
+ if (statusReport) {
35
+ log(LogLevel.DEBUG, `tryReportStatus ${statusReport.status || '(no update)'}`);
36
+
37
+ tryReportStatus(statusReport); // Don't wait for this to complete.
38
+ } else {
39
+ log(LogLevel.DEBUG, `Nothing to report`);
40
+ }
32
41
 
33
42
  return statusReport;
34
43
  }
@@ -39,7 +48,7 @@ async function tryReportStatus(statusReport: StatusReport, retryOnAppResume?: Na
39
48
  const previousReleaseChannelPublicId = statusReport.previousReleaseChannelPublicId || config.releaseChannelPublicId;
40
49
  try {
41
50
  if (statusReport.appVersion) {
42
- log(`Reporting binary update (${statusReport.appVersion})`);
51
+ log(LogLevel.INFO, `Reporting binary update (${statusReport.appVersion})`);
43
52
 
44
53
  if (!config.releaseChannelPublicId) {
45
54
  throw new Error('Release channel is missing');
@@ -54,9 +63,9 @@ async function tryReportStatus(statusReport: StatusReport, retryOnAppResume?: Na
54
63
 
55
64
  const label = statusReport.package.label;
56
65
  if (statusReport.status === 'DeploymentSucceeded') {
57
- log(`Reporting CodePush update success (${label})`);
66
+ log(LogLevel.INFO, `Reporting CodePush update success (${label})`);
58
67
  } else {
59
- log(`Reporting CodePush update rollback (${label})`);
68
+ log(LogLevel.INFO, `Reporting CodePush update rollback (${label})`);
60
69
  await NativeRNAppZungCodePushModule.setLatestRollbackInfo(statusReport.package.packageHash);
61
70
  }
62
71
 
@@ -75,7 +84,7 @@ async function tryReportStatus(statusReport: StatusReport, retryOnAppResume?: Na
75
84
  NativeRNAppZungCodePushModule.recordStatusReported(statusReport);
76
85
  retryOnAppResume && retryOnAppResume.remove();
77
86
  } catch (e) {
78
- log(`Report status failed: ${JSON.stringify(statusReport)}`);
87
+ log(LogLevel.WARN, `Report status failed: ${JSON.stringify(statusReport)}`);
79
88
  NativeRNAppZungCodePushModule.saveStatusReportForRetry(statusReport);
80
89
  // Try again when the app resumes
81
90
  if (!retryOnAppResume) {
@@ -83,6 +92,7 @@ async function tryReportStatus(statusReport: StatusReport, retryOnAppResume?: Na
83
92
  if (newState !== 'active') return;
84
93
  const refreshedStatusReport = await NativeRNAppZungCodePushModule.getNewStatusReport();
85
94
  if (refreshedStatusReport) {
95
+ log(LogLevel.DEBUG, `tryReportStatus on active appState ${statusReport.status || '(no update)'}`);
86
96
  tryReportStatus(refreshedStatusReport, resumeListener);
87
97
  } else {
88
98
  resumeListener && resumeListener.remove();
package/src/sync.ts CHANGED
@@ -1,6 +1,7 @@
1
1
  import { Alert, type AlertButton, Platform } from 'react-native';
2
2
  import { checkForUpdate } from './checkForUpdates';
3
3
  import { InstallMode } from './enums/InstallMode.enum';
4
+ import { LogLevel } from './enums/LogLevel.enum';
4
5
  import { SyncStatus } from './enums/SyncStatus.enum';
5
6
  import { getCurrentPackage } from './internals/getCurrentPackage';
6
7
  import { shouldUpdateBeIgnored } from './internals/shouldUpdateBeIgnored';
@@ -62,38 +63,39 @@ async function syncInternal(
62
63
  : (syncStatus: SyncStatus) => {
63
64
  switch (syncStatus) {
64
65
  case SyncStatus.CHECKING_FOR_UPDATE:
65
- log('Checking for update.');
66
+ log(LogLevel.INFO, 'Checking for update.');
66
67
  break;
67
68
  case SyncStatus.AWAITING_USER_ACTION:
68
- log('Awaiting user action.');
69
+ log(LogLevel.INFO, 'Awaiting user action.');
69
70
  break;
70
71
  case SyncStatus.DOWNLOADING_PACKAGE:
71
- log('Downloading package.');
72
+ log(LogLevel.INFO, 'Downloading package.');
72
73
  break;
73
74
  case SyncStatus.INSTALLING_UPDATE:
74
- log('Installing update.');
75
+ log(LogLevel.INFO, 'Installing update.');
75
76
  break;
76
77
  case SyncStatus.UP_TO_DATE:
77
- log('App is up to date.');
78
+ log(LogLevel.INFO, 'App is up to date.');
78
79
  break;
79
80
  case SyncStatus.UPDATE_IGNORED:
80
- log('User cancelled the update.');
81
+ log(LogLevel.INFO, 'User cancelled the update.');
81
82
  break;
82
83
  case SyncStatus.UPDATE_INSTALLED:
83
84
  if (resolvedInstallMode == InstallMode.ON_NEXT_RESTART) {
84
- log('Update is installed and will be run on the next app restart.');
85
+ log(LogLevel.INFO, 'Update is installed and will be run on the next app restart.');
85
86
  } else if (resolvedInstallMode == InstallMode.ON_NEXT_RESUME) {
86
87
  if (!!syncOptions.minimumBackgroundDuration) {
87
88
  log(
89
+ LogLevel.INFO,
88
90
  `Update is installed and will be run after the app has been in the background for at least ${syncOptions.minimumBackgroundDuration} seconds.`,
89
91
  );
90
92
  } else {
91
- log('Update is installed and will be run when the app next resumes.');
93
+ log(LogLevel.INFO, 'Update is installed and will be run when the app next resumes.');
92
94
  }
93
95
  }
94
96
  break;
95
97
  case SyncStatus.UNKNOWN_ERROR:
96
- log('An unknown error occurred.');
98
+ log(LogLevel.ERROR, 'An unknown error occurred.');
97
99
  break;
98
100
  }
99
101
  };
@@ -127,7 +129,10 @@ async function syncInternal(
127
129
 
128
130
  if (!remotePackage || updateShouldBeIgnored) {
129
131
  if (updateShouldBeIgnored) {
130
- log('An update is available, but it is being ignored due to having been previously rolled back.');
132
+ log(
133
+ LogLevel.INFO,
134
+ 'An update is available, but it is being ignored due to having been previously rolled back.',
135
+ );
131
136
  }
132
137
 
133
138
  const currentPackage = await getCurrentPackage();
@@ -195,6 +200,7 @@ async function syncInternal(
195
200
  } catch (error) {
196
201
  syncStatusChangeCallback(SyncStatus.UNKNOWN_ERROR);
197
202
  log(
203
+ LogLevel.ERROR,
198
204
  error != null && typeof error === 'object' && 'message' in error && typeof error.message === 'string'
199
205
  ? error.message
200
206
  : 'Unknown',
@@ -228,25 +234,29 @@ export const sync = (() => {
228
234
  downloadProgressCallback?: DownloadProgressCallback,
229
235
  handleBinaryVersionMismatchCallback?: HandleBinaryVersionMismatchCallback,
230
236
  ): Promise<SyncStatus> => {
231
- let syncStatusCallbackWithTryCatch: SyncStatusChangedCallback | undefined;
232
- let downloadProgressCallbackWithTryCatch: DownloadProgressCallback | undefined;
237
+ log(LogLevel.DEBUG, `sync start`);
233
238
 
234
- if (typeof syncStatusChangedCallback === 'function') {
235
- syncStatusCallbackWithTryCatch = (...args) => {
236
- try {
237
- syncStatusChangedCallback(...args);
238
- } catch (error) {
239
- log(`An error has occurred : ${error instanceof Error ? error.stack : 'unknown'}`);
240
- }
241
- };
242
- }
239
+ let syncStatusCallbackWithTryCatch: SyncStatusChangedCallback = (status) => {
240
+ log(LogLevel.DEBUG, `sync status ${SyncStatus[status]}`);
243
241
 
242
+ if (typeof syncStatusChangedCallback !== 'function') {
243
+ return;
244
+ }
245
+
246
+ try {
247
+ syncStatusChangedCallback(status);
248
+ } catch (error) {
249
+ log(LogLevel.ERROR, `An error has occurred : ${error instanceof Error ? error.stack : 'unknown'}`);
250
+ }
251
+ };
252
+
253
+ let downloadProgressCallbackWithTryCatch: DownloadProgressCallback | undefined;
244
254
  if (typeof downloadProgressCallback === 'function') {
245
255
  downloadProgressCallbackWithTryCatch = (...args) => {
246
256
  try {
247
257
  downloadProgressCallback(...args);
248
258
  } catch (error) {
249
- log(`An error has occurred: ${error instanceof Error ? error.stack : 'unknown'}`);
259
+ log(LogLevel.ERROR, `An error has occurred: ${error instanceof Error ? error.stack : 'unknown'}`);
250
260
  }
251
261
  };
252
262
  }
@@ -254,7 +264,7 @@ export const sync = (() => {
254
264
  if (syncInProgress) {
255
265
  typeof syncStatusCallbackWithTryCatch === 'function'
256
266
  ? syncStatusCallbackWithTryCatch(SyncStatus.SYNC_IN_PROGRESS)
257
- : log('Sync already in progress.');
267
+ : log(LogLevel.WARN, 'Sync already in progress.');
258
268
  return Promise.resolve(SyncStatus.SYNC_IN_PROGRESS);
259
269
  }
260
270