Skip to content

Commit 089b4a5

Browse files
authored
feat: show admin promotion message (WPB-25283) (#4825)
1 parent 9bbf44c commit 089b4a5

6 files changed

Lines changed: 42 additions & 1 deletion

File tree

app/src/main/kotlin/com/wire/android/mapper/SystemMessageContentMapper.kt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -226,6 +226,7 @@ class SystemMessageContentMapper @Inject constructor(
226226
return UIMessageContent.SystemMessage.RenamedConversation(authorName, content.conversationName)
227227
}
228228

229+
@Suppress("CyclomaticComplexMethod")
229230
fun mapMemberChangeMessage(
230231
content: MemberChange,
231232
senderUserId: UserId,
@@ -286,6 +287,8 @@ class SystemMessageContentMapper @Inject constructor(
286287
author = authorName,
287288
memberNames = memberNameList
288289
)
290+
291+
is MemberChange.SelfUserPromotedToAdmin -> UIMessageContent.SystemMessage.SelfUserPromotedToAdmin
289292
}
290293
}
291294

app/src/main/kotlin/com/wire/android/ui/home/conversations/messages/item/SystemMessageItem.kt

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -540,6 +540,13 @@ private fun SystemMessage.buildContent(isWireCellsEnabled: Boolean) = when (this
540540
}
541541
}
542542

543+
is SystemMessage.SelfUserPromotedToAdmin -> buildContent(
544+
iconResId = R.drawable.ic_member_role_updated,
545+
iconTintColor = MaterialTheme.wireColorScheme.onBackground,
546+
) {
547+
stringResource(id = R.string.label_system_message_admin_role_assigned).toMarkdownAnnotatedString()
548+
}
549+
543550
is SystemMessage.NewConversationWithCellStarted -> buildContent(
544551
iconResId = R.drawable.ic_files,
545552
iconTintColor = MaterialTheme.wireColorScheme.onBackground,

app/src/main/kotlin/com/wire/android/ui/home/conversations/model/UIMessage.kt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -612,6 +612,9 @@ sealed interface UIMessageContent {
612612
}
613613
}
614614

615+
@Serializable
616+
data object SelfUserPromotedToAdmin : SystemMessage
617+
615618
@Serializable
616619
data object NewConversationWithCellStarted : SystemMessage
617620

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
<!--
2+
~ Wire
3+
~ Copyright (C) 2026 Wire Swiss GmbH
4+
~
5+
~ This program is free software: you can redistribute it and/or modify
6+
~ it under the terms of the GNU General Public License as published by
7+
~ the Free Software Foundation, either version 3 of the License, or
8+
~ (at your option) any later version.
9+
~
10+
~ This program is distributed in the hope that it will be useful,
11+
~ but WITHOUT ANY WARRANTY; without even the implied warranty of
12+
~ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13+
~ GNU General Public License for more details.
14+
~
15+
~ You should have received a copy of the GNU General Public License
16+
~ along with this program. If not, see http://www.gnu.org/licenses/.
17+
-->
18+
<vector xmlns:android="http://schemas.android.com/apk/res/android"
19+
android:width="14dp"
20+
android:height="14dp"
21+
android:viewportWidth="14"
22+
android:viewportHeight="14">
23+
<path
24+
android:pathData="M11.5,0C12.881,0 14,1.119 14,2.5V8.5C14,9.881 12.881,11 11.5,11H3.726L0.814,13.345C0.598,13.518 0.284,13.484 0.111,13.269C0.039,13.18 0,13.07 0,12.955V2.5C0,1.119 1.119,0 2.5,0H11.5ZM5.572,2.074C5.465,1.972 5.371,1.99 5.287,2.04C5.058,2.182 4.822,2.322 4.579,2.459C4.475,2.521 4.441,2.599 4.461,2.731C4.586,3.522 4.314,4.189 3.631,4.772C3.599,4.799 3.564,4.824 3.524,4.847C3.462,4.884 3.394,4.914 3.327,4.941L3.228,4.978L3.131,5.022C3.07,5.058 3.035,5.105 3.02,5.172L3.013,5.245L3,6.116C2.998,6.24 3.048,6.317 3.159,6.358C3.564,6.506 3.873,6.795 4.132,7.268C4.387,7.732 4.46,8.201 4.357,8.699C4.34,8.782 4.357,8.849 4.412,8.903L4.459,8.941L5.012,9.3L5.214,9.425C5.237,9.436 5.264,9.446 5.294,9.448C5.328,9.45 5.36,9.443 5.39,9.425L5.421,9.403L5.532,9.293C5.59,9.243 5.654,9.196 5.723,9.155C6.032,8.973 6.459,8.89 6.882,8.935C7.26,8.975 7.595,9.111 7.821,9.314L7.941,9.436L7.978,9.466L8.022,9.489L8.074,9.5L8.123,9.497L8.177,9.48L8.236,9.45L8.904,9.055C9.044,8.973 9.059,8.87 9.045,8.781L9.012,8.609C8.971,8.297 9.041,7.922 9.21,7.558C9.4,7.15 9.687,6.81 9.999,6.626C10.069,6.585 10.14,6.551 10.211,6.526L10.357,6.483C10.397,6.468 10.441,6.439 10.465,6.38L10.48,6.332L10.486,6.272L10.497,5.662L10.5,5.368C10.501,5.255 10.457,5.183 10.363,5.147C9.912,4.976 9.579,4.661 9.346,4.184C9.109,3.698 9.044,3.264 9.141,2.818C9.162,2.722 9.144,2.647 9.085,2.589L9.034,2.547L8.336,2.097C8.236,2.031 8.142,2.057 8.096,2.085L8.064,2.106L7.927,2.22C7.871,2.266 7.811,2.312 7.749,2.349C7.709,2.372 7.671,2.39 7.632,2.405C7.284,2.536 6.957,2.593 6.662,2.574C6.256,2.548 5.9,2.384 5.572,2.074ZM6.75,4C7.716,4 8.5,4.784 8.5,5.75C8.5,6.716 7.716,7.5 6.75,7.5C5.784,7.5 5,6.716 5,5.75C5,4.784 5.784,4 6.75,4Z"
25+
android:fillColor="#000000"
26+
android:fillType="evenOdd"/>
27+
</vector>

app/src/main/res/values/strings.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1978,5 +1978,6 @@ In group conversations, the group admin can overwrite this setting.</string>
19781978
<string name="label_system_message_apps_access_enabled_by_other">%1$s enabled **apps** for this conversation</string>
19791979
<string name="label_system_message_apps_access_disabled_by_other">%1$s disabled **apps** for this conversation</string>
19801980
<string name="label_system_message_apps_access_enabled_disclaimer">Added apps have access to the content of this conversation.</string>
1981+
<string name="label_system_message_admin_role_assigned">You were promoted to group admin</string>
19811982
<string name="more_information_about_this_server">More information about this backend</string>
19821983
</resources>

0 commit comments

Comments
 (0)