Skip to content

Commit

Permalink
fix: build issue android back to v4
Browse files Browse the repository at this point in the history
  • Loading branch information
riderx committed May 8, 2023
1 parent 8785b37 commit 0191db4
Show file tree
Hide file tree
Showing 8 changed files with 150 additions and 72 deletions.
12 changes: 6 additions & 6 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.6.1'
androidxJunitVersion = project.hasProperty('androidxJunitVersion') ? rootProject.ext.androidxJunitVersion : '1.1.5'
androidxEspressoCoreVersion = project.hasProperty('androidxEspressoCoreVersion') ? rootProject.ext.androidxEspressoCoreVersion : '3.5.1'
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'
}

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

apply plugin: 'com.android.library'

android {
namespace "ee.forgr.capacitor_updater"
compileSdkVersion project.hasProperty('compileSdkVersion') ? rootProject.ext.compileSdkVersion : 33
compileSdkVersion project.hasProperty('compileSdkVersion') ? rootProject.ext.compileSdkVersion : 32
defaultConfig {
minSdkVersion project.hasProperty('minSdkVersion') ? rootProject.ext.minSdkVersion : 22
targetSdkVersion project.hasProperty('targetSdkVersion') ? rootProject.ext.targetSdkVersion : 33
targetSdkVersion project.hasProperty('targetSdkVersion') ? rootProject.ext.targetSdkVersion : 32
versionCode 1
versionName "1.0"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
Expand Down
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-8.0.2-all.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-7.6.1-bin.zip
networkTimeout=10000
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
zipStorePath=wrapper/dists
Original file line number Diff line number Diff line change
Expand Up @@ -349,7 +349,7 @@ public void finishDownload(
new Date(System.currentTimeMillis()),
checksum
);
this.saveBundleInfo(id, info);
this.saveBundleInfo(id, next);
if (
checksumRes != null &&
!checksumRes.isEmpty() &&
Expand All @@ -360,12 +360,11 @@ public void finishDownload(
"Error checksum " + next.getChecksum() + " " + checksum
);
this.sendStats("checksum_fail", getCurrentBundle().getVersionName());
final String id = info.getId();
final Boolean res = this.delete(id);
if (res) {
Log.i(
CapacitorUpdater.TAG,
"Failed bundle deleted: " + info.getVersionName()
"Failed bundle deleted: " + next.getVersionName()
);
}
throw new IOException("Checksum failed: " + id);
Expand Down
4 changes: 2 additions & 2 deletions ios/Plugin/CapacitorUpdaterPlugin.swift
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ public class CapacitorUpdaterPlugin: CAPPlugin {
if !resDel {
print("\(self.implementation.TAG) Delete failed, id \(id) doesn't exist")
}
throw "Checksum failed: \(id)"
throw ObjectSavableError.checksum
}
self.notifyListeners("updateAvailable", data: ["bundle": next.toJSON()])
call.resolve(next.toJSON())
Expand Down Expand Up @@ -567,7 +567,7 @@ public class CapacitorUpdaterPlugin: CAPPlugin {
print("\(self.implementation.TAG) Delete failed, id \(id) doesn't exist")
}
self.endBackGroundTask()
throw "Checksum failed: \(id)"
throw ObjectSavableError.checksum
}
self.notifyListeners("updateAvailable", data: ["bundle": next.toJSON()])
_ = self.implementation.setNextBundle(next: next.getId())
Expand Down
1 change: 1 addition & 0 deletions ios/Plugin/UserDefaultsExtension.swift
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ enum ObjectSavableError: String, LocalizedError {
case unableToEncode = "Unable to encode object into data"
case noValue = "No data object found for the given key"
case unableToDecode = "Unable to decode object into given type"
case checksum = "Checksum failed"

var errorDescription: String? {
rawValue
Expand Down
14 changes: 14 additions & 0 deletions ios/Podfile
Original file line number Diff line number Diff line change
Expand Up @@ -17,3 +17,17 @@ end
target 'PluginTests' do
capacitor_pods
end

post_install do |installer|
# Here is the code I provide above ==================
installer.generated_projects.each do |project|
project.targets.each do |target|
target.build_configurations.each do |config|
if config.build_settings['IPHONEOS_DEPLOYMENT_TARGET'] == '8.0'
config.build_settings['IPHONEOS_DEPLOYMENT_TARGET'] = '11.0'
end
end
end
end
#Here is the end ===================================
end
8 changes: 4 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -53,11 +53,11 @@
"prepublishOnly": "npm run build"
},
"devDependencies": {
"@capacitor/android": "^5.0.0",
"@capacitor/cli": "^5.0.0",
"@capacitor/core": "^5.0.0",
"@capacitor/android": "^4.8.0",
"@capacitor/cli": "^4.8.0",
"@capacitor/core": "^4.8.0",
"@capacitor/docgen": "^0.2.1",
"@capacitor/ios": "^5.0.0",
"@capacitor/ios": "^4.8.0",
"@ionic/eslint-config": "^0.3.0",
"@ionic/prettier-config": "^2.0.0",
"@ionic/swiftlint-config": "^1.1.2",
Expand Down

0 comments on commit 0191db4

Please sign in to comment.