mirror of
https://github.com/element-hq/element-android
synced 2024-11-28 05:31:21 +03:00
Merge branch 'develop' into feature/stabilization_2
This commit is contained in:
commit
d9c007d017
18 changed files with 122 additions and 75 deletions
12
CHANGES.md
12
CHANGES.md
|
@ -11,7 +11,8 @@ Other changes:
|
|||
-
|
||||
|
||||
Bugfix 🐛:
|
||||
-
|
||||
- Ask for permission before opening the camera (#934)
|
||||
- Encrypt for invited users by default, if the room state allows it (#803)
|
||||
|
||||
Translations 🗣:
|
||||
-
|
||||
|
@ -19,10 +20,17 @@ Translations 🗣:
|
|||
Build 🧱:
|
||||
-
|
||||
|
||||
Changes in RiotX 0.14.3 (2020-02-03)
|
||||
===================================================
|
||||
|
||||
Bugfix 🐛:
|
||||
- Fix Exception in DeviceListManager
|
||||
|
||||
Changes in RiotX 0.14.2 (2020-02-02)
|
||||
===================================================
|
||||
|
||||
Fix RiotX not starting issue
|
||||
Bugfix 🐛:
|
||||
- Fix RiotX not starting issue
|
||||
|
||||
Changes in RiotX 0.14.1 (2020-02-02)
|
||||
===================================================
|
||||
|
|
|
@ -74,7 +74,7 @@ class CryptoTestHelper(val mTestHelper: CommonTestHelper) {
|
|||
val room = aliceSession.getRoom(roomId!!)!!
|
||||
|
||||
val lock2 = CountDownLatch(1)
|
||||
room.enableEncryptionWithAlgorithm(MXCRYPTO_ALGORITHM_MEGOLM, object : TestMatrixCallback<Unit>(lock2) {})
|
||||
room.enableEncryption(callback = TestMatrixCallback(lock2))
|
||||
mTestHelper.await(lock2)
|
||||
|
||||
return CryptoTestData(aliceSession, roomId!!)
|
||||
|
|
|
@ -23,6 +23,7 @@ import androidx.work.WorkManager
|
|||
import com.zhuinden.monarchy.Monarchy
|
||||
import im.vector.matrix.android.BuildConfig
|
||||
import im.vector.matrix.android.api.auth.AuthenticationService
|
||||
import im.vector.matrix.android.api.crypto.MXCryptoConfig
|
||||
import im.vector.matrix.android.internal.SessionManager
|
||||
import im.vector.matrix.android.internal.crypto.attachments.ElementToDecrypt
|
||||
import im.vector.matrix.android.internal.crypto.attachments.MXEncryptedAttachments
|
||||
|
@ -35,7 +36,8 @@ import java.util.concurrent.atomic.AtomicBoolean
|
|||
import javax.inject.Inject
|
||||
|
||||
data class MatrixConfiguration(
|
||||
val applicationFlavor: String = "Default-application-flavor"
|
||||
val applicationFlavor: String = "Default-application-flavor",
|
||||
val cryptoConfig: MXCryptoConfig = MXCryptoConfig()
|
||||
) {
|
||||
|
||||
interface Provider {
|
||||
|
@ -57,12 +59,11 @@ class Matrix private constructor(context: Context, matrixConfiguration: MatrixCo
|
|||
|
||||
init {
|
||||
Monarchy.init(context)
|
||||
DaggerMatrixComponent.factory().create(context).inject(this)
|
||||
DaggerMatrixComponent.factory().create(context, matrixConfiguration).inject(this)
|
||||
if (context.applicationContext !is Configuration.Provider) {
|
||||
WorkManager.initialize(context, Configuration.Builder().build())
|
||||
}
|
||||
ProcessLifecycleOwner.get().lifecycle.addObserver(backgroundDetectionObserver)
|
||||
userAgentHolder.setApplicationFlavor(matrixConfiguration.applicationFlavor)
|
||||
}
|
||||
|
||||
fun getUserAgent() = userAgentHolder.userAgent
|
||||
|
|
|
@ -14,14 +14,14 @@
|
|||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package im.vector.matrix.android.internal.crypto
|
||||
package im.vector.matrix.android.api.crypto
|
||||
|
||||
/**
|
||||
* Class to define the parameters used to customize or configure the end-to-end crypto.
|
||||
*/
|
||||
data class MXCryptoConfig(
|
||||
// Tell whether the encryption of the event content is enabled for the invited members.
|
||||
// By default, we encrypt messages only for the joined members.
|
||||
// The encryption for the invited members will be blocked if the history visibility is "joined".
|
||||
var enableEncryptionForInvitedMembers: Boolean = false
|
||||
// SDK clients can disable this by settings it to false.
|
||||
// Note that the encryption for the invited members will be blocked if the history visibility is "joined".
|
||||
var enableEncryptionForInvitedMembers: Boolean = true
|
||||
)
|
|
@ -17,6 +17,7 @@
|
|||
package im.vector.matrix.android.api.session.room.crypto
|
||||
|
||||
import im.vector.matrix.android.api.MatrixCallback
|
||||
import im.vector.matrix.android.internal.crypto.MXCRYPTO_ALGORITHM_MEGOLM
|
||||
|
||||
interface RoomCryptoService {
|
||||
|
||||
|
@ -26,5 +27,9 @@ interface RoomCryptoService {
|
|||
|
||||
fun shouldEncryptForInvitedMembers(): Boolean
|
||||
|
||||
fun enableEncryptionWithAlgorithm(algorithm: String, callback: MatrixCallback<Unit>)
|
||||
/**
|
||||
* Enable encryption of the room
|
||||
*/
|
||||
fun enableEncryption(algorithm: String = MXCRYPTO_ALGORITHM_MEGOLM,
|
||||
callback: MatrixCallback<Unit>)
|
||||
}
|
||||
|
|
|
@ -18,9 +18,28 @@ package im.vector.matrix.android.api.session.room.model
|
|||
|
||||
import com.squareup.moshi.Json
|
||||
|
||||
/**
|
||||
* Ref: https://matrix.org/docs/spec/client_server/latest#room-history-visibility
|
||||
*/
|
||||
enum class RoomHistoryVisibility {
|
||||
/**
|
||||
* All events while this is the m.room.history_visibility value may be shared by any
|
||||
* participating homeserver with anyone, regardless of whether they have ever joined the room.
|
||||
*/
|
||||
@Json(name = "world_readable") WORLD_READABLE,
|
||||
/**
|
||||
* Previous events are always accessible to newly joined members. All events in the
|
||||
* room are accessible, even those sent when the member was not a part of the room.
|
||||
*/
|
||||
@Json(name = "shared") SHARED,
|
||||
/**
|
||||
* Events are accessible to newly joined members from the point they were invited onwards.
|
||||
* Events stop being accessible when the member's state changes to something other than invite or join.
|
||||
*/
|
||||
@Json(name = "invited") INVITED,
|
||||
@Json(name = "joined") JOINED,
|
||||
@Json(name = "world_readable") WORLD_READABLE
|
||||
/**
|
||||
* Events are accessible to newly joined members from the point they joined the room onwards.
|
||||
* Events stop being accessible when the member's state changes to something other than join.
|
||||
*/
|
||||
@Json(name = "joined") JOINED
|
||||
}
|
||||
|
|
|
@ -28,11 +28,6 @@ interface StateService {
|
|||
*/
|
||||
fun updateTopic(topic: String, callback: MatrixCallback<Unit>)
|
||||
|
||||
/**
|
||||
* Enable encryption of the room
|
||||
*/
|
||||
fun enableEncryption(algorithm: String, callback: MatrixCallback<Unit>)
|
||||
|
||||
fun getStateEvent(eventType: String, stateKey: String): Event?
|
||||
|
||||
fun getStateEventLive(eventType: String, stateKey: String): LiveData<Optional<Event>>
|
||||
|
|
|
@ -159,13 +159,6 @@ internal abstract class CryptoModule {
|
|||
fun providesRoomKeysAPI(retrofit: Retrofit): RoomKeysApi {
|
||||
return retrofit.create(RoomKeysApi::class.java)
|
||||
}
|
||||
|
||||
@JvmStatic
|
||||
@Provides
|
||||
@SessionScope
|
||||
fun providesCryptoConfig(): MXCryptoConfig {
|
||||
return MXCryptoConfig()
|
||||
}
|
||||
}
|
||||
|
||||
@Binds
|
||||
|
|
|
@ -28,6 +28,7 @@ import dagger.Lazy
|
|||
import im.vector.matrix.android.api.MatrixCallback
|
||||
import im.vector.matrix.android.api.NoOpMatrixCallback
|
||||
import im.vector.matrix.android.api.auth.data.Credentials
|
||||
import im.vector.matrix.android.api.crypto.MXCryptoConfig
|
||||
import im.vector.matrix.android.api.failure.Failure
|
||||
import im.vector.matrix.android.api.listeners.ProgressListener
|
||||
import im.vector.matrix.android.api.session.crypto.CryptoService
|
||||
|
@ -117,7 +118,7 @@ internal class DefaultCryptoService @Inject constructor(
|
|||
// Olm device
|
||||
private val olmDevice: MXOlmDevice,
|
||||
// Set of parameters used to configure/customize the end-to-end crypto.
|
||||
private val cryptoConfig: MXCryptoConfig = MXCryptoConfig(),
|
||||
private val mxCryptoConfig: MXCryptoConfig,
|
||||
// Device list manager
|
||||
private val deviceListManager: DeviceListManager,
|
||||
// The key backup service.
|
||||
|
@ -400,6 +401,7 @@ internal class DefaultCryptoService @Inject constructor(
|
|||
null
|
||||
}
|
||||
}
|
||||
|
||||
override fun getCryptoDeviceInfo(userId: String): List<CryptoDeviceInfo> {
|
||||
return cryptoStore.getUserDevices(userId)?.map { it.value } ?: emptyList()
|
||||
}
|
||||
|
@ -546,8 +548,8 @@ internal class DefaultCryptoService @Inject constructor(
|
|||
return cryptoStore.getUserDevices(userId)?.values?.toMutableList() ?: ArrayList()
|
||||
}
|
||||
|
||||
fun isEncryptionEnabledForInvitedUser(): Boolean {
|
||||
return cryptoConfig.enableEncryptionForInvitedMembers
|
||||
private fun isEncryptionEnabledForInvitedUser(): Boolean {
|
||||
return mxCryptoConfig.enableEncryptionForInvitedMembers
|
||||
}
|
||||
|
||||
override fun getEncryptionAlgorithm(roomId: String): String? {
|
||||
|
@ -780,7 +782,7 @@ internal class DefaultCryptoService @Inject constructor(
|
|||
deviceListManager.startTrackingDeviceList(listOf(userId))
|
||||
} else if (membership == Membership.INVITE
|
||||
&& shouldEncryptForInvitedMembers(roomId)
|
||||
&& cryptoConfig.enableEncryptionForInvitedMembers) {
|
||||
&& isEncryptionEnabledForInvitedUser()) {
|
||||
// track the deviceList for this invited user.
|
||||
// Caution: there's a big edge case here in that federated servers do not
|
||||
// know what other servers are in the room at the time they've been invited.
|
||||
|
|
|
@ -22,6 +22,7 @@ import com.squareup.moshi.Moshi
|
|||
import dagger.BindsInstance
|
||||
import dagger.Component
|
||||
import im.vector.matrix.android.api.Matrix
|
||||
import im.vector.matrix.android.api.MatrixConfiguration
|
||||
import im.vector.matrix.android.api.auth.AuthenticationService
|
||||
import im.vector.matrix.android.internal.SessionManager
|
||||
import im.vector.matrix.android.internal.auth.AuthModule
|
||||
|
@ -47,6 +48,8 @@ internal interface MatrixComponent {
|
|||
|
||||
fun context(): Context
|
||||
|
||||
fun matrixConfiguration(): MatrixConfiguration
|
||||
|
||||
fun resources(): Resources
|
||||
|
||||
fun olmManager(): OlmManager
|
||||
|
@ -63,6 +66,7 @@ internal interface MatrixComponent {
|
|||
|
||||
@Component.Factory
|
||||
interface Factory {
|
||||
fun create(@BindsInstance context: Context): MatrixComponent
|
||||
fun create(@BindsInstance context: Context,
|
||||
@BindsInstance matrixConfiguration: MatrixConfiguration): MatrixComponent
|
||||
}
|
||||
}
|
||||
|
|
|
@ -18,18 +18,20 @@ package im.vector.matrix.android.internal.network
|
|||
|
||||
import android.content.Context
|
||||
import im.vector.matrix.android.BuildConfig
|
||||
import im.vector.matrix.android.api.MatrixConfiguration
|
||||
import im.vector.matrix.android.internal.di.MatrixScope
|
||||
import timber.log.Timber
|
||||
import javax.inject.Inject
|
||||
|
||||
@MatrixScope
|
||||
internal class UserAgentHolder @Inject constructor(private val context: Context) {
|
||||
internal class UserAgentHolder @Inject constructor(private val context: Context,
|
||||
matrixConfiguration: MatrixConfiguration) {
|
||||
|
||||
var userAgent: String = ""
|
||||
private set
|
||||
|
||||
init {
|
||||
setApplicationFlavor("NoFlavor")
|
||||
setApplicationFlavor(matrixConfiguration.applicationFlavor)
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -38,7 +40,7 @@ internal class UserAgentHolder @Inject constructor(private val context: Context)
|
|||
*
|
||||
* @param flavorDescription the flavor description
|
||||
*/
|
||||
fun setApplicationFlavor(flavorDescription: String) {
|
||||
private fun setApplicationFlavor(flavorDescription: String) {
|
||||
var appName = ""
|
||||
var appVersion = ""
|
||||
|
||||
|
|
|
@ -35,7 +35,15 @@ import im.vector.matrix.android.api.session.securestorage.SecureStorageService
|
|||
import im.vector.matrix.android.internal.crypto.verification.VerificationMessageLiveObserver
|
||||
import im.vector.matrix.android.internal.database.LiveEntityObserver
|
||||
import im.vector.matrix.android.internal.database.SessionRealmConfigurationFactory
|
||||
import im.vector.matrix.android.internal.di.*
|
||||
import im.vector.matrix.android.internal.di.Authenticated
|
||||
import im.vector.matrix.android.internal.di.DeviceId
|
||||
import im.vector.matrix.android.internal.di.SessionCacheDirectory
|
||||
import im.vector.matrix.android.internal.di.SessionDatabase
|
||||
import im.vector.matrix.android.internal.di.SessionFilesDirectory
|
||||
import im.vector.matrix.android.internal.di.SessionId
|
||||
import im.vector.matrix.android.internal.di.Unauthenticated
|
||||
import im.vector.matrix.android.internal.di.UserId
|
||||
import im.vector.matrix.android.internal.di.UserMd5
|
||||
import im.vector.matrix.android.internal.network.AccessTokenInterceptor
|
||||
import im.vector.matrix.android.internal.network.DefaultNetworkConnectivityChecker
|
||||
import im.vector.matrix.android.internal.network.FallbackNetworkCallbackStrategy
|
||||
|
|
|
@ -21,6 +21,7 @@ import androidx.lifecycle.Transformations
|
|||
import com.zhuinden.monarchy.Monarchy
|
||||
import im.vector.matrix.android.api.MatrixCallback
|
||||
import im.vector.matrix.android.api.session.crypto.CryptoService
|
||||
import im.vector.matrix.android.api.session.events.model.EventType
|
||||
import im.vector.matrix.android.api.session.room.Room
|
||||
import im.vector.matrix.android.api.session.room.members.MembershipService
|
||||
import im.vector.matrix.android.api.session.room.model.RoomSummary
|
||||
|
@ -35,10 +36,15 @@ import im.vector.matrix.android.api.session.room.timeline.TimelineService
|
|||
import im.vector.matrix.android.api.session.room.typing.TypingService
|
||||
import im.vector.matrix.android.api.util.Optional
|
||||
import im.vector.matrix.android.api.util.toOptional
|
||||
import im.vector.matrix.android.internal.crypto.MXCRYPTO_ALGORITHM_MEGOLM
|
||||
import im.vector.matrix.android.internal.database.mapper.RoomSummaryMapper
|
||||
import im.vector.matrix.android.internal.database.model.RoomSummaryEntity
|
||||
import im.vector.matrix.android.internal.database.model.RoomSummaryEntityFields
|
||||
import im.vector.matrix.android.internal.database.query.where
|
||||
import im.vector.matrix.android.internal.session.room.state.SendStateTask
|
||||
import im.vector.matrix.android.internal.task.TaskExecutor
|
||||
import im.vector.matrix.android.internal.task.configureWith
|
||||
import java.security.InvalidParameterException
|
||||
import javax.inject.Inject
|
||||
|
||||
internal class DefaultRoom @Inject constructor(override val roomId: String,
|
||||
|
@ -54,7 +60,9 @@ internal class DefaultRoom @Inject constructor(override val roomId: String,
|
|||
private val cryptoService: CryptoService,
|
||||
private val relationService: RelationService,
|
||||
private val roomMembersService: MembershipService,
|
||||
private val roomPushRuleService: RoomPushRuleService) :
|
||||
private val roomPushRuleService: RoomPushRuleService,
|
||||
private val taskExecutor: TaskExecutor,
|
||||
private val sendStateTask: SendStateTask) :
|
||||
Room,
|
||||
TimelineService by timelineService,
|
||||
SendService by sendService,
|
||||
|
@ -96,11 +104,27 @@ internal class DefaultRoom @Inject constructor(override val roomId: String,
|
|||
return cryptoService.shouldEncryptForInvitedMembers(roomId)
|
||||
}
|
||||
|
||||
override fun enableEncryptionWithAlgorithm(algorithm: String, callback: MatrixCallback<Unit>) {
|
||||
if (isEncrypted()) {
|
||||
callback.onFailure(IllegalStateException("Encryption is already enabled for this room"))
|
||||
} else {
|
||||
stateService.enableEncryption(algorithm, callback)
|
||||
override fun enableEncryption(algorithm: String, callback: MatrixCallback<Unit>) {
|
||||
when {
|
||||
isEncrypted() -> {
|
||||
callback.onFailure(IllegalStateException("Encryption is already enabled for this room"))
|
||||
}
|
||||
algorithm != MXCRYPTO_ALGORITHM_MEGOLM -> {
|
||||
callback.onFailure(InvalidParameterException("Only MXCRYPTO_ALGORITHM_MEGOLM algorithm is supported"))
|
||||
}
|
||||
else -> {
|
||||
val params = SendStateTask.Params(roomId,
|
||||
EventType.STATE_ROOM_ENCRYPTION,
|
||||
mapOf(
|
||||
"algorithm" to algorithm
|
||||
))
|
||||
|
||||
sendStateTask
|
||||
.configureWith(params) {
|
||||
this.callback = callback
|
||||
}
|
||||
.executeBy(taskExecutor)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -29,8 +29,10 @@ import im.vector.matrix.android.internal.session.room.relation.DefaultRelationSe
|
|||
import im.vector.matrix.android.internal.session.room.reporting.DefaultReportingService
|
||||
import im.vector.matrix.android.internal.session.room.send.DefaultSendService
|
||||
import im.vector.matrix.android.internal.session.room.state.DefaultStateService
|
||||
import im.vector.matrix.android.internal.session.room.state.SendStateTask
|
||||
import im.vector.matrix.android.internal.session.room.timeline.DefaultTimelineService
|
||||
import im.vector.matrix.android.internal.session.room.typing.DefaultTypingService
|
||||
import im.vector.matrix.android.internal.task.TaskExecutor
|
||||
import javax.inject.Inject
|
||||
|
||||
internal interface RoomFactory {
|
||||
|
@ -50,7 +52,9 @@ internal class DefaultRoomFactory @Inject constructor(private val monarchy: Mona
|
|||
private val typingServiceFactory: DefaultTypingService.Factory,
|
||||
private val relationServiceFactory: DefaultRelationService.Factory,
|
||||
private val membershipServiceFactory: DefaultMembershipService.Factory,
|
||||
private val roomPushRuleServiceFactory: DefaultRoomPushRuleService.Factory):
|
||||
private val roomPushRuleServiceFactory: DefaultRoomPushRuleService.Factory,
|
||||
private val taskExecutor: TaskExecutor,
|
||||
private val sendStateTask: SendStateTask) :
|
||||
RoomFactory {
|
||||
|
||||
override fun create(roomId: String): Room {
|
||||
|
@ -68,7 +72,9 @@ internal class DefaultRoomFactory @Inject constructor(private val monarchy: Mona
|
|||
cryptoService = cryptoService,
|
||||
relationService = relationServiceFactory.create(roomId),
|
||||
roomMembersService = membershipServiceFactory.create(roomId),
|
||||
roomPushRuleService = roomPushRuleServiceFactory.create(roomId)
|
||||
roomPushRuleService = roomPushRuleServiceFactory.create(roomId),
|
||||
taskExecutor = taskExecutor,
|
||||
sendStateTask = sendStateTask
|
||||
)
|
||||
}
|
||||
}
|
||||
|
|
|
@ -27,7 +27,6 @@ import im.vector.matrix.android.api.session.events.model.EventType
|
|||
import im.vector.matrix.android.api.session.room.state.StateService
|
||||
import im.vector.matrix.android.api.util.Optional
|
||||
import im.vector.matrix.android.api.util.toOptional
|
||||
import im.vector.matrix.android.internal.crypto.MXCRYPTO_ALGORITHM_MEGOLM
|
||||
import im.vector.matrix.android.internal.database.mapper.asDomain
|
||||
import im.vector.matrix.android.internal.database.model.CurrentStateEventEntity
|
||||
import im.vector.matrix.android.internal.database.query.getOrNull
|
||||
|
@ -35,7 +34,6 @@ import im.vector.matrix.android.internal.database.query.whereStateKey
|
|||
import im.vector.matrix.android.internal.task.TaskExecutor
|
||||
import im.vector.matrix.android.internal.task.configureWith
|
||||
import io.realm.Realm
|
||||
import java.security.InvalidParameterException
|
||||
|
||||
internal class DefaultStateService @AssistedInject constructor(@Assisted private val roomId: String,
|
||||
private val monarchy: Monarchy,
|
||||
|
@ -77,22 +75,4 @@ internal class DefaultStateService @AssistedInject constructor(@Assisted private
|
|||
}
|
||||
.executeBy(taskExecutor)
|
||||
}
|
||||
|
||||
override fun enableEncryption(algorithm: String, callback: MatrixCallback<Unit>) {
|
||||
if (algorithm != MXCRYPTO_ALGORITHM_MEGOLM) {
|
||||
callback.onFailure(InvalidParameterException("Only MXCRYPTO_ALGORITHM_MEGOLM algorithm is supported"))
|
||||
} else {
|
||||
val params = SendStateTask.Params(roomId,
|
||||
EventType.STATE_ROOM_ENCRYPTION,
|
||||
mapOf(
|
||||
"algorithm" to algorithm
|
||||
))
|
||||
|
||||
sendStateTask
|
||||
.configureWith(params) {
|
||||
this.callback = callback
|
||||
}
|
||||
.executeBy(taskExecutor)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -43,7 +43,9 @@ import im.vector.riotx.R
|
|||
import im.vector.riotx.core.extensions.getMeasurements
|
||||
import im.vector.riotx.core.utils.PERMISSIONS_EMPTY
|
||||
import im.vector.riotx.core.utils.PERMISSIONS_FOR_PICKING_CONTACT
|
||||
import im.vector.riotx.core.utils.PERMISSIONS_FOR_TAKING_PHOTO
|
||||
import im.vector.riotx.core.utils.PERMISSIONS_FOR_WRITING_FILES
|
||||
import im.vector.riotx.features.attachments.AttachmentTypeSelectorView.Callback
|
||||
import kotlin.math.max
|
||||
|
||||
private const val ANIMATION_DURATION = 250
|
||||
|
@ -146,10 +148,10 @@ class AttachmentTypeSelectorView(context: Context,
|
|||
private fun animateWindowInCircular(anchor: View, contentView: View) {
|
||||
val coordinates = getClickCoordinates(anchor, contentView)
|
||||
val animator = ViewAnimationUtils.createCircularReveal(contentView,
|
||||
coordinates.first,
|
||||
coordinates.second,
|
||||
0f,
|
||||
max(contentView.width, contentView.height).toFloat())
|
||||
coordinates.first,
|
||||
coordinates.second,
|
||||
0f,
|
||||
max(contentView.width, contentView.height).toFloat())
|
||||
animator.duration = ANIMATION_DURATION.toLong()
|
||||
animator.start()
|
||||
}
|
||||
|
@ -164,10 +166,10 @@ class AttachmentTypeSelectorView(context: Context,
|
|||
private fun animateWindowOutCircular(anchor: View, contentView: View) {
|
||||
val coordinates = getClickCoordinates(anchor, contentView)
|
||||
val animator = ViewAnimationUtils.createCircularReveal(getContentView(),
|
||||
coordinates.first,
|
||||
coordinates.second,
|
||||
max(getContentView().width, getContentView().height).toFloat(),
|
||||
0f)
|
||||
coordinates.first,
|
||||
coordinates.second,
|
||||
max(getContentView().width, getContentView().height).toFloat(),
|
||||
0f)
|
||||
|
||||
animator.duration = ANIMATION_DURATION.toLong()
|
||||
animator.addListener(object : AnimatorListenerAdapter() {
|
||||
|
@ -222,8 +224,7 @@ class AttachmentTypeSelectorView(context: Context,
|
|||
* The all possible types to pick with their required permissions.
|
||||
*/
|
||||
enum class Type(val permissionsBit: Int) {
|
||||
|
||||
CAMERA(PERMISSIONS_EMPTY),
|
||||
CAMERA(PERMISSIONS_FOR_TAKING_PHOTO),
|
||||
GALLERY(PERMISSIONS_FOR_WRITING_FILES),
|
||||
FILE(PERMISSIONS_FOR_WRITING_FILES),
|
||||
STICKER(PERMISSIONS_EMPTY),
|
||||
|
|
|
@ -1318,7 +1318,7 @@ class RoomDetailFragment @Inject constructor(
|
|||
AttachmentTypeSelectorView.Type.AUDIO -> attachmentsHelper.selectAudio()
|
||||
AttachmentTypeSelectorView.Type.CONTACT -> attachmentsHelper.selectContact()
|
||||
AttachmentTypeSelectorView.Type.STICKER -> vectorBaseActivity.notImplemented("Adding stickers")
|
||||
}
|
||||
}.exhaustive
|
||||
}
|
||||
|
||||
// AttachmentsHelper.Callback
|
||||
|
|
|
@ -23,7 +23,6 @@ import com.squareup.inject.assisted.Assisted
|
|||
import com.squareup.inject.assisted.AssistedInject
|
||||
import im.vector.matrix.android.api.MatrixCallback
|
||||
import im.vector.matrix.android.api.session.Session
|
||||
import im.vector.matrix.android.internal.crypto.MXCRYPTO_ALGORITHM_MEGOLM
|
||||
import im.vector.matrix.rx.rx
|
||||
import im.vector.matrix.rx.unwrap
|
||||
import im.vector.riotx.core.platform.VectorViewModel
|
||||
|
@ -71,7 +70,7 @@ class RoomSettingsViewModel @AssistedInject constructor(@Assisted initialState:
|
|||
copy(isLoading = true)
|
||||
}
|
||||
|
||||
room.enableEncryption(MXCRYPTO_ALGORITHM_MEGOLM, object : MatrixCallback<Unit> {
|
||||
room.enableEncryption(callback = object : MatrixCallback<Unit> {
|
||||
override fun onFailure(failure: Throwable) {
|
||||
setState {
|
||||
copy(isLoading = false)
|
||||
|
|
Loading…
Reference in a new issue