Skip to content

Commit 16460d8

Browse files
committed
initial commit
1 parent 4c09490 commit 16460d8

File tree

122 files changed

+4096
-0
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

122 files changed

+4096
-0
lines changed

.editorconfig

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
root = true
2+
3+
[*]
4+
indent_size = 2
5+
# Most of the standard properties are supported
6+
max_line_length = 100
7+
8+
# don't use wildcard for Java/Kotlin imports
9+
[*.{java,kt}]
10+
wildcard_import_limit = 999
11+
ij_kotlin_name_count_to_use_star_import = 999
12+
ij_kotlin_name_count_to_use_star_import_for_members = 999

.gitignore

Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
1+
# Built application files
2+
*.apk
3+
*.ap_
4+
5+
# Files for the ART/Dalvik VM
6+
*.dex
7+
8+
# Java class files
9+
*.class
10+
11+
# Generated files
12+
bin/
13+
gen/
14+
out/
15+
16+
# Gradle files
17+
/.idea
18+
!.idea/codeInsightSettings.xml
19+
.gradle/
20+
build/
21+
22+
# Local configuration file (sdk path, etc)
23+
local.properties
24+
secrets.properties
25+
26+
# Proguard folder generated by Eclipse
27+
proguard/
28+
29+
# Log Files
30+
*.log
31+
32+
# Android Studio Navigation editor temp files
33+
.navigation/
34+
35+
# Android Studio captures folder
36+
captures/
37+
38+
# Intellij
39+
*.iml
40+
.idea/workspace.xml
41+
.idea/tasks.xml
42+
.idea/gradle.xml
43+
.idea/dictionaries
44+
.idea/libraries
45+
app/.idea/
46+
47+
# Mac
48+
*.DS_Store
49+
50+
# Keystore files
51+
*.jks
52+
53+
# External native build folder generated in Android Studio 2.2 and later
54+
.externalNativeBuild
55+
56+
# Google Services (e.g. APIs or Firebase)
57+
google-services.json
58+
59+
# Freeline
60+
freeline.py
61+
freeline/
62+
freeline_project_description.json
63+
64+
# Eclipse
65+
.project
66+
.settings
67+
.classpath
68+
69+
# Kotlin
70+
.kotlin

CODE_OF_CONDUCT.md

Lines changed: 128 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,128 @@
1+
# Contributor Covenant Code of Conduct
2+
3+
## Our Pledge
4+
5+
We as members, contributors, and leaders pledge to make participation in our
6+
community a harassment-free experience for everyone, regardless of age, body
7+
size, visible or invisible disability, ethnicity, sex characteristics, gender
8+
identity and expression, level of experience, education, socio-economic status,
9+
nationality, personal appearance, race, religion, or sexual identity
10+
and orientation.
11+
12+
We pledge to act and interact in ways that contribute to an open, welcoming,
13+
diverse, inclusive, and healthy community.
14+
15+
## Our Standards
16+
17+
Examples of behavior that contributes to a positive environment for our
18+
community include:
19+
20+
* Demonstrating empathy and kindness toward other people
21+
* Being respectful of differing opinions, viewpoints, and experiences
22+
* Giving and gracefully accepting constructive feedback
23+
* Accepting responsibility and apologizing to those affected by our mistakes,
24+
and learning from the experience
25+
* Focusing on what is best not just for us as individuals, but for the
26+
overall community
27+
28+
Examples of unacceptable behavior include:
29+
30+
* The use of sexualized language or imagery, and sexual attention or
31+
advances of any kind
32+
* Trolling, insulting or derogatory comments, and personal or political attacks
33+
* Public or private harassment
34+
* Publishing others' private information, such as a physical or email
35+
address, without their explicit permission
36+
* Other conduct which could reasonably be considered inappropriate in a
37+
professional setting
38+
39+
## Enforcement Responsibilities
40+
41+
Community leaders are responsible for clarifying and enforcing our standards of
42+
acceptable behavior and will take appropriate and fair corrective action in
43+
response to any behavior that they deem inappropriate, threatening, offensive,
44+
or harmful.
45+
46+
Community leaders have the right and responsibility to remove, edit, or reject
47+
comments, commits, code, wiki edits, issues, and other contributions that are
48+
not aligned to this Code of Conduct, and will communicate reasons for moderation
49+
decisions when appropriate.
50+
51+
## Scope
52+
53+
This Code of Conduct applies within all community spaces, and also applies when
54+
an individual is officially representing the community in public spaces.
55+
Examples of representing our community include using an official e-mail address,
56+
posting via an official social media account, or acting as an appointed
57+
representative at an online or offline event.
58+
59+
## Enforcement
60+
61+
Instances of abusive, harassing, or otherwise unacceptable behavior may be
62+
reported to the community leaders responsible for enforcement at
63+
64+
All complaints will be reviewed and investigated promptly and fairly.
65+
66+
All community leaders are obligated to respect the privacy and security of the
67+
reporter of any incident.
68+
69+
## Enforcement Guidelines
70+
71+
Community leaders will follow these Community Impact Guidelines in determining
72+
the consequences for any action they deem in violation of this Code of Conduct:
73+
74+
### 1. Correction
75+
76+
**Community Impact**: Use of inappropriate language or other behavior deemed
77+
unprofessional or unwelcome in the community.
78+
79+
**Consequence**: A private, written warning from community leaders, providing
80+
clarity around the nature of the violation and an explanation of why the
81+
behavior was inappropriate. A public apology may be requested.
82+
83+
### 2. Warning
84+
85+
**Community Impact**: A violation through a single incident or series
86+
of actions.
87+
88+
**Consequence**: A warning with consequences for continued behavior. No
89+
interaction with the people involved, including unsolicited interaction with
90+
those enforcing the Code of Conduct, for a specified period of time. This
91+
includes avoiding interactions in community spaces as well as external channels
92+
like social media. Violating these terms may lead to a temporary or
93+
permanent ban.
94+
95+
### 3. Temporary Ban
96+
97+
**Community Impact**: A serious violation of community standards, including
98+
sustained inappropriate behavior.
99+
100+
**Consequence**: A temporary ban from any sort of interaction or public
101+
communication with the community for a specified period of time. No public or
102+
private interaction with the people involved, including unsolicited interaction
103+
with those enforcing the Code of Conduct, is allowed during this period.
104+
Violating these terms may lead to a permanent ban.
105+
106+
### 4. Permanent Ban
107+
108+
**Community Impact**: Demonstrating a pattern of violation of community
109+
standards, including sustained inappropriate behavior, harassment of an
110+
individual, or aggression toward or disparagement of classes of individuals.
111+
112+
**Consequence**: A permanent ban from any sort of public interaction within
113+
the community.
114+
115+
## Attribution
116+
117+
This Code of Conduct is adapted from the [Contributor Covenant][homepage],
118+
version 2.0, available at
119+
https://www.contributor-covenant.org/version/2/0/code_of_conduct.html.
120+
121+
Community Impact Guidelines were inspired by [Mozilla's code of conduct
122+
enforcement ladder](https://github.com/mozilla/diversity).
123+
124+
[homepage]: https://www.contributor-covenant.org
125+
126+
For answers to common questions about this code of conduct, see the FAQ at
127+
https://www.contributor-covenant.org/faq. Translations are available at
128+
https://www.contributor-covenant.org/translations.

CONTRIBUTING.md

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
## How to contribute
2+
We'd love to accept your patches and contributions to this project. There are just a few small guidelines you need to follow.
3+
4+
## Preparing a pull request for review
5+
Ensure your change is properly formatted by running:
6+
7+
```gradle
8+
./gradlew spotlessApply
9+
```
10+
11+
Please correct any failures before requesting a review.
12+
13+
## Code reviews
14+
All submissions, including submissions by project members, require review. We use GitHub pull requests for this purpose. Consult [GitHub Help](https://docs.github.com/en/github/collaborating-with-pull-requests/proposing-changes-to-your-work-with-pull-requests/about-pull-requests) for more information on using pull requests.

README.md

Lines changed: 110 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,110 @@
1+
# Server Driven Compose
2+
3+
<p align="center">
4+
<a href="https://opensource.org/licenses/Apache-2.0"><img alt="License" src="https://img.shields.io/badge/License-Apache%202.0-blue.svg"/></a>
5+
<a href="https://android-arsenal.com/api?level=21"><img alt="API" src="https://img.shields.io/badge/API-21%2B-brightgreen.svg?style=flat"/></a>
6+
<a href="https://github.com/skydoves/server-driven-compose/actions"><img alt="Build Status" src="https://github.com/skydoves/server-driven-compose/workflows/Android%20CI/badge.svg"/></a>
7+
<a href="https://github.com/skydoves"><img alt="Profile" src="https://skydoves.github.io/badges/skydoves.svg"/></a>
8+
</p>
9+
10+
<p align="center">
11+
🧙 Server Driven Compose showcases server-driven UI approaches in Jetpack Compose with Firebase.
12+
</p>
13+
14+
<p align="center">
15+
<img src="preview/gif0.gif"/>
16+
</p>
17+
18+
## Tech stack & Open-source libraries
19+
- Minimum SDK level 21.
20+
- [Kotlin](https://kotlinlang.org/) based, utilizing [Coroutines](https://github.com/Kotlin/kotlinx.coroutines) + [Flow](https://kotlin.github.io/kotlinx.coroutines/kotlinx-coroutines-core/kotlinx.coroutines.flow/) for asynchronous operations.
21+
- Jetpack Libraries:
22+
- Jetpack Compose: Android’s modern toolkit for declarative UI development.
23+
- Lifecycle: Observes Android lifecycles and manages UI states upon lifecycle changes.
24+
- ViewModel: Manages UI-related data and is lifecycle-aware, ensuring data survival through configuration changes.
25+
- Navigation: Facilitates screen navigation, complemented by [Hilt Navigation Compose](https://developer.android.com/jetpack/compose/libraries#hilt) for dependency injection.
26+
- [Hilt](https://dagger.dev/hilt/): Facilitates dependency injection.
27+
- Architecture:
28+
- MVVM Architecture (View - ViewModel - Model): Facilitates separation of concerns and promotes maintainability.
29+
- Repository Pattern: Acts as a mediator between different data sources and the application's business logic.
30+
- [Firebase Android KTX](https://github.com/skydoves/firebase-android-ktx): Kotlin & Compose-friendly Firebase extensions designed to help you focus on your business logic.
31+
- [Retrofit2 & OkHttp3](https://github.com/square/retrofit): Constructs REST APIs and facilitates paging network data retrieval.
32+
- [ksp](https://github.com/google/ksp): Kotlin Symbol Processing API for code generation and analysis.
33+
- [Landscapist Glide](https://github.com/skydoves/landscapist#glide), [animation](https://github.com/skydoves/landscapist#animation), [placeholder](https://github.com/skydoves/landscapist#placeholder): A pluggable, highly optimized Jetpack Compose and Kotlin Multiplatform image loading library that fetches and displays network images with Glide, Coil, and Fresco.
34+
35+
## Runing This Project on Your Side
36+
37+
1. First things first, download the following JSON file on your local PC: [Gist: JSON demo for Timeline UI](https://gist.github.com/skydoves/16267ebe987c6246d917814440f03aac).
38+
39+
</details>
40+
41+
2. Following the [Firebase setup guidelines](https://firebase.google.com/docs/android/setup), download the **google-services.json** and place it into the `app` directory on this project.
42+
43+
3. Next, set up the [Firebase Realtime Database](https://firebase.google.com/docs/database) in your Firebase dashboard. Once that's done, you can import the JSON file like the image below:
44+
45+
![import](figure/import-json.png)
46+
47+
4. Next, create a file named `secrets.properties` in the root directory of this project, and copy & paste your Realtime Database URL into it, as shown in the example below:
48+
49+
![import](figure/db-url.png)
50+
51+
```
52+
REALTIME_DATABASE_URL=https://server-driven-compose-default-rtdb.asia-southeast1.firebasedatabase.app/
53+
```
54+
55+
5. Build the project.
56+
57+
## Architecture
58+
**Server Driven Compose** adheres to the MVVM architecture and implements the Repository pattern, aligning with [Google's official architecture guidance](https://developer.android.com/topic/architecture).
59+
60+
The architecture of **Server Driven Compose** is structured into two distinct layers: the UI layer and the data layer. Each layer fulfills specific roles and responsibilities, outlined as follows:
61+
62+
**Server Driven Compose** follows the principles outlined in the [Guide to app architecture](https://developer.android.com/topic/architecture), making it an exemplary demonstration of architectural concepts in practical application.
63+
64+
### Architecture Overview
65+
66+
![architecture](figure/figure1.png)
67+
68+
- Each layer adheres to the principles of [unidirectional event/data flow](https://developer.android.com/topic/architecture/ui-layer#udf): the UI layer sends user events to the data layer, and the data layer provides data streams to other layers.
69+
- The data layer operates autonomously from other layers, maintaining purity without dependencies on external layers.
70+
71+
This loosely coupled architecture enhances component reusability and app scalability, facilitating seamless development and maintenance.
72+
73+
### UI Layer
74+
75+
![architecture](figure/figure2.png)
76+
77+
The UI layer encompasses UI elements responsible for configuring screens for user interaction, alongside the [ViewModel](https://developer.android.com/topic/libraries/architecture/viewmodel), which manages app states and restores data during configuration changes.
78+
- UI elements observe the data flow, ensuring synchronization with the underlying data layer.
79+
80+
## Modularization
81+
82+
**Server Driven Compose** adopted modularization strategies below:
83+
84+
- **Reusability**: Modulizing reusable codes properly enable opportunities for code sharing and limits code accessibility in other modules at the same time.
85+
- **Parallel Building**: Each module can be run in parallel and it reduces the build time.
86+
- **Strict visibility control**: Modules restrict to expose dedicated components and access to other layers, so it prevents they're being used outside the module
87+
- **Decentralized focusing**: Each developer team can assign their dedicated module and they can focus on their own modules.
88+
89+
For more information, check out the [Guide to Android app modularization](https://developer.android.com/topic/modularization).
90+
91+
## Find this repository useful? :heart:
92+
Support it by joining __[stargazers](https://github.com/skydoves/server-driven-compose/stargazers)__ for this repository. :star: <br>
93+
Also, __[follow me](https://github.com/skydoves)__ on GitHub for my next creations! 🤩
94+
95+
# License
96+
```xml
97+
Designed and developed by 2024 skydoves (Jaewoong Eum)
98+
99+
Licensed under the Apache License, Version 2.0 (the "License");
100+
you may not use this file except in compliance with the License.
101+
You may obtain a copy of the License at
102+
103+
http://www.apache.org/licenses/LICENSE-2.0
104+
105+
Unless required by applicable law or agreed to in writing, software
106+
distributed under the License is distributed on an "AS IS" BASIS,
107+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
108+
See the License for the specific language governing permissions and
109+
limitations under the License.
110+
```

app/.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
/build

0 commit comments

Comments
 (0)