Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
PR #478 * Adds WatchKit support via CocoaPods (#465) * Fixes missing file for watchOS * Change watchOS product name * Adds modual map for watchos * Adds carthage watch example * Adds cocoapods watch example * Update CocoaPods demo to include older watchOS version I noticed that apps using this library could not launch on older watchOS version. This adds a demo project to reproduce this, * Fix crash on < watchOS 6 This fixes the crash mentioned in the prev. commit. It removes the frameworks for watchOS from the Podspec. * Changed button name * Update podspec for watchOS target Updated podspec excluding the new Reachability feature added when we got rid of the third part dependency Reachability.swift * Update travis scripts * Pod update Co-authored-by: leoAsana <56038088+leoAsana@users.noreply.github.com>
- Loading branch information
Showing
120 changed files
with
4,357 additions
and
855 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,14 @@ | ||
platform :ios, '9.0' | ||
use_frameworks! | ||
|
||
workspace 'SnowplowSwiftDemo.xcworkspace' | ||
|
||
target 'SnowplowSwiftDemo' do | ||
platform :ios, '9.0' | ||
pod 'SnowplowTracker', :path=> '../../' | ||
end | ||
|
||
target 'SnowplowSwiftWatch Extension' do | ||
platform :watchos, '4.0' | ||
pod 'SnowplowTracker', :path=> '../../' | ||
end | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,14 @@ | ||
platform :ios, '9.0' | ||
use_modular_headers! | ||
|
||
workspace 'SnowplowSwiftDemo.xcworkspace' | ||
|
||
target 'SnowplowSwiftDemo' do | ||
platform :ios, '9.0' | ||
pod 'SnowplowTracker', :path=> '../../' | ||
end | ||
|
||
target 'SnowplowSwiftWatch Extension' do | ||
platform :watchos, '4.0' | ||
pod 'SnowplowTracker', :path=> '../../' | ||
end | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,14 @@ | ||
platform :ios, '9.0' | ||
|
||
|
||
workspace 'SnowplowSwiftDemo.xcworkspace' | ||
|
||
target 'SnowplowSwiftDemo' do | ||
platform :ios, '9.0' | ||
pod 'SnowplowTracker', :path=> '../../' | ||
end | ||
|
||
target 'SnowplowSwiftWatch Extension' do | ||
platform :watchos, '4.0' | ||
pod 'SnowplowTracker', :path=> '../../' | ||
end | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,16 @@ | ||
#!/usr/bin/env bash | ||
|
||
DEST=$1 | ||
PROJECT=$2 | ||
SCHEME=$3 | ||
PROJECT=$1 | ||
DEST_IOS=$2 | ||
SCHEME_IOS=$3 | ||
DEST_WATCH=$4 | ||
SCHEME_WATCH=$5 | ||
|
||
printf "\n\n Carthage bootstrap \n" | ||
carthage bootstrap --platform iOS | ||
carthage bootstrap | ||
|
||
printf "\n\n Test framework \n" | ||
set -o pipefail && xcodebuild -sdk iphonesimulator -destination "${DEST}" ${PROJECT} ${SCHEME} clean test | xcpretty | ||
printf "\n\n Test framework on iOS \n" | ||
set -o pipefail && xcodebuild -destination "${DEST_IOS}" ${PROJECT} ${SCHEME_IOS} clean test | xcpretty | ||
|
||
printf "\n\n Build framework on watchOS \n" | ||
set -o pipefail && xcodebuild -destination "${DEST_WATCH}" ${PROJECT} ${SCHEME_WATCH} clean build | xcpretty |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
// | ||
// ExtensionDelegate.swift | ||
// SnowplowSwiftDemoWatch WatchKit Extension | ||
// | ||
// Created by Leo Mehlig on 12.11.19. | ||
// Copyright © 2019 snowplowanalytics. All rights reserved. | ||
// | ||
|
||
import WatchKit | ||
|
||
class ExtensionDelegate: NSObject, WKExtensionDelegate { | ||
|
||
func applicationDidFinishLaunching() { | ||
// Perform any final initialization of your application. | ||
} | ||
|
||
func applicationDidBecomeActive() { | ||
// Restart any tasks that were paused (or not yet started) while the application was inactive. If the application was previously in the background, optionally refresh the user interface. | ||
} | ||
|
||
func applicationWillResignActive() { | ||
// Sent when the application is about to move from active to inactive state. This can occur for certain types of temporary interruptions (such as an incoming phone call or SMS message) or when the user quits the application and it begins the transition to the background state. | ||
// Use this method to pause ongoing tasks, disable timers, etc. | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,80 @@ | ||
// | ||
// InterfaceController.swift | ||
// SnowplowSwiftDemoWatch WatchKit Extension | ||
// | ||
// Created by Leo Mehlig on 12.11.19. | ||
// Copyright © 2019 snowplowanalytics. All rights reserved. | ||
// | ||
|
||
import WatchKit | ||
import Foundation | ||
import SnowplowTracker | ||
|
||
class InterfaceController: WKInterfaceController, SPRequestCallback { | ||
|
||
let kAppId = "DemoAppId" | ||
let kNamespace = "DemoAppNamespace" | ||
|
||
func getTracker(_ url: String, method: SPRequestOptions, protocol _protocol: SPProtocol) -> SPTracker { | ||
let emitter = SPEmitter.build({ (builder : SPEmitterBuilder?) -> Void in | ||
builder!.setUrlEndpoint(url) | ||
builder!.setHttpMethod(method) | ||
builder!.setProtocol(_protocol) | ||
builder!.setCallback(self) | ||
builder!.setEmitRange(500) | ||
builder!.setEmitThreadPoolSize(20) | ||
builder!.setByteLimitPost(52000) | ||
}) | ||
let subject = SPSubject(platformContext: true, andGeoContext: false) | ||
let newTracker = SPTracker.build({ (builder : SPTrackerBuilder?) -> Void in | ||
builder!.setEmitter(emitter) | ||
builder!.setAppId(self.kAppId) | ||
builder!.setTrackerNamespace(self.kNamespace) | ||
builder!.setBase64Encoded(false) | ||
builder!.setSessionContext(true) | ||
builder!.setSubject(subject) | ||
builder!.setLifecycleEvents(true) | ||
builder!.setAutotrackScreenViews(true) | ||
builder!.setScreenContext(true) | ||
builder!.setApplicationContext(true) | ||
builder!.setExceptionEvents(true) | ||
builder!.setInstallEvent(true) | ||
}) | ||
return newTracker! | ||
} | ||
|
||
var tracker : SPTracker! | ||
|
||
|
||
override func awake(withContext context: Any?) { | ||
super.awake(withContext: context) | ||
self.tracker = self.getTracker("acme.fake.com", method: .get, protocol: .http) | ||
// Configure interface objects here. | ||
} | ||
|
||
override func willActivate() { | ||
// This method is called when watch view controller is about to be visible to user | ||
super.willActivate() | ||
} | ||
|
||
override func didDeactivate() { | ||
// This method is called when watch view controller is no longer visible | ||
super.didDeactivate() | ||
} | ||
|
||
@IBAction func sendEvent() { | ||
DispatchQueue.global(qos: .default).async { | ||
// Track all types of events | ||
DemoUtils.trackAll(self.tracker) | ||
} | ||
} | ||
|
||
func onSuccess(withCount successCount: Int) { | ||
print("Success: \(successCount)") | ||
} | ||
|
||
func onFailure(withCount failureCount: Int, successCount: Int) { | ||
print("Failure: \(failureCount), Success: \(successCount)") | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
16 changes: 12 additions & 4 deletions
16
Examples/SnowplowDemo/Pods/Local Podspecs/SnowplowTracker.podspec.json
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Oops, something went wrong.