Merge branch 'develop' into feature/fre/start_dm_on_first_msg

* develop: (91 commits)
  Remove unused import
  Update versions
  Update CHANGES
  Improve readability.
  Weblate: also clean trads
  Changelog
  Format file
  Add android:hasFragileUserData="true" to the manifest. See details in #2352
  Clean the TODO delete (UnusedResource not compatible with string template)
  showing a toast on password reset confirmation
  lifting duplicated event_base layout to the base class, with the option for children to override
  using vector model for consistency
  Replace 5 manual steps to 1 command line step
  Translated using Weblate (Italian)
  Translated using Weblate (Swedish)
  Translated using Weblate (Swedish)
  Translated using Weblate (Russian)
  extracting common breaker background selection to ftue extensions
  removing unused imports
  adding changelog entry
  ...
This commit is contained in:
Florian Renaud 2022-07-01 09:35:40 +02:00
commit 33a19c1ef5
322 changed files with 1780 additions and 796 deletions

View file

@ -100,12 +100,20 @@ body:
##### Release on MavenCentral
- [ ] Checkout the branch `main`
- [ ] Run the command `./gradlew publish --no-daemon --no-parallel`. You'll need some non-public element to do so
- [ ] Run the command `./gradlew closeAndReleaseRepository`. If it is working well, you can jump directly to the final step of this section.
If `./gradlew closeAndReleaseRepository` fails (for instance, several repositories are waiting to be handled), you have to close and release the repository manually. Do the following steps:
- [ ] Connect to https://s01.oss.sonatype.org
- [ ] Click on Staging Repositories and check the the files have been uploaded
- [ ] Click on close
- [ ] Wait (check Activity tab until step "Repository closed" is displayed)
- [ ] Click on release. The staging repository will disappear
Final step
- [ ] Check that the release is available in https://repo1.maven.org/maven2/org/matrix/android/matrix-android-sdk2/ (it can take a few minutes)
##### Release on GitHub

View file

@ -1,3 +1,59 @@
Changes in Element v1.4.26 (2022-06-30)
=======================================
Features ✨
----------
- Use UnifiedPush and allows user to have push without FCM. ([#3448](https://github.com/vector-im/element-android/issues/3448))
- Replace ffmpeg-kit with libopus and libopusenc. ([#6203](https://github.com/vector-im/element-android/issues/6203))
- Improve lock screen implementation. ([#6217](https://github.com/vector-im/element-android/issues/6217))
- Allow sharing text based content via android's share menu (eg .ics files) ([#6285](https://github.com/vector-im/element-android/issues/6285))
- Promote live location labs flag ([#6350](https://github.com/vector-im/element-android/issues/6350))
- [Location sharing] - Stop any active live before starting a new one ([#6364](https://github.com/vector-im/element-android/issues/6364))
- Expose pusher profile tag in advanced settings ([#6369](https://github.com/vector-im/element-android/issues/6369))
Bugfixes 🐛
----------
- Fixes concurrent modification crash when signing out or launching the app ([#5821](https://github.com/vector-im/element-android/issues/5821))
- Refactor - better naming, return native user id and not sip user id and create a dm with the native user instead of with the sip user. ([#6101](https://github.com/vector-im/element-android/issues/6101))
- Fixed /upgraderoom command not doing anything ([#6154](https://github.com/vector-im/element-android/issues/6154))
- Fixed crash when opening large images in the timeline ([#6290](https://github.com/vector-im/element-android/issues/6290))
- [Location sharing] Fix crash when starting/stopping a live when offline ([#6315](https://github.com/vector-im/element-android/issues/6315))
- Fix loop in timeline and simplify management of chunks and timeline events. ([#6318](https://github.com/vector-im/element-android/issues/6318))
- Update design and behaviour on widget permission bottom sheet ([#6326](https://github.com/vector-im/element-android/issues/6326))
- Fix | Some user verification requests couldn't be accepted/declined ([#6328](https://github.com/vector-im/element-android/issues/6328))
- [Location sharing] Fix stop of a live not possible from another device ([#6349](https://github.com/vector-im/element-android/issues/6349))
- Fix backslash escapes in formatted messages ([#6357](https://github.com/vector-im/element-android/issues/6357))
- Fixes wrong error message when signing in with wrong credentials ([#6371](https://github.com/vector-im/element-android/issues/6371))
- [Location Share] - Adding missing prefix "u=" for uncertainty in geo URI ([#6375](https://github.com/vector-im/element-android/issues/6375))
In development 🚧
----------------
- FTUE - Adds automatic homeserver selection when typing a full matrix id during registration or login ([#6162](https://github.com/vector-im/element-android/issues/6162))
Improved Documentation 📚
------------------------
- Update the PR process doc to come back to one reviewer with optional additional reviewers. ([#6396](https://github.com/vector-im/element-android/issues/6396))
SDK API changes ⚠️
------------------
- Group all location sharing related API into LocationSharingService ([#5864](https://github.com/vector-im/element-android/issues/5864))
- Add support for MSC2457 - opting in or out of logging out all devices when changing password ([#6191](https://github.com/vector-im/element-android/issues/6191))
- Create `QueryStateEventValue` to do query on `stateKey` for State Event. Also remove the default parameter values for those type. ([#6319](https://github.com/vector-im/element-android/issues/6319))
Other changes
-------------
- - Notify of the latest known location in LocationTracker to avoid multiple locations at start
- Debounce location updates
- Improve location providers access ([#5913](https://github.com/vector-im/element-android/issues/5913))
- Add unit tests for LiveLocationAggregationProcessor code ([#6155](https://github.com/vector-im/element-android/issues/6155))
- Making screenshots in bug reports opt in instead of opt out ([#6261](https://github.com/vector-im/element-android/issues/6261))
- Setup [Flipper](https://fbflipper.com/) ([#6300](https://github.com/vector-im/element-android/issues/6300))
- CreatePollViewModel unit tests ([#6320](https://github.com/vector-im/element-android/issues/6320))
- Fix flaky test in voice recording feature. ([#6329](https://github.com/vector-im/element-android/issues/6329))
- Poll view state unit tests ([#6366](https://github.com/vector-im/element-android/issues/6366))
- Let LoadRoomMembersTask insert by chunk to release db. ([#6394](https://github.com/vector-im/element-android/issues/6394))
Changes in Element v1.4.25 (2022-06-27)
=======================================

View file

@ -1 +0,0 @@
Use UnifiedPush and allows user to have push without FCM.

1
changelog.d/5284.wip Normal file
View file

@ -0,0 +1 @@
FTUE - Adds support for resetting the password during the FTUE onboarding journey

View file

@ -1 +0,0 @@
Fixes concurrent modification crash when signing out or launching the app

View file

@ -1 +0,0 @@
Group all location sharing related API into LocationSharingService

View file

@ -1,3 +0,0 @@
- Notify of the latest known location in LocationTracker to avoid multiple locations at start
- Debounce location updates
- Improve location providers access

View file

@ -1 +0,0 @@
Refactor - better naming, return native user id and not sip user id and create a dm with the native user instead of with the sip user.

View file

@ -1 +0,0 @@
Fixed /upgraderoom command not doing anything

View file

@ -1 +0,0 @@
Add unit tests for LiveLocationAggregationProcessor code

View file

@ -1 +0,0 @@
FTUE - Adds automatic homeserver selection when typing a full matrix id during registration or login

View file

@ -1 +0,0 @@
Add support for MSC2457 - opting in or out of logging out all devices when changing password

View file

@ -1 +0,0 @@
Replace ffmpeg-kit with libopus and libopusenc.

View file

@ -1 +0,0 @@
Improve lock screen implementation.

View file

@ -1 +0,0 @@
Making screenshots in bug reports opt in instead of opt out

View file

@ -1 +0,0 @@
Allow sharing text based content via android's share menu (eg .ics files)

1
changelog.d/6288.bugfix Normal file
View file

@ -0,0 +1 @@
Use stable endpoint for alias management instead of MSC2432. Contributed by Nico.

View file

@ -1 +0,0 @@
Fixed crash when opening large images in the timeline

View file

@ -1 +0,0 @@
Setup [Flipper](https://fbflipper.com/)

View file

@ -1 +0,0 @@
[Location sharing] Fix crash when starting/stopping a live when offline

View file

@ -1 +0,0 @@
Fix loop in timeline and simplify management of chunks and timeline events.

View file

@ -1 +0,0 @@
Create `QueryStateEventValue` to do query on `stateKey` for State Event. Also remove the default parameter values for those type.

View file

@ -1 +0,0 @@
CreatePollViewModel unit tests

View file

@ -1 +0,0 @@
Update design and behaviour on widget permission bottom sheet

View file

@ -1 +0,0 @@
Fix | Some user verification requests couldn't be accepted/declined

View file

@ -1 +0,0 @@
Fix flaky test in voice recording feature.

View file

@ -1 +0,0 @@
[Location sharing] Fix stop of a live not possible from another device

View file

@ -1 +0,0 @@
Promote live location labs flag

View file

@ -1 +0,0 @@
Fix backslash escapes in formatted messages

View file

@ -1 +0,0 @@
[Location sharing] - Stop any active live before starting a new one

View file

@ -1 +0,0 @@
Poll view state unit tests

View file

@ -1,2 +0,0 @@
Expose pusher profile tag in advanced settings

View file

@ -1 +0,0 @@
Fixes wrong error message when signing in with wrong credentials

View file

@ -1 +0,0 @@
[Location Share] - Adding missing prefix "u=" for uncertainty in geo URI

1
changelog.d/6389.misc Normal file
View file

@ -0,0 +1 @@
Replacing Epoxy annotation layout id references with getDefaultLayoutId

1
changelog.d/6392.misc Normal file
View file

@ -0,0 +1 @@
Ensure `RealmList<T>.clearWith()` extension is correctly used.

View file

@ -1 +0,0 @@
Let LoadRoomMembersTask insert by chunk to release db.

View file

@ -1 +0,0 @@
Update the PR process doc to come back to one reviewer with optional additional reviewers.

1
changelog.d/6413.feature Normal file
View file

@ -0,0 +1 @@
Show a loader if all the Room Members are not yet loaded.

1
changelog.d/6429.misc Normal file
View file

@ -0,0 +1 @@
Add `android:hasFragileUserData="true"` in the manifest

View file

@ -0,0 +1,2 @@
Hlavní změny v této verzi: Opravy různých chyb a vylepšení stability.
Úplný seznam změn: https://github.com/vector-im/element-android/releases

View file

@ -0,0 +1,2 @@
Hlavní změny v této verzi: Opravy různých chyb a vylepšení stability.
Úplný seznam změn: https://github.com/vector-im/element-android/releases

View file

@ -0,0 +1,2 @@
Hlavní změny v této verzi: Opravy různých chyb a vylepšení stability.
Úplný seznam změn: https://github.com/vector-im/element-android/releases

View file

@ -0,0 +1,2 @@
Main changes in this version: Use UnifiedPush and allows user to have push without FCM.
Full changelog: https://github.com/vector-im/element-android/releases

View file

@ -0,0 +1,2 @@
Põhilised muutused selles versioonis: erinevate vigade parandused ja stabiilsust edendavad kohendused.
Kogu ingliskeelne muudatuste logi: https://github.com/vector-im/element-android/releases

View file

@ -0,0 +1,2 @@
Põhilised muutused selles versioonis: erinevate vigade parandused ja stabiilsust edendavad kohendused.
Kogu ingliskeelne muudatuste logi: https://github.com/vector-im/element-android/releases

View file

@ -0,0 +1,2 @@
Põhilised muutused selles versioonis: erinevate vigade parandused ja stabiilsust edendavad kohendused.
Kogu ingliskeelne muudatuste logi: https://github.com/vector-im/element-android/releases

View file

@ -0,0 +1,2 @@
تغییرات عمده در این نگارش: رفع اشکال‌های مختلف و بهبودهای پایداری.
گزارش دگرگونی کامل: https://github.com/vector-im/element-android/releases

View file

@ -0,0 +1,2 @@
تغییرات عمده در این نگارش: رفع اشکال‌های مختلف و بهبودهای پایداری.
گزارش دگرگونی کامل: https://github.com/vector-im/element-android/releases

View file

@ -0,0 +1,2 @@
تغییرات عمده در این نگارش: رفع اشکال‌های مختلف و بهبودهای پایداری.
گزارش دگرگونی کامل: https://github.com/vector-im/element-android/releases

View file

@ -0,0 +1,2 @@
Principaux changements pour cette version : Plusieurs corrections de bogues et daméliorations de stabilité.
Intégralité des changements : https://github.com/vector-im/element-android/releases

View file

@ -0,0 +1,2 @@
Principaux changements pour cette version : Plusieurs corrections de bogues et daméliorations de stabilité.
Intégralité des changements : https://github.com/vector-im/element-android/releases

View file

@ -0,0 +1,2 @@
Principaux changements pour cette version : Plusieurs corrections de bogues et daméliorations de stabilité.
Intégralité des changements : https://github.com/vector-im/element-android/releases

View file

@ -0,0 +1,2 @@
Perubahan utama dalam versi ini: Banyak perbaikan kutu dan perbaikan stabilitas.
Catatan perubahan lanjutan: https://github.com/vector-im/element-android/releases

View file

@ -0,0 +1,2 @@
Perubahan utama dalam versi ini: Banyak perbaikan kutu dan perbaikan stabilitas.
Catatan perubahan lanjutan: https://github.com/vector-im/element-android/releases

View file

@ -0,0 +1,2 @@
Perubahan utama dalam versi ini: Banyak perbaikan kutu dan perbaikan stabilitas.
Catatan perubahan lanjutan: https://github.com/vector-im/element-android/releases

View file

@ -0,0 +1,2 @@
Modifiche principali in questa versione: varie correzioni di errori e miglioramenti della stabilità.
Cronologia completa: https://github.com/vector-im/element-android/releases

View file

@ -0,0 +1,2 @@
Modifiche principali in questa versione: varie correzioni di errori e miglioramenti della stabilità.
Cronologia completa: https://github.com/vector-im/element-android/releases

View file

@ -0,0 +1,2 @@
Modifiche principali in questa versione: varie correzioni di errori e miglioramenti della stabilità.
Cronologia completa: https://github.com/vector-im/element-android/releases

View file

@ -0,0 +1,2 @@
Principais mudanças nesta versão: Vários consertos de bugs e melhorias de estabilidade.
Changelog completo: https://github.com/vector-im/element-android/releases

View file

@ -0,0 +1,2 @@
Principais mudanças nesta versão: Vários consertos de bugs e melhorias de estabilidade.
Changelog completo: https://github.com/vector-im/element-android/releases

View file

@ -0,0 +1,2 @@
Principais mudanças nesta versão: Vários consertos de bugs e melhorias de estabilidade.
Changelog completo: https://github.com/vector-im/element-android/releases

View file

@ -0,0 +1,2 @@
Hlavné zmeny v tejto verzii: Rôzne opravy chýb a vylepšenia stability.
Úplný zoznam zmien: https://github.com/vector-im/element-android/releases

View file

@ -0,0 +1,2 @@
Hlavné zmeny v tejto verzii: Rôzne opravy chýb a vylepšenia stability.
Úplný zoznam zmien: https://github.com/vector-im/element-android/releases

View file

@ -0,0 +1,2 @@
Hlavné zmeny v tejto verzii: Rôzne opravy chýb a vylepšenia stability.
Úplný zoznam zmien: https://github.com/vector-im/element-android/releases

View file

@ -0,0 +1,2 @@
Huvudsakliga ändringar i den här versionen: Diverse buggfixar och stabilitetsförbättringar.
Full ändringslogg: https://github.com/vector-im/element-android/releases

View file

@ -0,0 +1,2 @@
Huvudsakliga ändringar i den här versionen: Diverse buggfixar och stabilitetsförbättringar.
Full ändringslogg: https://github.com/vector-im/element-android/releases

View file

@ -0,0 +1,2 @@
Huvudsakliga ändringar i den här versionen: Diverse buggfixar och stabilitetsförbättringar.
Full ändringslogg: https://github.com/vector-im/element-android/releases

View file

@ -1,2 +1,2 @@
Основні зміни в цій версії: Початкова реалізація тредів повідомлень. Повідомлення бульбашки.
Основні зміни в цій версії: Початкова реалізація гілок повідомлень. Повідомлення бульбашки.
Вичерпний перелік змін: https://github.com/vector-im/element-android/releases/tag/v1.4.0

View file

@ -1,2 +1,2 @@
Основні зміни в цій версії: Хронологія тредів працює наживо і швидше. Усунуто різні вади й поліпшено стабільність.
Основні зміни в цій версії: Хронологія гілок працює наживо і швидше. Усунуто різні вади й поліпшено стабільність.
Вичерпний перелік змін: https://github.com/vector-im/element-android/releases/tag/v1.4.6

View file

@ -1,2 +1,2 @@
Основні зміни в цій версії: Хронологія тредів працює наживо і швидше. Усунуто різні вади й поліпшено стабільність.
Основні зміни в цій версії: Хронологія гілок працює наживо і швидше. Усунуто різні вади й поліпшено стабільність.
Вичерпний перелік змін: https://github.com/vector-im/element-android/releases

View file

@ -0,0 +1,2 @@
Основні зміни в цій версії: Усунуто різні вади й поліпшено стабільність.
Вичерпний перелік змін: https://github.com/vector-im/element-android/releases

View file

@ -0,0 +1,2 @@
Основні зміни в цій версії: Усунуто різні вади й поліпшено стабільність.
Вичерпний перелік змін: https://github.com/vector-im/element-android/releases

View file

@ -0,0 +1,2 @@
Основні зміни в цій версії: Усунуто різні вади й поліпшено стабільність.
Вичерпний перелік змін: https://github.com/vector-im/element-android/releases

View file

@ -0,0 +1,2 @@
此版本中的主要變動:多個臭蟲修復與穩定性改善。
完整的變更紀錄https://github.com/vector-im/element-android/releases

View file

@ -0,0 +1,2 @@
此版本中的主要變動:多個臭蟲修復與穩定性改善。
完整的變更紀錄https://github.com/vector-im/element-android/releases

View file

@ -0,0 +1,2 @@
此版本中的主要變動:多個臭蟲修復與穩定性改善。
完整的變更紀錄https://github.com/vector-im/element-android/releases

View file

@ -2,7 +2,6 @@ apply plugin: 'com.android.library'
apply plugin: 'kotlin-android'
apply plugin: 'kotlin-parcelize'
apply plugin: 'kotlin-kapt'
apply plugin: 'com.jakewharton.butterknife'
buildscript {
repositories {
@ -15,9 +14,6 @@ buildscript {
url 'https://repo1.maven.org/maven2'
}
}
dependencies {
classpath 'com.jakewharton:butterknife-gradle-plugin:10.2.3'
}
}
android {

View file

@ -29,7 +29,7 @@ import com.airbnb.epoxy.EpoxyModelClass
import com.airbnb.epoxy.EpoxyModelWithHolder
import im.vector.lib.core.utils.epoxy.charsequence.EpoxyCharSequence
@EpoxyModelClass(layout = R2.layout.item_jv_base_value)
@EpoxyModelClass
internal abstract class ValueItem : EpoxyModelWithHolder<ValueItem.Holder>() {
@EpoxyAttribute
@ -44,6 +44,8 @@ internal abstract class ValueItem : EpoxyModelWithHolder<ValueItem.Holder>() {
@EpoxyAttribute(EpoxyAttribute.Option.DoNotHash)
var itemClickListener: View.OnClickListener? = null
override fun getDefaultLayout() = R.layout.item_jv_base_value
override fun bind(holder: Holder) {
super.bind(holder)
holder.textView.text = text?.charSequence

View file

@ -53,6 +53,13 @@ class FlowRoom(private val room: Room) {
}
}
fun liveAreAllMembersLoaded(): Flow<Boolean> {
return room.membershipService().areAllMembersLoadedLive().asFlow()
.startWith(room.coroutineDispatchers.io) {
room.membershipService().areAllMembersLoaded()
}
}
fun liveAnnotationSummary(eventId: String): Flow<Optional<EventAnnotationsSummary>> {
return room.relationService().getEventAnnotationsSummaryLive(eventId).asFlow()
.startWith(room.coroutineDispatchers.io) {

View file

@ -17,7 +17,7 @@ buildscript {
}
}
dependencies {
classpath "io.realm:realm-gradle-plugin:10.9.0"
classpath "io.realm:realm-gradle-plugin:10.11.0"
}
}
@ -60,7 +60,7 @@ android {
// that the app's state is completely cleared between tests.
testInstrumentationRunnerArguments clearPackageData: 'true'
buildConfigField "String", "SDK_VERSION", "\"1.4.26\""
buildConfigField "String", "SDK_VERSION", "\"1.4.28\""
buildConfigField "String", "GIT_SDK_REVISION", "\"${gitRevision()}\""
buildConfigField "String", "GIT_SDK_REVISION_UNIX_DATE", "\"${gitRevisionUnixDate()}\""

View file

@ -162,7 +162,7 @@ enum class ApiPath(val path: String, val method: String) {
KICK_USER(NetworkConstants.URI_API_PREFIX_PATH_R0 + "rooms/{roomId}/kick", "POST"),
REDACT_EVENT(NetworkConstants.URI_API_PREFIX_PATH_R0 + "rooms/{roomId}/redact/{eventId}/{txnId}", "PUT"),
REPORT_CONTENT(NetworkConstants.URI_API_PREFIX_PATH_R0 + "rooms/{roomId}/report/{eventId}", "POST"),
GET_ALIASES(NetworkConstants.URI_API_PREFIX_PATH_UNSTABLE + "org.matrix.msc2432/rooms/{roomId}/aliases", "GET"),
GET_ALIASES(NetworkConstants.URI_API_PREFIX_PATH_R0 + "rooms/{roomId}/aliases", "GET"),
SEND_TYPING_STATE(NetworkConstants.URI_API_PREFIX_PATH_R0 + "rooms/{roomId}/typing/{userId}", "PUT"),
PUT_TAG(NetworkConstants.URI_API_PREFIX_PATH_R0 + "user/{userId}/rooms/{roomId}/tags/{tag}", "PUT"),
DELETE_TAG(NetworkConstants.URI_API_PREFIX_PATH_R0 + "user/{userId}/rooms/{roomId}/tags/{tag}", "DELETE"),

View file

@ -30,6 +30,20 @@ interface MembershipService {
*/
suspend fun loadRoomMembersIfNeeded()
/**
* All the room members can be not loaded, for instance after an initial sync.
* All the members will be loaded when calling [loadRoomMembersIfNeeded], or when sending an encrypted
* event to the room.
* The fun let the app know if all the members have been loaded for this room.
* @return true if all the members are loaded, or false elsewhere.
*/
suspend fun areAllMembersLoaded(): Boolean
/**
* Live version for [areAllMembersLoaded].
*/
fun areAllMembersLoadedLive(): LiveData<Boolean>
/**
* Return the roomMember with userId or null.
* @param userId the userId param to look for

View file

@ -20,6 +20,7 @@ import io.realm.RealmList
import io.realm.RealmObject
import io.realm.RealmObjectSchema
import org.matrix.android.sdk.internal.database.model.HomeServerCapabilitiesEntityFields
import org.matrix.android.sdk.internal.util.fatalError
internal fun RealmObject.assertIsManaged() {
check(isManaged) { "${javaClass.simpleName} entity should be managed to use this function" }
@ -27,10 +28,19 @@ internal fun RealmObject.assertIsManaged() {
/**
* Clear a RealmList by deleting all its items calling the provided lambda.
* The lambda is supposed to delete the item, which means that after this operation, the list will be empty.
*/
internal fun <T> RealmList<T>.clearWith(delete: (T) -> Unit) {
while (!isEmpty()) {
first()?.let { delete.invoke(it) }
map { item ->
// Create a lambda for all items of the list
{ delete(item) }
}.forEach { lambda ->
// Then invoke all the lambda
lambda.invoke()
}
if (isNotEmpty()) {
fatalError("`clearWith` MUST delete all elements of the RealmList")
}
}

View file

@ -377,7 +377,7 @@ internal interface RoomAPI {
* Get a list of aliases maintained by the local server for the given room.
* Ref: https://matrix.org/docs/spec/client_server/r0.6.1#get-matrix-client-r0-rooms-roomid-aliases
*/
@GET(NetworkConstants.URI_API_PREFIX_PATH_UNSTABLE + "org.matrix.msc2432/rooms/{roomId}/aliases")
@GET(NetworkConstants.URI_API_PREFIX_PATH_R0 + "rooms/{roomId}/aliases")
suspend fun getAliases(@Path("roomId") roomId: String): GetAliasesResponse
/**

View file

@ -0,0 +1,55 @@
/*
* Copyright 2022 The Matrix.org Foundation C.I.C.
*
* 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 org.matrix.android.sdk.internal.session.room
import androidx.lifecycle.LiveData
import androidx.lifecycle.Transformations
import com.zhuinden.monarchy.Monarchy
import io.realm.Realm
import org.matrix.android.sdk.api.extensions.orFalse
import org.matrix.android.sdk.internal.database.model.RoomEntity
import org.matrix.android.sdk.internal.database.model.RoomMembersLoadStatusType
import org.matrix.android.sdk.internal.database.query.where
import org.matrix.android.sdk.internal.di.SessionDatabase
import javax.inject.Inject
internal class RoomDataSource @Inject constructor(
@SessionDatabase private val monarchy: Monarchy,
) {
fun getRoomMembersLoadStatus(roomId: String): RoomMembersLoadStatusType {
var result: RoomMembersLoadStatusType?
Realm.getInstance(monarchy.realmConfiguration).use {
result = RoomEntity.where(it, roomId).findFirst()?.membersLoadStatus
}
return result ?: RoomMembersLoadStatusType.NONE
}
fun getRoomMembersLoadStatusLive(roomId: String): LiveData<Boolean> {
val liveData = monarchy.findAllMappedWithChanges(
{
RoomEntity.where(it, roomId)
},
{
it.membersLoadStatus == RoomMembersLoadStatusType.LOADED
}
)
return Transformations.map(liveData) { results ->
results.firstOrNull().orFalse()
}
}
}

View file

@ -34,7 +34,6 @@ internal class DefaultGetRoomLocalAliasesTask @Inject constructor(
) : GetRoomLocalAliasesTask {
override suspend fun execute(params: GetRoomLocalAliasesTask.Params): List<String> {
// We do not check for "org.matrix.msc2432", so the API may be missing
val response = executeRequest(globalErrorReceiver) {
roomAPI.getAliases(roomId = params.roomId)
}

View file

@ -31,10 +31,12 @@ import org.matrix.android.sdk.api.session.room.model.RoomMemberSummary
import org.matrix.android.sdk.internal.database.mapper.asDomain
import org.matrix.android.sdk.internal.database.model.RoomMemberSummaryEntity
import org.matrix.android.sdk.internal.database.model.RoomMemberSummaryEntityFields
import org.matrix.android.sdk.internal.database.model.RoomMembersLoadStatusType
import org.matrix.android.sdk.internal.di.SessionDatabase
import org.matrix.android.sdk.internal.di.UserId
import org.matrix.android.sdk.internal.query.QueryStringValueProcessor
import org.matrix.android.sdk.internal.query.process
import org.matrix.android.sdk.internal.session.room.RoomDataSource
import org.matrix.android.sdk.internal.session.room.membership.admin.MembershipAdminTask
import org.matrix.android.sdk.internal.session.room.membership.joining.InviteTask
import org.matrix.android.sdk.internal.session.room.membership.threepid.InviteThreePidTask
@ -47,6 +49,7 @@ internal class DefaultMembershipService @AssistedInject constructor(
private val inviteTask: InviteTask,
private val inviteThreePidTask: InviteThreePidTask,
private val membershipAdminTask: MembershipAdminTask,
private val roomDataSource: RoomDataSource,
@UserId
private val userId: String,
private val queryStringValueProcessor: QueryStringValueProcessor
@ -62,6 +65,15 @@ internal class DefaultMembershipService @AssistedInject constructor(
loadRoomMembersTask.execute(params)
}
override suspend fun areAllMembersLoaded(): Boolean {
val status = roomDataSource.getRoomMembersLoadStatus(roomId)
return status == RoomMembersLoadStatusType.LOADED
}
override fun areAllMembersLoadedLive(): LiveData<Boolean> {
return roomDataSource.getRoomMembersLoadStatusLive(roomId)
}
override fun getRoomMember(userId: String): RoomMemberSummary? {
val roomMemberEntity = monarchy.fetchCopied {
RoomMemberHelper(it, roomId).getLastRoomMember(userId)

View file

@ -17,7 +17,6 @@
package org.matrix.android.sdk.internal.session.room.membership
import com.zhuinden.monarchy.Monarchy
import io.realm.Realm
import io.realm.kotlin.createObject
import kotlinx.coroutines.TimeoutCancellationException
import org.matrix.android.sdk.api.session.room.model.Membership
@ -38,6 +37,7 @@ import org.matrix.android.sdk.internal.di.SessionDatabase
import org.matrix.android.sdk.internal.network.GlobalErrorReceiver
import org.matrix.android.sdk.internal.network.executeRequest
import org.matrix.android.sdk.internal.session.room.RoomAPI
import org.matrix.android.sdk.internal.session.room.RoomDataSource
import org.matrix.android.sdk.internal.session.room.summary.RoomSummaryUpdater
import org.matrix.android.sdk.internal.session.sync.SyncTokenStore
import org.matrix.android.sdk.internal.task.Task
@ -58,6 +58,7 @@ internal interface LoadRoomMembersTask : Task<LoadRoomMembersTask.Params, Unit>
internal class DefaultLoadRoomMembersTask @Inject constructor(
private val roomAPI: RoomAPI,
@SessionDatabase private val monarchy: Monarchy,
private val roomDataSource: RoomDataSource,
private val syncTokenStore: SyncTokenStore,
private val roomSummaryUpdater: RoomSummaryUpdater,
private val roomMemberEventHandler: RoomMemberEventHandler,
@ -68,7 +69,7 @@ internal class DefaultLoadRoomMembersTask @Inject constructor(
) : LoadRoomMembersTask {
override suspend fun execute(params: LoadRoomMembersTask.Params) {
when (getRoomMembersLoadStatus(params.roomId)) {
when (roomDataSource.getRoomMembersLoadStatus(params.roomId)) {
RoomMembersLoadStatusType.NONE -> doRequest(params)
RoomMembersLoadStatusType.LOADING -> waitPreviousRequestToFinish(params)
RoomMembersLoadStatusType.LOADED -> Unit
@ -142,14 +143,6 @@ internal class DefaultLoadRoomMembersTask @Inject constructor(
}
}
private fun getRoomMembersLoadStatus(roomId: String): RoomMembersLoadStatusType {
var result: RoomMembersLoadStatusType?
Realm.getInstance(monarchy.realmConfiguration).use {
result = RoomEntity.where(it, roomId).findFirst()?.membersLoadStatus
}
return result ?: RoomMembersLoadStatusType.NONE
}
private suspend fun setRoomMembersLoadStatus(roomId: String, status: RoomMembersLoadStatusType) {
monarchy.awaitTransaction { realm ->
val roomEntity = RoomEntity.where(realm, roomId).findFirst() ?: realm.createObject(roomId)

View file

@ -0,0 +1,32 @@
/*
* Copyright (c) 2022 The Matrix.org Foundation C.I.C.
*
* 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 org.matrix.android.sdk.internal.util
import org.matrix.android.sdk.BuildConfig
import timber.log.Timber
/**
* Throws in debug, only log in production.
* As this method does not always throw, next statement should be a return.
*/
internal fun fatalError(message: String) {
if (BuildConfig.DEBUG) {
error(message)
} else {
Timber.e(message)
}
}

View file

@ -35,7 +35,7 @@ ext.versionMinor = 4
// Note: even values are reserved for regular release, odd values for hotfix release.
// When creating a hotfix, you should decrease the value, since the current value
// is the value for the next regular release.
ext.versionPatch = 26
ext.versionPatch = 28
static def getGitTimestamp() {
def cmd = 'git show -s --format=%ct'

View file

@ -23,11 +23,12 @@ import android.widget.Spinner
import android.widget.TextView
import com.airbnb.epoxy.EpoxyAttribute
import com.airbnb.epoxy.EpoxyModelClass
import im.vector.app.R
import im.vector.app.core.epoxy.VectorEpoxyHolder
import im.vector.app.core.epoxy.VectorEpoxyModel
@EpoxyModelClass(layout = im.vector.app.R.layout.item_feature)
abstract class BooleanFeatureItem : VectorEpoxyModel<BooleanFeatureItem.Holder>() {
@EpoxyModelClass
abstract class BooleanFeatureItem : VectorEpoxyModel<BooleanFeatureItem.Holder>(R.layout.item_feature) {
@EpoxyAttribute
lateinit var feature: Feature.BooleanFeature

View file

@ -23,11 +23,12 @@ import android.widget.Spinner
import android.widget.TextView
import com.airbnb.epoxy.EpoxyAttribute
import com.airbnb.epoxy.EpoxyModelClass
import im.vector.app.R
import im.vector.app.core.epoxy.VectorEpoxyHolder
import im.vector.app.core.epoxy.VectorEpoxyModel
@EpoxyModelClass(layout = im.vector.app.R.layout.item_feature)
abstract class EnumFeatureItem : VectorEpoxyModel<EnumFeatureItem.Holder>() {
@EpoxyModelClass
abstract class EnumFeatureItem : VectorEpoxyModel<EnumFeatureItem.Holder>(R.layout.item_feature) {
@EpoxyAttribute
lateinit var feature: Feature.EnumFeature<*>

View file

@ -21,14 +21,15 @@ import android.widget.TextView
import androidx.core.content.ContextCompat
import com.airbnb.epoxy.EpoxyAttribute
import com.airbnb.epoxy.EpoxyModelClass
import im.vector.app.R
import im.vector.app.core.epoxy.VectorEpoxyHolder
import im.vector.app.core.epoxy.VectorEpoxyModel
import me.gujun.android.span.image
import me.gujun.android.span.span
import org.matrix.android.sdk.api.session.crypto.verification.EmojiRepresentation
@EpoxyModelClass(layout = im.vector.app.R.layout.item_sas_emoji)
abstract class SasEmojiItem : VectorEpoxyModel<SasEmojiItem.Holder>() {
@EpoxyModelClass
abstract class SasEmojiItem : VectorEpoxyModel<SasEmojiItem.Holder>(R.layout.item_sas_emoji) {
@EpoxyAttribute
var index: Int = 0
@ -51,9 +52,9 @@ abstract class SasEmojiItem : VectorEpoxyModel<SasEmojiItem.Holder>() {
}
class Holder : VectorEpoxyHolder() {
val indexView by bind<TextView>(im.vector.app.R.id.sas_emoji_index)
val emojiView by bind<TextView>(im.vector.app.R.id.sas_emoji)
val textView by bind<TextView>(im.vector.app.R.id.sas_emoji_text)
val idView by bind<TextView>(im.vector.app.R.id.sas_emoji_text_id)
val indexView by bind<TextView>(R.id.sas_emoji_index)
val emojiView by bind<TextView>(R.id.sas_emoji)
val textView by bind<TextView>(R.id.sas_emoji_text)
val idView by bind<TextView>(R.id.sas_emoji_text_id)
}
}

View file

@ -77,6 +77,7 @@
<application
android:name=".VectorApplication"
android:allowBackup="false"
android:hasFragileUserData="true"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:networkSecurityConfig="@xml/network_security_config"
@ -85,6 +86,7 @@
android:supportsRtl="true"
android:taskAffinity="${applicationId}.${appTaskAffinitySuffix}"
android:theme="@style/Theme.Vector.Light"
tools:ignore="UnusedAttribute"
tools:replace="android:allowBackup">
<!-- No limit for screen ratio: avoid black strips -->
@ -413,9 +415,9 @@
<!-- UnifiedPush -->
<receiver
android:exported="true"
android:name=".core.pushers.VectorMessagingReceiver"
android:enabled="true"
android:name=".core.pushers.VectorMessagingReceiver">
android:exported="true">
<intent-filter>
<action android:name="org.unifiedpush.android.connector.MESSAGE" />
<action android:name="org.unifiedpush.android.connector.UNREGISTERED" />

View file

@ -18,7 +18,7 @@ package im.vector.app.core.epoxy
import com.airbnb.epoxy.EpoxyModelClass
import im.vector.app.R
@EpoxyModelClass(layout = R.layout.item_divider_on_surface)
abstract class BottomSheetDividerItem : VectorEpoxyModel<BottomSheetDividerItem.Holder>() {
@EpoxyModelClass
abstract class BottomSheetDividerItem : VectorEpoxyModel<BottomSheetDividerItem.Holder>(R.layout.item_divider_on_surface) {
class Holder : VectorEpoxyHolder()
}

View file

@ -22,8 +22,8 @@ import com.airbnb.epoxy.EpoxyModelClass
import com.google.android.material.checkbox.MaterialCheckBox
import im.vector.app.R
@EpoxyModelClass(layout = R.layout.item_checkbox)
abstract class CheckBoxItem : VectorEpoxyModel<CheckBoxItem.Holder>() {
@EpoxyModelClass
abstract class CheckBoxItem : VectorEpoxyModel<CheckBoxItem.Holder>(R.layout.item_checkbox) {
@EpoxyAttribute
var checked: Boolean = false

View file

@ -18,7 +18,7 @@ package im.vector.app.core.epoxy
import com.airbnb.epoxy.EpoxyModelClass
import im.vector.app.R
@EpoxyModelClass(layout = R.layout.item_divider)
abstract class DividerItem : VectorEpoxyModel<DividerItem.Holder>() {
@EpoxyModelClass
abstract class DividerItem : VectorEpoxyModel<DividerItem.Holder>(R.layout.item_divider) {
class Holder : VectorEpoxyHolder()
}

View file

@ -23,8 +23,8 @@ import com.airbnb.epoxy.EpoxyAttribute
import com.airbnb.epoxy.EpoxyModelClass
import im.vector.app.R
@EpoxyModelClass(layout = R.layout.item_error_retry)
abstract class ErrorWithRetryItem : VectorEpoxyModel<ErrorWithRetryItem.Holder>() {
@EpoxyModelClass
abstract class ErrorWithRetryItem : VectorEpoxyModel<ErrorWithRetryItem.Holder>(R.layout.item_error_retry) {
@EpoxyAttribute
var text: String? = null

Some files were not shown because too many files have changed in this diff Show more