-
Notifications
You must be signed in to change notification settings - Fork 56
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
9851e68
commit 5f06eb4
Showing
12 changed files
with
131 additions
and
10 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
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
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
27 changes: 27 additions & 0 deletions
27
src/main/kotlin/com/theapache64/stackzy/ui/feature/update/UpdateScreen.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 |
---|---|---|
@@ -0,0 +1,27 @@ | ||
package com.theapache64.stackzy.ui.feature.update | ||
|
||
import androidx.compose.material.Button | ||
import androidx.compose.material.Text | ||
import androidx.compose.runtime.Composable | ||
import com.theapache64.stackzy.App | ||
import com.theapache64.stackzy.ui.common.FullScreenError | ||
|
||
@Composable | ||
fun UpdateScreen( | ||
viewModel: UpdateScreenViewModel | ||
) { | ||
FullScreenError( | ||
title = "Update", | ||
message = "Looks like you're using an older version of ${App.appArgs.appName}." + | ||
"Please download the latest version and update. Thank you :)", | ||
action = { | ||
Button( | ||
onClick = { | ||
viewModel.onUpdateClicked() | ||
} | ||
) { | ||
Text(text = "UPDATE") | ||
} | ||
} | ||
) | ||
} |
27 changes: 27 additions & 0 deletions
27
src/main/kotlin/com/theapache64/stackzy/ui/feature/update/UpdateScreenComponent.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 |
---|---|---|
@@ -0,0 +1,27 @@ | ||
package com.theapache64.stackzy.ui.feature.update | ||
|
||
import androidx.compose.runtime.Composable | ||
import com.arkivanov.decompose.ComponentContext | ||
import com.theapache64.stackzy.di.AppComponent | ||
import com.theapache64.stackzy.ui.navigation.Component | ||
import javax.inject.Inject | ||
|
||
class UpdateScreenComponent( | ||
appComponent: AppComponent, | ||
private val componentContext: ComponentContext | ||
) : Component, ComponentContext by componentContext { | ||
|
||
@Inject | ||
lateinit var viewModel: UpdateScreenViewModel | ||
|
||
init { | ||
appComponent.inject(this) | ||
} | ||
|
||
@Composable | ||
override fun render() { | ||
UpdateScreen( | ||
viewModel | ||
) | ||
} | ||
} |
17 changes: 17 additions & 0 deletions
17
src/main/kotlin/com/theapache64/stackzy/ui/feature/update/UpdateScreenViewModel.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 |
---|---|---|
@@ -0,0 +1,17 @@ | ||
package com.theapache64.stackzy.ui.feature.update | ||
|
||
import java.awt.Desktop | ||
import java.net.URI | ||
import javax.inject.Inject | ||
|
||
class UpdateScreenViewModel @Inject constructor( | ||
|
||
) { | ||
companion object { | ||
private const val LATEST_VERSION_URL = "https://github.com/theapache64/stackzy/releases/latest" | ||
} | ||
|
||
fun onUpdateClicked() { | ||
Desktop.getDesktop().browse(URI(LATEST_VERSION_URL)) | ||
} | ||
} |
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