Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
 - update bottom sheet behaviour on canceling to be the same as the decline bottom click.
  • Loading branch information
ahmed-radhouane committed Mar 3, 2022
1 parent 6e6b04c commit 5fd3862
Show file tree
Hide file tree
Showing 3 changed files with 34 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ import timber.log.Timber
/**
* Add Mavericks capabilities, handle DI and bindings.
*/
abstract class VectorBaseBottomSheetDialogFragment<VB : ViewBinding> : BottomSheetDialogFragment(), MavericksView {
abstract class VectorBaseBottomSheetDialogFragment<VB : ViewBinding> : BottomSheetDialogFragment(), MavericksView, VectorBaseBottomSheetListener {
/* ==========================================================================================
* Analytics
* ========================================================================================== */
Expand Down Expand Up @@ -126,6 +126,12 @@ abstract class VectorBaseBottomSheetDialogFragment<VB : ViewBinding> : BottomShe
super.onDestroy()
}

override fun doCancel(dialog: DialogInterface) {}
override fun onCancel(dialog: DialogInterface) {
doCancel(dialog)
super.onCancel(dialog)
}

override fun onAttach(context: Context) {
val activityEntryPoint = EntryPointAccessors.fromActivity(vectorBaseActivity, ActivityEntryPoint::class.java)
viewModelFactory = activityEntryPoint.viewModelFactory()
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
/*
* Copyright (c) 2022 New Vector Ltd
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

package im.vector.app.core.platform

import android.content.DialogInterface

interface VectorBaseBottomSheetListener {
fun doCancel(dialog: DialogInterface)
}
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,10 @@ class RoomWidgetPermissionBottomSheet :
views.widgetPermissionContinue.debouncedClicks { doAccept() }
}

override fun doCancel(dialog: DialogInterface) {
doDecline()
}

override fun invalidate() = withState(viewModel) { state ->
super.invalidate()
val permissionData = state.permissionData() ?: return@withState
Expand Down

0 comments on commit 5fd3862

Please sign in to comment.