Skip to content

Commit

Permalink
Merge branch 'develop' into feature/180-custom-visitor-id
Browse files Browse the repository at this point in the history
  • Loading branch information
niksawtschuk authored Sep 10, 2017
2 parents a9e9bf3 + 40e46d5 commit ff45fb5
Show file tree
Hide file tree
Showing 11 changed files with 73 additions and 16 deletions.
5 changes: 4 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
# Exclude the build directory
build/*
DerivedData

# Exclude temp nibs and swap files
*~.nib
Expand All @@ -19,6 +20,8 @@ xcuserdata

# Exclude generate documentation
Doc/

# Exclude build products from dependency managers
Pods
DerivedData
/Podfile.lock
Carthage/
5 changes: 4 additions & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,11 @@ language: objective-c
before_install:
- gem install cocoapods --no-rdoc --no-ri --no-document --quiet
- gem install xcpretty --no-rdoc --no-ri --no-document --quiet
- brew install carthage
- cd $TRAVIS_BUILD_DIR
- pod install || pod install --repo-update
script: rake test
script:
- rake test
- rake build_with_package_manager
osx_image: xcode8.3
cache: cocoapods
8 changes: 7 additions & 1 deletion Example/ios/ios.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -330,9 +330,12 @@
files = (
);
inputPaths = (
"${SRCROOT}/../../Pods/Target Support Files/Pods-example-ios/Pods-example-ios-frameworks.sh",
"${BUILT_PRODUCTS_DIR}/PiwikTracker-iOS/PiwikTracker.framework",
);
name = "[CP] Embed Pods Frameworks";
outputPaths = (
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/PiwikTracker.framework",
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;
Expand All @@ -345,13 +348,16 @@
files = (
);
inputPaths = (
"${PODS_PODFILE_DIR_PATH}/Podfile.lock",
"${PODS_ROOT}/Manifest.lock",
);
name = "[CP] Check Pods Manifest.lock";
outputPaths = (
"$(DERIVED_FILE_DIR)/Pods-example-ios-checkManifestLockResult.txt",
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;
shellScript = "diff \"${PODS_PODFILE_DIR_PATH}/Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n";
shellScript = "diff \"${PODS_PODFILE_DIR_PATH}/Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n# This output is used by Xcode 'outputs' to avoid re-running this script phase.\necho \"SUCCESS\" > \"${SCRIPT_OUTPUT_FILE_0}\"\n";
showEnvVarsInLog = 0;
};
CDC3360217B97B190098386C /* Build appledoc */ = {
Expand Down
8 changes: 7 additions & 1 deletion Example/macos/macos.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -161,13 +161,16 @@
files = (
);
inputPaths = (
"${PODS_PODFILE_DIR_PATH}/Podfile.lock",
"${PODS_ROOT}/Manifest.lock",
);
name = "[CP] Check Pods Manifest.lock";
outputPaths = (
"$(DERIVED_FILE_DIR)/Pods-example-macos-checkManifestLockResult.txt",
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;
shellScript = "diff \"${PODS_PODFILE_DIR_PATH}/Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n";
shellScript = "diff \"${PODS_PODFILE_DIR_PATH}/Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n# This output is used by Xcode 'outputs' to avoid re-running this script phase.\necho \"SUCCESS\" > \"${SCRIPT_OUTPUT_FILE_0}\"\n";
showEnvVarsInLog = 0;
};
50DAC7215CB8D45774949E1F /* [CP] Embed Pods Frameworks */ = {
Expand All @@ -176,9 +179,12 @@
files = (
);
inputPaths = (
"${SRCROOT}/../../Pods/Target Support Files/Pods-example-macos/Pods-example-macos-frameworks.sh",
"${BUILT_PRODUCTS_DIR}/PiwikTracker-macOS/PiwikTracker.framework",
);
name = "[CP] Embed Pods Frameworks";
outputPaths = (
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/PiwikTracker.framework",
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;
Expand Down
8 changes: 7 additions & 1 deletion Example/tvos/tvos.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -161,9 +161,12 @@
files = (
);
inputPaths = (
"${SRCROOT}/../../Pods/Target Support Files/Pods-example-tvos/Pods-example-tvos-frameworks.sh",
"${BUILT_PRODUCTS_DIR}/PiwikTracker-tvOS/PiwikTracker.framework",
);
name = "[CP] Embed Pods Frameworks";
outputPaths = (
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/PiwikTracker.framework",
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;
Expand Down Expand Up @@ -191,13 +194,16 @@
files = (
);
inputPaths = (
"${PODS_PODFILE_DIR_PATH}/Podfile.lock",
"${PODS_ROOT}/Manifest.lock",
);
name = "[CP] Check Pods Manifest.lock";
outputPaths = (
"$(DERIVED_FILE_DIR)/Pods-example-tvos-checkManifestLockResult.txt",
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;
shellScript = "diff \"${PODS_PODFILE_DIR_PATH}/Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n";
shellScript = "diff \"${PODS_PODFILE_DIR_PATH}/Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n# This output is used by Xcode 'outputs' to avoid re-running this script phase.\necho \"SUCCESS\" > \"${SCRIPT_OUTPUT_FILE_0}\"\n";
showEnvVarsInLog = 0;
};
/* End PBXShellScriptBuildPhase section */
Expand Down
14 changes: 11 additions & 3 deletions PiwikTracker.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -311,9 +311,14 @@
files = (
);
inputPaths = (
"${SRCROOT}/Pods/Target Support Files/Pods-PiwikTrackerTests/Pods-PiwikTrackerTests-frameworks.sh",
"${BUILT_PRODUCTS_DIR}/Nimble/Nimble.framework",
"${BUILT_PRODUCTS_DIR}/Quick/Quick.framework",
);
name = "[CP] Embed Pods Frameworks";
outputPaths = (
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/Nimble.framework",
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/Quick.framework",
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;
Expand All @@ -326,13 +331,16 @@
files = (
);
inputPaths = (
"${PODS_PODFILE_DIR_PATH}/Podfile.lock",
"${PODS_ROOT}/Manifest.lock",
);
name = "[CP] Check Pods Manifest.lock";
outputPaths = (
"$(DERIVED_FILE_DIR)/Pods-PiwikTrackerTests-checkManifestLockResult.txt",
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;
shellScript = "diff \"${PODS_PODFILE_DIR_PATH}/Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n";
shellScript = "diff \"${PODS_PODFILE_DIR_PATH}/Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n# This output is used by Xcode 'outputs' to avoid re-running this script phase.\necho \"SUCCESS\" > \"${SCRIPT_OUTPUT_FILE_0}\"\n";
showEnvVarsInLog = 0;
};
F440219733D7385F192471AC /* [CP] Copy Pods Resources */ = {
Expand Down Expand Up @@ -516,7 +524,7 @@
PRODUCT_BUNDLE_IDENTIFIER = org.piwik.PiwikTracker;
PRODUCT_NAME = "$(TARGET_NAME)";
SKIP_INSTALL = YES;
SUPPORTED_PLATFORMS = "iphonesimulator iphoneos macosx tvos";
SUPPORTED_PLATFORMS = "iphonesimulator iphoneos appletvos macosx";
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
SWIFT_VERSION = 3.0;
};
Expand All @@ -538,7 +546,7 @@
PRODUCT_BUNDLE_IDENTIFIER = org.piwik.PiwikTracker;
PRODUCT_NAME = "$(TARGET_NAME)";
SKIP_INSTALL = YES;
SUPPORTED_PLATFORMS = "iphonesimulator iphoneos macosx tvos";
SUPPORTED_PLATFORMS = "iphonesimulator iphoneos appletvos macosx";
SWIFT_VERSION = 3.0;
};
name = Release;
Expand Down
1 change: 1 addition & 0 deletions PiwikTracker/Device.swift
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,7 @@ internal struct Device {

}
#if os(OSX)
import AppKit
extension Device {
/// Reaturns the version number of the current OS as String i.e. "1.2" or "9.4"
internal static func osVersionForCurrentDevice() -> String {
Expand Down
1 change: 1 addition & 0 deletions PiwikTracker/Event.swift
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
//

import Foundation
import CoreGraphics

/// Represents an event of any kind.
///
Expand Down
2 changes: 1 addition & 1 deletion PiwikTracker/PiwikTracker.h
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
// Copyright © 2016 PIWIK. All rights reserved.
//

#import <UIKit/UIKit.h>
@import Foundation;

//! Project version number for PiwikTracker.
FOUNDATION_EXPORT double PiwikTrackerVersionNumber;
Expand Down
13 changes: 6 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# PiwikTracker iOS SDK

The PiwikTracker is an iOS, tvOS and macOS SDK for sending app analytics to a Piwik server.
The PiwikTracker is an iOS, tvOS and macOS SDK for sending app analytics to a Piwik server. PiwikTracker can be used from Swift and [Objective-C](#objective-c-compatibility).

**Fancy help improving this SDK? Check [this list](https://github.com/piwik/piwik-sdk-ios/issues?utf8=✓&q=is%3Aopen%20is%3Aissue%20label%3Adiscussion%20label%3Aswift3) to see what is left and can be improved.**

Expand Down Expand Up @@ -93,9 +93,8 @@ PiwikTracker.shared?.visitorId = "coolUsername123"

All future events being tracked by the SDK will be associated with this userID, as opposed to the default UUID created for each Visitor.

### Advanced

#### Manual dispatching
## Advanced Usage
### Manual dispatching

The PiwikTracker will dispatch events every 30 seconds automatically. If you want to dispatch events manually, you can use the `dispatch()` function. You can, for example, dispatch whenever the application enter the background.

Expand All @@ -105,7 +104,7 @@ func applicationDidEnterBackground(_ application: UIApplication) {
}
```

#### Session Management
### Session Management

The PiwikTracker starts a new session whenever the application starts. If you want to start a new session manually, you can use the `startNewSession()` function. You can, for example, start a new session whenever the user enters the application.

Expand All @@ -115,7 +114,7 @@ func applicationWillEnterForeground(_ application: UIApplication) {
}
```

#### Logging
### Logging

The PiwikTracker per default loggs `warning` and `error` messages to the console. You can change the `LogLevel`.

Expand All @@ -137,7 +136,7 @@ You can instantiate the `PiwikTracker` using your own user agent.
PiwikTracker.configureSharedInstance(withSiteID: "5", baseURL: URL(string: "http://your.server.org/path-to-piwik/piwik.php")!, userAgent: "Your custom user agent")
```

#### Objective-C compatibility
### Objective-C compatibility

Version 4 of this SDK is written in Swift, but you can use it in your Objective-C project as well. If you don't want to update you can still use the unsupported older [version 3](https://github.com/piwik/piwik-sdk-ios/tree/version-3). Using the Swift SDK from Objective-C should be pretty straight forward.

Expand Down
24 changes: 24 additions & 0 deletions Rakefile
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,19 @@ namespace :test do
end
end

namespace :package_manager do
desc 'Prepare tests'
task :prepare do
end

desc 'Builds the project with Carthage'
task carthage: :prepare do
sh("carthage build --no-skip-current") rescue nil
package_manager_failed('Carthage integration') unless $?.success?
end
end


desc 'Run the PiwikTracker tests for iOS & Mac OS X'
task :test do
Rake::Task['test:ios'].invoke
Expand All @@ -40,8 +53,14 @@ task :test do
Rake::Task['test:tvos_demo'].invoke
end

desc 'Check the integration of PiwikTracker with package managers'
task :build_with_package_manager do
Rake::Task['package_manager:carthage'].invoke
end

task default: 'test'


private

def run_build(scheme, sdk, destination = 'platform=iOS Simulator,name=iPhone 6,OS=10.3.1')
Expand All @@ -67,6 +86,11 @@ def tests_failed(platform)
exit $?.exitstatus
end

def package_manager_failed(package_manager)
puts red("Integration with #{package_manager} failed")
exit $?.exitstatus
end

def red(string)
"\033[0;31m! #{string}"
end

0 comments on commit ff45fb5

Please sign in to comment.