-
Notifications
You must be signed in to change notification settings - Fork 0
Wi-Fi接続時のみ転送設定の追加 #305
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Wi-Fi接続時のみ転送設定の追加 #305
Changes from all commits
c6463b9
72cc7c3
c5015d7
89cbdcc
82745db
94c9e4b
ea7c8cc
309222b
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| package me.nya_n.notificationnotifier.domain.usecase | ||
|
|
||
| interface SaveWifiOnlyNotificationSettingUseCase { | ||
| operator fun invoke(isWifiOnlyNotificationEnabled: Boolean): Result<Unit> | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,20 @@ | ||
| package me.nya_n.notificationnotifier.domain.usecase.impl | ||
|
|
||
| import me.nya_n.notificationnotifier.data.repository.UserSettingsRepository | ||
| import me.nya_n.notificationnotifier.domain.usecase.SaveWifiOnlyNotificationSettingUseCase | ||
|
|
||
| class SaveWifiOnlyNotificationSettingUseCaseImpl( | ||
| private val userSettingsRepository: UserSettingsRepository | ||
| ) : SaveWifiOnlyNotificationSettingUseCase { | ||
| override fun invoke(isWifiOnlyNotificationEnabled: Boolean): Result<Unit> { | ||
| return runCatching { | ||
| val settings = userSettingsRepository.getUserSettings() | ||
| userSettingsRepository.saveUserSettings( | ||
| settings.copy( | ||
| isWifiOnlyNotificationEnabled = isWifiOnlyNotificationEnabled | ||
| ) | ||
| ) | ||
| return Result.success(Unit) | ||
| } | ||
| } | ||
| } |
| Original file line number | Diff line number | Diff line change | ||||||||
|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -6,8 +6,10 @@ data class UserSettings( | |||||||||
| val host: String, | ||||||||||
| val port: Int, | ||||||||||
| /** | ||||||||||
| * @see <a href="https://support.google.com/googleplay/android-developer/answer/10158779?hl=ja">https://support.google.com/googleplay/android-developer/answer/10158779</a> | ||||||||||
| * @see <a href="https://support.google.com/googleplay/android-developer/answer/10158779?hl=ja">パッケージ(アプリ)の広範な一覧取得(QUERY_ALL_PACKAGES)権限の使用</a> | ||||||||||
| */ | ||||||||||
| @SerializedName("is_package_visibility_granted") | ||||||||||
| val isPackageVisibilityGranted: Boolean | ||||||||||
| val isPackageVisibilityGranted: Boolean, | ||||||||||
| @SerializedName("is_wifi_only_notification_enabled") | ||||||||||
| val isWifiOnlyNotificationEnabled: Boolean | ||||||||||
|
Comment on lines
+13
to
+14
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🧩 Analysis chain🏁 Script executed: # Find Backup.kt and examine its structure
find . -name "Backup.kt" -o -name "backup.kt" | head -20Repository: ptkNktq/AndroidNotificationNotifier Length of output: 159 🏁 Script executed: # List files in the model directory to understand structure
git ls-files | grep -E "(Backup|UserSettings|backup)" | head -30Repository: ptkNktq/AndroidNotificationNotifier Length of output: 939 🏁 Script executed: # Search for UserSettings usage in backup context
rg -n "UserSettings" --type kotlin | grep -E "(Backup|backup)" | head -30Repository: ptkNktq/AndroidNotificationNotifier Length of output: 370 🏁 Script executed: # Look for Gson configuration and deserialization logic
rg -n "Gson|fromJson|deserialize" --type kotlin | head -40Repository: ptkNktq/AndroidNotificationNotifier Length of output: 1216 🏁 Script executed: # Check for any default value assignments in UserSettings
rg -n "UserSettings" -A 30 --type kotlin | grep -E "(class UserSettings|=|default)" | head -40Repository: ptkNktq/AndroidNotificationNotifier Length of output: 6710 🏁 Script executed: # Read Backup.kt to see its structure
cat -n AndroidApp/model/src/main/kotlin/me/nya_n/notificationnotifier/model/Backup.ktRepository: ptkNktq/AndroidNotificationNotifier Length of output: 445 🏁 Script executed: # Read UserSettings.kt to see all fields and current defaults
cat -n AndroidApp/model/src/main/kotlin/me/nya_n/notificationnotifier/model/UserSettings.ktRepository: ptkNktq/AndroidNotificationNotifier Length of output: 713 🏁 Script executed: # Read ImportDataUseCaseImpl to see deserialization and error handling
cat -n AndroidApp/domain/src/main/kotlin/me/nya_n/notificationnotifier/domain/usecase/impl/ImportDataUseCaseImpl.ktRepository: ptkNktq/AndroidNotificationNotifier Length of output: 1713 🏁 Script executed: # Search for Gson configuration, custom TypeAdapter, or JsonDeserializer
rg -n "TypeAdapter|JsonDeserializer|GsonBuilder|setFieldNamingStrategy" --type kotlinRepository: ptkNktq/AndroidNotificationNotifier Length of output: 61 🏁 Script executed: # Check for Gson version in build.gradle files
find . -name "build.gradle*" -type f | xargs grep -l "gson"Repository: ptkNktq/AndroidNotificationNotifier Length of output: 151 🏁 Script executed: # Search for test cases related to backup import
rg -n "ImportDataUseCase|import.*json|backup" --type kotlin | grep -i "test"Repository: ptkNktq/AndroidNotificationNotifier Length of output: 1075 🏁 Script executed: # Check if there's a Gson configuration or dependency setup
git ls-files | grep -i "gson\|gradle" | head -20Repository: ptkNktq/AndroidNotificationNotifier Length of output: 642 🏁 Script executed: # Check Gson version and dependencies
cat -n AndroidApp/gradle/libs.versions.toml | grep -i gsonRepository: ptkNktq/AndroidNotificationNotifier Length of output: 226 🏁 Script executed: # Check domain build.gradle.kts for Gson config
cat -n AndroidApp/domain/build.gradle.kts | head -50Repository: ptkNktq/AndroidNotificationNotifier Length of output: 1420 🏁 Script executed: # Check UseCaseTest.kt to see if there are backward compatibility tests
cat -n AndroidApp/domain/src/androidTest/java/me/nya_n/notificationnotifier/UseCaseTest.kt | head -150Repository: ptkNktq/AndroidNotificationNotifier Length of output: 7950 🏁 Script executed: # Search for any test data or old backup JSON files
find . -name "*.json" -type f | head -20Repository: ptkNktq/AndroidNotificationNotifier Length of output: 294 🏁 Script executed: # Verify Gson behavior - search for any error handling or migration logic
rg -n "JsonSyntaxException|catch|try" AndroidApp/domain/src/main/kotlin/me/nya_n/notificationnotifier/domain/usecase/impl/ImportDataUseCaseImpl.ktRepository: ptkNktq/AndroidNotificationNotifier Length of output: 61 🏁 Script executed: # Check if there's any version migration or schema update logic
rg -n "version|migration|upgrade" --type kotlin | grep -i "backup\|import\|restore" | head -20Repository: ptkNktq/AndroidNotificationNotifier Length of output: 510 🏁 Script executed: # Verify field initialization behavior in UserSettings
cat -n AndroidApp/model/src/main/kotlin/me/nya_n/notificationnotifier/model/UserSettings.ktRepository: ptkNktq/AndroidNotificationNotifier Length of output: 713 古いバックアップファイルの復元に失敗する可能性 新しく追加されたnon-nullableの 推奨される修正デフォルト値を追加してください: `@SerializedName`("is_wifi_only_notification_enabled")
- val isWifiOnlyNotificationEnabled: Boolean
+ val isWifiOnlyNotificationEnabled: Boolean = false📝 Committable suggestion
Suggested change
🤖 Prompt for AI Agents |
||||||||||
| ) | ||||||||||
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -12,6 +12,7 @@ import me.nya_n.notificationnotifier.domain.usecase.ImportDataUseCase | |||||||||||||||||||||
| import me.nya_n.notificationnotifier.domain.usecase.LoadAddressUseCase | ||||||||||||||||||||||
| import me.nya_n.notificationnotifier.domain.usecase.NotifyUseCase | ||||||||||||||||||||||
| import me.nya_n.notificationnotifier.domain.usecase.SaveAddressUseCase | ||||||||||||||||||||||
| import me.nya_n.notificationnotifier.domain.usecase.SaveWifiOnlyNotificationSettingUseCase | ||||||||||||||||||||||
| import me.nya_n.notificationnotifier.model.AppConfig | ||||||||||||||||||||||
| import me.nya_n.notificationnotifier.model.Message | ||||||||||||||||||||||
| import me.nya_n.notificationnotifier.ui.R | ||||||||||||||||||||||
|
|
@@ -22,6 +23,7 @@ class SettingsViewModel( | |||||||||||||||||||||
| loadAddressUseCase: LoadAddressUseCase, | ||||||||||||||||||||||
| private val saveAddressUseCase: SaveAddressUseCase, | ||||||||||||||||||||||
| private val notifyUseCase: NotifyUseCase, | ||||||||||||||||||||||
| private val saveWifiOnlyNotificationSettingUseCase: SaveWifiOnlyNotificationSettingUseCase, | ||||||||||||||||||||||
| private val exportDataUseCase: ExportDataUseCase, | ||||||||||||||||||||||
| private val importDataUseCase: ImportDataUseCase | ||||||||||||||||||||||
| ) : BaseViewModel<UiEvent>() { | ||||||||||||||||||||||
|
|
@@ -59,6 +61,11 @@ class SettingsViewModel( | |||||||||||||||||||||
| } | ||||||||||||||||||||||
| } | ||||||||||||||||||||||
|
|
||||||||||||||||||||||
| fun updateWifiOnlySetting(isWifiOnlyNotificationEnabled: Boolean) { | ||||||||||||||||||||||
| saveWifiOnlyNotificationSettingUseCase(isWifiOnlyNotificationEnabled) | ||||||||||||||||||||||
| _uiState.update { it.copy(isWifiOnlyNotificationEnabled = isWifiOnlyNotificationEnabled) } | ||||||||||||||||||||||
| } | ||||||||||||||||||||||
|
Comment on lines
+64
to
+67
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🧩 Analysis chain🏁 Script executed: find . -type f -name "SettingsViewModel.kt" | head -20Repository: ptkNktq/AndroidNotificationNotifier Length of output: 180 🏁 Script executed: cat -n ./AndroidApp/ui/src/main/kotlin/me/nya_n/notificationnotifier/ui/screen/settings/SettingsViewModel.ktRepository: ptkNktq/AndroidNotificationNotifier Length of output: 4573 🏁 Script executed: find . -type f -name "SaveWifiOnlyNotificationSettingUseCase.kt" | head -5Repository: ptkNktq/AndroidNotificationNotifier Length of output: 201 🏁 Script executed: cat -n ./AndroidApp/domain/src/main/kotlin/me/nya_n/notificationnotifier/domain/usecase/SaveWifiOnlyNotificationSettingUseCase.ktRepository: ptkNktq/AndroidNotificationNotifier Length of output: 298 🏁 Script executed: # Check if there are any other similar use cases that return Result
rg "SaveWifiOnlyNotificationSettingUseCase" -A 5 -B 5Repository: ptkNktq/AndroidNotificationNotifier Length of output: 11200 保存失敗時のUI整合性を担保してください
♻️ 修正案 fun updateWifiOnlySetting(isWifiOnlyNotificationEnabled: Boolean) {
- saveWifiOnlyNotificationSettingUseCase(isWifiOnlyNotificationEnabled)
- _uiState.update { it.copy(isWifiOnlyNotificationEnabled = isWifiOnlyNotificationEnabled) }
+ val result = saveWifiOnlyNotificationSettingUseCase(isWifiOnlyNotificationEnabled)
+ if (result.isSuccess) {
+ _uiState.update { it.copy(isWifiOnlyNotificationEnabled = isWifiOnlyNotificationEnabled) }
+ }
}📝 Committable suggestion
Suggested change
🤖 Prompt for AI Agents |
||||||||||||||||||||||
|
|
||||||||||||||||||||||
| /** バックアップのために外部ストレージにデータを保存 */ | ||||||||||||||||||||||
| fun exportData(uri: Uri?) { | ||||||||||||||||||||||
| if (uri == null) { | ||||||||||||||||||||||
|
|
||||||||||||||||||||||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🧩 Analysis chain
🏁 Script executed:
Repository: ptkNktq/AndroidNotificationNotifier
Length of output: 20933
UserSettingsRepositoryTest.ktの44行目を4パラメータコンストラクタに更新してくださいUserSettingsRepositoryTest.ktの46行目でUserSettingsの3パラメータコンストラクタが使用されています。新しい4パラメータシグネチャに対応するため、isWifiOnlyNotificationEnabledパラメータを追加する必要があります。該当コード
修正例:
🤖 Prompt for AI Agents