Skip to content

Commit

Permalink
Merge pull request #11 from htmlprogrammist/develop
Browse files Browse the repository at this point in the history
3.0.7
  • Loading branch information
htmlprogrammist authored Jan 26, 2023
2 parents 1d2cc6b + 75c1da3 commit cc418c4
Show file tree
Hide file tree
Showing 12 changed files with 387 additions and 389 deletions.
8 changes: 8 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -84,3 +84,11 @@ If you can't find valid, add new to codestyle agreements please. Other can be us
docs: update readme with additional information
docs: update description of run() method
```
## Before making pull request
1. Change version in [`EmojiPicker.podspec`](/EmojiPicker.podspec) file
2. Update version of dependency in Example App:
1. Open terminal
2. Open Example app directory using `cd Example\ App/`
3. Update pod version via command `pod install`
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.4'
s.version = '3.0.7'
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.4)
- EmojiPicker/Tests (3.0.4)
- EmojiPicker (3.0.7)
- EmojiPicker/Tests (3.0.7)

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

SPEC CHECKSUMS:
EmojiPicker: a21d785c95a64a0284b0d1472150d90c4348d5e3
EmojiPicker: 296cacb36c0eb34fe978d5411eaa06a67cd6da4b

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.

672 changes: 338 additions & 334 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.

63 changes: 28 additions & 35 deletions Sources/EmojiPicker/Services/EmojiManager.swift
Original file line number Diff line number Diff line change
Expand Up @@ -19,13 +19,10 @@
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
// SOFTWARE.

import UIKit.UIDevice
import UIKit

/// An abstraction over entity that provides emoji set.
protocol EmojiManagerProtocol {

/// Operating System version of a device.
var deviceVersion: Double { get }

/// Gets version of iOS for current device.
///
/// - Returns: Array of emoji categories (and array of emojis inside them).
Expand All @@ -37,21 +34,41 @@ final class EmojiManager: EmojiManagerProtocol {

// MARK: - Private Properties

/// An object that decodes instances of a data type from JSON objects.
private let decoder = JSONDecoder()

/// Version of emoji set.
///
/// - Note: The value is `5` by default.
private var emojiVersion = "5"

// MARK: - Internal
private var emojiVersion: String {
switch deviceVersion {
case 12.1...13.1:
return "11"

case 13.2...14.1:
return "12.1"

case 14.2...14.4:
return "13"

case 14.5...15.3:
return "13.1"

case 15.4...:
return "14"

default:
return "5"
}
}

var deviceVersion: Double {
private var deviceVersion: Double {
return (UIDevice.current.systemVersion as NSString).doubleValue
}

// MARK: - Internal Methods

func provideEmojis() -> EmojiSet {
setEmojiVersion()

guard let path = Bundle.module.path(forResource: emojiVersion, ofType: "json"),
let data = try? Data(contentsOf: URL(fileURLWithPath: path))
else {
Expand All @@ -65,28 +82,4 @@ final class EmojiManager: EmojiManagerProtocol {

return emojiSet
}

// MARK: - Private Methods

private func setEmojiVersion() {
switch deviceVersion {
case 12.1...13.1:
emojiVersion = "11"

case 13.2...14.1:
emojiVersion = "12.1"

case 14.2...14.4:
emojiVersion = "13"

case 14.5...15.3:
emojiVersion = "13.1"

case 15.4...:
emojiVersion = "14"

default:
emojiVersion = "5"
}
}
}
2 changes: 2 additions & 0 deletions Sources/EmojiPicker/ViewModel/EmojiPickerViewModel.swift
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
// SOFTWARE.

import Foundation

/// Protocol for a ViewModel which is being used in `EmojiPickerViewController`.
protocol EmojiPickerViewModelProtocol {
/// The observed variable that is responsible for the choice of emoji.
Expand Down
9 changes: 0 additions & 9 deletions Tests/EmojiPickerTests/EmojiManagerTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -33,13 +33,4 @@ class EmojiManagerTests: XCTestCase {
XCTAssertGreaterThan(result.categories.count, 0)
XCTAssertGreaterThan(result.aliases.count, 0)
}

/**
Tests that device version are identical.
*/
func testDeterminingDeviceVersion() throws {
let expectedVersion = (UIDevice.current.systemVersion as NSString).doubleValue

XCTAssertEqual(emojiManager.deviceVersion, expectedVersion)
}
}

0 comments on commit cc418c4

Please sign in to comment.