Compare commits
No commits in common. "main" and "graphql" have entirely different histories.
12 changed files with 27 additions and 40 deletions
|
@ -67,7 +67,7 @@ invoking `./gradlew :compose-web:jsBrowserDevelopmentRun`
|
||||||
This client is available in `compose-desktop` module. Note that you need to use appropriate version of JVM when running (works for example with Java 11)
|
This client is available in `compose-desktop` module. Note that you need to use appropriate version of JVM when running (works for example with Java 11)
|
||||||
|
|
||||||
|
|
||||||
### Backend code
|
### Deploying backend code
|
||||||
|
|
||||||
Have tested this out in Google App Engine deployment. Using shadowJar plugin to create an "uber" jar and then deploying it as shown below. Should be possible to deploy this jar to other services as well.
|
Have tested this out in Google App Engine deployment. Using shadowJar plugin to create an "uber" jar and then deploying it as shown below. Should be possible to deploy this jar to other services as well.
|
||||||
|
|
||||||
|
@ -76,11 +76,6 @@ Have tested this out in Google App Engine deployment. Using shadowJar plugin to
|
||||||
gcloud app deploy backend/build/libs/backend-all.jar
|
gcloud app deploy backend/build/libs/backend-all.jar
|
||||||
```
|
```
|
||||||
|
|
||||||
### GraphQL backend
|
|
||||||
|
|
||||||
There's a GraphQL module (`graphql-server`) which can be run locally using `./gradlew :graphql-server:bootRun` with "playground" then available at http://localhost:8080/playground
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
### Screenshots
|
### Screenshots
|
||||||
|
|
||||||
|
|
|
@ -64,9 +64,8 @@ dependencies {
|
||||||
implementation(activityCompose)
|
implementation(activityCompose)
|
||||||
}
|
}
|
||||||
|
|
||||||
with(Deps.Glance) {
|
implementation("androidx.glance:glance-appwidget:1.0.0-SNAPSHOT")
|
||||||
implementation(appwidget)
|
|
||||||
}
|
|
||||||
|
|
||||||
with(Deps.Compose) {
|
with(Deps.Compose) {
|
||||||
implementation(compiler)
|
implementation(compiler)
|
||||||
|
@ -80,6 +79,8 @@ dependencies {
|
||||||
implementation(uiTooling)
|
implementation(uiTooling)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
with(Deps.Koin) {
|
with(Deps.Koin) {
|
||||||
implementation(core)
|
implementation(core)
|
||||||
implementation(android)
|
implementation(android)
|
||||||
|
|
|
@ -7,14 +7,13 @@ import androidx.compose.ui.unit.ExperimentalUnitApi
|
||||||
import androidx.compose.ui.unit.TextUnit
|
import androidx.compose.ui.unit.TextUnit
|
||||||
import androidx.compose.ui.unit.TextUnitType
|
import androidx.compose.ui.unit.TextUnitType
|
||||||
import androidx.glance.GlanceModifier
|
import androidx.glance.GlanceModifier
|
||||||
import androidx.glance.Image
|
import androidx.glance.action.actionLaunchActivity
|
||||||
import androidx.glance.ImageProvider
|
|
||||||
import androidx.glance.action.actionStartActivity
|
|
||||||
import androidx.glance.action.clickable
|
import androidx.glance.action.clickable
|
||||||
import androidx.glance.background
|
import androidx.glance.background
|
||||||
import androidx.glance.layout.Box
|
import androidx.glance.layout.Box
|
||||||
|
import androidx.glance.layout.ImageProvider
|
||||||
|
import androidx.glance.layout.Text
|
||||||
import androidx.glance.layout.fillMaxSize
|
import androidx.glance.layout.fillMaxSize
|
||||||
import androidx.glance.text.Text
|
|
||||||
import androidx.glance.text.TextStyle
|
import androidx.glance.text.TextStyle
|
||||||
import androidx.glance.unit.ColorProvider
|
import androidx.glance.unit.ColorProvider
|
||||||
import com.surrus.common.repository.PeopleInSpaceRepositoryInterface
|
import com.surrus.common.repository.PeopleInSpaceRepositoryInterface
|
||||||
|
@ -82,12 +81,12 @@ class ISSMapWidget : BaseGlanceAppWidget<ISSMapWidget.Data>() {
|
||||||
override fun Content(data: Data?) {
|
override fun Content(data: Data?) {
|
||||||
Box(
|
Box(
|
||||||
modifier = GlanceModifier.background(Color.DarkGray).fillMaxSize().clickable(
|
modifier = GlanceModifier.background(Color.DarkGray).fillMaxSize().clickable(
|
||||||
actionStartActivity<MainActivity>()
|
actionLaunchActivity<MainActivity>()
|
||||||
)
|
)
|
||||||
) {
|
) {
|
||||||
val bitmap = data?.bitmap
|
val bitmap = data?.bitmap
|
||||||
if (bitmap != null) {
|
if (bitmap != null) {
|
||||||
Image(
|
androidx.glance.layout.Image(
|
||||||
modifier = GlanceModifier.fillMaxSize(),
|
modifier = GlanceModifier.fillMaxSize(),
|
||||||
provider = ImageProvider(bitmap),
|
provider = ImageProvider(bitmap),
|
||||||
contentDescription = "ISS Location"
|
contentDescription = "ISS Location"
|
||||||
|
|
|
@ -7,12 +7,13 @@ import androidx.compose.ui.unit.TextUnit
|
||||||
import androidx.compose.ui.unit.TextUnitType
|
import androidx.compose.ui.unit.TextUnitType
|
||||||
import androidx.compose.ui.unit.dp
|
import androidx.compose.ui.unit.dp
|
||||||
import androidx.glance.GlanceModifier
|
import androidx.glance.GlanceModifier
|
||||||
import androidx.glance.appwidget.lazy.LazyColumn
|
import androidx.glance.appwidget.layout.LazyColumn
|
||||||
|
import androidx.glance.appwidget.layout.items
|
||||||
import androidx.glance.background
|
import androidx.glance.background
|
||||||
import androidx.glance.layout.Row
|
import androidx.glance.layout.Row
|
||||||
|
import androidx.glance.layout.Text
|
||||||
import androidx.glance.layout.padding
|
import androidx.glance.layout.padding
|
||||||
import androidx.glance.text.FontWeight
|
import androidx.glance.text.FontWeight
|
||||||
import androidx.glance.text.Text
|
|
||||||
import androidx.glance.text.TextStyle
|
import androidx.glance.text.TextStyle
|
||||||
import androidx.glance.unit.ColorProvider
|
import androidx.glance.unit.ColorProvider
|
||||||
import com.surrus.common.remote.Assignment
|
import com.surrus.common.remote.Assignment
|
||||||
|
@ -48,10 +49,10 @@ class PeopleInSpaceWidget : BaseGlanceAppWidget<PeopleInSpaceWidget.Data>() {
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
if (data != null) {
|
if (data != null) {
|
||||||
items(data.people.size) {
|
items(data.people) {
|
||||||
Row {
|
Row {
|
||||||
Text(
|
Text(
|
||||||
text = data.people[it].name,
|
text = it.name,
|
||||||
style = TextStyle(
|
style = TextStyle(
|
||||||
color = ColorProvider(Color.White),
|
color = ColorProvider(Color.White),
|
||||||
fontSize = TextUnit(10f, TextUnitType.Sp)
|
fontSize = TextUnit(10f, TextUnitType.Sp)
|
||||||
|
|
|
@ -7,10 +7,10 @@ import androidx.compose.runtime.mutableStateOf
|
||||||
import androidx.compose.runtime.setValue
|
import androidx.compose.runtime.setValue
|
||||||
import androidx.compose.runtime.snapshotFlow
|
import androidx.compose.runtime.snapshotFlow
|
||||||
import androidx.compose.ui.unit.DpSize
|
import androidx.compose.ui.unit.DpSize
|
||||||
import androidx.glance.GlanceId
|
|
||||||
import androidx.glance.LocalGlanceId
|
|
||||||
import androidx.glance.LocalSize
|
import androidx.glance.LocalSize
|
||||||
import androidx.glance.appwidget.GlanceAppWidget
|
import androidx.glance.appwidget.GlanceAppWidget
|
||||||
|
import androidx.glance.appwidget.GlanceId
|
||||||
|
import androidx.glance.appwidget.LocalGlanceId
|
||||||
import kotlinx.coroutines.MainScope
|
import kotlinx.coroutines.MainScope
|
||||||
import kotlinx.coroutines.flow.filterNotNull
|
import kotlinx.coroutines.flow.filterNotNull
|
||||||
import kotlinx.coroutines.flow.firstOrNull
|
import kotlinx.coroutines.flow.firstOrNull
|
||||||
|
|
|
@ -11,7 +11,7 @@ buildscript {
|
||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
// keeping this here to allow AS to automatically update
|
// keeping this here to allow AS to automatically update
|
||||||
classpath("com.android.tools.build:gradle:7.1.0")
|
classpath("com.android.tools.build:gradle:7.0.4")
|
||||||
classpath("org.jetbrains.kotlin:kotlin-gradle-plugin:${kotlinVersion}")
|
classpath("org.jetbrains.kotlin:kotlin-gradle-plugin:${kotlinVersion}")
|
||||||
classpath("org.jetbrains.kotlin:kotlin-serialization:${kotlinVersion}")
|
classpath("org.jetbrains.kotlin:kotlin-serialization:${kotlinVersion}")
|
||||||
|
|
||||||
|
@ -33,7 +33,9 @@ allprojects {
|
||||||
mavenCentral()
|
mavenCentral()
|
||||||
maven(url = "https://maven.pkg.jetbrains.space/kotlin/p/kotlin/kotlin-js-wrappers")
|
maven(url = "https://maven.pkg.jetbrains.space/kotlin/p/kotlin/kotlin-js-wrappers")
|
||||||
maven(url = "https://jitpack.io")
|
maven(url = "https://jitpack.io")
|
||||||
|
maven(url = "https://androidx.dev/snapshots/builds/7888785/artifacts/repository")
|
||||||
maven(url = "https://maven.pkg.jetbrains.space/public/p/kotlinx-coroutines/maven")
|
maven(url = "https://maven.pkg.jetbrains.space/public/p/kotlinx-coroutines/maven")
|
||||||
|
maven(url = "https://maven.pkg.jetbrains.space/public/p/ktor/eap")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -156,9 +156,4 @@ object Deps {
|
||||||
const val logback = "ch.qos.logback:logback-classic:${Versions.logback}"
|
const val logback = "ch.qos.logback:logback-classic:${Versions.logback}"
|
||||||
const val kermit = "co.touchlab:kermit:${Versions.kermit}"
|
const val kermit = "co.touchlab:kermit:${Versions.kermit}"
|
||||||
}
|
}
|
||||||
|
|
||||||
object Glance {
|
|
||||||
const val tiles = "androidx.glance:glance-wear-tiles:1.0.0-alpha02"
|
|
||||||
const val appwidget = "androidx.glance:glance-appwidget:1.0.0-alpha02"
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
2
gradle/wrapper/gradle-wrapper.properties
vendored
2
gradle/wrapper/gradle-wrapper.properties
vendored
|
@ -2,4 +2,4 @@ distributionBase=GRADLE_USER_HOME
|
||||||
distributionPath=wrapper/dists
|
distributionPath=wrapper/dists
|
||||||
zipStoreBase=GRADLE_USER_HOME
|
zipStoreBase=GRADLE_USER_HOME
|
||||||
zipStorePath=wrapper/dists
|
zipStorePath=wrapper/dists
|
||||||
distributionUrl=https\://services.gradle.org/distributions/gradle-7.2-bin.zip
|
distributionUrl=https\://services.gradle.org/distributions/gradle-7.0.2-bin.zip
|
||||||
|
|
|
@ -2,6 +2,7 @@ pluginManagement {
|
||||||
repositories {
|
repositories {
|
||||||
gradlePluginPortal()
|
gradlePluginPortal()
|
||||||
mavenCentral()
|
mavenCentral()
|
||||||
|
maven(url = "https://maven.pkg.jetbrains.space/public/p/compose/dev")
|
||||||
}
|
}
|
||||||
resolutionStrategy {
|
resolutionStrategy {
|
||||||
eachPlugin {
|
eachPlugin {
|
||||||
|
|
|
@ -85,9 +85,7 @@ dependencies {
|
||||||
debugImplementation(composeUiTestManifest)
|
debugImplementation(composeUiTestManifest)
|
||||||
}
|
}
|
||||||
|
|
||||||
with(Deps.Glance) {
|
implementation("androidx.glance:glance-wear:1.0.0-SNAPSHOT")
|
||||||
implementation(tiles)
|
|
||||||
}
|
|
||||||
|
|
||||||
implementation(project(":common"))
|
implementation(project(":common"))
|
||||||
}
|
}
|
|
@ -8,16 +8,16 @@ import androidx.compose.ui.unit.TextUnitType
|
||||||
import androidx.compose.ui.unit.dp
|
import androidx.compose.ui.unit.dp
|
||||||
import androidx.glance.GlanceModifier
|
import androidx.glance.GlanceModifier
|
||||||
import androidx.glance.layout.Column
|
import androidx.glance.layout.Column
|
||||||
|
import androidx.glance.layout.Text
|
||||||
import androidx.glance.layout.padding
|
import androidx.glance.layout.padding
|
||||||
import androidx.glance.text.FontWeight
|
import androidx.glance.text.FontWeight
|
||||||
import androidx.glance.text.Text
|
|
||||||
import androidx.glance.text.TextStyle
|
import androidx.glance.text.TextStyle
|
||||||
import androidx.glance.unit.ColorProvider
|
import androidx.glance.unit.ColorProvider
|
||||||
import com.surrus.common.remote.Assignment
|
import com.surrus.common.remote.Assignment
|
||||||
import com.surrus.common.repository.PeopleInSpaceRepositoryInterface
|
import com.surrus.common.repository.PeopleInSpaceRepositoryInterface
|
||||||
import com.surrus.peopleinspace.tile.util.BaseGlanceTileService
|
import com.surrus.peopleinspace.tile.util.BaseGlanceTileService
|
||||||
import kotlinx.coroutines.flow.first
|
import kotlinx.coroutines.flow.first
|
||||||
import org.koin.core.component.inject
|
import org.koin.android.ext.android.inject
|
||||||
|
|
||||||
class PeopleInSpaceTile : BaseGlanceTileService<PeopleInSpaceTile.Data>() {
|
class PeopleInSpaceTile : BaseGlanceTileService<PeopleInSpaceTile.Data>() {
|
||||||
val repository: PeopleInSpaceRepositoryInterface by inject()
|
val repository: PeopleInSpaceRepositoryInterface by inject()
|
||||||
|
|
|
@ -1,16 +1,11 @@
|
||||||
package com.surrus.peopleinspace.tile.util
|
package com.surrus.peopleinspace.tile.util
|
||||||
|
|
||||||
import android.content.Context
|
|
||||||
import androidx.compose.runtime.Composable
|
import androidx.compose.runtime.Composable
|
||||||
import androidx.glance.wear.tiles.GlanceTileService
|
import androidx.glance.wear.GlanceTileService
|
||||||
import kotlinx.coroutines.Dispatchers
|
import kotlinx.coroutines.Dispatchers
|
||||||
import kotlinx.coroutines.runBlocking
|
import kotlinx.coroutines.runBlocking
|
||||||
import org.koin.core.component.KoinComponent
|
|
||||||
import org.koin.core.component.inject
|
|
||||||
|
|
||||||
abstract class BaseGlanceTileService<T> : GlanceTileService(), KoinComponent {
|
|
||||||
val context: Context by inject()
|
|
||||||
|
|
||||||
|
abstract class BaseGlanceTileService<T> : GlanceTileService() {
|
||||||
@Composable
|
@Composable
|
||||||
override fun Content() {
|
override fun Content() {
|
||||||
// Terrible hack for lack of suspend load function
|
// Terrible hack for lack of suspend load function
|
||||||
|
|
Loading…
Reference in a new issue