-
Notifications
You must be signed in to change notification settings - Fork 395
Jitsi Widget Permissions #3393
Jitsi Widget Permissions #3393
Changes from all commits
96305de
0992a16
32ad61e
20b8eed
8164374
80b197e
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -65,7 +65,11 @@ class WidgetActivity : VectorAppCompatActivity() { | |
//already there | ||
} else { | ||
RoomWidgetPermissionBottomSheet | ||
.newInstance(viewModel.session!!.myUserId, viewModel.widget) | ||
.newInstance(viewModel.session!!.myUserId, viewModel.widget).apply { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Does this code is robust to screen rotation, will the bottomSheet is displayed? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. worst case you have to tap again on the video conf banner |
||
onFinish = { accepted -> | ||
if (!accepted) finish() | ||
} | ||
} | ||
.show(supportFragmentManager, FRAGMENT_TAG_PERMISSION) | ||
} | ||
} | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -26,7 +26,6 @@ import android.widget.TextView | |
import butterknife.BindView | ||
import butterknife.OnClick | ||
import com.airbnb.mvrx.MvRx | ||
import com.airbnb.mvrx.activityViewModel | ||
import com.airbnb.mvrx.fragmentViewModel | ||
import com.airbnb.mvrx.withState | ||
import im.vector.R | ||
|
@@ -53,8 +52,8 @@ class RoomWidgetPermissionBottomSheet : VectorBaseBottomSheetDialogFragment() { | |
|
||
@BindView(R.id.bottom_sheet_widget_permission_owner_avatar) | ||
lateinit var authorAvatarView: ImageView | ||
|
||
private val sharedActivityViewModel: RoomWidgetViewModel by activityViewModel() | ||
var onFinish: ((Boolean) -> Unit)? = null | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The sharedViewModel was better, no? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It makes the bottom sheet more generic, can be used in other activity easier |
||
|
||
override fun invalidate() = withState(viewModel) { state -> | ||
|
||
|
@@ -63,9 +62,13 @@ class RoomWidgetPermissionBottomSheet : VectorBaseBottomSheetDialogFragment() { | |
VectorUtils.loadUserAvatar(requireContext(), viewModel.session, authorAvatarView, | ||
state.authorAvatarUrl, state.authorId, state.authorName) | ||
|
||
val domain = state.widgetDomain ?: "" | ||
val infoBuilder = SpannableStringBuilder() | ||
.append(getString(R.string.room_widget_permission_shared_info_title, "'${state.widgetDomain | ||
?: ""}'")) | ||
.append(getString( | ||
R.string.room_widget_permission_webview_shared_info_title | ||
.takeIf { state.isWebviewWidget } | ||
?: R.string.room_widget_permission_shared_info_title, | ||
"'$domain'")) | ||
infoBuilder.append("\n") | ||
|
||
state.permissionsList?.forEach { | ||
|
@@ -94,19 +97,21 @@ class RoomWidgetPermissionBottomSheet : VectorBaseBottomSheetDialogFragment() { | |
viewModel.blockWidget() | ||
//optimistic dismiss | ||
dismiss() | ||
sharedActivityViewModel.doFinish() | ||
onFinish?.invoke(false) | ||
} | ||
|
||
@OnClick(R.id.bottom_sheet_widget_permission_continue_button) | ||
fun doAccept() { | ||
viewModel.allowWidget() | ||
onFinish?.invoke(true) | ||
//optimistic dismiss | ||
dismiss() | ||
|
||
} | ||
|
||
override fun onCancel(dialog: DialogInterface?) { | ||
super.onCancel(dialog) | ||
sharedActivityViewModel.doFinish() | ||
onFinish?.invoke(false) | ||
} | ||
|
||
@Parcelize | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍