communicate FCM deviceID to relay immediately

Don't wait for second connection! This makes new installs able to get a
game going much more reliably.
This commit is contained in:
Eric House 2019-11-30 20:24:43 -08:00
parent 2d81135487
commit 5fe46f275c
5 changed files with 9 additions and 6 deletions

View file

@ -172,6 +172,7 @@ public class RelayService extends XWJIService
public static void fcmConfirmed( Context context, boolean working )
{
Log.d( TAG, "fcmConfirmed(working=%b)", working );
long newVal = working ? System.currentTimeMillis() : 0L;
if ( (s_lastFCM == 0) != working ) {
Log.i( TAG, "fcmConfirmed(): changing s_lastFCM to %d",
@ -296,7 +297,7 @@ public class RelayService extends XWJIService
return result;
}
public static void devIDChanged()
private static void devIDChanged()
{
s_registered = false;
}
@ -1052,8 +1053,8 @@ public class RelayService extends XWJIService
writeVLIString( out, devid );
}
Log.d( TAG, "registering devID \"%s\" (type=%s)", devid,
typ.toString() );
Log.d( TAG, "registerWithRelay(): registering devID \"%s\" (type=%s)",
devid, typ.toString() );
out.writeShort( BuildConfig.CLIENT_VERS_RELAY );
writeVLIString( out, BuildConfig.GIT_REV );

View file

@ -92,7 +92,7 @@ public class XWPrefs {
public static boolean getToastFCM( Context context )
{
return getPrefsBoolean( context, R.string.key_show_fcm, false );
return getPrefsBoolean( context, R.string.key_show_fcm, BuildConfig.DEBUG );
}
public static boolean getSMSToSelfEnabled( Context context )

View file

@ -128,7 +128,7 @@
<string name="key_enable_dup_invite">key_enable_dup_invite</string>
<string name="key_enable_nfc_toself">key_enable_nfc_toself</string>
<string name="key_enable_sms_toself">key_enable_sms_toself</string>
<string name="key_show_fcm">key_show_fcm</string>
<string name="key_show_fcm">key_show_fcm2</string>
<string name="key_nag_intervals">key_nag_intervals</string>
<string name="key_download_path">key_download_path</string>
<string name="key_got_langdict">key_got_langdict</string>

View file

@ -410,7 +410,7 @@
<CheckBoxPreference android:key="@string/key_show_fcm"
android:title="@string/show_fcm_title"
android:defaultValue="false"
android:defaultValue="@bool/DEBUG"
/>
<org.eehouse.android.xw4.XWEditTextPreference
android:key="@string/key_relay_host"

View file

@ -160,5 +160,7 @@ public class FBMService extends FirebaseMessagingService {
DBUtils.setStringFor( context, KEY_FCMID, token );
DevID.setFCMDevID( context, token );
RelayService.fcmConfirmed( context, true );
}
}