Skip to content

Commit 91e4e7e

Browse files
committed
add initial components
1 parent cf55b05 commit 91e4e7e

Some content is hidden

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

54 files changed

+2043
-33
lines changed

app/.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
build

app/build.gradle.kts

+13
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
1+
import org.jetbrains.kotlin.gradle.dsl.KotlinJvmOptions
2+
13
plugins {
24
id("com.android.application")
35
kotlin("android")
6+
kotlin("plugin.serialization")
47
}
58

69
android {
@@ -36,11 +39,21 @@ android {
3639

3740
kotlinOptions {
3841
jvmTarget = "11"
42+
optIn("androidx.compose.material3.ExperimentalMaterial3Api")
43+
optIn("androidx.compose.animation.ExperimentalAnimationApi")
44+
optIn("androidx.compose.foundation.ExperimentalFoundationApi")
3945
}
4046
}
4147

48+
fun KotlinJvmOptions.optIn(library: String) {
49+
freeCompilerArgs = freeCompilerArgs +
50+
"-opt-in=$library"
51+
}
52+
4253
dependencies {
54+
Dependencies.Ktor.applyDependencies(this)
4355
Dependencies.AndroidxCore.applyDependencies(this)
4456
Dependencies.Compose.applyDependencies(this)
57+
Dependencies.Accompanist.applyDependencies(this)
4558
Dependencies.Koin.applyDependencies(this)
4659
}

app/src/main/AndroidManifest.xml

+13-1
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,23 @@
33
package="com.vanced.store">
44

55
<application
6+
android:name=".VSApp"
67
android:allowBackup="true"
78
android:icon="@mipmap/ic_launcher"
89
android:label="@string/app_name"
910
android:roundIcon="@mipmap/ic_launcher_round"
1011
android:supportsRtl="true"
11-
android:theme="@style/Theme.VancedStore" />
12+
android:theme="@style/Theme.VancedStore">
13+
14+
<activity
15+
android:name=".ui.activity.MainActivity"
16+
android:exported="true">
17+
<intent-filter>
18+
<action android:name="android.intent.action.MAIN" />
19+
<category android:name="android.intent.category.LAUNCHER" />
20+
</intent-filter>
21+
</activity>
22+
23+
</application>
1224

1325
</manifest>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
package com.vanced.store
2+
3+
import android.app.Application
4+
import com.vanced.store.di.httpModule
5+
import com.vanced.store.di.repositoryModule
6+
import com.vanced.store.di.viewModelModule
7+
import org.koin.android.ext.koin.androidContext
8+
import org.koin.core.context.startKoin
9+
10+
class VSApp : Application() {
11+
12+
override fun onCreate() {
13+
super.onCreate()
14+
15+
startKoin {
16+
androidContext(this@VSApp)
17+
18+
modules(
19+
httpModule,
20+
repositoryModule,
21+
viewModelModule
22+
)
23+
}
24+
}
25+
26+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
package com.vanced.store.di
2+
3+
import io.ktor.client.*
4+
import io.ktor.client.engine.android.*
5+
import io.ktor.client.plugins.*
6+
import io.ktor.serialization.kotlinx.json.*
7+
import kotlinx.serialization.json.Json
8+
import org.koin.dsl.module
9+
10+
val json = Json {
11+
ignoreUnknownKeys = true
12+
}
13+
14+
val httpModule = module {
15+
16+
fun provideKtorClient(): HttpClient {
17+
return HttpClient(Android) {
18+
expectSuccess = false
19+
install(ContentNegotiation) {
20+
json(json)
21+
}
22+
}
23+
}
24+
25+
single { provideKtorClient() }
26+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
package com.vanced.store.di
2+
3+
import com.vanced.store.domain.repository.BrowseRepository
4+
import com.vanced.store.domain.repository.BrowseRepositoryImpl
5+
import org.koin.dsl.module
6+
7+
val repositoryModule = module {
8+
fun provideBrowseRepository(): BrowseRepository {
9+
return BrowseRepositoryImpl()
10+
}
11+
12+
single { provideBrowseRepository() }
13+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
package com.vanced.store.di
2+
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
package com.vanced.store.di
2+
3+
import com.vanced.store.domain.repository.BrowseRepository
4+
import com.vanced.store.ui.viewmodel.BrowseViewModel
5+
import org.koin.androidx.viewmodel.dsl.viewModel
6+
import org.koin.dsl.module
7+
8+
val viewModelModule = module {
9+
fun provideBrowseViewModel(
10+
browseRepository: BrowseRepository
11+
): BrowseViewModel {
12+
return BrowseViewModel(browseRepository)
13+
}
14+
15+
viewModel { provideBrowseViewModel(get()) }
16+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
package com.vanced.store.domain.model
2+
3+
import com.vanced.store.network.dto.AppDto
4+
5+
data class BrowseAppModel(
6+
val appName: String,
7+
val appDescription: String,
8+
val appIconUrl: String
9+
) {
10+
companion object {
11+
fun fromDto(appDto: AppDto): BrowseAppModel {
12+
return with (appDto) {
13+
BrowseAppModel(
14+
appName = appName,
15+
appDescription = appDescription,
16+
appIconUrl = ""
17+
)
18+
}
19+
}
20+
}
21+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
package com.vanced.store.domain.repository
2+
3+
import com.vanced.store.domain.model.BrowseAppModel
4+
5+
interface BrowseRepository {
6+
7+
suspend fun getApps(): List<BrowseAppModel>
8+
9+
}
10+
11+
class BrowseRepositoryImpl : BrowseRepository {
12+
13+
override suspend fun getApps(): List<BrowseAppModel> {
14+
TODO("Not yet implemented")
15+
}
16+
17+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
package com.vanced.store.domain.repository
2+
3+
interface LibraryRepository {
4+
5+
6+
7+
}
8+
9+
class LibraryRepositoryImpl : LibraryRepository {
10+
11+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
package com.vanced.store.network.dto
2+
3+
import kotlinx.serialization.SerialName
4+
import kotlinx.serialization.Serializable
5+
6+
@Serializable
7+
data class AppDto(
8+
@SerialName("name")
9+
val appName: String,
10+
11+
@SerialName("description")
12+
val appDescription: String,
13+
14+
@SerialName("data_nonroot")
15+
val nonrootData: AppNonrootDataDto?,
16+
17+
@SerialName("data_root")
18+
val rootData: AppRootDataDto?,
19+
)
20+
21+
@Serializable
22+
data class AppNonrootDataDto(
23+
@SerialName("version_name")
24+
override val versionName: String,
25+
26+
@SerialName("version_code")
27+
override val versionCode: Int,
28+
29+
@SerialName("package_name")
30+
override val packageName: String,
31+
) : AppDataDto
32+
33+
@Serializable
34+
data class AppRootDataDto(
35+
@SerialName("version_name")
36+
override val versionName: String,
37+
38+
@SerialName("version_code")
39+
override val versionCode: Int,
40+
41+
@SerialName("package_name")
42+
override val packageName: String,
43+
44+
@SerialName("needs_hook")
45+
val needsHook: Boolean,
46+
) : AppDataDto
47+
48+
private interface AppDataDto {
49+
50+
val versionName: String
51+
52+
val versionCode: Int
53+
54+
val packageName: String
55+
56+
}
57+
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
package com.vanced.store.network.service
2+
3+
import io.ktor.client.*
4+
5+
interface BrowseService {
6+
7+
}
8+
9+
class BrowseServiceImpl(
10+
private val client: HttpClient
11+
) : BrowseService {
12+
13+
14+
15+
}

0 commit comments

Comments
 (0)