mirror of
https://github.com/element-hq/element-android
synced 2024-11-24 10:25:35 +03:00
Run ./gradlew ktlintFormat
This commit is contained in:
parent
b7f0efbeb1
commit
f5375c7af2
9 changed files with 48 additions and 58 deletions
|
@ -91,8 +91,8 @@ private fun toFailure(errorBody: ResponseBody?, httpCode: Int, globalErrorReceiv
|
||||||
matrixError.code == MatrixError.M_CONSENT_NOT_GIVEN && !matrixError.consentUri.isNullOrBlank() -> {
|
matrixError.code == MatrixError.M_CONSENT_NOT_GIVEN && !matrixError.consentUri.isNullOrBlank() -> {
|
||||||
globalErrorReceiver?.handleGlobalError(GlobalError.ConsentNotGivenError(matrixError.consentUri))
|
globalErrorReceiver?.handleGlobalError(GlobalError.ConsentNotGivenError(matrixError.consentUri))
|
||||||
}
|
}
|
||||||
httpCode == HttpURLConnection.HTTP_UNAUTHORIZED /* 401 */
|
httpCode == HttpURLConnection.HTTP_UNAUTHORIZED && /* 401 */
|
||||||
&& matrixError.code == MatrixError.M_UNKNOWN_TOKEN -> {
|
matrixError.code == MatrixError.M_UNKNOWN_TOKEN -> {
|
||||||
globalErrorReceiver?.handleGlobalError(GlobalError.InvalidToken(matrixError.isSoftLogout.orFalse()))
|
globalErrorReceiver?.handleGlobalError(GlobalError.InvalidToken(matrixError.isSoftLogout.orFalse()))
|
||||||
}
|
}
|
||||||
matrixError.code == MatrixError.ORG_MATRIX_EXPIRED_ACCOUNT -> {
|
matrixError.code == MatrixError.ORG_MATRIX_EXPIRED_ACCOUNT -> {
|
||||||
|
|
|
@ -30,9 +30,9 @@ import androidx.test.espresso.matcher.ViewMatchers.withClassName
|
||||||
import androidx.test.espresso.matcher.ViewMatchers.withId
|
import androidx.test.espresso.matcher.ViewMatchers.withId
|
||||||
import androidx.test.espresso.matcher.ViewMatchers.withText
|
import androidx.test.espresso.matcher.ViewMatchers.withText
|
||||||
import im.vector.app.R
|
import im.vector.app.R
|
||||||
import org.hamcrest.Matchers.`is`
|
|
||||||
import org.hamcrest.Matchers.allOf
|
import org.hamcrest.Matchers.allOf
|
||||||
import org.hamcrest.Matchers.instanceOf
|
import org.hamcrest.Matchers.instanceOf
|
||||||
|
import org.hamcrest.Matchers.`is`
|
||||||
|
|
||||||
fun clickOnPreference(@StringRes textResId: Int) {
|
fun clickOnPreference(@StringRes textResId: Int) {
|
||||||
onView(withId(R.id.recycler_view))
|
onView(withId(R.id.recycler_view))
|
||||||
|
|
|
@ -89,12 +89,12 @@ class DefaultErrorFormatter @Inject constructor(
|
||||||
throwable.error.code == MatrixError.M_USER_DEACTIVATED -> {
|
throwable.error.code == MatrixError.M_USER_DEACTIVATED -> {
|
||||||
stringProvider.getString(R.string.auth_invalid_login_deactivated_account)
|
stringProvider.getString(R.string.auth_invalid_login_deactivated_account)
|
||||||
}
|
}
|
||||||
throwable.error.code == MatrixError.M_THREEPID_IN_USE
|
throwable.error.code == MatrixError.M_THREEPID_IN_USE &&
|
||||||
&& throwable.error.message == "Email is already in use" -> {
|
throwable.error.message == "Email is already in use" -> {
|
||||||
stringProvider.getString(R.string.account_email_already_used_error)
|
stringProvider.getString(R.string.account_email_already_used_error)
|
||||||
}
|
}
|
||||||
throwable.error.code == MatrixError.M_THREEPID_IN_USE
|
throwable.error.code == MatrixError.M_THREEPID_IN_USE &&
|
||||||
&& throwable.error.message == "MSISDN is already in use" -> {
|
throwable.error.message == "MSISDN is already in use" -> {
|
||||||
stringProvider.getString(R.string.account_phone_number_already_used_error)
|
stringProvider.getString(R.string.account_phone_number_already_used_error)
|
||||||
}
|
}
|
||||||
throwable.error.code == MatrixError.M_THREEPID_AUTH_FAILED -> {
|
throwable.error.code == MatrixError.M_THREEPID_AUTH_FAILED -> {
|
||||||
|
|
|
@ -221,8 +221,8 @@ class MainActivity : VectorBaseActivity<ActivityMainBinding>(), UnlockedActivity
|
||||||
private fun startNextActivityAndFinish(ignoreClearCredentials: Boolean = false) {
|
private fun startNextActivityAndFinish(ignoreClearCredentials: Boolean = false) {
|
||||||
val intent = when {
|
val intent = when {
|
||||||
args.clearCredentials &&
|
args.clearCredentials &&
|
||||||
!ignoreClearCredentials
|
!ignoreClearCredentials &&
|
||||||
&& (!args.isUserLoggedOut || args.isAccountDeactivated) -> {
|
(!args.isUserLoggedOut || args.isAccountDeactivated) -> {
|
||||||
// User has explicitly asked to log out or deactivated his account
|
// User has explicitly asked to log out or deactivated his account
|
||||||
navigator.openLogin(this, null)
|
navigator.openLogin(this, null)
|
||||||
null
|
null
|
||||||
|
|
|
@ -78,7 +78,6 @@ class ShortcutCreator @Inject constructor(
|
||||||
.setLongLived(true)
|
.setLongLived(true)
|
||||||
.setRank(rank)
|
.setRank(rank)
|
||||||
.setCategories(categories)
|
.setCategories(categories)
|
||||||
|
|
||||||
.build()
|
.build()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -781,8 +781,8 @@ class LoginViewModel @AssistedInject constructor(
|
||||||
|
|
||||||
val loginMode = when {
|
val loginMode = when {
|
||||||
// SSO login is taken first
|
// SSO login is taken first
|
||||||
data.supportedLoginTypes.contains(LoginFlowTypes.SSO)
|
data.supportedLoginTypes.contains(LoginFlowTypes.SSO) &&
|
||||||
&& data.supportedLoginTypes.contains(LoginFlowTypes.PASSWORD) -> LoginMode.SsoAndPassword(data.ssoIdentityProviders)
|
data.supportedLoginTypes.contains(LoginFlowTypes.PASSWORD) -> LoginMode.SsoAndPassword(data.ssoIdentityProviders)
|
||||||
data.supportedLoginTypes.contains(LoginFlowTypes.SSO) -> LoginMode.Sso(data.ssoIdentityProviders)
|
data.supportedLoginTypes.contains(LoginFlowTypes.SSO) -> LoginMode.Sso(data.ssoIdentityProviders)
|
||||||
data.supportedLoginTypes.contains(LoginFlowTypes.PASSWORD) -> LoginMode.Password
|
data.supportedLoginTypes.contains(LoginFlowTypes.PASSWORD) -> LoginMode.Password
|
||||||
else -> LoginMode.Unsupported
|
else -> LoginMode.Unsupported
|
||||||
|
|
|
@ -630,8 +630,8 @@ class LoginViewModel2 @AssistedInject constructor(
|
||||||
} ?: return
|
} ?: return
|
||||||
|
|
||||||
val loginMode = when {
|
val loginMode = when {
|
||||||
data.supportedLoginTypes.contains(LoginFlowTypes.SSO)
|
data.supportedLoginTypes.contains(LoginFlowTypes.SSO) &&
|
||||||
&& data.supportedLoginTypes.contains(LoginFlowTypes.PASSWORD) -> LoginMode.SsoAndPassword(data.ssoIdentityProviders)
|
data.supportedLoginTypes.contains(LoginFlowTypes.PASSWORD) -> LoginMode.SsoAndPassword(data.ssoIdentityProviders)
|
||||||
data.supportedLoginTypes.contains(LoginFlowTypes.SSO) -> LoginMode.Sso(data.ssoIdentityProviders)
|
data.supportedLoginTypes.contains(LoginFlowTypes.SSO) -> LoginMode.Sso(data.ssoIdentityProviders)
|
||||||
data.supportedLoginTypes.contains(LoginFlowTypes.PASSWORD) -> LoginMode.Password
|
data.supportedLoginTypes.contains(LoginFlowTypes.PASSWORD) -> LoginMode.Password
|
||||||
else -> LoginMode.Unsupported
|
else -> LoginMode.Unsupported
|
||||||
|
@ -757,8 +757,8 @@ class LoginViewModel2 @AssistedInject constructor(
|
||||||
rememberHomeServer(homeServerConnectionConfig.homeServerUri.toString())
|
rememberHomeServer(homeServerConnectionConfig.homeServerUri.toString())
|
||||||
|
|
||||||
val loginMode = when {
|
val loginMode = when {
|
||||||
data.supportedLoginTypes.contains(LoginFlowTypes.SSO)
|
data.supportedLoginTypes.contains(LoginFlowTypes.SSO) &&
|
||||||
&& data.supportedLoginTypes.contains(LoginFlowTypes.PASSWORD) -> LoginMode.SsoAndPassword(data.ssoIdentityProviders)
|
data.supportedLoginTypes.contains(LoginFlowTypes.PASSWORD) -> LoginMode.SsoAndPassword(data.ssoIdentityProviders)
|
||||||
data.supportedLoginTypes.contains(LoginFlowTypes.SSO) -> LoginMode.Sso(data.ssoIdentityProviders)
|
data.supportedLoginTypes.contains(LoginFlowTypes.SSO) -> LoginMode.Sso(data.ssoIdentityProviders)
|
||||||
data.supportedLoginTypes.contains(LoginFlowTypes.PASSWORD) -> LoginMode.Password
|
data.supportedLoginTypes.contains(LoginFlowTypes.PASSWORD) -> LoginMode.Password
|
||||||
else -> LoginMode.Unsupported
|
else -> LoginMode.Unsupported
|
||||||
|
|
|
@ -543,36 +543,27 @@ class NotificationUtils @Inject constructor(private val context: Context,
|
||||||
.setWhen(lastMessageTimestamp)
|
.setWhen(lastMessageTimestamp)
|
||||||
// MESSAGING_STYLE sets title and content for API 16 and above devices.
|
// MESSAGING_STYLE sets title and content for API 16 and above devices.
|
||||||
.setStyle(messageStyle)
|
.setStyle(messageStyle)
|
||||||
|
|
||||||
// A category allows groups of notifications to be ranked and filtered – per user or system settings.
|
// A category allows groups of notifications to be ranked and filtered – per user or system settings.
|
||||||
// For example, alarm notifications should display before promo notifications, or message from known contact
|
// For example, alarm notifications should display before promo notifications, or message from known contact
|
||||||
// that can be displayed in not disturb mode if white listed (the later will need compat28.x)
|
// that can be displayed in not disturb mode if white listed (the later will need compat28.x)
|
||||||
.setCategory(NotificationCompat.CATEGORY_MESSAGE)
|
.setCategory(NotificationCompat.CATEGORY_MESSAGE)
|
||||||
|
|
||||||
// ID of the corresponding shortcut, for conversation features under API 30+
|
// ID of the corresponding shortcut, for conversation features under API 30+
|
||||||
.setShortcutId(roomInfo.roomId)
|
.setShortcutId(roomInfo.roomId)
|
||||||
|
|
||||||
// Title for API < 16 devices.
|
// Title for API < 16 devices.
|
||||||
.setContentTitle(roomInfo.roomDisplayName)
|
.setContentTitle(roomInfo.roomDisplayName)
|
||||||
// Content for API < 16 devices.
|
// Content for API < 16 devices.
|
||||||
.setContentText(stringProvider.getString(R.string.notification_new_messages))
|
.setContentText(stringProvider.getString(R.string.notification_new_messages))
|
||||||
|
|
||||||
// Number of new notifications for API <24 (M and below) devices.
|
// Number of new notifications for API <24 (M and below) devices.
|
||||||
.setSubText(stringProvider.getQuantityString(R.plurals.room_new_messages_notification, messageStyle.messages.size, messageStyle.messages.size))
|
.setSubText(stringProvider.getQuantityString(R.plurals.room_new_messages_notification, messageStyle.messages.size, messageStyle.messages.size))
|
||||||
|
|
||||||
// Auto-bundling is enabled for 4 or more notifications on API 24+ (N+)
|
// Auto-bundling is enabled for 4 or more notifications on API 24+ (N+)
|
||||||
// devices and all Wear devices. But we want a custom grouping, so we specify the groupID
|
// devices and all Wear devices. But we want a custom grouping, so we specify the groupID
|
||||||
// TODO Group should be current user display name
|
// TODO Group should be current user display name
|
||||||
.setGroup(stringProvider.getString(R.string.app_name))
|
.setGroup(stringProvider.getString(R.string.app_name))
|
||||||
|
|
||||||
// In order to avoid notification making sound twice (due to the summary notification)
|
// In order to avoid notification making sound twice (due to the summary notification)
|
||||||
.setGroupAlertBehavior(NotificationCompat.GROUP_ALERT_SUMMARY)
|
.setGroupAlertBehavior(NotificationCompat.GROUP_ALERT_SUMMARY)
|
||||||
|
|
||||||
.setSmallIcon(smallIcon)
|
.setSmallIcon(smallIcon)
|
||||||
|
|
||||||
// Set primary color (important for Wear 2.0 Notifications).
|
// Set primary color (important for Wear 2.0 Notifications).
|
||||||
.setColor(accentColor)
|
.setColor(accentColor)
|
||||||
|
|
||||||
// Sets priority for 25 and below. For 26 and above, 'priority' is deprecated for
|
// Sets priority for 25 and below. For 26 and above, 'priority' is deprecated for
|
||||||
// 'importance' which is set in the NotificationChannel. The integers representing
|
// 'importance' which is set in the NotificationChannel. The integers representing
|
||||||
// 'priority' are different from 'importance', so make sure you don't mix them.
|
// 'priority' are different from 'importance', so make sure you don't mix them.
|
||||||
|
|
|
@ -103,8 +103,8 @@ class SoftLogoutViewModel @AssistedInject constructor(
|
||||||
|
|
||||||
val loginMode = when {
|
val loginMode = when {
|
||||||
// SSO login is taken first
|
// SSO login is taken first
|
||||||
data.supportedLoginTypes.contains(LoginFlowTypes.SSO)
|
data.supportedLoginTypes.contains(LoginFlowTypes.SSO) &&
|
||||||
&& data.supportedLoginTypes.contains(LoginFlowTypes.PASSWORD) -> LoginMode.SsoAndPassword(data.ssoIdentityProviders)
|
data.supportedLoginTypes.contains(LoginFlowTypes.PASSWORD) -> LoginMode.SsoAndPassword(data.ssoIdentityProviders)
|
||||||
data.supportedLoginTypes.contains(LoginFlowTypes.SSO) -> LoginMode.Sso(data.ssoIdentityProviders)
|
data.supportedLoginTypes.contains(LoginFlowTypes.SSO) -> LoginMode.Sso(data.ssoIdentityProviders)
|
||||||
data.supportedLoginTypes.contains(LoginFlowTypes.PASSWORD) -> LoginMode.Password
|
data.supportedLoginTypes.contains(LoginFlowTypes.PASSWORD) -> LoginMode.Password
|
||||||
else -> LoginMode.Unsupported
|
else -> LoginMode.Unsupported
|
||||||
|
|
Loading…
Reference in a new issue