Skip to content

Commit 165c93a

Browse files
authored
Remove android.nonTransitiveRClass=false and update cross-module R references (#6336)
* Remove `android.nonTransitiveRClass=false` since AGP 8.0+ defaults to non-transitive R classes. This migration aligns the project with modern defaults, improves build performance (smaller R classes, better incremental compilation), and prevents accidental coupling between modules. * Update KDoc for ChannelScreen component * Increase coverage of CommandExtensions and cleanup snapshot files * Fix string resource logic for group and conversation channel errors
1 parent 85f4558 commit 165c93a

88 files changed

Lines changed: 444 additions & 365 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

gradle.properties

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,6 @@ org.gradle.jvmargs=-Xmx4g -XX:+HeapDumpOnOutOfMemoryError -XX:+UseParallelGC -Dl
33
android.useAndroidX=true
44
org.gradle.parallel=true
55
org.gradle.caching=true
6-
android.nonTransitiveRClass=false
7-
86
# Disabled R8 full mode
97
android.enableR8.fullMode=true
108
android.suppressUnsupportedCompileSdk=34

stream-chat-android-compose-sample/src/androidTestE2eDebug/kotlin/io/getstream/chat/android/compose/tests/QuotedReplyTests.kt

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@
1616

1717
package io.getstream.chat.android.compose.tests
1818

19-
import io.getstream.chat.android.compose.R
2019
import io.getstream.chat.android.compose.robots.assertDeletedMessage
2120
import io.getstream.chat.android.compose.robots.assertGiphyImage
2221
import io.getstream.chat.android.compose.robots.assertInvalidCommandMessage
@@ -33,6 +32,7 @@ import io.qameta.allure.kotlin.Allure.step
3332
import io.qameta.allure.kotlin.AllureId
3433
import org.junit.Ignore
3534
import org.junit.Test
35+
import io.getstream.chat.android.ui.common.R as UiCommonR
3636

3737
class QuotedReplyTests : StreamTestCase() {
3838

@@ -244,7 +244,7 @@ class QuotedReplyTests : StreamTestCase() {
244244
step("AND deleted message is shown in quoted reply bubble") {
245245
userRobot.assertQuotedMessage(
246246
text = quoteReply,
247-
quote = appContext.getString(R.string.stream_ui_message_list_message_deleted),
247+
quote = appContext.getString(UiCommonR.string.stream_ui_message_list_message_deleted),
248248
)
249249
}
250250
}
@@ -292,7 +292,7 @@ class QuotedReplyTests : StreamTestCase() {
292292
step("AND deleted message is shown in quoted reply bubble") {
293293
userRobot.assertQuotedMessage(
294294
text = quoteReply,
295-
quote = appContext.getString(R.string.stream_ui_message_list_message_deleted),
295+
quote = appContext.getString(UiCommonR.string.stream_ui_message_list_message_deleted),
296296
)
297297
}
298298
}
@@ -637,7 +637,7 @@ class QuotedReplyTests : StreamTestCase() {
637637
step("AND deleted message is shown in quoted reply bubble") {
638638
userRobot.assertQuotedMessage(
639639
text = quoteReply,
640-
quote = appContext.getString(R.string.stream_ui_message_list_message_deleted),
640+
quote = appContext.getString(UiCommonR.string.stream_ui_message_list_message_deleted),
641641
)
642642
}
643643
}
@@ -686,7 +686,7 @@ class QuotedReplyTests : StreamTestCase() {
686686
step("AND deleted message is shown in quoted reply bubble") {
687687
userRobot.assertQuotedMessage(
688688
text = quoteReply,
689-
quote = appContext.getString(R.string.stream_ui_message_list_message_deleted),
689+
quote = appContext.getString(UiCommonR.string.stream_ui_message_list_message_deleted),
690690
)
691691
}
692692
}

stream-chat-android-compose-sample/src/main/java/io/getstream/chat/android/compose/sample/feature/channel/list/ChannelsScreenNavigationDrawer.kt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@ import io.getstream.chat.android.compose.ui.components.avatar.AvatarSize
4747
import io.getstream.chat.android.compose.ui.components.avatar.UserAvatar
4848
import io.getstream.chat.android.compose.ui.theme.ChatTheme
4949
import io.getstream.chat.android.models.User
50+
import io.getstream.chat.android.compose.R as ComposeR
5051

5152
@Suppress("LongParameterList")
5253
@Composable
@@ -92,7 +93,7 @@ fun ChannelsScreenNavigationDrawer(
9293
Spacer(modifier = Modifier.weight(1f))
9394
// Sign Out
9495
NavigationDrawerItem(
95-
icon = R.drawable.stream_design_ic_account,
96+
icon = ComposeR.drawable.stream_design_ic_account,
9697
text = stringResource(R.string.navigation_drawer_sign_out),
9798
onClick = onSignOutClick,
9899
)

stream-chat-android-compose-sample/src/main/java/io/getstream/chat/android/compose/sample/ui/channel/DirectChannelInfoActivity.kt

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,6 @@ import androidx.activity.viewModels
2626
import androidx.compose.foundation.layout.statusBarsPadding
2727
import androidx.compose.runtime.LaunchedEffect
2828
import androidx.compose.ui.Modifier
29-
import io.getstream.chat.android.compose.sample.R
3029
import io.getstream.chat.android.compose.sample.ui.channel.attachments.ChannelFilesAttachmentsActivity
3130
import io.getstream.chat.android.compose.sample.ui.channel.attachments.ChannelMediaAttachmentsActivity
3231
import io.getstream.chat.android.compose.sample.ui.pinned.PinnedMessagesActivity
@@ -36,6 +35,7 @@ import io.getstream.chat.android.compose.viewmodel.channel.ChannelInfoViewModel
3635
import io.getstream.chat.android.compose.viewmodel.channel.ChannelInfoViewModelFactory
3736
import io.getstream.chat.android.ui.common.feature.channel.info.ChannelInfoViewEvent
3837
import kotlinx.coroutines.flow.collectLatest
38+
import io.getstream.chat.android.ui.common.R as UiCommonR
3939

4040
/**
4141
* Activity showing information about a 1-to-1 direct channel (chat).
@@ -144,37 +144,37 @@ class DirectChannelInfoActivity : ComponentActivity() {
144144
private fun showError(error: ChannelInfoViewEvent.Error) {
145145
val message = when (error) {
146146
ChannelInfoViewEvent.RenameChannelError,
147-
-> R.string.stream_ui_channel_info_rename_group_error
147+
-> UiCommonR.string.stream_ui_channel_info_rename_group_error
148148

149149
ChannelInfoViewEvent.MuteChannelError,
150150
ChannelInfoViewEvent.UnmuteChannelError,
151-
-> R.string.stream_ui_channel_info_mute_conversation_error
151+
-> UiCommonR.string.stream_ui_channel_info_mute_conversation_error
152152

153153
ChannelInfoViewEvent.MuteUserError,
154154
ChannelInfoViewEvent.UnmuteUserError,
155-
-> R.string.stream_ui_channel_info_mute_user_error
155+
-> UiCommonR.string.stream_ui_channel_info_mute_user_error
156156

157157
ChannelInfoViewEvent.BlockUserError,
158158
ChannelInfoViewEvent.UnblockUserError,
159-
-> R.string.stream_ui_channel_info_block_user_error
159+
-> UiCommonR.string.stream_ui_channel_info_block_user_error
160160

161161
ChannelInfoViewEvent.LeaveChannelError,
162-
-> R.string.stream_ui_channel_info_leave_conversation_error
162+
-> UiCommonR.string.stream_ui_channel_info_leave_conversation_error
163163

164164
ChannelInfoViewEvent.DeleteChannelError,
165-
-> R.string.stream_ui_channel_info_delete_conversation_error
165+
-> UiCommonR.string.stream_ui_channel_info_delete_conversation_error
166166

167167
ChannelInfoViewEvent.RemoveMemberError,
168-
-> R.string.stream_ui_channel_info_remove_member_error
168+
-> UiCommonR.string.stream_ui_channel_info_remove_member_error
169169

170170
ChannelInfoViewEvent.AddMembersError,
171-
-> R.string.stream_ui_channel_info_add_members_error
171+
-> UiCommonR.string.stream_ui_channel_info_add_members_error
172172

173173
ChannelInfoViewEvent.BanMemberError,
174-
-> R.string.stream_ui_channel_info_ban_member_error
174+
-> UiCommonR.string.stream_ui_channel_info_ban_member_error
175175

176176
ChannelInfoViewEvent.UnbanMemberError,
177-
-> R.string.stream_ui_channel_info_unban_member_error
177+
-> UiCommonR.string.stream_ui_channel_info_unban_member_error
178178
}
179179
Toast.makeText(applicationContext, message, Toast.LENGTH_SHORT).show()
180180
}

stream-chat-android-compose-sample/src/main/java/io/getstream/chat/android/compose/sample/ui/channel/GroupChannelInfoActivity.kt

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,6 @@ import androidx.activity.viewModels
2626
import androidx.compose.foundation.layout.statusBarsPadding
2727
import androidx.compose.runtime.LaunchedEffect
2828
import androidx.compose.ui.Modifier
29-
import io.getstream.chat.android.compose.sample.R
3029
import io.getstream.chat.android.compose.sample.feature.channel.draft.DraftChannelActivity
3130
import io.getstream.chat.android.compose.sample.ui.MessagesActivity
3231
import io.getstream.chat.android.compose.sample.ui.channel.attachments.ChannelFilesAttachmentsActivity
@@ -38,6 +37,7 @@ import io.getstream.chat.android.compose.viewmodel.channel.ChannelInfoViewModel
3837
import io.getstream.chat.android.compose.viewmodel.channel.ChannelInfoViewModelFactory
3938
import io.getstream.chat.android.ui.common.feature.channel.info.ChannelInfoViewEvent
4039
import kotlinx.coroutines.flow.collectLatest
40+
import io.getstream.chat.android.ui.common.R as UiCommonR
4141

4242
/**
4343
* Activity showing information about a group channel (chat).
@@ -145,37 +145,37 @@ class GroupChannelInfoActivity : ComponentActivity() {
145145
private fun showError(error: ChannelInfoViewEvent.Error) {
146146
val message = when (error) {
147147
ChannelInfoViewEvent.RenameChannelError,
148-
-> R.string.stream_ui_channel_info_rename_group_error
148+
-> UiCommonR.string.stream_ui_channel_info_rename_group_error
149149

150150
ChannelInfoViewEvent.MuteChannelError,
151151
ChannelInfoViewEvent.UnmuteChannelError,
152-
-> R.string.stream_ui_channel_info_mute_group_error
152+
-> UiCommonR.string.stream_ui_channel_info_mute_group_error
153153

154154
ChannelInfoViewEvent.MuteUserError,
155155
ChannelInfoViewEvent.UnmuteUserError,
156-
-> R.string.stream_ui_channel_info_mute_user_error
156+
-> UiCommonR.string.stream_ui_channel_info_mute_user_error
157157

158158
ChannelInfoViewEvent.BlockUserError,
159159
ChannelInfoViewEvent.UnblockUserError,
160-
-> R.string.stream_ui_channel_info_block_user_error
160+
-> UiCommonR.string.stream_ui_channel_info_block_user_error
161161

162162
ChannelInfoViewEvent.LeaveChannelError,
163-
-> R.string.stream_ui_channel_info_leave_group_error
163+
-> UiCommonR.string.stream_ui_channel_info_leave_group_error
164164

165165
ChannelInfoViewEvent.DeleteChannelError,
166-
-> R.string.stream_ui_channel_info_delete_group_error
166+
-> UiCommonR.string.stream_ui_channel_info_delete_group_error
167167

168168
ChannelInfoViewEvent.BanMemberError,
169-
-> R.string.stream_ui_channel_info_ban_member_error
169+
-> UiCommonR.string.stream_ui_channel_info_ban_member_error
170170

171171
ChannelInfoViewEvent.UnbanMemberError,
172-
-> R.string.stream_ui_channel_info_unban_member_error
172+
-> UiCommonR.string.stream_ui_channel_info_unban_member_error
173173

174174
ChannelInfoViewEvent.RemoveMemberError,
175-
-> R.string.stream_ui_channel_info_remove_member_error
175+
-> UiCommonR.string.stream_ui_channel_info_remove_member_error
176176

177177
ChannelInfoViewEvent.AddMembersError,
178-
-> R.string.stream_ui_channel_info_add_members_error
178+
-> UiCommonR.string.stream_ui_channel_info_add_members_error
179179
}
180180
Toast.makeText(applicationContext, message, Toast.LENGTH_SHORT).show()
181181
}

stream-chat-android-compose-sample/src/main/java/io/getstream/chat/android/compose/sample/ui/channel/attachments/ChannelMediaAttachmentsActivity.kt

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,14 +27,15 @@ import androidx.compose.runtime.LaunchedEffect
2727
import androidx.compose.ui.Modifier
2828
import androidx.lifecycle.viewmodel.compose.viewModel
2929
import io.getstream.chat.android.compose.sample.R
30-
import io.getstream.chat.android.compose.sample.R.string.stream_ui_message_list_video_display_error
3130
import io.getstream.chat.android.compose.ui.channel.attachments.ChannelMediaAttachmentsScreen
3231
import io.getstream.chat.android.compose.ui.theme.ChatTheme
3332
import io.getstream.chat.android.compose.viewmodel.channel.ChannelAttachmentsViewModel
3433
import io.getstream.chat.android.compose.viewmodel.channel.ChannelAttachmentsViewModelFactory
3534
import io.getstream.chat.android.models.AttachmentType
3635
import io.getstream.chat.android.ui.common.feature.channel.attachments.ChannelAttachmentsViewEvent
3736
import kotlinx.coroutines.flow.collectLatest
37+
import io.getstream.chat.android.compose.R as ComposeR
38+
import io.getstream.chat.android.ui.common.R as UiCommonR
3839

3940
class ChannelMediaAttachmentsActivity : ComponentActivity() {
4041
companion object {
@@ -65,14 +66,14 @@ class ChannelMediaAttachmentsActivity : ComponentActivity() {
6566
onVideoPlaybackError = {
6667
Toast.makeText(
6768
applicationContext,
68-
stream_ui_message_list_video_display_error,
69+
UiCommonR.string.stream_ui_message_list_video_display_error,
6970
Toast.LENGTH_SHORT,
7071
).show()
7172
},
7273
onSharingError = {
7374
Toast.makeText(
7475
applicationContext,
75-
R.string.stream_compose_media_gallery_preview_could_not_share_attachment,
76+
ComposeR.string.stream_compose_media_gallery_preview_could_not_share_attachment,
7677
Toast.LENGTH_SHORT,
7778
).show()
7879
},

stream-chat-android-compose-sample/src/main/java/io/getstream/chat/android/compose/sample/ui/chats/ChatsActivity.kt

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,6 @@ import io.getstream.chat.android.client.api.state.globalStateFlow
5151
import io.getstream.chat.android.compose.sample.ChatApp
5252
import io.getstream.chat.android.compose.sample.ChatHelper
5353
import io.getstream.chat.android.compose.sample.R
54-
import io.getstream.chat.android.compose.sample.R.string.stream_ui_message_list_video_display_error
5554
import io.getstream.chat.android.compose.sample.feature.channel.ChannelConstants.CHANNEL_ARG_DRAFT
5655
import io.getstream.chat.android.compose.sample.feature.channel.add.AddChannelActivity
5756
import io.getstream.chat.android.compose.sample.feature.channel.isGroupChannel
@@ -105,6 +104,7 @@ import kotlinx.coroutines.flow.collectLatest
105104
import kotlinx.coroutines.flow.flatMapLatest
106105
import kotlinx.coroutines.launch
107106
import io.getstream.chat.android.compose.R as ComposeR
107+
import io.getstream.chat.android.ui.common.R as UiCommonR
108108

109109
class ChatsActivity : ComponentActivity() {
110110

@@ -480,7 +480,7 @@ class ChatsActivity : ComponentActivity() {
480480
title = {
481481
Column {
482482
Text(
483-
text = stringResource(R.string.stream_ui_channel_info_group_title),
483+
text = stringResource(UiCommonR.string.stream_ui_channel_info_group_title),
484484
style = ChatTheme.typography.headingMedium,
485485
color = ChatTheme.colors.textPrimary,
486486
)
@@ -503,7 +503,7 @@ class ChatsActivity : ComponentActivity() {
503503
OutlinedButton(
504504
onClick = onActionClick,
505505
) {
506-
Text(text = stringResource(id = ComposeR.string.stream_ui_channel_info_edit_action))
506+
Text(text = stringResource(id = UiCommonR.string.stream_ui_channel_info_edit_action))
507507
}
508508
}
509509
},
@@ -578,14 +578,14 @@ class ChatsActivity : ComponentActivity() {
578578
onVideoPlaybackError = {
579579
Toast.makeText(
580580
applicationContext,
581-
stream_ui_message_list_video_display_error,
581+
UiCommonR.string.stream_ui_message_list_video_display_error,
582582
Toast.LENGTH_SHORT,
583583
).show()
584584
},
585585
onSharingError = {
586586
Toast.makeText(
587587
applicationContext,
588-
R.string.stream_compose_media_gallery_preview_could_not_share_attachment,
588+
ComposeR.string.stream_compose_media_gallery_preview_could_not_share_attachment,
589589
Toast.LENGTH_SHORT,
590590
).show()
591591
},
@@ -630,8 +630,8 @@ class ChatsActivity : ComponentActivity() {
630630
private fun CloseButton(onClick: () -> Unit) {
631631
IconButton(onClick = onClick) {
632632
Icon(
633-
painter = painterResource(id = R.drawable.stream_design_ic_xmark),
634-
contentDescription = stringResource(id = R.string.stream_compose_cancel),
633+
painter = painterResource(id = ComposeR.drawable.stream_design_ic_xmark),
634+
contentDescription = stringResource(id = ComposeR.string.stream_compose_cancel),
635635
tint = ChatTheme.colors.textPrimary,
636636
)
637637
}
@@ -717,37 +717,37 @@ private fun ThreePaneNavigator.navigateToChannel(
717717
private fun Context.showError(error: ChannelInfoViewEvent.Error) {
718718
val message = when (error) {
719719
ChannelInfoViewEvent.RenameChannelError,
720-
-> R.string.stream_ui_channel_info_rename_group_error
720+
-> UiCommonR.string.stream_ui_channel_info_rename_group_error
721721

722722
ChannelInfoViewEvent.MuteChannelError,
723723
ChannelInfoViewEvent.UnmuteChannelError,
724-
-> R.string.stream_ui_channel_info_mute_conversation_error
724+
-> UiCommonR.string.stream_ui_channel_info_mute_conversation_error
725725

726726
ChannelInfoViewEvent.MuteUserError,
727727
ChannelInfoViewEvent.UnmuteUserError,
728-
-> R.string.stream_ui_channel_info_mute_user_error
728+
-> UiCommonR.string.stream_ui_channel_info_mute_user_error
729729

730730
ChannelInfoViewEvent.BlockUserError,
731731
ChannelInfoViewEvent.UnblockUserError,
732-
-> R.string.stream_ui_channel_info_block_user_error
732+
-> UiCommonR.string.stream_ui_channel_info_block_user_error
733733

734734
ChannelInfoViewEvent.LeaveChannelError,
735-
-> R.string.stream_ui_channel_info_leave_conversation_error
735+
-> UiCommonR.string.stream_ui_channel_info_leave_conversation_error
736736

737737
ChannelInfoViewEvent.DeleteChannelError,
738-
-> R.string.stream_ui_channel_info_delete_conversation_error
738+
-> UiCommonR.string.stream_ui_channel_info_delete_conversation_error
739739

740740
ChannelInfoViewEvent.BanMemberError,
741-
-> R.string.stream_ui_channel_info_ban_member_error
741+
-> UiCommonR.string.stream_ui_channel_info_ban_member_error
742742

743743
ChannelInfoViewEvent.UnbanMemberError,
744-
-> R.string.stream_ui_channel_info_unban_member_error
744+
-> UiCommonR.string.stream_ui_channel_info_unban_member_error
745745

746746
ChannelInfoViewEvent.RemoveMemberError,
747-
-> R.string.stream_ui_channel_info_remove_member_error
747+
-> UiCommonR.string.stream_ui_channel_info_remove_member_error
748748

749749
ChannelInfoViewEvent.AddMembersError,
750-
-> R.string.stream_ui_channel_info_add_members_error
750+
-> UiCommonR.string.stream_ui_channel_info_add_members_error
751751
}
752752
Toast.makeText(applicationContext, message, Toast.LENGTH_SHORT).show()
753753
}

stream-chat-android-compose-sample/src/main/java/io/getstream/chat/android/compose/sample/ui/component/AppToolbar.kt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,8 +38,8 @@ import androidx.compose.ui.text.style.TextAlign
3838
import androidx.compose.ui.unit.Dp
3939
import androidx.compose.ui.unit.dp
4040
import androidx.compose.ui.unit.sp
41-
import io.getstream.chat.android.compose.sample.R
4241
import io.getstream.chat.android.compose.ui.theme.ChatTheme
42+
import io.getstream.chat.android.compose.R as ComposeR
4343

4444
/**
4545
* Composable rendering the default app toolbar.
@@ -71,7 +71,7 @@ fun AppToolbar(
7171
IconButton(onClick = onBack) {
7272
Icon(
7373
modifier = Modifier.size(24.dp),
74-
painter = painterResource(id = R.drawable.stream_design_ic_arrow_left),
74+
painter = painterResource(id = ComposeR.drawable.stream_design_ic_arrow_left),
7575
contentDescription = "Back",
7676
tint = ChatTheme.colors.textPrimary,
7777
)

stream-chat-android-compose-sample/src/main/java/io/getstream/chat/android/compose/sample/ui/location/LocationPicker.kt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -65,14 +65,14 @@ import com.google.android.gms.location.LocationRequest
6565
import com.google.android.gms.location.LocationServices
6666
import com.google.android.gms.location.LocationSettingsRequest
6767
import com.google.android.gms.location.Priority
68-
import io.getstream.chat.android.compose.R
6968
import io.getstream.chat.android.compose.sample.ui.component.MapWebView
7069
import io.getstream.chat.android.compose.sample.vm.SharedLocationViewModel
7170
import io.getstream.chat.android.compose.sample.vm.SharedLocationViewModelFactory
7271
import io.getstream.chat.android.compose.ui.components.LoadingIndicator
7372
import io.getstream.chat.android.compose.ui.theme.ChatTheme
7473
import kotlinx.coroutines.tasks.await
7574
import java.util.Date
75+
import io.getstream.chat.android.ui.common.R as UiCommonR
7676

7777
@Composable
7878
internal fun LocationPicker(
@@ -267,7 +267,7 @@ private fun LocationPermissionRequired(
267267
colors = ButtonDefaults.textButtonColors(contentColor = ChatTheme.colors.accentPrimary),
268268
onClick = onClick,
269269
) {
270-
Text(stringResource(id = R.string.stream_ui_message_composer_grant_permission_button))
270+
Text(stringResource(id = UiCommonR.string.stream_ui_message_composer_grant_permission_button))
271271
}
272272
}
273273
}

0 commit comments

Comments
 (0)