Compare commits

..

4 Commits

Author SHA1 Message Date
Eric Kok 9e3612469b
Merge pull request #653 from jedrivisser/ide-code-completion 10 months ago
Eric Kok 9457215b95
Merge branch 'master' into ide-code-completion 10 months ago
Eric Kok 6faa976fd1 Fix #647 by using short version code method 10 months ago
Jedri Visser fdcad7b428 Add legacy org apache lib for local development 2 years ago
  1. 5
      app/build.gradle
  2. BIN
      app/libs/org.apache.http.legacy.jar
  3. 11
      app/src/main/java/org/transdroid/core/service/AppUpdateJobRunner.java

5
app/build.gradle

@ -103,4 +103,9 @@ dependencies {
annotationProcessor 'org.androidannotations:androidannotations:4.8.0' annotationProcessor 'org.androidannotations:androidannotations:4.8.0'
annotationProcessor 'org.androidannotations:ormlite:4.8.0' annotationProcessor 'org.androidannotations:ormlite:4.8.0'
// Copied From androidSdkPath/platforms/android-31/optional/org.apache.http.legacy.jar
// Using it as a compileOnly so this helps while developing, but is not compiled into the final
// app, see https://developer.android.com/studio/build/dependencies#dependency_configurations
compileOnly files('libs/org.apache.http.legacy.jar')
} }

BIN
app/libs/org.apache.http.legacy.jar

Binary file not shown.

11
app/src/main/java/org/transdroid/core/service/AppUpdateJobRunner.java

@ -26,7 +26,6 @@ import android.net.Uri;
import androidx.core.app.NotificationCompat; import androidx.core.app.NotificationCompat;
import androidx.work.ListenableWorker;
import androidx.work.Worker; import androidx.work.Worker;
import org.androidannotations.annotations.Bean; import org.androidannotations.annotations.Bean;
@ -91,7 +90,7 @@ public class AppUpdateJobRunner {
lastDay.add(Calendar.DAY_OF_MONTH, -1); lastDay.add(Calendar.DAY_OF_MONTH, -1);
if (lastChecked != null && lastChecked.after(lastDay.getTime())) { if (lastChecked != null && lastChecked.after(lastDay.getTime())) {
log.d(this, "Skip the update service, as we already checked the last 24 hours (or to be exact at " log.d(this, "Skip the update service, as we already checked the last 24 hours (or to be exact at "
+ lastChecked.toString() + ")."); + lastChecked + ").");
return Worker.Result.retry(); return Worker.Result.retry();
} }
@ -109,9 +108,9 @@ public class AppUpdateJobRunner {
// New version of the app? // New version of the app?
try { try {
PackageInfo appPackage = context.getPackageManager().getPackageInfo(context.getPackageName(), 0); PackageInfo appPackage = context.getPackageManager().getPackageInfo(context.getPackageName(), 0);
log.d(this, "Local Transdroid is at " + appPackage.getLongVersionCode() + " and the reported latest version is " log.d(this, "Local Transdroid is at " + appPackage.versionCode + " and the reported latest version is "
+ appVersion); + appVersion);
if (appPackage.getLongVersionCode() < appVersion) { if (appPackage.versionCode < appVersion) {
// New version available! Notify the user. // New version available! Notify the user.
newNotification(context.getString(R.string.update_app_newversion), newNotification(context.getString(R.string.update_app_newversion),
context.getString(R.string.update_app_newversion), context.getString(R.string.update_app_newversion),
@ -125,9 +124,9 @@ public class AppUpdateJobRunner {
// New version of the search module? // New version of the search module?
try { try {
PackageInfo searchPackage = context.getPackageManager().getPackageInfo("org.transdroid.search", 0); PackageInfo searchPackage = context.getPackageManager().getPackageInfo("org.transdroid.search", 0);
log.d(this, "Local Transdroid Search is at " + searchPackage.getLongVersionCode() log.d(this, "Local Transdroid Search is at " + searchPackage.versionCode
+ " and the reported latest version is " + searchVersion); + " and the reported latest version is " + searchVersion);
if (searchPackage.getLongVersionCode() < searchVersion) { if (searchPackage.versionCode < searchVersion) {
// New version available! Notify the user. // New version available! Notify the user.
newNotification(context.getString(R.string.update_search_newversion), newNotification(context.getString(R.string.update_search_newversion),
context.getString(R.string.update_search_newversion), context.getString(R.string.update_search_newversion),

Loading…
Cancel
Save