Skip to content

Commit

Permalink
Merge pull request #481 from snowplow/release/1.2.0
Browse files Browse the repository at this point in the history
Release/1.2.0
  • Loading branch information
AlexBenny authored Jan 20, 2020
2 parents d4b852b + f176a1f commit 16d7352
Show file tree
Hide file tree
Showing 206 changed files with 4,834 additions and 2,895 deletions.
60 changes: 20 additions & 40 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,50 +1,30 @@
language: objective-c
osx_image: xcode11.2
osx_image: xcode11.3

env:
global:
- secure: H45yyUlB0cXQrzTTcnmD3WrkCyqjUzaop2jHgmBF3bm8ue4XOcTWKDSDcAN39SG0FUeDC7GdDCtWAc3VCpLwN++5IznAnvBuZSGgxQ2lCxWMhdTtXtOWU2mivgVvs+uldS7/TuVlOjZ7inrTgetl+jgFjenwESOGIIZwn7SXpPo=
- BUILD_DEST="platform=iOS Simulator,OS=13.2.2,name=iPhone 8"
- BUILD_PROJECT_LIB="-project Snowplow.xcodeproj"
- BUILD_SCHEME_LIB="-scheme Snowplow-iOS"
- BUILD_WORKSPACE_OBJC_DEMO="-workspace SnowplowDemo.xcworkspace"
- BUILD_SCHEME_OBJC_DEMO="-scheme SnowplowDemo"
- BUILD_WORKSPACE_SWIFT_DEMO="-workspace SnowplowSwiftDemo.xcworkspace"
- BUILD_PROJECT_SWIFT_DEMO="-project SnowplowSwiftDemo.xcodeproj"
- BUILD_SCHEME_SWIFT_DEMO="-scheme SnowplowSwiftDemo"

before_install:
- gem install slather
- gem install xcpretty -N --no-document
- gem install cocoapods -v '1.8.4'

# The first dot is not a typo. It's needed to export the env variables to the current travis script
before_install: . .travis/setup.sh

jobs:
include:
- name: "Test Snowplow framework [iOS]"
install:
- carthage bootstrap --platform iOS
script:
- set -o pipefail && xcodebuild -sdk iphonesimulator -destination "${BUILD_DEST}" ${BUILD_PROJECT_LIB} ${BUILD_SCHEME_LIB} clean test | xcpretty
- name: "Test Snowplow framework"
script: .travis/test_framework.sh "${BUILD_PROJECT_LIB}" "${BUILD_DEST_IOS}" "${BUILD_SCHEME_LIB_IOS}" "${BUILD_DEST_WATCH}" "${BUILD_SCHEME_LIB_WATCH}"
after_success: slather

- name: "Test Snowplow ObjC demo app [iOS]"
install:
- cd Examples/SnowplowDemo
- pod update
script:
- set -o pipefail && xcodebuild -sdk iphonesimulator -destination "${BUILD_DEST}" ${BUILD_WORKSPACE_OBJC_DEMO} ${BUILD_SCHEME_OBJC_DEMO} clean build | xcpretty

- name: "Test Snowplow Swift demo app [iOS] using Cocoapods"
install:
- cd Examples/SnowplowSwiftCocoapodsDemo
- pod update
script:
- set -o pipefail && xcodebuild -sdk iphonesimulator -destination "${BUILD_DEST}" ${BUILD_WORKSPACE_SWIFT_DEMO} ${BUILD_SCHEME_SWIFT_DEMO} clean build | xcpretty

- name: "Test Snowplow Swift demo app [iOS] using Carthage"
install:
- cd Examples/SnowplowSwiftCarthageDemo
- ./generateCartfile.sh
- carthage update --platform ios
script:
- set -o pipefail && xcodebuild -sdk iphonesimulator -destination "${BUILD_DEST}" ${BUILD_PROJECT_SWIFT_DEMO} ${BUILD_SCHEME_SWIFT_DEMO} clean build | xcpretty
- name: "Test Snowplow ObjC demo app"
script: .travis/test_ios_demo.sh SnowplowDemo Podfile "${BUILD_WORKSPACE_OBJC_DEMO}" "${BUILD_DEST_IOS}" "${BUILD_SCHEME_OBJC_DEMO}"

- name: "Test Snowplow Swift demo app using Carthage"
script: .travis/test_ios_demo.sh SnowplowSwiftCarthageDemo Cartfile "${BUILD_PROJECT_SWIFT_DEMO}" "${BUILD_DEST_IOS}" "${BUILD_SCHEME_SWIFT_DEMO_IOS}"

- name: "Test Snowplow Swift demo app using Cocoapods (no directive)"
script: .travis/test_ios_demo.sh SnowplowSwiftCocoapodsDemo Podfile_simple "${BUILD_WORKSPACE_SWIFT_DEMO}" "${BUILD_DEST_IOS}" "${BUILD_SCHEME_SWIFT_DEMO_IOS}" "${BUILD_DEST_PAIRED}" "${BUILD_SCHEME_SWIFT_DEMO_WATCH}"

- name: "Test Snowplow Swift demo app using Cocoapods (use_frameworks! directive)"
script: .travis/test_ios_demo.sh SnowplowSwiftCocoapodsDemo Podfile_frameworks "${BUILD_WORKSPACE_SWIFT_DEMO}" "${BUILD_DEST_IOS}" "${BUILD_SCHEME_SWIFT_DEMO_IOS}" "${BUILD_DEST_PAIRED}" "${BUILD_SCHEME_SWIFT_DEMO_WATCH}"

- name: "Test Snowplow Swift demo app using Cocoapods (use_modular_headers! directive)"
script: .travis/test_ios_demo.sh SnowplowSwiftCocoapodsDemo Podfile_modular_headers "${BUILD_WORKSPACE_SWIFT_DEMO}" "${BUILD_DEST_IOS}" "${BUILD_SCHEME_SWIFT_DEMO_IOS}" "${BUILD_DEST_PAIRED}" "${BUILD_SCHEME_SWIFT_DEMO_WATCH}"
14 changes: 14 additions & 0 deletions .travis/Podfile_frameworks
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
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

14 changes: 14 additions & 0 deletions .travis/Podfile_modular_headers
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
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

14 changes: 14 additions & 0 deletions .travis/Podfile_simple
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@

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


31 changes: 31 additions & 0 deletions .travis/setup.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
#!/usr/bin/env bash

if [ "$CI" = true ]; then
printf "\n\n Install Slather - Code coverage tool \n"
gem install slather

printf "\n\n Install Xcpretty - Prettify xcodebuild logs \n"
gem install xcpretty -N --no-document

printf "\n\n Install Cocoapods - Dependencies manager \n"
gem install cocoapods -v '1.8.4'
fi

printf "\n\n Setup env variables \n"

BUILD_DEST_IOS="platform=iOS Simulator,OS=13.3,name=iPhone 11 Pro"
BUILD_DEST_PAIRED="platform=iOS Simulator,OS=13.3,name=iPhone 11 Pro"
BUILD_DEST_WATCH="platform=watchOS Simulator,OS=6.1.1,name=Apple Watch Series 5 - 44mm"

BUILD_PROJECT_LIB="-project Snowplow.xcodeproj"
BUILD_SCHEME_LIB_IOS="-scheme Snowplow-iOS"
BUILD_SCHEME_LIB_WATCH="-scheme Snowplow-watchOS"

BUILD_WORKSPACE_OBJC_DEMO="-workspace SnowplowDemo.xcworkspace"
BUILD_SCHEME_OBJC_DEMO="-scheme SnowplowDemo"

BUILD_WORKSPACE_SWIFT_DEMO="-workspace SnowplowSwiftDemo.xcworkspace"
BUILD_PROJECT_SWIFT_DEMO="-project SnowplowSwiftDemo.xcodeproj"
BUILD_SCHEME_SWIFT_DEMO_IOS="-scheme SnowplowSwiftDemo"
BUILD_SCHEME_SWIFT_DEMO_WATCH="-scheme SnowplowSwiftWatch"

16 changes: 16 additions & 0 deletions .travis/test_framework.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
#!/usr/bin/env bash

PROJECT=$1
DEST_IOS=$2
SCHEME_IOS=$3
DEST_WATCH=$4
SCHEME_WATCH=$5

printf "\n\n Carthage bootstrap \n"
carthage bootstrap

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
36 changes: 36 additions & 0 deletions .travis/test_ios_demo.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
#!/usr/bin/env bash

APP=$1
DEP_FILE=$2
PROJECT=$3
DEST_IOS=$4
SCHEME_IOS=$5
DEST_WATCH=$6
SCHEME_WATCH=$7

if [ $DEP_FILE == "Cartfile" ]; then
printf "\n\n Carthage update \n"
cd Examples/$APP
./generateCartfile.sh
carthage update
elif [ $DEP_FILE == "Podfile" ]; then
printf "\n\n Pod update \n"
cd Examples/$APP
pod update
elif [[ $DEP_FILE == Podfile* ]]; then
printf "\n\n Pod update with Podfile: " + $DEP_FILE + " \n"
cp -rf .travis/$DEP_FILE Examples/$APP/Podfile
cd Examples/$APP
pod update
else
printf "ERROR: Podfile or Cartfile is not correctly indicated" 1>&2
exit 1
fi

printf "\n\n Build iOS ${APP} \n"
set -o pipefail && xcodebuild -destination "${DEST_IOS}" ${PROJECT} ${SCHEME_IOS} clean build | xcpretty

if [ ! -z "$SCHEME_WATCH" ]; then
printf "\n\n Build watchOS ${APP} \n"
set -o pipefail && xcodebuild -destination "${DEST_WATCH}" ${PROJECT} ${SCHEME_WATCH} clean build | xcpretty
fi
9 changes: 9 additions & 0 deletions CHANGELOG
Original file line number Diff line number Diff line change
@@ -1,3 +1,12 @@
Version 1.2.0 (2020-01-20)
--------------------------
Ensure addDictionaryToPayload enumeration over immutable dictionary (#480) (Contribute of Matt Robinson)
Stop updating screen context when auto-tracking is disabled (#431)
Fix valueForKey error in auto-tracking for screenviews (#428)
Add Watchkit support (#465) (Contribute of Leo Mehlig)
Allow overwriting of the 'platform' parameter (#476)
ReachabilitySwift conflicts with Reachability (#437)

Version 1.1.5 (2019-11-25)
--------------------------
Fix travis script not able to test on iOS 13.2 (#472)
Expand Down
3 changes: 0 additions & 3 deletions Cartfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,2 @@
# Reachability.swift
github "ashleymills/Reachability.swift" ~> 4.3.1

# FMDB
github "ccgus/fmdb" ~> 2.6
1 change: 0 additions & 1 deletion Cartfile.resolved
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
github "ashleymills/Reachability.swift" "v4.3.1"
github "ccgus/fmdb" "2.7.5"
github "luisobo/Nocilla" "0.11.0"
github "snowplow/iglu-objc-client" "10b9758ef35c21d4bfee9c11d8f4813347a50097"
Expand Down
25 changes: 25 additions & 0 deletions Examples/CommonSwiftCode/ExtensionDelegate.swift
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.
}
}
80 changes: 80 additions & 0 deletions Examples/CommonSwiftCode/InterfaceController.swift
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)")
}

}
1 change: 0 additions & 1 deletion Examples/CommonSwiftCode/MetricsViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,6 @@ class MetricsViewController: UIViewController, UITextFieldDelegate, PageObserver
sessionCountLabel.text = String(format: "Session Count: %lu", CUnsignedLong(self.tracker?.getSessionIndex() ?? 0))
isRunningLabel.text = String(format: "Running: %@", self.tracker?.emitter.getSendingStatus() ?? false ? "yes" : "no")
isBackgroundLabel.text = String(format: "Background: %@", self.tracker?.getInBackground() ?? false ? "yes" : "no")
isOnlineLabel.text = String(format: "Online: %@", SPUtilities.isOnline() ? "yes" : "no")
sentLabel.text = String(format: "Sent: %lu", CUnsignedLong(parentPageViewController.sentCounter))
}

Expand Down
8 changes: 2 additions & 6 deletions Examples/SnowplowDemo/Podfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -2,27 +2,23 @@ PODS:
- FMDB (2.6.2):
- FMDB/standard (= 2.6.2)
- FMDB/standard (2.6.2)
- ReachabilitySwift (4.3.1)
- SnowplowTracker (1.1.4-rc2):
- SnowplowTracker (1.2.0-M3):
- FMDB (~> 2.6.2)
- ReachabilitySwift (~> 4.3.1)

DEPENDENCIES:
- SnowplowTracker (from `../../`)

SPEC REPOS:
trunk:
- FMDB
- ReachabilitySwift

EXTERNAL SOURCES:
SnowplowTracker:
:path: "../../"

SPEC CHECKSUMS:
FMDB: 854a0341b4726e53276f2a8996f06f1b80f9259a
ReachabilitySwift: 4032e2f59586e11e3b0ebe15b167abdd587a388b
SnowplowTracker: adfea8c239085461dd70b1779a9acf2796178177
SnowplowTracker: 2ea78776f9f624eccf5e026db87bd915785f894e

PODFILE CHECKSUM: 375b0f24567595e0cac8c9289ed3aea84854fdd6

Expand Down
Loading

0 comments on commit 16d7352

Please sign in to comment.