Skip to content

Commit

Permalink
feat!: update to capacitor 5, remove deprecated method
Browse files Browse the repository at this point in the history
  • Loading branch information
riderx committed May 22, 2023
1 parent 1fa7056 commit e342d9c
Show file tree
Hide file tree
Showing 12 changed files with 292 additions and 326 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ jobs:
uses: actions/setup-java@v3
with:
distribution: 'zulu'
java-version: '11'
java-version: '17'
- name: Build
id: build_code
run: npm run verify:android
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ jobs:
uses: actions/setup-java@v3
with:
distribution: 'zulu'
java-version: '11'
java-version: '17'
- name: Build
id: build_code
run: npm run verify:android
Expand Down
18 changes: 0 additions & 18 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,6 @@ Capacitor Updator works by unzipping a compiled app bundle to the native device
* [`current()`](#current)
* [`reload()`](#reload)
* [`setMultiDelay(...)`](#setmultidelay)
* [`setDelay(...)`](#setdelay)
* [`cancelDelay()`](#canceldelay)
* [`getLatest()`](#getlatest)
* [`setChannel(...)`](#setchannel)
Expand Down Expand Up @@ -304,23 +303,6 @@ Set <a href="#delaycondition">DelayCondition</a>, skip updates until one of the
--------------------


### setDelay(...)

```typescript
setDelay(options: DelayCondition) => Promise<void>
```

Set <a href="#delaycondition">DelayCondition</a>, skip updates until the condition is met

| Param | Type | Description |
| ------------- | --------------------------------------------------------- | ------------------------------------------------------------------ |
| **`options`** | <code><a href="#delaycondition">DelayCondition</a></code> | is the {@link <a href="#delaycondition">DelayCondition</a>} to set |

**Since:** 4.0.0

--------------------


### cancelDelay()

```typescript
Expand Down
16 changes: 8 additions & 8 deletions android/build.gradle
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
ext {
junitVersion = project.hasProperty('junitVersion') ? rootProject.ext.junitVersion : '4.13.2'
androidxAppCompatVersion = project.hasProperty('androidxAppCompatVersion') ? rootProject.ext.androidxAppCompatVersion : '1.4.1'
androidxJunitVersion = project.hasProperty('androidxJunitVersion') ? rootProject.ext.androidxJunitVersion : '1.1.3'
androidxEspressoCoreVersion = project.hasProperty('androidxEspressoCoreVersion') ? rootProject.ext.androidxEspressoCoreVersion : '3.4.0'
androidxAppCompatVersion = project.hasProperty('androidxAppCompatVersion') ? rootProject.ext.androidxAppCompatVersion : '1.6.1'
androidxJunitVersion = project.hasProperty('androidxJunitVersion') ? rootProject.ext.androidxJunitVersion : '1.1.5'
androidxEspressoCoreVersion = project.hasProperty('androidxEspressoCoreVersion') ? rootProject.ext.androidxEspressoCoreVersion : '3.5.1'
}

buildscript {
Expand All @@ -11,18 +11,18 @@ buildscript {
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:7.3.1'
classpath 'com.android.tools.build:gradle:8.0.0'
}
}

apply plugin: 'com.android.library'

android {
namespace "ee.forgr.capacitor_updater"
compileSdkVersion project.hasProperty('compileSdkVersion') ? rootProject.ext.compileSdkVersion : 32
compileSdkVersion project.hasProperty('compileSdkVersion') ? rootProject.ext.compileSdkVersion : 33
defaultConfig {
minSdkVersion project.hasProperty('minSdkVersion') ? rootProject.ext.minSdkVersion : 22
targetSdkVersion project.hasProperty('targetSdkVersion') ? rootProject.ext.targetSdkVersion : 32
targetSdkVersion project.hasProperty('targetSdkVersion') ? rootProject.ext.targetSdkVersion : 33
versionCode 1
versionName "1.0"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
Expand All @@ -37,8 +37,8 @@ android {
abortOnError false
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
sourceCompatibility JavaVersion.VERSION_17
targetCompatibility JavaVersion.VERSION_17
}
}

Expand Down
Binary file modified android/gradle/wrapper/gradle-wrapper.jar
Binary file not shown.
4 changes: 2 additions & 2 deletions android/gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-7.6.1-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.0.2-all.zip
networkTimeout=10000
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
zipStorePath=wrapper/dists
4 changes: 2 additions & 2 deletions android/gradlew
Original file line number Diff line number Diff line change
Expand Up @@ -144,15 +144,15 @@ if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then
case $MAX_FD in #(
max*)
# In POSIX sh, ulimit -H is undefined. That's why the result is checked to see if it worked.
# shellcheck disable=SC3045
# shellcheck disable=SC3045
MAX_FD=$( ulimit -H -n ) ||
warn "Could not query maximum file descriptor limit"
esac
case $MAX_FD in #(
'' | soft) :;; #(
*)
# In POSIX sh, ulimit -n is undefined. That's why the result is checked to see if it worked.
# shellcheck disable=SC3045
# shellcheck disable=SC3045
ulimit -n "$MAX_FD" ||
warn "Could not set maximum file descriptor limit to $MAX_FD"
esac
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -675,33 +675,6 @@ private Boolean _setMultiDelay(String delayConditions) {
}
}

@Deprecated
@PluginMethod
public void setDelay(final PluginCall call) {
try {
String kind = call.getString("kind");
String value = call.getString("value");
String delayConditions =
"[{\"kind\":\"" +
kind +
"\", \"value\":\"" +
(value != null ? value : "") +
"\"}]";
if (_setMultiDelay(delayConditions)) {
call.resolve();
} else {
call.reject("Failed to delay update");
}
} catch (final Exception e) {
Log.e(
CapacitorUpdater.TAG,
"Failed to delay update, [Error calling 'setDelay()']",
e
);
call.reject("Failed to delay update", e);
}
}

private boolean _cancelDelay(String source) {
try {
this.editor.remove(DELAY_CONDITION_PREFERENCES);
Expand Down Expand Up @@ -1260,8 +1233,7 @@ private boolean isMainActivity() {
Context mContext = this.getContext();
ActivityManager activityManager =
(ActivityManager) mContext.getSystemService(Context.ACTIVITY_SERVICE);
List<ActivityManager.AppTask> runningTasks =
activityManager.getAppTasks();
List<ActivityManager.AppTask> runningTasks = activityManager.getAppTasks();
ActivityManager.RecentTaskInfo runningTask = runningTasks
.get(0)
.getTaskInfo();
Expand Down
12 changes: 0 additions & 12 deletions ios/Plugin/CapacitorUpdaterPlugin.swift
Original file line number Diff line number Diff line change
Expand Up @@ -338,18 +338,6 @@ public class CapacitorUpdaterPlugin: CAPPlugin {
}
}

@available(*, deprecated, message: "use SetMultiDelay instead")
@objc func setDelay(_ call: CAPPluginCall) {
let kind: String = call.getString("kind", "")
let value: String? = call.getString("value", "")
let delayConditions: String = "[{\"kind\":\"\(kind)\", \"value\":\"\(value ?? "")\"}]"
if _setMultiDelay(delayConditions: delayConditions) {
call.resolve()
} else {
call.reject("Failed to delay update")
}
}

private func _setMultiDelay(delayConditions: String?) -> Bool {
if delayConditions != nil && "" != delayConditions {
UserDefaults.standard.set(delayConditions, forKey: DELAY_CONDITION_PREFERENCES)
Expand Down
30 changes: 15 additions & 15 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@capgo/capacitor-updater",
"version": "4.61.8",
"version": "5.0.0",
"packageManager": "pnpm@8.5.1",
"license": "MPL-2.0",
"description": "Live update for capacitor apps",
Expand Down Expand Up @@ -53,24 +53,24 @@
"prepublishOnly": "npm run build"
},
"devDependencies": {
"@capacitor/android": "^4.8.0",
"@capacitor/cli": "^4.8.0",
"@capacitor/core": "^4.8.0",
"@capacitor/android": "^5.0.3",
"@capacitor/cli": "^5.0.3",
"@capacitor/core": "^5.0.3",
"@capacitor/docgen": "^0.2.1",
"@capacitor/ios": "^4.8.0",
"@capacitor/ios": "^5.0.3",
"@ionic/eslint-config": "^0.3.0",
"@ionic/prettier-config": "^2.0.0",
"@ionic/prettier-config": "^3.0.0",
"@ionic/swiftlint-config": "^1.1.2",
"@types/node": "^18.15.11",
"@typescript-eslint/eslint-plugin": "^5.58.0",
"@typescript-eslint/parser": "^5.58.0",
"eslint": "^8.39.0",
"@types/node": "^20.2.3",
"@typescript-eslint/eslint-plugin": "^5.59.7",
"@typescript-eslint/parser": "^5.59.7",
"eslint": "^8.41.0",
"eslint-plugin-import": "^2.27.5",
"prettier": "^2.8.7",
"prettier": "^2.8.8",
"prettier-plugin-java": "^2.1.0",
"rimraf": "^5.0.0",
"rollup": "^3.20.7",
"swiftlint": "^1.0.1",
"rimraf": "^5.0.1",
"rollup": "^3.23.0",
"swiftlint": "^1.0.2",
"typescript": "^5.0.4"
},
"peerDependencies": {
Expand All @@ -89,4 +89,4 @@
"src": "android"
}
}
}
}

0 comments on commit e342d9c

Please sign in to comment.