Skip to content

Commit af64d3a

Browse files
committed
chore: run detekt auto correct and update baseline
1 parent d7de06c commit af64d3a

File tree

144 files changed

+983
-888
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

144 files changed

+983
-888
lines changed

app/src/main/kotlin/com/wire/android/datastore/UserDataStore.kt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -114,5 +114,4 @@ class UserDataStore(private val context: Context, userId: UserId) {
114114
private val ANALYTICS_DIALOG_SEEN = booleanPreferencesKey("analytics_dialog_seen")
115115
private val IS_CREATE_TEAM_NOTICE_READ = booleanPreferencesKey("is_create_team_notice_read")
116116
}
117-
118117
}

app/src/main/kotlin/com/wire/android/di/CoroutineScope.kt

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,6 @@ import javax.inject.Singleton
3333
@Qualifier
3434
annotation class ApplicationScope
3535

36-
3736
@Retention(AnnotationRetention.RUNTIME)
3837
@Qualifier
3938
annotation class DefaultDispatcher
@@ -50,7 +49,6 @@ annotation class MainDispatcher
5049
@Qualifier
5150
annotation class MainImmediateDispatcher
5251

53-
5452
@InstallIn(SingletonComponent::class)
5553
@Module
5654
object CoroutinesScopesModule {

app/src/main/kotlin/com/wire/android/feature/AccountSwitchUseCase.kt

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -109,8 +109,11 @@ class AccountSwitchUseCase @Inject constructor(
109109
}?.userId
110110
}
111111
}
112-
if (nextSessionId == null) appLogger.i("$TAG No next account to switch to")
113-
else appLogger.i("$TAG Switching to next account: ${nextSessionId.toLogString()}")
112+
if (nextSessionId == null) {
113+
appLogger.i("$TAG No next account to switch to")
114+
} else {
115+
appLogger.i("$TAG Switching to next account: ${nextSessionId.toLogString()}")
116+
}
114117
return switch(nextSessionId, current)
115118
}
116119

app/src/main/kotlin/com/wire/android/feature/ShouldStartPersistentWebSocketServiceUseCase.kt

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,8 +39,11 @@ class ShouldStartPersistentWebSocketServiceUseCase @Inject constructor(
3939
val res = result.persistentWebSocketStatusListFlow.firstOrNull()
4040
res
4141
}
42-
if (statusList != null && statusList.map { it.isPersistentWebSocketEnabled }.contains(true)) Result.Success(true)
43-
else Result.Success(false)
42+
if (statusList != null && statusList.map { it.isPersistentWebSocketEnabled }.contains(true)) {
43+
Result.Success(true)
44+
} else {
45+
Result.Success(false)
46+
}
4447
}
4548
}
4649
}

app/src/main/kotlin/com/wire/android/feature/e2ei/OAuthUseCase.kt

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,8 @@ class OAuthUseCase(
7676
_authState.performActionWithFreshTokens(authorizationService) { _, idToken, exception ->
7777
if (exception != null) {
7878
appLogger.e(
79-
message = "OAuthTokenRefreshManager: Error refreshing tokens, continue with login!", throwable = exception
79+
message = "OAuthTokenRefreshManager: Error refreshing tokens, continue with login!",
80+
throwable = exception
8081
)
8182
launchLoginFlow(activityResultRegistry, resultHandler)
8283
} else {
@@ -96,7 +97,8 @@ class OAuthUseCase(
9697
resultHandler: (OAuthResult) -> Unit
9798
) {
9899
val resultLauncher = activityResultRegistry.register(
99-
OAUTH_ACTIVITY_RESULT_KEY, ActivityResultContracts.StartActivityForResult()
100+
OAUTH_ACTIVITY_RESULT_KEY,
101+
ActivityResultContracts.StartActivityForResult()
100102
) { result ->
101103
handleActivityResult(result, resultHandler)
102104
}
@@ -158,7 +160,10 @@ class OAuthUseCase(
158160
}
159161

160162
private fun getAuthorizationRequest(clientId: String) = AuthorizationRequest.Builder(
161-
authServiceConfig, clientId, ResponseTypeValues.CODE, URL_AUTH_REDIRECT
163+
authServiceConfig,
164+
clientId,
165+
ResponseTypeValues.CODE,
166+
URL_AUTH_REDIRECT
162167
).setCodeVerifier().setScopes(
163168
AuthorizationRequest.Scope.OPENID,
164169
AuthorizationRequest.Scope.EMAIL,
@@ -171,7 +176,9 @@ class OAuthUseCase(
171176
private fun AuthorizationRequest.Builder.setCodeVerifier(): AuthorizationRequest.Builder {
172177
val codeVerifier = getCodeVerifier()
173178
setCodeVerifier(
174-
codeVerifier, getCodeChallenge(codeVerifier), CODE_VERIFIER_CHALLENGE_METHOD
179+
codeVerifier,
180+
getCodeChallenge(codeVerifier),
181+
CODE_VERIFIER_CHALLENGE_METHOD
175182
)
176183
return this
177184
}

app/src/main/kotlin/com/wire/android/mapper/MessagePreviewContentMapper.kt

Lines changed: 42 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -123,58 +123,80 @@ fun MessagePreview.uiLastMessageContent(): UILastMessageContent {
123123
UILastMessageContent.SenderWithMessage(
124124
userUIText,
125125
UIText.StringResource(
126-
if (isSelfMessage) R.string.last_message_self_user_shared_image
127-
else R.string.last_message_other_user_shared_image
126+
if (isSelfMessage) {
127+
R.string.last_message_self_user_shared_image
128+
} else {
129+
R.string.last_message_other_user_shared_image
130+
}
128131
)
129132
)
130133

131134
AssetType.VIDEO ->
132135
UILastMessageContent.SenderWithMessage(
133136
userUIText,
134137
UIText.StringResource(
135-
if (isSelfMessage) R.string.last_message_self_user_shared_video
136-
else R.string.last_message_other_user_shared_video
138+
if (isSelfMessage) {
139+
R.string.last_message_self_user_shared_video
140+
} else {
141+
R.string.last_message_other_user_shared_video
142+
}
137143
)
138144
)
139145

140146
AssetType.GENERIC_ASSET ->
141147
UILastMessageContent.SenderWithMessage(
142-
userUIText, UIText.StringResource(
143-
if (isSelfMessage) R.string.last_message_self_user_shared_asset
144-
else R.string.last_message_other_user_shared_asset
148+
userUIText,
149+
UIText.StringResource(
150+
if (isSelfMessage) {
151+
R.string.last_message_self_user_shared_asset
152+
} else {
153+
R.string.last_message_other_user_shared_asset
154+
}
145155
)
146156
)
147157
}
148158

149159
is WithUser.ConversationNameChange -> UILastMessageContent.SenderWithMessage(
150160
userUIText,
151161
UIText.StringResource(
152-
if (isSelfMessage) R.string.last_message_self_changed_conversation_name
153-
else R.string.last_message_other_changed_conversation_name
162+
if (isSelfMessage) {
163+
R.string.last_message_self_changed_conversation_name
164+
} else {
165+
R.string.last_message_other_changed_conversation_name
166+
}
154167
)
155168
)
156169

157170
is WithUser.Knock -> UILastMessageContent.SenderWithMessage(
158171
userUIText,
159172
UIText.StringResource(
160-
if (isSelfMessage) R.string.last_message_self_user_knock
161-
else R.string.last_message_other_user_knock
173+
if (isSelfMessage) {
174+
R.string.last_message_self_user_knock
175+
} else {
176+
R.string.last_message_other_user_knock
177+
}
162178
)
163179
)
164180

165181
is WithUser.MemberJoined -> UILastMessageContent.SenderWithMessage(
166182
userUIText,
167183
UIText.StringResource(
168-
if (isSelfMessage) R.string.last_message_self_user_joined_conversation
169-
else R.string.last_message_other_user_joined_conversation
184+
if (isSelfMessage) {
185+
R.string.last_message_self_user_joined_conversation
186+
} else {
187+
R.string.last_message_other_user_joined_conversation
188+
}
170189
)
171190
)
172191

173192
is WithUser.MemberLeft -> UILastMessageContent.SenderWithMessage(
174193
userUIText,
175194
UIText.StringResource(
176-
if (isSelfMessage) R.string.last_message_self_user_left_conversation
177-
else R.string.last_message_other_user_left_conversation
195+
if (isSelfMessage) {
196+
R.string.last_message_self_user_left_conversation
197+
} else {
198+
R.string.last_message_other_user_left_conversation
199+
}
178200
)
179201
)
180202

@@ -278,8 +300,11 @@ fun MessagePreview.uiLastMessageContent(): UILastMessageContent {
278300
is WithUser.Location -> UILastMessageContent.SenderWithMessage(
279301
userUIText,
280302
UIText.StringResource(
281-
if (isSelfMessage) R.string.last_message_self_user_shared_location
282-
else R.string.last_message_other_user_shared_location
303+
if (isSelfMessage) {
304+
R.string.last_message_self_user_shared_location
305+
} else {
306+
R.string.last_message_other_user_shared_location
307+
}
283308
)
284309
)
285310

app/src/main/kotlin/com/wire/android/mapper/RegularMessageContentMapper.kt

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,7 @@ class RegularMessageMapper @Inject constructor(
5656
private val isoFormatter: ISOFormatter,
5757
) {
5858

59+
@Suppress("LongMethod")
5960
fun mapMessage(
6061
message: Message.Regular,
6162
sender: User?,
@@ -84,7 +85,8 @@ class RegularMessageMapper @Inject constructor(
8485
UIText.StringResource(messageResourceProvider.memberNameYouTitlecase)
8586
} else {
8687
sender?.name.orUnknownName()
87-
}, message.isSelfMessage
88+
},
89+
message.isSelfMessage
8890
)
8991

9092
is MessageContent.RestrictedAsset -> toRestrictedAsset(

app/src/main/kotlin/com/wire/android/mapper/SystemMessageContentMapper.kt

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -286,7 +286,9 @@ class SystemMessageContentMapper @Inject constructor(
286286
UIMessageContent.SystemMessage.ConversationVerified(protocol)
287287

288288
fun mapMemberName(user: User?, type: SelfNameType = SelfNameType.NameOrDeleted): UIText = when (user) {
289-
is OtherUser -> user.name?.let { UIText.DynamicString(it) } ?: UIText.StringResource(messageResourceProvider.memberNameDeleted)
289+
is OtherUser -> user.name?.let {
290+
UIText.DynamicString(it)
291+
} ?: UIText.StringResource(messageResourceProvider.memberNameDeleted)
290292
is SelfUser -> when (type) {
291293
SelfNameType.ResourceLowercase -> UIText.StringResource(messageResourceProvider.memberNameYouLowercase)
292294
SelfNameType.ResourceTitleCase -> UIText.StringResource(messageResourceProvider.memberNameYouTitlecase)
@@ -308,8 +310,11 @@ class SystemMessageContentMapper @Inject constructor(
308310
self: () -> UIMessageContent.SystemMessage.LegalHold,
309311
others: (List<UIText>) -> UIMessageContent.SystemMessage.LegalHold
310312
): UIMessageContent.SystemMessage.LegalHold =
311-
if (members.size == 1 && senderUserId == members.first()) self()
312-
else others(members.map { mapMemberName(user = userList.findUser(userId = it), type = SelfNameType.ResourceLowercase) })
313+
if (members.size == 1 && senderUserId == members.first()) {
314+
self()
315+
} else {
316+
others(members.map { mapMemberName(user = userList.findUser(userId = it), type = SelfNameType.ResourceLowercase) })
317+
}
313318

314319
return when (content) {
315320
MessageContent.LegalHold.ForConversation.Disabled -> UIMessageContent.SystemMessage.LegalHold.Disabled.Conversation

app/src/main/kotlin/com/wire/android/mapper/UserTypeMapper.kt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,5 +34,4 @@ class UserTypeMapper @Inject constructor() {
3434
UserType.ADMIN -> Membership.Admin
3535
UserType.OWNER -> Membership.Owner
3636
}
37-
3837
}

app/src/main/kotlin/com/wire/android/media/CallRinger.kt

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -75,23 +75,22 @@ class CallRinger @Inject constructor(private val context: Context) {
7575
stop()
7676
vibrateIfNeeded(isIncomingCall)
7777
createMediaPlayer(resource, isLooping)
78-
appLogger.i("Starting ringing | isIncomingCall: $isIncomingCall");
78+
appLogger.i("Starting ringing | isIncomingCall: $isIncomingCall")
7979
mediaPlayer?.start()
8080
}
8181

82-
8382
@Suppress("NestedBlockDepth")
8483
private fun vibrateIfNeeded(isIncomingCall: Boolean) {
8584
if (isIncomingCall) {
8685
vibrator?.let {
8786
if (!it.hasVibrator()) {
88-
appLogger.i("Device does not support vibration");
87+
appLogger.i("Device does not support vibration")
8988
return
9089
}
9190
val audioManager = context.getSystemService(Context.AUDIO_SERVICE) as AudioManager?
9291
val ringerMode = audioManager?.ringerMode
9392
if (ringerMode == AudioManager.RINGER_MODE_VIBRATE) {
94-
appLogger.i("Starting vibration");
93+
appLogger.i("Starting vibration")
9594
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
9695
it.cancel()
9796
it.vibrate(VibrationEffect.createWaveform(VIBRATE_PATTERN, 1))

0 commit comments

Comments
 (0)