Skip to content

Commit

Permalink
Multiplatform: JVM example. (#836)
Browse files Browse the repository at this point in the history
  • Loading branch information
vanniktech authored May 26, 2022
1 parent f5293ac commit 5e3ab17
Show file tree
Hide file tree
Showing 3 changed files with 40 additions and 1 deletion.
15 changes: 15 additions & 0 deletions jvm/build.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
apply plugin: "kotlin"
apply plugin: "application"

mainClassName = "com.vanniktech.emoji.jvm.MainKt"

defaultTasks("run")

java {
sourceCompatibility = JavaVersion.VERSION_11
targetCompatibility = JavaVersion.VERSION_11
}

dependencies {
implementation(project(":emoji-ios"))
}
23 changes: 23 additions & 0 deletions jvm/src/main/kotlin/com/vanniktech/emoji/jvm/Main.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
package com.vanniktech.emoji.jvm

import com.vanniktech.emoji.EmojiManager
import com.vanniktech.emoji.emojiInformation
import com.vanniktech.emoji.ios.IosEmojiProvider
import com.vanniktech.emoji.search.SearchEmojiManager

fun main() {
val emojiProvider = IosEmojiProvider()
EmojiManager.install(emojiProvider)

val emojiString = """Hello from JVM ❤️💚💙"""
println("\nGetting emoji information from $emojiString:")
val emojiInformation = emojiString.emojiInformation()
println(emojiInformation)

val query = "swim"
println("\nSearching for all emojis with $query:")
SearchEmojiManager().search(query = query)
.forEach {
println(it)
}
}
3 changes: 2 additions & 1 deletion settings.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,10 @@ pluginManagement {

include ':app'
include ':emoji'
include ':emoji-facebook'
include ':emoji-google'
include ':emoji-google-compat'
include ':emoji-ios'
include ':emoji-material'
include ':emoji-twitter'
include ':emoji-facebook'
include ':jvm'

0 comments on commit 5e3ab17

Please sign in to comment.