diff --git a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/session/SessionModule.kt b/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/session/SessionModule.kt index c750cb1f73..e6da21315b 100644 --- a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/session/SessionModule.kt +++ b/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/session/SessionModule.kt @@ -386,7 +386,4 @@ internal abstract class SessionModule { @Binds abstract fun bindEventSenderProcessor(processor: EventSenderProcessorCoroutine): EventSenderProcessor - - - } diff --git a/newsfragment/3531.feature b/newsfragment/3531.feature new file mode 100644 index 0000000000..e8b63584e3 --- /dev/null +++ b/newsfragment/3531.feature @@ -0,0 +1 @@ +Introduces AutoAcceptInvites which can be enabled at compile time. \ No newline at end of file diff --git a/vector/src/main/java/im/vector/app/features/home/HomeDetailViewModel.kt b/vector/src/main/java/im/vector/app/features/home/HomeDetailViewModel.kt index f282a3137c..3614b345c6 100644 --- a/vector/src/main/java/im/vector/app/features/home/HomeDetailViewModel.kt +++ b/vector/src/main/java/im/vector/app/features/home/HomeDetailViewModel.kt @@ -208,7 +208,7 @@ private val autoAcceptInvites: AutoAcceptInvites) val activeSpaceRoomId = groupingMethod.spaceSummary?.roomId var dmInvites = 0 var roomsInvite = 0 - if(!autoAcceptInvites.hideInvites) { + if (!autoAcceptInvites.hideInvites) { dmInvites = session.getRoomSummaries( roomSummaryQueryParams { memberships = listOf(Membership.INVITE) diff --git a/vector/src/main/java/im/vector/app/features/invite/AutoAcceptInvites.kt b/vector/src/main/java/im/vector/app/features/invite/AutoAcceptInvites.kt index 4027ba23d5..4f39ee0925 100644 --- a/vector/src/main/java/im/vector/app/features/invite/AutoAcceptInvites.kt +++ b/vector/src/main/java/im/vector/app/features/invite/AutoAcceptInvites.kt @@ -24,6 +24,6 @@ interface AutoAcceptInvites { } class CompileTimeAutoAcceptInvites @Inject constructor() : AutoAcceptInvites { - override val isEnabled = true - override val hideInvites = false + override val isEnabled = false + override val hideInvites = isEnabled } diff --git a/vector/src/main/java/im/vector/app/features/notifications/NotificationDrawerManager.kt b/vector/src/main/java/im/vector/app/features/notifications/NotificationDrawerManager.kt index c051a866b5..37ed1e654a 100644 --- a/vector/src/main/java/im/vector/app/features/notifications/NotificationDrawerManager.kt +++ b/vector/src/main/java/im/vector/app/features/notifications/NotificationDrawerManager.kt @@ -256,10 +256,10 @@ class NotificationDrawerManager @Inject constructor(private val context: Context } } is InviteNotifiableEvent -> { - if(autoAcceptInvites.hideInvites){ + if (autoAcceptInvites.hideInvites) { // Forget this event eventIterator.remove() - }else { + } else { invitationEvents.add(event) } } diff --git a/vector/src/main/java/im/vector/app/features/spaces/SpacesListViewModel.kt b/vector/src/main/java/im/vector/app/features/spaces/SpacesListViewModel.kt index 93205364f2..ca1dc54cf5 100644 --- a/vector/src/main/java/im/vector/app/features/spaces/SpacesListViewModel.kt +++ b/vector/src/main/java/im/vector/app/features/spaces/SpacesListViewModel.kt @@ -121,9 +121,9 @@ class SpacesListViewModel @AssistedInject constructor(@Assisted initialState: Sp .throttleFirst(300, TimeUnit.MILLISECONDS) .observeOn(Schedulers.computation()) .subscribe { - val inviteCount = if(autoAcceptInvites.hideInvites){ + val inviteCount = if (autoAcceptInvites.hideInvites) { 0 - }else { + } else { session.getRoomSummaries( roomSummaryQueryParams { this.memberships = listOf(Membership.INVITE) } ).size