Skip to content

Commit

Permalink
Merge branch 'release/1.2.0'
Browse files Browse the repository at this point in the history
  • Loading branch information
KWANG HYOUN KIM committed Jan 23, 2019
2 parents 0bf7f1e + d37e753 commit 0bcb603
Show file tree
Hide file tree
Showing 69 changed files with 31 additions and 6,265 deletions.
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,8 @@ playground.xcworkspace
# you should judge for yourself, the pros and cons are mentioned at:
# https://guides.cocoapods.org/using/using-cocoapods.html#should-i-check-the-pods-directory-into-source-control
#
# Pods/
Pods/
Example/Pods/

# Carthage
#
Expand Down
3 changes: 1 addition & 2 deletions APNSUtil.podspec
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

Pod::Spec.new do |s|
s.name = 'APNSUtil'
s.version = '1.1.5'
s.version = '1.2.0'
s.summary = 'APNSUtil is makes code simple using apple push notification service.'
s.description = 'APNSUtil is makes code simple using apple push notification service.'
s.homepage = 'https://github.com/pisces/APNSUtil'
Expand All @@ -17,5 +17,4 @@ Pod::Spec.new do |s|
s.source = { :git => 'https://github.com/pisces/APNSUtil.git', :tag => s.version.to_s }
s.ios.deployment_target = '9.0'
s.source_files = 'APNSUtil/Classes/**/*'
s.dependency 'ObjectMapper', '~> 3.1'
end
18 changes: 10 additions & 8 deletions APNSUtil/Classes/APNSManager.swift
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@

import UIKit
import UserNotifications
import ObjectMapper

public class APNSManager {

Expand Down Expand Up @@ -43,16 +42,19 @@ public class APNSManager {
dequeue()
return self
}
public func didFinishLaunching<T: Mappable>(withOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?, as type: T.Type) {
public func didFinishLaunching<T: Decodable>(withOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?, as type: T.Type) {
let remote = launchOptions?[UIApplicationLaunchOptionsKey.remoteNotification] as? [AnyHashable: Any]
let local = launchOptions?[UIApplicationLaunchOptionsKey.localNotification] as? [AnyHashable: Any]
guard let userInfo = remote ?? local else {return}
didReceive(userInfo: userInfo, as: type, isInactive: true)
}
public func didReceive<T: Mappable>(userInfo: [AnyHashable : Any], as: T.Type, isInactive: Bool) {
let map = Map(mappingType: .fromJSON, JSON: userInfo as! [String: Any])
let model = T.init(map: map)!
enqueue(RemoteNotificationElement(isInactive: isInactive, model: model)).dequeue()
public func didReceive<T: Decodable>(userInfo: [AnyHashable : Any], as: T.Type, isInactive: Bool) {
do {
let data = try JSONSerialization.data(withJSONObject: userInfo, options: .prettyPrinted)
let model = try JSONDecoder().decode(`as`, from: data)
enqueue(RemoteNotificationElement(isInactive: isInactive, model: model)).dequeue()
} catch {
}
}
public func processing(_ subscribable: Subscribable, _ closure: @escaping Processing) -> APNSManager {
guard processingClosureMap[subscribable.hash] == nil else {return self}
Expand Down Expand Up @@ -132,7 +134,7 @@ public class APNSManager {
}

public struct RemoteNotificationElement {
public typealias T = Mappable
public typealias T = Decodable

public private(set) var isInactive: Bool = false
private var model: T!
Expand All @@ -142,7 +144,7 @@ public struct RemoteNotificationElement {
self.model = model
}

public func payload<E: Mappable>() -> E {
public func payload<E: Decodable>() -> E {
return model as! E
}
}
Expand Down
3 changes: 1 addition & 2 deletions APNSUtilAppExtension.podspec
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

Pod::Spec.new do |s|
s.name = 'APNSUtilAppExtension'
s.version = '1.1.5'
s.version = '1.2.0'
s.summary = 'APNSUtil is makes code simple using apple push notification service.'
s.description = 'APNSUtil is makes code simple using apple push notification service.'
s.homepage = 'https://github.com/pisces/APNSUtil'
Expand All @@ -17,6 +17,5 @@ Pod::Spec.new do |s|
s.source = { :git => 'https://github.com/pisces/APNSUtil.git', :tag => s.version.to_s }
s.ios.deployment_target = '9.0'
s.source_files = 'APNSUtil/Classes/**/*'
s.dependency 'ObjectMapper', '~> 3.1'
s.pod_target_xcconfig = { 'OTHER_SWIFT_FLAGS' => '-DAPP_EXTENSIONS' }
end
6 changes: 2 additions & 4 deletions Example/APNSUtil.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -288,18 +288,16 @@
files = (
);
inputPaths = (
"${SRCROOT}/Pods/Target Support Files/Pods-APNSUtil_Example/Pods-APNSUtil_Example-frameworks.sh",
"${PODS_ROOT}/Target Support Files/Pods-APNSUtil_Example/Pods-APNSUtil_Example-frameworks.sh",
"${BUILT_PRODUCTS_DIR}/APNSUtil/APNSUtil.framework",
"${BUILT_PRODUCTS_DIR}/ObjectMapper/ObjectMapper.framework",
);
name = "[CP] Embed Pods Frameworks";
outputPaths = (
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/APNSUtil.framework",
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/ObjectMapper.framework",
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;
shellScript = "\"${SRCROOT}/Pods/Target Support Files/Pods-APNSUtil_Example/Pods-APNSUtil_Example-frameworks.sh\"\n";
shellScript = "\"${PODS_ROOT}/Target Support Files/Pods-APNSUtil_Example/Pods-APNSUtil_Example-frameworks.sh\"\n";
showEnvVarsInLog = 0;
};
BDAD0D8957304EFC768F6D68 /* [CP] Check Pods Manifest.lock */ = {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>IDEDidComputeMac32BitWarning</key>
<true/>
</dict>
</plist>
12 changes: 1 addition & 11 deletions Example/APNSUtil/APNSPayload.swift
Original file line number Diff line number Diff line change
Expand Up @@ -7,23 +7,13 @@
//

import APNSUtil
import ObjectMapper

extension RemoteNotificationElement {
typealias T = APNSPayload
}

struct APNSPayload: Mappable {
struct APNSPayload: Decodable {
var msg: String?
var id: String?

init?(map: Map) {
mapping(map: map)
}

mutating func mapping(map: Map) {
msg <- map["msg"]
id <- map["id"]
}
}

2 changes: 1 addition & 1 deletion Example/Podfile
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
use_frameworks!

target 'APNSUtil_Example' do
pod 'APNSUtil/AppExtension', :path => '../'
pod 'APNSUtil', :path => '../'

target 'APNSUtil_Tests' do
inherit! :search_paths
Expand Down
17 changes: 5 additions & 12 deletions Example/Podfile.lock
Original file line number Diff line number Diff line change
@@ -1,23 +1,16 @@
PODS:
- APNSUtil/AppExtension (1.1.4):
- ObjectMapper (~> 3.1)
- ObjectMapper (3.3.0)
- APNSUtil (1.2.0)

DEPENDENCIES:
- APNSUtil/AppExtension (from `../`)

SPEC REPOS:
https://github.com/cocoapods/specs.git:
- ObjectMapper
- APNSUtil (from `../`)

EXTERNAL SOURCES:
APNSUtil:
:path: "../"

SPEC CHECKSUMS:
APNSUtil: f17545141df5eced25cbe5cbd6381ba4b79b9247
ObjectMapper: b612bf8c8e99c4dc0bb6013a51f7c27966ed5da9
APNSUtil: 0cb42dffae8b96391243270c1c0566e5f64022a6

PODFILE CHECKSUM: 7563841551ece1485579af146b74c9ca08ddb06d
PODFILE CHECKSUM: 682a114a47371b5a83ba6292e00758c19f6a5987

COCOAPODS: 1.5.3
COCOAPODS: 1.6.0.beta.2
40 changes: 0 additions & 40 deletions Example/Pods/Local Podspecs/APNSUtil.podspec.json

This file was deleted.

23 changes: 0 additions & 23 deletions Example/Pods/Manifest.lock

This file was deleted.

8 changes: 0 additions & 8 deletions Example/Pods/ObjectMapper/LICENSE

This file was deleted.

Loading

0 comments on commit 0bcb603

Please sign in to comment.