Skip to content

Commit

Permalink
update pmi room invite info
Browse files Browse the repository at this point in the history
  • Loading branch information
AderanFeng committed Nov 22, 2023
1 parent 5c4d503 commit f3d1e42
Show file tree
Hide file tree
Showing 6 changed files with 27 additions and 7 deletions.
1 change: 1 addition & 0 deletions app/src/main/java/io/agora/flat/data/model/InviteInfo.kt
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,5 @@ data class InviteInfo(
val roomUuid: String,
val beginTime: Long,
val endTime: Long,
val isPmi: Boolean
)
Original file line number Diff line number Diff line change
Expand Up @@ -669,6 +669,7 @@ class ClassRoomViewModel @Inject constructor(
roomUuid = state.inviteCode.toInviteCodeDisplay(),
beginTime = state.beginTime,
endTime = state.endTime,
isPmi = state.isPmi,
)
}

Expand Down
18 changes: 13 additions & 5 deletions app/src/main/java/io/agora/flat/ui/activity/play/ToolComponent.kt
Original file line number Diff line number Diff line change
Expand Up @@ -214,6 +214,7 @@ class ToolComponent(
activity.showToast(R.string.teacher_turn_off_mic)
}
}

is RequestDeviceResponseReceived -> {
if (event.camera == false) {
activity.showToast(
Expand All @@ -227,15 +228,19 @@ class ToolComponent(
activity.showToast(activity.getString(R.string.refuse_turn_on_mic_format, event.username))
}
}

is RequestDeviceSent -> {
activity.showToast(R.string.teacher_send_request_device)
}

is RequestDeviceReceived -> {
handleRequestDevice(event)
}

RequestMuteAllSent -> {
activity.showToast(R.string.toast_mute_all_mic)
}

else -> {}
}
}
Expand Down Expand Up @@ -526,23 +531,26 @@ class ToolComponent(

private fun showInviteDialog() {
val inviteInfo = viewModel.getInviteInfo() ?: return
val inviteTitle = activity.getString(R.string.invite_title_format, inviteInfo.username)

val inviteLink = inviteInfo.link
val datetime = "${FlatFormatter.date(inviteInfo.beginTime)} ${
FlatFormatter.timeDuring(inviteInfo.beginTime, inviteInfo.endTime)
}"
val datetime = FlatFormatter.dateWithDuring(inviteInfo.beginTime, inviteInfo.endTime)
val roomTitle = inviteInfo.roomTitle
val roomUuid = inviteInfo.roomUuid

val inviteText = activity.getString(
R.string.invite_text_format,
if (inviteInfo.isPmi) R.string.invite_pmi_text_format else R.string.invite_text_format,
inviteInfo.username,
roomTitle,
roomUuid,
datetime,
inviteLink
)

val inviteTitle = activity.getString(
if (inviteInfo.isPmi) R.string.invite_pmi_title_format else R.string.invite_title_format,
inviteInfo.username
)

val dialog = InviteDialog().apply {
arguments = Bundle().apply {
putString(InviteDialog.INVITE_TITLE, inviteTitle)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -528,18 +528,23 @@ private fun InviteDialog(roomInfo: UIRoomInfo, onDismissRequest: () -> Unit, onC
val inviteLink = "${roomInfo.baseInviteUrl}/join/$linkCode"

val inviteText = stringResource(
R.string.invite_text_format,
if (roomInfo.isPmi) R.string.invite_pmi_text_format else R.string.invite_text_format,
roomInfo.username,
roomInfo.title,
datetime,
roomInfo.inviteCode.toInviteCodeDisplay(),
inviteLink
)

val inviteTitle = stringResource(
if (roomInfo.isPmi) R.string.invite_pmi_title_format else R.string.invite_title_format,
roomInfo.username
)

Dialog(onDismissRequest) {
Surface(shape = Shapes.large) {
Column(Modifier.padding(horizontal = 24.dp, vertical = 20.dp)) {
Text(stringResource(R.string.invite_title_format, roomInfo.username))
Text(inviteTitle)
FlatLargeVerticalSpacer()
Row {
Text(stringResource(R.string.room_theme))
Expand Down
3 changes: 3 additions & 0 deletions app/src/main/res/values-zh/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -266,6 +266,9 @@
<string name="invite_text_format">%1$s 邀请你加入 Flat 房间\n\n房间主题:%2$s\n房间号:%3$s\n\n开始时间:%4$s\n加入链接:%5$s</string>
<string name="invite_title_format">%1$s 邀请你加入 Flat 房间</string>

<string name="invite_pmi_text_format">%1$s 邀请你加入 Flat 个人房间\n\n房间主题:%2$s\n房间号:%3$s\n\n开始时间:%4$s\n加入链接:%5$s</string>
<string name="invite_pmi_title_format">%1$s 邀请你加入 Flat 个人房间</string>

<string name="replay">回放</string>
<string name="exit_replay">退出回放</string>
<string name="exit_replay_tip">确定退出回放?</string>
Expand Down
2 changes: 2 additions & 0 deletions app/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -254,6 +254,8 @@
<string name="copy_success">Copy successfully</string>
<string name="invite_text_format">%1$s invites you to join the Flat room\n\nRoom Theme: %2$s\nRoom ID: %3$s\n\nStart Time: %4$s\nJoin Link: %5$s</string>
<string name="invite_title_format">%1$s invites you to join the Flat room</string>
<string name="invite_pmi_text_format">%1$s invites you to join the Flat pmi room\n\nRoom Theme: %2$s\nRoom ID: %3$s\n\nStart Time: %4$s\nJoin Link: %5$s</string>
<string name="invite_pmi_title_format">%1$s invites you to join the Flat pmi room</string>
<string name="replay">Replay</string>
<string name="exit_replay">Exit playback</string>
<string name="exit_replay_tip">Are you sure to exit playback?</string>
Expand Down

0 comments on commit f3d1e42

Please sign in to comment.