Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

✨ Implement realm definition of clip items #315

Merged
merged 5 commits into from
Feb 16, 2024
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
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,7 @@ enum class AppFileType {
LOG,
ENCRYPT,
DATA,
IMAGE,
VIDEO,
FILE
}
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
package com.clipevery.clip.item

import java.io.File
import java.nio.file.Path

interface ClipFile {

val file: File
fun getFilePath(): Path

val extension: String
fun getExtension(): String
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
package com.clipevery.clip.item

import java.nio.file.Path

interface ClipFiles {
fun getFilePaths(): List<Path>
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,5 @@ package com.clipevery.clip.item

interface ClipHtml {

val html: String
var html: String
}
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,5 @@ import java.awt.Image

interface ClipImage {

val image: Image
fun getImage(): Image
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,5 @@ package com.clipevery.clip.item

interface ClipText {

val text: String
var text: String
}
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
package com.clipevery.clip.item

import java.net.URL

interface ClipUrl {
val url: URL
var url: String
}

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ interface ClipAppearItem {

fun getSearchContent(): String?

fun getMd5(): String
var md5: String

fun update(data: Any, md5: String)

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
package com.clipevery.dao.clip

interface ClipDao {

fun getMaxClipId(): Int
}

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -10,17 +10,37 @@ interface PathProvider {
AppFileType.LOG -> clipLogPath.resolve("logs")
AppFileType.ENCRYPT -> clipEncryptPath.resolve("encrypt")
AppFileType.DATA -> clipDataPath.resolve("data")
AppFileType.IMAGE -> clipDataPath.resolve("images")
AppFileType.VIDEO -> clipUserPath.resolve("videos")
AppFileType.FILE -> clipUserPath.resolve("files")
}

if (!path.toFile().exists()) {
path.toFile().mkdirs()
}
autoCreateDir(path)

return fileName?.let {
path.resolve(fileName)
} ?: path
}

fun resolve(basePath: Path,
path: String,
autoCreate: Boolean = true,
isFile: Boolean = false): Path {
val newPath = basePath.resolve(path)
if (isFile) {
autoCreateDir(newPath.parent)
} else {
autoCreateDir(newPath)
}
return newPath
}

private fun autoCreateDir(path: Path) {
if (!path.toFile().exists()) {
path.toFile().mkdirs()
}
}

val clipUserPath: Path

val clipLogPath: Path get() = clipUserPath
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,6 @@ interface OneFilePersist {
fun <T> save(config: T)

fun saveBytes(bytes: ByteArray)

fun delete(): Boolean
}
Loading
Loading