put back pref controlling whether FCM receives are Toasted

This commit is contained in:
Eric House 2019-02-01 19:27:12 -08:00
parent 272204223e
commit 40eab8690b
5 changed files with 20 additions and 5 deletions

View file

@ -71,6 +71,11 @@ public class XWPrefs {
return getPrefsBoolean( context, R.string.key_ignore_fcm, false );
}
public static boolean getToastFCM( Context context )
{
return getPrefsBoolean( context, R.string.key_show_fcm, false );
}
public static boolean getSMSToSelfEnabled( Context context )
{
return getPrefsBoolean( context, R.string.key_enable_sms_toself, false );

View file

@ -127,6 +127,7 @@
<string name="key_enable_sms_toself">key_enable_sms_toself</string>
<string name="key_enable_smsproto">key_enable_smsproto</string>
<string name="key_ignore_fcm">key_ignore_fcm</string>
<string name="key_show_fcm">key_show_fcm</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

@ -2643,6 +2643,7 @@
<string name="ignore_fcm_summary">Mimic life without a google account</string>
<string name="show_sms_title">Show SMS sends, receives</string>
<string name="show_fcm_title">Show FCM receives</string>
<!-- Shown after "resend messages" menuitem chosen -->
<plurals name="resent_msgs_fmt">

View file

@ -398,6 +398,10 @@
android:summary="@string/ignore_fcm_summary"
android:defaultValue="false"
/>
<CheckBoxPreference android:key="@string/key_show_fcm"
android:title="@string/show_fcm_title"
android:defaultValue="false"
/>
<org.eehouse.android.xw4.XWEditTextPreference
android:key="@string/key_relay_host"
android:title="@string/relay_host"

View file

@ -58,12 +58,9 @@ public class FBMService extends FirebaseMessagingService {
} else {
RelayService.fcmConfirmed( this, true );
if ( BuildConfig.DEBUG ) {
Utils.showToast( this, TAG + ".onMessageReceived()" );
}
Map<String, String> data = message.getData();
Log.d( TAG, "onMessageReceived(data=%s)", data );
boolean toastFCM = XWPrefs.getToastFCM( this );
String value = data.get( "msgs64" );
if ( null != value ) {
@ -71,6 +68,10 @@ public class FBMService extends FirebaseMessagingService {
try {
JSONArray msgs64 = new JSONArray( value );
String[] strs64 = new String[msgs64.length()];
if ( toastFCM ) {
DbgUtils.showf( this, "%s.onMessageReceived(): got %d msgs",
TAG, strs64.length );
}
for ( int ii = 0; ii < strs64.length; ++ii ) {
strs64[ii] = msgs64.optString(ii);
@ -94,6 +95,10 @@ public class FBMService extends FirebaseMessagingService {
value = data.get( "getMoves" );
if ( null != value && Boolean.parseBoolean( value ) ) {
RelayService.timerFired( this );
if ( toastFCM ) {
DbgUtils.showf( this, "%s.onMessageReceived(): got 'getMoves'",
TAG );
}
}
value = data.get( "msg" );
@ -121,7 +126,6 @@ public class FBMService extends FirebaseMessagingService {
if ( null == result ) {
getTokenAsync( context );
}
return result;
}