capacitor-ota 1.0.7 → 1.0.8

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/src/index.mjs +4 -25
  2. package/package.json +1 -1
@@ -119,25 +119,8 @@ var OtaUpdater = class {
119
119
  });
120
120
  this.emit("downloadStart", { version });
121
121
  if (!isNativePlatform()) {
122
- for (let i = 0; i <= 100; i += 5) {
123
- this.setState({ progress: i });
124
- this.emit("downloadProgress", {
125
- progress: i,
126
- version
127
- });
128
- await new Promise((r) => setTimeout(r, 50));
129
- }
130
- this.downloadedBundle = {
131
- id: "web-sim",
132
- version
133
- };
134
- this.setState({ status: "ready" });
135
- this.emit("downloadComplete", { version });
136
- this.emit("updateReady", {
137
- version,
138
- bundleId: "web-sim"
139
- });
140
- return true;
122
+ this.setState({ status: "idle" });
123
+ return false;
141
124
  }
142
125
  try {
143
126
  const url = `${this.config.staticUrl}/updates/${this.config.appId}.json`;
@@ -181,13 +164,8 @@ var OtaUpdater = class {
181
164
  }
182
165
  }
183
166
  async apply() {
167
+ if (!isNativePlatform()) return;
184
168
  this.setState({ status: "applying" });
185
- if (!isNativePlatform()) {
186
- await new Promise((r) => setTimeout(r, 500));
187
- this.emit("updateApplied", { version: this.state.newVersion || "" });
188
- window.location.reload();
189
- return;
190
- }
191
169
  if (!this.downloadedBundle) {
192
170
  const error = "No downloaded bundle";
193
171
  this.setState({
@@ -758,6 +736,7 @@ function registerOtaUpdateElement() {
758
736
  //#region src/index.ts
759
737
  async function initOtaUpdate(config) {
760
738
  const ota = createOtaUpdater(config);
739
+ if (!isNativePlatform()) return ota;
761
740
  if (config.showUI !== false) {
762
741
  registerOtaUpdateElement();
763
742
  const element = document.createElement("ota-update");
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "capacitor-ota",
3
- "version": "1.0.7",
3
+ "version": "1.0.8",
4
4
  "type": "module",
5
5
  "main": "dist/src/index.mjs",
6
6
  "types": "dist/src/index.d.mts",