Skip to content

Commit

Permalink
Merge pull request #10 from Woosmap/dev/userproperties
Browse files Browse the repository at this point in the history
User properties
  • Loading branch information
sameerdhulap authored Nov 27, 2024
2 parents e816e69 + 86d864f commit af42d05
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 15 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
## 1.0.0
- Woosmap Geofence and Batch Integration
22 changes: 9 additions & 13 deletions ios/GeofencingEventsReceiver.swift
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ class GeofencingEventsReceiver: NSObject {
collectedEvent["radius"] = POIregion.radius


if let POI = POIs.getPOIbyIdStore(idstore: POIregion.identifier) as POI? {
if let POI = POIs.getPOIbyIdStore(idstore: POIregion.identifier) as POI? {
collectedEvent["name"] = POI.name ?? "-"

let idstore = POI.idstore ?? "-"
Expand Down Expand Up @@ -75,12 +75,9 @@ class GeofencingEventsReceiver: NSObject {

POI.user_properties.forEach {
if collectedEvent.keys.count <= 25 {
let keyValue = $0.value as? String ?? "-"
if(keyValue.trimmingCharacters(in: .whitespacesAndNewlines) != ""){
var attributeKey: String = $0.key.camelCaseToKey().lowercased()
attributeKey = String(attributeKey.prefix(30))
collectedEvent[attributeKey] = keyValue
}
var attributeKey: String = $0.key.camelCaseToKey().lowercased()
attributeKey = String(attributeKey.prefix(30))
collectedEvent[attributeKey] = $0.value
}
}
}
Expand All @@ -93,20 +90,19 @@ class GeofencingEventsReceiver: NSObject {
else if let val = eventValue as? Int {
eventAttributes.put(val, forKey: eventKey)
}
else if let val = eventValue as? Float {
eventAttributes.put(val, forKey: eventKey)
}
else if let val = eventValue as? Date {
eventAttributes.put(val, forKey: eventKey)
}
else if let val = eventValue as? Bool {
eventAttributes.put(val, forKey: eventKey)
}
else if let val = eventValue as? String {
eventAttributes.put(String(val.prefix(200)), forKey: eventKey)
if(val.trimmingCharacters(in: .whitespacesAndNewlines) != ""){
eventAttributes.put(String(val.prefix(200)), forKey: eventKey)
}
}
}

BatchProfile.trackEvent(name: batchEventName,attributes:eventAttributes)
}

Expand All @@ -124,7 +120,7 @@ private extension String {
return unicodeScalars.dropFirst().reduce(String(prefix(1))) {
return CharacterSet.uppercaseLetters.contains($1)
? $0 + "_" + String($1).lowercased()
: $0 + String($1)
: $0 + String($1)
}
}
}
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@woosmap/expo-plugin-geofencing-batch",
"version":"0.2.3",
"version":"1.0.0",
"description": "Woosmap geofencing and batch integration",
"main": "build/index.js",
"types": "build/index.d.ts",
Expand Down
2 changes: 1 addition & 1 deletion whatsnew.md
Original file line number Diff line number Diff line change
@@ -1 +1 @@
* Enhancement: bug fixes
* Enhancement: bug fixes user properties

0 comments on commit af42d05

Please sign in to comment.