Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(remote-package): use downloadProgress callback #75

Open
wants to merge 5 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .idea/.gitignore

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

12 changes: 12 additions & 0 deletions .idea/GitlabLint.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

12 changes: 12 additions & 0 deletions .idea/capacitor-codepush.iml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

65 changes: 65 additions & 0 deletions .idea/codeStyles/Project.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 5 additions & 0 deletions .idea/codeStyles/codeStyleConfig.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions .idea/inspectionProfiles/Project_Default.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 8 additions & 0 deletions .idea/modules.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions .idea/vcs.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ Once you've followed the general-purpose ["getting started"](https://docs.micros

```shell
npm i @capacitor-community/http@next @capacitor/device @capacitor/dialog @capacitor/filesystem -D
npm i https://github.com/mapiacompany/capacitor-codepush -D
npm i https://github.com/salohcin714/capacitor-codepush -D
npx cap sync
```

Expand Down
3 changes: 3 additions & 0 deletions android/.idea/.gitignore

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions android/.idea/compiler.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

20 changes: 20 additions & 0 deletions android/.idea/gradle.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

30 changes: 30 additions & 0 deletions android/.idea/jarRepositories.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 10 additions & 0 deletions android/.idea/misc.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions android/.idea/vcs.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Binary file added android/app/src/main/assets/cdvasset.manifest
Binary file not shown.
16 changes: 9 additions & 7 deletions android/build.gradle
Original file line number Diff line number Diff line change
@@ -1,26 +1,28 @@
ext {
junitVersion = project.hasProperty('junitVersion') ? rootProject.ext.junitVersion : '4.12'
androidxJunitVersion = project.hasProperty('androidxJunitVersion') ? rootProject.ext.androidxJunitVersion : '1.1.1'
androidxEspressoCoreVersion = project.hasProperty('androidxEspressoCoreVersion') ? rootProject.ext.androidxEspressoCoreVersion : '3.2.0'
junitVersion = project.hasProperty('junitVersion') ? rootProject.ext.junitVersion : '4.13.2'
androidxJunitVersion = project.hasProperty('androidxJunitVersion') ? rootProject.ext.androidxJunitVersion : '1.1.5'
androidxEspressoCoreVersion = project.hasProperty('androidxEspressoCoreVersion') ? rootProject.ext.androidxEspressoCoreVersion : '3.5.1'
}

buildscript {
repositories {
google()
mavenCentral()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.6.1'
classpath 'com.android.tools.build:gradle:8.0.0'
}
}

apply plugin: 'com.android.library'

android {
compileSdkVersion project.hasProperty('compileSdkVersion') ? rootProject.ext.compileSdkVersion : 30
namespace "com.microsoft.capacitor.codepush"
compileSdkVersion project.hasProperty('compileSdkVersion') ? rootProject.ext.compileSdkVersion : 33
defaultConfig {
minSdkVersion project.hasProperty('minSdkVersion') ? rootProject.ext.minSdkVersion : 24
targetSdkVersion project.hasProperty('targetSdkVersion') ? rootProject.ext.targetSdkVersion : 30
targetSdkVersion project.hasProperty('targetSdkVersion') ? rootProject.ext.targetSdkVersion : 33
versionCode 1
versionName "1.0"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
Expand Down Expand Up @@ -48,7 +50,7 @@ repositories {
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation project(':capacitor-android')
implementation "androidx.appcompat:appcompat:$androidxAppCompatVersion"
implementation "androidx.appcompat:appcompat:1.2.0"
implementation 'com.nimbusds:nimbus-jose-jwt:5.1'
testImplementation "junit:junit:$junitVersion"
androidTestImplementation "androidx.test.ext:junit:$androidxJunitVersion"
Expand Down
3 changes: 1 addition & 2 deletions android/gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -20,5 +20,4 @@ org.gradle.jvmargs=-Xmx1536m
# Android operating system, and which are packaged with your app's APK
# https://developer.android.com/topic/libraries/support-library/androidx-rn
android.useAndroidX=true
# Automatically convert third-party libraries to use AndroidX
android.enableJetifier=true

2 changes: 1 addition & 1 deletion android/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.microsoft.capacitor.codepush">
>
</manifest>
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

import android.content.Context;
import android.content.SharedPreferences;
import android.util.Log;

import org.json.JSONException;

Expand Down Expand Up @@ -30,7 +31,7 @@ public class CodePushPreferences {
private static final String LAST_VERSION_DEPLOYMENT_KEY_KEY = "LAST_VERSION_DEPLOYMENT_KEY_KEY";
private static final String LAST_VERSION_LABEL_OR_APP_VERSION_KEY = "LAST_VERSION_LABEL_OR_APP_VERSION_KEY";

private Context context;
private final Context context;

public CodePushPreferences(Context context) {
this.context = context;
Expand All @@ -45,7 +46,7 @@ public void saveBinaryHash(String binaryHash) {
SharedPreferences preferences = context.getSharedPreferences(CodePushPreferences.BINARY_HASH_PREFERENCE, Context.MODE_PRIVATE);
SharedPreferences.Editor editor = preferences.edit();
editor.putString(CodePushPreferences.BINARY_HASH_PREFERENCE_KEY, binaryHash);
editor.commit();
editor.apply();
}

public void saveFailedUpdate(String hashCode) {
Expand All @@ -58,7 +59,7 @@ public void saveFailedUpdate(String hashCode) {
failedUpdatesSet.add(hashCode);
SharedPreferences.Editor editor = preferences.edit();
editor.putStringSet(CodePushPreferences.FAILED_UPDATES_KEY, failedUpdatesSet);
editor.commit();
editor.apply();
}

public boolean isFailedUpdate(String hashCode) {
Expand All @@ -80,7 +81,7 @@ public void savePendingInstall(InstallOptions installOptions) {
SharedPreferences.Editor editor = preferences.edit();
editor.putInt(CodePushPreferences.INSTALL_MODE_KEY, installOptions.installMode.getValue());
editor.putInt(CodePushPreferences.INSTALL_MIN_BACKGROUND_DURATION, installOptions.minimumBackgroundDuration);
editor.commit();
editor.apply();
}

public void clearPendingInstall() {
Expand All @@ -105,7 +106,7 @@ public void markInstallNeedsConfirmation() {
SharedPreferences preferences = context.getSharedPreferences(CodePushPreferences.INSTALL_NEEDS_CONFIRMATION, Context.MODE_PRIVATE);
SharedPreferences.Editor editor = preferences.edit();
editor.putBoolean(CodePushPreferences.INSTALL_NEEDS_CONFIRMATION_KEY, true);
editor.commit();
editor.apply();
}

public void clearInstallNeedsConfirmation() {
Expand All @@ -114,35 +115,33 @@ public void clearInstallNeedsConfirmation() {

public boolean installNeedsConfirmation() {
SharedPreferences preferences = context.getSharedPreferences(CodePushPreferences.INSTALL_NEEDS_CONFIRMATION, Context.MODE_PRIVATE);
boolean notConfirmedInstall = preferences.getBoolean(CodePushPreferences.INSTALL_NEEDS_CONFIRMATION_KEY, false);
return notConfirmedInstall;
return preferences.getBoolean(CodePushPreferences.INSTALL_NEEDS_CONFIRMATION_KEY, false);
}

public void clearBinaryFirstRunFlag() {
SharedPreferences preferences = context.getSharedPreferences(CodePushPreferences.FIRST_RUN_PREFERENCE, Context.MODE_PRIVATE);
SharedPreferences.Editor editor = preferences.edit();
editor.remove(CodePushPreferences.FIRST_RUN_PREFERENCE_KEY);
editor.commit();
editor.apply();
}

public void saveBinaryFirstRunFlag() {
SharedPreferences preferences = context.getSharedPreferences(CodePushPreferences.FIRST_RUN_PREFERENCE, Context.MODE_PRIVATE);
SharedPreferences.Editor editor = preferences.edit();
editor.putBoolean(CodePushPreferences.FIRST_RUN_PREFERENCE_KEY, false);
editor.commit();
editor.apply();
}

public boolean isBinaryFirstRun() {
SharedPreferences preferences = context.getSharedPreferences(CodePushPreferences.FIRST_RUN_PREFERENCE, Context.MODE_PRIVATE);
boolean isFirstRun = preferences.getBoolean(CodePushPreferences.FIRST_RUN_PREFERENCE_KEY, true);
return isFirstRun;
return preferences.getBoolean(CodePushPreferences.FIRST_RUN_PREFERENCE_KEY, true);
}

public void clearPreferences(String preferencesId) {
SharedPreferences preferences = context.getSharedPreferences(preferencesId, Context.MODE_PRIVATE);
SharedPreferences.Editor editor = preferences.edit();
editor.clear();
editor.commit();
editor.apply();
}

public void clearFailedReport() {
Expand All @@ -165,15 +164,15 @@ public void saveFailedReport(StatusReport statusReport) {
SharedPreferences preferences = context.getSharedPreferences(CodePushPreferences.FAILED_STATUS_REPORT_PREFERENCE, Context.MODE_PRIVATE);
SharedPreferences.Editor editor = preferences.edit();
editor.putString(CodePushPreferences.FAILED_STATUS_REPORT_PREFERENCE_KEY, statusReport.serialize());
editor.commit();
editor.apply();
}

public void saveLastVersion(String labelOrAppVersion, String deploymentKey) {
SharedPreferences preferences = context.getSharedPreferences(CodePushPreferences.LAST_VERSION_PREFERENCE, Context.MODE_PRIVATE);
SharedPreferences.Editor editor = preferences.edit();
editor.putString(CodePushPreferences.LAST_VERSION_LABEL_OR_APP_VERSION_KEY, labelOrAppVersion);
editor.putString(CodePushPreferences.LAST_VERSION_DEPLOYMENT_KEY_KEY, deploymentKey);
editor.commit();
editor.apply();
}

public String getLastVersionDeploymentKey() {
Expand Down
Loading