diff --git a/emoji-facebook/emoji_facebook.podspec b/emoji-facebook/EmojiFacebook.podspec similarity index 86% rename from emoji-facebook/emoji_facebook.podspec rename to emoji-facebook/EmojiFacebook.podspec index 883146ccb6..de3f880af6 100644 --- a/emoji-facebook/emoji_facebook.podspec +++ b/emoji-facebook/EmojiFacebook.podspec @@ -1,11 +1,11 @@ Pod::Spec.new do |spec| - spec.name = 'emoji_facebook' + spec.name = 'EmojiFacebook' spec.version = '0.16.0-SNAPSHOT' - spec.homepage = '' + spec.homepage = 'https://github.com/vanniktech/Emoji' spec.source = { :http=> ''} spec.authors = '' spec.license = '' - spec.summary = '' + spec.summary = 'emoji-facebook' spec.vendored_frameworks = 'build/cocoapods/framework/emoji_facebook.framework' spec.libraries = 'c++' @@ -18,7 +18,7 @@ Pod::Spec.new do |spec| spec.script_phases = [ { - :name => 'Build emoji_facebook', + :name => 'Build EmojiFacebook', :execution_position => :before_compile, :shell_path => '/bin/sh', :script => <<-SCRIPT diff --git a/emoji-facebook/build.gradle b/emoji-facebook/build.gradle index 53039228e3..5f210e0d6b 100644 --- a/emoji-facebook/build.gradle +++ b/emoji-facebook/build.gradle @@ -16,7 +16,7 @@ licensee { metalava { filename = "api/current.txt" - sourcePaths = ["src/commonMain", "src/androidMain", "src/jvmMain"] + sourcePaths = ["src/commonMain", "src/androidMain", "src/jvmMain", "src/iosMain"] } dependencyGuard { @@ -30,9 +30,22 @@ kotlin { android("android") { publishLibraryVariants("release") } -// ios("ios") + ios("ios") jvm("jvm") + cocoapods { + version = VERSION_NAME + summary = "emoji-facebook" + homepage = "https://github.com/vanniktech/Emoji" + name = "EmojiFacebook" + +// framework { +// isStatic = true +// embedBitcode(BITCODE) +// export(project(":emoji")) +// } + } + sourceSets { commonMain { dependencies { @@ -55,6 +68,12 @@ kotlin { implementation libs.robolectric } + iosMain.dependencies { + } + + iosTest.dependencies { + } + jvmMain.dependencies { } diff --git a/emoji-facebook/src/iosMain/kotlin/com/vanniktech/emoji/facebook/FacebookEmojiProvider.kt b/emoji-facebook/src/iosMain/kotlin/com/vanniktech/emoji/facebook/FacebookEmojiProvider.kt new file mode 100644 index 0000000000..e601c138d1 --- /dev/null +++ b/emoji-facebook/src/iosMain/kotlin/com/vanniktech/emoji/facebook/FacebookEmojiProvider.kt @@ -0,0 +1,44 @@ +/* + * Copyright (C) 2016 - Niklas Baudy, Ruben Gees, Mario Đanić and contributors + * + * 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 + * + * http://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 com.vanniktech.emoji.facebook + +import com.vanniktech.emoji.EmojiCategory +import com.vanniktech.emoji.EmojiProvider +import com.vanniktech.emoji.facebook.category.ActivitiesCategory +import com.vanniktech.emoji.facebook.category.AnimalsAndNatureCategory +import com.vanniktech.emoji.facebook.category.FlagsCategory +import com.vanniktech.emoji.facebook.category.FoodAndDrinkCategory +import com.vanniktech.emoji.facebook.category.ObjectsCategory +import com.vanniktech.emoji.facebook.category.SmileysAndPeopleCategory +import com.vanniktech.emoji.facebook.category.SymbolsCategory +import com.vanniktech.emoji.facebook.category.TravelAndPlacesCategory + +class FacebookEmojiProvider : EmojiProvider { + override val categories: Array + get() = arrayOf( + SmileysAndPeopleCategory(), + AnimalsAndNatureCategory(), + FoodAndDrinkCategory(), + ActivitiesCategory(), + TravelAndPlacesCategory(), + ObjectsCategory(), + SymbolsCategory(), + FlagsCategory(), + ) + + override fun release() = Unit +} diff --git a/emoji-google-compat/emoji_google_compat.podspec b/emoji-google-compat/EmojiGoogleCompat.podspec similarity index 85% rename from emoji-google-compat/emoji_google_compat.podspec rename to emoji-google-compat/EmojiGoogleCompat.podspec index 89d08dfbc2..169e033067 100644 --- a/emoji-google-compat/emoji_google_compat.podspec +++ b/emoji-google-compat/EmojiGoogleCompat.podspec @@ -1,11 +1,11 @@ Pod::Spec.new do |spec| - spec.name = 'emoji_google_compat' + spec.name = 'EmojiGoogleCompat' spec.version = '0.16.0-SNAPSHOT' - spec.homepage = '' + spec.homepage = 'https://github.com/vanniktech/Emoji' spec.source = { :http=> ''} spec.authors = '' spec.license = '' - spec.summary = '' + spec.summary = 'emoji-google-compat' spec.vendored_frameworks = 'build/cocoapods/framework/emoji_google_compat.framework' spec.libraries = 'c++' @@ -18,7 +18,7 @@ Pod::Spec.new do |spec| spec.script_phases = [ { - :name => 'Build emoji_google_compat', + :name => 'Build EmojiGoogleCompat', :execution_position => :before_compile, :shell_path => '/bin/sh', :script => <<-SCRIPT diff --git a/emoji-google-compat/build.gradle b/emoji-google-compat/build.gradle index 7a3a79ea7a..480c52ce1f 100644 --- a/emoji-google-compat/build.gradle +++ b/emoji-google-compat/build.gradle @@ -16,7 +16,7 @@ licensee { metalava { filename = "api/current.txt" - sourcePaths = ["src/commonMain", "src/androidMain", "src/jvmMain"] + sourcePaths = ["src/commonMain", "src/androidMain", "src/jvmMain", "src/iosMain"] } dependencyGuard { @@ -30,9 +30,22 @@ kotlin { android("android") { publishLibraryVariants("release") } -// ios("ios") + ios("ios") jvm("jvm") + cocoapods { + version = VERSION_NAME + summary = "emoji-google-compat" + homepage = "https://github.com/vanniktech/Emoji" + name = "EmojiGoogleCompat" + +// framework { +// isStatic = true +// embedBitcode(BITCODE) +// export(project(":emoji")) +// } + } + sourceSets { commonMain { dependencies { @@ -56,6 +69,12 @@ kotlin { implementation libs.robolectric } + iosMain.dependencies { + } + + iosTest.dependencies { + } + jvmMain.dependencies { } diff --git a/emoji-google-compat/src/iosMain/kotlin/com/vanniktech/emoji/googlecompat/GoogleCompatEmojiProvider.kt b/emoji-google-compat/src/iosMain/kotlin/com/vanniktech/emoji/googlecompat/GoogleCompatEmojiProvider.kt new file mode 100644 index 0000000000..7419cbba28 --- /dev/null +++ b/emoji-google-compat/src/iosMain/kotlin/com/vanniktech/emoji/googlecompat/GoogleCompatEmojiProvider.kt @@ -0,0 +1,44 @@ +/* + * Copyright (C) 2016 - Niklas Baudy, Ruben Gees, Mario Đanić and contributors + * + * 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 + * + * http://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 com.vanniktech.emoji.googlecompat + +import com.vanniktech.emoji.EmojiCategory +import com.vanniktech.emoji.EmojiProvider +import com.vanniktech.emoji.googlecompat.category.ActivitiesCategory +import com.vanniktech.emoji.googlecompat.category.AnimalsAndNatureCategory +import com.vanniktech.emoji.googlecompat.category.FlagsCategory +import com.vanniktech.emoji.googlecompat.category.FoodAndDrinkCategory +import com.vanniktech.emoji.googlecompat.category.ObjectsCategory +import com.vanniktech.emoji.googlecompat.category.SmileysAndPeopleCategory +import com.vanniktech.emoji.googlecompat.category.SymbolsCategory +import com.vanniktech.emoji.googlecompat.category.TravelAndPlacesCategory + +class GoogleCompatEmojiProvider : EmojiProvider { + override val categories: Array + get() = arrayOf( + SmileysAndPeopleCategory(), + AnimalsAndNatureCategory(), + FoodAndDrinkCategory(), + ActivitiesCategory(), + TravelAndPlacesCategory(), + ObjectsCategory(), + SymbolsCategory(), + FlagsCategory(), + ) + + override fun release() = Unit +} diff --git a/emoji-google/emoji_google.podspec b/emoji-google/EmojiGoogle.podspec similarity index 86% rename from emoji-google/emoji_google.podspec rename to emoji-google/EmojiGoogle.podspec index 49b516dd3b..6f99c143b2 100644 --- a/emoji-google/emoji_google.podspec +++ b/emoji-google/EmojiGoogle.podspec @@ -1,11 +1,11 @@ Pod::Spec.new do |spec| - spec.name = 'emoji_google' + spec.name = 'EmojiGoogle' spec.version = '0.16.0-SNAPSHOT' - spec.homepage = '' + spec.homepage = 'https://github.com/vanniktech/Emoji' spec.source = { :http=> ''} spec.authors = '' spec.license = '' - spec.summary = '' + spec.summary = 'emoji-google' spec.vendored_frameworks = 'build/cocoapods/framework/emoji_google.framework' spec.libraries = 'c++' @@ -18,7 +18,7 @@ Pod::Spec.new do |spec| spec.script_phases = [ { - :name => 'Build emoji_google', + :name => 'Build EmojiGoogle', :execution_position => :before_compile, :shell_path => '/bin/sh', :script => <<-SCRIPT diff --git a/emoji-google/build.gradle b/emoji-google/build.gradle index 5ebb340f4a..24f98a96e9 100644 --- a/emoji-google/build.gradle +++ b/emoji-google/build.gradle @@ -16,7 +16,7 @@ licensee { metalava { filename = "api/current.txt" - sourcePaths = ["src/commonMain", "src/androidMain", "src/jvmMain"] + sourcePaths = ["src/commonMain", "src/androidMain", "src/jvmMain", "src/iosMain"] } dependencyGuard { @@ -30,9 +30,22 @@ kotlin { android("android") { publishLibraryVariants("release") } -// ios("ios") + ios("ios") jvm("jvm") + cocoapods { + version = VERSION_NAME + summary = "emoji-google" + homepage = "https://github.com/vanniktech/Emoji" + name = "EmojiGoogle" + +// framework { +// isStatic = true +// embedBitcode(BITCODE) +// export(project(":emoji")) +// } + } + sourceSets { commonMain { dependencies { @@ -55,6 +68,12 @@ kotlin { implementation libs.robolectric } + iosMain.dependencies { + } + + iosTest.dependencies { + } + jvmMain.dependencies { } diff --git a/emoji-google/src/iosMain/kotlin/com/vanniktech/emoji/google/GoogleEmojiProvider.kt b/emoji-google/src/iosMain/kotlin/com/vanniktech/emoji/google/GoogleEmojiProvider.kt new file mode 100644 index 0000000000..c1f720da84 --- /dev/null +++ b/emoji-google/src/iosMain/kotlin/com/vanniktech/emoji/google/GoogleEmojiProvider.kt @@ -0,0 +1,44 @@ +/* + * Copyright (C) 2016 - Niklas Baudy, Ruben Gees, Mario Đanić and contributors + * + * 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 + * + * http://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 com.vanniktech.emoji.google + +import com.vanniktech.emoji.EmojiCategory +import com.vanniktech.emoji.EmojiProvider +import com.vanniktech.emoji.google.category.ActivitiesCategory +import com.vanniktech.emoji.google.category.AnimalsAndNatureCategory +import com.vanniktech.emoji.google.category.FlagsCategory +import com.vanniktech.emoji.google.category.FoodAndDrinkCategory +import com.vanniktech.emoji.google.category.ObjectsCategory +import com.vanniktech.emoji.google.category.SmileysAndPeopleCategory +import com.vanniktech.emoji.google.category.SymbolsCategory +import com.vanniktech.emoji.google.category.TravelAndPlacesCategory + +class GoogleEmojiProvider : EmojiProvider { + override val categories: Array + get() = arrayOf( + SmileysAndPeopleCategory(), + AnimalsAndNatureCategory(), + FoodAndDrinkCategory(), + ActivitiesCategory(), + TravelAndPlacesCategory(), + ObjectsCategory(), + SymbolsCategory(), + FlagsCategory(), + ) + + override fun release() = Unit +} diff --git a/emoji-ios/emoji_ios.podspec b/emoji-ios/EmojiIos.podspec similarity index 86% rename from emoji-ios/emoji_ios.podspec rename to emoji-ios/EmojiIos.podspec index c9b221c168..c4e84e2dd2 100644 --- a/emoji-ios/emoji_ios.podspec +++ b/emoji-ios/EmojiIos.podspec @@ -1,11 +1,11 @@ Pod::Spec.new do |spec| - spec.name = 'emoji_ios' + spec.name = 'EmojiIos' spec.version = '0.16.0-SNAPSHOT' - spec.homepage = '' + spec.homepage = 'https://github.com/vanniktech/Emoji' spec.source = { :http=> ''} spec.authors = '' spec.license = '' - spec.summary = '' + spec.summary = 'emoji-ios' spec.vendored_frameworks = 'build/cocoapods/framework/emoji_ios.framework' spec.libraries = 'c++' @@ -18,7 +18,7 @@ Pod::Spec.new do |spec| spec.script_phases = [ { - :name => 'Build emoji_ios', + :name => 'Build EmojiIos', :execution_position => :before_compile, :shell_path => '/bin/sh', :script => <<-SCRIPT diff --git a/emoji-ios/build.gradle b/emoji-ios/build.gradle index 1731b3d252..56748a22c3 100644 --- a/emoji-ios/build.gradle +++ b/emoji-ios/build.gradle @@ -16,7 +16,7 @@ licensee { metalava { filename = "api/current.txt" - sourcePaths = ["src/commonMain", "src/androidMain", "src/jvmMain"] + sourcePaths = ["src/commonMain", "src/androidMain", "src/jvmMain", "src/iosMain"] } dependencyGuard { @@ -30,9 +30,22 @@ kotlin { android("android") { publishLibraryVariants("release") } -// ios("ios") + ios("ios") jvm("jvm") + cocoapods { + version = VERSION_NAME + summary = "emoji-ios" + homepage = "https://github.com/vanniktech/Emoji" + name = "EmojiIos" + +// framework { +// isStatic = true +// embedBitcode(BITCODE) +// export(project(":emoji")) +// } + } + sourceSets { commonMain { dependencies { @@ -55,6 +68,12 @@ kotlin { implementation libs.robolectric } + iosMain.dependencies { + } + + iosTest.dependencies { + } + jvmMain.dependencies { } diff --git a/emoji-ios/src/iosMain/kotlin/com/vanniktech/emoji/ios/IosEmojiProvider.kt b/emoji-ios/src/iosMain/kotlin/com/vanniktech/emoji/ios/IosEmojiProvider.kt new file mode 100644 index 0000000000..75e8661374 --- /dev/null +++ b/emoji-ios/src/iosMain/kotlin/com/vanniktech/emoji/ios/IosEmojiProvider.kt @@ -0,0 +1,44 @@ +/* + * Copyright (C) 2016 - Niklas Baudy, Ruben Gees, Mario Đanić and contributors + * + * 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 + * + * http://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 com.vanniktech.emoji.ios + +import com.vanniktech.emoji.EmojiCategory +import com.vanniktech.emoji.EmojiProvider +import com.vanniktech.emoji.ios.category.ActivitiesCategory +import com.vanniktech.emoji.ios.category.AnimalsAndNatureCategory +import com.vanniktech.emoji.ios.category.FlagsCategory +import com.vanniktech.emoji.ios.category.FoodAndDrinkCategory +import com.vanniktech.emoji.ios.category.ObjectsCategory +import com.vanniktech.emoji.ios.category.SmileysAndPeopleCategory +import com.vanniktech.emoji.ios.category.SymbolsCategory +import com.vanniktech.emoji.ios.category.TravelAndPlacesCategory + +class IosEmojiProvider : EmojiProvider { + override val categories: Array + get() = arrayOf( + SmileysAndPeopleCategory(), + AnimalsAndNatureCategory(), + FoodAndDrinkCategory(), + ActivitiesCategory(), + TravelAndPlacesCategory(), + ObjectsCategory(), + SymbolsCategory(), + FlagsCategory(), + ) + + override fun release() = Unit +} diff --git a/emoji-ios/src/iosTest/kotlin/com/vanniktech/emoji/ios/commonTestEmojiProviderIosApi.kt b/emoji-ios/src/iosTest/kotlin/com/vanniktech/emoji/ios/commonTestEmojiProviderIosApi.kt new file mode 100644 index 0000000000..abc120e32c --- /dev/null +++ b/emoji-ios/src/iosTest/kotlin/com/vanniktech/emoji/ios/commonTestEmojiProviderIosApi.kt @@ -0,0 +1,5 @@ +package com.vanniktech.emoji.ios + +import com.vanniktech.emoji.EmojiProvider + +actual fun emojiProvider(): EmojiProvider = IosEmojiProvider() diff --git a/emoji-material/emoji_material.podspec b/emoji-material/EmojiMaterial.podspec similarity index 86% rename from emoji-material/emoji_material.podspec rename to emoji-material/EmojiMaterial.podspec index b9d2fdbab9..95096b53e6 100644 --- a/emoji-material/emoji_material.podspec +++ b/emoji-material/EmojiMaterial.podspec @@ -1,11 +1,11 @@ Pod::Spec.new do |spec| - spec.name = 'emoji_material' + spec.name = 'EmojiMaterial' spec.version = '0.16.0-SNAPSHOT' - spec.homepage = '' + spec.homepage = 'https://github.com/vanniktech/Emoji' spec.source = { :http=> ''} spec.authors = '' spec.license = '' - spec.summary = '' + spec.summary = 'emoji-material' spec.vendored_frameworks = 'build/cocoapods/framework/emoji_material.framework' spec.libraries = 'c++' @@ -18,7 +18,7 @@ Pod::Spec.new do |spec| spec.script_phases = [ { - :name => 'Build emoji_material', + :name => 'Build EmojiMaterial', :execution_position => :before_compile, :shell_path => '/bin/sh', :script => <<-SCRIPT diff --git a/emoji-material/build.gradle b/emoji-material/build.gradle index adcdb85578..89f63dd326 100644 --- a/emoji-material/build.gradle +++ b/emoji-material/build.gradle @@ -30,9 +30,22 @@ kotlin { android("android") { publishLibraryVariants("release") } -// ios("ios") + ios("ios") jvm("jvm") + cocoapods { + version = VERSION_NAME + summary = "emoji-material" + homepage = "https://github.com/vanniktech/Emoji" + name = "EmojiMaterial" + +// framework { +// isStatic = true +// embedBitcode(BITCODE) +// export(project(":emoji")) +// } + } + sourceSets { commonMain { dependencies { @@ -56,6 +69,12 @@ kotlin { implementation libs.robolectric } + iosMain.dependencies { + } + + iosTest.dependencies { + } + jvmMain.dependencies { } diff --git a/emoji-twitter/emoji_twitter.podspec b/emoji-twitter/EmojiTwitter.podspec similarity index 86% rename from emoji-twitter/emoji_twitter.podspec rename to emoji-twitter/EmojiTwitter.podspec index 144b8e8534..876d7d9557 100644 --- a/emoji-twitter/emoji_twitter.podspec +++ b/emoji-twitter/EmojiTwitter.podspec @@ -1,11 +1,11 @@ Pod::Spec.new do |spec| - spec.name = 'emoji_twitter' + spec.name = 'EmojiTwitter' spec.version = '0.16.0-SNAPSHOT' - spec.homepage = '' + spec.homepage = 'https://github.com/vanniktech/Emoji' spec.source = { :http=> ''} spec.authors = '' spec.license = '' - spec.summary = '' + spec.summary = 'emoji-twitter' spec.vendored_frameworks = 'build/cocoapods/framework/emoji_twitter.framework' spec.libraries = 'c++' @@ -18,7 +18,7 @@ Pod::Spec.new do |spec| spec.script_phases = [ { - :name => 'Build emoji_twitter', + :name => 'Build EmojiTwitter', :execution_position => :before_compile, :shell_path => '/bin/sh', :script => <<-SCRIPT diff --git a/emoji-twitter/build.gradle b/emoji-twitter/build.gradle index 4199e9a98d..50564ef642 100644 --- a/emoji-twitter/build.gradle +++ b/emoji-twitter/build.gradle @@ -16,7 +16,7 @@ licensee { metalava { filename = "api/current.txt" - sourcePaths = ["src/commonMain", "src/androidMain", "src/jvmMain"] + sourcePaths = ["src/commonMain", "src/androidMain", "src/jvmMain", "src/iosMain"] } dependencyGuard { @@ -30,9 +30,22 @@ kotlin { android("android") { publishLibraryVariants("release") } -// ios("ios") + ios("ios") jvm("jvm") + cocoapods { + version = VERSION_NAME + summary = "emoji-twitter" + homepage = "https://github.com/vanniktech/Emoji" + name = "EmojiTwitter" + +// framework { +// isStatic = true +// embedBitcode(BITCODE) +// export(project(":emoji")) +// } + } + sourceSets { commonMain { dependencies { @@ -55,6 +68,12 @@ kotlin { implementation libs.robolectric } + iosMain.dependencies { + } + + iosTest.dependencies { + } + jvmMain.dependencies { } diff --git a/emoji-twitter/src/iosMain/kotlin/com/vanniktech/emoji/twitter/TwitterEmojiProvider.kt b/emoji-twitter/src/iosMain/kotlin/com/vanniktech/emoji/twitter/TwitterEmojiProvider.kt new file mode 100644 index 0000000000..bbb0f83bc1 --- /dev/null +++ b/emoji-twitter/src/iosMain/kotlin/com/vanniktech/emoji/twitter/TwitterEmojiProvider.kt @@ -0,0 +1,44 @@ +/* + * Copyright (C) 2016 - Niklas Baudy, Ruben Gees, Mario Đanić and contributors + * + * 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 + * + * http://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 com.vanniktech.emoji.twitter + +import com.vanniktech.emoji.EmojiCategory +import com.vanniktech.emoji.EmojiProvider +import com.vanniktech.emoji.twitter.category.ActivitiesCategory +import com.vanniktech.emoji.twitter.category.AnimalsAndNatureCategory +import com.vanniktech.emoji.twitter.category.FlagsCategory +import com.vanniktech.emoji.twitter.category.FoodAndDrinkCategory +import com.vanniktech.emoji.twitter.category.ObjectsCategory +import com.vanniktech.emoji.twitter.category.SmileysAndPeopleCategory +import com.vanniktech.emoji.twitter.category.SymbolsCategory +import com.vanniktech.emoji.twitter.category.TravelAndPlacesCategory + +class TwitterEmojiProvider : EmojiProvider { + override val categories: Array + get() = arrayOf( + SmileysAndPeopleCategory(), + AnimalsAndNatureCategory(), + FoodAndDrinkCategory(), + ActivitiesCategory(), + TravelAndPlacesCategory(), + ObjectsCategory(), + SymbolsCategory(), + FlagsCategory(), + ) + + override fun release() = Unit +} diff --git a/emoji/build.gradle b/emoji/build.gradle index 7085e95754..c541fbf350 100644 --- a/emoji/build.gradle +++ b/emoji/build.gradle @@ -30,9 +30,21 @@ kotlin { android("android") { publishLibraryVariants("release") } -// ios("ios") + ios("ios") jvm("jvm") + cocoapods { + version = VERSION_NAME + summary = "emoji" + homepage = "https://github.com/vanniktech/Emoji" + name = "Emoji" + + // framework { + // isStatic = true + // embedBitcode(BITCODE) + // } + } + sourceSets { commonMain { dependencies { @@ -46,19 +58,21 @@ kotlin { } } - androidMain { - dependencies { - api libs.androidx.appcompat - api libs.androidx.cardview - api libs.androidx.recyclerview - } + androidMain.dependencies { + api libs.androidx.appcompat + api libs.androidx.cardview + api libs.androidx.recyclerview } - androidTest { - dependencies { - implementation libs.kotlin.test.junit - implementation libs.robolectric - } + androidTest.dependencies { + implementation libs.kotlin.test.junit + implementation libs.robolectric + } + + iosMain.dependencies { + } + + iosTest.dependencies { } jvmMain.dependencies { diff --git a/emoji/emoji.podspec b/emoji/emoji.podspec index b250d9d927..e57c6efa3c 100644 --- a/emoji/emoji.podspec +++ b/emoji/emoji.podspec @@ -1,11 +1,11 @@ Pod::Spec.new do |spec| - spec.name = 'emoji' + spec.name = 'Emoji' spec.version = '0.16.0-SNAPSHOT' - spec.homepage = '' + spec.homepage = 'https://github.com/vanniktech/Emoji' spec.source = { :http=> ''} spec.authors = '' spec.license = '' - spec.summary = '' + spec.summary = 'emoji' spec.vendored_frameworks = 'build/cocoapods/framework/emoji.framework' spec.libraries = 'c++' @@ -18,7 +18,7 @@ Pod::Spec.new do |spec| spec.script_phases = [ { - :name => 'Build emoji', + :name => 'Build Emoji', :execution_position => :before_compile, :shell_path => '/bin/sh', :script => <<-SCRIPT diff --git a/emoji/src/androidMain/kotlin/com/vanniktech/emoji/commonLockAndroidApi.kt b/emoji/src/androidMain/kotlin/com/vanniktech/emoji/commonLockAndroidApi.kt new file mode 100644 index 0000000000..acf3e50e7f --- /dev/null +++ b/emoji/src/androidMain/kotlin/com/vanniktech/emoji/commonLockAndroidApi.kt @@ -0,0 +1,10 @@ +package com.vanniktech.emoji + +import java.util.concurrent.locks.ReentrantLock + +internal actual class Lock { + private val mutex = ReentrantLock() + + actual fun lock() = mutex.lock() + actual fun unlock() = mutex.unlock() +} diff --git a/emoji/src/commonMain/kotlin/com/vanniktech/emoji/EmojiManager.kt b/emoji/src/commonMain/kotlin/com/vanniktech/emoji/EmojiManager.kt index 3089988ba8..54ac0a4590 100644 --- a/emoji/src/commonMain/kotlin/com/vanniktech/emoji/EmojiManager.kt +++ b/emoji/src/commonMain/kotlin/com/vanniktech/emoji/EmojiManager.kt @@ -16,6 +16,8 @@ package com.vanniktech.emoji +import kotlin.jvm.JvmStatic + /** * EmojiManager where an EmojiProvider can be installed for further usage. */ @@ -29,6 +31,8 @@ object EmojiManager { private var emojiPattern: Regex? = null internal var emojiRepetitivePattern: Regex? = null + private val LOCK = Lock() + internal fun categories(): Array { verifyInstalled() return categories!! @@ -81,7 +85,7 @@ object EmojiManager { * [provider] the provider that should be installed. */ @JvmStatic fun install(provider: EmojiProvider) { - synchronized(EmojiManager::class.java) { + LOCK.use { categories = provider.categories emojiProvider = provider emojiMap.clear() @@ -114,7 +118,7 @@ object EmojiManager { for (i in 0 until unicodesForPatternSize) { patternBuilder.append(Regex.escape(unicodesForPattern[i])).append('|') } - val regex = patternBuilder.deleteCharAt(patternBuilder.length - 1).toString() + val regex = patternBuilder.deleteAt(patternBuilder.length - 1).toString() emojiPattern = Regex(regex, RegexOption.IGNORE_CASE) emojiRepetitivePattern = Regex("($regex)+", RegexOption.IGNORE_CASE) } @@ -125,10 +129,10 @@ object EmojiManager { * all data associated with installed [Emoji]s. For the existing [EmojiProvider]s this * means the memory-heavy emoji sheet. * - * @see .destroy + * @see [destroy] */ @JvmStatic fun destroy() { - synchronized(EmojiManager::class.java) { + LOCK.use { release() emojiMap.clear() emojiProvider = null @@ -145,10 +149,10 @@ object EmojiManager { * In contrast to [destroy], this does **not** destroy the internal * data structures and thus, you do not need to [install] again before using the EmojiManager. * - * @see .destroy + * @see [destroy] */ @JvmStatic fun release() { - synchronized(EmojiManager::class.java) { + LOCK.use { emojiProvider?.release() } } diff --git a/emoji/src/commonMain/kotlin/com/vanniktech/emoji/commonLockApi.kt b/emoji/src/commonMain/kotlin/com/vanniktech/emoji/commonLockApi.kt new file mode 100644 index 0000000000..8dfc5d1ef8 --- /dev/null +++ b/emoji/src/commonMain/kotlin/com/vanniktech/emoji/commonLockApi.kt @@ -0,0 +1,15 @@ +package com.vanniktech.emoji + +internal expect class Lock() { + fun lock() + fun unlock() +} + +internal inline fun Lock.use(block: () -> R): R { + try { + lock() + return block() + } finally { + unlock() + } +} diff --git a/emoji/src/commonMain/kotlin/com/vanniktech/emoji/search/SearchEmojiResult.kt b/emoji/src/commonMain/kotlin/com/vanniktech/emoji/search/SearchEmojiResult.kt index f1405f68a9..0fbf20653f 100644 --- a/emoji/src/commonMain/kotlin/com/vanniktech/emoji/search/SearchEmojiResult.kt +++ b/emoji/src/commonMain/kotlin/com/vanniktech/emoji/search/SearchEmojiResult.kt @@ -17,6 +17,7 @@ package com.vanniktech.emoji.search import com.vanniktech.emoji.Emoji +import kotlin.jvm.JvmField data class SearchEmojiResult( @JvmField val emoji: Emoji, diff --git a/emoji/src/iosMain/kotlin/com/vanniktech/emoji/commonLockIosApi.kt b/emoji/src/iosMain/kotlin/com/vanniktech/emoji/commonLockIosApi.kt new file mode 100644 index 0000000000..89214fe313 --- /dev/null +++ b/emoji/src/iosMain/kotlin/com/vanniktech/emoji/commonLockIosApi.kt @@ -0,0 +1,10 @@ +package com.vanniktech.emoji + +import platform.Foundation.NSLock + +internal actual class Lock { + private val lock = NSLock() + + actual fun lock() = lock.lock() + actual fun unlock() = lock.unlock() +} diff --git a/emoji/src/iosMain/kotlin/com/vanniktech/emoji/commonParcelableIosApi.kt b/emoji/src/iosMain/kotlin/com/vanniktech/emoji/commonParcelableIosApi.kt new file mode 100644 index 0000000000..d193300375 --- /dev/null +++ b/emoji/src/iosMain/kotlin/com/vanniktech/emoji/commonParcelableIosApi.kt @@ -0,0 +1,3 @@ +package com.vanniktech.emoji + +actual interface Parcelable diff --git a/emoji/src/jvmMain/kotlin/com/vanniktech/emoji/commonLockJvmApi.kt b/emoji/src/jvmMain/kotlin/com/vanniktech/emoji/commonLockJvmApi.kt new file mode 100644 index 0000000000..acf3e50e7f --- /dev/null +++ b/emoji/src/jvmMain/kotlin/com/vanniktech/emoji/commonLockJvmApi.kt @@ -0,0 +1,10 @@ +package com.vanniktech.emoji + +import java.util.concurrent.locks.ReentrantLock + +internal actual class Lock { + private val mutex = ReentrantLock() + + actual fun lock() = mutex.lock() + actual fun unlock() = mutex.unlock() +} diff --git a/emoji/src/jvmMain/kotlin/com/vanniktech/emoji/commonParcelableJvmApi.kt b/emoji/src/jvmMain/kotlin/com/vanniktech/emoji/commonParcelableJvmApi.kt index 8e831cd7f5..d193300375 100644 --- a/emoji/src/jvmMain/kotlin/com/vanniktech/emoji/commonParcelableJvmApi.kt +++ b/emoji/src/jvmMain/kotlin/com/vanniktech/emoji/commonParcelableJvmApi.kt @@ -1,4 +1,3 @@ -// ktlint-disable filename package com.vanniktech.emoji actual interface Parcelable diff --git a/generator/index.js b/generator/index.js index 0f4fd32ed2..315dff0b88 100644 --- a/generator/index.js +++ b/generator/index.js @@ -375,7 +375,7 @@ async function copyImages(map, targets, shouldOptimize) { } /** - * Generates the relevant java code and saves it to the destinations, specified by the targets. Code generated are the + * Generates the relevant code and saves it to the destinations, specified by the targets. Code generated are the * categories, the provider and the specific emoji class. * @param map The previously created map. * @param targets The targets, providing destination for the code files. @@ -391,24 +391,27 @@ async function generateCode(map, targets) { const emojiProviderAndroid = await fs.readFile("template/EmojiProviderAndroid.kt", "utf-8"); const emojiProviderCompatTemplate = await fs.readFile("template/EmojiProviderCompat.kt", "utf-8"); const emojiProviderJvm = await fs.readFile("template/EmojiProviderJvm.kt", "utf-8"); + const emojiProviderIos = await fs.readFile("template/EmojiProviderIos.kt", "utf-8"); const entries = stable([...map.entries()], (first, second) => { return categoryInfo.findIndex(it => it.name === first[0]) - categoryInfo.findIndex(it => it.name === second[0]); }); for (const target of targets) { - const srcDir = `../emoji-${target.module}/src/androidMain/kotlin/com/vanniktech/emoji/${target.package}`; - const commonSrcDir = `../emoji-${target.module}/src/commonMain/kotlin/com/vanniktech/emoji/${target.package}`; - const jvmSrcDir = `../emoji-${target.module}/src/jvmMain/kotlin/com/vanniktech/emoji/${target.package}`; + const androidMain = `../emoji-${target.module}/src/androidMain/kotlin/com/vanniktech/emoji/${target.package}`; + const commonMain = `../emoji-${target.module}/src/commonMain/kotlin/com/vanniktech/emoji/${target.package}`; + const jvmMain = `../emoji-${target.module}/src/jvmMain/kotlin/com/vanniktech/emoji/${target.package}`; + const iosMain = `../emoji-${target.module}/src/iosMain/kotlin/com/vanniktech/emoji/${target.package}`; if (target.module !== "google-compat") { - await fs.emptyDir(commonSrcDir); - await fs.mkdir(`${commonSrcDir}/category`); + await fs.emptyDir(commonMain); + await fs.mkdir(`${commonMain}/category`); } else { - await fs.emptyDir(`${commonSrcDir}/category`) + await fs.emptyDir(`${commonMain}/category`) } - await fs.emptyDir(jvmSrcDir); + await fs.emptyDir(jvmMain); + await fs.emptyDir(iosMain); let strips = 0; for (const [category, emojis] of entries) { @@ -423,7 +426,7 @@ async function generateCode(map, targets) { chunkClasses.push(chunkClass) - await fs.writeFile(`${commonSrcDir}/category/${chunkClass}.kt`, + await fs.writeFile(`${commonMain}/category/${chunkClass}.kt`, template(categoryChunkTemplate)({ package: target.package, name: target.name, @@ -434,7 +437,7 @@ async function generateCode(map, targets) { ); } - await fs.writeFile(`${commonSrcDir}/category/${category}Category.kt`, + await fs.writeFile(`${commonMain}/category/${category}Category.kt`, template(categoryTemplate)({ package: target.package, name: target.name, @@ -456,7 +459,7 @@ async function generateCode(map, targets) { }) if (target.module !== "google-compat") { - await fs.writeFile(`${srcDir}/${target.name}Provider.kt`, template(emojiProviderAndroid)({ + await fs.writeFile(`${androidMain}/${target.name}Provider.kt`, template(emojiProviderAndroid)({ package: target.package, imports: imports, name: target.name, @@ -464,7 +467,7 @@ async function generateCode(map, targets) { strips: strips, })); } else { - await fs.writeFile(`${srcDir}/${target.name}Provider.kt`, template(emojiProviderCompatTemplate)({ + await fs.writeFile(`${androidMain}/${target.name}Provider.kt`, template(emojiProviderCompatTemplate)({ package: target.package, imports: imports, name: target.name, @@ -472,7 +475,14 @@ async function generateCode(map, targets) { })); } - await fs.writeFile(`${jvmSrcDir}/${target.name}Provider.kt`, template(emojiProviderJvm)({ + await fs.writeFile(`${jvmMain}/${target.name}Provider.kt`, template(emojiProviderJvm)({ + package: target.package, + imports: imports, + name: target.name, + categories: categories, + })); + + await fs.writeFile(`${iosMain}/${target.name}Provider.kt`, template(emojiProviderIos)({ package: target.package, imports: imports, name: target.name, @@ -480,12 +490,12 @@ async function generateCode(map, targets) { })); if (target.module !== "google-compat") { - await fs.writeFile(`${commonSrcDir}/${target.name}.kt`, template(emojiTemplate)({ + await fs.writeFile(`${commonMain}/${target.name}.kt`, template(emojiTemplate)({ package: target.package, name: target.name, })); } else { - await fs.writeFile(`${commonSrcDir}/${target.name}.kt`, template(emojiCompatTemplate)({ + await fs.writeFile(`${commonMain}/${target.name}.kt`, template(emojiCompatTemplate)({ package: target.package, name: target.name, })); diff --git a/generator/template/EmojiProviderIos.kt b/generator/template/EmojiProviderIos.kt new file mode 100644 index 0000000000..f0b8a53c6f --- /dev/null +++ b/generator/template/EmojiProviderIos.kt @@ -0,0 +1,30 @@ +/* + * Copyright (C) 2016 - Niklas Baudy, Ruben Gees, Mario Đanić and contributors + * + * 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 + * + * http://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 com.vanniktech.emoji.<%= package %> + +import com.vanniktech.emoji.EmojiCategory +import com.vanniktech.emoji.EmojiProvider +<%= imports %> + +class <%= name %>Provider : EmojiProvider { + override val categories: Array + get() = arrayOf(<% categories.forEach(function(category) { %> + <%= category.name %>(),<% }); %> + ) + + override fun release() = Unit +} diff --git a/gradle.properties b/gradle.properties index dfc5b00675..9b0ab64b04 100644 --- a/gradle.properties +++ b/gradle.properties @@ -36,3 +36,8 @@ android.defaults.buildfeatures.resvalues=false android.defaults.buildfeatures.shaders=false kotlin.mpp.stability.nowarn=true +kotlin.native.ignoreDisabledTargets=true + +# https://github.com/JetBrains/kotlin/blob/master/kotlin-native/NEW_MM.md +kotlin.native.binary.memoryModel=experimental +kotlin.native.binary.freezing=disabled