Skip to content

Commit

Permalink
Merge branch 'develop'
Browse files Browse the repository at this point in the history
  • Loading branch information
devpurevee committed Dec 19, 2018
2 parents ae4b614 + 027d5a0 commit c72c2b8
Show file tree
Hide file tree
Showing 4 changed files with 37 additions and 3 deletions.
2 changes: 1 addition & 1 deletion ErxesSDK.podspec
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@

Pod::Spec.new do |s|
s.name = 'ErxesSDK'
s.version = '0.1.6'
s.version = '0.1.7'
s.summary = 'A short description of erxes-ios-sdk.'
s.swift_version = '4.0'
s.description = 'erxes for IOS SDK, for integrating erxes into your iOS application https://erxes.io/'
Expand Down
34 changes: 33 additions & 1 deletion ErxesSDK/Classes/Global/Erxes.swift
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,11 @@ var isOnline = true
}

if data.keys.count > 0 {
erxesUserData = data
var processed = [String:Any]()
for (key, value) in data {
processed[key] = forceBridgeFromObjectiveC(value)
}
erxesUserData = processed
}

if var topController = UIApplication.shared.keyWindow?.rootViewController {
Expand All @@ -119,6 +123,34 @@ var isOnline = true
}
}

static func forceBridgeFromObjectiveC(_ value: Any) -> Any {

if value == nil {
return value
}

switch value {

case is NSString:
return value as! String

case is Bool:
return value as! Bool
case is Int:
return value as! Int
case is Int64:
return value as! Int64
case is Double:
return value as! Double
case is NSDictionary:
return Dictionary(uniqueKeysWithValues: (value as! NSDictionary).map { ($0.key as! AnyHashable, forceBridgeFromObjectiveC($0.value)) })
case is NSArray:
return (value as? NSArray).map { forceBridgeFromObjectiveC($0) }
default:
return value
}
}

@objc public static func setDeviceToken(token:String){
}

Expand Down
2 changes: 2 additions & 0 deletions ErxesSDK/Classes/Views/RegisterVC.swift
Original file line number Diff line number Diff line change
Expand Up @@ -145,10 +145,12 @@ public class RegisterVC: UIViewController {

if erxesEmail.count > 0 {
mutation.email = erxesEmail
mutation.isUser = true
}

if erxesPhone.count > 0 {
mutation.phone = erxesPhone
mutation.isUser = true
}

if erxesUserData.keys.count > 0 {
Expand Down
2 changes: 1 addition & 1 deletion Example/ErxesSDK/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
<key>CFBundlePackageType</key>
<string>APPL</string>
<key>CFBundleShortVersionString</key>
<string>0.1.6</string>
<string>0.1.7</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleVersion</key>
Expand Down

0 comments on commit c72c2b8

Please sign in to comment.