Skip to content

Commit 961429b

Browse files
committed
feat(README.md): Update documentation and add license - Enhances README with badges, article link, and clarifies sections; adds MIT license file.
1 parent 1a391b4 commit 961429b

File tree

3 files changed

+81
-24
lines changed

3 files changed

+81
-24
lines changed

LICENSE

+21
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
MIT License
2+
3+
Copyright (c) 2025 Muhammad Utsman
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.

README.MD

+27-20
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,13 @@
1+
<p>
2+
<a href="https://central.sonatype.com/artifact/io.github.utsmannn/compose-remote-layout/overview"><img alt="Maven Central Version" src="https://img.shields.io/maven-central/v/io.github.utsmannn/compose-remote-layout"></a>
3+
<a href="https://github.com/utsmannn/compose-remote-layout/actions/workflows/publish.yaml"><img alt="Publish to Maven Central" src="https://github.com/utsmannn/compose-remote-layout/actions/workflows/publish.yaml/badge.svg"></a>
4+
</p>
5+
6+
17
# Compose Remote Layout
8+
Article published on [Medium](https://medium.com/@utsmannn/server-driven-ui-with-compose-remote-layout-bdc902d973f8)
29

3-
## 1. Background and Motivation
10+
## Background and Motivation
411

512
In modern app development, the ability to update UI components without deploying new app versions is
613
increasingly important. While solutions like React Native and Flutter offer this capability, they
@@ -15,7 +22,7 @@ This library was created to solve several key challenges:
1522
- Platform-specific UI customization from a central source
1623
- Real-time UI updates for critical changes
1724

18-
## 2. Key Features
25+
## Key Features
1926

2027
The compose-remote-layout module provides several core features:
2128

@@ -48,7 +55,7 @@ The compose-remote-layout module provides several core features:
4855

4956
https://github.com/user-attachments/assets/6479f0c1-338e-4d1e-90e9-25c2ebf72395
5057

51-
## 3. Download
58+
## Download
5259

5360
Add the dependencies to your `build.gradle.kts`:
5461

@@ -64,9 +71,9 @@ implementation("io.github.utsmannn:compose-remote-layout-iosarm64:{version}")
6471
implementation("io.github.utsmannn:compose-remote-layout-js:{version}")
6572
```
6673

67-
## 4. Usage Guide
74+
## Usage Guide
6875

69-
### 4.1 Default Usage
76+
### Default Usage
7077

7178
Basic implementation using built-in components:
7279

@@ -108,7 +115,7 @@ Example JSON layout:
108115
}
109116
```
110117

111-
### 4.2 Custom Node Registration
118+
### Custom Node Registration
112119

113120
Create and register custom components:
114121

@@ -148,7 +155,7 @@ Use in JSON:
148155
}
149156
```
150157

151-
### 4.3 Modifier System
158+
### Modifier System
152159

153160
The library supports extensive modifiers through JSON:
154161

@@ -169,7 +176,7 @@ The library supports extensive modifiers through JSON:
169176
}
170177
```
171178

172-
### 4.4 Scoped Modifiers
179+
### Scoped Modifiers
173180

174181
Different components support specific modifiers:
175182

@@ -198,12 +205,12 @@ Different components support specific modifiers:
198205
}
199206
```
200207

201-
# 5. How It Works
208+
# How It Works
202209

203210
The library operates through several interconnected systems that handle JSON parsing, component
204211
rendering, and state management. Let's explore how each part works.
205212

206-
## 5.1 Core Flow
213+
## Core Flow
207214

208215
The basic flow of the library follows this sequence:
209216

@@ -253,7 +260,7 @@ fun MyScreen() {
253260
}
254261
```
255262

256-
## 5.2 JSON Parsing and Component Creation
263+
## JSON Parsing and Component Creation
257264

258265
Here's how the library processes JSON into UI components:
259266

@@ -291,7 +298,7 @@ fun LayoutScreen() {
291298
}
292299
```
293300

294-
## 5.3 Value Binding System
301+
## Value Binding System
295302

296303
The value binding system manages dynamic content updates:
297304

@@ -347,7 +354,7 @@ fun CounterExample() {
347354
}
348355
```
349356

350-
## 5.4 Custom Component Registration
357+
## Custom Component Registration
351358

352359
The process for registering and using custom components:
353360

@@ -401,7 +408,7 @@ class MainActivity : ComponentActivity() {
401408
}
402409
```
403410

404-
## 5.5 Event Handling Flow
411+
## Event Handling Flow
405412

406413
The event system handles user interactions:
407414

@@ -445,7 +452,7 @@ fun ButtonExample() {
445452
}
446453
```
447454

448-
## 5.6 Layout Updates and Caching
455+
## Layout Updates and Caching
449456

450457
Updates and caching flow:
451458

@@ -484,7 +491,7 @@ fun DynamicUpdates() {
484491
}
485492
```
486493

487-
## 6. Sample Projects
494+
## Sample Projects
488495

489496
### Firebase Remote Config Integration
490497

@@ -494,9 +501,9 @@ The repository includes a [Firebase sample](samples/firebaseApp) project demonst
494501
2. **Real-time Updates**: Layout updates without app deployment
495502
3. **Cross-platform Support**: Implementation for Android and iOS
496503

497-
## 7. JSON Builder Module
504+
## JSON Builder Module
498505

499-
### 7.1 Using jsonBuilderWeb Module
506+
### Using jsonBuilderWeb Module
500507

501508
![json_builder.png](images/json_builder.png)
502509

@@ -528,7 +535,7 @@ To run the remote config server:
528535
npm run start
529536
```
530537

531-
## 8. Potential Use Cases
538+
## Potential Use Cases
532539

533540
This library can handle various scenarios:
534541

@@ -552,7 +559,7 @@ This library can handle various scenarios:
552559
- New feature rollouts
553560
- Experimental features
554561

555-
## 9. Important Disclaimer
562+
## Important Disclaimer
556563

557564
⚠️ **Early Development Stage**
558565

samples/simpleApp/composeApp/src/commonMain/kotlin/sample/app/App.kt

+33-4
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,17 @@
11
package sample.app
22

33
import androidx.compose.runtime.Composable
4+
import androidx.compose.runtime.LaunchedEffect
5+
import androidx.compose.runtime.getValue
6+
import androidx.compose.runtime.mutableStateOf
7+
import androidx.compose.runtime.remember
8+
import androidx.compose.runtime.rememberCoroutineScope
9+
import androidx.compose.runtime.setValue
10+
import com.utsman.composeremote.BindsValue
411
import com.utsman.composeremote.DynamicLayout
512
import com.utsman.composeremote.createLayoutComponent
13+
import kotlinx.coroutines.delay
14+
import kotlinx.coroutines.launch
615

716
@Composable
817
fun App() {
@@ -18,9 +27,8 @@ fun App() {
1827
},
1928
"children": [
2029
{
21-
"user": {
22-
"name": "Utsman",
23-
"phone": "0812345678"
30+
"text": {
31+
"content": "Counter: {counter}"
2432
}
2533
}
2634
]
@@ -29,5 +37,26 @@ fun App() {
2937
"""
3038

3139
val component = createLayoutComponent(jsonLayout)
32-
DynamicLayout(component = component)
40+
val bindsValue = remember { BindsValue() }
41+
42+
var counter by remember { mutableStateOf(0) }
43+
44+
val scope = rememberCoroutineScope()
45+
LaunchedEffect(Unit) {
46+
while (true) {
47+
scope.launch {
48+
counter++
49+
}
50+
delay(1000)
51+
}
52+
}
53+
54+
LaunchedEffect(counter) {
55+
bindsValue.setValue("counter", counter)
56+
}
57+
58+
DynamicLayout(
59+
component = component,
60+
bindValue = bindsValue,
61+
)
3362
}

0 commit comments

Comments
 (0)