Skip to content

Commit

Permalink
Library improvements (#84)
Browse files Browse the repository at this point in the history
  • Loading branch information
shalva97 authored Mar 24, 2023
1 parent d64e073 commit 871e1d7
Show file tree
Hide file tree
Showing 46 changed files with 11,663 additions and 250 deletions.
77 changes: 4 additions & 73 deletions build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,74 +1,5 @@
import org.jetbrains.compose.ExperimentalComposeLibrary

plugins {
kotlin("multiplatform") version "1.8.0"
kotlin("plugin.serialization") version "1.8.0"
// id("com.github.johnrengelman.shadow") version "7.1.2" // TODO also add support for jvm
id("com.adarshr.test-logger") version "3.2.0"
id("org.jetbrains.compose") version "1.3.0"
`maven-publish`
}

group = "me.shalva97"
version = "2.1.1"

repositories {
mavenCentral()
maven { url = uri("https://maven.pkg.jetbrains.space/public/p/kotlinx-html/maven") }
maven("https://maven.pkg.jetbrains.space/public/p/compose/dev")
}

dependencies {
commonMainImplementation("junit:junit:4.13.2")
commonTestImplementation(kotlin("test-junit"))
commonMainImplementation("org.jetbrains.kotlinx:kotlinx-serialization-json:1.4.1")
commonMainImplementation("org.jetbrains.kotlinx:kotlinx-datetime:0.4.0")
commonMainImplementation("org.jetbrains.kotlinx:kotlinx-coroutines-core:1.6.4")
commonMainImplementation("org.kodein.di:kodein-di-framework-compose:7.18.0")
commonMainImplementation("org.kodein.di:kodein-di:7.18.0")
commonMainImplementation(compose.ui)
commonMainImplementation(compose.foundation)
commonMainImplementation(compose.materialIconsExtended)
@OptIn(ExperimentalComposeLibrary::class) commonMainImplementation(compose.material3)
commonMainImplementation(compose.runtime)
}

kotlin {
jvm {
val main by compilations.getting {
kotlinOptions {
jvmTarget = JavaVersion.VERSION_11.toString()
}
dependencies {
implementation(compose.desktop.macos_x64)
implementation("com.darkrockstudios:mpfilepicker:1.0.0")
}
}
}

js(IR) {
browser()
binaries.executable()
}

sourceSets {
val commonMain by getting {

}
val commonTest by getting {
dependencies {
implementation("org.jetbrains.kotlinx:kotlinx-coroutines-test:1.6.4")
}
}
val jsMain by getting {
dependencies {
implementation(kotlin("stdlib-js"))
implementation("org.jetbrains.kotlinx:kotlinx-html:0.8.1")
}
}
}
}

compose.experimental {
web.application {}
}
kotlin("multiplatform") version "1.8.0" apply false
kotlin("plugin.serialization") version "1.8.0" apply false
id("com.adarshr.test-logger") version "3.2.0" apply false
}
3 changes: 1 addition & 2 deletions jitpack.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
jdk:
- openjdk11
install:
- echo "Running a custom install command"
- ./gradlew -xtest clean publishJvmPublicationToMavenLocal
- ./gradlew -xtest clean publishKotlinMultiplatformPublicationToMavenLocal
File renamed without changes.
68 changes: 68 additions & 0 deletions multiplatform-ui/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
import org.jetbrains.compose.ExperimentalComposeLibrary

plugins {
kotlin("multiplatform") version "1.8.0"
kotlin("plugin.serialization") version "1.8.0"
id("com.adarshr.test-logger") version "3.2.0"
id("org.jetbrains.compose") version "1.3.0"
}

repositories {
mavenCentral()
maven("https://maven.pkg.jetbrains.space/public/p/kotlinx-html/maven")
maven("https://maven.pkg.jetbrains.space/public/p/compose/dev")
}

kotlin {
jvm {
val main by compilations.getting {
kotlinOptions {
jvmTarget = JavaVersion.VERSION_11.toString()
}
dependencies {
implementation(compose.desktop.macos_x64)
implementation("com.darkrockstudios:mpfilepicker:1.0.0")
}
}
}

js(IR) {
browser()
binaries.executable()
}

sourceSets {
val commonMain by getting {
dependencies {
implementation("junit:junit:4.13.2")
implementation(kotlin("test-junit"))
implementation("org.jetbrains.kotlinx:kotlinx-serialization-json:1.4.1")
implementation("org.jetbrains.kotlinx:kotlinx-datetime:0.4.0")
implementation("org.jetbrains.kotlinx:kotlinx-coroutines-core:1.6.4")
implementation("org.kodein.di:kodein-di-framework-compose:7.18.0")
implementation("org.kodein.di:kodein-di:7.18.0")
implementation(compose.ui)
implementation(compose.foundation)
implementation(compose.materialIconsExtended)
@OptIn(ExperimentalComposeLibrary::class) implementation(compose.material3)
implementation(compose.runtime)
implementation(project(":parser"))
}
}
val commonTest by getting {
dependencies {
implementation("org.jetbrains.kotlinx:kotlinx-coroutines-test:1.6.4")
}
}
val jsMain by getting {
dependencies {
implementation(kotlin("stdlib-js"))
implementation("org.jetbrains.kotlinx:kotlinx-html:0.8.1")
}
}
}
}

compose.experimental {
web.application {}
}
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
package gui.data
package data

import YoutubeHistory
import gui.di.MAIN
import gui.di.kodein
import gui.models.HistoryFile
import di.MAIN
import di.kodein
import kotlinx.coroutines.CoroutineDispatcher
import kotlinx.coroutines.CoroutineScope
import kotlinx.coroutines.flow.*
import models.HistoryFile
import org.kodein.di.DI
import org.kodein.di.DIAware
import org.kodein.di.instance
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package gui.data
package data

import kotlinx.coroutines.flow.MutableStateFlow

Expand Down
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
package gui.di
package di

import gui.data.HistoryFilesRepository
import gui.data.SettingsRepo
import gui.ui.HomeScreenViewModel
import gui.ui.tabs.HistoryScreenViewModel
import data.HistoryFilesRepository
import data.SettingsRepo
import kotlinx.coroutines.CoroutineDispatcher
import kotlinx.coroutines.Dispatchers
import org.kodein.di.DI
import org.kodein.di.bindProvider
import org.kodein.di.bindSingleton
import ui.HomeScreenViewModel
import ui.tabs.HistoryScreenViewModel

expect fun mainDispatcher(): CoroutineDispatcher

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
package gui.domain
package domain

import gui.models.HistoryFile
import models.HistoryFile

expect suspend fun selectAndParseFilesFromDisk(): List<HistoryFile>
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
package gui.models
package models

data class HistoryFile(val fileName: String, val contents: String)
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package gui.models
package models

import androidx.compose.material.icons.Icons
import androidx.compose.material.icons.rounded.Download
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package gui.ui
package ui

import androidx.compose.foundation.layout.Row
import androidx.compose.foundation.layout.Spacer
Expand All @@ -9,20 +9,20 @@ import androidx.compose.material3.*
import androidx.compose.runtime.*
import androidx.compose.ui.Modifier
import androidx.compose.ui.unit.dp
import gui.data.HistoryFilesRepository
import gui.di.kodein
import gui.domain.selectAndParseFilesFromDisk
import gui.models.HistoryFile
import gui.models.HomeTab
import gui.ui.tabs.DownloadsScreen
import gui.ui.tabs.HistoryScreen
import gui.ui.tabs.SettingsScreen
import gui.ui.tabs.StatsScreen
import data.HistoryFilesRepository
import di.kodein
import domain.selectAndParseFilesFromDisk
import kotlinx.coroutines.launch
import models.HistoryFile
import models.HomeTab
import org.kodein.di.DI
import org.kodein.di.DIAware
import org.kodein.di.compose.localDI
import org.kodein.di.instance
import ui.tabs.DownloadsScreen
import ui.tabs.HistoryScreen
import ui.tabs.SettingsScreen
import ui.tabs.StatsScreen

@OptIn(ExperimentalMaterial3Api::class)
@Composable
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package gui.ui.tabs
package ui.tabs

import androidx.compose.material3.Text
import androidx.compose.runtime.Composable
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package gui.ui.tabs
package ui.tabs

import androidx.compose.foundation.gestures.scrollBy
import androidx.compose.foundation.layout.Column
Expand All @@ -15,8 +15,8 @@ import androidx.compose.ui.input.pointer.PointerEvent
import androidx.compose.ui.input.pointer.PointerEventType
import androidx.compose.ui.input.pointer.onPointerEvent
import androidx.compose.ui.unit.dp
import gui.data.HistoryFilesRepository
import gui.di.kodein
import data.HistoryFilesRepository
import di.kodein
import kotlinx.coroutines.flow.*
import kotlinx.coroutines.launch
import org.jetbrains.skiko.SkikoPointerEvent
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package gui.ui.tabs
package ui.tabs

import androidx.compose.foundation.layout.*
import androidx.compose.material3.Button
Expand All @@ -9,7 +9,7 @@ import androidx.compose.runtime.*
import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
import androidx.compose.ui.unit.dp
import gui.data.SettingsRepo
import data.SettingsRepo
import org.kodein.di.compose.localDI
import org.kodein.di.instance

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package gui.ui.tabs
package ui.tabs

import androidx.compose.material3.Text
import androidx.compose.runtime.Composable
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package gui.di
package di

import kotlinx.coroutines.CoroutineDispatcher
import kotlinx.coroutines.Dispatchers
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package gui.domain
package domain

import gui.models.HistoryFile
import kotlinx.browser.document
import models.HistoryFile
import org.w3c.dom.Document
import org.w3c.dom.HTMLInputElement
import org.w3c.dom.ItemArrayLike
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,11 @@ import androidx.compose.material3.MaterialTheme
import androidx.compose.material3.darkColorScheme
import androidx.compose.material3.lightColorScheme
import androidx.compose.ui.window.Window
import gui.di.kodein
import gui.ui.HomeScreen
import di.kodein
import kotlinx.browser.window
import org.jetbrains.skiko.wasm.onWasmReady
import org.kodein.di.compose.withDI
import ui.HomeScreen

fun main() {
onWasmReady {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,6 @@
canvas.height = window.innerHeight;

</script>
<script src="Youtube_history_parser.js"></script>
<script src="multiplatform-ui.js"></script>
</body>
</html>
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package gui.di
package di

import kotlinx.coroutines.CoroutineDispatcher
import kotlinx.coroutines.Dispatchers
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package gui.domain
package domain

import gui.models.HistoryFile
import models.HistoryFile
import java.awt.FileDialog
import java.awt.Frame
import java.io.File
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@ import androidx.compose.ui.unit.dp
import androidx.compose.ui.window.Window
import androidx.compose.ui.window.application
import androidx.compose.ui.window.rememberWindowState
import gui.di.kodein
import gui.ui.HomeScreen
import di.kodein
import org.kodein.di.compose.withDI
import ui.HomeScreen

fun main() = application {
Window(
Expand Down
1 change: 1 addition & 0 deletions parser/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
build
Loading

0 comments on commit 871e1d7

Please sign in to comment.