From 533735d4a08333dfe885dc501d92f77b66c60b17 Mon Sep 17 00:00:00 2001 From: Maxwell Date: Tue, 19 Mar 2024 19:55:32 +0200 Subject: [PATCH] chore: house keeping refactoring and cleanups --- .github/PULL_REQUEST_TEMPLATE.md | 15 ++++---------- .../main/java/io/wax911/emojifysample/App.kt | 2 +- .../wax911/emojifysample/EmojiInitializer.kt | 2 +- .../io/wax911/emoji/buildSrc/Libraries.kt | 2 +- .../wax911/emoji/buildSrc/module/Modules.kt | 2 +- .../emoji/buildSrc/plugin/CorePlugin.kt | 6 ++---- .../plugin/components/AndroidConfiguration.kt | 15 ++++++++------ .../plugin/components/AndroidOptions.kt | 5 ++--- .../plugin/extensions/ProjectExtensions.kt | 9 ++++++--- contract/build.gradle.kts | 12 +---------- .../emojify/contract/model/AbstractEmoji.kt | 18 ++++++++++++++++- .../wax911/emojify/contract/model/IEmoji.kt | 16 +++++++++++++++ .../contract/serializer/IEmojiDeserializer.kt | 16 +++++++++++++++ .../io/wax911/emojify/core/EmojiLoader.kt | 2 +- .../serializer/{ => gson}/GsonDeserializer.kt | 4 ++-- .../serializer/{ => gson}/GsonEmoji.kt | 20 +++++++++++++++++-- .../{ => kotlinx}/KotlinxDeserializer.kt | 3 ++- .../serializer/{ => kotlinx}/KotlinxEmoji.kt | 18 ++++++++++++++++- .../{ => moshi}/MoshiDeserializer.kt | 5 ++--- .../serializer/{ => moshi}/MoshiEmoji.kt | 20 +++++++++++++++++-- 20 files changed, 137 insertions(+), 55 deletions(-) rename serializer/gson/src/main/kotlin/io/wax911/emojify/serializer/{ => gson}/GsonDeserializer.kt (92%) rename serializer/gson/src/main/kotlin/io/wax911/emojify/serializer/{ => gson}/GsonEmoji.kt (52%) rename serializer/kotlinx/src/main/kotlin/io/wax911/emojify/serializer/{ => kotlinx}/KotlinxDeserializer.kt (92%) rename serializer/kotlinx/src/main/kotlin/io/wax911/emojify/serializer/{ => kotlinx}/KotlinxEmoji.kt (54%) rename serializer/moshi/src/main/kotlin/io/wax911/emojify/serializer/{ => moshi}/MoshiDeserializer.kt (91%) rename serializer/moshi/src/main/kotlin/io/wax911/emojify/serializer/{ => moshi}/MoshiEmoji.kt (53%) diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md index 3125f31a..4917662a 100644 --- a/.github/PULL_REQUEST_TEMPLATE.md +++ b/.github/PULL_REQUEST_TEMPLATE.md @@ -1,18 +1,13 @@ # AniTrend Pull Request -Thank you for contributing! Please take a moment to review our [**contributing -guidelines**](https://github.com/AniTrend/android-emojify/blob/develop/CONTRIBUTING.md) -to make the process easy and effective for everyone involved. +Thank you for contributing! Please take a moment to review our [**contributing guidelines**](https://github.com/AniTrend/android-emojify/blob/develop/CONTRIBUTING.md) to make the process easy and effective for everyone involved. -**Please open an issue** before embarking on any significant pull request, especially those that -add a new library or change existing tests, otherwise you risk spending a lot of time working -on something that might not end up being merged into the project. +**Please open an issue** before embarking on any significant pull request, especially those that add a new library or change existing tests, otherwise you risk spending a lot of time working on something that might not end up being merged into the project. Before opening a pull request, please ensure you've done the following: -- You have followed our [**contributing - guidelines**](https://github.com/AniTrend/android-emojify/blob/develop/CONTRIBUTING.md) +- You have followed our [**contributing guidelines**](https://github.com/AniTrend/android-emojify/blob/develop/CONTRIBUTING.md) - Double checked that your branch is based on `develop` and targets `develop` (where applicable) - Pull request has tests (if applicable) - Documentation is updated (if necessary) @@ -32,6 +27,4 @@ Before opening a pull request, please ensure you've done the following: -**IMPORTANT**: By submitting a patch, you agree to allow the project -owners to license your work under the terms of -the [Apache License 2.0](https://github.com/AniTrend/android-emojify/blob/develop/LICENSE.md). +**IMPORTANT**: By submitting a patch, you agree to allow the project owners to license your work under the terms of the [Apache License 2.0](https://github.com/AniTrend/android-emojify/blob/develop/LICENSE.md). diff --git a/app/src/main/java/io/wax911/emojifysample/App.kt b/app/src/main/java/io/wax911/emojifysample/App.kt index c8325fb3..2bbd262f 100644 --- a/app/src/main/java/io/wax911/emojifysample/App.kt +++ b/app/src/main/java/io/wax911/emojifysample/App.kt @@ -3,7 +3,7 @@ package io.wax911.emojifysample import android.app.Application import androidx.startup.AppInitializer import io.wax911.emojify.EmojiManager -import io.wax911.emojify.serializer.KotlinxDeserializer +import io.wax911.emojify.serializer.kotlinx.KotlinxDeserializer /** * Created by max on 2017/09/22. diff --git a/app/src/main/java/io/wax911/emojifysample/EmojiInitializer.kt b/app/src/main/java/io/wax911/emojifysample/EmojiInitializer.kt index dc3048c2..c5f55764 100644 --- a/app/src/main/java/io/wax911/emojifysample/EmojiInitializer.kt +++ b/app/src/main/java/io/wax911/emojifysample/EmojiInitializer.kt @@ -2,7 +2,7 @@ package io.wax911.emojifysample import io.wax911.emojify.contract.serializer.IEmojiDeserializer import io.wax911.emojify.initializer.AbstractEmojiInitializer -import io.wax911.emojify.serializer.KotlinxDeserializer +import io.wax911.emojify.serializer.kotlinx.KotlinxDeserializer class EmojiInitializer : AbstractEmojiInitializer() { override val serializer: IEmojiDeserializer = KotlinxDeserializer() diff --git a/buildSrc/src/main/java/io/wax911/emoji/buildSrc/Libraries.kt b/buildSrc/src/main/java/io/wax911/emoji/buildSrc/Libraries.kt index 6d982316..65ffe12a 100644 --- a/buildSrc/src/main/java/io/wax911/emoji/buildSrc/Libraries.kt +++ b/buildSrc/src/main/java/io/wax911/emoji/buildSrc/Libraries.kt @@ -8,7 +8,7 @@ object Libraries { object Emojify { val emojify = Modules.Library.Emojify.path() val contract = Modules.Library.Contract.path() - val serializerKotlinx = Modules.Library.SerializerKotlinx.path() + val serializerKotlinx = Modules.Library.SerializerKotlinX.path() val serializerGson = Modules.Library.SerializerGson.path() val serializerMoshi = Modules.Library.SerializerMoshi.path() } diff --git a/buildSrc/src/main/java/io/wax911/emoji/buildSrc/module/Modules.kt b/buildSrc/src/main/java/io/wax911/emoji/buildSrc/module/Modules.kt index 242df2b4..a0f0a1b9 100644 --- a/buildSrc/src/main/java/io/wax911/emoji/buildSrc/module/Modules.kt +++ b/buildSrc/src/main/java/io/wax911/emoji/buildSrc/module/Modules.kt @@ -18,7 +18,7 @@ internal object Modules { enum class Library(override val id: String) : Module { Emojify("emojify"), Contract("contract"), - SerializerKotlinx("serializer:kotlinx"), + SerializerKotlinX("serializer:kotlinx"), SerializerGson("serializer:gson"), SerializerMoshi("serializer:moshi"), } diff --git a/buildSrc/src/main/java/io/wax911/emoji/buildSrc/plugin/CorePlugin.kt b/buildSrc/src/main/java/io/wax911/emoji/buildSrc/plugin/CorePlugin.kt index c7536e34..90652a56 100644 --- a/buildSrc/src/main/java/io/wax911/emoji/buildSrc/plugin/CorePlugin.kt +++ b/buildSrc/src/main/java/io/wax911/emoji/buildSrc/plugin/CorePlugin.kt @@ -13,8 +13,7 @@ open class CorePlugin : Plugin { /** * Inspecting available extensions */ - @Suppress("UnstableApiUsage") - internal fun Project.availableExtensions() { + private fun Project.availableExtensions() { val extensionSchema = project.extensions.extensionsSchema extensionSchema.forEach { println("Available extension for module ${project.path}: ${it.name} -> ${it.publicType}") @@ -24,8 +23,7 @@ open class CorePlugin : Plugin { /** * Inspecting available components */ - @Suppress("UnstableApiUsage") - internal fun Project.availableComponents() { + private fun Project.availableComponents() { val collectionSchema = project.components.asMap collectionSchema.forEach { println("Available component for module ${project.path}: ${it.key} -> ${it.value}") diff --git a/buildSrc/src/main/java/io/wax911/emoji/buildSrc/plugin/components/AndroidConfiguration.kt b/buildSrc/src/main/java/io/wax911/emoji/buildSrc/plugin/components/AndroidConfiguration.kt index 695f742b..02402faa 100644 --- a/buildSrc/src/main/java/io/wax911/emoji/buildSrc/plugin/components/AndroidConfiguration.kt +++ b/buildSrc/src/main/java/io/wax911/emoji/buildSrc/plugin/components/AndroidConfiguration.kt @@ -1,7 +1,13 @@ package io.wax911.emoji.buildSrc.plugin.components import com.android.build.gradle.internal.dsl.DefaultConfig -import io.wax911.emoji.buildSrc.plugin.extensions.* +import io.wax911.emoji.buildSrc.plugin.extensions.baseAppExtension +import io.wax911.emoji.buildSrc.plugin.extensions.baseExtension +import io.wax911.emoji.buildSrc.plugin.extensions.isLibraryModule +import io.wax911.emoji.buildSrc.plugin.extensions.isSampleModule +import io.wax911.emoji.buildSrc.plugin.extensions.libs +import io.wax911.emoji.buildSrc.plugin.extensions.props +import io.wax911.emoji.buildSrc.plugin.extensions.spotlessExtension import org.gradle.api.JavaVersion import org.gradle.api.Project import org.jetbrains.kotlin.gradle.dsl.KotlinCompile @@ -13,7 +19,7 @@ internal fun Project.configureSpotless() { spotlessExtension().run { kotlin { target("**/kotlin/**/*.kt") - targetExclude("$buildDir/**/*.kt", "**/test/**/*.kt", "bin/**/*.kt") + targetExclude("${layout.buildDirectory}/**/*.kt", "**/test/**/*.kt", "bin/**/*.kt") ktlint(libs.versions.ktlint.get()) licenseHeaderFile(rootProject.file("spotless/copyright.kt")) } @@ -28,7 +34,6 @@ private fun Project.configureLint() = baseAppExtension().run { } } -@Suppress("UnstableApiUsage") private fun DefaultConfig.applyAdditionalConfiguration(project: Project) { if (project.isSampleModule()) { applicationId = "io.wax911.emoji.sample" @@ -106,9 +111,7 @@ internal fun Project.configureAndroid(): Unit = baseExtension().run { if (isSampleModule()) { compileArgs.add("-opt-in=kotlinx.coroutines.ExperimentalCoroutinesApi") compileArgs.add("-opt-in=kotlinx.coroutines.FlowPreview") - } else - compileArgs.add("-opt-in=kotlinx.serialization.ExperimentalSerializationApi") - // Filter out modules that won't be using coroutines + } freeCompilerArgs = compileArgs } } diff --git a/buildSrc/src/main/java/io/wax911/emoji/buildSrc/plugin/components/AndroidOptions.kt b/buildSrc/src/main/java/io/wax911/emoji/buildSrc/plugin/components/AndroidOptions.kt index 007f0739..581d04cb 100644 --- a/buildSrc/src/main/java/io/wax911/emoji/buildSrc/plugin/components/AndroidOptions.kt +++ b/buildSrc/src/main/java/io/wax911/emoji/buildSrc/plugin/components/AndroidOptions.kt @@ -26,7 +26,7 @@ private fun Project.createMavenPublicationUsing(sourcesJar: Jar) { version = props[PropertyTypes.VERSION] artifact(sourcesJar) - artifact("${project.buildDir}/outputs/aar/${project.name}-release.aar") + artifact("${project.layout.buildDirectory}/outputs/aar/${project.name}-release.aar") from(component) pom { @@ -148,7 +148,6 @@ private fun Project.createDokkaTaskProvider() = tasks.named("dokkaHtm } -@Suppress("UnstableApiUsage") internal fun Project.configureOptions() { if (isLibraryModule()) { println("Applying additional tasks options for dokka and javadoc on ${project.path}") @@ -161,7 +160,7 @@ internal fun Project.configureOptions() { } val classesJar by tasks.register("classesJar", Jar::class.java) { - from("${project.buildDir}/intermediates/classes/release") + from("${project.layout.buildDirectory}/intermediates/classes/release") } artifacts { diff --git a/buildSrc/src/main/java/io/wax911/emoji/buildSrc/plugin/extensions/ProjectExtensions.kt b/buildSrc/src/main/java/io/wax911/emoji/buildSrc/plugin/extensions/ProjectExtensions.kt index 11b2b742..95276bd7 100644 --- a/buildSrc/src/main/java/io/wax911/emoji/buildSrc/plugin/extensions/ProjectExtensions.kt +++ b/buildSrc/src/main/java/io/wax911/emoji/buildSrc/plugin/extensions/ProjectExtensions.kt @@ -22,11 +22,14 @@ fun Project.isSampleModule() = name == Modules.App.Sample.id fun Project.isLibraryModule() = - name == Modules.Library.Emojify.id + name == "emojify" || + name == "contract" || + name == "kotlinx" || + name == "gson" || + name == "moshi" internal val Project.libs: LibrariesForLibs - get() = - extensions.getByType() + get() = extensions.getByType() internal val Project.props: PropertiesReader get() = PropertiesReader(this) diff --git a/contract/build.gradle.kts b/contract/build.gradle.kts index d9ee914c..2051ce90 100644 --- a/contract/build.gradle.kts +++ b/contract/build.gradle.kts @@ -1,19 +1,9 @@ plugins { - id("com.android.library") - id("org.jetbrains.kotlin.android") + id("io.wax911.emojify") } android { namespace = "io.wax911.emojify.contract" - compileSdk = 34 - - compileOptions { - sourceCompatibility = JavaVersion.VERSION_1_8 - targetCompatibility = JavaVersion.VERSION_1_8 - } - kotlinOptions { - jvmTarget = "1.8" - } } dependencies { diff --git a/contract/src/main/kotlin/io/wax911/emojify/contract/model/AbstractEmoji.kt b/contract/src/main/kotlin/io/wax911/emojify/contract/model/AbstractEmoji.kt index e2d5719d..2e61dd57 100644 --- a/contract/src/main/kotlin/io/wax911/emojify/contract/model/AbstractEmoji.kt +++ b/contract/src/main/kotlin/io/wax911/emojify/contract/model/AbstractEmoji.kt @@ -1,3 +1,19 @@ +/* + * Copyright 2024 AniTrend + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + package io.wax911.emojify.contract.model import java.nio.charset.Charset @@ -6,7 +22,7 @@ import java.nio.charset.Charset * Abstract class holding some logic. * To implement for parser-specific data representation with their annotation */ -abstract class AbstractEmoji: IEmoji { +abstract class AbstractEmoji : IEmoji { override val unicode: String by lazy(LazyThreadSafetyMode.NONE) { String(emoji.toByteArray(), Charset.forName("UTF-8")) } diff --git a/contract/src/main/kotlin/io/wax911/emojify/contract/model/IEmoji.kt b/contract/src/main/kotlin/io/wax911/emojify/contract/model/IEmoji.kt index e01584bb..0ae89afb 100644 --- a/contract/src/main/kotlin/io/wax911/emojify/contract/model/IEmoji.kt +++ b/contract/src/main/kotlin/io/wax911/emojify/contract/model/IEmoji.kt @@ -1,3 +1,19 @@ +/* + * Copyright 2024 AniTrend + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + package io.wax911.emojify.contract.model /** diff --git a/contract/src/main/kotlin/io/wax911/emojify/contract/serializer/IEmojiDeserializer.kt b/contract/src/main/kotlin/io/wax911/emojify/contract/serializer/IEmojiDeserializer.kt index 4a7247dd..42890389 100644 --- a/contract/src/main/kotlin/io/wax911/emojify/contract/serializer/IEmojiDeserializer.kt +++ b/contract/src/main/kotlin/io/wax911/emojify/contract/serializer/IEmojiDeserializer.kt @@ -1,3 +1,19 @@ +/* + * Copyright 2024 AniTrend + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + package io.wax911.emojify.contract.serializer import io.wax911.emojify.contract.model.AbstractEmoji diff --git a/emojify/src/test/kotlin/io/wax911/emojify/core/EmojiLoader.kt b/emojify/src/test/kotlin/io/wax911/emojify/core/EmojiLoader.kt index a6be2229..9d9f4ddf 100644 --- a/emojify/src/test/kotlin/io/wax911/emojify/core/EmojiLoader.kt +++ b/emojify/src/test/kotlin/io/wax911/emojify/core/EmojiLoader.kt @@ -17,7 +17,7 @@ package io.wax911.emojify.core import io.wax911.emojify.EmojiManager -import io.wax911.emojify.serializer.KotlinxDeserializer +import io.wax911.emojify.serializer.kotlinx.KotlinxDeserializer abstract class EmojiLoader { diff --git a/serializer/gson/src/main/kotlin/io/wax911/emojify/serializer/GsonDeserializer.kt b/serializer/gson/src/main/kotlin/io/wax911/emojify/serializer/gson/GsonDeserializer.kt similarity index 92% rename from serializer/gson/src/main/kotlin/io/wax911/emojify/serializer/GsonDeserializer.kt rename to serializer/gson/src/main/kotlin/io/wax911/emojify/serializer/gson/GsonDeserializer.kt index 3e384988..b4120875 100644 --- a/serializer/gson/src/main/kotlin/io/wax911/emojify/serializer/GsonDeserializer.kt +++ b/serializer/gson/src/main/kotlin/io/wax911/emojify/serializer/gson/GsonDeserializer.kt @@ -14,7 +14,7 @@ * limitations under the License. */ -package io.wax911.emojify.serializer +package io.wax911.emojify.serializer.gson import com.google.gson.Gson import com.google.gson.reflect.TypeToken @@ -25,7 +25,7 @@ import java.io.InputStream /** * Default implementation for gson */ -class GsonDeserializer: IEmojiDeserializer { +class GsonDeserializer : IEmojiDeserializer { private val gson = Gson() override fun decodeFromStream(inputStream: InputStream): List { diff --git a/serializer/gson/src/main/kotlin/io/wax911/emojify/serializer/GsonEmoji.kt b/serializer/gson/src/main/kotlin/io/wax911/emojify/serializer/gson/GsonEmoji.kt similarity index 52% rename from serializer/gson/src/main/kotlin/io/wax911/emojify/serializer/GsonEmoji.kt rename to serializer/gson/src/main/kotlin/io/wax911/emojify/serializer/gson/GsonEmoji.kt index d5720b31..093c5a6f 100644 --- a/serializer/gson/src/main/kotlin/io/wax911/emojify/serializer/GsonEmoji.kt +++ b/serializer/gson/src/main/kotlin/io/wax911/emojify/serializer/gson/GsonEmoji.kt @@ -1,4 +1,20 @@ -package io.wax911.emojify.serializer +/* + * Copyright 2024 AniTrend + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package io.wax911.emojify.serializer.gson import com.google.gson.annotations.SerializedName import io.wax911.emojify.contract.model.AbstractEmoji @@ -14,4 +30,4 @@ data class GsonEmoji( @SerializedName(value = "supports_fitzpatrick") override val supportsFitzpatrick: Boolean, @SerializedName(value = "supports_gender") override val supportsGender: Boolean, @SerializedName(value = "tags") override val tags: List?, -): AbstractEmoji() +) : AbstractEmoji() diff --git a/serializer/kotlinx/src/main/kotlin/io/wax911/emojify/serializer/KotlinxDeserializer.kt b/serializer/kotlinx/src/main/kotlin/io/wax911/emojify/serializer/kotlinx/KotlinxDeserializer.kt similarity index 92% rename from serializer/kotlinx/src/main/kotlin/io/wax911/emojify/serializer/KotlinxDeserializer.kt rename to serializer/kotlinx/src/main/kotlin/io/wax911/emojify/serializer/kotlinx/KotlinxDeserializer.kt index ec663bb6..a8e091ee 100644 --- a/serializer/kotlinx/src/main/kotlin/io/wax911/emojify/serializer/KotlinxDeserializer.kt +++ b/serializer/kotlinx/src/main/kotlin/io/wax911/emojify/serializer/kotlinx/KotlinxDeserializer.kt @@ -14,7 +14,7 @@ * limitations under the License. */ -package io.wax911.emojify.serializer +package io.wax911.emojify.serializer.kotlinx import io.wax911.emojify.contract.model.AbstractEmoji import io.wax911.emojify.contract.serializer.IEmojiDeserializer @@ -30,6 +30,7 @@ import java.io.InputStream class KotlinxDeserializer : IEmojiDeserializer { private val json = Json { isLenient = true } + @OptIn(kotlinx.serialization.ExperimentalSerializationApi::class) @Throws(SerializationException::class) override fun decodeFromStream(inputStream: InputStream): List { val deserializer = ListSerializer(KotlinxEmoji.serializer()) diff --git a/serializer/kotlinx/src/main/kotlin/io/wax911/emojify/serializer/KotlinxEmoji.kt b/serializer/kotlinx/src/main/kotlin/io/wax911/emojify/serializer/kotlinx/KotlinxEmoji.kt similarity index 54% rename from serializer/kotlinx/src/main/kotlin/io/wax911/emojify/serializer/KotlinxEmoji.kt rename to serializer/kotlinx/src/main/kotlin/io/wax911/emojify/serializer/kotlinx/KotlinxEmoji.kt index f7ad8dd8..217f47c3 100644 --- a/serializer/kotlinx/src/main/kotlin/io/wax911/emojify/serializer/KotlinxEmoji.kt +++ b/serializer/kotlinx/src/main/kotlin/io/wax911/emojify/serializer/kotlinx/KotlinxEmoji.kt @@ -1,4 +1,20 @@ -package io.wax911.emojify.serializer +/* + * Copyright 2024 AniTrend + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package io.wax911.emojify.serializer.kotlinx import io.wax911.emojify.contract.model.AbstractEmoji import kotlinx.serialization.SerialName diff --git a/serializer/moshi/src/main/kotlin/io/wax911/emojify/serializer/MoshiDeserializer.kt b/serializer/moshi/src/main/kotlin/io/wax911/emojify/serializer/moshi/MoshiDeserializer.kt similarity index 91% rename from serializer/moshi/src/main/kotlin/io/wax911/emojify/serializer/MoshiDeserializer.kt rename to serializer/moshi/src/main/kotlin/io/wax911/emojify/serializer/moshi/MoshiDeserializer.kt index 40a35575..d69948fd 100644 --- a/serializer/moshi/src/main/kotlin/io/wax911/emojify/serializer/MoshiDeserializer.kt +++ b/serializer/moshi/src/main/kotlin/io/wax911/emojify/serializer/moshi/MoshiDeserializer.kt @@ -14,9 +14,8 @@ * limitations under the License. */ -package io.wax911.emojify.serializer +package io.wax911.emojify.serializer.moshi -import com.squareup.moshi.JsonClass import com.squareup.moshi.Moshi import com.squareup.moshi.Types import com.squareup.moshi.kotlin.reflect.KotlinJsonAdapterFactory @@ -29,7 +28,7 @@ import java.io.InputStream /** * Default implementation for moshi */ -class MoshiDeserializer: IEmojiDeserializer { +class MoshiDeserializer : IEmojiDeserializer { private val moshi = Moshi.Builder().addLast(KotlinJsonAdapterFactory()).build() override fun decodeFromStream(inputStream: InputStream): List { diff --git a/serializer/moshi/src/main/kotlin/io/wax911/emojify/serializer/MoshiEmoji.kt b/serializer/moshi/src/main/kotlin/io/wax911/emojify/serializer/moshi/MoshiEmoji.kt similarity index 53% rename from serializer/moshi/src/main/kotlin/io/wax911/emojify/serializer/MoshiEmoji.kt rename to serializer/moshi/src/main/kotlin/io/wax911/emojify/serializer/moshi/MoshiEmoji.kt index 36db4c10..3bdadf97 100644 --- a/serializer/moshi/src/main/kotlin/io/wax911/emojify/serializer/MoshiEmoji.kt +++ b/serializer/moshi/src/main/kotlin/io/wax911/emojify/serializer/moshi/MoshiEmoji.kt @@ -1,4 +1,20 @@ -package io.wax911.emojify.serializer +/* + * Copyright 2024 AniTrend + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package io.wax911.emojify.serializer.moshi import com.squareup.moshi.Json import com.squareup.moshi.JsonClass @@ -16,4 +32,4 @@ data class MoshiEmoji( @Json(name = "supports_fitzpatrick") override val supportsFitzpatrick: Boolean = false, @Json(name = "supports_gender") override val supportsGender: Boolean = false, @Json(name = "tags") override val tags: List? = null, -): AbstractEmoji() +) : AbstractEmoji()