Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 26 additions & 7 deletions app/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
import org.jetbrains.kotlin.gradle.dsl.JvmTarget
import org.jetbrains.kotlin.util.prefixIfNot

plugins {
alias(libs.plugins.android.application)
alias(libs.plugins.kotlin.android)
alias(libs.plugins.kotlin.compose)
id("org.jetbrains.kotlin.plugin.serialization")
id("com.google.devtools.ksp")
id("kotlin-parcelize")
}
Expand All @@ -18,7 +20,7 @@ android {
}
}
namespace = "com.paulcoding.hviewer"
compileSdk = 35
compileSdk = 36

val repoUrl = providers.exec {
commandLine = "git remote get-url origin".split(' ')
Expand All @@ -32,7 +34,7 @@ android {
minSdk = 26
targetSdk = 34
versionCode = 1
versionName = "1.5.0"
versionName = "1.6.0"

buildConfigField("String", "REPO_URL", "\"$repoUrl\"")

Expand Down Expand Up @@ -68,13 +70,17 @@ android {
targetCompatibility = JavaVersion.VERSION_17
isCoreLibraryDesugaringEnabled = true
}
kotlinOptions {
jvmTarget = "17"
}

buildFeatures {
compose = true
buildConfig = true
}

kotlin {
compilerOptions {
jvmTarget.set(JvmTarget.JVM_17)
}
}
}

dependencies {
Expand All @@ -88,7 +94,11 @@ dependencies {
implementation(libs.androidx.ui.tooling.preview)
implementation(libs.androidx.material3)

implementation(libs.js)
implementation(libs.js) {
exclude(
group = "io.ktor",
)
}
implementation(libs.androidx.navigation.compose)
implementation(libs.kotlinx.coroutines.core)
implementation(libs.mmkv)
Expand All @@ -108,7 +118,7 @@ dependencies {

implementation(libs.ktor.client.core)
implementation(libs.ktor.client.android)
implementation(libs.ktor.serialization.gson)
implementation(libs.ktor.serialization.kotlinx.json)
implementation(libs.ktor.client.content.negotiation)
implementation(libs.ktor.client.logging)
implementation(libs.androidx.webkit)
Expand All @@ -124,6 +134,15 @@ dependencies {

implementation(libs.androidx.work.runtime.ktx)

implementation(libs.koin.core)
implementation(libs.koin.androidx.compose)
implementation(libs.koin.ktor)
implementation(libs.koin.logger.slf4j)
implementation(libs.koin.annotations)
implementation(libs.koin.androidx.workmanager)

implementation(libs.kotlinx.serialization.json)

testImplementation(libs.junit)
androidTestImplementation(libs.androidx.junit)
androidTestImplementation(libs.androidx.espresso.core)
Expand Down
36 changes: 5 additions & 31 deletions app/schemas/com.paulcoding.hviewer.database.AppDatabase/6.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@
"formatVersion": 1,
"database": {
"version": 6,
"identityHash": "9a533ec4d7da1d93de96fb8ff43d17b9",
"identityHash": "d6a4ff6e532191f65ce7dc9e59b19c18",
"entities": [
{
"tableName": "post_items",
"createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`url` TEXT NOT NULL, `name` TEXT NOT NULL, `thumbnail` TEXT NOT NULL, `createdAt` INTEGER NOT NULL, `tags` TEXT, `size` INTEGER, `views` INTEGER, `quantity` INTEGER, `favorite` INTEGER NOT NULL, `favoriteAt` INTEGER NOT NULL, `viewed` INTEGER NOT NULL, `viewedAt` INTEGER NOT NULL, PRIMARY KEY(`url`))",
"tableName": "PostItem",
"createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`url` TEXT NOT NULL, `name` TEXT NOT NULL, `thumbnail` TEXT NOT NULL, `createdAt` INTEGER NOT NULL, `tags` TEXT, `size` INTEGER, `views` INTEGER, `quantity` INTEGER)",
"fields": [
{
"fieldPath": "url",
Expand Down Expand Up @@ -55,37 +55,11 @@
"columnName": "quantity",
"affinity": "INTEGER",
"notNull": false
},
{
"fieldPath": "favorite",
"columnName": "favorite",
"affinity": "INTEGER",
"notNull": true
},
{
"fieldPath": "favoriteAt",
"columnName": "favoriteAt",
"affinity": "INTEGER",
"notNull": true
},
{
"fieldPath": "viewed",
"columnName": "viewed",
"affinity": "INTEGER",
"notNull": true
},
{
"fieldPath": "viewedAt",
"columnName": "viewedAt",
"affinity": "INTEGER",
"notNull": true
}
],
"primaryKey": {
"autoGenerate": false,
"columnNames": [
"url"
]
"columnNames": []
},
"indices": [],
"foreignKeys": []
Expand All @@ -94,7 +68,7 @@
"views": [],
"setupQueries": [
"CREATE TABLE IF NOT EXISTS room_master_table (id INTEGER PRIMARY KEY,identity_hash TEXT)",
"INSERT OR REPLACE INTO room_master_table (id,identity_hash) VALUES(42, '9a533ec4d7da1d93de96fb8ff43d17b9')"
"INSERT OR REPLACE INTO room_master_table (id,identity_hash) VALUES(42, 'd6a4ff6e532191f65ce7dc9e59b19c18')"
]
}
}
102 changes: 102 additions & 0 deletions app/schemas/com.paulcoding.hviewer.database.AppDatabase/7.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,102 @@
{
"formatVersion": 1,
"database": {
"version": 7,
"identityHash": "16b37833f6882e7ecb34faa2ab4c529a",
"entities": [
{
"tableName": "favorite",
"createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`url` TEXT NOT NULL, `name` TEXT NOT NULL, `thumbnail` TEXT NOT NULL, `tags` TEXT, `favoriteAt` INTEGER NOT NULL, PRIMARY KEY(`url`))",
"fields": [
{
"fieldPath": "url",
"columnName": "url",
"affinity": "TEXT",
"notNull": true
},
{
"fieldPath": "name",
"columnName": "name",
"affinity": "TEXT",
"notNull": true
},
{
"fieldPath": "thumbnail",
"columnName": "thumbnail",
"affinity": "TEXT",
"notNull": true
},
{
"fieldPath": "tags",
"columnName": "tags",
"affinity": "TEXT",
"notNull": false
},
{
"fieldPath": "favoriteAt",
"columnName": "favoriteAt",
"affinity": "INTEGER",
"notNull": true
}
],
"primaryKey": {
"autoGenerate": false,
"columnNames": [
"url"
]
},
"indices": [],
"foreignKeys": []
},
{
"tableName": "history",
"createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`url` TEXT NOT NULL, `name` TEXT NOT NULL, `thumbnail` TEXT NOT NULL, `tags` TEXT, `viewedAt` INTEGER NOT NULL, PRIMARY KEY(`url`))",
"fields": [
{
"fieldPath": "url",
"columnName": "url",
"affinity": "TEXT",
"notNull": true
},
{
"fieldPath": "name",
"columnName": "name",
"affinity": "TEXT",
"notNull": true
},
{
"fieldPath": "thumbnail",
"columnName": "thumbnail",
"affinity": "TEXT",
"notNull": true
},
{
"fieldPath": "tags",
"columnName": "tags",
"affinity": "TEXT",
"notNull": false
},
{
"fieldPath": "viewedAt",
"columnName": "viewedAt",
"affinity": "INTEGER",
"notNull": true
}
],
"primaryKey": {
"autoGenerate": false,
"columnNames": [
"url"
]
},
"indices": [],
"foreignKeys": []
}
],
"views": [],
"setupQueries": [
"CREATE TABLE IF NOT EXISTS room_master_table (id INTEGER PRIMARY KEY,identity_hash TEXT)",
"INSERT OR REPLACE INTO room_master_table (id,identity_hash) VALUES(42, '16b37833f6882e7ecb34faa2ab4c529a')"
]
}
}
19 changes: 17 additions & 2 deletions app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -59,8 +59,14 @@
</intent-filter>
</activity>

<activity
android:name=".WebActivity"
android:exported="true"
android:theme="@style/Theme.HViewer">
</activity>

<service
android:name=".ui.page.post.DownloadService"
android:name=".helper.DownloadImageService"
android:foregroundServiceType="dataSync" />
<service
android:name=".worker.DownloadApkService"
Expand All @@ -75,6 +81,15 @@
android:name="android.support.FILE_PROVIDER_PATHS"
android:resource="@xml/provider_paths" />
</provider>
` <provider
android:name="androidx.startup.InitializationProvider"
android:authorities="${applicationId}.androidx-startup"
android:exported="false"
tools:node="merge">
<meta-data
android:name="androidx.work.WorkManagerInitializer"
android:value="androidx.startup"
tools:node="remove" />
</provider>`
</application>

</manifest>
15 changes: 14 additions & 1 deletion app/src/main/java/com/paulcoding/hviewer/Constants.kt
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,17 @@ package com.paulcoding.hviewer

const val CHECK_FOR_UPDATE_CHANNEL = "check_for_update"
const val CHECK_FOR_UPDATE_APK_CHANNEL = "check_for_update_app"
const val ACTION_INSTALL_APK = "ACTION_INSTALL_APK"
const val ACTION_INSTALL_APK = "ACTION_INSTALL_APK"
const val APK_NAME = "latest.apk"
const val PIN_COUNT = 4


object H_JS_FUNCTIONS {
const val GET_SEARCH_URL = "getSearchUrl"
const val GET_POSTS = "getPosts"
const val SEARCH = "search"
}

object H_JS_PROPERTIES {
const val BASE_URL = "baseUrl"
}
Loading