Compare commits
3 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 00569666be | |||
| 2cf6578378 | |||
| fbcf9af761 |
@@ -32,13 +32,13 @@ jobs:
|
|||||||
|
|
||||||
- name: Deploy latest to Nextcloud
|
- name: Deploy latest to Nextcloud
|
||||||
run: |
|
run: |
|
||||||
curl -k -u "${{ secrets.NEXTCLOUD_USERNAME }}:${{ secrets.NEXTCLOUD_PASSWORD }}" -T "app/build/outputs/apk/release/app-release.apk" "https://nextcloud.zobrist.me/remote.php/dav/files/deploy/TichuCounter/latest/app-release.apk"
|
curl -k -u "${{ secrets.NEXTCLOUD_USERNAME }}:${{ secrets.NEXTCLOUD_PASSWORD }}" -T "app/build/outputs/apk/release/app-release.apk" "${{ secrets.NEXTCLOUD_BASE_URL }}/TichuCounter/latest/app-release.apk"
|
||||||
curl -k -u "${{ secrets.NEXTCLOUD_USERNAME }}:${{ secrets.NEXTCLOUD_PASSWORD }}" -T "app/build/outputs/bundle/release/app-release.aab" "https://nextcloud.zobrist.me/remote.php/dav/files/deploy/TichuCounter/latest/app-release.aab"
|
curl -k -u "${{ secrets.NEXTCLOUD_USERNAME }}:${{ secrets.NEXTCLOUD_PASSWORD }}" -T "app/build/outputs/bundle/release/app-release.aab" "${{ secrets.NEXTCLOUD_BASE_URL }}/TichuCounter/latest/app-release.aab"
|
||||||
|
|
||||||
- name: Deploy tagged build to Nextcloud
|
- name: Deploy tagged build to Nextcloud
|
||||||
run: |
|
run: |
|
||||||
curl -k -u "${{ secrets.NEXTCLOUD_USERNAME }}:${{ secrets.NEXTCLOUD_PASSWORD }}" -T "app/build/outputs/apk/release/app-release.apk" "https://nextcloud.zobrist.me/remote.php/dav/files/deploy/TichuCounter/tagged/app-release-${GITHUB_REF_NAME##*/}.apk"
|
curl -k -u "${{ secrets.NEXTCLOUD_USERNAME }}:${{ secrets.NEXTCLOUD_PASSWORD }}" -T "app/build/outputs/apk/release/app-release.apk" "${{ secrets.NEXTCLOUD_BASE_URL }}/TichuCounter/tagged/app-release-${GITHUB_REF_NAME##*/}.apk"
|
||||||
curl -k -u "${{ secrets.NEXTCLOUD_USERNAME }}:${{ secrets.NEXTCLOUD_PASSWORD }}" -T "app/build/outputs/bundle/release/app-release.aab" "https://nextcloud.zobrist.me/remote.php/dav/files/deploy/TichuCounter/tagged/app-release-${GITHUB_REF_NAME##*/}.aab"
|
curl -k -u "${{ secrets.NEXTCLOUD_USERNAME }}:${{ secrets.NEXTCLOUD_PASSWORD }}" -T "app/build/outputs/bundle/release/app-release.aab" "${{ secrets.NEXTCLOUD_BASE_URL }}/TichuCounter/tagged/app-release-${GITHUB_REF_NAME##*/}.aab"
|
||||||
|
|
||||||
- uses: https://github.com/ravsamhq/notify-slack-action@v2
|
- uses: https://github.com/ravsamhq/notify-slack-action@v2
|
||||||
if: always()
|
if: always()
|
||||||
|
|||||||
@@ -27,6 +27,8 @@ class GameRepository @Inject constructor(
|
|||||||
|
|
||||||
private val newGameFlow = MutableStateFlow(Game())
|
private val newGameFlow = MutableStateFlow(Game())
|
||||||
|
|
||||||
|
private var deletedGame: GameWithScores? = null
|
||||||
|
|
||||||
init {
|
init {
|
||||||
CoroutineScope(Dispatchers.IO).launch {
|
CoroutineScope(Dispatchers.IO).launch {
|
||||||
gameDao.getActiveAsFlow().collect {
|
gameDao.getActiveAsFlow().collect {
|
||||||
@@ -104,14 +106,33 @@ class GameRepository @Inject constructor(
|
|||||||
withContext(Dispatchers.IO) {
|
withContext(Dispatchers.IO) {
|
||||||
try {
|
try {
|
||||||
val game = gameDao.getGameById(uid)
|
val game = gameDao.getGameById(uid)
|
||||||
gameDao.delete(game)
|
|
||||||
val rounds = roundDao.getAllForGame(game.uid)
|
val rounds = roundDao.getAllForGame(game.uid)
|
||||||
|
|
||||||
|
deletedGame = GameWithScores(game, rounds)
|
||||||
|
|
||||||
|
gameDao.delete(game)
|
||||||
roundDao.delete(rounds)
|
roundDao.delete(rounds)
|
||||||
} catch (_: NullPointerException) {
|
} catch (_: NullPointerException) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
suspend fun restoreLastDeletedGame() {
|
||||||
|
if (deletedGame == null) {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
val revert = deletedGame!!
|
||||||
|
deletedGame = null
|
||||||
|
|
||||||
|
withContext(Dispatchers.IO) {
|
||||||
|
gameDao.insert(revert.game)
|
||||||
|
|
||||||
|
revert.rounds.forEach {
|
||||||
|
roundDao.insert(it)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
suspend fun deleteAllInactive() {
|
suspend fun deleteAllInactive() {
|
||||||
withContext(Dispatchers.IO) {
|
withContext(Dispatchers.IO) {
|
||||||
try {
|
try {
|
||||||
|
|||||||
@@ -95,6 +95,7 @@ fun HistoryList(
|
|||||||
viewModel.activateGame(it)
|
viewModel.activateGame(it)
|
||||||
lazyListState.animateScrollToItem(0)
|
lazyListState.animateScrollToItem(0)
|
||||||
|
|
||||||
|
snackbarHostState.currentSnackbarData?.dismiss()
|
||||||
val result = snackbarHostState.showSnackbar(
|
val result = snackbarHostState.showSnackbar(
|
||||||
message = activatedMessage,
|
message = activatedMessage,
|
||||||
actionLabel = activatedActionLabel,
|
actionLabel = activatedActionLabel,
|
||||||
@@ -108,7 +109,9 @@ fun HistoryList(
|
|||||||
},
|
},
|
||||||
onDeleteClicked = {
|
onDeleteClicked = {
|
||||||
scope.launch {
|
scope.launch {
|
||||||
viewModel.markToDelete(it)
|
viewModel.deleteGame(it)
|
||||||
|
|
||||||
|
snackbarHostState.currentSnackbarData?.dismiss()
|
||||||
val result = snackbarHostState.showSnackbar(
|
val result = snackbarHostState.showSnackbar(
|
||||||
message = deletedMessage,
|
message = deletedMessage,
|
||||||
actionLabel = deletedActionLabel,
|
actionLabel = deletedActionLabel,
|
||||||
@@ -118,7 +121,7 @@ fun HistoryList(
|
|||||||
if (result == SnackbarResult.Dismissed) {
|
if (result == SnackbarResult.Dismissed) {
|
||||||
viewModel.deleteGame(it)
|
viewModel.deleteGame(it)
|
||||||
} else {
|
} else {
|
||||||
viewModel.unmarkToDelete(it)
|
viewModel.restoreLastDeletedGame()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -33,20 +33,18 @@ class HistoryViewModel @Inject constructor(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fun markToDelete(gameId: Long) {
|
|
||||||
gameAndHistory = fullList.filter { it.game.uid != gameId }
|
|
||||||
}
|
|
||||||
|
|
||||||
fun unmarkToDelete(gameId: Long) {
|
|
||||||
gameAndHistory = fullList
|
|
||||||
}
|
|
||||||
|
|
||||||
fun deleteGame(gameId: Long) {
|
fun deleteGame(gameId: Long) {
|
||||||
viewModelScope.launch {
|
viewModelScope.launch {
|
||||||
gameRepository.deleteGame(gameId)
|
gameRepository.deleteGame(gameId)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fun restoreLastDeletedGame() {
|
||||||
|
viewModelScope.launch {
|
||||||
|
gameRepository.restoreLastDeletedGame()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
fun activateGame(gameId: Long) {
|
fun activateGame(gameId: Long) {
|
||||||
viewModelScope.launch {
|
viewModelScope.launch {
|
||||||
gameRepository.setActive(gameId)
|
gameRepository.setActive(gameId)
|
||||||
|
|||||||
@@ -6,7 +6,7 @@ buildscript {
|
|||||||
mavenCentral()
|
mavenCentral()
|
||||||
}
|
}
|
||||||
dependencies {
|
dependencies {
|
||||||
classpath 'com.android.tools.build:gradle:8.1.1'
|
classpath 'com.android.tools.build:gradle:8.1.2'
|
||||||
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
|
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
|
||||||
|
|
||||||
// NOTE: Do not place your application dependencies here; they belong
|
// NOTE: Do not place your application dependencies here; they belong
|
||||||
|
|||||||
Reference in New Issue
Block a user