From a15533b97972b1815db32f760550ffd59d329c81 Mon Sep 17 00:00:00 2001 From: manuroe Date: Fri, 5 Jan 2018 10:02:10 +0100 Subject: [PATCH 01/10] Remove Google Analytics --- Podfile | 7 --- Riot/AppDelegate.m | 143 +++++++++++++++++++++++---------------------- 2 files changed, 72 insertions(+), 78 deletions(-) diff --git a/Podfile b/Podfile index 8244f347ea..960c8b5d70 100644 --- a/Podfile +++ b/Podfile @@ -21,18 +21,15 @@ def import_MatrixKit if $matrixKitVersion == 'local' pod 'MatrixSDK', :path => '../matrix-ios-sdk/MatrixSDK.podspec' pod 'MatrixSDK/JingleCallStack', :path => '../matrix-ios-sdk/MatrixSDK.podspec' - pod 'MatrixSDK/GoogleAnalytics', :path => '../matrix-ios-sdk/MatrixSDK.podspec' pod 'MatrixKit', :path => '../matrix-ios-kit/MatrixKit.podspec' else if $matrixKitVersion == 'develop' pod 'MatrixSDK', :git => 'https://github.com/matrix-org/matrix-ios-sdk.git', :branch => 'develop' pod 'MatrixSDK/JingleCallStack', :git => 'https://github.com/matrix-org/matrix-ios-sdk.git', :branch => 'develop' - pod 'MatrixSDK/GoogleAnalytics', :git => 'https://github.com/matrix-org/matrix-ios-sdk.git', :branch => 'develop' pod 'MatrixKit', :git => 'https://github.com/matrix-org/matrix-ios-kit.git', :branch => 'develop' else pod 'MatrixKit', $matrixKitVersion pod 'MatrixSDK/JingleCallStack' - pod 'MatrixSDK/GoogleAnalytics' end end end @@ -42,18 +39,15 @@ def import_MatrixKitAppExtension if $matrixKitVersion == 'local' pod 'MatrixSDK', :path => '../matrix-ios-sdk/MatrixSDK.podspec' pod 'MatrixSDK/JingleCallStack', :path => '../matrix-ios-sdk/MatrixSDK.podspec' - pod 'MatrixSDK/GoogleAnalytics', :path => '../matrix-ios-sdk/MatrixSDK.podspec' pod 'MatrixKit/AppExtension', :path => '../matrix-ios-kit/MatrixKit.podspec' else if $matrixKitVersion == 'develop' pod 'MatrixSDK', :git => 'https://github.com/matrix-org/matrix-ios-sdk.git', :branch => 'develop' pod 'MatrixSDK/JingleCallStack', :git => 'https://github.com/matrix-org/matrix-ios-sdk.git', :branch => 'develop' - pod 'MatrixSDK/GoogleAnalytics', :git => 'https://github.com/matrix-org/matrix-ios-sdk.git', :branch => 'develop' pod 'MatrixKit/AppExtension', :git => 'https://github.com/matrix-org/matrix-ios-kit.git', :branch => 'develop' else pod 'MatrixKit/AppExtension', $matrixKitVersion pod 'MatrixSDK/JingleCallStack' - pod 'MatrixSDK/GoogleAnalytics' end end end @@ -62,7 +56,6 @@ end abstract_target 'RiotPods' do pod 'GBDeviceInfo', '~> 4.4.0' - pod 'GoogleAnalytics' # OLMKit for crypto pod 'OLMKit' diff --git a/Riot/AppDelegate.m b/Riot/AppDelegate.m index b0bb8f1cc5..0b9aabff9b 100644 --- a/Riot/AppDelegate.m +++ b/Riot/AppDelegate.m @@ -35,7 +35,6 @@ #import "RoomKeyRequestViewController.h" #import -#import "MatrixSDK/MXGoogleAnalytics.h" #import "Tools.h" #import "WidgetManager.h" @@ -46,12 +45,6 @@ #include -// Google Analytics -#import "GAI.h" -#import "GAIFields.h" -#import "GAIDictionaryBuilder.h" -#include - // Calls #import "CallViewController.h" @@ -233,7 +226,8 @@ + (void)initialize sdkOptions.applicationGroupIdentifier = @"group.im.vector"; // Track SDK performance on Google analytics - sdkOptions.analyticsDelegate = [[MXGoogleAnalytics alloc] init]; + // TODO: needs the same tool + //sdkOptions.analyticsDelegate = [[MXGoogleAnalytics alloc] init]; // Redirect NSLogs to files only if we are not debugging if (!isatty(STDERR_FILENO)) @@ -555,7 +549,8 @@ - (void)applicationDidEnterBackground:(UIApplication *)application _isAppForeground = NO; // GA: End a session while the app is in background - [[[GAI sharedInstance] defaultTracker] set:kGAISessionControl value:@"end"]; + // @TODO +// [[[GAI sharedInstance] defaultTracker] set:kGAISessionControl value:@"end"]; } - (void)applicationWillEnterForeground:(UIApplication *)application @@ -574,7 +569,8 @@ - (void)applicationWillEnterForeground:(UIApplication *)application _isAppForeground = YES; // GA: Start a new session. The next hit from this tracker will be the first in a new session. - [[[GAI sharedInstance] defaultTracker] set:kGAISessionControl value:@"start"]; + // @TODO +// [[[GAI sharedInstance] defaultTracker] set:kGAISessionControl value:@"start"]; } - (void)applicationDidBecomeActive:(UIApplication *)application @@ -1010,38 +1006,39 @@ - (void)startAnalytics // Check whether the user has enabled the sending of crash reports. if ([[NSUserDefaults standardUserDefaults] boolForKey:@"enableCrashReport"]) { - // Retrieve trackerId from GoogleService-Info.plist. - NSString *googleServiceInfoPath = [[NSBundle mainBundle] pathForResource:@"GoogleService-Info" ofType:@"plist"]; - NSDictionary *googleServiceInfo = [NSDictionary dictionaryWithContentsOfFile:googleServiceInfoPath]; - NSString *gaTrackingID = [googleServiceInfo objectForKey:@"TRACKING_ID"]; - if (gaTrackingID) - { - // Catch and log crashes - [MXLogger logCrashes:YES]; - [MXLogger setBuildVersion:[AppDelegate theDelegate].build]; - - // Configure GAI options. - GAI *gai = [GAI sharedInstance]; - - // Disable GA UncaughtException: their crash reports are quite limited (100 first chars of the stack trace) - // Let's MXLogger manage them - gai.trackUncaughtExceptions = NO; - - // Initialize it with the app tracker ID - [gai trackerWithTrackingId:gaTrackingID]; - - // Set Google Analytics dispatch interval to e.g. 20 seconds. - gai.dispatchInterval = 20; - -#ifdef DEBUG - // Disable GAI in debug as it pollutes stats and crashes in GA - gai.dryRun = YES; -#endif - } - else - { - NSLog(@"[AppDelegate] Unable to find tracker id for Google Analytics"); - } + // @TODO +// // Retrieve trackerId from GoogleService-Info.plist. +// NSString *googleServiceInfoPath = [[NSBundle mainBundle] pathForResource:@"GoogleService-Info" ofType:@"plist"]; +// NSDictionary *googleServiceInfo = [NSDictionary dictionaryWithContentsOfFile:googleServiceInfoPath]; +// NSString *gaTrackingID = [googleServiceInfo objectForKey:@"TRACKING_ID"]; +// if (gaTrackingID) +// { +// // Catch and log crashes +// [MXLogger logCrashes:YES]; +// [MXLogger setBuildVersion:[AppDelegate theDelegate].build]; +// +// // Configure GAI options. +// GAI *gai = [GAI sharedInstance]; +// +// // Disable GA UncaughtException: their crash reports are quite limited (100 first chars of the stack trace) +// // Let's MXLogger manage them +// gai.trackUncaughtExceptions = NO; +// +// // Initialize it with the app tracker ID +// [gai trackerWithTrackingId:gaTrackingID]; +// +// // Set Google Analytics dispatch interval to e.g. 20 seconds. +// gai.dispatchInterval = 20; +// +//#ifdef DEBUG +// // Disable GAI in debug as it pollutes stats and crashes in GA +// gai.dryRun = YES; +//#endif +// } +// else +// { +// NSLog(@"[AppDelegate] Unable to find tracker id for Google Analytics"); +// } } else if ([[NSUserDefaults standardUserDefaults] objectForKey:@"enableCrashReport"]) { @@ -1051,28 +1048,30 @@ - (void)startAnalytics - (void)stopAnalytics { - GAI *gai = [GAI sharedInstance]; - - // End a session. The next hit from this tracker will be the last in the current session. - [[gai defaultTracker] set:kGAISessionControl value:@"end"]; - - // Flush pending GA messages - [gai dispatch]; - - [gai removeTrackerByName:[gai defaultTracker].name]; - + // @TODO +// GAI *gai = [GAI sharedInstance]; +// +// // End a session. The next hit from this tracker will be the last in the current session. +// [[gai defaultTracker] set:kGAISessionControl value:@"end"]; +// +// // Flush pending GA messages +// [gai dispatch]; +// +// [gai removeTrackerByName:[gai defaultTracker].name]; + [MXLogger logCrashes:NO]; } - (void)trackScreen:(NSString *)screenName { - // Screen tracking (via Google Analytics) - id tracker = [[GAI sharedInstance] defaultTracker]; - if (tracker) - { - [tracker set:kGAIScreenName value:screenName]; - [tracker send:[[GAIDictionaryBuilder createScreenView] build]]; - } + // @TODO +// // Screen tracking (via Google Analytics) +// id tracker = [[GAI sharedInstance] defaultTracker]; +// if (tracker) +// { +// [tracker set:kGAIScreenName value:screenName]; +// [tracker send:[[GAIDictionaryBuilder createScreenView] build]]; +// } } // Check if there is a crash log to send to server @@ -1094,17 +1093,18 @@ - (void)checkExceptionToReport error:nil]; NSLog(@"[AppDelegate] Send crash log to Google Analytics:\n%@", description); - + + // @TODO // Send it via Google Analytics // The doc says the exception description must not exceeed 100 chars but it seems // to accept much more. // https://developers.google.com/analytics/devguides/collection/ios/v3/exceptions#overview - id tracker = [[GAI sharedInstance] defaultTracker]; - [tracker send:[[GAIDictionaryBuilder - createExceptionWithDescription:description - withFatal:[NSNumber numberWithBool:YES]] build]]; - [[GAI sharedInstance] dispatch]; - +// id tracker = [[GAI sharedInstance] defaultTracker]; +// [tracker send:[[GAIDictionaryBuilder +// createExceptionWithDescription:description +// withFatal:[NSNumber numberWithBool:YES]] build]]; +// [[GAI sharedInstance] dispatch]; + // Ask the user to send a crash report by email too // The email will provide logs and thus more context to the crash [[RageShakeManager sharedManager] promptCrashReportInViewController:self.window.rootViewController]; @@ -2728,11 +2728,12 @@ - (void)handleLaunchAnimation if ([MXSDKOptions sharedInstance].enableGoogleAnalytics) { - id tracker = [[GAI sharedInstance] defaultTracker]; - [tracker send:[[GAIDictionaryBuilder createTimingWithCategory:kMXGoogleAnalyticsStartupCategory - interval:@((int)durationMs) - name:kMXGoogleAnalyticsStartupLaunchScreen - label:nil] build]]; + // @TODO +// id tracker = [[GAI sharedInstance] defaultTracker]; +// [tracker send:[[GAIDictionaryBuilder createTimingWithCategory:kMXGoogleAnalyticsStartupCategory +// interval:@((int)durationMs) +// name:kMXGoogleAnalyticsStartupLaunchScreen +// label:nil] build]]; } [launchAnimationContainerView removeFromSuperview]; From 1a1dd02f75c0a3b6c0528a9d3e2612d700e17feb Mon Sep 17 00:00:00 2001 From: manuroe Date: Tue, 23 Jan 2018 20:18:07 +0100 Subject: [PATCH 02/10] Podfile: Enable use_frameworks so that we can use Swift pods --- Podfile | 15 ++++++ Riot.xcodeproj/project.pbxproj | 90 ++++++++++++++++++++++++++-------- 2 files changed, 85 insertions(+), 20 deletions(-) diff --git a/Podfile b/Podfile index 960c8b5d70..227829bd51 100644 --- a/Podfile +++ b/Podfile @@ -1,6 +1,9 @@ # Uncomment this line to define a global platform for your project platform :ios, "8.0" +# Use frameforks to allow usage of pod written in Swift (like PiwikTracker) +use_frameworks! + source 'https://github.com/CocoaPods/Specs.git' @@ -82,3 +85,15 @@ abstract_target 'RiotPods' do end + +# Disable bitcode for each pod framework +# Because the WebRTC pod (included by the JingleCallStack pod) does not support it. +# Plus the app does not enable it +post_install do |installer| + installer.pods_project.targets.each do |target| + target.build_configurations.each do |config| + config.build_settings['ENABLE_BITCODE'] = 'NO' + end + end +end + diff --git a/Riot.xcodeproj/project.pbxproj b/Riot.xcodeproj/project.pbxproj index 3495408e0e..526fcb07c0 100755 --- a/Riot.xcodeproj/project.pbxproj +++ b/Riot.xcodeproj/project.pbxproj @@ -28,15 +28,13 @@ 24EEE5A11F23A09A00B3C705 /* RiotDesignValues.m in Sources */ = {isa = PBXBuildFile; fileRef = F083BC171E7009EC00A9B29C /* RiotDesignValues.m */; }; 24EEE5A21F23A8B400B3C705 /* MXRoom+Riot.m in Sources */ = {isa = PBXBuildFile; fileRef = F083BBE81E7009EC00A9B29C /* MXRoom+Riot.m */; }; 24EEE5A31F23A8C300B3C705 /* AvatarGenerator.m in Sources */ = {isa = PBXBuildFile; fileRef = F083BC111E7009EC00A9B29C /* AvatarGenerator.m */; }; - 24EEE5A41F24C06E00B3C705 /* BuildFile in Resources */ = {isa = PBXBuildFile; }; + 24EEE5A41F24C06E00B3C705 /* (null) in Resources */ = {isa = PBXBuildFile; }; 24EEE5A81F25529600B3C705 /* cancel@3x.png in Resources */ = {isa = PBXBuildFile; fileRef = F0614A121EDEE65000F5DC9A /* cancel@3x.png */; }; 24EEE5A91F25529900B3C705 /* cancel@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = F0614A111EDEE65000F5DC9A /* cancel@2x.png */; }; 24EEE5AA1F25529C00B3C705 /* cancel.png in Resources */ = {isa = PBXBuildFile; fileRef = F0614A101EDEE65000F5DC9A /* cancel.png */; }; 24EEE5AF1F25F0F500B3C705 /* Images.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = F083BBEF1E7009EC00A9B29C /* Images.xcassets */; }; 24EEE5B41F2607C000B3C705 /* SegmentedViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = F083BC4E1E7009EC00A9B29C /* SegmentedViewController.m */; }; 24EEE5B51F2607C500B3C705 /* SegmentedViewController.xib in Resources */ = {isa = PBXBuildFile; fileRef = F083BC4F1E7009EC00A9B29C /* SegmentedViewController.xib */; }; - 268F9A229B0162F9C8AEBE34 /* libPods-RiotPods-Riot.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 714B084D44A5553C13D855BA /* libPods-RiotPods-Riot.a */; }; - 319F86690284AA02FC397A15 /* libPods-RiotPods-SiriIntents.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 7C1A4A3DCE26410A60959E96 /* libPods-RiotPods-SiriIntents.a */; }; 3205ED7D1E976C8A003D65FA /* DirectoryServerPickerViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 3205ED7C1E976C8A003D65FA /* DirectoryServerPickerViewController.m */; }; 3205ED841E97725E003D65FA /* DirectoryServerTableViewCell.m in Sources */ = {isa = PBXBuildFile; fileRef = 3205ED821E97725E003D65FA /* DirectoryServerTableViewCell.m */; }; 3205ED851E97725E003D65FA /* DirectoryServerTableViewCell.xib in Resources */ = {isa = PBXBuildFile; fileRef = 3205ED831E97725E003D65FA /* DirectoryServerTableViewCell.xib */; }; @@ -89,7 +87,7 @@ 32F3AE1A1F6FF4E600F0F004 /* WidgetViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 32F3AE191F6FF4E600F0F004 /* WidgetViewController.m */; }; 32FD0A3D1EB0CD9B0072B066 /* BugReportViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 32FD0A3B1EB0CD9B0072B066 /* BugReportViewController.m */; }; 32FD0A3E1EB0CD9B0072B066 /* BugReportViewController.xib in Resources */ = {isa = PBXBuildFile; fileRef = 32FD0A3C1EB0CD9B0072B066 /* BugReportViewController.xib */; }; - 40D7564A9783FD6C28C157CE /* libPods-RiotPods-RiotShareExtension.a in Frameworks */ = {isa = PBXBuildFile; fileRef = AF0A0746EF74FF15B8B79658 /* libPods-RiotPods-RiotShareExtension.a */; }; + 68A2327678CA647A9A7739C7 /* Pods_RiotPods_Riot.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = B0FAA1A49F76B0CE15C5CBD8 /* Pods_RiotPods_Riot.framework */; }; 83711A7C1F6F8E7D008F0D4D /* KeyboardGrowingTextView.m in Sources */ = {isa = PBXBuildFile; fileRef = 83711A7B1F6F8E7D008F0D4D /* KeyboardGrowingTextView.m */; }; 92324BE31F4F66D3009DE194 /* IncomingCallView.m in Sources */ = {isa = PBXBuildFile; fileRef = 92324BE21F4F66D3009DE194 /* IncomingCallView.m */; }; 92324BE61F4F6A60009DE194 /* CircleButton.m in Sources */ = {isa = PBXBuildFile; fileRef = 92324BE51F4F6A60009DE194 /* CircleButton.m */; }; @@ -97,6 +95,8 @@ 92726A471F58737A004AD26F /* IntentHandler.m in Sources */ = {isa = PBXBuildFile; fileRef = 92726A461F58737A004AD26F /* IntentHandler.m */; }; 92726A4B1F58737A004AD26F /* SiriIntents.appex in Embed App Extensions */ = {isa = PBXBuildFile; fileRef = 92726A431F58737A004AD26F /* SiriIntents.appex */; settings = {ATTRIBUTES = (RemoveHeadersOnCopy, ); }; }; 92726A511F587410004AD26F /* Intents.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 92726A501F587410004AD26F /* Intents.framework */; }; + 9D686B069F967C4D4BBC610F /* Pods_RiotPods_SiriIntents.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = DB50EEBE8214352B9EBD6394 /* Pods_RiotPods_SiriIntents.framework */; }; + DDDE2AB95F865F2292B1D315 /* Pods_RiotPods_RiotShareExtension.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 23D7292481328A48B8D5D4ED /* Pods_RiotPods_RiotShareExtension.framework */; }; F0131DE51F2200D600CBF707 /* RiotSplitViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = F0131DE41F2200D600CBF707 /* RiotSplitViewController.m */; }; F0173EB51FCF346800B5F6A3 /* Vector.strings in Resources */ = {isa = PBXBuildFile; fileRef = F0173EAF1FCF346800B5F6A3 /* Vector.strings */; }; F0173EB61FCF346800B5F6A3 /* Localizable.strings in Resources */ = {isa = PBXBuildFile; fileRef = F0173EB11FCF346800B5F6A3 /* Localizable.strings */; }; @@ -648,6 +648,7 @@ /* Begin PBXFileReference section */ 12AA0005C8B3D8D8162584C5 /* Pods-RiotShareExtension.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-RiotShareExtension.debug.xcconfig"; path = "Pods/Target Support Files/Pods-RiotShareExtension/Pods-RiotShareExtension.debug.xcconfig"; sourceTree = ""; }; 22D76C11C202B6BC5917A049 /* Pods-RiotPods-RiotShareExtension.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-RiotPods-RiotShareExtension.release.xcconfig"; path = "Pods/Target Support Files/Pods-RiotPods-RiotShareExtension/Pods-RiotPods-RiotShareExtension.release.xcconfig"; sourceTree = ""; }; + 23D7292481328A48B8D5D4ED /* Pods_RiotPods_RiotShareExtension.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_RiotPods_RiotShareExtension.framework; sourceTree = BUILT_PRODUCTS_DIR; }; 2439DD601F6BBE760090F42D /* RecentRoomTableViewCell.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RecentRoomTableViewCell.h; sourceTree = ""; }; 2439DD611F6BBE760090F42D /* RecentRoomTableViewCell.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RecentRoomTableViewCell.m; sourceTree = ""; }; 2439DD631F6BBEA50090F42D /* RecentRoomTableViewCell.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; path = RecentRoomTableViewCell.xib; sourceTree = ""; }; @@ -745,10 +746,8 @@ 4D1164C2F07EF74950DCDA7A /* Pods-SiriIntents.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-SiriIntents.release.xcconfig"; path = "Pods/Target Support Files/Pods-SiriIntents/Pods-SiriIntents.release.xcconfig"; sourceTree = ""; }; 5666C1236223F54D4C635C54 /* libPods-SiriIntents.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = "libPods-SiriIntents.a"; sourceTree = BUILT_PRODUCTS_DIR; }; 61BB7CD1741206BEAAA6D4C7 /* Pods-RiotPods-SiriIntents.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-RiotPods-SiriIntents.debug.xcconfig"; path = "Pods/Target Support Files/Pods-RiotPods-SiriIntents/Pods-RiotPods-SiriIntents.debug.xcconfig"; sourceTree = ""; }; - 714B084D44A5553C13D855BA /* libPods-RiotPods-Riot.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = "libPods-RiotPods-Riot.a"; sourceTree = BUILT_PRODUCTS_DIR; }; 7246451C668D6782166E22EC /* libPods-RiotShareExtension.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = "libPods-RiotShareExtension.a"; sourceTree = BUILT_PRODUCTS_DIR; }; 765F5104DB3EC39713DEB3A4 /* Pods-RiotShareExtension.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-RiotShareExtension.release.xcconfig"; path = "Pods/Target Support Files/Pods-RiotShareExtension/Pods-RiotShareExtension.release.xcconfig"; sourceTree = ""; }; - 7C1A4A3DCE26410A60959E96 /* libPods-RiotPods-SiriIntents.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = "libPods-RiotPods-SiriIntents.a"; sourceTree = BUILT_PRODUCTS_DIR; }; 83711A7B1F6F8E7D008F0D4D /* KeyboardGrowingTextView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = KeyboardGrowingTextView.m; sourceTree = ""; }; 839BB91240D350D5607D55BA /* Pods-Riot.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Riot.debug.xcconfig"; path = "Pods/Target Support Files/Pods-Riot/Pods-Riot.debug.xcconfig"; sourceTree = ""; }; 92324BE11F4F66D3009DE194 /* IncomingCallView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = IncomingCallView.h; sourceTree = ""; }; @@ -764,9 +763,10 @@ 92726A4F1F587393004AD26F /* SiriIntents.entitlements */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.entitlements; path = SiriIntents.entitlements; sourceTree = ""; }; 92726A501F587410004AD26F /* Intents.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Intents.framework; path = System/Library/Frameworks/Intents.framework; sourceTree = SDKROOT; }; A5030B7C3C0B6EB83A9257BD /* Pods-RiotPods-Riot.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-RiotPods-Riot.debug.xcconfig"; path = "Pods/Target Support Files/Pods-RiotPods-Riot/Pods-RiotPods-Riot.debug.xcconfig"; sourceTree = ""; }; - AF0A0746EF74FF15B8B79658 /* libPods-RiotPods-RiotShareExtension.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = "libPods-RiotPods-RiotShareExtension.a"; sourceTree = BUILT_PRODUCTS_DIR; }; + B0FAA1A49F76B0CE15C5CBD8 /* Pods_RiotPods_Riot.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_RiotPods_Riot.framework; sourceTree = BUILT_PRODUCTS_DIR; }; C195C53961EA28E6900AEB68 /* Pods-Riot.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Riot.release.xcconfig"; path = "Pods/Target Support Files/Pods-Riot/Pods-Riot.release.xcconfig"; sourceTree = ""; }; C5258DFF261AA3AB228A3F11 /* Pods-RiotPods-RiotShareExtension.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-RiotPods-RiotShareExtension.debug.xcconfig"; path = "Pods/Target Support Files/Pods-RiotPods-RiotShareExtension/Pods-RiotPods-RiotShareExtension.debug.xcconfig"; sourceTree = ""; }; + DB50EEBE8214352B9EBD6394 /* Pods_RiotPods_SiriIntents.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_RiotPods_SiriIntents.framework; sourceTree = BUILT_PRODUCTS_DIR; }; F0131DE31F2200D600CBF707 /* RiotSplitViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RiotSplitViewController.h; sourceTree = ""; }; F0131DE41F2200D600CBF707 /* RiotSplitViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RiotSplitViewController.m; sourceTree = ""; }; F0173EB01FCF346800B5F6A3 /* vi */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = vi; path = Vector.strings; sourceTree = ""; }; @@ -1399,7 +1399,7 @@ isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( - 40D7564A9783FD6C28C157CE /* libPods-RiotPods-RiotShareExtension.a in Frameworks */, + DDDE2AB95F865F2292B1D315 /* Pods_RiotPods_RiotShareExtension.framework in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -1408,7 +1408,7 @@ buildActionMask = 2147483647; files = ( 92726A511F587410004AD26F /* Intents.framework in Frameworks */, - 319F86690284AA02FC397A15 /* libPods-RiotPods-SiriIntents.a in Frameworks */, + 9D686B069F967C4D4BBC610F /* Pods_RiotPods_SiriIntents.framework in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -1417,7 +1417,7 @@ buildActionMask = 2147483647; files = ( 3233F7461F3497E2006ACA81 /* JitsiMeet.framework in Frameworks */, - 268F9A229B0162F9C8AEBE34 /* libPods-RiotPods-Riot.a in Frameworks */, + 68A2327678CA647A9A7739C7 /* Pods_RiotPods_Riot.framework in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -1606,9 +1606,9 @@ FD9D0BDE9232898950554DD5 /* libPods-Riot.a */, 7246451C668D6782166E22EC /* libPods-RiotShareExtension.a */, 5666C1236223F54D4C635C54 /* libPods-SiriIntents.a */, - 714B084D44A5553C13D855BA /* libPods-RiotPods-Riot.a */, - AF0A0746EF74FF15B8B79658 /* libPods-RiotPods-RiotShareExtension.a */, - 7C1A4A3DCE26410A60959E96 /* libPods-RiotPods-SiriIntents.a */, + B0FAA1A49F76B0CE15C5CBD8 /* Pods_RiotPods_Riot.framework */, + 23D7292481328A48B8D5D4ED /* Pods_RiotPods_RiotShareExtension.framework */, + DB50EEBE8214352B9EBD6394 /* Pods_RiotPods_SiriIntents.framework */, ); name = Frameworks; sourceTree = ""; @@ -2829,9 +2829,9 @@ F0BFBDBB1FF3BF6F00C88726 /* Vector.strings in Resources */, F0BFBDBF1FF3BFD200C88726 /* Vector.strings in Resources */, 24D6B35E1F3CA03E00FC7A71 /* FallbackViewController.xib in Resources */, - 24EEE5A41F24C06E00B3C705 /* BuildFile in Resources */, + 24EEE5A41F24C06E00B3C705 /* (null) in Resources */, 2439DD641F6BBEA50090F42D /* RecentRoomTableViewCell.xib in Resources */, - 24EEE5A41F24C06E00B3C705 /* BuildFile in Resources */, + 24EEE5A41F24C06E00B3C705 /* (null) in Resources */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -3345,7 +3345,7 @@ "${PODS_ROOT}/MatrixKit/MatrixKit/Views/RoomTitle/MXKRoomTitleView.xib", "${PODS_ROOT}/MatrixKit/MatrixKit/Views/RoomTitle/MXKRoomTitleViewWithTopic.xib", "${PODS_ROOT}/MatrixKit/MatrixKit/Views/Search/MXKSearchTableViewCell.xib", - "$PODS_CONFIGURATION_BUILD_DIR/MatrixKit/MatrixKit.bundle", + $PODS_CONFIGURATION_BUILD_DIR/MatrixKit/MatrixKit.bundle, ); name = "[CP] Copy Pods Resources"; outputPaths = ( @@ -3381,11 +3381,37 @@ ); inputPaths = ( "${SRCROOT}/Pods/Target Support Files/Pods-RiotPods-Riot/Pods-RiotPods-Riot-frameworks.sh", + "${BUILT_PRODUCTS_DIR}/AFNetworking/AFNetworking.framework", + "${BUILT_PRODUCTS_DIR}/DTCoreText/DTCoreText.framework", + "${BUILT_PRODUCTS_DIR}/DTFoundation/DTFoundation.framework", + "${BUILT_PRODUCTS_DIR}/GBDeviceInfo/GBDeviceInfo.framework", + "${BUILT_PRODUCTS_DIR}/GZIP/GZIP.framework", + "${BUILT_PRODUCTS_DIR}/HPGrowingTextView/HPGrowingTextView.framework", + "${BUILT_PRODUCTS_DIR}/MatrixKit/MatrixKit.framework", + "${BUILT_PRODUCTS_DIR}/MatrixSDK/MatrixSDK.framework", + "${BUILT_PRODUCTS_DIR}/OLMKit/OLMKit.framework", + "${BUILT_PRODUCTS_DIR}/Realm/Realm.framework", "${PODS_ROOT}/WebRTC/WebRTC.framework", + "${BUILT_PRODUCTS_DIR}/cmark/cmark.framework", + "${BUILT_PRODUCTS_DIR}/libPhoneNumber-iOS/libPhoneNumber_iOS.framework", + "${BUILT_PRODUCTS_DIR}/DTCoreText.default-Extension/DTCoreText.framework", + "${BUILT_PRODUCTS_DIR}/MatrixKit-AppExtension/MatrixKit.framework", ); name = "[CP] Embed Pods Frameworks"; outputPaths = ( + "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/AFNetworking.framework", + "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/DTCoreText.framework", + "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/DTFoundation.framework", + "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/GBDeviceInfo.framework", + "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/GZIP.framework", + "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/HPGrowingTextView.framework", + "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/MatrixKit.framework", + "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/MatrixSDK.framework", + "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/OLMKit.framework", + "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/Realm.framework", "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/WebRTC.framework", + "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/cmark.framework", + "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/libPhoneNumber_iOS.framework", ); runOnlyForDeploymentPostprocessing = 0; shellPath = /bin/sh; @@ -4031,8 +4057,20 @@ ENABLE_BITCODE = NO; FRAMEWORK_SEARCH_PATHS = ( "$(inherited)", - "$(PROJECT_DIR)/Riot/libs", - "$(PROJECT_DIR)/Riot/libs/jitsi-meet", + "\"${PODS_CONFIGURATION_BUILD_DIR}/AFNetworking\"", + "\"${PODS_CONFIGURATION_BUILD_DIR}/DTCoreText\"", + "\"${PODS_CONFIGURATION_BUILD_DIR}/DTFoundation\"", + "\"${PODS_CONFIGURATION_BUILD_DIR}/GBDeviceInfo\"", + "\"${PODS_CONFIGURATION_BUILD_DIR}/GZIP\"", + "\"${PODS_CONFIGURATION_BUILD_DIR}/HPGrowingTextView\"", + "\"${PODS_CONFIGURATION_BUILD_DIR}/MatrixKit\"", + "\"${PODS_CONFIGURATION_BUILD_DIR}/MatrixSDK\"", + "\"${PODS_CONFIGURATION_BUILD_DIR}/OLMKit\"", + "\"${PODS_CONFIGURATION_BUILD_DIR}/Realm\"", + "\"${PODS_CONFIGURATION_BUILD_DIR}/cmark\"", + "\"${PODS_CONFIGURATION_BUILD_DIR}/libPhoneNumber-iOS\"", + "\"${PODS_ROOT}/WebRTC\"", + "\"$(PROJECT_DIR)/Riot/libs/jitsi-meet\"", ); INFOPLIST_FILE = Riot/Info.plist; IPHONEOS_DEPLOYMENT_TARGET = 8.0; @@ -4053,8 +4091,20 @@ ENABLE_BITCODE = NO; FRAMEWORK_SEARCH_PATHS = ( "$(inherited)", - "$(PROJECT_DIR)/Riot/libs", - "$(PROJECT_DIR)/Riot/libs/jitsi-meet", + "\"${PODS_CONFIGURATION_BUILD_DIR}/AFNetworking\"", + "\"${PODS_CONFIGURATION_BUILD_DIR}/DTCoreText\"", + "\"${PODS_CONFIGURATION_BUILD_DIR}/DTFoundation\"", + "\"${PODS_CONFIGURATION_BUILD_DIR}/GBDeviceInfo\"", + "\"${PODS_CONFIGURATION_BUILD_DIR}/GZIP\"", + "\"${PODS_CONFIGURATION_BUILD_DIR}/HPGrowingTextView\"", + "\"${PODS_CONFIGURATION_BUILD_DIR}/MatrixKit\"", + "\"${PODS_CONFIGURATION_BUILD_DIR}/MatrixSDK\"", + "\"${PODS_CONFIGURATION_BUILD_DIR}/OLMKit\"", + "\"${PODS_CONFIGURATION_BUILD_DIR}/Realm\"", + "\"${PODS_CONFIGURATION_BUILD_DIR}/cmark\"", + "\"${PODS_CONFIGURATION_BUILD_DIR}/libPhoneNumber-iOS\"", + "\"${PODS_ROOT}/WebRTC\"", + "\"$(PROJECT_DIR)/Riot/libs/jitsi-meet\"", ); INFOPLIST_FILE = Riot/Info.plist; IPHONEOS_DEPLOYMENT_TARGET = 8.0; From 75f6d94c55d7469f8c62eb87247b4b6588e51ac8 Mon Sep 17 00:00:00 2001 From: manuroe Date: Mon, 29 Jan 2018 15:26:44 +0100 Subject: [PATCH 03/10] Piwik: Use it for analytics --- Podfile | 6 ++ Riot.xcodeproj/project.pbxproj | 2 + Riot/AppDelegate.m | 121 +++++++++++++-------------------- Riot/Riot-Defaults.plist | 7 ++ 4 files changed, 64 insertions(+), 72 deletions(-) diff --git a/Podfile b/Podfile index 227829bd51..ffb2540b4c 100644 --- a/Podfile +++ b/Podfile @@ -60,6 +60,11 @@ abstract_target 'RiotPods' do pod 'GBDeviceInfo', '~> 4.4.0' + # Piwik for analytics + # While https://github.com/matomo-org/matomo-sdk-ios/pull/223 is not accepted, use the PR branch + pod 'PiwikTracker', :git => 'https://github.com/manuroe/matomo-sdk-ios.git', :branch => 'feature/CustomVariables' + #pod 'PiwikTracker', '~> 4.4.2' + # OLMKit for crypto pod 'OLMKit' #pod 'OLMKit', :path => '../olm/OLMKit.podspec' @@ -93,6 +98,7 @@ post_install do |installer| installer.pods_project.targets.each do |target| target.build_configurations.each do |config| config.build_settings['ENABLE_BITCODE'] = 'NO' + config.build_settings['SWIFT_VERSION'] = '4.0' # Required for PiwikTracker. Should be removed end end end diff --git a/Riot.xcodeproj/project.pbxproj b/Riot.xcodeproj/project.pbxproj index 526fcb07c0..ee821f9ca3 100755 --- a/Riot.xcodeproj/project.pbxproj +++ b/Riot.xcodeproj/project.pbxproj @@ -3390,6 +3390,7 @@ "${BUILT_PRODUCTS_DIR}/MatrixKit/MatrixKit.framework", "${BUILT_PRODUCTS_DIR}/MatrixSDK/MatrixSDK.framework", "${BUILT_PRODUCTS_DIR}/OLMKit/OLMKit.framework", + "${BUILT_PRODUCTS_DIR}/PiwikTracker/PiwikTracker.framework", "${BUILT_PRODUCTS_DIR}/Realm/Realm.framework", "${PODS_ROOT}/WebRTC/WebRTC.framework", "${BUILT_PRODUCTS_DIR}/cmark/cmark.framework", @@ -3408,6 +3409,7 @@ "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/MatrixKit.framework", "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/MatrixSDK.framework", "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/OLMKit.framework", + "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/PiwikTracker.framework", "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/Realm.framework", "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/WebRTC.framework", "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/cmark.framework", diff --git a/Riot/AppDelegate.m b/Riot/AppDelegate.m index 0b9aabff9b..020ace4af3 100644 --- a/Riot/AppDelegate.m +++ b/Riot/AppDelegate.m @@ -45,6 +45,8 @@ #include +@import PiwikTracker; + // Calls #import "CallViewController.h" @@ -548,9 +550,8 @@ - (void)applicationDidEnterBackground:(UIApplication *)application _isAppForeground = NO; - // GA: End a session while the app is in background - // @TODO -// [[[GAI sharedInstance] defaultTracker] set:kGAISessionControl value:@"end"]; + // Analytics: Force to send the pending actions + [[PiwikTracker shared] dispatch]; } - (void)applicationWillEnterForeground:(UIApplication *)application @@ -645,8 +646,6 @@ - (void)applicationWillTerminate:(UIApplication *)application { NSLog(@"[AppDelegate] applicationWillTerminate"); // Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:. - - [self stopAnalytics]; } - (void)applicationDidReceiveMemoryWarning:(UIApplication *)application @@ -1003,75 +1002,65 @@ - (void)navigationController:(UINavigationController *)navigationController didS - (void)startAnalytics { + NSDictionary *piwikConfig = [[NSUserDefaults standardUserDefaults] objectForKey:@"piwik"]; + [PiwikTracker configureSharedInstanceWithSiteID:piwikConfig[@"siteId"] + baseURL:[NSURL URLWithString:piwikConfig[@"url"]] + userAgent:@"iOSPiwikTracker"]; + // Check whether the user has enabled the sending of crash reports. if ([[NSUserDefaults standardUserDefaults] boolForKey:@"enableCrashReport"]) { - // @TODO -// // Retrieve trackerId from GoogleService-Info.plist. -// NSString *googleServiceInfoPath = [[NSBundle mainBundle] pathForResource:@"GoogleService-Info" ofType:@"plist"]; -// NSDictionary *googleServiceInfo = [NSDictionary dictionaryWithContentsOfFile:googleServiceInfoPath]; -// NSString *gaTrackingID = [googleServiceInfo objectForKey:@"TRACKING_ID"]; -// if (gaTrackingID) -// { -// // Catch and log crashes -// [MXLogger logCrashes:YES]; -// [MXLogger setBuildVersion:[AppDelegate theDelegate].build]; -// -// // Configure GAI options. -// GAI *gai = [GAI sharedInstance]; -// -// // Disable GA UncaughtException: their crash reports are quite limited (100 first chars of the stack trace) -// // Let's MXLogger manage them -// gai.trackUncaughtExceptions = NO; -// -// // Initialize it with the app tracker ID -// [gai trackerWithTrackingId:gaTrackingID]; -// -// // Set Google Analytics dispatch interval to e.g. 20 seconds. -// gai.dispatchInterval = 20; -// -//#ifdef DEBUG -// // Disable GAI in debug as it pollutes stats and crashes in GA -// gai.dryRun = YES; -//#endif -// } -// else -// { -// NSLog(@"[AppDelegate] Unable to find tracker id for Google Analytics"); -// } + [PiwikTracker shared].isOptedOut = NO; + + [[PiwikTracker shared] setCustomVariableWithIndex:1 name:@"App Platform" value:@"iOS Platform"]; + [[PiwikTracker shared] setCustomVariableWithIndex:2 name:@"App Version" value:[self appVersion]]; + + // The language is either the one selected by the user within the app + // or, else, the one configured by the OS + NSString *language = [NSBundle mxk_language] ? [NSBundle mxk_language] : [[NSBundle mainBundle] preferredLocalizations][0]; + [[PiwikTracker shared] setCustomVariableWithIndex:4 name:@"Chosen Language" value:language]; + + MXKAccount* account = [MXKAccountManager sharedManager].activeAccounts.firstObject; + if (account) + { + [[PiwikTracker shared] setCustomVariableWithIndex:7 name:@"Homeserver URL" value:account.mxCredentials.homeServer]; + [[PiwikTracker shared] setCustomVariableWithIndex:8 name:@"Identity Server URL" value:account.identityServerURL]; + } + + // TODO: We should also track device and os version + // But that needs to be decided for all platforms + + // Catch and log crashes + [MXLogger logCrashes:YES]; + [MXLogger setBuildVersion:[AppDelegate theDelegate].build]; + +#ifdef DEBUG + // Disable analytics in debug as it pollutes stats + [PiwikTracker shared].isOptedOut = YES; +#endif } else if ([[NSUserDefaults standardUserDefaults] objectForKey:@"enableCrashReport"]) { - NSLog(@"[AppDelegate] The user decides to do not use Google Analytics"); + NSLog(@"[AppDelegate] The user decided to not "); + [PiwikTracker shared].isOptedOut = YES; + [MXLogger logCrashes:NO]; } } - (void)stopAnalytics { - // @TODO -// GAI *gai = [GAI sharedInstance]; -// -// // End a session. The next hit from this tracker will be the last in the current session. -// [[gai defaultTracker] set:kGAISessionControl value:@"end"]; -// -// // Flush pending GA messages -// [gai dispatch]; -// -// [gai removeTrackerByName:[gai defaultTracker].name]; - + [PiwikTracker shared].isOptedOut = YES; [MXLogger logCrashes:NO]; } - (void)trackScreen:(NSString *)screenName { - // @TODO -// // Screen tracking (via Google Analytics) -// id tracker = [[GAI sharedInstance] defaultTracker]; -// if (tracker) -// { -// [tracker set:kGAIScreenName value:screenName]; -// [tracker send:[[GAIDictionaryBuilder createScreenView] build]]; -// } + // Use the same URL pattern as Android + NSString *appName = [[[NSBundle mainBundle] infoDictionary] objectForKey:@"CFBundleDisplayName"]; + NSString *appVersion = [self appVersion]; + NSURL *url = [NSURL URLWithString:[NSString stringWithFormat:@"/ios/%@/%@/%@", appName, appVersion, screenName]]; + + [[PiwikTracker shared] trackWithView:@[screenName] url:url]; } // Check if there is a crash log to send to server @@ -1092,21 +1081,9 @@ - (void)checkExceptionToReport usedEncoding:nil error:nil]; - NSLog(@"[AppDelegate] Send crash log to Google Analytics:\n%@", description); + NSLog(@"[AppDelegate] Promt user to report crash:\n%@", description); - // @TODO - // Send it via Google Analytics - // The doc says the exception description must not exceeed 100 chars but it seems - // to accept much more. - // https://developers.google.com/analytics/devguides/collection/ios/v3/exceptions#overview -// id tracker = [[GAI sharedInstance] defaultTracker]; -// [tracker send:[[GAIDictionaryBuilder -// createExceptionWithDescription:description -// withFatal:[NSNumber numberWithBool:YES]] build]]; -// [[GAI sharedInstance] dispatch]; - - // Ask the user to send a crash report by email too - // The email will provide logs and thus more context to the crash + // Ask the user to send a crash report [[RageShakeManager sharedManager] promptCrashReportInViewController:self.window.rootViewController]; } } diff --git a/Riot/Riot-Defaults.plist b/Riot/Riot-Defaults.plist index 34452a887d..cb890974a9 100644 --- a/Riot/Riot-Defaults.plist +++ b/Riot/Riot-Defaults.plist @@ -30,6 +30,13 @@ https://scalar-staging.riot.im/scalar-web/ integrationsRestUrl https://scalar-staging.riot.im/scalar/api + piwik + + url + https://piwik.riot.im/ + siteId + 1 + showAllEventsInRoomHistory showRedactionsInRoomHistory From ce18f02301a97a271655b239b0870c068de41fc0 Mon Sep 17 00:00:00 2001 From: manuroe Date: Mon, 29 Jan 2018 16:30:20 +0100 Subject: [PATCH 04/10] Piwik: Remove @TODO --- Riot/AppDelegate.m | 20 +++----------------- 1 file changed, 3 insertions(+), 17 deletions(-) diff --git a/Riot/AppDelegate.m b/Riot/AppDelegate.m index 020ace4af3..a3ff2aa159 100644 --- a/Riot/AppDelegate.m +++ b/Riot/AppDelegate.m @@ -568,10 +568,6 @@ - (void)applicationWillEnterForeground:(UIApplication *)application // Called as part of the transition from the background to the inactive state; here you can undo many of the changes made on entering the background. _isAppForeground = YES; - - // GA: Start a new session. The next hit from this tracker will be the first in a new session. - // @TODO -// [[[GAI sharedInstance] defaultTracker] set:kGAISessionControl value:@"start"]; } - (void)applicationDidBecomeActive:(UIApplication *)application @@ -2104,9 +2100,6 @@ - (void)initMatrixSessions // Disable identicon use sdkOptions.disableIdenticonUseForUserAvatar = YES; - // Enable SDK stats upload to GA - sdkOptions.enableGoogleAnalytics = YES; - // Use UIKit BackgroundTask for handling background tasks in the SDK sdkOptions.backgroundModeHandler = [[MXUIKitBackgroundModeHandler alloc] init]; @@ -2702,16 +2695,9 @@ - (void)handleLaunchAnimation { NSTimeInterval durationMs = [[NSDate date] timeIntervalSinceDate:launchAnimationStart] * 1000; NSLog(@"[AppDelegate] LaunchAnimation was shown for %.3fms", durationMs); - - if ([MXSDKOptions sharedInstance].enableGoogleAnalytics) - { - // @TODO -// id tracker = [[GAI sharedInstance] defaultTracker]; -// [tracker send:[[GAIDictionaryBuilder createTimingWithCategory:kMXGoogleAnalyticsStartupCategory -// interval:@((int)durationMs) -// name:kMXGoogleAnalyticsStartupLaunchScreen -// label:nil] build]]; - } + + // TODO: Send durationMs to Piwik + // Such information should be the same on all platforms [launchAnimationContainerView removeFromSuperview]; launchAnimationContainerView = nil; From 76aa765dc25e45ace2127a0a75c7a06d7d272268 Mon Sep 17 00:00:00 2001 From: manuroe Date: Tue, 30 Jan 2018 08:35:29 +0100 Subject: [PATCH 05/10] Piwik: our PR on Piwik now just need to be released --- Riot/AppDelegate.m | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Riot/AppDelegate.m b/Riot/AppDelegate.m index a3ff2aa159..828c7339d1 100644 --- a/Riot/AppDelegate.m +++ b/Riot/AppDelegate.m @@ -1032,7 +1032,7 @@ - (void)startAnalytics #ifdef DEBUG // Disable analytics in debug as it pollutes stats - [PiwikTracker shared].isOptedOut = YES; + // [PiwikTracker shared].isOptedOut = YES; #endif } else if ([[NSUserDefaults standardUserDefaults] objectForKey:@"enableCrashReport"]) From 0bd7c1117d6f9a82aa9a29359532b823232a48dd Mon Sep 17 00:00:00 2001 From: manuroe Date: Tue, 30 Jan 2018 08:36:52 +0100 Subject: [PATCH 06/10] Piwik: our PR on Piwik now just need to be released --- Podfile | 2 +- Riot/AppDelegate.m | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Podfile b/Podfile index ffb2540b4c..0ec08561bc 100644 --- a/Podfile +++ b/Podfile @@ -61,7 +61,7 @@ abstract_target 'RiotPods' do pod 'GBDeviceInfo', '~> 4.4.0' # Piwik for analytics - # While https://github.com/matomo-org/matomo-sdk-ios/pull/223 is not accepted, use the PR branch + # While https://github.com/matomo-org/matomo-sdk-ios/pull/223 is not released, use the PR branch pod 'PiwikTracker', :git => 'https://github.com/manuroe/matomo-sdk-ios.git', :branch => 'feature/CustomVariables' #pod 'PiwikTracker', '~> 4.4.2' diff --git a/Riot/AppDelegate.m b/Riot/AppDelegate.m index 828c7339d1..a3ff2aa159 100644 --- a/Riot/AppDelegate.m +++ b/Riot/AppDelegate.m @@ -1032,7 +1032,7 @@ - (void)startAnalytics #ifdef DEBUG // Disable analytics in debug as it pollutes stats - // [PiwikTracker shared].isOptedOut = YES; + [PiwikTracker shared].isOptedOut = YES; #endif } else if ([[NSUserDefaults standardUserDefaults] objectForKey:@"enableCrashReport"]) From 19cfd3b9d0fb2fe748217d25aa77ee48facda359 Mon Sep 17 00:00:00 2001 From: manuroe Date: Tue, 30 Jan 2018 15:10:26 +0100 Subject: [PATCH 07/10] Piwik: Point to the piwik API URL, not the site landing page --- Riot/Riot-Defaults.plist | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Riot/Riot-Defaults.plist b/Riot/Riot-Defaults.plist index cb890974a9..a8590fe540 100644 --- a/Riot/Riot-Defaults.plist +++ b/Riot/Riot-Defaults.plist @@ -33,7 +33,7 @@ piwik url - https://piwik.riot.im/ + https://piwik.riot.im/piwik.php siteId 1 From d4f929b3dc936631c21802c2e4c67dd1df386a45 Mon Sep 17 00:00:00 2001 From: manuroe Date: Wed, 31 Jan 2018 09:46:24 +0100 Subject: [PATCH 08/10] Piwik: Podfile: set the right identity for frameworks to be able to make release builds See https://github.com/CocoaPods/CocoaPods/issues/3156#issuecomment-102022787 --- Podfile | 27 +++++++++++++++++++-------- 1 file changed, 19 insertions(+), 8 deletions(-) diff --git a/Podfile b/Podfile index 0ec08561bc..62aacc4b0d 100644 --- a/Podfile +++ b/Podfile @@ -91,15 +91,26 @@ abstract_target 'RiotPods' do end -# Disable bitcode for each pod framework -# Because the WebRTC pod (included by the JingleCallStack pod) does not support it. -# Plus the app does not enable it post_install do |installer| - installer.pods_project.targets.each do |target| - target.build_configurations.each do |config| - config.build_settings['ENABLE_BITCODE'] = 'NO' - config.build_settings['SWIFT_VERSION'] = '4.0' # Required for PiwikTracker. Should be removed + installer.pods_project.targets.each do |target| + + # Disable bitcode for each pod framework + # Because the WebRTC pod (included by the JingleCallStack pod) does not support it. + # Plus the app does not enable it + target.build_configurations.each do |config| + config.build_settings['ENABLE_BITCODE'] = 'NO' + config.build_settings['SWIFT_VERSION'] = '4.0' # Required for PiwikTracker. Should be removed + end + + # Set the right identity to build pods frameworks to be able to make release builds + # See https://github.com/CocoaPods/CocoaPods/issues/3156#issuecomment-102022787 + if target.to_s.include? 'Pods' + target.build_configurations.each do |config| + if !config.to_s.include? 'Debug' + config.build_settings['CODE_SIGN_IDENTITY[sdk=iphoneos*]'] = 'iPhone Distribution' + end + end + end end - end end From 2f29f67a3e652cbaffbe3465b21632f3dc6e35c4 Mon Sep 17 00:00:00 2001 From: manuroe Date: Wed, 31 Jan 2018 17:28:29 +0100 Subject: [PATCH 09/10] Podfile: matrix-ios-sdk now enables crypto by default --- Podfile | 5 ----- 1 file changed, 5 deletions(-) diff --git a/Podfile b/Podfile index 62aacc4b0d..bc5180a476 100644 --- a/Podfile +++ b/Podfile @@ -65,11 +65,6 @@ abstract_target 'RiotPods' do pod 'PiwikTracker', :git => 'https://github.com/manuroe/matomo-sdk-ios.git', :branch => 'feature/CustomVariables' #pod 'PiwikTracker', '~> 4.4.2' - # OLMKit for crypto - pod 'OLMKit' - #pod 'OLMKit', :path => '../olm/OLMKit.podspec' - pod 'Realm', '~> 3.0.1' - # Remove warnings from "bad" pods pod 'OLMKit', :inhibit_warnings => true pod 'cmark', :inhibit_warnings => true From b2cd69453374127d680d0d2edb0133e659cf3965 Mon Sep 17 00:00:00 2001 From: manuroe Date: Wed, 31 Jan 2018 18:20:11 +0100 Subject: [PATCH 10/10] Piwik: Fix screen tracking --- Riot/AppDelegate.m | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Riot/AppDelegate.m b/Riot/AppDelegate.m index a3ff2aa159..09818f89b2 100644 --- a/Riot/AppDelegate.m +++ b/Riot/AppDelegate.m @@ -1051,12 +1051,12 @@ - (void)stopAnalytics - (void)trackScreen:(NSString *)screenName { - // Use the same URL pattern as Android + // Use the same pattern as Android NSString *appName = [[[NSBundle mainBundle] infoDictionary] objectForKey:@"CFBundleDisplayName"]; NSString *appVersion = [self appVersion]; - NSURL *url = [NSURL URLWithString:[NSString stringWithFormat:@"/ios/%@/%@/%@", appName, appVersion, screenName]]; - [[PiwikTracker shared] trackWithView:@[screenName] url:url]; + [[PiwikTracker shared] trackWithView:@[@"ios", appName, appVersion, screenName] + url:nil]; } // Check if there is a crash log to send to server