-
Notifications
You must be signed in to change notification settings - Fork 150
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #253 from GuoXiCheng/dev
Dev
- Loading branch information
Showing
9 changed files
with
82 additions
and
22 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
28 changes: 25 additions & 3 deletions
28
app/src/main/java/com/android/skip/ui/whitelist/WhiteListRepository.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
15 changes: 14 additions & 1 deletion
15
app/src/main/java/com/android/skip/ui/whitelist/WhiteListViewModel.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,26 @@ | ||
package com.android.skip.ui.whitelist | ||
|
||
import androidx.lifecycle.ViewModel | ||
import androidx.lifecycle.viewModelScope | ||
import com.android.skip.R | ||
import com.android.skip.util.DataStoreUtils | ||
import com.blankj.utilcode.util.StringUtils.getString | ||
import dagger.hilt.android.lifecycle.HiltViewModel | ||
import kotlinx.coroutines.Dispatchers | ||
import kotlinx.coroutines.launch | ||
import kotlinx.coroutines.withContext | ||
import javax.inject.Inject | ||
|
||
@HiltViewModel | ||
class WhiteListViewModel @Inject constructor( | ||
private val whiteListRepository: WhiteListRepository | ||
) : ViewModel() { | ||
fun updateWhiteList(packageName: String, checked: Boolean) = | ||
fun updateWhiteList(packageName: String, checked: Boolean) { | ||
whiteListRepository.updateWhiteList(packageName, checked) | ||
viewModelScope.launch { | ||
withContext(Dispatchers.IO) { | ||
DataStoreUtils.putData(getString(R.string.whitelist_dot) + packageName, checked) | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
18 changes: 10 additions & 8 deletions
18
app/src/main/java/com/android/skip/ui/whitelist/list/AppListRepository.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters