Skip to content
Snippets Groups Projects
Commit 7c66b03d authored by Taras's avatar Taras
Browse files

Add action for notification switch

parent f8806a5b
No related branches found
No related tags found
No related merge requests found
...@@ -54,6 +54,9 @@ class TimelineOptionsDialogFragment : ...@@ -54,6 +54,9 @@ class TimelineOptionsDialogFragment :
private fun setupViews() { private fun setupViews() {
with(binding) { with(binding) {
lPushNotifications.setOnClickListener {
viewModel.setNotificationsEnabled(!svPushNotifications.isChecked)
}
tvConfigure.apply { tvConfigure.apply {
setText( setText(
getString(if (isGroupMode) R.string.configure_group else R.string.configure_circle) getString(if (isGroupMode) R.string.configure_group else R.string.configure_circle)
...@@ -113,6 +116,9 @@ class TimelineOptionsDialogFragment : ...@@ -113,6 +116,9 @@ class TimelineOptionsDialogFragment :
binding.toolbar.title = room.displayName binding.toolbar.title = room.displayName
} }
} }
viewModel.notificationsStateLiveData.observeData(this) {
binding.svPushNotifications.isChecked = it
}
} }
......
...@@ -23,10 +23,12 @@ class TimelineOptionsViewModel @Inject constructor( ...@@ -23,10 +23,12 @@ class TimelineOptionsViewModel @Inject constructor(
accessLevelDataSource: AccessLevelDataSource, accessLevelDataSource: AccessLevelDataSource,
) : ViewModel() { ) : ViewModel() {
private val roomId: String = savedStateHandle.getOrThrow("roomId")
val leaveDeleteEventLiveData = SingleEventLiveData<Response<Unit?>>() val leaveDeleteEventLiveData = SingleEventLiveData<Response<Unit?>>()
val accessLevelLiveData = accessLevelDataSource.accessLevelFlow.asLiveData() val accessLevelLiveData = accessLevelDataSource.accessLevelFlow.asLiveData()
val notificationsStateLiveData = roomNotificationsDataSource.notificationsStateLiveData
private val roomId: String = savedStateHandle.getOrThrow("roomId")
val roomSummaryLiveData = val roomSummaryLiveData =
MatrixSessionProvider.getSessionOrThrow().getRoom(roomId)?.getRoomSummaryLive() MatrixSessionProvider.getSessionOrThrow().getRoom(roomId)?.getRoomSummaryLive()
......
...@@ -55,7 +55,7 @@ ...@@ -55,7 +55,7 @@
android:id="@+id/lPushNotifications" android:id="@+id/lPushNotifications"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginTop="16dp" android:layout_marginTop="24dp"
android:background="?selectableItemBackground" android:background="?selectableItemBackground"
android:clickable="true" android:clickable="true"
android:focusable="true" android:focusable="true"
...@@ -66,6 +66,8 @@ ...@@ -66,6 +66,8 @@
style="@style/settingMenuItem" style="@style/settingMenuItem"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:clickable="false"
android:focusable="false"
android:text="@string/push_notifications" android:text="@string/push_notifications"
app:drawableStartCompat="@drawable/ic_notifications" app:drawableStartCompat="@drawable/ic_notifications"
app:layout_constraintBottom_toBottomOf="parent" app:layout_constraintBottom_toBottomOf="parent"
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment