aboutsummaryrefslogtreecommitdiffstats
path: root/src/main
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--src/main/java/eu/siacs/conversations/services/CheckAppVersionService.java3
-rw-r--r--src/main/java/eu/siacs/conversations/services/UpdaterWebService.java7
-rw-r--r--src/main/java/eu/siacs/conversations/ui/UpdaterActivity.java29
-rw-r--r--src/main/res/values-de/strings.xml2
-rw-r--r--src/main/res/values/strings.xml2
5 files changed, 12 insertions, 31 deletions
diff --git a/src/main/java/eu/siacs/conversations/services/CheckAppVersionService.java b/src/main/java/eu/siacs/conversations/services/CheckAppVersionService.java
index dc57745f1..52962a314 100644
--- a/src/main/java/eu/siacs/conversations/services/CheckAppVersionService.java
+++ b/src/main/java/eu/siacs/conversations/services/CheckAppVersionService.java
@@ -33,11 +33,10 @@ public class CheckAppVersionService extends HttpServlet {
myObj.addProperty("success", false);
myObj.addProperty("latestVersionCode", 2);
myObj.addProperty("latestVersion", "1.0.0");
+ myObj.addProperty("changelog", "");
myObj.addProperty("filesize", "");
myObj.addProperty("appURI", "");
out.println(myObj.toString());
out.close();
-
}
-
}
diff --git a/src/main/java/eu/siacs/conversations/services/UpdaterWebService.java b/src/main/java/eu/siacs/conversations/services/UpdaterWebService.java
index d7044d73a..dbeaee2b8 100644
--- a/src/main/java/eu/siacs/conversations/services/UpdaterWebService.java
+++ b/src/main/java/eu/siacs/conversations/services/UpdaterWebService.java
@@ -29,8 +29,8 @@ public class UpdaterWebService extends IntentService {
public static final String RESPONSE_MESSAGE = "";
private String URL = null;
- public static final int REGISTRATION_TIMEOUT = 3 * 1000;
- public static final int WAIT_TIMEOUT = 30 * 1000;
+ public static final int REGISTRATION_TIMEOUT = Config.SOCKET_TIMEOUT;
+ public static final int WAIT_TIMEOUT = Config.CONNECT_TIMEOUT;
public UpdaterWebService() {
super("UpdaterWebService");
@@ -89,14 +89,11 @@ public class UpdaterWebService extends IntentService {
responseMessage = "";
}
-
Intent broadcastIntent = new Intent();
broadcastIntent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
broadcastIntent.setAction(UpdateReceiver.PROCESS_RESPONSE);
broadcastIntent.addCategory(Intent.CATEGORY_DEFAULT);
broadcastIntent.putExtra(RESPONSE_MESSAGE, responseMessage);
sendBroadcast(broadcastIntent);
-
}
-
} \ No newline at end of file
diff --git a/src/main/java/eu/siacs/conversations/ui/UpdaterActivity.java b/src/main/java/eu/siacs/conversations/ui/UpdaterActivity.java
index dad6b9232..70536d5f5 100644
--- a/src/main/java/eu/siacs/conversations/ui/UpdaterActivity.java
+++ b/src/main/java/eu/siacs/conversations/ui/UpdaterActivity.java
@@ -18,7 +18,6 @@ import android.os.Build;
import android.os.Bundle;
import android.os.Environment;
import android.support.v4.app.ActivityCompat;
-import android.util.Log;
import android.view.WindowManager;
import android.widget.TextView;
import android.widget.Toast;
@@ -45,7 +44,9 @@ public class UpdaterActivity extends Activity {
private int versionCode = 0;
private DownloadManager downloadManager;
private long downloadReference;
+ private String FileName = "update.apk";
//broadcast receiver to get notification about ongoing downloads
+
BroadcastReceiver downloadReceiver = new BroadcastReceiver() {
@Override
@@ -53,9 +54,7 @@ public class UpdaterActivity extends Activity {
//check if the broadcast message is for our Enqueued download
long referenceId = intent.getExtras().getLong(DownloadManager.EXTRA_DOWNLOAD_ID);
if (downloadReference == referenceId) {
- File file = new File(getExternalFilesDir(Environment.DIRECTORY_DOWNLOADS), "Conversations.apk");
- Log.d(Config.LOGTAG, "AppUpdater: Downloading of the new app version complete. Starting installation from " + file);
-
+ File file = new File(getExternalFilesDir(Environment.DIRECTORY_DOWNLOADS), FileName);
//start the installation of the latest version
Intent installIntent = new Intent(Intent.ACTION_INSTALL_PACKAGE);
installIntent.setDataAndType(Uri.fromFile(file), "application/vnd.android.package-archive");
@@ -157,9 +156,7 @@ public class UpdaterActivity extends Activity {
NetworkInfo[] info = connectivity.getAllNetworkInfo();
if (info != null) {
for (int i = 0; i < info.length; i++) {
- Log.d(Config.LOGTAG, "AppUpdater: " + String.valueOf(i));
if (info[i].getState() == NetworkInfo.State.CONNECTED) {
- Log.d(Config.LOGTAG, "AppUpdater: connected to update Server!");
return true;
}
}
@@ -172,16 +169,13 @@ public class UpdaterActivity extends Activity {
if (Build.VERSION.SDK_INT >= 23) {
if (checkSelfPermission(android.Manifest.permission.WRITE_EXTERNAL_STORAGE)
== PackageManager.PERMISSION_GRANTED) {
- Log.d(Config.LOGTAG, "AppUpdater: Permission is granted");
return true;
} else {
- Log.d(Config.LOGTAG, "AppUpdater: Permission is revoked");
ActivityCompat.requestPermissions(this, new String[]{Manifest.permission.WRITE_EXTERNAL_STORAGE}, 1);
return false;
}
} else { //permission is automatically granted on sdk<23 upon installation
- Log.d(Config.LOGTAG, "AppUpdater: Permission is granted");
return true;
}
}
@@ -209,7 +203,7 @@ public class UpdaterActivity extends Activity {
//broadcast receiver to get notification when the web request finishes
public class UpdateReceiver extends BroadcastReceiver {
- public static final String PROCESS_RESPONSE = "eu.siacs.conversations.intent.action.PROCESS_RESPONSE";
+ public static final String PROCESS_RESPONSE = "de.pixart.messenger.intent.action.PROCESS_RESPONSE";
@Override
public void onReceive(Context context, Intent intent) {
@@ -219,16 +213,13 @@ public class UpdaterActivity extends Activity {
WindowManager.LayoutParams.FLAG_NOT_TOUCHABLE);
String responseMessage = intent.getStringExtra(UpdaterWebService.RESPONSE_MESSAGE);
- Log.d(Config.LOGTAG, "AppUpdater: Reponse: " + responseMessage);
if (responseMessage == "" || responseMessage.isEmpty() || responseMessage == null) {
Toast.makeText(getApplicationContext(),
getText(R.string.failed),
Toast.LENGTH_LONG).show();
- Log.e(Config.LOGTAG, "AppUpdater: error connecting to server");
UpdaterActivity.this.finish();
} else {
- Log.d(Config.LOGTAG, "AppUpdater: connecting to server");
//parse the JSON reponse
JSONObject reponseObj;
@@ -241,7 +232,6 @@ public class UpdaterActivity extends Activity {
//start backing up database
try {
ExportDatabase();
- Log.d(Config.LOGTAG, "AppUpdater: Database successfully exported");
} catch (IOException e) {
e.printStackTrace();
}
@@ -261,14 +251,13 @@ public class UpdaterActivity extends Activity {
int latestVersionCode = reponseObj.getInt("latestVersionCode");
String latestVersion = reponseObj.getString("latestVersion");
String filesize = reponseObj.getString("filesize");
+ String changelog = reponseObj.getString("changelog");
//get the lastest application URI from the JSON string
appURI = reponseObj.getString("appURI");
//check if we need to upgrade?
if (latestVersionCode > versionCode) {
- Log.d(Config.LOGTAG, "AppUpdater: update available");
//delete old downloaded version files
File dir = new File(getExternalFilesDir(null), Environment.DIRECTORY_DOWNLOADS);
- Log.d(Config.LOGTAG, "AppUpdater: delete old update files in: " + dir);
if (dir.isDirectory()) {
String[] children = dir.list();
for (int i = 0; i < children.length; i++) {
@@ -283,7 +272,7 @@ public class UpdaterActivity extends Activity {
builder.setCancelable(false);
String UpdateMessageInfo = getResources().getString(R.string.update_available);
- builder.setMessage(String.format(UpdateMessageInfo, latestVersion, filesize, versionName))
+ builder.setMessage(String.format(UpdateMessageInfo, latestVersion, filesize, versionName, changelog))
.setPositiveButton(R.string.update, new DialogInterface.OnClickListener() {
//if the user agrees to upgrade
public void onClick(DialogInterface dialog, int id) {
@@ -299,7 +288,7 @@ public class UpdaterActivity extends Activity {
//request.setAllowedNetworkTypes(DownloadManager.Request.NETWORK_WIFI);
//request.setAllowedOverRoaming(false);
request.setTitle("Pix-Art Messenger Update");
- request.setDestinationInExternalFilesDir(UpdaterActivity.this, Environment.DIRECTORY_DOWNLOADS, "Conversations.apk");
+ request.setDestinationInExternalFilesDir(UpdaterActivity.this, Environment.DIRECTORY_DOWNLOADS, FileName);
downloadReference = downloadManager.enqueue(request);
Toast.makeText(getApplicationContext(),
getText(R.string.download_started),
@@ -330,22 +319,18 @@ public class UpdaterActivity extends Activity {
Toast.makeText(getApplicationContext(),
getText(R.string.no_update_available),
Toast.LENGTH_SHORT).show();
- Log.d(Config.LOGTAG, "AppUpdater: no update available");
UpdaterActivity.this.finish();
}
} else {
Toast.makeText(getApplicationContext(),
getText(R.string.failed),
Toast.LENGTH_LONG).show();
- Log.e(Config.LOGTAG, "AppUpdater: contact to server not successfull");
UpdaterActivity.this.finish();
}
} catch (JSONException e) {
e.printStackTrace();
}
}
-
}
-
}
}
diff --git a/src/main/res/values-de/strings.xml b/src/main/res/values-de/strings.xml
index 90f798977..910792364 100644
--- a/src/main/res/values-de/strings.xml
+++ b/src/main/res/values-de/strings.xml
@@ -466,7 +466,7 @@
<string name="checking_for_updates">Auf Pix-Art Messenger Updates prüfen</string>
<string name="title_activity_updater">Update Dienst</string>
<string name="update">aktualisieren</string>
- <string name="update_available">Version %1$s ist verfügbar.\n\nDateigröße: %2$s\n\nJetzt auf Version %1$s aktualisieren?</string>
+ <string name="update_available">Version %1$s ist verfügbar.\n\nDateigröße: %2$s\n\nJetzt auf Version %1$s aktualisieren?\n\n\n%4$s</string>
<string name="download_started">Download gestartet</string>
<string name="no_update_available">Kein Update verfügbar</string>
<string name="account_status_tor_unavailable">Tor-Netzwerk nicht verfügbar</string>
diff --git a/src/main/res/values/strings.xml b/src/main/res/values/strings.xml
index 584d08a21..08c8b7fbf 100644
--- a/src/main/res/values/strings.xml
+++ b/src/main/res/values/strings.xml
@@ -521,7 +521,7 @@
<string name="pref_use_white_background_summary">Show received messages as black text on a white background</string>
<string name="action_check_update">Check for Updates</string>
<string name="title_activity_updater">Update Service</string>
- <string name="update_available">Version %1$s is available.\n\nFilesize: %2$s\n\nUpdate to version %1$s now?</string>
+ <string name="update_available">Version %1$s is available.\n\nFilesize: %2$s\n\nUpdate to version %1$s now?\n\n\n%4$s</string>
<string name="checking_for_updates">Checking for Pix-Art Messenger updates</string>
<string name="remind_later">later</string>
<string name="update">update</string>