Skip to content

Commit a39dbb4

Browse files
authored
Merge branch 'trunk' into issue/menus-beta-pill
2 parents 99f7cac + 5816731 commit a39dbb4

File tree

42 files changed

+167
-116
lines changed

Some content is hidden

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

42 files changed

+167
-116
lines changed

WordPress/src/main/java/org/wordpress/android/inappupdate/InAppUpdateManagerImpl.kt

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
package org.wordpress.android.inappupdate
22

33
import android.annotation.SuppressLint
4+
import androidx.core.content.edit
45
import android.app.Activity
56
import android.content.Context
67
import android.util.Log
@@ -190,19 +191,17 @@ class InAppUpdateManagerImpl(
190191

191192
private fun saveLastUpdateRequestInfo(appUpdateInfo: AppUpdateInfo) {
192193
val sharedPref = applicationContext.getSharedPreferences(PREF_NAME, Context.MODE_PRIVATE)
193-
sharedPref.edit().apply {
194+
sharedPref.edit {
194195
putInt(KEY_LAST_APP_UPDATE_CHECK_VERSION, getAvailableUpdateAppVersion(appUpdateInfo))
195196
putLong(KEY_LAST_APP_UPDATE_CHECK_TIME, currentTimeProvider.invoke())
196-
apply()
197197
}
198198
}
199199

200200
private fun resetLastUpdateRequestInfo() {
201201
val sharedPref = applicationContext.getSharedPreferences(PREF_NAME, Context.MODE_PRIVATE)
202-
sharedPref.edit().apply {
202+
sharedPref.edit {
203203
putInt(KEY_LAST_APP_UPDATE_CHECK_VERSION, -1)
204204
putLong(KEY_LAST_APP_UPDATE_CHECK_TIME, -1L)
205-
apply()
206205
}
207206
}
208207

WordPress/src/main/java/org/wordpress/android/localcontentmigration/LocalMigrationResult.kt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,8 @@ fun <T : LocalContentEntityData, E : LocalMigrationError> LocalMigrationResult<T
5757
*/
5858
inline fun <T : Any?, U : LocalContentEntityData, E : LocalMigrationError> Iterable<T>.foldAllToSingleResult(
5959
transform: (T) -> LocalMigrationResult<U, E>,
60-
) = fold(EmptyResult) { current: LocalMigrationResult<LocalContentEntityData, LocalMigrationError>, item ->
60+
): LocalMigrationResult<LocalContentEntityData, LocalMigrationError> =
61+
fold(EmptyResult) { current: LocalMigrationResult<LocalContentEntityData, LocalMigrationError>, item ->
6162
when (val result = transform(item)) {
6263
is Failure -> return result
6364
else -> current

WordPress/src/main/java/org/wordpress/android/networking/restapi/WpComApiClientProvider.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ class WpComApiClientProvider @Inject constructor() {
2222

2323
return WpComApiClient(
2424
requestExecutor = WpRequestExecutor(httpClient = WpHttpClient.CustomOkHttpClient(okHttpClient)),
25-
authProvider = WpAuthenticationProvider.staticWithAuth(WpAuthentication.Bearer(token = accessToken!!)
25+
authProvider = WpAuthenticationProvider.staticWithAuth(WpAuthentication.Bearer(token = accessToken)
2626
)
2727
)
2828
}

WordPress/src/main/java/org/wordpress/android/support/he/ui/HESupportViewModel.kt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
package org.wordpress.android.support.he.ui
22

3+
import android.annotation.SuppressLint
34
import android.app.Application
45
import android.net.Uri
56
import androidx.lifecycle.viewModelScope
@@ -316,6 +317,7 @@ class HESupportViewModel @Inject constructor(
316317
)
317318
}
318319

320+
@SuppressLint("Recycle") // False positive: descriptor is closed via .use {}
319321
@Suppress("TooGenericExceptionCaught")
320322
private suspend fun getFileSize(uri: Uri): Long? = withContext(ioDispatcher) {
321323
try {

WordPress/src/main/java/org/wordpress/android/support/he/util/TempAttachmentsUtil.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,7 @@ class TempAttachmentsUtil @Inject constructor(
119119
AppLog.d(AppLog.T.SUPPORT, "Download response code: $responseCode")
120120

121121
if (response.isSuccessful) {
122-
response.body?.byteStream()?.use { input ->
122+
response.body.byteStream().use { input ->
123123
tempFile.outputStream().use { output ->
124124
input.copyTo(output)
125125
}

WordPress/src/main/java/org/wordpress/android/ui/blaze/blazecampaigns/campaignlisting/CampaignListingUIModelMapper.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ class CampaignListingUIModelMapper @Inject constructor(
1717

1818
private fun mapToCampaignModel(campaignModel:BlazeCampaignModel): CampaignModel {
1919
return CampaignModel(
20-
id = campaignModel.campaignId.toString(),
20+
id = campaignModel.campaignId,
2121
title = UiString.UiStringText(campaignModel.title),
2222
status = CampaignStatus.fromString(campaignModel.uiStatus),
2323
featureImageUrl = campaignModel.imageUrl,

WordPress/src/main/java/org/wordpress/android/ui/debug/DebugSettingsViewModel.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -140,7 +140,7 @@ class DebugSettingsViewModel
140140
return RemoteFieldConfigDefaults.remoteFieldConfigDefaults.mapNotNull { remoteField ->
141141
val remoteConfig = remoteConfigFields.find { remoteField.key == it.key }
142142
remoteConfig?.let {
143-
Field(remoteField.key, remoteConfig.value.toString(), remoteConfig.source.toString())
143+
Field(remoteField.key, remoteConfig.value, remoteConfig.source.toString())
144144
}
145145
}.sortedBy { it.remoteFieldKey }
146146
}

WordPress/src/main/java/org/wordpress/android/ui/jetpackoverlay/JetpackFeatureRemovalBrandingUtil.kt

Lines changed: 12 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -119,22 +119,18 @@ class JetpackFeatureRemovalBrandingUtil @Inject constructor(
119119

120120
private fun getQuantityUiString(interval: Pluralisable): UiStringPluralRes {
121121
return when (interval) {
122-
is Weeks -> (interval as? Weeks)?.run {
123-
UiStringPluralRes(
124-
zeroRes = otherRes,
125-
oneRes = oneRes,
126-
otherRes = otherRes,
127-
count = number.toInt(),
128-
)
129-
} ?: error("Pluralisable interval should be of type Weeks")
130-
is Days -> (interval as? Days)?.run {
131-
UiStringPluralRes(
132-
zeroRes = otherRes,
133-
oneRes = oneRes,
134-
otherRes = otherRes,
135-
count = number.toInt(),
136-
)
137-
} ?: error("Pluralisable interval should be of type Days")
122+
is Weeks -> UiStringPluralRes(
123+
zeroRes = interval.otherRes,
124+
oneRes = interval.oneRes,
125+
otherRes = interval.otherRes,
126+
count = interval.number.toInt(),
127+
)
128+
is Days -> UiStringPluralRes(
129+
zeroRes = interval.otherRes,
130+
oneRes = interval.oneRes,
131+
otherRes = interval.otherRes,
132+
count = interval.number.toInt(),
133+
)
138134
}
139135
}
140136
}

WordPress/src/main/java/org/wordpress/android/ui/media/VideoLoader.kt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
package org.wordpress.android.ui.media
22

3+
import android.annotation.SuppressLint
34
import android.content.Context
45
import android.net.Uri
56
import androidx.core.net.toUri
@@ -61,6 +62,7 @@ class VideoLoader
6162
}
6263
}
6364

65+
@SuppressLint("Recycle") // False positive: cursor is closed via .use {}
6466
private fun getSizeFromContentUri(contentUri: Uri) =
6567
appContext.contentResolver.query(contentUri, null, null, null, null, null).use { cursor ->
6668
cursor?.moveToFirst()?.takeIf { true }?.let {

WordPress/src/main/java/org/wordpress/android/ui/mediapicker/MediaPickerViewModel.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,7 @@ class MediaPickerViewModel @Inject constructor(
124124
filter = domainModel?.filter,
125125
searchExpanded = searchExpanded
126126
),
127-
!domainModel?.domainItems.isNullOrEmpty() && domainModel?.isLoading == true,
127+
!domainModel?.domainItems.isNullOrEmpty() && domainModel.isLoading == true,
128128
buildBrowseMenuUiModel(softAskRequest, searchExpanded),
129129
progressDialogUiModel ?: Hidden,
130130
showPartialAccessPrompt ?: false,

0 commit comments

Comments
 (0)