Skip to content

Commit 1ca45fe

Browse files
additional logging added
1 parent c320738 commit 1ca45fe

File tree

3 files changed

+11
-12
lines changed

3 files changed

+11
-12
lines changed

BreinifyApi.podspec

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
Pod::Spec.new do |s|
22
s.name = 'BreinifyApi'
3-
s.version = '2.0.17'
3+
s.version = '2.0.18'
44
s.summary = 'Breinify´s DigitalDNA API puts dynamic behavior-based, people-driven data right at your fingertips'
55
s.description = 'Breinify´s DigitalDNA API puts dynamic behavior-based, people-driven data right at your fingertips. We believe that in many situations, a critical component of a great user experience is personalization. With all the data available on the web it should be easy to provide a unique experience to every visitor, and yet, sometimes you may find yourself wondering why it is so difficult.'
66
s.homepage = 'https://github.com/Breinify/brein-api-library-ios'

BreinifyApi/api/Breinify.swift

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ open class Breinify: NSObject {
1111
typealias apiFailure = (_ error: NSDictionary) -> Void
1212

1313
/// contains the current version of the library
14-
static let version: String! = "2.0.16"
14+
static let version: String! = "2.0.18"
1515

1616
/// contains the configuration
1717
static var config: BreinConfig?
@@ -151,7 +151,6 @@ open class Breinify: NSObject {
151151
let lastName: String = userInfo?[BreinUser.UserInfo.lastName] ?? ""
152152
let phone: String = userInfo?[BreinUser.UserInfo.phoneNumber] ?? ""
153153
let email: String = userInfo?[BreinUser.UserInfo.email] ?? ""
154-
// let userId: String = userInfo?[BreinUser.UserInfo.userId] ?? ""
155154

156155
Breinify.setUserInfo(firstName: firstName,
157156
lastName: lastName,
@@ -269,7 +268,6 @@ open class Breinify: NSObject {
269268

270269
activity.setTagsDic(tagsDic)
271270

272-
// invoke activity call
273271
do {
274272
try Breinify.activity(activity,
275273
successBlock,

BreinifyApi/api/BreinifyManager.swift

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -294,6 +294,7 @@ open class BreinifyManager: NSObject, UNUserNotificationCenterDelegate {
294294
let campaignNotificationDic = getCampaignContent(response.notification.request.content.userInfo)
295295
sendActivity(BreinActivityType.OPEN_PUSH_NOTIFICATION.rawValue, additionalActivityTagContent: campaignNotificationDic)
296296

297+
BreinLogger.shared.log("Breinify invoking handleIncomingNotificationContent from didReceive method")
297298
handleIncomingNotificationContent(response.notification.request.content.userInfo)
298299

299300
completionHandler()
@@ -318,14 +319,14 @@ open class BreinifyManager: NSObject, UNUserNotificationCenterDelegate {
318319
let campaignNotificationDic = getCampaignContent(userInfo)
319320
sendActivity(BreinActivityType.RECEIVED_PUSH_NOTIFICATION.rawValue, additionalActivityTagContent: campaignNotificationDic)
320321
}
321-
322322
}
323323

324324
private func handleIncomingNotificationContent(_ notification: [AnyHashable: Any]) {
325325
BreinLogger.shared.log("Breinify handleIncomingNotificationContent invoked with notification: \(notification)")
326326

327327
let actionNotificationDic = getActionContent(notification)
328328
guard let unwrappedDic = actionNotificationDic else {
329+
BreinLogger.shared.log("Breinify handleIncomingNotificationContent - no action content detected on: \(notification)")
329330
return
330331
}
331332

@@ -335,26 +336,30 @@ open class BreinifyManager: NSObject, UNUserNotificationCenterDelegate {
335336
BreinLogger.shared.log("Breinify action: \(action) with parameter: \(parameter)")
336337

337338
if action == "openUrl" {
339+
BreinLogger.shared.log("Breinify openUrl action detected")
338340
let sharedSelector = NSSelectorFromString("sharedApplication")
339341
let openSelector = NSSelectorFromString("openURL:")
340342

341343
let urlStr = getUrl(parameter)
342344
if urlStr.isEmpty == false {
343-
345+
BreinLogger.shared.log("Breinify trying to open url: \(urlStr)")
344346
DispatchQueue.main.async {
345347
if let urlToOpen = URL(string: urlStr), UIApplication.responds(to: sharedSelector),
346348
let shared = UIApplication.perform(sharedSelector)?.takeRetainedValue() as? UIApplication, shared.responds(to: openSelector) {
349+
BreinLogger.shared.log("Breinify performing action - urlToOpen is: \(urlToOpen)")
347350
shared.perform(openSelector, with: urlToOpen)
348351
}
349352
}
350353
}
351354
} else if action == "sendActivity" {
355+
BreinLogger.shared.log("Breinify sendActivity action detected")
352356
// send activity
353357
let activityName = getActivityName(parameter)
354358
if activityName.isEmpty == false {
355359
let tags = getTags(parameter)
356360
if tags?.isEmpty == false {
357361
// send the activity
362+
BreinLogger.shared.log("Breinify sending action detected with name: \(activityName) and tags: \(tags)")
358363
BreinifyManager.shared.sendActivity(activityName, additionalActivityTagContent: tags)
359364
}
360365
}
@@ -656,7 +661,6 @@ open class BreinifyManager: NSObject, UNUserNotificationCenterDelegate {
656661
let campaignNotificationDic = getCampaignContent(notification)
657662
sendActivity(BreinActivityType.RECEIVED_PUSH_NOTIFICATION.rawValue, additionalActivityTagContent: campaignNotificationDic)
658663
}
659-
660664
}
661665

662666
/// Provides the campaign related content as a dictionary
@@ -688,7 +692,7 @@ open class BreinifyManager: NSObject, UNUserNotificationCenterDelegate {
688692
notiDic?.forEach {
689693
let key = ($0).lowercased()
690694
if key.contains("breinify") {
691-
BreinLogger.shared.log("Breinify Tag detected in notification")
695+
BreinLogger.shared.log("Breinify Tag detected in notification for content: \(content)")
692696
if let innerValue = ($1) as? String {
693697

694698
let innerDic = BreinUtil.convertToDictionary(text: innerValue)
@@ -698,11 +702,10 @@ open class BreinifyManager: NSObject, UNUserNotificationCenterDelegate {
698702
if key.contains(content) {
699703
if let contentDic = val as? Dictionary<String, Any> {
700704
retVal = contentDic
701-
BreinLogger.shared.log("Breinify content is \(contentDic)")
705+
BreinLogger.shared.log("Breinify content (\(content)) is \(contentDic)")
702706
}
703707
}
704708
}
705-
706709
}
707710
}
708711
}
@@ -712,8 +715,6 @@ open class BreinifyManager: NSObject, UNUserNotificationCenterDelegate {
712715

713716
}
714717

715-
716-
717718
public func didFailToRegisterForRemoteNotificationsWithError(_ error: Error) {
718719
BreinLogger.shared.log("Breinify didFailToRegisterForRemoteNotificationsWithError called")
719720
}

0 commit comments

Comments
 (0)