@capgo/capacitor-updater 5.4.1 → 5.5.0
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.
- package/README.md +4 -1
- package/android/src/main/java/ee/forgr/capacitor_updater/CapacitorUpdater.java +2 -0
- package/android/src/main/java/ee/forgr/capacitor_updater/CapacitorUpdaterPlugin.java +3 -1
- package/dist/docs.json +16 -0
- package/dist/esm/definitions.d.ts +9 -0
- package/ios/Plugin/CapacitorUpdater.swift +4 -1
- package/ios/Plugin/CapacitorUpdaterPlugin.swift +5 -4
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -170,6 +170,7 @@ CapacitorUpdater can be configured with this options:
|
|
|
170
170
|
| **`localSupa`** | <code>string</code> | Configure the CLI to use a local server for testing or self-hosted update server. | <code>undefined</code> | 4.17.48 |
|
|
171
171
|
| **`localSupaAnon`** | <code>string</code> | Configure the CLI to use a local server for testing. | <code>undefined</code> | 4.17.48 |
|
|
172
172
|
| **`allowModifyUrl`** | <code>boolean</code> | Allow the plugin to modify the updateUrl, statsUrl and channelUrl dynamically from the JavaScript side. | <code>false</code> | 5.4.0 |
|
|
173
|
+
| **`defaultChannel`** | <code>string</code> | Set the default channel for the app in the config. | <code>undefined</code> | 5.5.0 |
|
|
173
174
|
|
|
174
175
|
### Examples
|
|
175
176
|
|
|
@@ -196,7 +197,8 @@ In `capacitor.config.json`:
|
|
|
196
197
|
"localWebHost": undefined,
|
|
197
198
|
"localSupa": undefined,
|
|
198
199
|
"localSupaAnon": undefined,
|
|
199
|
-
"allowModifyUrl": undefined
|
|
200
|
+
"allowModifyUrl": undefined,
|
|
201
|
+
"defaultChannel": undefined
|
|
200
202
|
}
|
|
201
203
|
}
|
|
202
204
|
}
|
|
@@ -230,6 +232,7 @@ const config: CapacitorConfig = {
|
|
|
230
232
|
localSupa: undefined,
|
|
231
233
|
localSupaAnon: undefined,
|
|
232
234
|
allowModifyUrl: undefined,
|
|
235
|
+
defaultChannel: undefined,
|
|
233
236
|
},
|
|
234
237
|
},
|
|
235
238
|
};
|
|
@@ -88,6 +88,7 @@ public class CapacitorUpdater {
|
|
|
88
88
|
public String customId = "";
|
|
89
89
|
public String statsUrl = "";
|
|
90
90
|
public String channelUrl = "";
|
|
91
|
+
public String defaultChannel = "";
|
|
91
92
|
public String appId = "";
|
|
92
93
|
public String privateKey = "";
|
|
93
94
|
public String deviceID = "";
|
|
@@ -763,6 +764,7 @@ public class CapacitorUpdater {
|
|
|
763
764
|
json.put("plugin_version", this.PLUGIN_VERSION);
|
|
764
765
|
json.put("is_emulator", this.isEmulator());
|
|
765
766
|
json.put("is_prod", this.isProd());
|
|
767
|
+
json.put("defaultChannel", this.defaultChannel);
|
|
766
768
|
return json;
|
|
767
769
|
}
|
|
768
770
|
|
|
@@ -55,7 +55,7 @@ public class CapacitorUpdaterPlugin extends Plugin {
|
|
|
55
55
|
private static final String channelUrlDefault =
|
|
56
56
|
"https://api.capgo.app/channel_self";
|
|
57
57
|
|
|
58
|
-
private final String PLUGIN_VERSION = "5.
|
|
58
|
+
private final String PLUGIN_VERSION = "5.5.0";
|
|
59
59
|
private static final String DELAY_CONDITION_PREFERENCES = "";
|
|
60
60
|
|
|
61
61
|
private SharedPreferences.Editor editor;
|
|
@@ -182,6 +182,8 @@ public class CapacitorUpdaterPlugin extends Plugin {
|
|
|
182
182
|
this.implementation.channelUrl =
|
|
183
183
|
this.getConfig().getString("channelUrl", channelUrlDefault);
|
|
184
184
|
int userValue = this.getConfig().getInt("periodCheckDelay", 0);
|
|
185
|
+
this.implementation.defaultChannel =
|
|
186
|
+
this.getConfig().getString("defaultChannel", "");
|
|
185
187
|
|
|
186
188
|
if (userValue >= 0 && userValue <= 600) {
|
|
187
189
|
this.periodCheckDelay = 600 * 1000;
|
package/dist/docs.json
CHANGED
|
@@ -1858,6 +1858,22 @@
|
|
|
1858
1858
|
"docs": "Allow the plugin to modify the updateUrl, statsUrl and channelUrl dynamically from the JavaScript side.",
|
|
1859
1859
|
"complexTypes": [],
|
|
1860
1860
|
"type": "boolean | undefined"
|
|
1861
|
+
},
|
|
1862
|
+
{
|
|
1863
|
+
"name": "defaultChannel",
|
|
1864
|
+
"tags": [
|
|
1865
|
+
{
|
|
1866
|
+
"text": "undefined",
|
|
1867
|
+
"name": "default"
|
|
1868
|
+
},
|
|
1869
|
+
{
|
|
1870
|
+
"text": "5.5.0",
|
|
1871
|
+
"name": "since"
|
|
1872
|
+
}
|
|
1873
|
+
],
|
|
1874
|
+
"docs": "Set the default channel for the app in the config.",
|
|
1875
|
+
"complexTypes": [],
|
|
1876
|
+
"type": "string | undefined"
|
|
1861
1877
|
}
|
|
1862
1878
|
],
|
|
1863
1879
|
"docs": "CapacitorUpdater can be configured with this options:"
|
|
@@ -161,6 +161,15 @@ declare module "@capacitor/cli" {
|
|
|
161
161
|
* @since 5.4.0
|
|
162
162
|
*/
|
|
163
163
|
allowModifyUrl?: boolean;
|
|
164
|
+
/**
|
|
165
|
+
* Set the default channel for the app in the config.
|
|
166
|
+
*
|
|
167
|
+
*
|
|
168
|
+
*
|
|
169
|
+
* @default undefined
|
|
170
|
+
* @since 5.5.0
|
|
171
|
+
*/
|
|
172
|
+
defaultChannel?: string;
|
|
164
173
|
};
|
|
165
174
|
}
|
|
166
175
|
}
|
|
@@ -79,6 +79,7 @@ struct InfoObject: Codable {
|
|
|
79
79
|
let is_prod: Bool?
|
|
80
80
|
var action: String?
|
|
81
81
|
var channel: String?
|
|
82
|
+
var defaultChannel: String?
|
|
82
83
|
}
|
|
83
84
|
struct AppVersionDec: Decodable {
|
|
84
85
|
let version: String?
|
|
@@ -233,6 +234,7 @@ extension CustomError: LocalizedError {
|
|
|
233
234
|
public var timeout: Double = 20
|
|
234
235
|
public var statsUrl: String = ""
|
|
235
236
|
public var channelUrl: String = ""
|
|
237
|
+
public var defaultChannel: String = ""
|
|
236
238
|
public var appId: String = ""
|
|
237
239
|
public var deviceID = UIDevice.current.identifierForVendor?.uuidString ?? ""
|
|
238
240
|
public var privateKey: String = ""
|
|
@@ -429,7 +431,8 @@ extension CustomError: LocalizedError {
|
|
|
429
431
|
is_emulator: self.isEmulator(),
|
|
430
432
|
is_prod: self.isProd(),
|
|
431
433
|
action: nil,
|
|
432
|
-
channel: nil
|
|
434
|
+
channel: nil,
|
|
435
|
+
defaultChannel: self.defaultChannel
|
|
433
436
|
)
|
|
434
437
|
}
|
|
435
438
|
|
|
@@ -15,7 +15,7 @@ import Version
|
|
|
15
15
|
@objc(CapacitorUpdaterPlugin)
|
|
16
16
|
public class CapacitorUpdaterPlugin: CAPPlugin {
|
|
17
17
|
public var implementation = CapacitorUpdater()
|
|
18
|
-
private let PLUGIN_VERSION: String = "5.
|
|
18
|
+
private let PLUGIN_VERSION: String = "5.5.0"
|
|
19
19
|
static let updateUrlDefault = "https://api.capgo.app/updates"
|
|
20
20
|
static let statsUrlDefault = "https://api.capgo.app/stats"
|
|
21
21
|
static let channelUrlDefault = "https://api.capgo.app/channel_self"
|
|
@@ -80,6 +80,7 @@ public class CapacitorUpdaterPlugin: CAPPlugin {
|
|
|
80
80
|
print("\(self.implementation.TAG) appId \(implementation.appId)")
|
|
81
81
|
implementation.statsUrl = getConfig().getString("statsUrl", CapacitorUpdaterPlugin.statsUrlDefault)!
|
|
82
82
|
implementation.channelUrl = getConfig().getString("channelUrl", CapacitorUpdaterPlugin.channelUrlDefault)!
|
|
83
|
+
implementation.defaultChannel = getConfig().getString("defaultChannel", "")!
|
|
83
84
|
if resetWhenUpdate {
|
|
84
85
|
self.cleanupObsoleteVersions()
|
|
85
86
|
}
|
|
@@ -142,7 +143,7 @@ public class CapacitorUpdaterPlugin: CAPPlugin {
|
|
|
142
143
|
}
|
|
143
144
|
|
|
144
145
|
@objc func setUpdateUrl(_ call: CAPPluginCall) {
|
|
145
|
-
|
|
146
|
+
if !call.getBool("allowModifyUrl", false) {
|
|
146
147
|
print("\(self.implementation.TAG) setUpdateUrl called without allowModifyUrl")
|
|
147
148
|
call.reject("setUpdateUrl called without allowModifyUrl")
|
|
148
149
|
return
|
|
@@ -157,7 +158,7 @@ public class CapacitorUpdaterPlugin: CAPPlugin {
|
|
|
157
158
|
}
|
|
158
159
|
|
|
159
160
|
@objc func setStatsUrl(_ call: CAPPluginCall) {
|
|
160
|
-
|
|
161
|
+
if !call.getBool("allowModifyUrl", false) {
|
|
161
162
|
print("\(self.implementation.TAG) setStatsUrl called without allowModifyUrl")
|
|
162
163
|
call.reject("setStatsUrl called without allowModifyUrl")
|
|
163
164
|
return
|
|
@@ -172,7 +173,7 @@ public class CapacitorUpdaterPlugin: CAPPlugin {
|
|
|
172
173
|
}
|
|
173
174
|
|
|
174
175
|
@objc func setChannelUrl(_ call: CAPPluginCall) {
|
|
175
|
-
|
|
176
|
+
if !call.getBool("allowModifyUrl", false) {
|
|
176
177
|
print("\(self.implementation.TAG) setChannelUrl called without allowModifyUrl")
|
|
177
178
|
call.reject("setChannelUrl called without allowModifyUrl")
|
|
178
179
|
return
|