Skip to content

Commit

Permalink
SQUASHED IT ALL
Browse files Browse the repository at this point in the history
to remove careem email ;)
  • Loading branch information
efemoney committed Apr 10, 2024
1 parent caae894 commit e7127d4
Show file tree
Hide file tree
Showing 85 changed files with 2,030 additions and 1,064 deletions.
10 changes: 10 additions & 0 deletions .github/workflows/on-pr.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
name: On Pull Requests

on:
pull_request:
types: [ opened ]
branches: [ main ]

jobs:
build-and-test:
runs-on: ubuntu-latest
30 changes: 14 additions & 16 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,21 +1,19 @@
**/.idea/caches
**/.idea/dictionaries
**/.idea/libraries
**/.idea/modules
**/.idea/shelf
**/.idea/assetWizardSettings.xml
**/.idea/checkstyle-idea.xml
**/.idea/dictionaries.xml
**/.idea/modules.xml
**/.idea/misc.xml
**/.idea/navEditor.xml
**/.idea/workspace.xml
.idea/**
!.idea/codeStyles/
!.idea/vcs.xml
!.idea/gradle.xml

.gradle/
**/.gradle/

.kotlin/

build/
**/build/
**/captures/

local.properties
**/local.properties

/server/application-local.conf
/server/service-account.json
/server/firebase-config.json
server/application-local.conf
server/service-account.json
server/firebase-config.json
7 changes: 0 additions & 7 deletions .idea/compiler.xml

This file was deleted.

20 changes: 15 additions & 5 deletions .idea/gradle.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 0 additions & 6 deletions .idea/kotlinScripting.xml

This file was deleted.

15 changes: 0 additions & 15 deletions .idea/runConfigurations/lexiko_server.xml

This file was deleted.

59 changes: 30 additions & 29 deletions app/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,39 +1,40 @@
plugins {
id("com.android.application")
kotlin("android")
kotlin("kapt")
alias(libs.plugins.android.application)
alias(libs.plugins.kotlin.android)
alias(libs.plugins.kotlin.compose)
alias(libs.plugins.ksp)
}

android.buildFeatures.compose = true
android {
namespace = "dev.efemoney.lexiko.app"
defaultConfig {
targetSdk = 34
}
}

dependencies {
implementation(Deps.kotlin.stdlib.jdk8)
implementation(Deps.kotlinx.immutable.jvm)
implementation(Deps.kotlinx.coroutines.android)

implementation(projects.core)
implementation(libs.kotlin.stdlib)
implementation(libs.kotlinx.immutable.jvm)
implementation(libs.kotlinx.coroutines.android)

implementation(Deps.androidx.core)
implementation(Deps.androidx.activity)
implementation(Deps.androidx.activity.compose)
implementation(Deps.androidx.appcompat)
implementation(Deps.androidx.fragment)
implementation(Deps.androidx.navigation.compose)
implementation(libs.androidx.core)
implementation(libs.androidx.activity)
implementation(libs.androidx.activity.compose)
implementation(libs.androidx.appcompat)
implementation(libs.androidx.fragment)
implementation(libs.androidx.navigation.compose)

implementation(Deps.androidx.compose.runtime)
implementation(Deps.androidx.compose.ui)
implementation(Deps.androidx.compose.ui.tooling)
implementation(Deps.androidx.compose.material)
// implementation(Deps.androidx.compose.material3)
implementation(Deps.androidx.compose.material.icons)
implementation(Deps.androidx.compose.material.moarIcons)
implementation(libs.androidx.compose.ui)
implementation(libs.androidx.compose.ui.tooling)
implementation(libs.androidx.compose.material)
implementation(libs.androidx.compose.material3)
implementation(libs.androidx.compose.material.icons)
implementation(libs.androidx.compose.material.icons.extended)

implementation(Deps.coil)
implementation(Deps.coil.compose)
implementation(Deps.accompanist.insets)
implementation(Deps.accompanist.insetsUi)
implementation(Deps.accompanist.systemUiController)
implementation(libs.coil)
implementation(libs.coil.okhttp)
implementation(libs.coil.compose)

implementation(Deps.dagger)
kapt(Deps.dagger.compiler)
implementation(libs.dagger)
ksp(libs.dagger.compiler)
}
10 changes: 1 addition & 9 deletions app/src/dev/efemoney/lexiko/app/LexikoActivity.kt
Original file line number Diff line number Diff line change
Expand Up @@ -3,22 +3,14 @@ package dev.efemoney.lexiko.app
import android.os.Bundle
import androidx.activity.compose.setContent
import androidx.appcompat.app.AppCompatActivity
import androidx.compose.runtime.CompositionLocalProvider
import androidx.core.view.WindowCompat.setDecorFitsSystemWindows
import coil.compose.LocalImageLoader
import dev.efemoney.lexiko.app.internal.component
import dev.efemoney.lexiko.app.ui.LexikoApp

class LexikoActivity : AppCompatActivity() {

override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setDecorFitsSystemWindows(window, false)

setContent {
CompositionLocalProvider(LocalImageLoader provides component().imageLoader) {
LexikoApp()
}
}
setContent { LexikoApp() }
}
}
6 changes: 4 additions & 2 deletions app/src/dev/efemoney/lexiko/app/LexikoApplication.kt
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ package dev.efemoney.lexiko.app

import android.app.Application
import dev.efemoney.lexiko.DaggerCoreComponent
import dev.efemoney.lexiko.app.internal.DaggerAppComponent
import dev.efemoney.lexiko.app.internal.DaggerSingletonComponent
import dev.efemoney.lexiko.app.internal.SingletonComponent

class LexikoApplication : Application() {
Expand All @@ -11,6 +11,8 @@ class LexikoApplication : Application() {

override fun onCreate() {
super.onCreate()
component = DaggerAppComponent.factory().create(this, DaggerCoreComponent.create())
component = DaggerSingletonComponent.factory().create(this, DaggerCoreComponent.create())
}

override fun newImageLoader() = component.imageLoader
}
6 changes: 3 additions & 3 deletions app/src/dev/efemoney/lexiko/app/internal/component.kt
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import androidx.lifecycle.ViewModelProvider
import androidx.lifecycle.ViewModelStoreOwner
import androidx.lifecycle.get
import androidx.lifecycle.viewmodel.compose.LocalViewModelStoreOwner
import coil.ImageLoader
import coil3.ImageLoader
import dagger.BindsInstance
import dagger.Component
import dagger.Subcomponent
Expand All @@ -33,6 +33,8 @@ internal interface SingletonComponent {

val retainedComponentFactory: ForegroundComponent.Factory

val imageLoader: ImageLoader

@Component.Factory
interface Factory {

Expand All @@ -47,8 +49,6 @@ internal interface SingletonComponent {
@Subcomponent(modules = [ForegroundModule::class])
internal abstract class ForegroundComponent : ViewModel() {

abstract val imageLoader: ImageLoader

abstract val navigator: RealNavigator

abstract val lobbyPresenter: LobbyPresenter
Expand Down
29 changes: 16 additions & 13 deletions app/src/dev/efemoney/lexiko/app/internal/module.kt
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
package dev.efemoney.lexiko.app.internal

import android.content.Context
import coil.ImageLoader
import coil3.ImageLoader
import coil3.network.okhttp.OkHttpNetworkFetcherFactory
import coil3.serviceLoaderEnabled
import dagger.Binds
import dagger.Module
import dagger.Provides
Expand All @@ -13,7 +15,19 @@ import dev.efemoney.lexiko.navigation.Navigator
import okhttp3.OkHttpClient

@Module
internal interface SingletonModule
internal interface SingletonModule {
companion object {

@Provides
@Reusable
fun imageLoader(context: Context, okHttp: dagger.Lazy<OkHttpClient>) =
ImageLoader.Builder(context)
// Add okhttp fetching manually so we can specify a custom OkHttpClient instance.
.components { add(OkHttpNetworkFetcherFactory(okHttp::get)) }
.serviceLoaderEnabled(false)
.build()
}
}

@Module
internal interface ForegroundModule {
Expand All @@ -26,15 +40,4 @@ internal interface ForegroundModule {

@Binds
fun RealForegroundScope.asForegroundScope(): ForegroundScope

companion object {

@Provides
@Reusable
fun imageLoader(context: Context, okHttp: dagger.Lazy<OkHttpClient>) =
ImageLoader.Builder(context)
.callFactory { okHttp.get() }
.components {}
.build()
}
}
33 changes: 25 additions & 8 deletions app/src/dev/efemoney/lexiko/app/lobby/lobby.kt
Original file line number Diff line number Diff line change
@@ -1,13 +1,30 @@
package dev.efemoney.lexiko.app.lobby

import androidx.compose.foundation.Image
import androidx.compose.foundation.border
import androidx.compose.foundation.layout.*
import androidx.compose.foundation.layout.Row
import androidx.compose.foundation.layout.Spacer
import androidx.compose.foundation.layout.fillMaxSize
import androidx.compose.foundation.layout.fillMaxWidth
import androidx.compose.foundation.layout.height
import androidx.compose.foundation.layout.heightIn
import androidx.compose.foundation.layout.offset
import androidx.compose.foundation.layout.padding
import androidx.compose.foundation.layout.size
import androidx.compose.foundation.layout.width
import androidx.compose.foundation.layout.wrapContentWidth
import androidx.compose.foundation.lazy.LazyColumn
import androidx.compose.foundation.lazy.items
import androidx.compose.foundation.shape.CircleShape
import androidx.compose.foundation.shape.RoundedCornerShape
import androidx.compose.material.*
import androidx.compose.material.ContentAlpha
import androidx.compose.material.Icon
import androidx.compose.material.IconButton
import androidx.compose.material.LocalContentAlpha
import androidx.compose.material.MaterialTheme
import androidx.compose.material.Scaffold
import androidx.compose.material.Surface
import androidx.compose.material.Text
import androidx.compose.material.TopAppBar
import androidx.compose.material.icons.Icons
import androidx.compose.material.icons.filled.AccountCircle
import androidx.compose.material.icons.filled.Visibility
Expand All @@ -18,11 +35,12 @@ import androidx.compose.runtime.getValue
import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
import androidx.compose.ui.draw.clip
import androidx.compose.ui.res.painterResource
import androidx.compose.ui.tooling.preview.Preview
import androidx.compose.ui.tooling.preview.PreviewParameter
import androidx.compose.ui.unit.dp
import androidx.compose.ui.unit.sp
import coil.compose.rememberImagePainter
import coil.compose.AsyncImage
import dev.efemoney.lexiko.app.R
import dev.efemoney.lexiko.app.internal.component
import dev.efemoney.lexiko.app.ui.LexikoTheme
Expand Down Expand Up @@ -160,10 +178,9 @@ private fun SpectatorCount(spectatorCount: Int) {

@Composable
private fun PlayerAvatar(avatar: Avatar, modifier: Modifier = Modifier) {
Image(
painter = rememberImagePainter(avatar) {
placeholder(R.drawable.avatar_placeholder)
},
AsyncImage(
model = avatar,
placeholder = painterResource(R.drawable.avatar_placeholder),
contentDescription = null,
modifier = modifier
.border(2.dp, color = MaterialTheme.colors.surface, CircleShape)
Expand Down
6 changes: 3 additions & 3 deletions app/src/dev/efemoney/lexiko/app/navigation/navigation.kt
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
package dev.efemoney.lexiko.app.navigation

import androidx.navigation.NavDirections
import dev.efemoney.lexiko.app.internal.Retained
import dev.efemoney.lexiko.navigation.Direction
import dev.efemoney.lexiko.navigation.Navigator
import kotlinx.coroutines.channels.Channel
import javax.inject.Inject

@Retained
internal class RealNavigator @Inject constructor() : Navigator {

val directions = Channel<Direction>()
val directions = Channel<NavDirections>()

override fun navigate(direction: Direction) {
override fun navigate(direction: NavDirections) {
directions.trySend(direction)
}
}
Loading

0 comments on commit e7127d4

Please sign in to comment.