1
0
mirror of https://github.com/TwidereProject/Twidere-Android synced 2025-02-17 04:00:48 +01:00

support notification enabled user retweet notification

This commit is contained in:
Mariotaku Lee 2017-03-18 17:12:53 +08:00
parent 215272b447
commit 5fcfc78f46
No known key found for this signature in database
GPG Key ID: 15C10F89D7C33535

View File

@ -343,8 +343,13 @@ class StreamingService : BaseService() {
builder.setWhen(status.createdAt?.time ?: 0)
builder.setSmallIcon(R.drawable.ic_stat_twitter)
builder.setCategory(NotificationCompat.CATEGORY_SOCIAL)
builder.setContentTitle(context.getString(R.string.notification_title_new_status_by_user, userDisplayName))
builder.setContentText(InternalTwitterContentUtils.formatStatusTextWithIndices(status).text)
if (status.isRetweetedByMe) {
builder.setContentTitle(context.getString(R.string.notification_title_new_retweet_by_user, userDisplayName))
builder.setContentText(InternalTwitterContentUtils.formatStatusTextWithIndices(status.retweetedStatus).text)
} else {
builder.setContentTitle(context.getString(R.string.notification_title_new_status_by_user, userDisplayName))
builder.setContentText(InternalTwitterContentUtils.formatStatusTextWithIndices(status).text)
}
builder.setContentIntent(PendingIntent.getActivity(context, 0, Intent(Intent.ACTION_VIEW, statusUri).apply {
setClass(context, LinkHandlerActivity::class.java)
}, PendingIntent.FLAG_UPDATE_CURRENT))