From 9fb9fdb63fb6160bab1c3aec6c1e981525161c03 Mon Sep 17 00:00:00 2001 From: Stefan Humm Date: Wed, 26 Jan 2022 12:37:22 +0900 Subject: [PATCH] Fix parsing of legacy cached Emoji (#49) --- CHANGELOG.md | 3 + example/ios/Podfile.lock | 2 +- example/ios/Runner.xcodeproj/project.pbxproj | 11 ++-- .../Flutter/GeneratedPluginRegistrant.swift | 2 - example/macos/Podfile.lock | 2 +- .../macos/Runner.xcodeproj/project.pbxproj | 64 +++++++++---------- example/macos/Runner/Configs/AppInfo.xcconfig | 2 +- example/pubspec.lock | 2 +- lib/src/emoji.dart | 3 +- pubspec.yaml | 2 +- test/emoji_picker_flutter_test.dart | 29 +++++++++ 11 files changed, 75 insertions(+), 47 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 4617c8c..24e1ee3 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,6 @@ +## 1.1.1 +* Fix parsing of legacy Emoji Recent-List 😵 + ## 1.1.0 * New feature: EmojiPickerUtils provide access to recent emojis, search emoji and adding emoji to recently-used list * New feature: Skin-Tone Support diff --git a/example/ios/Podfile.lock b/example/ios/Podfile.lock index 41f12e0..35ab6a9 100644 --- a/example/ios/Podfile.lock +++ b/example/ios/Podfile.lock @@ -25,4 +25,4 @@ SPEC CHECKSUMS: PODFILE CHECKSUM: aafe91acc616949ddb318b77800a7f51bffa2a4c -COCOAPODS: 1.9.3 +COCOAPODS: 1.10.0 diff --git a/example/ios/Runner.xcodeproj/project.pbxproj b/example/ios/Runner.xcodeproj/project.pbxproj index 1fbd469..3ac670f 100644 --- a/example/ios/Runner.xcodeproj/project.pbxproj +++ b/example/ios/Runner.xcodeproj/project.pbxproj @@ -253,15 +253,12 @@ buildActionMask = 2147483647; files = ( ); - inputPaths = ( - "${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-frameworks.sh", - "${BUILT_PRODUCTS_DIR}/emoji_picker_flutter/emoji_picker_flutter.framework", - "${BUILT_PRODUCTS_DIR}/shared_preferences/shared_preferences.framework", + inputFileListPaths = ( + "${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-frameworks-${CONFIGURATION}-input-files.xcfilelist", ); name = "[CP] Embed Pods Frameworks"; - outputPaths = ( - "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/emoji_picker_flutter.framework", - "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/shared_preferences.framework", + outputFileListPaths = ( + "${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-frameworks-${CONFIGURATION}-output-files.xcfilelist", ); runOnlyForDeploymentPostprocessing = 0; shellPath = /bin/sh; diff --git a/example/macos/Flutter/GeneratedPluginRegistrant.swift b/example/macos/Flutter/GeneratedPluginRegistrant.swift index 60d519e..287b6a9 100644 --- a/example/macos/Flutter/GeneratedPluginRegistrant.swift +++ b/example/macos/Flutter/GeneratedPluginRegistrant.swift @@ -5,10 +5,8 @@ import FlutterMacOS import Foundation -import emoji_picker_flutter import shared_preferences_macos func RegisterGeneratedPlugins(registry: FlutterPluginRegistry) { - EmojiPickerFlutterPlugin.register(with: registry.registrar(forPlugin: "EmojiPickerFlutterPlugin")) SharedPreferencesPlugin.register(with: registry.registrar(forPlugin: "SharedPreferencesPlugin")) } diff --git a/example/macos/Podfile.lock b/example/macos/Podfile.lock index e93f18e..dfdc55f 100644 --- a/example/macos/Podfile.lock +++ b/example/macos/Podfile.lock @@ -19,4 +19,4 @@ SPEC CHECKSUMS: PODFILE CHECKSUM: 6eac6b3292e5142cfc23bdeb71848a40ec51c14c -COCOAPODS: 1.10.1 +COCOAPODS: 1.11.2 diff --git a/example/macos/Runner.xcodeproj/project.pbxproj b/example/macos/Runner.xcodeproj/project.pbxproj index 36fed0a..fb2338a 100644 --- a/example/macos/Runner.xcodeproj/project.pbxproj +++ b/example/macos/Runner.xcodeproj/project.pbxproj @@ -21,12 +21,12 @@ /* End PBXAggregateTarget section */ /* Begin PBXBuildFile section */ + 0E0498948702EF9EB4B250E8 /* Pods_Runner.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 957CA104F61BB50B33FED6CB /* Pods_Runner.framework */; }; 335BBD1B22A9A15E00E9071D /* GeneratedPluginRegistrant.swift in Sources */ = {isa = PBXBuildFile; fileRef = 335BBD1A22A9A15E00E9071D /* GeneratedPluginRegistrant.swift */; }; 33CC10F12044A3C60003C045 /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 33CC10F02044A3C60003C045 /* AppDelegate.swift */; }; 33CC10F32044A3C60003C045 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 33CC10F22044A3C60003C045 /* Assets.xcassets */; }; 33CC10F62044A3C60003C045 /* MainMenu.xib in Resources */ = {isa = PBXBuildFile; fileRef = 33CC10F42044A3C60003C045 /* MainMenu.xib */; }; 33CC11132044BFA00003C045 /* MainFlutterWindow.swift in Sources */ = {isa = PBXBuildFile; fileRef = 33CC11122044BFA00003C045 /* MainFlutterWindow.swift */; }; - 9501A4BA94C43701D402F0DC /* Pods_Runner.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 4499436A4685BD9FFEA33464 /* Pods_Runner.framework */; }; /* End PBXBuildFile section */ /* Begin PBXContainerItemProxy section */ @@ -53,6 +53,7 @@ /* End PBXCopyFilesBuildPhase section */ /* Begin PBXFileReference section */ + 1D675DFF141B849B7B2A6419 /* Pods-Runner.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Runner.release.xcconfig"; path = "Target Support Files/Pods-Runner/Pods-Runner.release.xcconfig"; sourceTree = ""; }; 333000ED22D3DE5D00554162 /* Warnings.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; path = Warnings.xcconfig; sourceTree = ""; }; 335BBD1A22A9A15E00E9071D /* GeneratedPluginRegistrant.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = GeneratedPluginRegistrant.swift; sourceTree = ""; }; 33CC10ED2044A3C60003C045 /* example.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = example.app; sourceTree = BUILT_PRODUCTS_DIR; }; @@ -67,12 +68,11 @@ 33E51913231747F40026EE4D /* DebugProfile.entitlements */ = {isa = PBXFileReference; lastKnownFileType = text.plist.entitlements; path = DebugProfile.entitlements; sourceTree = ""; }; 33E51914231749380026EE4D /* Release.entitlements */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.entitlements; path = Release.entitlements; sourceTree = ""; }; 33E5194F232828860026EE4D /* AppInfo.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; path = AppInfo.xcconfig; sourceTree = ""; }; - 4499436A4685BD9FFEA33464 /* Pods_Runner.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_Runner.framework; sourceTree = BUILT_PRODUCTS_DIR; }; + 74CAA3218A1A4F48DE277AD7 /* Pods-Runner.profile.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Runner.profile.xcconfig"; path = "Target Support Files/Pods-Runner/Pods-Runner.profile.xcconfig"; sourceTree = ""; }; 7AFA3C8E1D35360C0083082E /* Release.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; path = Release.xcconfig; sourceTree = ""; }; - 7E62EBD1132A870EC9BFBE7E /* Pods-Runner.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Runner.release.xcconfig"; path = "Target Support Files/Pods-Runner/Pods-Runner.release.xcconfig"; sourceTree = ""; }; - 7EB63E5C7EB94946D8F5A27E /* Pods-Runner.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Runner.debug.xcconfig"; path = "Target Support Files/Pods-Runner/Pods-Runner.debug.xcconfig"; sourceTree = ""; }; - 95DAD697B55780E0D2CDDADB /* Pods-Runner.profile.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Runner.profile.xcconfig"; path = "Target Support Files/Pods-Runner/Pods-Runner.profile.xcconfig"; sourceTree = ""; }; + 957CA104F61BB50B33FED6CB /* Pods_Runner.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_Runner.framework; sourceTree = BUILT_PRODUCTS_DIR; }; 9740EEB21CF90195004384FC /* Debug.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; path = Debug.xcconfig; sourceTree = ""; }; + BB84AEB1A79F0B7C6247A451 /* Pods-Runner.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Runner.debug.xcconfig"; path = "Target Support Files/Pods-Runner/Pods-Runner.debug.xcconfig"; sourceTree = ""; }; /* End PBXFileReference section */ /* Begin PBXFrameworksBuildPhase section */ @@ -80,7 +80,7 @@ isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( - 9501A4BA94C43701D402F0DC /* Pods_Runner.framework in Frameworks */, + 0E0498948702EF9EB4B250E8 /* Pods_Runner.framework in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -105,7 +105,7 @@ 33CEB47122A05771004F2AC0 /* Flutter */, 33CC10EE2044A3C60003C045 /* Products */, D73912EC22F37F3D000D13A0 /* Frameworks */, - ADD1A3D8FB009DF768361F28 /* Pods */, + 7D78366ECA4F0ADD0717FA67 /* Pods */, ); sourceTree = ""; }; @@ -152,12 +152,12 @@ path = Runner; sourceTree = ""; }; - ADD1A3D8FB009DF768361F28 /* Pods */ = { + 7D78366ECA4F0ADD0717FA67 /* Pods */ = { isa = PBXGroup; children = ( - 7EB63E5C7EB94946D8F5A27E /* Pods-Runner.debug.xcconfig */, - 7E62EBD1132A870EC9BFBE7E /* Pods-Runner.release.xcconfig */, - 95DAD697B55780E0D2CDDADB /* Pods-Runner.profile.xcconfig */, + BB84AEB1A79F0B7C6247A451 /* Pods-Runner.debug.xcconfig */, + 1D675DFF141B849B7B2A6419 /* Pods-Runner.release.xcconfig */, + 74CAA3218A1A4F48DE277AD7 /* Pods-Runner.profile.xcconfig */, ); name = Pods; path = Pods; @@ -166,7 +166,7 @@ D73912EC22F37F3D000D13A0 /* Frameworks */ = { isa = PBXGroup; children = ( - 4499436A4685BD9FFEA33464 /* Pods_Runner.framework */, + 957CA104F61BB50B33FED6CB /* Pods_Runner.framework */, ); name = Frameworks; sourceTree = ""; @@ -178,13 +178,13 @@ isa = PBXNativeTarget; buildConfigurationList = 33CC10FB2044A3C60003C045 /* Build configuration list for PBXNativeTarget "Runner" */; buildPhases = ( - 487196C0857FD34357548D78 /* [CP] Check Pods Manifest.lock */, + BAD3A89A1466A3AAE07E1729 /* [CP] Check Pods Manifest.lock */, 33CC10E92044A3C60003C045 /* Sources */, 33CC10EA2044A3C60003C045 /* Frameworks */, 33CC10EB2044A3C60003C045 /* Resources */, 33CC110E2044A8840003C045 /* Bundle Framework */, 3399D490228B24CF009A79C7 /* ShellScript */, - 64D88447A7CB74B9145C68D8 /* [CP] Embed Pods Frameworks */, + 00D0E436DF9A5A5318A27FF2 /* [CP] Embed Pods Frameworks */, ); buildRules = ( ); @@ -254,6 +254,23 @@ /* End PBXResourcesBuildPhase section */ /* Begin PBXShellScriptBuildPhase section */ + 00D0E436DF9A5A5318A27FF2 /* [CP] Embed Pods Frameworks */ = { + isa = PBXShellScriptBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + inputFileListPaths = ( + "${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-frameworks-${CONFIGURATION}-input-files.xcfilelist", + ); + name = "[CP] Embed Pods Frameworks"; + outputFileListPaths = ( + "${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-frameworks-${CONFIGURATION}-output-files.xcfilelist", + ); + runOnlyForDeploymentPostprocessing = 0; + shellPath = /bin/sh; + shellScript = "\"${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-frameworks.sh\"\n"; + showEnvVarsInLog = 0; + }; 3399D490228B24CF009A79C7 /* ShellScript */ = { isa = PBXShellScriptBuildPhase; buildActionMask = 2147483647; @@ -291,7 +308,7 @@ shellPath = /bin/sh; shellScript = "\"$FLUTTER_ROOT\"/packages/flutter_tools/bin/macos_assemble.sh && touch Flutter/ephemeral/tripwire"; }; - 487196C0857FD34357548D78 /* [CP] Check Pods Manifest.lock */ = { + BAD3A89A1466A3AAE07E1729 /* [CP] Check Pods Manifest.lock */ = { isa = PBXShellScriptBuildPhase; buildActionMask = 2147483647; files = ( @@ -313,23 +330,6 @@ shellScript = "diff \"${PODS_PODFILE_DIR_PATH}/Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n# This output is used by Xcode 'outputs' to avoid re-running this script phase.\necho \"SUCCESS\" > \"${SCRIPT_OUTPUT_FILE_0}\"\n"; showEnvVarsInLog = 0; }; - 64D88447A7CB74B9145C68D8 /* [CP] Embed Pods Frameworks */ = { - isa = PBXShellScriptBuildPhase; - buildActionMask = 2147483647; - files = ( - ); - inputFileListPaths = ( - "${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-frameworks-${CONFIGURATION}-input-files.xcfilelist", - ); - name = "[CP] Embed Pods Frameworks"; - outputFileListPaths = ( - "${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-frameworks-${CONFIGURATION}-output-files.xcfilelist", - ); - runOnlyForDeploymentPostprocessing = 0; - shellPath = /bin/sh; - shellScript = "\"${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-frameworks.sh\"\n"; - showEnvVarsInLog = 0; - }; /* End PBXShellScriptBuildPhase section */ /* Begin PBXSourcesBuildPhase section */ diff --git a/example/macos/Runner/Configs/AppInfo.xcconfig b/example/macos/Runner/Configs/AppInfo.xcconfig index 7c7d71a..14c10af 100644 --- a/example/macos/Runner/Configs/AppInfo.xcconfig +++ b/example/macos/Runner/Configs/AppInfo.xcconfig @@ -11,4 +11,4 @@ PRODUCT_NAME = example PRODUCT_BUNDLE_IDENTIFIER = com.fintays.example // The copyright displayed in application information -PRODUCT_COPYRIGHT = Copyright © 2021 com.fintays. All rights reserved. +PRODUCT_COPYRIGHT = Copyright © 2022 com.fintays. All rights reserved. diff --git a/example/pubspec.lock b/example/pubspec.lock index 298cf78..c97ee0c 100644 --- a/example/pubspec.lock +++ b/example/pubspec.lock @@ -21,7 +21,7 @@ packages: path: ".." relative: true source: path - version: "1.1.0" + version: "1.1.1" ffi: dependency: transitive description: diff --git a/lib/src/emoji.dart b/lib/src/emoji.dart index 1a566e0..125db19 100644 --- a/lib/src/emoji.dart +++ b/lib/src/emoji.dart @@ -27,7 +27,8 @@ class Emoji { return Emoji( json['name'] as String, json['emoji'] as String, - hasSkinTone: json['hasSkinTone'] as bool, + hasSkinTone: + json['hasSkinTone'] != null ? json['hasSkinTone'] as bool : false, ); } diff --git a/pubspec.yaml b/pubspec.yaml index 49853bb..5660132 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -1,6 +1,6 @@ name: emoji_picker_flutter description: A Flutter package that provides an Emoji picker widget with 1500+ emojis in 8 categories. -version: 1.1.0 +version: 1.1.1 homepage: https://github.com/Fintasys/emoji_picker_flutter environment: diff --git a/test/emoji_picker_flutter_test.dart b/test/emoji_picker_flutter_test.dart index 8b59758..583f158 100644 --- a/test/emoji_picker_flutter_test.dart +++ b/test/emoji_picker_flutter_test.dart @@ -8,6 +8,7 @@ import 'package:test/test.dart'; void main() { skinToneTests(); emojiVersioningTests(); + emojiModelTests(); } void skinToneTests() { @@ -67,3 +68,31 @@ void emojiVersioningTests() { expect((await utils.isEmojiUpdateAvailable()), false); }); } + +void emojiModelTests() { + test('encode Emoji', () { + final encode = const Emoji('name', '🤣'); + expect(encode.toJson(), + {'name': 'name', 'emoji': '🤣', 'hasSkinTone': false}); + }); + + test('decode Emoji without hasSkinTone property', () { + final decode = {'name': 'name', 'emoji': '🤣'}; + final result = Emoji.fromJson(decode); + expect(result.name, 'name'); + expect(result.emoji, '🤣'); + expect(result.hasSkinTone, false); + }); + + test('decode Emoji with hasSkinTone property', () { + final decode = { + 'name': 'name', + 'emoji': '🤣', + 'hasSkinTone': true + }; + final result = Emoji.fromJson(decode); + expect(result.name, 'name'); + expect(result.emoji, '🤣'); + expect(result.hasSkinTone, true); + }); +}