Skip to content
This repository has been archived by the owner on Sep 6, 2019. It is now read-only.

Commit

Permalink
Added intent for update check
Browse files Browse the repository at this point in the history
Closes #1867
  • Loading branch information
M66B committed Aug 16, 2014
1 parent 7e3ecf4 commit fea4eef
Show file tree
Hide file tree
Showing 5 changed files with 17 additions and 25 deletions.
1 change: 1 addition & 0 deletions AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -149,6 +149,7 @@
<action android:name="biz.bokhorst.xprivacy.action.FETCH" />
<action android:name="biz.bokhorst.xprivacy.action.SUBMIT" />
<action android:name="biz.bokhorst.xprivacy.action.TOGGLE" />
<action android:name="biz.bokhorst.xprivacy.action.UPDATE" />

<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
Expand Down
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ Version 2.99.x and version 3.x will be available with a [pro license](http://www
**Next release**

* Added application specific quirks ([issue](/../../issues/1844))
* Added intent for update check ([issue](/../../issues/1867))
* Updated Simplified Chinese translation

[Open issues](https://github.com/M66B/XPrivacy/issues?state=open)
Expand Down
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -1076,7 +1076,7 @@ am start -a biz.bokhorst.xprivacy.action.USAGE
am start -a biz.bokhorst.xprivacy.action.USAGE --ei Uid 10123
```

* Export, import, submit, fetch, toggle
* Export, import, submit, fetch, toggle, update

```
am start -a biz.bokhorst.xprivacy.action.EXPORT
Expand All @@ -1086,6 +1086,7 @@ am start -a biz.bokhorst.xprivacy.action.IMPORT --eia UidList 10123,10124 --ez I
am start -a biz.bokhorst.xprivacy.action.SUBMIT --eia UidList 10123,10124 --ez Interactive true
am start -a biz.bokhorst.xprivacy.action.FETCH --eia UidList 10123,10124 --ez Interactive true
am start -a biz.bokhorst.xprivacy.action.TOGGLE --eia UidList 10123,10124 --ez Interactive true
am start -a biz.bokhorst.xprivacy.action.UPDATE
```

With Tasker, you can create shortcuts on your homescreen:
Expand Down
19 changes: 0 additions & 19 deletions src/biz/bokhorst/xprivacy/ActivityMain.java
Original file line number Diff line number Diff line change
@@ -1,9 +1,6 @@
package biz.bokhorst.xprivacy;

import java.io.ByteArrayOutputStream;
import java.io.File;
import java.io.FileOutputStream;
import java.io.IOException;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Comparator;
Expand All @@ -15,24 +12,9 @@
import java.util.concurrent.ThreadFactory;
import java.util.concurrent.atomic.AtomicInteger;

import org.apache.http.HttpResponse;
import org.apache.http.HttpStatus;
import org.apache.http.StatusLine;
import org.apache.http.client.HttpClient;
import org.apache.http.client.methods.HttpPost;
import org.apache.http.entity.ByteArrayEntity;
import org.apache.http.impl.client.DefaultHttpClient;
import org.apache.http.params.BasicHttpParams;
import org.apache.http.params.HttpConnectionParams;
import org.apache.http.params.HttpParams;
import org.json.JSONObject;

import android.annotation.SuppressLint;
import android.app.AlertDialog;
import android.app.Dialog;
import android.app.Notification;
import android.app.NotificationManager;
import android.app.PendingIntent;
import android.app.ProgressDialog;
import android.content.BroadcastReceiver;
import android.content.Context;
Expand All @@ -55,7 +37,6 @@
import android.os.Environment;
import android.os.Handler;
import android.os.Process;
import android.support.v4.app.NotificationCompat;
import android.text.Editable;
import android.text.TextWatcher;
import android.util.Log;
Expand Down
18 changes: 13 additions & 5 deletions src/biz/bokhorst/xprivacy/ActivityShare.java
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,7 @@ public class ActivityShare extends ActivityBase {
public static final String ACTION_FETCH = "biz.bokhorst.xprivacy.action.FETCH";
public static final String ACTION_SUBMIT = "biz.bokhorst.xprivacy.action.SUBMIT";
public static final String ACTION_TOGGLE = "biz.bokhorst.xprivacy.action.TOGGLE";
public static final String ACTION_UPDATE = "biz.bokhorst.xprivacy.action.UPDATE";

public static final int CHOICE_CLEAR = 1;
public static final int CHOICE_TEMPLATE = 2;
Expand Down Expand Up @@ -161,14 +162,14 @@ protected void onCreate(Bundle savedInstanceState) {
mFileName = (extras != null && extras.containsKey(cFileName) ? extras.getString(cFileName) : null);

// License check
if (action.equals(ACTION_IMPORT) || action.equals(ACTION_EXPORT)
|| (action.equals(ACTION_TOGGLE) && uids.length > 1)) {
if (action.equals(ACTION_IMPORT) || action.equals(ACTION_EXPORT)) {
if (!Util.isProEnabled() && Util.hasProLicense(this) == null) {
Util.viewUri(this, ActivityMain.cProUri);
finish();
return;
}
} else if (action.equals(ACTION_FETCH)) {
} else if (action.equals(ACTION_FETCH) || action.equals(ACTION_UPDATE)
|| (action.equals(ACTION_TOGGLE) && uids.length > 1)) {
if (Util.hasProLicense(this) == null) {
Util.viewUri(this, ActivityMain.cProUri);
finish();
Expand All @@ -182,6 +183,13 @@ protected void onCreate(Bundle savedInstanceState) {
return;
}

// Update
if (action.equals(ACTION_UPDATE)) {
new UpdateTask(getApplicationContext()).executeOnExecutor(mExecutor);
finish();
return;
}

// Check whether we need a user interface
if (extras != null && extras.containsKey(cInteractive) && extras.getBoolean(cInteractive, false))
mInteractive = true;
Expand Down Expand Up @@ -1826,12 +1834,12 @@ public void onClick(DialogInterface dialog, int which) {
}

public static class UpdateTask extends AsyncTask<Object, Object, Object> {
private ActivityBase mContext;
private Context mContext;
private NotificationCompat.Builder builder;
private Notification notification;
private NotificationManager notificationManager;

public UpdateTask(ActivityBase context) {
public UpdateTask(Context context) {
mContext = context;
builder = new NotificationCompat.Builder(context);
notificationManager = (NotificationManager) context.getSystemService(Context.NOTIFICATION_SERVICE);
Expand Down

0 comments on commit fea4eef

Please sign in to comment.