From c6abd4c75a4c1577502cdc88d99c4f901e661bb0 Mon Sep 17 00:00:00 2001 From: joeloewi7178 Date: Mon, 15 Jan 2024 15:45:42 +0900 Subject: [PATCH 1/5] mod: disable autofill dialog when login to hoyolab --- .../navigation/main/attendances/screen/LoginHoYoLABScreen.kt | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/app/src/main/kotlin/com/joeloewi/croissant/ui/navigation/main/attendances/screen/LoginHoYoLABScreen.kt b/app/src/main/kotlin/com/joeloewi/croissant/ui/navigation/main/attendances/screen/LoginHoYoLABScreen.kt index 33b654d7..06a5043a 100644 --- a/app/src/main/kotlin/com/joeloewi/croissant/ui/navigation/main/attendances/screen/LoginHoYoLABScreen.kt +++ b/app/src/main/kotlin/com/joeloewi/croissant/ui/navigation/main/attendances/screen/LoginHoYoLABScreen.kt @@ -5,7 +5,9 @@ import android.app.Dialog import android.content.Intent import android.graphics.Bitmap import android.net.http.SslError +import android.os.Build import android.os.Message +import android.view.View import android.view.ViewGroup import android.webkit.* import androidx.compose.foundation.layout.* @@ -251,6 +253,9 @@ fun LoginHoYoLABContent( navigator = webViewNavigator, onCreated = { webView -> with(webView) { + if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) { + importantForAutofill = View.IMPORTANT_FOR_AUTOFILL_NO + } settings.apply { javaScriptEnabled = true domStorageEnabled = true From cfaf2c6f17ea09a7d67a92c64e907904105a83bb Mon Sep 17 00:00:00 2001 From: joeloewi7178 Date: Tue, 16 Jan 2024 17:26:03 +0900 Subject: [PATCH 2/5] mod: bound to provided network when do job in worker --- .../joeloewi/croissant/util/WorkExtensions.kt | 28 ++ .../worker/AttendCheckInEventWorker.kt | 248 +++++++++--------- .../croissant/worker/CheckSessionWorker.kt | 125 ++++----- .../worker/RefreshResinStatusWorker.kt | 171 ++++++------ 4 files changed, 306 insertions(+), 266 deletions(-) create mode 100644 app/src/main/kotlin/com/joeloewi/croissant/util/WorkExtensions.kt diff --git a/app/src/main/kotlin/com/joeloewi/croissant/util/WorkExtensions.kt b/app/src/main/kotlin/com/joeloewi/croissant/util/WorkExtensions.kt new file mode 100644 index 00000000..1b9a78ec --- /dev/null +++ b/app/src/main/kotlin/com/joeloewi/croissant/util/WorkExtensions.kt @@ -0,0 +1,28 @@ +package com.joeloewi.croissant.util + +import android.net.ConnectivityManager +import android.os.Build +import androidx.core.content.getSystemService +import androidx.work.CoroutineWorker + +suspend fun CoroutineWorker.withBoundNetwork(block: suspend () -> T): T { + val connectivityManager = applicationContext.getSystemService() + + return if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.P) { + if (network != null) { + val shouldBeUnbound = connectivityManager?.bindProcessToNetwork(network) + + try { + block() + } finally { + if (shouldBeUnbound == true) { + connectivityManager.bindProcessToNetwork(null) + } + } + } else { + block() + } + } else { + block() + } +} \ No newline at end of file diff --git a/app/src/main/kotlin/com/joeloewi/croissant/worker/AttendCheckInEventWorker.kt b/app/src/main/kotlin/com/joeloewi/croissant/worker/AttendCheckInEventWorker.kt index 5b05074f..2385d7c2 100644 --- a/app/src/main/kotlin/com/joeloewi/croissant/worker/AttendCheckInEventWorker.kt +++ b/app/src/main/kotlin/com/joeloewi/croissant/worker/AttendCheckInEventWorker.kt @@ -1,6 +1,7 @@ package com.joeloewi.croissant.worker import android.content.Context +import android.net.ConnectivityManager import androidx.hilt.work.HiltWorker import androidx.work.CoroutineWorker import androidx.work.ForegroundInfo @@ -21,6 +22,7 @@ import com.joeloewi.croissant.domain.usecase.FailureLogUseCase import com.joeloewi.croissant.domain.usecase.SuccessLogUseCase import com.joeloewi.croissant.domain.usecase.WorkerExecutionLogUseCase import com.joeloewi.croissant.util.NotificationGenerator +import com.joeloewi.croissant.util.withBoundNetwork import dagger.assisted.Assisted import dagger.assisted.AssistedInject import kotlinx.coroutines.CancellationException @@ -40,7 +42,8 @@ class AttendCheckInEventWorker @AssistedInject constructor( private val insertWorkerExecutionLogUseCase: WorkerExecutionLogUseCase.Insert, private val insertSuccessLogUseCase: SuccessLogUseCase.Insert, private val insertFailureLogUseCase: FailureLogUseCase.Insert, - private val notificationGenerator: NotificationGenerator + private val notificationGenerator: NotificationGenerator, + private val connectivityManager: ConnectivityManager ) : CoroutineWorker( appContext = context, params = params @@ -87,146 +90,149 @@ class AttendCheckInEventWorker @AssistedInject constructor( override suspend fun doWork(): Result = withContext(Dispatchers.IO) { setForeground(notificationGenerator.createForegroundInfo(_attendanceId.toInt())) - _attendanceId.runCatching { - takeIf { it != Long.MIN_VALUE }!! - }.mapCatching { attendanceId -> - //check session is valid - val attendanceWithGames = getOneAttendanceUseCase(attendanceId) - val cookie = attendanceWithGames.attendance.cookie - - //attend check in events - attendanceWithGames.games.forEach { game -> - try { - when (game.type) { - HoYoLABGame.HonkaiImpact3rd -> { - attendCheckInHonkaiImpact3rdUseCase(cookie = cookie) - } - - HoYoLABGame.GenshinImpact -> { - attendCheckInGenshinImpactUseCase(cookie = cookie) - } - HoYoLABGame.TearsOfThemis -> { - attendCheckInTearsOfThemisUseCase(cookie = cookie) - } + withBoundNetwork { + _attendanceId.runCatching { + takeIf { it != Long.MIN_VALUE }!! + }.mapCatching { attendanceId -> + //check session is valid + val attendanceWithGames = getOneAttendanceUseCase(attendanceId) + val cookie = attendanceWithGames.attendance.cookie + + //attend check in events + attendanceWithGames.games.forEach { game -> + try { + when (game.type) { + HoYoLABGame.HonkaiImpact3rd -> { + attendCheckInHonkaiImpact3rdUseCase(cookie = cookie) + } - HoYoLABGame.HonkaiStarRail -> { - attendCheckInHonkaiStarRail(cookie = cookie) - } + HoYoLABGame.GenshinImpact -> { + attendCheckInGenshinImpactUseCase(cookie = cookie) + } - HoYoLABGame.Unknown -> { - throw Exception() - } - }.getOrThrow().also { response -> - notificationGenerator.createSuccessfulAttendanceNotification( - nickname = attendanceWithGames.attendance.nickname, - hoYoLABGame = game.type, - region = game.region, - message = response.message, - retCode = response.retCode - ).let { notification -> - notificationGenerator.safeNotify( - UUID.randomUUID().toString(), - game.type.gameId, - notification - ) - } + HoYoLABGame.TearsOfThemis -> { + attendCheckInTearsOfThemisUseCase(cookie = cookie) + } - val executionLogId = insertWorkerExecutionLogUseCase( - WorkerExecutionLog( - attendanceId = attendanceId, - state = WorkerExecutionLogState.SUCCESS, - loggableWorker = LoggableWorker.ATTEND_CHECK_IN_EVENT - ) - ) - - insertSuccessLogUseCase( - SuccessLog( - executionLogId = executionLogId, - gameName = game.type, - retCode = response.retCode, - message = response.message - ) - ) - } - } catch (cause: CancellationException) { - throw cause - } catch (cause: Throwable) { - if (cause is HoYoLABUnsuccessfulResponseException) { - when (HoYoLABRetCode.findByCode(cause.retCode)) { - HoYoLABRetCode.AlreadyCheckedIn, HoYoLABRetCode.CharacterNotExists -> { - //do not log to crashlytics + HoYoLABGame.HonkaiStarRail -> { + attendCheckInHonkaiStarRail(cookie = cookie) } - else -> { - Firebase.crashlytics.apply { - log(this@AttendCheckInEventWorker.javaClass.simpleName) - recordException(cause) - } + HoYoLABGame.Unknown -> { + throw Exception() } - } + }.getOrThrow().also { response -> + notificationGenerator.createSuccessfulAttendanceNotification( + nickname = attendanceWithGames.attendance.nickname, + hoYoLABGame = game.type, + region = game.region, + message = response.message, + retCode = response.retCode + ).let { notification -> + notificationGenerator.safeNotify( + UUID.randomUUID().toString(), + game.type.gameId, + notification + ) + } + + val executionLogId = insertWorkerExecutionLogUseCase( + WorkerExecutionLog( + attendanceId = attendanceId, + state = WorkerExecutionLogState.SUCCESS, + loggableWorker = LoggableWorker.ATTEND_CHECK_IN_EVENT + ) + ) - createUnsuccessfulAttendanceNotification( - nickname = attendanceWithGames.attendance.nickname, - hoYoLABGame = game.type, - region = game.region, - hoYoLABUnsuccessfulResponseException = cause - ).let { notification -> - notificationGenerator.safeNotify( - UUID.randomUUID().toString(), - game.type.gameId, - notification + insertSuccessLogUseCase( + SuccessLog( + executionLogId = executionLogId, + gameName = game.type, + retCode = response.retCode, + message = response.message + ) ) } - } else { - //if result is unsuccessful with unknown error - //retry for three times + } catch (cause: CancellationException) { + throw cause + } catch (cause: Throwable) { + if (cause is HoYoLABUnsuccessfulResponseException) { + when (HoYoLABRetCode.findByCode(cause.retCode)) { + HoYoLABRetCode.AlreadyCheckedIn, HoYoLABRetCode.CharacterNotExists -> { + //do not log to crashlytics + } - /*if (runAttemptCount > 3) { - addFailureLog(attendanceId, cause) + else -> { + Firebase.crashlytics.apply { + log(this@AttendCheckInEventWorker.javaClass.simpleName) + recordException(cause) + } + } + } + + createUnsuccessfulAttendanceNotification( + nickname = attendanceWithGames.attendance.nickname, + hoYoLABGame = game.type, + region = game.region, + hoYoLABUnsuccessfulResponseException = cause + ).let { notification -> + notificationGenerator.safeNotify( + UUID.randomUUID().toString(), + game.type.gameId, + notification + ) + } } else { + //if result is unsuccessful with unknown error + //retry for three times - }*/ - Firebase.crashlytics.apply { - log(this@AttendCheckInEventWorker.javaClass.simpleName) - recordException(cause) - } + /*if (runAttemptCount > 3) { + addFailureLog(attendanceId, cause) + } else { - notificationGenerator.createUnsuccessfulAttendanceNotification( - nickname = attendanceWithGames.attendance.nickname, - hoYoLABGame = game.type, - attendanceId = _attendanceId - ).let { notification -> - notificationGenerator.safeNotify( - UUID.randomUUID().toString(), - game.type.gameId, - notification - ) + }*/ + Firebase.crashlytics.apply { + log(this@AttendCheckInEventWorker.javaClass.simpleName) + recordException(cause) + } + + notificationGenerator.createUnsuccessfulAttendanceNotification( + nickname = attendanceWithGames.attendance.nickname, + hoYoLABGame = game.type, + attendanceId = _attendanceId + ).let { notification -> + notificationGenerator.safeNotify( + UUID.randomUUID().toString(), + game.type.gameId, + notification + ) + } } - } - addFailureLog(attendanceId, cause) - } - } - }.fold( - onSuccess = { - Result.success() - }, - onFailure = { cause -> - if (cause is CancellationException) { - throw cause + addFailureLog(attendanceId, cause) + } } + }.fold( + onSuccess = { + Result.success() + }, + onFailure = { cause -> + if (cause is CancellationException) { + throw cause + } - Firebase.crashlytics.apply { - log(this@AttendCheckInEventWorker.javaClass.simpleName) - recordException(cause) - } + Firebase.crashlytics.apply { + log(this@AttendCheckInEventWorker.javaClass.simpleName) + recordException(cause) + } - addFailureLog(_attendanceId, cause) + addFailureLog(_attendanceId, cause) - Result.failure() - } - ) + Result.failure() + } + ) + } } companion object { diff --git a/app/src/main/kotlin/com/joeloewi/croissant/worker/CheckSessionWorker.kt b/app/src/main/kotlin/com/joeloewi/croissant/worker/CheckSessionWorker.kt index 9ed9b521..e9ee16a6 100644 --- a/app/src/main/kotlin/com/joeloewi/croissant/worker/CheckSessionWorker.kt +++ b/app/src/main/kotlin/com/joeloewi/croissant/worker/CheckSessionWorker.kt @@ -20,6 +20,7 @@ import com.joeloewi.croissant.domain.usecase.HoYoLABUseCase import com.joeloewi.croissant.domain.usecase.SuccessLogUseCase import com.joeloewi.croissant.domain.usecase.WorkerExecutionLogUseCase import com.joeloewi.croissant.util.NotificationGenerator +import com.joeloewi.croissant.util.withBoundNetwork import dagger.assisted.Assisted import dagger.assisted.AssistedInject import kotlinx.coroutines.CancellationException @@ -44,82 +45,84 @@ class CheckSessionWorker @AssistedInject constructor( private val _attendanceId = inputData.getLong(ATTENDANCE_ID, Long.MIN_VALUE) override suspend fun doWork(): Result = withContext(Dispatchers.IO) { - _attendanceId.runCatching { - takeIf { it != Long.MIN_VALUE }!! - }.mapCatching { attendanceId -> - val attendance = runCatching { getOneAttendanceUseCase(attendanceId) }.getOrNull() + withBoundNetwork { + _attendanceId.runCatching { + takeIf { it != Long.MIN_VALUE }!! + }.mapCatching { attendanceId -> + val attendance = runCatching { getOneAttendanceUseCase(attendanceId) }.getOrNull() - if (attendance == null) { - WorkManager.getInstance(context).cancelWorkById(id) - return@withContext Result.failure() - } else { - attendance - } - }.mapCatching { attendanceWithAllValues -> - getUserFullInfoHoYoLABUseCase(attendanceWithAllValues.attendance.cookie).getOrThrow() - }.fold( - onSuccess = { - val executionLogId = insertWorkerExecutionLogUseCase( - WorkerExecutionLog( - attendanceId = _attendanceId, - state = WorkerExecutionLogState.SUCCESS, - loggableWorker = LoggableWorker.CHECK_SESSION + if (attendance == null) { + WorkManager.getInstance(context).cancelWorkById(id) + return@withBoundNetwork Result.failure() + } else { + attendance + } + }.mapCatching { attendanceWithAllValues -> + getUserFullInfoHoYoLABUseCase(attendanceWithAllValues.attendance.cookie).getOrThrow() + }.fold( + onSuccess = { + val executionLogId = insertWorkerExecutionLogUseCase( + WorkerExecutionLog( + attendanceId = _attendanceId, + state = WorkerExecutionLogState.SUCCESS, + loggableWorker = LoggableWorker.CHECK_SESSION + ) ) - ) - insertSuccessLogUseCase( - SuccessLog( - executionLogId = executionLogId, - retCode = it.retCode, - message = it.message + insertSuccessLogUseCase( + SuccessLog( + executionLogId = executionLogId, + retCode = it.retCode, + message = it.message + ) ) - ) - Result.success() - }, - onFailure = { cause -> - when (cause) { - is HoYoLABUnsuccessfulResponseException -> { - if (HoYoLABRetCode.findByCode(cause.retCode) == HoYoLABRetCode.LoginFailed) { - with(notificationGenerator) { - safeNotify( - UUID.randomUUID().toString(), - 0, - createCheckSessionNotification(_attendanceId) - ) + Result.success() + }, + onFailure = { cause -> + when (cause) { + is HoYoLABUnsuccessfulResponseException -> { + if (HoYoLABRetCode.findByCode(cause.retCode) == HoYoLABRetCode.LoginFailed) { + with(notificationGenerator) { + safeNotify( + UUID.randomUUID().toString(), + 0, + createCheckSessionNotification(_attendanceId) + ) + } } } - } - is CancellationException -> { - throw cause + is CancellationException -> { + throw cause + } } - } - Firebase.crashlytics.apply { - log(this@CheckSessionWorker.javaClass.simpleName) - recordException(cause) - } + Firebase.crashlytics.apply { + log(this@CheckSessionWorker.javaClass.simpleName) + recordException(cause) + } - val executionLogId = insertWorkerExecutionLogUseCase( - WorkerExecutionLog( - attendanceId = _attendanceId, - state = WorkerExecutionLogState.FAILURE, - loggableWorker = LoggableWorker.CHECK_SESSION + val executionLogId = insertWorkerExecutionLogUseCase( + WorkerExecutionLog( + attendanceId = _attendanceId, + state = WorkerExecutionLogState.FAILURE, + loggableWorker = LoggableWorker.CHECK_SESSION + ) ) - ) - insertFailureLogUseCase( - FailureLog( - executionLogId = executionLogId, - failureMessage = cause.message ?: "", - failureStackTrace = cause.stackTraceToString() + insertFailureLogUseCase( + FailureLog( + executionLogId = executionLogId, + failureMessage = cause.message ?: "", + failureStackTrace = cause.stackTraceToString() + ) ) - ) - Result.failure() - } - ) + Result.failure() + } + ) + } } companion object { diff --git a/app/src/main/kotlin/com/joeloewi/croissant/worker/RefreshResinStatusWorker.kt b/app/src/main/kotlin/com/joeloewi/croissant/worker/RefreshResinStatusWorker.kt index 3937050e..52490c46 100644 --- a/app/src/main/kotlin/com/joeloewi/croissant/worker/RefreshResinStatusWorker.kt +++ b/app/src/main/kotlin/com/joeloewi/croissant/worker/RefreshResinStatusWorker.kt @@ -17,6 +17,7 @@ import com.joeloewi.croissant.util.createContentRemoteViews import com.joeloewi.croissant.util.createErrorDueToPowerSaveModeRemoteViews import com.joeloewi.croissant.util.createLoadingRemoteViews import com.joeloewi.croissant.util.createUnknownErrorRemoteViews +import com.joeloewi.croissant.util.withBoundNetwork import dagger.assisted.Assisted import dagger.assisted.AssistedInject import kotlinx.coroutines.CancellationException @@ -41,103 +42,105 @@ class RefreshResinStatusWorker @AssistedInject constructor( private val _appWidgetManager by lazy { AppWidgetManager.getInstance(context) } override suspend fun doWork(): Result = withContext(Dispatchers.IO) { - runCatching { - if (powerManager.isInteractive) { - //loading view - _appWidgetManager.updateAppWidget( - _appWidgetId, - createLoadingRemoteViews(context) - ) + withBoundNetwork { + runCatching { + if (powerManager.isInteractive) { + //loading view + _appWidgetManager.updateAppWidget( + _appWidgetId, + createLoadingRemoteViews(context) + ) + + val resinStatusWidgetWithAccounts = + getOneByAppWidgetIdResinStatusWidgetUseCase(_appWidgetId) - val resinStatusWidgetWithAccounts = - getOneByAppWidgetIdResinStatusWidgetUseCase(_appWidgetId) + val resinStatuses = resinStatusWidgetWithAccounts.accounts.map { account -> + getGameRecordCardHoYoLABUseCase.runCatching { + invoke( + cookie = account.cookie, + uid = account.uid + ).getOrThrow()?.list + }.mapCatching { gameRecords -> + gameRecords?.find { gameRecord -> + HoYoLABGame.findByGameId(gameRecord.gameId) == HoYoLABGame.GenshinImpact + }!! + }.mapCatching { gameRecord -> + val isDailyNoteEnabled = + gameRecord.dataSwitches.find { it.switchId == DataSwitch.GENSHIN_IMPACT_DAILY_NOTE_SWITCH_ID }?.isPublic - val resinStatuses = resinStatusWidgetWithAccounts.accounts.map { account -> - getGameRecordCardHoYoLABUseCase.runCatching { - invoke( - cookie = account.cookie, - uid = account.uid - ).getOrThrow()?.list - }.mapCatching { gameRecords -> - gameRecords?.find { gameRecord -> - HoYoLABGame.findByGameId(gameRecord.gameId) == HoYoLABGame.GenshinImpact - }!! - }.mapCatching { gameRecord -> - val isDailyNoteEnabled = - gameRecord.dataSwitches.find { it.switchId == DataSwitch.GENSHIN_IMPACT_DAILY_NOTE_SWITCH_ID }?.isPublic + if (isDailyNoteEnabled == false) { + changeDataSwitchHoYoLABUseCase( + cookie = account.cookie, + switchId = DataSwitch.GENSHIN_IMPACT_DAILY_NOTE_SWITCH_ID, + isPublic = true, + gameId = gameRecord.gameId, + ).getOrThrow() + } - if (isDailyNoteEnabled == false) { - changeDataSwitchHoYoLABUseCase( + val genshinDailyNote = getGenshinDailyNoteHoYoLABUseCase( cookie = account.cookie, - switchId = DataSwitch.GENSHIN_IMPACT_DAILY_NOTE_SWITCH_ID, - isPublic = true, - gameId = gameRecord.gameId, + server = gameRecord.region, + roleId = gameRecord.gameRoleId ).getOrThrow() - } - val genshinDailyNote = getGenshinDailyNoteHoYoLABUseCase( - cookie = account.cookie, - server = gameRecord.region, - roleId = gameRecord.gameRoleId - ).getOrThrow() - - ResinStatus( - id = account.id, - nickname = gameRecord.nickname, - currentResin = genshinDailyNote?.currentResin - ?: 0, - maxResin = genshinDailyNote?.maxResin - ?: 0 - ) - }.fold( - onSuccess = { - it - }, - onFailure = { cause -> - if (cause is CancellationException) { - throw cause + ResinStatus( + id = account.id, + nickname = gameRecord.nickname, + currentResin = genshinDailyNote?.currentResin + ?: 0, + maxResin = genshinDailyNote?.maxResin + ?: 0 + ) + }.fold( + onSuccess = { + it + }, + onFailure = { cause -> + if (cause is CancellationException) { + throw cause + } + ResinStatus() } - ResinStatus() - } - ) - } + ) + } - _appWidgetManager.updateAppWidget( - _appWidgetId, - createContentRemoteViews(context, _appWidgetId, resinStatuses) - ) - } - }.fold( - onSuccess = { - Result.success() - }, - onFailure = { cause -> - if (cause is CancellationException) { - throw cause + _appWidgetManager.updateAppWidget( + _appWidgetId, + createContentRemoteViews(context, _appWidgetId, resinStatuses) + ) } - //hoyoverse api rarely throws timeout error - //even though this worker has constraints on connection + }.fold( + onSuccess = { + Result.success() + }, + onFailure = { cause -> + if (cause is CancellationException) { + throw cause + } + //hoyoverse api rarely throws timeout error + //even though this worker has constraints on connection - Firebase.crashlytics.apply { - log(this@RefreshResinStatusWorker.javaClass.simpleName) - recordException(cause) - } + Firebase.crashlytics.apply { + log(this@RefreshResinStatusWorker.javaClass.simpleName) + recordException(cause) + } - val remoteViews = if (powerManager.isPowerSaveMode) { - createErrorDueToPowerSaveModeRemoteViews(context, _appWidgetId) - } else { - //error view - createUnknownErrorRemoteViews(context, _appWidgetId) - } + val remoteViews = if (powerManager.isPowerSaveMode) { + createErrorDueToPowerSaveModeRemoteViews(context, _appWidgetId) + } else { + //error view + createUnknownErrorRemoteViews(context, _appWidgetId) + } - _appWidgetManager?.updateAppWidget( - _appWidgetId, - remoteViews - ) + _appWidgetManager?.updateAppWidget( + _appWidgetId, + remoteViews + ) - Result.failure() - } - ) + Result.failure() + } + ) + } } companion object { From caca40fa7f8b4ace1dff9585c1cb294325765fbb Mon Sep 17 00:00:00 2001 From: joeloewi7178 Date: Tue, 16 Jan 2024 18:28:37 +0900 Subject: [PATCH 3/5] mod: wrong constructor value --- .../com/joeloewi/croissant/worker/AttendCheckInEventWorker.kt | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/app/src/main/kotlin/com/joeloewi/croissant/worker/AttendCheckInEventWorker.kt b/app/src/main/kotlin/com/joeloewi/croissant/worker/AttendCheckInEventWorker.kt index 2385d7c2..fd570787 100644 --- a/app/src/main/kotlin/com/joeloewi/croissant/worker/AttendCheckInEventWorker.kt +++ b/app/src/main/kotlin/com/joeloewi/croissant/worker/AttendCheckInEventWorker.kt @@ -1,7 +1,6 @@ package com.joeloewi.croissant.worker import android.content.Context -import android.net.ConnectivityManager import androidx.hilt.work.HiltWorker import androidx.work.CoroutineWorker import androidx.work.ForegroundInfo @@ -42,8 +41,7 @@ class AttendCheckInEventWorker @AssistedInject constructor( private val insertWorkerExecutionLogUseCase: WorkerExecutionLogUseCase.Insert, private val insertSuccessLogUseCase: SuccessLogUseCase.Insert, private val insertFailureLogUseCase: FailureLogUseCase.Insert, - private val notificationGenerator: NotificationGenerator, - private val connectivityManager: ConnectivityManager + private val notificationGenerator: NotificationGenerator ) : CoroutineWorker( appContext = context, params = params From 4f0355b801122fbf2e60660e9726bcf4441758b0 Mon Sep 17 00:00:00 2001 From: joeloewi7178 Date: Tue, 16 Jan 2024 18:30:37 +0900 Subject: [PATCH 4/5] mod: disable autofill dialog when webview shows new window --- .../navigation/main/attendances/screen/LoginHoYoLABScreen.kt | 3 +++ 1 file changed, 3 insertions(+) diff --git a/app/src/main/kotlin/com/joeloewi/croissant/ui/navigation/main/attendances/screen/LoginHoYoLABScreen.kt b/app/src/main/kotlin/com/joeloewi/croissant/ui/navigation/main/attendances/screen/LoginHoYoLABScreen.kt index 06a5043a..0746f789 100644 --- a/app/src/main/kotlin/com/joeloewi/croissant/ui/navigation/main/attendances/screen/LoginHoYoLABScreen.kt +++ b/app/src/main/kotlin/com/joeloewi/croissant/ui/navigation/main/attendances/screen/LoginHoYoLABScreen.kt @@ -359,6 +359,9 @@ fun LoginHoYoLABContent( resultMsg: Message? ): Boolean { val popUpWebView = WebView(activity).apply { + if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) { + importantForAutofill = View.IMPORTANT_FOR_AUTOFILL_NO + } settings.apply { javaScriptEnabled = true domStorageEnabled = true From 8efa3350e2edb5f36a40307caa014a6f30dfbc32 Mon Sep 17 00:00:00 2001 From: joeloewi7178 Date: Tue, 16 Jan 2024 18:31:44 +0900 Subject: [PATCH 5/5] versionCode 53 versionName 1.2.4 --- app/build.gradle.kts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/build.gradle.kts b/app/build.gradle.kts index 62149ee0..7f41cf4a 100644 --- a/app/build.gradle.kts +++ b/app/build.gradle.kts @@ -20,8 +20,8 @@ android { defaultConfig { applicationId = "com.joeloewi.croissant" - versionCode = 52 - versionName = "1.2.3" + versionCode = 53 + versionName = "1.2.4" targetSdk = 34 testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"