diff --git a/Podfile b/Podfile index bf1a97832..52f327a56 100644 --- a/Podfile +++ b/Podfile @@ -62,7 +62,6 @@ def shared_pods pod 'PureLayout', :inhibit_warnings => true pod 'Reachability', :inhibit_warnings => true pod 'YYImage', :inhibit_warnings => true - pod 'CryptoSwift', :inhibit_warnings => true pod 'IGIdenticon', :inhibit_warnings => true end @@ -72,8 +71,10 @@ target 'Signal' do pod 'SSZipArchive', :inhibit_warnings => true # Loki - pod 'GCDWebServer', '~> 3.0' - pod 'FeedKit', '~> 8.1' + pod 'GCDWebServer', '~> 3.0', :inhibit_warnings => true + pod 'FeedKit', '~> 8.1', :inhibit_warnings => true + pod 'CryptoSwift', '~> 1.0', :inhibit_warnings => true + pod 'Mixpanel', '~> 3.4', :inhibit_warnings => true target 'SignalTests' do inherit! :search_paths diff --git a/Podfile.lock b/Podfile.lock index 5b624389a..aecbc3596 100644 --- a/Podfile.lock +++ b/Podfile.lock @@ -52,6 +52,7 @@ PODS: - Mantle (2.1.0): - Mantle/extobjc (= 2.1.0) - Mantle/extobjc (2.1.0) + - Mixpanel (3.4.7) - PromiseKit (6.5.3): - PromiseKit/CorePromise (= 6.5.3) - PromiseKit/Foundation (= 6.5.3) @@ -196,7 +197,7 @@ DEPENDENCIES: - AFNetworking - AxolotlKit (from `https://github.com/signalapp/SignalProtocolKit.git`, branch `master`) - AxolotlKit/Tests (from `https://github.com/signalapp/SignalProtocolKit.git`, branch `master`) - - CryptoSwift + - CryptoSwift (~> 1.0) - Curve25519Kit (from `https://github.com/signalapp/Curve25519Kit`) - Curve25519Kit/Tests (from `https://github.com/signalapp/Curve25519Kit`) - FeedKit (~> 8.1) @@ -206,6 +207,7 @@ DEPENDENCIES: - HKDFKit/Tests (from `https://github.com/signalapp/HKDFKit.git`) - IGIdenticon - Mantle (from `https://github.com/signalapp/Mantle`, branch `signal-master`) + - Mixpanel (~> 3.4) - PromiseKit (= 6.5.3) - PureLayout - Reachability @@ -230,6 +232,7 @@ SPEC REPOS: - GCDWebServer - IGIdenticon - libPhoneNumber-iOS + - Mixpanel - PromiseKit - PureLayout - Reachability @@ -307,6 +310,7 @@ SPEC CHECKSUMS: IGIdenticon: 5790befde4fe56296927c72c0efed3d07b21de8e libPhoneNumber-iOS: e444379ac18bbfbdefad571da735b2cd7e096caa Mantle: 2fa750afa478cd625a94230fbf1c13462f29395b + Mixpanel: 696e0a1c7f2685aa06bb23829b7a58ab7203d6c7 PromiseKit: c609029bdd801f792551a504c695c7d3098b42cd PureLayout: f08c01b8dec00bb14a1fefa3de4c7d9c265df85e Reachability: 33e18b67625424e47b6cde6d202dce689ad7af96 @@ -321,6 +325,6 @@ SPEC CHECKSUMS: YapDatabase: b418a4baa6906e8028748938f9159807fd039af4 YYImage: 1e1b62a9997399593e4b9c4ecfbbabbf1d3f3b54 -PODFILE CHECKSUM: 95f41137d4fe8c5b8a27de951b328f8c9531d166 +PODFILE CHECKSUM: 0666e8fade5ac5ba48d0b3c9cb83b2095d1b3cef COCOAPODS: 1.5.3 diff --git a/Signal.xcodeproj/project.pbxproj b/Signal.xcodeproj/project.pbxproj index f10fe677d..9a9b0316a 100644 --- a/Signal.xcodeproj/project.pbxproj +++ b/Signal.xcodeproj/project.pbxproj @@ -565,6 +565,7 @@ B82584A02315024B001B41CB /* LokiRSSFeedPoller.swift in Sources */ = {isa = PBXBuildFile; fileRef = B825849F2315024B001B41CB /* LokiRSSFeedPoller.swift */; }; B845B4D4230CD09100D759F0 /* LokiGroupChatPoller.swift in Sources */ = {isa = PBXBuildFile; fileRef = B845B4D3230CD09000D759F0 /* LokiGroupChatPoller.swift */; }; B846365B22B7418B00AF1514 /* Identicon+ObjC.swift in Sources */ = {isa = PBXBuildFile; fileRef = B846365A22B7418B00AF1514 /* Identicon+ObjC.swift */; }; + B8911057231F774C00F15FCC /* Analytics.swift in Sources */ = {isa = PBXBuildFile; fileRef = B8911056231F774C00F15FCC /* Analytics.swift */; }; B89841E322B7579F00B1BDC6 /* NewConversationViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = B89841E222B7579F00B1BDC6 /* NewConversationViewController.swift */; }; B90418E6183E9DD40038554A /* DateUtil.m in Sources */ = {isa = PBXBuildFile; fileRef = B90418E5183E9DD40038554A /* DateUtil.m */; }; B9EB5ABD1884C002007CBB57 /* MessageUI.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = B9EB5ABC1884C002007CBB57 /* MessageUI.framework */; }; @@ -1359,6 +1360,7 @@ B825849F2315024B001B41CB /* LokiRSSFeedPoller.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = LokiRSSFeedPoller.swift; sourceTree = ""; }; B845B4D3230CD09000D759F0 /* LokiGroupChatPoller.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = LokiGroupChatPoller.swift; sourceTree = ""; }; B846365A22B7418B00AF1514 /* Identicon+ObjC.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "Identicon+ObjC.swift"; sourceTree = ""; }; + B8911056231F774C00F15FCC /* Analytics.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Analytics.swift; sourceTree = ""; }; B89841E222B7579F00B1BDC6 /* NewConversationViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = NewConversationViewController.swift; sourceTree = ""; }; B90418E4183E9DD40038554A /* DateUtil.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DateUtil.h; sourceTree = ""; }; B90418E5183E9DD40038554A /* DateUtil.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = DateUtil.m; sourceTree = ""; }; @@ -2616,6 +2618,7 @@ isa = PBXGroup; children = ( B821F2F72272CED3002C88C0 /* AccountDetailsViewController.swift */, + B8911056231F774C00F15FCC /* Analytics.swift */, B8162F0222891AD600D46544 /* FriendRequestView.swift */, B8162F0422892C5F00D46544 /* FriendRequestViewDelegate.swift */, B845B4D3230CD09000D759F0 /* LokiGroupChatPoller.swift */, @@ -3291,6 +3294,7 @@ "${BUILT_PRODUCTS_DIR}/HKDFKit/HKDFKit.framework", "${BUILT_PRODUCTS_DIR}/IGIdenticon/IGIdenticon.framework", "${BUILT_PRODUCTS_DIR}/Mantle/Mantle.framework", + "${BUILT_PRODUCTS_DIR}/Mixpanel/Mixpanel.framework", "${BUILT_PRODUCTS_DIR}/PromiseKit/PromiseKit.framework", "${BUILT_PRODUCTS_DIR}/PureLayout/PureLayout.framework", "${BUILT_PRODUCTS_DIR}/Reachability/Reachability.framework", @@ -3319,6 +3323,7 @@ "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/HKDFKit.framework", "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/IGIdenticon.framework", "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/Mantle.framework", + "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/Mixpanel.framework", "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/PromiseKit.framework", "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/PureLayout.framework", "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/Reachability.framework", @@ -3674,6 +3679,7 @@ 34E3EF101EFC2684007F6822 /* DebugUIPage.m in Sources */, 34A8B3512190A40E00218A25 /* MediaAlbumCellView.swift in Sources */, 34D1F0AE1F867BFC0066283D /* OWSMessageCell.m in Sources */, + B8911057231F774C00F15FCC /* Analytics.swift in Sources */, 4C4AEC4520EC343B0020E72B /* DismissableTextField.swift in Sources */, 4CB5F26720F6E1E2004D1B42 /* MenuActionsViewController.swift in Sources */, 3496955E219B605E00DCFE74 /* PhotoLibrary.swift in Sources */, diff --git a/Signal/src/AppDelegate.m b/Signal/src/AppDelegate.m index 1d0c684cb..3eadb2f82 100644 --- a/Signal/src/AppDelegate.m +++ b/Signal/src/AppDelegate.m @@ -46,6 +46,7 @@ #import #import #import +#import @import WebRTC; @import Intents; @@ -348,6 +349,9 @@ static NSTimeInterval launchStartedAt; // NSLog(@"[Loki] Failed to start P2P server."); // } + // Loki - Set up beta analytics + [Mixpanel sharedInstanceWithToken:@"0410357303b7b6b45b740e6f0e6d34be"]; + return YES; } diff --git a/Signal/src/Loki/Analytics.swift b/Signal/src/Loki/Analytics.swift new file mode 100644 index 000000000..faeecc6c0 --- /dev/null +++ b/Signal/src/Loki/Analytics.swift @@ -0,0 +1,9 @@ +import Mixpanel + +@objc(LKAnalytics) +final class Analytics : NSObject { + + @objc static func track(_ event: String) { + Mixpanel.sharedInstance()?.track(event, properties: [ "configuration" : BuildConfiguration.current.description ]) + } +} diff --git a/SignalServiceKit/src/Loki/Utilities/BuildConfiguration.swift b/SignalServiceKit/src/Loki/Utilities/BuildConfiguration.swift index 8dc686d40..eb5c4aaf8 100644 --- a/SignalServiceKit/src/Loki/Utilities/BuildConfiguration.swift +++ b/SignalServiceKit/src/Loki/Utilities/BuildConfiguration.swift @@ -1,5 +1,5 @@ -public enum BuildConfiguration { +public enum BuildConfiguration : CustomStringConvertible { case debug, production public static let current: BuildConfiguration = { @@ -9,4 +9,11 @@ public enum BuildConfiguration { return .production #endif }() + + public var description: String { + switch self { + case .debug: return "debug" + case .production: return "production" + } + } }