Skip to content

Commit

Permalink
Differentiate between SDK and demo app in Xcode console logs
Browse files Browse the repository at this point in the history
  • Loading branch information
mokagio committed Jan 8, 2025
1 parent 06c8b36 commit d83f06a
Showing 1 changed file with 9 additions and 5 deletions.
14 changes: 9 additions & 5 deletions Demo/ParselyDemo/FirstViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -6,27 +6,31 @@ class FirstViewController: UIViewController {
let delegate = UIApplication.shared.delegate as! AppDelegate

@IBAction func didTouchButton(_ sender: Any) {
os_log("didTouchButton", log: OSLog.default, type: .debug)
log("didTouchButton")
let demoMetas = ParselyMetadata(authors: ["Yogi Berr"])
delegate.parsely.trackPageView(url: "http://parsely.com/path/cool-blog-post/1?qsarg=nawp&anotherone=yup", metadata: demoMetas, extraData: ["product-id": "12345"], siteId: "subdomain.parsely-test.com")
}

@IBAction func didStartEngagement(_ sender: Any) {
os_log("didStartEngagement", log: OSLog.default, type: .debug)
log("didStartEngagement")
delegate.parsely.startEngagement(url: "http://parsely.com/very-not-real", urlref:"http://parsely.com/not-real", extraData: ["product-id": "12345"], siteId: "engaged.parsely-test.com")
}

@IBAction func didStopEngagement(_ sender: Any) {
os_log("didStopEngagement", log: OSLog.default, type: .debug)
log("didStopEngagement")
delegate.parsely.stopEngagement()
}
@IBAction func didStartVideo(_ sender: Any) {
os_log("didStartVideo", log: OSLog.default, type: .debug)
log("didStartVideo")
let demoMetas = ParselyMetadata(authors: ["Yogi Berr"], duration: TimeInterval(10))
delegate.parsely.trackPlay(url: "http://parsely.com/path/cool-blog-post/1?qsarg=nawp&anotherone=yup", urlref: "not-a-real-urlref", videoID: "videoOne", duration: TimeInterval(6000), metadata: demoMetas, extraData: ["product-id": "12345", "ts": "should be overwritten"])
}
@IBAction func didPauseVideo(_ sender: Any) {
os_log("didStopVideo", log: OSLog.default, type: .debug)
log("didStopVideo")
delegate.parsely.trackPause()
}

private func log(_ message: String) {
os_log("[Parsely Demo App] %@", log: OSLog.default, type: .debug, message)
}
}

0 comments on commit d83f06a

Please sign in to comment.