mirror of
git://xwords.git.sourceforge.net/gitroot/xwords/xwords
synced 2025-01-08 05:24:39 +01:00
put back pref controlling whether FCM receives are Toasted
This commit is contained in:
parent
9f7899cd7c
commit
1a3aa9f8d1
5 changed files with 20 additions and 5 deletions
|
@ -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 );
|
||||
|
|
|
@ -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>
|
||||
|
|
|
@ -2644,6 +2644,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">
|
||||
|
|
|
@ -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"
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue