From 622412fc723fb402035ce2600f980806952709b8 Mon Sep 17 00:00:00 2001 From: steckbrief Date: Sun, 28 Jan 2018 22:09:57 +0100 Subject: Introducing product flavor 'beta' and removing product flavor 'playstore' --- build.gradle | 10 +- gradle/wrapper/gradle-wrapper.properties | 4 +- src/beta/res/drawable-hdpi/ic_launcher.png | Bin 0 -> 5133 bytes src/beta/res/drawable-mdpi/ic_launcher.png | Bin 0 -> 3096 bytes src/beta/res/drawable-xhdpi/ic_launcher.png | Bin 0 -> 7317 bytes src/beta/res/drawable-xxhdpi/ic_launcher.png | Bin 0 -> 11957 bytes src/beta/res/drawable-xxxhdpi/ic_launcher.png | Bin 0 -> 16932 bytes src/beta/res/values/strings.xml | 4 + .../services/PushManagementService.java | 24 ----- src/main/AndroidManifest.xml | 2 +- .../providers/ConversationsPlusFileProvider.java | 3 +- .../services/PushManagementService.java | 24 +++++ src/playstore/AndroidManifest.xml | 35 ------ .../conversations/services/InstanceIdService.java | 15 --- .../services/PushManagementService.java | 119 --------------------- .../services/PushMessageReceiver.java | 20 ---- 16 files changed, 40 insertions(+), 220 deletions(-) create mode 100644 src/beta/res/drawable-hdpi/ic_launcher.png create mode 100644 src/beta/res/drawable-mdpi/ic_launcher.png create mode 100644 src/beta/res/drawable-xhdpi/ic_launcher.png create mode 100644 src/beta/res/drawable-xxhdpi/ic_launcher.png create mode 100644 src/beta/res/drawable-xxxhdpi/ic_launcher.png create mode 100644 src/beta/res/values/strings.xml delete mode 100644 src/free/java/de/thedevstack/conversationsplus/services/PushManagementService.java create mode 100644 src/main/java/de/thedevstack/conversationsplus/services/PushManagementService.java delete mode 100644 src/playstore/AndroidManifest.xml delete mode 100644 src/playstore/java/eu/siacs/conversations/services/InstanceIdService.java delete mode 100644 src/playstore/java/eu/siacs/conversations/services/PushManagementService.java delete mode 100644 src/playstore/java/eu/siacs/conversations/services/PushMessageReceiver.java diff --git a/build.gradle b/build.gradle index 0d7069a3..71d726b6 100644 --- a/build.gradle +++ b/build.gradle @@ -5,7 +5,7 @@ buildscript { jcenter() } dependencies { - classpath 'com.android.tools.build:gradle:2.0.0' + classpath 'com.android.tools.build:gradle:2.2.0' } } @@ -82,6 +82,7 @@ android { versionName "0.0.8" archivesBaseName += "-$versionName" apply from: 'configuration.gradle' + applicationId "de.thedevstack.conversationsplus" } dexOptions { @@ -95,8 +96,11 @@ android { } productFlavors { - playstore - free + beta { + applicationIdSuffix ".beta" + versionNameSuffix "-beta" + } + free } testOptions { unitTests.all { diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index 518d1f1f..f141b3c1 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,6 +1,6 @@ -#Wed May 31 19:49:33 CEST 2017 +#Sun Jan 28 20:51:58 CET 2018 distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-2.12-all.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-2.14.1-all.zip diff --git a/src/beta/res/drawable-hdpi/ic_launcher.png b/src/beta/res/drawable-hdpi/ic_launcher.png new file mode 100644 index 00000000..16c7a7ce Binary files /dev/null and b/src/beta/res/drawable-hdpi/ic_launcher.png differ diff --git a/src/beta/res/drawable-mdpi/ic_launcher.png b/src/beta/res/drawable-mdpi/ic_launcher.png new file mode 100644 index 00000000..3a59b17e Binary files /dev/null and b/src/beta/res/drawable-mdpi/ic_launcher.png differ diff --git a/src/beta/res/drawable-xhdpi/ic_launcher.png b/src/beta/res/drawable-xhdpi/ic_launcher.png new file mode 100644 index 00000000..9afafb85 Binary files /dev/null and b/src/beta/res/drawable-xhdpi/ic_launcher.png differ diff --git a/src/beta/res/drawable-xxhdpi/ic_launcher.png b/src/beta/res/drawable-xxhdpi/ic_launcher.png new file mode 100644 index 00000000..b12d83bb Binary files /dev/null and b/src/beta/res/drawable-xxhdpi/ic_launcher.png differ diff --git a/src/beta/res/drawable-xxxhdpi/ic_launcher.png b/src/beta/res/drawable-xxxhdpi/ic_launcher.png new file mode 100644 index 00000000..d0654a90 Binary files /dev/null and b/src/beta/res/drawable-xxxhdpi/ic_launcher.png differ diff --git a/src/beta/res/values/strings.xml b/src/beta/res/values/strings.xml new file mode 100644 index 00000000..7116ad23 --- /dev/null +++ b/src/beta/res/values/strings.xml @@ -0,0 +1,4 @@ + + + Conversations+ BETA + diff --git a/src/free/java/de/thedevstack/conversationsplus/services/PushManagementService.java b/src/free/java/de/thedevstack/conversationsplus/services/PushManagementService.java deleted file mode 100644 index c11b6e98..00000000 --- a/src/free/java/de/thedevstack/conversationsplus/services/PushManagementService.java +++ /dev/null @@ -1,24 +0,0 @@ -package de.thedevstack.conversationsplus.services; - -import de.thedevstack.conversationsplus.entities.Account; - -public class PushManagementService { - - protected final XmppConnectionService mXmppConnectionService; - - public PushManagementService(XmppConnectionService service) { - this.mXmppConnectionService = service; - } - - public void registerPushTokenOnServer(Account account) { - //stub implementation. only affects playstore flavor - } - - public boolean available(Account account) { - return false; - } - - public boolean isStub() { - return true; - } -} diff --git a/src/main/AndroidManifest.xml b/src/main/AndroidManifest.xml index ca369a5d..c2fe9878 100644 --- a/src/main/AndroidManifest.xml +++ b/src/main/AndroidManifest.xml @@ -176,7 +176,7 @@ diff --git a/src/main/java/de/thedevstack/conversationsplus/providers/ConversationsPlusFileProvider.java b/src/main/java/de/thedevstack/conversationsplus/providers/ConversationsPlusFileProvider.java index a718b161..577a5dd4 100644 --- a/src/main/java/de/thedevstack/conversationsplus/providers/ConversationsPlusFileProvider.java +++ b/src/main/java/de/thedevstack/conversationsplus/providers/ConversationsPlusFileProvider.java @@ -3,6 +3,7 @@ package de.thedevstack.conversationsplus.providers; import android.net.Uri; import android.support.v4.content.FileProvider; +import de.thedevstack.conversationsplus.BuildConfig; import de.thedevstack.conversationsplus.ConversationsPlusApplication; import de.thedevstack.conversationsplus.entities.DownloadableFile; @@ -12,7 +13,7 @@ import de.thedevstack.conversationsplus.entities.DownloadableFile; public class ConversationsPlusFileProvider extends FileProvider { private static final String SCHEME = "content"; - private static final String AUTHORITY = "de.thedevstack.conversationsplus"; + private static final String AUTHORITY = BuildConfig.APPLICATION_ID; public static Uri createUriForPrivateFile(DownloadableFile file) { return FileProvider.getUriForFile(ConversationsPlusApplication.getAppContext(), AUTHORITY, file); diff --git a/src/main/java/de/thedevstack/conversationsplus/services/PushManagementService.java b/src/main/java/de/thedevstack/conversationsplus/services/PushManagementService.java new file mode 100644 index 00000000..c11b6e98 --- /dev/null +++ b/src/main/java/de/thedevstack/conversationsplus/services/PushManagementService.java @@ -0,0 +1,24 @@ +package de.thedevstack.conversationsplus.services; + +import de.thedevstack.conversationsplus.entities.Account; + +public class PushManagementService { + + protected final XmppConnectionService mXmppConnectionService; + + public PushManagementService(XmppConnectionService service) { + this.mXmppConnectionService = service; + } + + public void registerPushTokenOnServer(Account account) { + //stub implementation. only affects playstore flavor + } + + public boolean available(Account account) { + return false; + } + + public boolean isStub() { + return true; + } +} diff --git a/src/playstore/AndroidManifest.xml b/src/playstore/AndroidManifest.xml deleted file mode 100644 index a1b91be3..00000000 --- a/src/playstore/AndroidManifest.xml +++ /dev/null @@ -1,35 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/src/playstore/java/eu/siacs/conversations/services/InstanceIdService.java b/src/playstore/java/eu/siacs/conversations/services/InstanceIdService.java deleted file mode 100644 index dc080430..00000000 --- a/src/playstore/java/eu/siacs/conversations/services/InstanceIdService.java +++ /dev/null @@ -1,15 +0,0 @@ -package eu.siacs.conversations.services; - -import android.content.Intent; - -import com.google.android.gms.iid.InstanceIDListenerService; - -public class InstanceIdService extends InstanceIDListenerService { - - @Override - public void onTokenRefresh() { - Intent intent = new Intent(this, XmppConnectionService.class); - intent.setAction(XmppConnectionService.ACTION_GCM_TOKEN_REFRESH); - startService(intent); - } -} diff --git a/src/playstore/java/eu/siacs/conversations/services/PushManagementService.java b/src/playstore/java/eu/siacs/conversations/services/PushManagementService.java deleted file mode 100644 index 3fdaf832..00000000 --- a/src/playstore/java/eu/siacs/conversations/services/PushManagementService.java +++ /dev/null @@ -1,119 +0,0 @@ -package eu.siacs.conversations.services; - -import android.provider.Settings; -import android.util.Log; - -import com.google.android.gms.common.ConnectionResult; -import com.google.android.gms.common.GoogleApiAvailability; -import com.google.android.gms.gcm.GoogleCloudMessaging; -import com.google.android.gms.iid.InstanceID; - -import java.io.IOException; - -import eu.siacs.conversations.Config; -import eu.siacs.conversations.R; -import eu.siacs.conversations.entities.Account; -import eu.siacs.conversations.xml.Element; -import eu.siacs.conversations.xmpp.OnIqPacketReceived; -import eu.siacs.conversations.xmpp.XmppConnection; -import eu.siacs.conversations.xmpp.forms.Data; -import eu.siacs.conversations.xmpp.jid.InvalidJidException; -import eu.siacs.conversations.xmpp.jid.Jid; -import eu.siacs.conversations.xmpp.stanzas.IqPacket; - -public class PushManagementService { - - private static final String APP_SERVER = "push.siacs.eu"; - - protected final XmppConnectionService mXmppConnectionService; - - public PushManagementService(XmppConnectionService service) { - this.mXmppConnectionService = service; - } - - public void registerPushTokenOnServer(final Account account) { - Log.d(Config.LOGTAG, account.getJid().toBareJid() + ": has push support"); - retrieveGcmInstanceToken(new OnGcmInstanceTokenRetrieved() { - @Override - public void onGcmInstanceTokenRetrieved(String token) { - try { - final String deviceId = Settings.Secure.getString(mXmppConnectionService.getContentResolver(), Settings.Secure.ANDROID_ID); - IqPacket packet = mXmppConnectionService.getIqGenerator().pushTokenToAppServer(Jid.fromString(APP_SERVER), token, deviceId); - mXmppConnectionService.sendIqPacket(account, packet, new OnIqPacketReceived() { - @Override - public void onIqPacketReceived(Account account, IqPacket packet) { - Element command = packet.findChild("command","http://jabber.org/protocol/commands"); - if (packet.getType() == IqPacket.TYPE.RESULT && command != null) { - Element x = command.findChild("x","jabber:x:data"); - if (x != null) { - Data data = Data.parse(x); - try { - String node = data.getValue("node"); - String secret = data.getValue("secret"); - Jid jid = Jid.fromString(data.getValue("jid")); - if (node != null && secret != null) { - enablePushOnServer(account, jid, node, secret); - } - } catch (InvalidJidException e) { - e.printStackTrace(); - } - } - } else { - Log.d(Config.LOGTAG,account.getJid().toBareJid()+": invalid response from app server"); - } - } - }); - } catch (InvalidJidException ignored) { - - } - } - }); - } - - private void enablePushOnServer(final Account account, final Jid jid, final String node, final String secret) { - IqPacket enable = mXmppConnectionService.getIqGenerator().enablePush(jid, node, secret); - mXmppConnectionService.sendIqPacket(account, enable, new OnIqPacketReceived() { - @Override - public void onIqPacketReceived(Account account, IqPacket packet) { - if (packet.getType() == IqPacket.TYPE.RESULT) { - Log.d(Config.LOGTAG, account.getJid().toBareJid() + ": successfully enabled push on server"); - } else if (packet.getType() == IqPacket.TYPE.ERROR) { - Log.d(Config.LOGTAG, account.getJid().toBareJid() + ": enabling push on server failed"); - } - } - }); - } - - private void retrieveGcmInstanceToken(final OnGcmInstanceTokenRetrieved instanceTokenRetrieved) { - new Thread(new Runnable() { - @Override - public void run() { - InstanceID instanceID = InstanceID.getInstance(mXmppConnectionService); - try { - String token = instanceID.getToken(mXmppConnectionService.getString(R.string.gcm_defaultSenderId), GoogleCloudMessaging.INSTANCE_ID_SCOPE, null); - instanceTokenRetrieved.onGcmInstanceTokenRetrieved(token); - } catch (IOException e) { - } - } - }).start(); - - } - - - public boolean available(Account account) { - final XmppConnection connection = account.getXmppConnection(); - return connection != null && connection.getFeatures().push() && playServicesAvailable(); - } - - private boolean playServicesAvailable() { - return GoogleApiAvailability.getInstance().isGooglePlayServicesAvailable(mXmppConnectionService) == ConnectionResult.SUCCESS; - } - - public boolean isStub() { - return false; - } - - interface OnGcmInstanceTokenRetrieved { - void onGcmInstanceTokenRetrieved(String token); - } -} diff --git a/src/playstore/java/eu/siacs/conversations/services/PushMessageReceiver.java b/src/playstore/java/eu/siacs/conversations/services/PushMessageReceiver.java deleted file mode 100644 index 37c95e13..00000000 --- a/src/playstore/java/eu/siacs/conversations/services/PushMessageReceiver.java +++ /dev/null @@ -1,20 +0,0 @@ -package eu.siacs.conversations.services; - -import android.content.Intent; -import android.os.Bundle; -import android.util.Log; - -import com.google.android.gms.gcm.GcmListenerService; - -import eu.siacs.conversations.Config; - -public class PushMessageReceiver extends GcmListenerService { - - @Override - public void onMessageReceived(String from, Bundle data) { - Intent intent = new Intent(this, XmppConnectionService.class); - intent.setAction(XmppConnectionService.ACTION_GCM_MESSAGE_RECEIVED); - intent.replaceExtras(data); - startService(intent); - } -} -- cgit v1.2.3