Back up handling of no map data for huawei notifications

Also rethemed the send buttona dn home plus button to have better ax contrast by standardising the colour displayed on the accent color to be the same as the one on the sent messages
pull/1518/head
ThomasSession 7 months ago
parent 94688c2b07
commit de09d8ea2e

@ -20,7 +20,7 @@ class HuaweiPushService: HmsMessageService() {
override fun onMessageReceived(message: RemoteMessage?) { override fun onMessageReceived(message: RemoteMessage?) {
Log.d(TAG, "onMessageReceived") Log.d(TAG, "onMessageReceived")
message?.dataOfMap?.takeIf { it.isNotEmpty() }?.let(pushReceiver::onPush) ?: message?.dataOfMap?.takeIf { it.isNotEmpty() }?.let(pushReceiver::onPushDataReceived) ?:
pushReceiver.onPushDataReceived(message?.data?.let(Base64::decode)) pushReceiver.onPushDataReceived(message?.data?.let(Base64::decode))
} }

@ -24,6 +24,9 @@ class HuaweiTokenFetcher @Inject constructor(
override suspend fun fetch(): String? = HmsInstanceId.getInstance(context).run { override suspend fun fetch(): String? = HmsInstanceId.getInstance(context).run {
// https://developer.huawei.com/consumer/en/doc/development/HMS-Guides/push-basic-capability#h2-1576218800370 // https://developer.huawei.com/consumer/en/doc/development/HMS-Guides/push-basic-capability#h2-1576218800370
// getToken may return an empty string, if so HuaweiPushService#onNewToken will be called. // getToken may return an empty string, if so HuaweiPushService#onNewToken will be called.
withContext(Dispatchers.IO) { getToken(APP_ID, TOKEN_SCOPE) } withContext(Dispatchers.IO) {
val test = getToken(APP_ID, TOKEN_SCOPE)
test
}
} }
} }

@ -77,7 +77,9 @@ class InputBarButton : RelativeLayout {
result.layoutParams = LayoutParams(size, size) result.layoutParams = LayoutParams(size, size)
result.scaleType = ImageView.ScaleType.CENTER_INSIDE result.scaleType = ImageView.ScaleType.CENTER_INSIDE
result.setImageResource(iconID) result.setImageResource(iconID)
result.imageTintList = ColorStateList.valueOf(context.getColorFromAttr(R.attr.input_bar_button_text_color)) result.imageTintList = if(isSendButton)
ColorStateList.valueOf(context.getColorFromAttr(R.attr.message_sent_text_color))
else ColorStateList.valueOf(context.getColorFromAttr(R.attr.input_bar_button_text_color))
result result
} }

@ -16,7 +16,6 @@
*/ */
package org.thoughtcrime.securesms.conversation.v2.utilities; package org.thoughtcrime.securesms.conversation.v2.utilities;
import static com.google.android.gms.common.util.CollectionUtils.listOf;
import static org.session.libsession.utilities.StringSubstitutionConstants.APP_NAME_KEY; import static org.session.libsession.utilities.StringSubstitutionConstants.APP_NAME_KEY;
import android.Manifest; import android.Manifest;

@ -38,7 +38,8 @@ class PushReceiver @Inject constructor(@ApplicationContext val context: Context)
} }
fun onPushDataReceived(data: ByteArray?) { fun onPushDataReceived(data: ByteArray?) {
//todo DELETION currently Huawei sends data to this. We need to check what it actually sends, as it might actually be a map like the above firebase one - then we need to hook the huawei push service appropriately to work with this updated class addMessageReceiveJob(PushData(data = data, metadata = null))
//todo DELETION verify this once I can get notifications on debug huawei builds
} }
private fun addMessageReceiveJob(pushData: PushData?){ private fun addMessageReceiveJob(pushData: PushData?){

@ -1,11 +0,0 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportWidth="24"
android:viewportHeight="24"
android:tint="?colorAccent">
<path
android:fillColor="@android:color/white"
android:pathData="m12,2.4355c-5.2796,0 -9.5645,4.2848 -9.5645,9.5645 0,5.2796 4.2848,9.5645 9.5645,9.5645 5.2796,0 9.5645,-4.2848 9.5645,-9.5645 0,-5.2796 -4.2848,-9.5645 -9.5645,-9.5645zM12.123,7.9375 L15.6777,11.4922 14.9707,12.1992 12.623,9.8515v6.1797h-1v-6.1797l-1.9961,1.9941 -0.3535,0.3535 -0.707,-0.707 0.3535,-0.3535 3.2031,-3.2012z"
android:strokeWidth=".95645"/>
</vector>

@ -173,7 +173,8 @@
android:layout_centerHorizontal="true" android:layout_centerHorizontal="true"
android:layout_marginBottom="@dimen/new_conversation_button_bottom_offset" android:layout_marginBottom="@dimen/new_conversation_button_bottom_offset"
app:rippleColor="@color/button_primary_ripple" app:rippleColor="@color/button_primary_ripple"
android:src="@drawable/ic_plus" /> android:src="@drawable/ic_plus"
android:tint="?message_sent_text_color"/>
</RelativeLayout> </RelativeLayout>

@ -118,10 +118,11 @@
android:id="@+id/mediasend_send_button" android:id="@+id/mediasend_send_button"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"
android:scaleType="fitXY" android:scaleType="fitCenter"
android:padding="10dp"
android:contentDescription="@string/send" android:contentDescription="@string/send"
android:src="?conversation_transport_sms_indicator" android:src="@drawable/ic_arrow_up"
android:background="@drawable/circle_touch_highlight_background"/> android:background="@drawable/accent_dot"/>
</FrameLayout> </FrameLayout>

@ -41,8 +41,6 @@
<attr name="conversation_editor_text_color" format="reference|color"/> <attr name="conversation_editor_text_color" format="reference|color"/>
<attr name="conversation_input_background" format="reference"/> <attr name="conversation_input_background" format="reference"/>
<attr name="conversation_input_inline_attach_icon_tint" format="reference"/> <attr name="conversation_input_inline_attach_icon_tint" format="reference"/>
<attr name="conversation_transport_sms_indicator" format="reference"/>
<attr name="conversation_transport_push_indicator" format="reference"/>
<attr name="conversation_transport_popup_background" format="reference"/> <attr name="conversation_transport_popup_background" format="reference"/>
<attr name="conversation_emoji_toggle" format="reference"/> <attr name="conversation_emoji_toggle" format="reference"/>
<attr name="conversation_sticker_toggle" format="reference"/> <attr name="conversation_sticker_toggle" format="reference"/>

@ -21,7 +21,6 @@
<item name="android:backgroundDimEnabled">true</item> <item name="android:backgroundDimEnabled">true</item>
<item name="android:backgroundDimAmount">0.6</item> <item name="android:backgroundDimAmount">0.6</item>
<item name="dialogCornerRadius">@dimen/dialog_corner_radius</item> <item name="dialogCornerRadius">@dimen/dialog_corner_radius</item>
<item name="conversation_transport_sms_indicator">@drawable/ic_arrow_up_circle_24</item>
<item name="android:alertDialogTheme">@style/ThemeOverlay.Session.AlertDialog</item> <item name="android:alertDialogTheme">@style/ThemeOverlay.Session.AlertDialog</item>
<item name="alertDialogTheme">@style/ThemeOverlay.Session.AlertDialog</item> <item name="alertDialogTheme">@style/ThemeOverlay.Session.AlertDialog</item>
<item name="conversationMenuSearchTintColor">?android:textColorPrimary</item> <item name="conversationMenuSearchTintColor">?android:textColorPrimary</item>
@ -173,8 +172,6 @@
<item name="conversation_editor_background">#22ffffff</item> <item name="conversation_editor_background">#22ffffff</item>
<item name="conversation_editor_text_color">#ffeeeeee</item> <item name="conversation_editor_text_color">#ffeeeeee</item>
<item name="conversation_input_inline_attach_icon_tint">@color/core_grey_05</item> <item name="conversation_input_inline_attach_icon_tint">@color/core_grey_05</item>
<item name="conversation_transport_sms_indicator">@drawable/ic_arrow_up_circle_24</item>
<item name="conversation_transport_push_indicator">@drawable/ic_arrow_up_circle_24</item>
<item name="conversation_transport_popup_background">@color/black</item> <item name="conversation_transport_popup_background">@color/black</item>
<item name="conversation_attach_camera">@drawable/ic_photo_camera_dark</item> <item name="conversation_attach_camera">@drawable/ic_photo_camera_dark</item>
<item name="conversation_attach_image">@drawable/ic_image_dark</item> <item name="conversation_attach_image">@drawable/ic_image_dark</item>

@ -32,8 +32,6 @@
<attr name="conversation_editor_text_color" format="reference|color"/> <attr name="conversation_editor_text_color" format="reference|color"/>
<attr name="conversation_input_background" format="reference"/> <attr name="conversation_input_background" format="reference"/>
<attr name="conversation_input_inline_attach_icon_tint" format="reference"/> <attr name="conversation_input_inline_attach_icon_tint" format="reference"/>
<attr name="conversation_transport_sms_indicator" format="reference"/>
<attr name="conversation_transport_push_indicator" format="reference"/>
<attr name="conversation_transport_popup_background" format="reference"/> <attr name="conversation_transport_popup_background" format="reference"/>
<attr name="conversation_emoji_toggle" format="reference"/> <attr name="conversation_emoji_toggle" format="reference"/>
<attr name="conversation_sticker_toggle" format="reference"/> <attr name="conversation_sticker_toggle" format="reference"/>

Loading…
Cancel
Save