Skip to content

Commit

Permalink
content-available corrected
Browse files Browse the repository at this point in the history
  • Loading branch information
kirillkotov committed Jul 17, 2022
1 parent 9795fc2 commit b3a6cf2
Show file tree
Hide file tree
Showing 6 changed files with 15 additions and 15 deletions.
2 changes: 1 addition & 1 deletion PushSDK.podspec
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ Pod::Spec.new do |spec|
#

spec.name = "PushSDK"
spec.version = "1.0.0.43"
spec.version = "1.0.0.44"
spec.summary = "SDK for sending push messages to iOS devices."

# This description is used to generate tags and improve search results.
Expand Down
4 changes: 2 additions & 2 deletions PushSDK/PushSDK.swift
Original file line number Diff line number Diff line change
Expand Up @@ -389,7 +389,7 @@ public class PushSDK {

//function for parsing incoming message from firebase
public static func parseIncomingPush(message: Notification) -> PushKMess {
guard let jsonData = try? JSONSerialization.data(withJSONObject: message.userInfo ?? "", options: []) else { return PushKMess(code: 500, result: "Error in process message", messageFir: FullFirebaseMessageStr(aps: MessApsDataStr(contentAvailable: ""), message: MessagesResponseStr(), googleCSenderId: "", gcmMessageId: ""))}
guard let jsonData = try? JSONSerialization.data(withJSONObject: message.userInfo ?? "", options: []) else { return PushKMess(code: 500, result: "Error in process message", messageFir: FullFirebaseMessageStr(aps: MessApsDataStr(contentAvailable: 0), message: MessagesResponseStr(), googleCSenderId: "", gcmMessageId: ""))}
let jsonString = String(data: jsonData, encoding: .utf8)
let newString = String(jsonString ?? "").replacingOccurrences(of: "\\", with: "", options: .literal, range: nil)
let parsed_message = PushKAnswParser.messageIncomingJson(str_resp: newString)
Expand All @@ -398,7 +398,7 @@ public class PushSDK {

//userInfo parse
public static func parseIncomingPush(message: [AnyHashable : Any]) -> PushKMess {
guard let jsonData = try? JSONSerialization.data(withJSONObject: message , options: []) else { return PushKMess(code: 500, result: "Error in process message", messageFir: FullFirebaseMessageStr(aps: MessApsDataStr(contentAvailable: ""), message: MessagesResponseStr(), googleCSenderId: "", gcmMessageId: ""))}
guard let jsonData = try? JSONSerialization.data(withJSONObject: message , options: []) else { return PushKMess(code: 500, result: "Error in process message", messageFir: FullFirebaseMessageStr(aps: MessApsDataStr(contentAvailable: 0), message: MessagesResponseStr(), googleCSenderId: "", gcmMessageId: ""))}

let jsonString = String(data: jsonData, encoding: .utf8)
let newString = String(jsonString ?? "").replacingOccurrences(of: "\\", with: "", options: .literal, range: nil)
Expand Down
2 changes: 1 addition & 1 deletion PushSDK/models/DataStructures.swift
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ public struct MessagesResponseStr {
}

public struct MessApsDataStr {
public var contentAvailable: String
public var contentAvailable: Int

public func toString() -> String{
return "MessApsDataStr(contentAvailable: \(contentAvailable)"
Expand Down
8 changes: 4 additions & 4 deletions PushSDK/settings/JsonParser.swift
Original file line number Diff line number Diff line change
Expand Up @@ -220,7 +220,7 @@ class PushKAnswParser {
enum CodingKeys: String, CodingKey {
case contentavailable = "content-available"
}
var contentavailable: String? = ""
var contentavailable: Int? = 0
}

struct ImageResponseParse: Decodable {
Expand Down Expand Up @@ -266,7 +266,7 @@ class PushKAnswParser {
PushKConstants.logger.debug("messageIncomingJson before decoding: str_resp_transform: \(str_resp_transform)")


guard let jsonData = str_resp_transform.data(using: .utf8) else { return FullFirebaseMessageStr(aps: MessApsDataStr(contentAvailable: ""), message: MessagesResponseStr(phone: "", messageId: "", title: "", body: "", image: ImageResponse(url: ""), button: ButtonResponse(text: "", url: ""), time: "", partner: ""),googleCSenderId: "", gcmMessageId: "")}
guard let jsonData = str_resp_transform.data(using: .utf8) else { return FullFirebaseMessageStr(aps: MessApsDataStr(contentAvailable: 0), message: MessagesResponseStr(phone: "", messageId: "", title: "", body: "", image: ImageResponse(url: ""), button: ButtonResponse(text: "", url: ""), time: "", partner: ""),googleCSenderId: "", gcmMessageId: "")}

PushKConstants.logger.debug("messageIncomingJson transformed to data")

Expand All @@ -279,7 +279,7 @@ class PushKAnswParser {
let elem2: ButtonResponse = ButtonResponse.init(text: parsedJson.message?.button?.text, url: parsedJson.message?.button?.url)
let elem3: MessagesResponseStr = MessagesResponseStr.init(phone: parsedJson.message?.phone, messageId: parsedJson.message?.messageId, title: parsedJson.message?.title, body: parsedJson.message?.body, image: elem1, button: elem2, time: parsedJson.message?.time, partner: parsedJson.message?.partner)

let res = FullFirebaseMessageStr.init(aps: MessApsDataStr(contentAvailable: parsedJson.aps?.contentavailable ?? ""),
let res = FullFirebaseMessageStr.init(aps: MessApsDataStr(contentAvailable: parsedJson.aps?.contentavailable ?? 0),
message: elem3,
googleCSenderId: parsedJson.googlecsenderid ?? "",
gcmMessageId: parsedJson.gcmmessageid ?? "")
Expand All @@ -290,7 +290,7 @@ class PushKAnswParser {
return res
} catch {
//handle error
let res = FullFirebaseMessageStr.init(aps: MessApsDataStr(contentAvailable: ""),
let res = FullFirebaseMessageStr.init(aps: MessApsDataStr(contentAvailable: 0),
message: MessagesResponseStr(phone: "", messageId: "", title: "", body: "", image: ImageResponse(url: ""), button: ButtonResponse(text: "", url: ""), time: "", partner: ""),
googleCSenderId: "",
gcmMessageId: "")
Expand Down
2 changes: 1 addition & 1 deletion PushSDK/settings/params.swift
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ public struct PushKConstants {

let kOSType = "ios"
static let serverSdkVersion = "2.3"
static let sdkVersion = "1.0.0.42"
static let sdkVersion = "1.0.0.44"
static let dev_os_Version = UIDevice.current.systemVersion
static let kDeviceType = "\(UIDevice.current.model)"
static let kDeviceType2 = "\(UIDevice.current.batteryLevel)"
Expand Down
12 changes: 6 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@

***
### IMPORTANT information <br>
last actual SDK version: 1.0.0.42
last actual SDK version: 1.0.0.44

Integrate PushSDK to your project with COCOAPODS (https://guides.cocoapods.org/using/the-podfile.html) <br>
```pod 'PushSDK', :git => 'https://github.com/GlobalMessageServices/Push-SDK-IOS', :branch => 'master'```
```pod 'PushSDK', :git => 'https://github.com/GlobalMessageServices/BCS-GMS-SDK-IOS', :branch => 'masterapi'```
***

## Using SDK
Expand All @@ -16,11 +16,11 @@ Integrate PushSDK to your project with COCOAPODS (https://guides.cocoapods.org/u

Important ! Before start using SDK, configure firebase project first and upload your google-services.json file into your application directory

* [Setting up your project to work with the SDK](https://github.com/GlobalMessageServices/Push-SDK-IOS/wiki/Creating-App-Id-and-APNS-key)
* [Setting up your project to work with the SDK](https://github.com/GlobalMessageServices/BCS-GMS-SDK-IOS/wiki/Creating-App-Id-and-APNS-key)

* [SDK functions list](https://github.com/GlobalMessageServices/Push-SDK-IOS/wiki/SDK-functions-description)
* [SDK functions list](https://github.com/GlobalMessageServices/BCS-GMS-SDK-IOS/wiki/SDK-functions-description)

* [SDK answers](https://github.com/GlobalMessageServices/Push-SDK-IOS/wiki/SDK-answers)
* [SDK answers](https://github.com/GlobalMessageServices/BCS-GMS-SDK-IOS/wiki/SDK-answers)



Expand Down Expand Up @@ -93,7 +93,7 @@ Configure processing incoming messages in ViewController.swift
```

Then you can communicate with push platform by the following functions
[SDK functions list](https://github.com/GlobalMessageServices/Push-SDK-IOS/wiki/SDK-functions-description)
[SDK functions list](https://github.com/GlobalMessageServices/BCS-GMS-SDK-IOS/wiki/SDK-functions-description)

An example of using SDK functions:
```swift
Expand Down

0 comments on commit b3a6cf2

Please sign in to comment.