Skip to content

Commit

Permalink
Fix parsing of legacy cached Emoji (#49)
Browse files Browse the repository at this point in the history
  • Loading branch information
Fintasys authored Jan 26, 2022
1 parent 2bb7fb9 commit 9fb9fdb
Show file tree
Hide file tree
Showing 11 changed files with 75 additions and 47 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -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
Expand Down
2 changes: 1 addition & 1 deletion example/ios/Podfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -25,4 +25,4 @@ SPEC CHECKSUMS:

PODFILE CHECKSUM: aafe91acc616949ddb318b77800a7f51bffa2a4c

COCOAPODS: 1.9.3
COCOAPODS: 1.10.0
11 changes: 4 additions & 7 deletions example/ios/Runner.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
2 changes: 0 additions & 2 deletions example/macos/Flutter/GeneratedPluginRegistrant.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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"))
}
2 changes: 1 addition & 1 deletion example/macos/Podfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -19,4 +19,4 @@ SPEC CHECKSUMS:

PODFILE CHECKSUM: 6eac6b3292e5142cfc23bdeb71848a40ec51c14c

COCOAPODS: 1.10.1
COCOAPODS: 1.11.2
64 changes: 32 additions & 32 deletions example/macos/Runner.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -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 */
Expand All @@ -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 = "<group>"; };
333000ED22D3DE5D00554162 /* Warnings.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; path = Warnings.xcconfig; sourceTree = "<group>"; };
335BBD1A22A9A15E00E9071D /* GeneratedPluginRegistrant.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = GeneratedPluginRegistrant.swift; sourceTree = "<group>"; };
33CC10ED2044A3C60003C045 /* example.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = example.app; sourceTree = BUILT_PRODUCTS_DIR; };
Expand All @@ -67,20 +68,19 @@
33E51913231747F40026EE4D /* DebugProfile.entitlements */ = {isa = PBXFileReference; lastKnownFileType = text.plist.entitlements; path = DebugProfile.entitlements; sourceTree = "<group>"; };
33E51914231749380026EE4D /* Release.entitlements */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.entitlements; path = Release.entitlements; sourceTree = "<group>"; };
33E5194F232828860026EE4D /* AppInfo.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; path = AppInfo.xcconfig; sourceTree = "<group>"; };
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 = "<group>"; };
7AFA3C8E1D35360C0083082E /* Release.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; path = Release.xcconfig; sourceTree = "<group>"; };
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 = "<group>"; };
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 = "<group>"; };
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 = "<group>"; };
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 = "<group>"; };
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 = "<group>"; };
/* End PBXFileReference section */

/* Begin PBXFrameworksBuildPhase section */
33CC10EA2044A3C60003C045 /* Frameworks */ = {
isa = PBXFrameworksBuildPhase;
buildActionMask = 2147483647;
files = (
9501A4BA94C43701D402F0DC /* Pods_Runner.framework in Frameworks */,
0E0498948702EF9EB4B250E8 /* Pods_Runner.framework in Frameworks */,
);
runOnlyForDeploymentPostprocessing = 0;
};
Expand All @@ -105,7 +105,7 @@
33CEB47122A05771004F2AC0 /* Flutter */,
33CC10EE2044A3C60003C045 /* Products */,
D73912EC22F37F3D000D13A0 /* Frameworks */,
ADD1A3D8FB009DF768361F28 /* Pods */,
7D78366ECA4F0ADD0717FA67 /* Pods */,
);
sourceTree = "<group>";
};
Expand Down Expand Up @@ -152,12 +152,12 @@
path = Runner;
sourceTree = "<group>";
};
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;
Expand All @@ -166,7 +166,7 @@
D73912EC22F37F3D000D13A0 /* Frameworks */ = {
isa = PBXGroup;
children = (
4499436A4685BD9FFEA33464 /* Pods_Runner.framework */,
957CA104F61BB50B33FED6CB /* Pods_Runner.framework */,
);
name = Frameworks;
sourceTree = "<group>";
Expand All @@ -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 = (
);
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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 = (
Expand All @@ -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 */
Expand Down
2 changes: 1 addition & 1 deletion example/macos/Runner/Configs/AppInfo.xcconfig
Original file line number Diff line number Diff line change
Expand Up @@ -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.
2 changes: 1 addition & 1 deletion example/pubspec.lock
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ packages:
path: ".."
relative: true
source: path
version: "1.1.0"
version: "1.1.1"
ffi:
dependency: transitive
description:
Expand Down
3 changes: 2 additions & 1 deletion lib/src/emoji.dart
Original file line number Diff line number Diff line change
Expand Up @@ -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,
);
}

Expand Down
2 changes: 1 addition & 1 deletion pubspec.yaml
Original file line number Diff line number Diff line change
@@ -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:
Expand Down
29 changes: 29 additions & 0 deletions test/emoji_picker_flutter_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import 'package:test/test.dart';
void main() {
skinToneTests();
emojiVersioningTests();
emojiModelTests();
}

void skinToneTests() {
Expand Down Expand Up @@ -67,3 +68,31 @@ void emojiVersioningTests() {
expect((await utils.isEmojiUpdateAvailable()), false);
});
}

void emojiModelTests() {
test('encode Emoji', () {
final encode = const Emoji('name', '🤣');
expect(encode.toJson(),
<String, dynamic>{'name': 'name', 'emoji': '🤣', 'hasSkinTone': false});
});

test('decode Emoji without hasSkinTone property', () {
final decode = <String, dynamic>{'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 = <String, dynamic>{
'name': 'name',
'emoji': '🤣',
'hasSkinTone': true
};
final result = Emoji.fromJson(decode);
expect(result.name, 'name');
expect(result.emoji, '🤣');
expect(result.hasSkinTone, true);
});
}

0 comments on commit 9fb9fdb

Please sign in to comment.