Merge pull request #6593 from vector-im/task/eric/trailing-commas
Code style change: Trailing Commas
This commit is contained in:
commit
a0bf1787cb
|
@ -770,7 +770,7 @@ ij_kotlin_align_multiline_extends_list = false
|
||||||
ij_kotlin_align_multiline_method_parentheses = false
|
ij_kotlin_align_multiline_method_parentheses = false
|
||||||
ij_kotlin_align_multiline_parameters = true
|
ij_kotlin_align_multiline_parameters = true
|
||||||
ij_kotlin_align_multiline_parameters_in_calls = false
|
ij_kotlin_align_multiline_parameters_in_calls = false
|
||||||
ij_kotlin_allow_trailing_comma = false
|
ij_kotlin_allow_trailing_comma = true
|
||||||
ij_kotlin_allow_trailing_comma_on_call_site = false
|
ij_kotlin_allow_trailing_comma_on_call_site = false
|
||||||
ij_kotlin_assignment_wrap = off
|
ij_kotlin_assignment_wrap = off
|
||||||
ij_kotlin_blank_lines_after_class_header = 0
|
ij_kotlin_blank_lines_after_class_header = 0
|
||||||
|
|
|
@ -37,9 +37,9 @@ import org.matrix.android.sdk.internal.auth.db.PendingSessionData
|
||||||
* This class execute the registration request and is responsible to keep the session of interactive authentication.
|
* This class execute the registration request and is responsible to keep the session of interactive authentication.
|
||||||
*/
|
*/
|
||||||
internal class DefaultRegistrationWizard(
|
internal class DefaultRegistrationWizard(
|
||||||
authAPI: AuthAPI,
|
authAPI: AuthAPI,
|
||||||
private val sessionCreator: SessionCreator,
|
private val sessionCreator: SessionCreator,
|
||||||
private val pendingSessionStore: PendingSessionStore
|
private val pendingSessionStore: PendingSessionStore
|
||||||
) : RegistrationWizard {
|
) : RegistrationWizard {
|
||||||
|
|
||||||
private var pendingSessionData: PendingSessionData = pendingSessionStore.getPendingSessionData() ?: error("Pending session data should exist here")
|
private var pendingSessionData: PendingSessionData = pendingSessionStore.getPendingSessionData() ?: error("Pending session data should exist here")
|
||||||
|
@ -74,20 +74,20 @@ internal class DefaultRegistrationWizard(
|
||||||
initialDeviceDisplayName: String?
|
initialDeviceDisplayName: String?
|
||||||
): RegistrationResult {
|
): RegistrationResult {
|
||||||
val params = RegistrationParams(
|
val params = RegistrationParams(
|
||||||
username = userName,
|
username = userName,
|
||||||
password = password,
|
password = password,
|
||||||
initialDeviceDisplayName = initialDeviceDisplayName
|
initialDeviceDisplayName = initialDeviceDisplayName
|
||||||
)
|
)
|
||||||
return performRegistrationRequest(params, LoginType.PASSWORD)
|
return performRegistrationRequest(params, LoginType.PASSWORD)
|
||||||
.also {
|
.also {
|
||||||
pendingSessionData = pendingSessionData.copy(isRegistrationStarted = true)
|
pendingSessionData = pendingSessionData.copy(isRegistrationStarted = true)
|
||||||
.also { pendingSessionStore.savePendingSessionData(it) }
|
.also { pendingSessionStore.savePendingSessionData(it) }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
override suspend fun performReCaptcha(response: String): RegistrationResult {
|
override suspend fun performReCaptcha(response: String): RegistrationResult {
|
||||||
val safeSession = pendingSessionData.currentSession
|
val safeSession = pendingSessionData.currentSession
|
||||||
?: throw IllegalStateException("developer error, call createAccount() method first")
|
?: throw IllegalStateException("developer error, call createAccount() method first")
|
||||||
|
|
||||||
val params = RegistrationParams(auth = AuthParams.createForCaptcha(safeSession, response))
|
val params = RegistrationParams(auth = AuthParams.createForCaptcha(safeSession, response))
|
||||||
return performRegistrationRequest(params, LoginType.PASSWORD)
|
return performRegistrationRequest(params, LoginType.PASSWORD)
|
||||||
|
@ -95,7 +95,7 @@ internal class DefaultRegistrationWizard(
|
||||||
|
|
||||||
override suspend fun acceptTerms(): RegistrationResult {
|
override suspend fun acceptTerms(): RegistrationResult {
|
||||||
val safeSession = pendingSessionData.currentSession
|
val safeSession = pendingSessionData.currentSession
|
||||||
?: throw IllegalStateException("developer error, call createAccount() method first")
|
?: throw IllegalStateException("developer error, call createAccount() method first")
|
||||||
|
|
||||||
val params = RegistrationParams(auth = AuthParams(type = LoginFlowTypes.TERMS, session = safeSession))
|
val params = RegistrationParams(auth = AuthParams(type = LoginFlowTypes.TERMS, session = safeSession))
|
||||||
return performRegistrationRequest(params, LoginType.PASSWORD)
|
return performRegistrationRequest(params, LoginType.PASSWORD)
|
||||||
|
@ -103,14 +103,14 @@ internal class DefaultRegistrationWizard(
|
||||||
|
|
||||||
override suspend fun addThreePid(threePid: RegisterThreePid): RegistrationResult {
|
override suspend fun addThreePid(threePid: RegisterThreePid): RegistrationResult {
|
||||||
pendingSessionData = pendingSessionData.copy(currentThreePidData = null)
|
pendingSessionData = pendingSessionData.copy(currentThreePidData = null)
|
||||||
.also { pendingSessionStore.savePendingSessionData(it) }
|
.also { pendingSessionStore.savePendingSessionData(it) }
|
||||||
|
|
||||||
return sendThreePid(threePid)
|
return sendThreePid(threePid)
|
||||||
}
|
}
|
||||||
|
|
||||||
override suspend fun sendAgainThreePid(): RegistrationResult {
|
override suspend fun sendAgainThreePid(): RegistrationResult {
|
||||||
val safeCurrentThreePid = pendingSessionData.currentThreePidData?.threePid
|
val safeCurrentThreePid = pendingSessionData.currentThreePidData?.threePid
|
||||||
?: throw IllegalStateException("developer error, call createAccount() method first")
|
?: throw IllegalStateException("developer error, call createAccount() method first")
|
||||||
|
|
||||||
return sendThreePid(safeCurrentThreePid)
|
return sendThreePid(safeCurrentThreePid)
|
||||||
}
|
}
|
||||||
|
@ -126,7 +126,7 @@ internal class DefaultRegistrationWizard(
|
||||||
)
|
)
|
||||||
|
|
||||||
pendingSessionData = pendingSessionData.copy(sendAttempt = pendingSessionData.sendAttempt + 1)
|
pendingSessionData = pendingSessionData.copy(sendAttempt = pendingSessionData.sendAttempt + 1)
|
||||||
.also { pendingSessionStore.savePendingSessionData(it) }
|
.also { pendingSessionStore.savePendingSessionData(it) }
|
||||||
|
|
||||||
val params = RegistrationParams(
|
val params = RegistrationParams(
|
||||||
auth = if (threePid is RegisterThreePid.Email) {
|
auth = if (threePid is RegisterThreePid.Email) {
|
||||||
|
@ -149,7 +149,7 @@ internal class DefaultRegistrationWizard(
|
||||||
)
|
)
|
||||||
// Store data
|
// Store data
|
||||||
pendingSessionData = pendingSessionData.copy(currentThreePidData = ThreePidData.from(threePid, response, params))
|
pendingSessionData = pendingSessionData.copy(currentThreePidData = ThreePidData.from(threePid, response, params))
|
||||||
.also { pendingSessionStore.savePendingSessionData(it) }
|
.also { pendingSessionStore.savePendingSessionData(it) }
|
||||||
|
|
||||||
// and send the sid a first time
|
// and send the sid a first time
|
||||||
return performRegistrationRequest(params, LoginType.PASSWORD)
|
return performRegistrationRequest(params, LoginType.PASSWORD)
|
||||||
|
@ -157,7 +157,7 @@ internal class DefaultRegistrationWizard(
|
||||||
|
|
||||||
override suspend fun checkIfEmailHasBeenValidated(delayMillis: Long): RegistrationResult {
|
override suspend fun checkIfEmailHasBeenValidated(delayMillis: Long): RegistrationResult {
|
||||||
val safeParam = pendingSessionData.currentThreePidData?.registrationParams
|
val safeParam = pendingSessionData.currentThreePidData?.registrationParams
|
||||||
?: throw IllegalStateException("developer error, no pending three pid")
|
?: throw IllegalStateException("developer error, no pending three pid")
|
||||||
|
|
||||||
return performRegistrationRequest(safeParam, LoginType.PASSWORD, delayMillis)
|
return performRegistrationRequest(safeParam, LoginType.PASSWORD, delayMillis)
|
||||||
}
|
}
|
||||||
|
@ -168,13 +168,13 @@ internal class DefaultRegistrationWizard(
|
||||||
|
|
||||||
private suspend fun validateThreePid(code: String): RegistrationResult {
|
private suspend fun validateThreePid(code: String): RegistrationResult {
|
||||||
val registrationParams = pendingSessionData.currentThreePidData?.registrationParams
|
val registrationParams = pendingSessionData.currentThreePidData?.registrationParams
|
||||||
?: throw IllegalStateException("developer error, no pending three pid")
|
?: throw IllegalStateException("developer error, no pending three pid")
|
||||||
val safeCurrentData = pendingSessionData.currentThreePidData ?: throw IllegalStateException("developer error, call createAccount() method first")
|
val safeCurrentData = pendingSessionData.currentThreePidData ?: throw IllegalStateException("developer error, call createAccount() method first")
|
||||||
val url = safeCurrentData.addThreePidRegistrationResponse.submitUrl ?: throw IllegalStateException("Missing url to send the code")
|
val url = safeCurrentData.addThreePidRegistrationResponse.submitUrl ?: throw IllegalStateException("Missing url to send the code")
|
||||||
val validationBody = ValidationCodeBody(
|
val validationBody = ValidationCodeBody(
|
||||||
clientSecret = pendingSessionData.clientSecret,
|
clientSecret = pendingSessionData.clientSecret,
|
||||||
sid = safeCurrentData.addThreePidRegistrationResponse.sid,
|
sid = safeCurrentData.addThreePidRegistrationResponse.sid,
|
||||||
code = code
|
code = code
|
||||||
)
|
)
|
||||||
val validationResponse = validateCodeTask.execute(ValidateCodeTask.Params(url, validationBody))
|
val validationResponse = validateCodeTask.execute(ValidateCodeTask.Params(url, validationBody))
|
||||||
if (validationResponse.isSuccess()) {
|
if (validationResponse.isSuccess()) {
|
||||||
|
@ -189,7 +189,7 @@ internal class DefaultRegistrationWizard(
|
||||||
|
|
||||||
override suspend fun dummy(): RegistrationResult {
|
override suspend fun dummy(): RegistrationResult {
|
||||||
val safeSession = pendingSessionData.currentSession
|
val safeSession = pendingSessionData.currentSession
|
||||||
?: throw IllegalStateException("developer error, call createAccount() method first")
|
?: throw IllegalStateException("developer error, call createAccount() method first")
|
||||||
|
|
||||||
val params = RegistrationParams(auth = AuthParams(type = LoginFlowTypes.DUMMY, session = safeSession))
|
val params = RegistrationParams(auth = AuthParams(type = LoginFlowTypes.DUMMY, session = safeSession))
|
||||||
return performRegistrationRequest(params, LoginType.PASSWORD)
|
return performRegistrationRequest(params, LoginType.PASSWORD)
|
||||||
|
|
|
@ -604,14 +604,16 @@ internal class MXOlmDevice @Inject constructor(
|
||||||
* @param sharedHistory MSC3061, this key is sharable on invite
|
* @param sharedHistory MSC3061, this key is sharable on invite
|
||||||
* @return true if the operation succeeds.
|
* @return true if the operation succeeds.
|
||||||
*/
|
*/
|
||||||
fun addInboundGroupSession(sessionId: String,
|
fun addInboundGroupSession(
|
||||||
sessionKey: String,
|
sessionId: String,
|
||||||
roomId: String,
|
sessionKey: String,
|
||||||
senderKey: String,
|
roomId: String,
|
||||||
forwardingCurve25519KeyChain: List<String>,
|
senderKey: String,
|
||||||
keysClaimed: Map<String, String>,
|
forwardingCurve25519KeyChain: List<String>,
|
||||||
exportFormat: Boolean,
|
keysClaimed: Map<String, String>,
|
||||||
sharedHistory: Boolean): AddSessionResult {
|
exportFormat: Boolean,
|
||||||
|
sharedHistory: Boolean
|
||||||
|
): AddSessionResult {
|
||||||
val candidateSession = tryOrNull("Failed to create inbound session in room $roomId") {
|
val candidateSession = tryOrNull("Failed to create inbound session in room $roomId") {
|
||||||
if (exportFormat) {
|
if (exportFormat) {
|
||||||
OlmInboundGroupSession.importSession(sessionKey)
|
OlmInboundGroupSession.importSession(sessionKey)
|
||||||
|
@ -701,8 +703,8 @@ internal class MXOlmDevice @Inject constructor(
|
||||||
val senderKey = megolmSessionData.senderKey ?: continue
|
val senderKey = megolmSessionData.senderKey ?: continue
|
||||||
val roomId = megolmSessionData.roomId
|
val roomId = megolmSessionData.roomId
|
||||||
|
|
||||||
val candidateSessionToImport = try {
|
val candidateSessionToImport = try {
|
||||||
MXInboundMegolmSessionWrapper.newFromMegolmData(megolmSessionData, true)
|
MXInboundMegolmSessionWrapper.newFromMegolmData(megolmSessionData, true)
|
||||||
} catch (e: Throwable) {
|
} catch (e: Throwable) {
|
||||||
Timber.tag(loggerTag.value).e(e, "## importInboundGroupSession() : Failed to import session $senderKey/$sessionId")
|
Timber.tag(loggerTag.value).e(e, "## importInboundGroupSession() : Failed to import session $senderKey/$sessionId")
|
||||||
continue
|
continue
|
||||||
|
|
|
@ -38,6 +38,7 @@ internal class MXMegolmDecryptionFactory @Inject constructor(
|
||||||
outgoingKeyRequestManager,
|
outgoingKeyRequestManager,
|
||||||
cryptoStore,
|
cryptoStore,
|
||||||
matrixConfiguration,
|
matrixConfiguration,
|
||||||
eventsManager)
|
eventsManager
|
||||||
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -250,8 +250,10 @@ internal class MXMegolmEncryption(
|
||||||
* @param sessionInfo the session info
|
* @param sessionInfo the session info
|
||||||
* @param devicesByUser the devices map
|
* @param devicesByUser the devices map
|
||||||
*/
|
*/
|
||||||
private suspend fun shareUserDevicesKey(sessionInfo: MXOutboundSessionInfo,
|
private suspend fun shareUserDevicesKey(
|
||||||
devicesByUser: Map<String, List<CryptoDeviceInfo>>) {
|
sessionInfo: MXOutboundSessionInfo,
|
||||||
|
devicesByUser: Map<String, List<CryptoDeviceInfo>>
|
||||||
|
) {
|
||||||
val sessionKey = olmDevice.getSessionKey(sessionInfo.sessionId) ?: return Unit.also {
|
val sessionKey = olmDevice.getSessionKey(sessionInfo.sessionId) ?: return Unit.also {
|
||||||
Timber.tag(loggerTag.value).v("shareUserDevicesKey() Failed to share session, failed to export")
|
Timber.tag(loggerTag.value).v("shareUserDevicesKey() Failed to share session, failed to export")
|
||||||
}
|
}
|
||||||
|
|
|
@ -22,7 +22,7 @@ import timber.log.Timber
|
||||||
/**
|
/**
|
||||||
* Throws in debug, only log in production.
|
* Throws in debug, only log in production.
|
||||||
* As this method does not always throw, next statement should be a return.
|
* As this method does not always throw, next statement should be a return.
|
||||||
*/
|
*/
|
||||||
internal fun fatalError(message: String) {
|
internal fun fatalError(message: String) {
|
||||||
if (BuildConfig.DEBUG) {
|
if (BuildConfig.DEBUG) {
|
||||||
error(message)
|
error(message)
|
||||||
|
|
|
@ -21,11 +21,11 @@ import im.vector.app.features.onboarding.AuthenticationDescription
|
||||||
|
|
||||||
fun AuthenticationDescription.AuthenticationType.toAnalyticsType() = when (this) {
|
fun AuthenticationDescription.AuthenticationType.toAnalyticsType() = when (this) {
|
||||||
AuthenticationDescription.AuthenticationType.Password -> Signup.AuthenticationType.Password
|
AuthenticationDescription.AuthenticationType.Password -> Signup.AuthenticationType.Password
|
||||||
AuthenticationDescription.AuthenticationType.Apple -> Signup.AuthenticationType.Apple
|
AuthenticationDescription.AuthenticationType.Apple -> Signup.AuthenticationType.Apple
|
||||||
AuthenticationDescription.AuthenticationType.Facebook -> Signup.AuthenticationType.Facebook
|
AuthenticationDescription.AuthenticationType.Facebook -> Signup.AuthenticationType.Facebook
|
||||||
AuthenticationDescription.AuthenticationType.GitHub -> Signup.AuthenticationType.GitHub
|
AuthenticationDescription.AuthenticationType.GitHub -> Signup.AuthenticationType.GitHub
|
||||||
AuthenticationDescription.AuthenticationType.GitLab -> Signup.AuthenticationType.GitLab
|
AuthenticationDescription.AuthenticationType.GitLab -> Signup.AuthenticationType.GitLab
|
||||||
AuthenticationDescription.AuthenticationType.Google -> Signup.AuthenticationType.Google
|
AuthenticationDescription.AuthenticationType.Google -> Signup.AuthenticationType.Google
|
||||||
AuthenticationDescription.AuthenticationType.SSO -> Signup.AuthenticationType.SSO
|
AuthenticationDescription.AuthenticationType.SSO -> Signup.AuthenticationType.SSO
|
||||||
AuthenticationDescription.AuthenticationType.Other -> Signup.AuthenticationType.Other
|
AuthenticationDescription.AuthenticationType.Other -> Signup.AuthenticationType.Other
|
||||||
}
|
}
|
||||||
|
|
|
@ -70,7 +70,7 @@ class AvatarRenderer @Inject constructor(
|
||||||
render(
|
render(
|
||||||
GlideApp.with(imageView),
|
GlideApp.with(imageView),
|
||||||
matrixItem,
|
matrixItem,
|
||||||
DrawableImageViewTarget(imageView)
|
DrawableImageViewTarget(imageView),
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -103,7 +103,7 @@ class AvatarRenderer @Inject constructor(
|
||||||
render(
|
render(
|
||||||
glideRequests,
|
glideRequests,
|
||||||
matrixItem,
|
matrixItem,
|
||||||
DrawableImageViewTarget(imageView)
|
DrawableImageViewTarget(imageView),
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -123,7 +123,7 @@ class AvatarRenderer @Inject constructor(
|
||||||
val matrixItem = MatrixItem.UserItem(
|
val matrixItem = MatrixItem.UserItem(
|
||||||
// Need an id starting with @
|
// Need an id starting with @
|
||||||
id = "@${mappedContact.displayName}",
|
id = "@${mappedContact.displayName}",
|
||||||
displayName = mappedContact.displayName
|
displayName = mappedContact.displayName,
|
||||||
)
|
)
|
||||||
|
|
||||||
val placeholder = getPlaceholderDrawable(matrixItem)
|
val placeholder = getPlaceholderDrawable(matrixItem)
|
||||||
|
@ -140,7 +140,7 @@ class AvatarRenderer @Inject constructor(
|
||||||
val matrixItem = MatrixItem.UserItem(
|
val matrixItem = MatrixItem.UserItem(
|
||||||
// Need an id starting with @
|
// Need an id starting with @
|
||||||
id = profileInfo.matrixId,
|
id = profileInfo.matrixId,
|
||||||
displayName = profileInfo.displayName
|
displayName = profileInfo.displayName,
|
||||||
)
|
)
|
||||||
|
|
||||||
val placeholder = getPlaceholderDrawable(matrixItem)
|
val placeholder = getPlaceholderDrawable(matrixItem)
|
||||||
|
@ -215,7 +215,7 @@ class AvatarRenderer @Inject constructor(
|
||||||
.bold()
|
.bold()
|
||||||
.endConfig()
|
.endConfig()
|
||||||
.buildRect(matrixItem.firstLetterOfDisplayName(), avatarColor)
|
.buildRect(matrixItem.firstLetterOfDisplayName(), avatarColor)
|
||||||
.toBitmap(width = iconSize, height = iconSize)
|
.toBitmap(width = iconSize, height = iconSize),
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -231,7 +231,7 @@ class AvatarRenderer @Inject constructor(
|
||||||
addPlaceholder: Boolean
|
addPlaceholder: Boolean
|
||||||
) {
|
) {
|
||||||
val transformations = mutableListOf<Transformation<Bitmap>>(
|
val transformations = mutableListOf<Transformation<Bitmap>>(
|
||||||
BlurTransformation(20, sampling)
|
BlurTransformation(20, sampling),
|
||||||
)
|
)
|
||||||
if (colorFilter != null) {
|
if (colorFilter != null) {
|
||||||
transformations.add(ColorFilterTransformation(colorFilter))
|
transformations.add(ColorFilterTransformation(colorFilter))
|
||||||
|
|
|
@ -219,7 +219,7 @@ class HomeActivity :
|
||||||
is HomeActivitySharedAction.ShowSpaceSettings -> showSpaceSettings(sharedAction.spaceId)
|
is HomeActivitySharedAction.ShowSpaceSettings -> showSpaceSettings(sharedAction.spaceId)
|
||||||
is HomeActivitySharedAction.OpenSpaceInvite -> openSpaceInvite(sharedAction.spaceId)
|
is HomeActivitySharedAction.OpenSpaceInvite -> openSpaceInvite(sharedAction.spaceId)
|
||||||
HomeActivitySharedAction.SendSpaceFeedBack -> bugReporter.openBugReportScreen(this, ReportType.SPACE_BETA_FEEDBACK)
|
HomeActivitySharedAction.SendSpaceFeedBack -> bugReporter.openBugReportScreen(this, ReportType.SPACE_BETA_FEEDBACK)
|
||||||
HomeActivitySharedAction.OnCloseSpace -> onCloseSpace()
|
HomeActivitySharedAction.OnCloseSpace -> onCloseSpace()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
.launchIn(lifecycleScope)
|
.launchIn(lifecycleScope)
|
||||||
|
|
|
@ -63,10 +63,10 @@ class EncryptionItemFactory @Inject constructor(
|
||||||
isDirect && RoomLocalEcho.isLocalEchoId(event.root.roomId.orEmpty()) -> {
|
isDirect && RoomLocalEcho.isLocalEchoId(event.root.roomId.orEmpty()) -> {
|
||||||
R.string.direct_room_encryption_enabled_tile_description_future
|
R.string.direct_room_encryption_enabled_tile_description_future
|
||||||
}
|
}
|
||||||
isDirect -> {
|
isDirect -> {
|
||||||
R.string.direct_room_encryption_enabled_tile_description
|
R.string.direct_room_encryption_enabled_tile_description
|
||||||
}
|
}
|
||||||
else -> {
|
else -> {
|
||||||
R.string.encryption_enabled_tile_description
|
R.string.encryption_enabled_tile_description
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -146,17 +146,17 @@ class RoomListViewModel @AssistedInject constructor(
|
||||||
companion object : MavericksViewModelFactory<RoomListViewModel, RoomListViewState> by hiltMavericksViewModelFactory()
|
companion object : MavericksViewModelFactory<RoomListViewModel, RoomListViewState> by hiltMavericksViewModelFactory()
|
||||||
|
|
||||||
private val roomListSectionBuilder = RoomListSectionBuilder(
|
private val roomListSectionBuilder = RoomListSectionBuilder(
|
||||||
session,
|
session,
|
||||||
stringProvider,
|
stringProvider,
|
||||||
appStateHandler,
|
appStateHandler,
|
||||||
viewModelScope,
|
viewModelScope,
|
||||||
autoAcceptInvites,
|
autoAcceptInvites,
|
||||||
{
|
{
|
||||||
updatableQuery = it
|
updatableQuery = it
|
||||||
},
|
},
|
||||||
suggestedRoomJoiningState,
|
suggestedRoomJoiningState,
|
||||||
!vectorPreferences.prefSpacesShowAllRoomInHome()
|
!vectorPreferences.prefSpacesShowAllRoomInHome()
|
||||||
)
|
)
|
||||||
|
|
||||||
val sections: List<RoomsSection> by lazy {
|
val sections: List<RoomsSection> by lazy {
|
||||||
roomListSectionBuilder.buildSections(initialState.displayMode)
|
roomListSectionBuilder.buildSections(initialState.displayMode)
|
||||||
|
|
|
@ -85,27 +85,27 @@ class EventHtmlRenderer @Inject constructor(
|
||||||
} else {
|
} else {
|
||||||
builder
|
builder
|
||||||
}
|
}
|
||||||
.usePlugin(
|
.usePlugin(
|
||||||
MarkwonInlineParserPlugin.create(
|
MarkwonInlineParserPlugin.create(
|
||||||
/* Configuring the Markwon inline formatting processor.
|
/* Configuring the Markwon inline formatting processor.
|
||||||
* Default settings are all Markdown features. Turn those off, only using the
|
* Default settings are all Markdown features. Turn those off, only using the
|
||||||
* inline HTML processor and HTML entities processor.
|
* inline HTML processor and HTML entities processor.
|
||||||
*/
|
*/
|
||||||
MarkwonInlineParser.factoryBuilderNoDefaults()
|
MarkwonInlineParser.factoryBuilderNoDefaults()
|
||||||
.addInlineProcessor(HtmlInlineProcessor()) // use inline HTML processor
|
.addInlineProcessor(HtmlInlineProcessor()) // use inline HTML processor
|
||||||
.addInlineProcessor(EntityInlineProcessor()) // use HTML entities processor
|
.addInlineProcessor(EntityInlineProcessor()) // use HTML entities processor
|
||||||
|
)
|
||||||
)
|
)
|
||||||
)
|
.usePlugin(object : AbstractMarkwonPlugin() {
|
||||||
.usePlugin(object : AbstractMarkwonPlugin() {
|
override fun configureParser(builder: Parser.Builder) {
|
||||||
override fun configureParser(builder: Parser.Builder) {
|
/* Configuring the Markwon block formatting processor.
|
||||||
/* Configuring the Markwon block formatting processor.
|
* Default settings are all Markdown blocks. Turn those off.
|
||||||
* Default settings are all Markdown blocks. Turn those off.
|
*/
|
||||||
*/
|
builder.enabledBlockTypes(kotlin.collections.emptySet())
|
||||||
builder.enabledBlockTypes(kotlin.collections.emptySet())
|
}
|
||||||
}
|
})
|
||||||
})
|
.textSetter(PrecomputedFutureTextSetterCompat.create())
|
||||||
.textSetter(PrecomputedFutureTextSetterCompat.create())
|
.build()
|
||||||
.build()
|
|
||||||
|
|
||||||
val plugins: List<MarkwonPlugin> = markwon.plugins
|
val plugins: List<MarkwonPlugin> = markwon.plugins
|
||||||
|
|
||||||
|
|
|
@ -29,7 +29,7 @@ import im.vector.app.databinding.BottomSheetLiveLocationLabsFlagPromotionBinding
|
||||||
* This should not be shown if the user already enabled the labs flag.
|
* This should not be shown if the user already enabled the labs flag.
|
||||||
*/
|
*/
|
||||||
class LiveLocationLabsFlagPromotionBottomSheet :
|
class LiveLocationLabsFlagPromotionBottomSheet :
|
||||||
VectorBaseBottomSheetDialogFragment<BottomSheetLiveLocationLabsFlagPromotionBinding>() {
|
VectorBaseBottomSheetDialogFragment<BottomSheetLiveLocationLabsFlagPromotionBinding>() {
|
||||||
|
|
||||||
override val showExpanded = true
|
override val showExpanded = true
|
||||||
|
|
||||||
|
|
|
@ -41,12 +41,12 @@ sealed interface AuthenticationDescription : Parcelable {
|
||||||
}
|
}
|
||||||
|
|
||||||
fun SsoIdentityProvider?.toAuthenticationType() = when (this?.brand) {
|
fun SsoIdentityProvider?.toAuthenticationType() = when (this?.brand) {
|
||||||
SsoIdentityProvider.BRAND_GOOGLE -> AuthenticationType.Google
|
SsoIdentityProvider.BRAND_GOOGLE -> AuthenticationType.Google
|
||||||
SsoIdentityProvider.BRAND_GITHUB -> AuthenticationType.GitHub
|
SsoIdentityProvider.BRAND_GITHUB -> AuthenticationType.GitHub
|
||||||
SsoIdentityProvider.BRAND_APPLE -> AuthenticationType.Apple
|
SsoIdentityProvider.BRAND_APPLE -> AuthenticationType.Apple
|
||||||
SsoIdentityProvider.BRAND_FACEBOOK -> AuthenticationType.Facebook
|
SsoIdentityProvider.BRAND_FACEBOOK -> AuthenticationType.Facebook
|
||||||
SsoIdentityProvider.BRAND_GITLAB -> AuthenticationType.GitLab
|
SsoIdentityProvider.BRAND_GITLAB -> AuthenticationType.GitLab
|
||||||
SsoIdentityProvider.BRAND_TWITTER -> AuthenticationType.SSO
|
SsoIdentityProvider.BRAND_TWITTER -> AuthenticationType.SSO
|
||||||
null -> AuthenticationType.SSO
|
null -> AuthenticationType.SSO
|
||||||
else -> AuthenticationType.SSO
|
else -> AuthenticationType.SSO
|
||||||
}
|
}
|
||||||
|
|
|
@ -563,7 +563,7 @@ class OnboardingViewModel @AssistedInject constructor(
|
||||||
setState { copy(isLoading = false, resetState = ResetState()) }
|
setState { copy(isLoading = false, resetState = ResetState()) }
|
||||||
val nextEvent = when {
|
val nextEvent = when {
|
||||||
vectorFeatures.isOnboardingCombinedLoginEnabled() -> OnboardingViewEvents.OnResetPasswordComplete
|
vectorFeatures.isOnboardingCombinedLoginEnabled() -> OnboardingViewEvents.OnResetPasswordComplete
|
||||||
else -> OnboardingViewEvents.OpenResetPasswordComplete
|
else -> OnboardingViewEvents.OpenResetPasswordComplete
|
||||||
}
|
}
|
||||||
_viewEvents.post(nextEvent)
|
_viewEvents.post(nextEvent)
|
||||||
},
|
},
|
||||||
|
|
|
@ -31,6 +31,6 @@ fun SignMode.toAuthenticateAction(login: String, password: String, initialDevice
|
||||||
}
|
}
|
||||||
|
|
||||||
fun ThemeProvider.ftueBreakerBackground() = when (isLightTheme()) {
|
fun ThemeProvider.ftueBreakerBackground() = when (isLightTheme()) {
|
||||||
true -> R.drawable.bg_gradient_ftue_breaker
|
true -> R.drawable.bg_gradient_ftue_breaker
|
||||||
false -> R.drawable.bg_color_background
|
false -> R.drawable.bg_color_background
|
||||||
}
|
}
|
||||||
|
|
|
@ -33,6 +33,6 @@ class BiometricAuthError(val code: Int, message: String) : Throwable(message) {
|
||||||
val isAuthPermanentlyDisabledError: Boolean get() = code == BiometricPrompt.ERROR_LOCKOUT_PERMANENT
|
val isAuthPermanentlyDisabledError: Boolean get() = code == BiometricPrompt.ERROR_LOCKOUT_PERMANENT
|
||||||
|
|
||||||
companion object {
|
companion object {
|
||||||
private val LOCKOUT_ERROR_CODES = arrayOf(BiometricPrompt.ERROR_LOCKOUT, BiometricPrompt.ERROR_LOCKOUT_PERMANENT)
|
private val LOCKOUT_ERROR_CODES = arrayOf(BiometricPrompt.ERROR_LOCKOUT, BiometricPrompt.ERROR_LOCKOUT_PERMANENT)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -73,26 +73,30 @@ class BiometricHelper @Inject constructor(
|
||||||
/**
|
/**
|
||||||
* Returns true if a weak biometric method (i.e.: some face or iris unlock implementations) can be used.
|
* Returns true if a weak biometric method (i.e.: some face or iris unlock implementations) can be used.
|
||||||
*/
|
*/
|
||||||
val canUseWeakBiometricAuth: Boolean get() =
|
val canUseWeakBiometricAuth: Boolean
|
||||||
configuration.isWeakBiometricsEnabled && biometricManager.canAuthenticate(BIOMETRIC_WEAK) == BIOMETRIC_SUCCESS
|
get() =
|
||||||
|
configuration.isWeakBiometricsEnabled && biometricManager.canAuthenticate(BIOMETRIC_WEAK) == BIOMETRIC_SUCCESS
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns true if a strong biometric method (i.e.: fingerprint, some face or iris unlock implementations) can be used.
|
* Returns true if a strong biometric method (i.e.: fingerprint, some face or iris unlock implementations) can be used.
|
||||||
*/
|
*/
|
||||||
val canUseStrongBiometricAuth: Boolean get() =
|
val canUseStrongBiometricAuth: Boolean
|
||||||
configuration.isStrongBiometricsEnabled && biometricManager.canAuthenticate(BIOMETRIC_STRONG) == BIOMETRIC_SUCCESS
|
get() =
|
||||||
|
configuration.isStrongBiometricsEnabled && biometricManager.canAuthenticate(BIOMETRIC_STRONG) == BIOMETRIC_SUCCESS
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns true if the device credentials can be used to unlock (system pin code, password, pattern, etc.).
|
* Returns true if the device credentials can be used to unlock (system pin code, password, pattern, etc.).
|
||||||
*/
|
*/
|
||||||
val canUseDeviceCredentialsAuth: Boolean get() =
|
val canUseDeviceCredentialsAuth: Boolean
|
||||||
configuration.isDeviceCredentialUnlockEnabled && biometricManager.canAuthenticate(DEVICE_CREDENTIAL) == BIOMETRIC_SUCCESS
|
get() =
|
||||||
|
configuration.isDeviceCredentialUnlockEnabled && biometricManager.canAuthenticate(DEVICE_CREDENTIAL) == BIOMETRIC_SUCCESS
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns true if any system authentication method (biometric weak/strong or device credentials) can be used.
|
* Returns true if any system authentication method (biometric weak/strong or device credentials) can be used.
|
||||||
*/
|
*/
|
||||||
@VisibleForTesting(otherwise = PRIVATE)
|
@VisibleForTesting(otherwise = PRIVATE)
|
||||||
internal val canUseAnySystemAuth: Boolean get() = canUseWeakBiometricAuth || canUseStrongBiometricAuth || canUseDeviceCredentialsAuth
|
internal val canUseAnySystemAuth: Boolean
|
||||||
|
get() = canUseWeakBiometricAuth || canUseStrongBiometricAuth || canUseDeviceCredentialsAuth
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns true if any system authentication method and there is a valid associated key.
|
* Returns true if any system authentication method and there is a valid associated key.
|
||||||
|
@ -153,9 +157,9 @@ class BiometricHelper @Inject constructor(
|
||||||
@SuppressLint("NewApi")
|
@SuppressLint("NewApi")
|
||||||
@OptIn(ExperimentalCoroutinesApi::class)
|
@OptIn(ExperimentalCoroutinesApi::class)
|
||||||
private fun authenticateInternal(
|
private fun authenticateInternal(
|
||||||
activity: FragmentActivity,
|
activity: FragmentActivity,
|
||||||
checkSystemKeyExists: Boolean,
|
checkSystemKeyExists: Boolean,
|
||||||
cryptoObject: BiometricPrompt.CryptoObject? = null,
|
cryptoObject: BiometricPrompt.CryptoObject? = null,
|
||||||
): Flow<Boolean> {
|
): Flow<Boolean> {
|
||||||
if (checkSystemKeyExists && !isSystemAuthEnabledAndValid) return flowOf(false)
|
if (checkSystemKeyExists && !isSystemAuthEnabledAndValid) return flowOf(false)
|
||||||
|
|
||||||
|
@ -189,9 +193,9 @@ class BiometricHelper @Inject constructor(
|
||||||
|
|
||||||
@VisibleForTesting(otherwise = PRIVATE)
|
@VisibleForTesting(otherwise = PRIVATE)
|
||||||
internal fun authenticateWithPromptInternal(
|
internal fun authenticateWithPromptInternal(
|
||||||
activity: FragmentActivity,
|
activity: FragmentActivity,
|
||||||
cryptoObject: BiometricPrompt.CryptoObject? = null,
|
cryptoObject: BiometricPrompt.CryptoObject? = null,
|
||||||
channel: Channel<Boolean>,
|
channel: Channel<Boolean>,
|
||||||
): BiometricPrompt {
|
): BiometricPrompt {
|
||||||
val executor = ContextCompat.getMainExecutor(context)
|
val executor = ContextCompat.getMainExecutor(context)
|
||||||
val callback = createSuspendingAuthCallback(channel, executor.asCoroutineDispatcher())
|
val callback = createSuspendingAuthCallback(channel, executor.asCoroutineDispatcher())
|
||||||
|
|
|
@ -36,7 +36,7 @@ class LockScreenKeyRepository(
|
||||||
private val systemKeyAlias = "$baseName.system"
|
private val systemKeyAlias = "$baseName.system"
|
||||||
|
|
||||||
private val pinCodeCrypto: KeyStoreCrypto by lazy {
|
private val pinCodeCrypto: KeyStoreCrypto by lazy {
|
||||||
keyStoreCryptoFactory.provide(pinCodeKeyAlias, keyNeedsUserAuthentication = false)
|
keyStoreCryptoFactory.provide(pinCodeKeyAlias, keyNeedsUserAuthentication = false)
|
||||||
}
|
}
|
||||||
private val systemKeyCrypto: KeyStoreCrypto by lazy {
|
private val systemKeyCrypto: KeyStoreCrypto by lazy {
|
||||||
keyStoreCryptoFactory.provide(systemKeyAlias, keyNeedsUserAuthentication = true)
|
keyStoreCryptoFactory.provide(systemKeyAlias, keyNeedsUserAuthentication = true)
|
||||||
|
|
|
@ -114,15 +114,15 @@ class LockScreenFragment : VectorBaseFragment<FragmentLockScreenBinding>() {
|
||||||
private fun handleEvent(viewEvent: LockScreenViewEvent) {
|
private fun handleEvent(viewEvent: LockScreenViewEvent) {
|
||||||
when (viewEvent) {
|
when (viewEvent) {
|
||||||
is LockScreenViewEvent.CodeCreationComplete -> lockScreenListener?.onPinCodeCreated()
|
is LockScreenViewEvent.CodeCreationComplete -> lockScreenListener?.onPinCodeCreated()
|
||||||
is LockScreenViewEvent.ClearPinCode -> {
|
is LockScreenViewEvent.ClearPinCode -> {
|
||||||
if (viewEvent.confirmationFailed) {
|
if (viewEvent.confirmationFailed) {
|
||||||
lockScreenListener?.onNewCodeValidationFailed()
|
lockScreenListener?.onNewCodeValidationFailed()
|
||||||
}
|
}
|
||||||
views.codeView.clearCode()
|
views.codeView.clearCode()
|
||||||
}
|
}
|
||||||
is LockScreenViewEvent.AuthSuccessful -> lockScreenListener?.onAuthenticationSuccess(viewEvent.method)
|
is LockScreenViewEvent.AuthSuccessful -> lockScreenListener?.onAuthenticationSuccess(viewEvent.method)
|
||||||
is LockScreenViewEvent.AuthFailure -> onAuthFailure(viewEvent.method)
|
is LockScreenViewEvent.AuthFailure -> onAuthFailure(viewEvent.method)
|
||||||
is LockScreenViewEvent.AuthError -> onAuthError(viewEvent.method, viewEvent.throwable)
|
is LockScreenViewEvent.AuthError -> onAuthError(viewEvent.method, viewEvent.throwable)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -94,7 +94,7 @@ class LockScreenViewModel @AssistedInject constructor(
|
||||||
|
|
||||||
override fun handle(action: LockScreenAction) {
|
override fun handle(action: LockScreenAction) {
|
||||||
when (action) {
|
when (action) {
|
||||||
is LockScreenAction.PinCodeEntered -> onPinCodeEntered(action.value)
|
is LockScreenAction.PinCodeEntered -> onPinCodeEntered(action.value)
|
||||||
is LockScreenAction.ShowBiometricPrompt -> showBiometricPrompt(action.callingActivity)
|
is LockScreenAction.ShowBiometricPrompt -> showBiometricPrompt(action.callingActivity)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -48,15 +48,15 @@ object DevicePromptCheck {
|
||||||
* See [this OP forum thread](https://forums.oneplus.com/threads/oneplus-7-pro-fingerprint-biometricprompt-does-not-show.1035821/).
|
* See [this OP forum thread](https://forums.oneplus.com/threads/oneplus-7-pro-fingerprint-biometricprompt-does-not-show.1035821/).
|
||||||
*/
|
*/
|
||||||
private val isOnePlusDeviceWithNoBiometricUI: Boolean =
|
private val isOnePlusDeviceWithNoBiometricUI: Boolean =
|
||||||
Build.BRAND.equals("OnePlus", ignoreCase = true) &&
|
Build.BRAND.equals("OnePlus", ignoreCase = true) &&
|
||||||
!onePlusModelsWithWorkingBiometricUI.contains(Build.MODEL) &&
|
!onePlusModelsWithWorkingBiometricUI.contains(Build.MODEL) &&
|
||||||
Build.VERSION.SDK_INT < Build.VERSION_CODES.R
|
Build.VERSION.SDK_INT < Build.VERSION_CODES.R
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Some LG models don't seem to have a system biometric prompt at all.
|
* Some LG models don't seem to have a system biometric prompt at all.
|
||||||
*/
|
*/
|
||||||
private val isLGDeviceWithNoBiometricUI: Boolean =
|
private val isLGDeviceWithNoBiometricUI: Boolean =
|
||||||
Build.BRAND.equals("LG", ignoreCase = true) && lgModelsWithoutBiometricUI.contains(Build.MODEL)
|
Build.BRAND.equals("LG", ignoreCase = true) && lgModelsWithoutBiometricUI.contains(Build.MODEL)
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Check if this device is included in the list of devices with known Biometric Prompt issues.
|
* Check if this device is included in the list of devices with known Biometric Prompt issues.
|
||||||
|
|
|
@ -31,7 +31,7 @@ import javax.inject.Inject
|
||||||
|
|
||||||
class FontScaleSettingFragment @Inject constructor(
|
class FontScaleSettingFragment @Inject constructor(
|
||||||
private val fontListController: FontScaleSettingController
|
private val fontListController: FontScaleSettingController
|
||||||
) : VectorBaseFragment<FragmentSettingsFontScalingBinding>(), FontScaleSettingController.Callback {
|
) : VectorBaseFragment<FragmentSettingsFontScalingBinding>(), FontScaleSettingController.Callback {
|
||||||
|
|
||||||
private val viewModel: FontScaleSettingViewModel by fragmentViewModel()
|
private val viewModel: FontScaleSettingViewModel by fragmentViewModel()
|
||||||
|
|
||||||
|
|
|
@ -94,10 +94,10 @@ class SoftLogoutController @Inject constructor(
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun buildForm(state: SoftLogoutViewState) = when (state.asyncHomeServerLoginFlowRequest) {
|
private fun buildForm(state: SoftLogoutViewState) = when (state.asyncHomeServerLoginFlowRequest) {
|
||||||
is Fail -> buildLoginErrorWithRetryItem(state.asyncHomeServerLoginFlowRequest.error)
|
is Fail -> buildLoginErrorWithRetryItem(state.asyncHomeServerLoginFlowRequest.error)
|
||||||
is Success -> buildLoginSuccessItem(state)
|
is Success -> buildLoginSuccessItem(state)
|
||||||
is Loading, Uninitialized -> buildLoadingItem()
|
is Loading, Uninitialized -> buildLoadingItem()
|
||||||
is Incomplete -> Unit
|
is Incomplete -> Unit
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun buildLoadingItem() {
|
private fun buildLoadingItem() {
|
||||||
|
@ -116,11 +116,11 @@ class SoftLogoutController @Inject constructor(
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun buildLoginSuccessItem(state: SoftLogoutViewState) = when (state.asyncHomeServerLoginFlowRequest.invoke()) {
|
private fun buildLoginSuccessItem(state: SoftLogoutViewState) = when (state.asyncHomeServerLoginFlowRequest.invoke()) {
|
||||||
LoginMode.Password -> buildLoginPasswordForm(state)
|
LoginMode.Password -> buildLoginPasswordForm(state)
|
||||||
is LoginMode.Sso -> buildLoginSSOForm()
|
is LoginMode.Sso -> buildLoginSSOForm()
|
||||||
is LoginMode.SsoAndPassword -> disambiguateLoginSSOAndPasswordForm(state)
|
is LoginMode.SsoAndPassword -> disambiguateLoginSSOAndPasswordForm(state)
|
||||||
LoginMode.Unsupported -> buildLoginUnsupportedForm()
|
LoginMode.Unsupported -> buildLoginUnsupportedForm()
|
||||||
LoginMode.Unknown, null -> Unit // Should not happen
|
LoginMode.Unknown, null -> Unit // Should not happen
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun buildLoginPasswordForm(state: SoftLogoutViewState) {
|
private fun buildLoginPasswordForm(state: SoftLogoutViewState) {
|
||||||
|
@ -148,12 +148,12 @@ class SoftLogoutController @Inject constructor(
|
||||||
|
|
||||||
private fun disambiguateLoginSSOAndPasswordForm(state: SoftLogoutViewState) {
|
private fun disambiguateLoginSSOAndPasswordForm(state: SoftLogoutViewState) {
|
||||||
when (state.loginType) {
|
when (state.loginType) {
|
||||||
LoginType.PASSWORD -> buildLoginPasswordForm(state)
|
LoginType.PASSWORD -> buildLoginPasswordForm(state)
|
||||||
LoginType.SSO -> buildLoginSSOForm()
|
LoginType.SSO -> buildLoginSSOForm()
|
||||||
LoginType.DIRECT,
|
LoginType.DIRECT,
|
||||||
LoginType.CUSTOM,
|
LoginType.CUSTOM,
|
||||||
LoginType.UNSUPPORTED -> buildLoginUnsupportedForm()
|
LoginType.UNSUPPORTED -> buildLoginUnsupportedForm()
|
||||||
LoginType.UNKNOWN -> Unit
|
LoginType.UNKNOWN -> Unit
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue