Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code

Unified Diff: src/org/adblockplus/android/ABPEngine.java

Issue 5153282527854592: Issue 98 - Use the libadblockplus update mechanism (Closed)
Patch Set: Only append the revision to the version for devbuilds Created Sept. 26, 2014, 2:54 p.m.
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « res/values/strings.xml ('k') | src/org/adblockplus/android/AdblockPlus.java » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/org/adblockplus/android/ABPEngine.java
===================================================================
--- a/src/org/adblockplus/android/ABPEngine.java
+++ b/src/org/adblockplus/android/ABPEngine.java
@@ -21,7 +21,6 @@
import java.util.Locale;
import org.adblockplus.libadblockplus.AppInfo;
-import org.adblockplus.libadblockplus.EventCallback;
import org.adblockplus.libadblockplus.Filter;
import org.adblockplus.libadblockplus.FilterChangeCallback;
import org.adblockplus.libadblockplus.FilterEngine;
@@ -29,6 +28,7 @@
import org.adblockplus.libadblockplus.JsEngine;
import org.adblockplus.libadblockplus.LogSystem;
import org.adblockplus.libadblockplus.Subscription;
+import org.adblockplus.libadblockplus.UpdateAvailableCallback;
import org.adblockplus.libadblockplus.UpdateCheckDoneCallback;
import org.adblockplus.libadblockplus.WebRequest;
@@ -59,7 +59,7 @@
private volatile FilterEngine filterEngine;
private volatile LogSystem logSystem;
private volatile WebRequest webRequest;
- private volatile EventCallback updateCallback;
+ private volatile UpdateAvailableCallback updateAvailableCallback;
private volatile UpdateCheckDoneCallback updateCheckDoneCallback;
private volatile FilterChangeCallback filterChangeCallback;
@@ -70,11 +70,14 @@
public static AppInfo generateAppInfo(final Context context)
{
+ final boolean developmentBuild = !context.getResources().getBoolean(R.bool.def_release);
String version = "0";
try
{
final PackageInfo info = context.getPackageManager().getPackageInfo(context.getPackageName(), 0);
- version = info.versionName + "." + info.versionCode;
+ version = info.versionName;
+ if (developmentBuild)
+ version += "." + info.versionCode;
}
catch (final NameNotFoundException e)
{
@@ -82,7 +85,6 @@
}
final String sdkVersion = String.valueOf(VERSION.SDK_INT);
final String locale = Locale.getDefault().toString().replace('_', '-');
- final boolean developmentBuild = !context.getResources().getBoolean(R.bool.def_release);
return AppInfo.builder()
.setVersion(version)
@@ -105,10 +107,9 @@
engine.webRequest = new AndroidWebRequest();
engine.jsEngine.setWebRequest(engine.webRequest);
- engine.updateCallback = new AndroidUpdateAvailableCallback(context);
- engine.jsEngine.setEventCallback("updateAvailable", engine.updateCallback);
-
engine.filterEngine = new FilterEngine(engine.jsEngine);
+ engine.updateAvailableCallback = new AndroidUpdateAvailableCallback(context);
+ engine.filterEngine.setUpdateAvailableCallback(engine.updateAvailableCallback);
engine.filterChangeCallback = new AndroidFilterChangeCallback(context);
engine.filterEngine.setFilterChangeCallback(engine.filterChangeCallback);
@@ -144,10 +145,10 @@
this.webRequest = null;
}
- if (this.updateCallback != null)
+ if (this.updateAvailableCallback != null)
{
- this.updateCallback.dispose();
- this.updateCallback = null;
+ this.updateAvailableCallback.dispose();
+ this.updateAvailableCallback = null;
}
if (this.updateCheckDoneCallback != null)
« no previous file with comments | « res/values/strings.xml ('k') | src/org/adblockplus/android/AdblockPlus.java » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld