diff --git a/xwords4/android/app/build.gradle b/xwords4/android/app/build.gradle index d7356d9e1..b418cec40 100644 --- a/xwords4/android/app/build.gradle +++ b/xwords4/android/app/build.gradle @@ -36,10 +36,8 @@ if ( FABRIC_API_KEY && hasProperty('useCrashlytics') ) { // rm-for-fdroid } // rm-for-fdroid repositories { google() - maven { url 'https://maven.fabric.io/public' } // rm-for-fdroid - maven { - url "https://repo.eclipse.org/content/repositories/paho-releases/" - } + maven { url 'https://maven.fabric.io/public' } // rm-for-fdroid + maven { url "https://repo.eclipse.org/content/repositories/paho-releases/" } // rm-for-fdroid } android { @@ -122,6 +120,7 @@ android { resValue "string", "nfc_aid", "$NFC_AID_XW4" externalNativeBuild.ndkBuild.cFlags += ['-DVARIANT_xw4fdroid'] externalNativeBuild.ndkBuild.arguments += ['XW_BT_UUID=' + XW_UUID] + buildConfigField "boolean", "OFFER_MQTT", "false" } xw4d { @@ -337,7 +336,7 @@ dependencies { implementation 'com.github.eehouse:nbsproxy:v0.2.2' - implementation "org.eclipse.paho:org.eclipse.paho.client.mqttv3:1.1.+" + implementation "org.eclipse.paho:org.eclipse.paho.client.mqttv3:1.1.+" // rm-for-fdroid } task mkImages(type: Exec) { diff --git a/xwords4/android/app/src/main/java/org/eehouse/android/xw4/PrefsDelegate.java b/xwords4/android/app/src/main/java/org/eehouse/android/xw4/PrefsDelegate.java index 65919a3a8..97f5c2e56 100644 --- a/xwords4/android/app/src/main/java/org/eehouse/android/xw4/PrefsDelegate.java +++ b/xwords4/android/app/src/main/java/org/eehouse/android/xw4/PrefsDelegate.java @@ -243,7 +243,9 @@ public class PrefsDelegate extends DelegateBase case R.string.key_mqtt_host: case R.string.key_mqtt_port: case R.string.key_mqtt_qos: - MQTTUtils.onConfigChanged( m_activity ); + if ( BuildConfig.OFFER_MQTT ) { + MQTTUtils.onConfigChanged( m_activity ); + } break; default: Assert.failDbg(); diff --git a/xwords4/android/app/src/main/java/org/eehouse/android/xw4/XWApp.java b/xwords4/android/app/src/main/java/org/eehouse/android/xw4/XWApp.java index 4528b4884..c0eb7b352 100644 --- a/xwords4/android/app/src/main/java/org/eehouse/android/xw4/XWApp.java +++ b/xwords4/android/app/src/main/java/org/eehouse/android/xw4/XWApp.java @@ -102,7 +102,9 @@ public class XWApp extends Application DupeModeTimer.init( this ); - MQTTUtils.init( this ); + if ( BuildConfig.OFFER_MQTT ) { + MQTTUtils.init( this ); + } } @OnLifecycleEvent(ON_ANY) diff --git a/xwords4/android/app/src/xw4NoSMS/java/org/eehouse/android/xw4/MQTTUtils.java b/xwords4/android/app/src/xw4NoSMS/java/org/eehouse/android/xw4/MQTTUtils.java new file mode 120000 index 000000000..811f81ea5 --- /dev/null +++ b/xwords4/android/app/src/xw4NoSMS/java/org/eehouse/android/xw4/MQTTUtils.java @@ -0,0 +1 @@ +../../../../../../xw4SMS/java/org/eehouse/android/xw4/MQTTUtils.java \ No newline at end of file diff --git a/xwords4/android/app/src/main/java/org/eehouse/android/xw4/MQTTUtils.java b/xwords4/android/app/src/xw4SMS/java/org/eehouse/android/xw4/MQTTUtils.java similarity index 100% rename from xwords4/android/app/src/main/java/org/eehouse/android/xw4/MQTTUtils.java rename to xwords4/android/app/src/xw4SMS/java/org/eehouse/android/xw4/MQTTUtils.java diff --git a/xwords4/android/app/src/xw4d/java/org/eehouse/android/xw4/MQTTUtils.java b/xwords4/android/app/src/xw4d/java/org/eehouse/android/xw4/MQTTUtils.java new file mode 120000 index 000000000..811f81ea5 --- /dev/null +++ b/xwords4/android/app/src/xw4d/java/org/eehouse/android/xw4/MQTTUtils.java @@ -0,0 +1 @@ +../../../../../../xw4SMS/java/org/eehouse/android/xw4/MQTTUtils.java \ No newline at end of file diff --git a/xwords4/android/app/src/xw4fdroid/java/org/eehouse/android/xw4/MQTTUtils.java b/xwords4/android/app/src/xw4fdroid/java/org/eehouse/android/xw4/MQTTUtils.java new file mode 100644 index 000000000..bee3e6d59 --- /dev/null +++ b/xwords4/android/app/src/xw4fdroid/java/org/eehouse/android/xw4/MQTTUtils.java @@ -0,0 +1,81 @@ +/* -*- compile-command: "find-and-gradle.sh -PuseCrashlytics insXw4dDeb"; -*- */ +/* + * Copyright 2020 by Eric House (xwords@eehouse.org). All rights reserved. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License as + * published by the Free Software Foundation; either version 2 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + +package org.eehouse.android.xw4; + +import android.content.Context; + +import org.eehouse.android.xw4.jni.CommsAddrRec; + +public class MQTTUtils { + private static final String TAG = MQTTUtils.class.getSimpleName(); + + public static void init( Context context ) + { + logUnimpl( "init" ); + } + + public static void onResume( Context context ) + { + logUnimpl( "onResume" ); + } + + public static int send( Context context, String addressee, int gameID, byte[] buf ) + { + logUnimpl( "send" ); + return -1; + } + + public static void handleMessage( Context context, CommsAddrRec from, + int gameID, byte[] data ) + { + logUnimpl( "handleMessage" ); + } + + public static void handleGameGone( Context context, CommsAddrRec from, int gameID ) + { + logUnimpl( "handleGameGone" ); + } + + public static void gameDied( String devID, int gameID ) + { + logUnimpl( "gameDied" ); + } + + public static void timerFired( Context context ) + { + logUnimpl( "timerFired" ); + } + + static void onConfigChanged( Context context ) + { + logUnimpl( "onConfigChanged" ); + } + + public static void inviteRemote( Context context, String invitee, NetLaunchInfo nli ) + { + logUnimpl( "inviteRemote" ); + } + + private static void logUnimpl( String name ) + { + Log.d( TAG, "%s(): UNIMPLEMENTED", name ); + } + +}