Skip to content

Commit

Permalink
Add methods to enable/disable tracking using opt-in. Grammar fixes. X…
Browse files Browse the repository at this point in the history
…code 12 updates.
  • Loading branch information
AvdLee committed Oct 22, 2020
1 parent 10a736c commit 3cd83c6
Show file tree
Hide file tree
Showing 5 changed files with 28 additions and 10 deletions.
16 changes: 9 additions & 7 deletions Trekker.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -297,7 +297,7 @@
isa = PBXProject;
attributes = {
LastSwiftUpdateCheck = 0710;
LastUpgradeCheck = 1120;
LastUpgradeCheck = 1200;
ORGANIZATIONNAME = "Rens Verhoeven";
TargetAttributes = {
0C7FAD091BECBE8C0049C011 = {
Expand Down Expand Up @@ -465,6 +465,7 @@
CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES;
CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES;
CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
CLANG_WARN_STRICT_PROTOTYPES = YES;
CLANG_WARN_SUSPICIOUS_MOVE = YES;
Expand All @@ -489,7 +490,7 @@
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
IPHONEOS_DEPLOYMENT_TARGET = 9.1;
IPHONEOS_DEPLOYMENT_TARGET = 12.0;
MTL_ENABLE_DEBUG_INFO = YES;
ONLY_ACTIVE_ARCH = YES;
SDKROOT = iphoneos;
Expand Down Expand Up @@ -520,6 +521,7 @@
CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES;
CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES;
CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
CLANG_WARN_STRICT_PROTOTYPES = YES;
CLANG_WARN_SUSPICIOUS_MOVE = YES;
Expand All @@ -538,7 +540,7 @@
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
IPHONEOS_DEPLOYMENT_TARGET = 9.1;
IPHONEOS_DEPLOYMENT_TARGET = 12.0;
MTL_ENABLE_DEBUG_INFO = NO;
SDKROOT = iphoneos;
SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule";
Expand All @@ -554,7 +556,7 @@
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
CODE_SIGN_IDENTITY = "iPhone Developer";
INFOPLIST_FILE = Example/Info.plist;
IPHONEOS_DEPLOYMENT_TARGET = 8.0;
IPHONEOS_DEPLOYMENT_TARGET = 12.0;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
PRODUCT_BUNDLE_IDENTIFIER = "co.awkward.trekker-example";
PRODUCT_NAME = "$(TARGET_NAME)";
Expand All @@ -569,7 +571,7 @@
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
CODE_SIGN_IDENTITY = "iPhone Developer";
INFOPLIST_FILE = Example/Info.plist;
IPHONEOS_DEPLOYMENT_TARGET = 8.0;
IPHONEOS_DEPLOYMENT_TARGET = 12.0;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
PRODUCT_BUNDLE_IDENTIFIER = "co.awkward.trekker-example";
PRODUCT_NAME = "$(TARGET_NAME)";
Expand All @@ -591,7 +593,7 @@
DYLIB_INSTALL_NAME_BASE = "@rpath";
INFOPLIST_FILE = Trekker/Info.plist;
INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks";
IPHONEOS_DEPLOYMENT_TARGET = 8.0;
IPHONEOS_DEPLOYMENT_TARGET = 12.0;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
PRODUCT_BUNDLE_IDENTIFIER = co.awkward.trekker;
PRODUCT_NAME = "$(TARGET_NAME)";
Expand All @@ -617,7 +619,7 @@
DYLIB_INSTALL_NAME_BASE = "@rpath";
INFOPLIST_FILE = Trekker/Info.plist;
INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks";
IPHONEOS_DEPLOYMENT_TARGET = 8.0;
IPHONEOS_DEPLOYMENT_TARGET = 12.0;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
PRODUCT_BUNDLE_IDENTIFIER = co.awkward.trekker;
PRODUCT_NAME = "$(TARGET_NAME)";
Expand Down
2 changes: 1 addition & 1 deletion Trekker.xcodeproj/xcshareddata/xcschemes/Trekker.xcscheme
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "1130"
LastUpgradeVersion = "1200"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "1130"
LastUpgradeVersion = "1200"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"
Expand Down
11 changes: 10 additions & 1 deletion Trekker/Trekker.swift
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ public final class Trekker: NSObject {

//MARK: - Public configurable or readable variables

/// If the Trekker itself should handle sesstion state updates automaticlly.
/// If the Trekker itself should handle session state updates automatically.
///
/// - important: If this is disbale, you are responsible to call the following methods yourself:
/// - `func startTracking()`
Expand Down Expand Up @@ -71,6 +71,15 @@ public final class Trekker: NSObject {
NotificationCenter.default.addObserver(self, selector: #selector(Trekker.endTracking(_:)), name: UIApplication.willTerminateNotification, object: nil)
}
}

/// Enables/disables tracking within all registered services.
/// This method can be used if Tracking is opt-in for legal reasons.
/// Each service should respect this setting individually using the optional `setTrackingEnabled(_:)` method.
///
/// - Parameter enabled: Whether or not tracking should be enabled.
public func setTrackingEnabled(_ enabled: Bool) {
services.forEach { $0.setTrackingEnabled(enabled) }
}

// MARK: - Session state

Expand Down
7 changes: 7 additions & 0 deletions Trekker/TrekkerService.swift
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,9 @@ public protocol TrekkerService {

/// Called when the Trekker has been stopped using `func stopTracking()`. Some services can use this to end a session.
func stop()

/// Called when Tracking is opt-in to enable/disable tracking.
func setTrackingEnabled(_ enabled: Bool)
}

public extension TrekkerService {
Expand All @@ -57,4 +60,8 @@ public extension TrekkerService {
func stop() {
// Empty implementation to make the implementation optional.
}

func setTrackingEnabled(_ enabled: Bool) {
// Empty implementation to make the implementation optional.
}
}

0 comments on commit 3cd83c6

Please sign in to comment.