Skip to content

Commit 041aeb3

Browse files
Synchronize functions to avoid issues on race conditions
1 parent e65c4e5 commit 041aeb3

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

libs/fluxc/src/main/java/org/wordpress/android/fluxc/network/rest/wpapi/applicationpasswords/JetpackApplicationPasswordsSupport.kt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ class JetpackApplicationPasswordsSupport @Inject constructor(
1818
) {
1919
private val fluxCPreferences by lazy { PreferenceUtils.getFluxCPreferences(context) }
2020

21+
@Synchronized
2122
fun supportsAppPasswords(siteModel: SiteModel): Boolean {
2223
val siteFlag = fluxCPreferences.getStringSet(UNSUPPORTED_JETPACK_APP_PASSWORDS_SITES, null)
2324
?.firstOrNull { it.startsWith("${siteModel.siteId}:") }
@@ -38,6 +39,7 @@ class JetpackApplicationPasswordsSupport @Inject constructor(
3839
return siteModel.isApplicationPasswordsSupported
3940
}
4041

42+
@Synchronized
4143
fun flagAsUnsupported(siteModel: SiteModel) {
4244
val unsupportedSites = fluxCPreferences.getStringSet(UNSUPPORTED_JETPACK_APP_PASSWORDS_SITES, null) ?: setOf()
4345
if (unsupportedSites.any { it.startsWith("${siteModel.siteId}:") }) {

0 commit comments

Comments
 (0)