no message

merge-update-with-lab-changes
Zohaib Kambrani 5 years ago
parent 9ea779e48a
commit c534061c4f

@ -19,6 +19,18 @@ func dictionaryArray(from:String) -> [[String:Any]]{
}
func dictionary(from:String) -> [String:Any]?{
if let data = from.data(using: .utf8) {
do {
return try? JSONSerialization.jsonObject(with: data, options: []) as? [String: Any]
} catch {
print(error.localizedDescription)
}
}
return nil
}
func showNotification(identifier:String? = nil, title:String?, subtitle:String?, message:String?, sound:UNNotificationSound = UNNotificationSound.default){
let notificationContent = UNMutableNotificationContent()

@ -149,13 +149,20 @@ extension HMG_Geofence{
}
func notifyServer(forRegion:CLRegion, transition:Transition, location:CLLocation?){
showNotification(title: "Notifying server..." , subtitle: forRegion.identifier, message: "")
if let idString = forRegion.identifier.split(separator: "_").first, let idInt = Int(idString){
let body:[String:Any] = ["PointsID":idInt,"GeoType":transition.rawValue,"PatientID":"1231755"]
let url = "https://hmgwebservices.com/Services/Patients.svc/REST/GeoF_InsertPatientFileInfo"
httpPostRequest(urlString: url, jsonBody: body){ (status,json) in
showNotification(title: transition.name(), subtitle: forRegion.identifier, message: status ? "Success: notified to server ✔️" : "Failed to notified server ✖️")
if let userProfileJson = UserDefaults.standard.string(forKey: "user-profile"),
let userProfile = dictionary(from: userProfileJson), let patientId = userProfile["PatientID"] as? String{
if let idString = forRegion.identifier.split(separator: "_").first, let idInt = Int(idString){
let body:[String:Any] = [
"PointsID":idInt,
"GeoType":transition.rawValue,
"PatientID":patientId
]
let url = "https://hmgwebservices.com/Services/Patients.svc/REST/GeoF_InsertPatientFileInfo"
httpPostRequest(urlString: url, jsonBody: body){ (status,json) in
showNotification(title: transition.name(), subtitle: forRegion.identifier, message: status ? "Success: notified to server ✔️" : "Failed to notified server ✖️")
}
}
}
}

Loading…
Cancel
Save