Skip to content

Commit

Permalink
fix: typo in text
Browse files Browse the repository at this point in the history
  • Loading branch information
riderx committed Mar 7, 2022
1 parent b18d37c commit 71b861f
Show file tree
Hide file tree
Showing 6 changed files with 35 additions and 33 deletions.
10 changes: 6 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
# capacitor-updater

Update capacitor app withtout store review.

You have 2 ways possible :
- use [capgo.app](https://capgo.app) a full featured auto update system in 5 min Setup, to manage version, update, revert and see stats.
- use manual methods to zip, upload, download, update or revert when you want.
Expand Down Expand Up @@ -94,14 +96,14 @@ Add in your main code
}
```

*Be extra carufull for your update* if you send a broken update, the app will crash until the user uninstall it.
*Be extra carufull for your update* if you send a broken update, the app will crash until the user reinstalls it.


You can list the version and manage it with the command below.

## Packaging `dist.zip`

Whatever you choose to name the file you download from your release/update server URL, the zip file should contain the full contents of your production Capacitor build output folder, usually `{project directory}/dist/`. This is where `index.html` will be located, and it should also contain all bundled JavaScript, CSS, and web resources necessary for your app to run.
Whatever you choose to name the file you download from your release/update server URL, the zip file should contain the full contents of your production Capacitor build output folder, usually `{project directory}/dist/` or `{project directory}/www/`. This is where `index.html` will be located, and it should also contain all bundled JavaScript, CSS, and web resources necessary for your app to run.

Do not password encrypt this file, or it will fail to unpack.

Expand Down Expand Up @@ -280,12 +282,12 @@ CapacitorUpdater.addListener('download', (info: any) => {

On iOS, Apple don't allow you to show a message when the app is updated, so you can't show a progress bar.

### Inspiraton
### Inspiration

- [cordova-plugin-ionic](https://github.com/ionic-team/cordova-plugin-ionic)
- [capacitor-codepush](https://github.dev/mapiacompany/capacitor-codepush)


### Contributer
### Contributors

[jamesyoung1337](https://github.com/jamesyoung1337) Thanks a lot for your guidance and support, it was impossible to make this plugin work without you.
Original file line number Diff line number Diff line change
Expand Up @@ -234,7 +234,7 @@ public ArrayList<String> list() {
res.add(i.getName());
}
} else {
Log.i(TAG, "NO version available" + destHot);
Log.i(TAG, "No version available" + destHot);
}
return res;
}
Expand Down Expand Up @@ -279,8 +279,7 @@ public void onResponse(String response) {
}, new Response.ErrorListener() {
@Override
public void onErrorResponse(VolleyError error) {
// Anything you want
Log.e(TAG, "Error get Latest");
Log.e(TAG, "Error getting Latest" + error);
}
});
RequestQueue requestQueue = Volley.newRequestQueue(this.context);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,12 @@ public void load() {
onActivityStarted(getActivity());
}

public void notifyDownload(int percent) {
JSObject ret = new JSObject();
ret.put("percent", percent);
notifyListeners("download", ret);
}

@PluginMethod
public void download(PluginCall call) {
new Thread(new Runnable(){
Expand Down Expand Up @@ -85,7 +91,7 @@ public void set(PluginCall call) {
Boolean res = implementation.set(version, versionName);

if (!res) {
call.reject("Update failed, version don't exist");
call.reject("Update failed, version " + version + " doesn't exist");
} else {
String pathHot = implementation.getLastPathHot();
Log.i(TAG, "getLastPathHot : " + pathHot);
Expand All @@ -94,12 +100,6 @@ public void set(PluginCall call) {
}
}

public void notifyDownload(int percent) {
JSObject ret = new JSObject();
ret.put("percent", percent);
notifyListeners("download", ret);
}

@PluginMethod
public void delete(PluginCall call) {
String version = call.getString("version");
Expand All @@ -108,7 +108,7 @@ public void delete(PluginCall call) {
if (res) {
call.resolve();
} else {
call.reject("Delete failed, version don't exist");
call.reject("Delete failed, version " + version + " doesn't exist");
}
} catch(IOException ex) {
Log.e("CapacitorUpdater", "An unexpected error occurred during deletion of folder. Message: " + ex.getMessage());
Expand Down Expand Up @@ -147,21 +147,22 @@ public void reset(PluginCall call) {
}

@PluginMethod
public void current(PluginCall call) {
String pathHot = implementation.getLastPathHot();
public void versionName(PluginCall call) {
String name = implementation.getVersionName();
JSObject ret = new JSObject();
String current = pathHot.length() >= 10 ? pathHot.substring(pathHot.length() - 10) : "default";
ret.put("current", current);
ret.put("versionName", name);
call.resolve(ret);
}

@PluginMethod
public void versionName(PluginCall call) {
String name = implementation.getVersionName();
public void current(PluginCall call) {
String pathHot = implementation.getLastPathHot();
JSObject ret = new JSObject();
ret.put("versionName", name);
String current = pathHot.length() >= 10 ? pathHot.substring(pathHot.length() - 10) : "default";
ret.put("current", current);
call.resolve(ret);
}

@PluginMethod
public void notifyAppReady(PluginCall call) {
editor.putBoolean("notifyAppReady", true);
Expand Down
2 changes: 1 addition & 1 deletion ios/Plugin/CapacitorUpdater.swift
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ extension Bundle {
latest.version = version
}
case let .failure(error):
print("✨ Capacitor-updater: Error get Latest \(url)", error )
print("✨ Capacitor-updater: Error getting Latest", error )
}
semaphore.signal()
}
Expand Down
4 changes: 2 additions & 2 deletions ios/Plugin/CapacitorUpdaterPlugin.swift
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ public class CapacitorUpdaterPlugin: CAPPlugin {
print("✨ Capacitor-updater: Set to version: \(version) versionName: \(versionName)")
call.resolve()
} else {
call.reject("Cannot reload")
call.reject("Update failed, version \(version) doesn't exist")
}
}

Expand All @@ -88,7 +88,7 @@ public class CapacitorUpdaterPlugin: CAPPlugin {
if (res) {
call.resolve()
} else {
call.reject("Delete failed, version don't exist")
call.reject("Delete failed, version \(version) doesn't exist")
}
}

Expand Down
16 changes: 8 additions & 8 deletions src/definitions.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
export interface CapacitorUpdaterPlugin {
/**
* Download new version from url, it should be a zip file, with files inside or with a unique folder inside with all your files
* Download a new version from the provided URL, it should be a zip file, with files inside or with a unique folder inside with all your files
* @returns {Promise<{version: string}>} an Promise with version name of the downloaded version, version is generated by the plugin, it's a random string of 10 char length
* @param url The url where download the version, it can be S3 github tag or whatever, it should be a zip file
* @param url The URL where download the version, it can be S3 github tag or whatever, it should be a zip file
*/
download(options: { url: string }): Promise<{ version: string }>;
/**
* Set version as current version, set will return error if there are no index.html file inside the version folder, versionName is optional and it's a custom value who will be saved for you
* Set version as current version, set will return an error if there are is no index.html file inside the version folder. `versionName` is optional and it's a custom value that will be saved for you
* @returns {Promise<void>} an empty Promise when the version is set, if there are no index.html or no version folder throw an error
* @param version The version name to set as current version
*/
Expand All @@ -18,7 +18,7 @@ export interface CapacitorUpdaterPlugin {
*/
delete(options: { version: string }): Promise<void>;
/**
* Get all avaible versions
* Get all available versions
* @returns {Promise<{version: string[]}>} an Promise witht the version list
*/
list(): Promise<{ versions: string[] }>;
Expand All @@ -28,7 +28,7 @@ export interface CapacitorUpdaterPlugin {
*/
reset(): Promise<void>;
/**
* Get the curent version, if none are set it return 'default'
* Get the current version, if none are set it returns 'default'
* @returns {Promise<{ current: string }>} an Promise with the current version name
*/
current(): Promise<{ current: string }>;
Expand All @@ -43,17 +43,17 @@ export interface CapacitorUpdaterPlugin {
*/
versionName(): Promise<{ versionName: string }>;
/**
* Notify native plugin that the update is working, only in auto update
* Notify native plugin that the update is working, only in auto-update
* @returns {Promise<void>} an Promise resolved directly
*/
notifyAppReady(): Promise<void>;
/**
* Skip update in the next app backgrounding, only in auto update
* Skip updates in the next time the app goes into the background, only in auto-update
* @returns {Promise<void>} an Promise resolved directly
*/
delayUpdate(): Promise<void>;
/**
* allow update in the next app backgrounding, only in auto update
* allow update in the next time the app goes into the background, only in auto-update
* @returns {Promise<void>} an Promise resolved directly
*/
cancelDelay(): Promise<void>;
Expand Down

0 comments on commit 71b861f

Please sign in to comment.