Skip to content

Commit

Permalink
Merge pull request #13 from htmlprogrammist/develop
Browse files Browse the repository at this point in the history
3.0.8
  • Loading branch information
htmlprogrammist authored Jan 28, 2023
2 parents cc418c4 + bb8d4c6 commit 4e38995
Show file tree
Hide file tree
Showing 31 changed files with 226 additions and 196 deletions.
2 changes: 1 addition & 1 deletion EmojiPicker.podspec
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Pod::Spec.new do |s|
s.name = 'EmojiPicker'
s.version = '3.0.7'
s.version = '3.0.8'
s.license = 'MIT'
s.summary = 'Emoji picker for iOS like on MacOS'
s.homepage = 'https://github.com/htmlprogrammist/EmojiPicker'
Expand Down
Binary file not shown.
6 changes: 3 additions & 3 deletions Example App/Podfile.lock
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
PODS:
- EmojiPicker (3.0.7)
- EmojiPicker/Tests (3.0.7)
- EmojiPicker (3.0.8)
- EmojiPicker/Tests (3.0.8)

DEPENDENCIES:
- EmojiPicker (from `../`)
Expand All @@ -11,7 +11,7 @@ EXTERNAL SOURCES:
:path: "../"

SPEC CHECKSUMS:
EmojiPicker: 296cacb36c0eb34fe978d5411eaa06a67cd6da4b
EmojiPicker: 2015f097678687260575d880b5960194802d6958

PODFILE CHECKSUM: e686a8fbd8a5367eac0bf7fb77e0bbddf18a2353

Expand Down
4 changes: 2 additions & 2 deletions Example App/Pods/Local Podspecs/EmojiPicker.podspec.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions Example App/Pods/Manifest.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

177 changes: 90 additions & 87 deletions Example App/Pods/Pods.xcodeproj/project.pbxproj

Large diffs are not rendered by default.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

28 changes: 15 additions & 13 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,8 @@
# EmojiPicker

Emoji picker for iOS like on macOS

<p float="left">
<img src="https://user-images.githubusercontent.com/50948518/172110164-b0dec76f-495d-4112-ad00-2708ffdda54a.gif" width="230">
<img src="https://user-images.githubusercontent.com/50948518/171909950-ebf388f3-83a1-4b63-ad54-f58ba947e3bb.png" width="230">
<p align="center">
<br>
<b>EmojiPicker</b> is a customizable package<br>implementing macOS-style emoji picker popover
<br>
<img width="640" alt="Emoji Picker Preview" src="https://user-images.githubusercontent.com/60363270/215256897-bb78172d-703b-4eba-8e99-8de36f323202.png">
</p>

## Navigation
Expand All @@ -15,16 +13,17 @@ Emoji picker for iOS like on macOS
- [Manually](#manually)
- [Quick Start](#quick-start)
- [Usage](#usage)
- [Required parameters](#required-parameters)
- [Delegate](#delegate)
- [Source view](#source-view)
- [Selected emoji category tint color](#selected-emoji-category-tint-color)
- [Arrow direction](#arrow-direction)
- [Horizontal inset](#horizontal-inset)
- [Is dismissed after choosing](#is-dismissed-after-choosing)
- [Custom height](#custom-height)
- [Feedback generator style](#feedback-generator-style)
- [Localizations](#localizations)
- [Localization](#localization)
- [Contributing](#contributing)
- [Getting started](#getting-started)
- [Experiments](#experiments)

## Installation

Expand Down Expand Up @@ -153,16 +152,19 @@ viewController.feedbackGeneratorStyle = .soft

## Localization

* Chinese 🇨🇳
* English 🇬🇧
* Russian 🇷🇺
* Ukraine 🇺🇦
* French 🇫🇷
* German 🇩🇪
* Hindi 🇮🇳
* Russian 🇷🇺
* Turkish 🇹🇷
* Ukrainian 🇺🇦

You can also contribute your language to this list. Please, read [following heading](#contributing) for more information.

> ❗️ Note that the languages are arranged in alphabetical order
## Contributing

Contributions are welcomed and encouraged! Please see the [Contributing guide](https://github.com/htmlprogrammist/EmojiPicker/blob/main/CONTRIBUTING.md).
Expand All @@ -171,7 +173,7 @@ To be a truly great community, we need to welcome developers from all walks of l

To give clarity of what is expected of our members, we have adopted the code of conduct defined by the Contributor Covenant. This document is used across many open source communities, and we think it articulates our values well. For more, see the [Code of Conduct](https://github.com/htmlprogrammist/EmojiPicker/blob/main/CODE_OF_CONDUCT.md).

## Getting started
## Experiments

To play around with the project, contribute to it, see how it works or adapt it for yourself:

Expand Down
18 changes: 0 additions & 18 deletions Sources/EmojiPicker.h

This file was deleted.

1 change: 1 addition & 0 deletions Sources/EmojiPicker/Bindings/Observable.swift
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
// The MIT License (MIT)
//
// Copyright © 2022 Ivan Izyumkin
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
Expand Down
1 change: 1 addition & 0 deletions Sources/EmojiPicker/Extensions/Foundation/Bundle.swift
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
// The MIT License (MIT)
//
// Copyright © 2022 Ivan Izyumkin
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
Expand Down
1 change: 1 addition & 0 deletions Sources/EmojiPicker/Extensions/UIKit/UIColor.swift
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
// The MIT License (MIT)
//
// Copyright © 2022 Ivan Izyumkin
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
Expand Down
1 change: 1 addition & 0 deletions Sources/EmojiPicker/Extensions/UIKit/UIView.swift
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
// The MIT License (MIT)
//
// Copyright © 2022 Ivan Izyumkin
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
Expand Down
5 changes: 3 additions & 2 deletions Sources/EmojiPicker/Models/Category.swift
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
// The MIT License (MIT)
//
// Copyright © 2022 Egor Badmaev
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
Expand All @@ -24,11 +25,11 @@ struct Category: Decodable {
/// Type-safe category type.
let type: CategoryType
/// Identifiers of emojis.
let emojis: [String]
let identifiers: [Emoji.ID]

enum CodingKeys: String, CodingKey {
case type = "id"
case emojis
case identifiers = "emojis"
}
}

Expand Down
14 changes: 13 additions & 1 deletion Sources/EmojiPicker/Models/Emoji.swift
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
// The MIT License (MIT)
//
// Copyright © 2022 Egor Badmaev
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
Expand All @@ -20,7 +21,7 @@
// SOFTWARE.

/// An object that represents emoji.
struct Emoji: Decodable {
struct Emoji: Decodable, Identifiable {
/// Emoji identifier.
let id: String
/// Name of an emoji.
Expand All @@ -31,4 +32,15 @@ struct Emoji: Decodable {
let skins: [Skin]
/// Version in which the emoji appeared.
let version: Double
/// Skin tone number. We save it so user can use the skin he chose.
var skinToneIndex = 0
}

extension Emoji {
/// String emoji. For example: 😄
///
/// Shows in the collection view.
var emoji: String {
return skins[skinToneIndex].native
}
}
5 changes: 3 additions & 2 deletions Sources/EmojiPicker/Models/EmojiSet.swift
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
// The MIT License (MIT)
//
// Copyright © 2022 Egor Badmaev
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
Expand All @@ -23,8 +24,8 @@
struct EmojiSet: Decodable {
/// Emoji categories.
let categories: [Category]
/// Emojis dictionary. Key is the name (id) of emoji.
let emojis: [String: Emoji]
/// Emojis dictionary from which you can get emojis by ID.
let emojis: [Emoji.ID: Emoji]
/// Aliases of keywords for emojis.
let aliases: [String: String]
}
1 change: 1 addition & 0 deletions Sources/EmojiPicker/Models/PickerArrowDirectionMode.swift
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
// The MIT License (MIT)
//
// Copyright © 2022 Ivan Izyumkin
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
Expand Down
1 change: 1 addition & 0 deletions Sources/EmojiPicker/Models/Skin.swift
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
// The MIT License (MIT)
//
// Copyright © 2022 Egor Badmaev
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
"people" = "微笑与人";
"nature" = "动物与自然";
"foods" = "食物及饮品";
"activity" = "活动";
"places" = "旅游及地点";
"objects" = "对象";
"symbols" = "符号";
"flags" = "旗帜";
13 changes: 9 additions & 4 deletions Sources/EmojiPicker/Services/EmojiManager.swift
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
// The MIT License (MIT)
//
// Copyright © 2022 Egor Badmaev
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
Expand All @@ -19,13 +20,13 @@
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
// SOFTWARE.

import UIKit
import Foundation

/// An abstraction over entity that provides emoji set.
protocol EmojiManagerProtocol {
/// Gets version of iOS for current device.
/// Provides a set of emojis.
///
/// - Returns: Array of emoji categories (and array of emojis inside them).
/// - Returns: Set of emojis.
func provideEmojis() -> EmojiSet
}

Expand Down Expand Up @@ -62,8 +63,12 @@ final class EmojiManager: EmojiManagerProtocol {
}
}

/// Version of operating system of a device.
///
/// It takes major and minor version of a device and returns it as `15.5`.
private var deviceVersion: Double {
return (UIDevice.current.systemVersion as NSString).doubleValue
let operatingSystemVersion = ProcessInfo().operatingSystemVersion
return Double(operatingSystemVersion.majorVersion) + Double(operatingSystemVersion.minorVersion) / 10
}

// MARK: - Internal Methods
Expand Down
7 changes: 4 additions & 3 deletions Sources/EmojiPicker/ViewModel/EmojiPickerViewModel.swift
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
// The MIT License (MIT)
//
// Copyright © 2022 Ivan Izyumkin
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
Expand Down Expand Up @@ -65,12 +66,12 @@ final class EmojiPickerViewModel: EmojiPickerViewModelProtocol {
}

func numberOfItems(in section: Int) -> Int {
return emojiSet.categories[section].emojis.count
return emojiSet.categories[section].identifiers.count
}

func emoji(at indexPath: IndexPath) -> String {
let name = emojiSet.categories[indexPath.section].emojis[indexPath.row]
return emojiSet.emojis[name]?.skins[0].native ?? ""
let name = emojiSet.categories[indexPath.section].identifiers[indexPath.row]
return emojiSet.emojis[name]?.emoji ?? ""
}

func sectionHeaderViewModel(for section: Int) -> String {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
// The MIT License (MIT)
//
// Copyright © 2022 Ivan Izyumkin
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
// The MIT License (MIT)
//
// Copyright © 2022 Ivan Izyumkin
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
Expand Down
1 change: 1 addition & 0 deletions Sources/EmojiPicker/Views/EmojiCollectionViewCell.swift
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
// The MIT License (MIT)
//
// Copyright © 2022 Ivan Izyumkin
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
Expand Down
1 change: 1 addition & 0 deletions Sources/EmojiPicker/Views/EmojiCollectionViewHeader.swift
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
// The MIT License (MIT)
//
// Copyright © 2022 Ivan Izyumkin
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
Expand Down
Loading

0 comments on commit 4e38995

Please sign in to comment.