Skip to content

Commit

Permalink
Merge branch 'droidconKE:main' into main
Browse files Browse the repository at this point in the history
  • Loading branch information
Jacquigee authored Nov 3, 2023
2 parents f1e4925 + 11a5fdc commit 1602802
Show file tree
Hide file tree
Showing 59 changed files with 864 additions and 734 deletions.
83 changes: 49 additions & 34 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -84,8 +84,8 @@ The app will have the following features:
## Designs

This is the link to the app designs:
[Light Theme] (https://xd.adobe.com/view/dd5d0245-b92b-4678-9d4a-48b3a6f48191-880e/)
[Dark Theme] (https://xd.adobe.com/view/5ec235b6-c3c6-49a9-b783-1f1303deb1a8-0b91/)
- [Light Theme](https://xd.adobe.com/view/dd5d0245-b92b-4678-9d4a-48b3a6f48191-880e/)
- [Dark Theme](https://xd.adobe.com/view/5ec235b6-c3c6-49a9-b783-1f1303deb1a8-0b91/)

The app uses a design system: Chai

Expand All @@ -110,16 +110,9 @@ libraries.
and `ktor` as examples.
[plugins] Used to define plugins.

You need to add your dependency version in [versions]. This is unnecessary if you are not sharing
the version across different dependencies. After defining the version, add your library in
You need to add your dependency version in [versions]. After defining the version, add your library in
the [libraries] section as:

```toml
compose-activity = "androidx.activity:activity-compose:1.5.0"
```

Moreover, if you have already defined the version in [versions], you define it as:

```toml
androidx-splashscreen = { module = "androidx.core:core-splashscreen", version.ref = "splash" }
```
Expand Down Expand Up @@ -202,14 +195,21 @@ We would endlessly like to thank the following contributors
<sub><b>Hannah Olukoye</b></sub>
</a>
</td>
<td align="center">
<a href="https://github.com/Borwe">
<img src="https://avatars.githubusercontent.com/u/3319843?v=4" width="100;" alt="Borwe"/>
<br />
<sub><b>Brian Orwe</b></sub>
</a>
</td></tr>
<tr>
<td align="center">
<a href="https://github.com/chege4179">
<img src="https://avatars.githubusercontent.com/u/62762943?v=4" width="100;" alt="chege4179"/>
<br />
<sub><b>Peter Chege</b></sub>
</a>
</td></tr>
<tr>
</td>
<td align="center">
<a href="https://github.com/robert-nganga">
<img src="https://avatars.githubusercontent.com/u/52964743?v=4" width="100;" alt="robert-nganga"/>
Expand All @@ -231,13 +231,6 @@ We would endlessly like to thank the following contributors
<sub><b>Kenneth Mathari</b></sub>
</a>
</td>
<td align="center">
<a href="https://github.com/Borwe">
<img src="https://avatars.githubusercontent.com/u/3319843?v=4" width="100;" alt="Borwe"/>
<br />
<sub><b>Brian Orwe</b></sub>
</a>
</td>
<td align="center">
<a href="https://github.com/jumaallan">
<img src="https://avatars.githubusercontent.com/u/25085146?v=4" width="100;" alt="jumaallan"/>
Expand All @@ -254,17 +247,17 @@ We would endlessly like to thank the following contributors
</td></tr>
<tr>
<td align="center">
<a href="https://github.com/Jacquigee">
<img src="https://avatars.githubusercontent.com/u/25638707?v=4" width="100;" alt="Jacquigee"/>
<a href="https://github.com/kibettheophilus">
<img src="https://avatars.githubusercontent.com/u/61080898?v=4" width="100;" alt="kibettheophilus"/>
<br />
<sub><b>Jacquiline Gitau</b></sub>
<sub><b>Kibet Theo</b></sub>
</a>
</td>
<td align="center">
<a href="https://github.com/kibettheophilus">
<img src="https://avatars.githubusercontent.com/u/61080898?v=4" width="100;" alt="kibettheophilus"/>
<a href="https://github.com/Jacquigee">
<img src="https://avatars.githubusercontent.com/u/25638707?v=4" width="100;" alt="Jacquigee"/>
<br />
<sub><b>Kibet Theo</b></sub>
<sub><b>Jacquiline Gitau</b></sub>
</a>
</td>
<td align="center">
Expand All @@ -281,21 +274,28 @@ We would endlessly like to thank the following contributors
<sub><b>N3</b></sub>
</a>
</td>
<td align="center">
<a href="https://github.com/ndiritumichael">
<img src="https://avatars.githubusercontent.com/u/17760799?v=4" width="100;" alt="ndiritumichael"/>
<br />
<sub><b>Michael Ndiritu</b></sub>
</a>
</td>
<td align="center">
<a href="https://github.com/mog-rn">
<img src="https://avatars.githubusercontent.com/u/61131314?v=4" width="100;" alt="mog-rn"/>
<br />
<sub><b>Amos Nyaburi</b></sub>
</a>
</td>
</td></tr>
<tr>
<td align="center">
<a href="https://github.com/etonotieno">
<img src="https://avatars.githubusercontent.com/u/25648109?v=4" width="100;" alt="etonotieno"/>
<br />
<sub><b>Eton Otieno</b></sub>
</a>
</td></tr>
<tr>
</td>
<td align="center">
<a href="https://github.com/joelmuraguri">
<img src="https://avatars.githubusercontent.com/u/97348446?v=4" width="100;" alt="joelmuraguri"/>
Expand All @@ -310,6 +310,13 @@ We would endlessly like to thank the following contributors
<sub><b>Martin Thuo</b></sub>
</a>
</td>
<td align="center">
<a href="https://github.com/michaelbukachi">
<img src="https://avatars.githubusercontent.com/u/10145850?v=4" width="100;" alt="michaelbukachi"/>
<br />
<sub><b>Michael Bukachi</b></sub>
</a>
</td>
<td align="center">
<a href="https://github.com/Njoguu">
<img src="https://avatars.githubusercontent.com/u/60213982?v=4" width="100;" alt="Njoguu"/>
Expand All @@ -323,6 +330,14 @@ We would endlessly like to thank the following contributors
<br />
<sub><b>Terry Mochire</b></sub>
</a>
</td></tr>
<tr>
<td align="center">
<a href="https://github.com/cliffgor">
<img src="https://avatars.githubusercontent.com/u/17774205?v=4" width="100;" alt="cliffgor"/>
<br />
<sub><b>Cliff Gor</b></sub>
</a>
</td>
<td align="center">
<a href="https://github.com/emmanuelmuturia">
Expand All @@ -337,8 +352,7 @@ We would endlessly like to thank the following contributors
<br />
<sub><b>Paul Juma</b></sub>
</a>
</td></tr>
<tr>
</td>
<td align="center">
<a href="https://github.com/BKinya">
<img src="https://avatars.githubusercontent.com/u/30239692?v=4" width="100;" alt="BKinya"/>
Expand All @@ -359,12 +373,13 @@ We would endlessly like to thank the following contributors
<br />
<sub><b>Josphat Mwania</b></sub>
</a>
</td>
</td></tr>
<tr>
<td align="center">
<a href="https://github.com/michaelbukachi">
<img src="https://avatars.githubusercontent.com/u/10145850?v=4" width="100;" alt="michaelbukachi"/>
<a href="https://github.com/bagechengzi">
<img src="https://avatars.githubusercontent.com/u/89894288?v=4" width="100;" alt="bagechengzi"/>
<br />
<sub><b>Michael Bukachi</b></sub>
<sub><b>Null</b></sub>
</a>
</td>
<td align="center">
Expand Down
4 changes: 2 additions & 2 deletions app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -24,12 +24,12 @@
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>

<provider
android:name="androidx.startup.InitializationProvider"
android:authorities="${applicationId}.androidx-startup"
android:exported="false"
tools:node="remove"
/>
tools:node="remove" />
</application>

</manifest>
Original file line number Diff line number Diff line change
Expand Up @@ -23,28 +23,22 @@ import androidx.hilt.work.HiltWorkerFactory
import androidx.work.Configuration
import androidx.work.WorkManager
import com.android254.data.work.WorkConstants
import com.android254.data.work.WorkInitializer
import com.android254.droidconKE2023.crashlytics.CrashlyticsTree
import dagger.hilt.android.HiltAndroidApp
import javax.inject.Inject
import ke.droidcon.kotlin.BuildConfig
import ke.droidcon.kotlin.datasource.remote.utils.RemoteFeatureToggle
import org.jetbrains.annotations.NotNull
import timber.log.Timber

@HiltAndroidApp
class DroidconKE2023App : Application(), Configuration.Provider {
@Inject
lateinit var remoteFeatureToggle: RemoteFeatureToggle

@Inject
lateinit var workerFactory: HiltWorkerFactory
override fun onCreate() {
super.onCreate()
remoteFeatureToggle.sync()
initTimber()
setUpWorkerManagerNotificationChannel()
WorkInitializer.initialize(context = this)
}

override fun getWorkManagerConfiguration(): Configuration =
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,18 +24,18 @@ class AndroidHiltConventionPlugin : Plugin<Project> {
with(target) {
with(pluginManager) {
apply("dagger.hilt.android.plugin")
apply("org.jetbrains.kotlin.kapt")
apply("com.google.devtools.ksp")
}

dependencies {
"implementation"(libs.findLibrary("android.hilt").get())
"implementation"(libs.findLibrary("android.hilt.navigation.compose").get())
"implementation"(libs.findLibrary("hilt.work").get())
"implementation"(libs.findLibrary("hilt.common").get())
"kapt"(libs.findLibrary("android.hilt.androidx.compiler").get())
"kapt"(libs.findLibrary("android.hilt.compiler").get())
"kaptAndroidTest"(libs.findLibrary("android.hilt.compiler").get())
"kaptTest"(libs.findLibrary("android.hilt.compiler").get())
"ksp"(libs.findLibrary("android.hilt.androidx.compiler").get())
"ksp"(libs.findLibrary("android.hilt.compiler").get())
"kspAndroidTest"(libs.findLibrary("android.hilt.compiler").get())
"kspTest"(libs.findLibrary("android.hilt.compiler").get())
"androidTestImplementation"(libs.findLibrary("android.hilt.testing").get())
"testImplementation"(libs.findLibrary("android.hilt.compiler").get())
}
Expand Down
13 changes: 5 additions & 8 deletions build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,12 +1,5 @@
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
dependencies {
classpath("com.google.dagger:hilt-android-gradle-plugin:2.47")
classpath("com.google.gms:google-services:4.3.15")
classpath("com.google.firebase:firebase-crashlytics-gradle:2.9.9")
classpath("com.google.firebase:perf-plugin:1.4.2")
}
}

plugins {
alias(libs.plugins.android.application) apply false
alias(libs.plugins.android.library) apply false
Expand All @@ -16,6 +9,10 @@ plugins {
alias(libs.plugins.jlleitschuh)
alias(libs.plugins.detekt)
alias(libs.plugins.spotless)
alias(libs.plugins.hilt.plugin) apply false
alias(libs.plugins.gms) apply false
alias(libs.plugins.firebase.crashlytics) apply false
alias(libs.plugins.firebase.perf) apply false
}

allprojects {
Expand Down
19 changes: 16 additions & 3 deletions chai/src/main/java/com/droidconke/chai/colors/ChaiColors.kt
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ import com.droidconke.chai.atoms.ChaiBlue
import com.droidconke.chai.atoms.ChaiGrey
import com.droidconke.chai.atoms.ChaiGrey90
import com.droidconke.chai.atoms.ChaiLightGrey
import com.droidconke.chai.atoms.ChaiRed
import com.droidconke.chai.atoms.ChaiSmokeyGrey
import com.droidconke.chai.atoms.ChaiTeal90
import com.droidconke.chai.atoms.ChaiWhite
Expand All @@ -37,6 +38,10 @@ data class ChaiColors(
val inactiveBottomNavIconColor: Color = Color.Unspecified,
val titleTextColorPrimary: Color = Color.Unspecified,
val linkTextColorPrimary: Color = Color.Unspecified,
val eventDaySelectorActiveSurfaceColor: Color = Color.Unspecified,
val eventDaySelectorInactiveSurfaceColor: Color = Color.Unspecified,
val eventDaySelectorInactiveTextColor: Color = Color.Unspecified,
val eventDaySelectorActiveTextColor: Color = Color.Unspecified
)

val LocalChaiColorsPalette = staticCompositionLocalOf { ChaiColors() }
Expand All @@ -49,7 +54,11 @@ val ChaiLightColorPalette = ChaiColors(
activeBottomNavIconColor = ChaiBlue,
inactiveBottomNavIconColor = ChaiGrey90,
titleTextColorPrimary = ChaiBlue,
linkTextColorPrimary = ChaiBlue
linkTextColorPrimary = ChaiBlue,
eventDaySelectorActiveSurfaceColor = ChaiRed,
eventDaySelectorInactiveSurfaceColor = ChaiTeal90,
eventDaySelectorActiveTextColor = ChaiWhite,
eventDaySelectorInactiveTextColor = ChaiGrey90
)

val ChaiDarkColorPalette = ChaiColors(
Expand All @@ -60,5 +69,9 @@ val ChaiDarkColorPalette = ChaiColors(
activeBottomNavIconColor = ChaiTeal90,
inactiveBottomNavIconColor = ChaiWhite,
titleTextColorPrimary = ChaiWhite,
linkTextColorPrimary = ChaiLightGrey
)
linkTextColorPrimary = ChaiLightGrey,
eventDaySelectorActiveSurfaceColor = ChaiRed,
eventDaySelectorInactiveSurfaceColor = ChaiTeal90,
eventDaySelectorActiveTextColor = ChaiWhite,
eventDaySelectorInactiveTextColor = ChaiWhite
)
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,9 @@ import dagger.Module
import dagger.Provides
import dagger.hilt.InstallIn
import dagger.hilt.components.SingletonComponent
import javax.inject.Singleton
import ke.droidcon.kotlin.datasource.remote.utils.RemoteConfigConfig
import ke.droidcon.kotlin.datasource.remote.utils.RemoteFeatureToggle
import javax.inject.Singleton

@Module
@InstallIn(SingletonComponent::class)
Expand Down
31 changes: 29 additions & 2 deletions data/src/main/java/com/android254/data/repos/SessionsManager.kt
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,11 @@ package com.android254.data.repos
import com.android254.data.repos.mappers.toDomainModel
import com.android254.data.repos.mappers.toEntity
import com.android254.domain.models.Session
import com.android254.domain.models.SessionsInformationDomainModel
import com.android254.domain.repos.SessionsRepo
import java.text.SimpleDateFormat
import java.util.Date
import java.util.Locale
import javax.inject.Inject
import ke.droidcon.kotlin.datasource.local.dao.BookmarkDao
import ke.droidcon.kotlin.datasource.local.model.BookmarkEntity
Expand Down Expand Up @@ -51,6 +55,24 @@ class SessionsManager @Inject constructor(
}
}.flowOn(ioDispatcher)
}

override suspend fun fetchSessionsInformation(): Flow<SessionsInformationDomainModel> = combine(
localSessionsDataSource.getCachedSessions(),
bookmarkDao.getBookmarkIds()
) { sessions, bookmarks ->
val eventDays = sessions.groupBy { it.startTimestamp.toEventDay() }.keys.toList()
SessionsInformationDomainModel(
sessions = sessions.map { session -> session.toDomainModel().copy(isBookmarked = bookmarks.map { it.sessionId }.contains(session.id.toString())) },
eventDays = eventDays
)
}

private fun Long.toEventDay(): String {
val date = Date(this)
val sdf = SimpleDateFormat("dd", Locale.getDefault())
return sdf.format(date)
}

override fun fetchBookmarkedSessions(): Flow<List<Session>> {
val bookmarksFlow = bookmarkDao.getBookmarkIds()
val sessionsFlow = localSessionsDataSource.getCachedSessions()
Expand All @@ -74,9 +96,13 @@ class SessionsManager @Inject constructor(
}.flowOn(ioDispatcher)
}

override fun fetchSessionById(sessionId: String): Flow<Session?> {
override fun fetchFilteredSessions(vararg filters: List<String>) {
//
}

override fun fetchSessionById(id: String): Flow<Session?> {
val bookmarksFlow = bookmarkDao.getBookmarkIds()
val sessionFlow = localSessionsDataSource.getCachedSessionById(sessionId).map {
val sessionFlow = localSessionsDataSource.getCachedSessionById(id).map {
it?.toDomainModel()
}
return combine(sessionFlow, bookmarksFlow) { session, bookmarks ->
Expand Down Expand Up @@ -109,6 +135,7 @@ class SessionsManager @Inject constructor(
is DataResult.Error -> {
Timber.d("Sync sessions failed ${response.message}")
}

else -> {
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ class SpeakersManager @Inject constructor(

override suspend fun fetchSpeakerCount(): Flow<Int> = localSpeakersDataSource.fetchCachedSpeakerCount()

override suspend fun getSpeakerById(id: Int): ResourceResult<Speaker> = ResourceResult.Success(localSpeakersDataSource.getCachedSpeakerById(id)?.toDomainModel())
override suspend fun getSpeakerByName(name: String): ResourceResult<Speaker> = ResourceResult.Success(localSpeakersDataSource.getCachedSpeakerByName(name)?.toDomainModel())

override suspend fun syncSpeakers() {
when (val response = remoteSpeakersDataSource.getAllSpeakersRemote()) {
Expand Down
Loading

0 comments on commit 1602802

Please sign in to comment.