mirror of
https://github.com/vector-im/element-ios.git
synced 2024-09-28 23:32:41 +00:00
Remove cocoapods-keys. Use UUID for analytics.
Make configuration optional.
This commit is contained in:
parent
23555b00fd
commit
46d264477d
8 changed files with 15 additions and 35 deletions
|
@ -166,8 +166,10 @@ final class BuildSettings: NSObject {
|
||||||
|
|
||||||
// MARK: - Analytics
|
// MARK: - Analytics
|
||||||
#warning("Testing environment.")
|
#warning("Testing environment.")
|
||||||
static let analyticsHost = "https://posthog-poc.lab.element.dev"
|
// Optional host for PostHog analytics. Set to nil to disable analytics.
|
||||||
static let analyticsAppId = "14"
|
static let analyticsHost: String? = "https://posthog-poc.lab.element.dev"
|
||||||
|
// Public key for submitting analytics. Set to nil to disable analytics.
|
||||||
|
static let analyticsKey: String? = "rs-pJjsYJTuAkXJfhaMmPUNBhWliDyTKLOOxike6ck8"
|
||||||
|
|
||||||
|
|
||||||
// MARK: - Bug report
|
// MARK: - Bug report
|
||||||
|
|
1
Gemfile
1
Gemfile
|
@ -3,7 +3,6 @@ source "https://rubygems.org"
|
||||||
gem "xcode-install"
|
gem "xcode-install"
|
||||||
gem "fastlane"
|
gem "fastlane"
|
||||||
gem "cocoapods", '~>1.11.2'
|
gem "cocoapods", '~>1.11.2'
|
||||||
gem "cocoapods-keys"
|
|
||||||
|
|
||||||
plugins_path = File.join(File.dirname(__FILE__), 'fastlane', 'Pluginfile')
|
plugins_path = File.join(File.dirname(__FILE__), 'fastlane', 'Pluginfile')
|
||||||
eval_gemfile(plugins_path) if File.exist?(plugins_path)
|
eval_gemfile(plugins_path) if File.exist?(plugins_path)
|
||||||
|
|
11
Gemfile.lock
11
Gemfile.lock
|
@ -3,9 +3,6 @@ GEM
|
||||||
specs:
|
specs:
|
||||||
CFPropertyList (3.0.4)
|
CFPropertyList (3.0.4)
|
||||||
rexml
|
rexml
|
||||||
RubyInline (3.12.5)
|
|
||||||
ZenTest (~> 4.3)
|
|
||||||
ZenTest (4.12.0)
|
|
||||||
activesupport (6.1.4.1)
|
activesupport (6.1.4.1)
|
||||||
concurrent-ruby (~> 1.0, >= 1.0.2)
|
concurrent-ruby (~> 1.0, >= 1.0.2)
|
||||||
i18n (>= 1.6, < 2)
|
i18n (>= 1.6, < 2)
|
||||||
|
@ -67,9 +64,6 @@ GEM
|
||||||
typhoeus (~> 1.0)
|
typhoeus (~> 1.0)
|
||||||
cocoapods-deintegrate (1.0.5)
|
cocoapods-deintegrate (1.0.5)
|
||||||
cocoapods-downloader (1.5.1)
|
cocoapods-downloader (1.5.1)
|
||||||
cocoapods-keys (2.2.1)
|
|
||||||
dotenv
|
|
||||||
osx_keychain
|
|
||||||
cocoapods-plugins (1.0.0)
|
cocoapods-plugins (1.0.0)
|
||||||
nap
|
nap
|
||||||
cocoapods-search (1.0.1)
|
cocoapods-search (1.0.1)
|
||||||
|
@ -231,8 +225,6 @@ GEM
|
||||||
netrc (0.11.0)
|
netrc (0.11.0)
|
||||||
optparse (0.1.1)
|
optparse (0.1.1)
|
||||||
os (1.1.1)
|
os (1.1.1)
|
||||||
osx_keychain (1.0.2)
|
|
||||||
RubyInline (~> 3)
|
|
||||||
plist (3.6.0)
|
plist (3.6.0)
|
||||||
public_suffix (4.0.6)
|
public_suffix (4.0.6)
|
||||||
rake (13.0.6)
|
rake (13.0.6)
|
||||||
|
@ -300,7 +292,6 @@ PLATFORMS
|
||||||
|
|
||||||
DEPENDENCIES
|
DEPENDENCIES
|
||||||
cocoapods (~> 1.11.2)
|
cocoapods (~> 1.11.2)
|
||||||
cocoapods-keys
|
|
||||||
fastlane
|
fastlane
|
||||||
fastlane-plugin-diawi
|
fastlane-plugin-diawi
|
||||||
fastlane-plugin-versioning
|
fastlane-plugin-versioning
|
||||||
|
@ -308,4 +299,4 @@ DEPENDENCIES
|
||||||
xcode-install
|
xcode-install
|
||||||
|
|
||||||
BUNDLED WITH
|
BUNDLED WITH
|
||||||
2.2.28
|
2.2.31
|
||||||
|
|
5
Podfile
5
Podfile
|
@ -127,11 +127,6 @@ abstract_target 'RiotPods' do
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
plugin 'cocoapods-keys', {
|
|
||||||
:project => "Riot",
|
|
||||||
:keys => ["PostHog"]
|
|
||||||
}
|
|
||||||
|
|
||||||
post_install do |installer|
|
post_install do |installer|
|
||||||
installer.pods_project.targets.each do |target|
|
installer.pods_project.targets.each do |target|
|
||||||
|
|
||||||
|
|
|
@ -48,7 +48,6 @@ PODS:
|
||||||
- Introspect (0.1.3)
|
- Introspect (0.1.3)
|
||||||
- JitsiMeetSDK (3.10.2)
|
- JitsiMeetSDK (3.10.2)
|
||||||
- KeychainAccess (4.2.2)
|
- KeychainAccess (4.2.2)
|
||||||
- Keys (1.0.1)
|
|
||||||
- KituraContracts (1.2.1):
|
- KituraContracts (1.2.1):
|
||||||
- LoggerAPI (~> 1.7)
|
- LoggerAPI (~> 1.7)
|
||||||
- KTCenterFlowLayout (1.3.1)
|
- KTCenterFlowLayout (1.3.1)
|
||||||
|
@ -123,7 +122,6 @@ DEPENDENCIES:
|
||||||
- GBDeviceInfo (~> 6.6.0)
|
- GBDeviceInfo (~> 6.6.0)
|
||||||
- Introspect (~> 0.1)
|
- Introspect (~> 0.1)
|
||||||
- KeychainAccess (~> 4.2.2)
|
- KeychainAccess (~> 4.2.2)
|
||||||
- Keys (from `Pods/CocoaPodsKeys`)
|
|
||||||
- KTCenterFlowLayout (~> 1.3.1)
|
- KTCenterFlowLayout (~> 1.3.1)
|
||||||
- MatrixKit (= 0.16.10)
|
- MatrixKit (= 0.16.10)
|
||||||
- MatrixSDK
|
- MatrixSDK
|
||||||
|
@ -184,10 +182,6 @@ SPEC REPOS:
|
||||||
- zxcvbn-ios
|
- zxcvbn-ios
|
||||||
- ZXingObjC
|
- ZXingObjC
|
||||||
|
|
||||||
EXTERNAL SOURCES:
|
|
||||||
Keys:
|
|
||||||
:path: Pods/CocoaPodsKeys
|
|
||||||
|
|
||||||
SPEC CHECKSUMS:
|
SPEC CHECKSUMS:
|
||||||
AFNetworking: 7864c38297c79aaca1500c33288e429c3451fdce
|
AFNetworking: 7864c38297c79aaca1500c33288e429c3451fdce
|
||||||
BlueCryptor: b0aee3d9b8f367b49b30de11cda90e1735571c24
|
BlueCryptor: b0aee3d9b8f367b49b30de11cda90e1735571c24
|
||||||
|
@ -207,7 +201,6 @@ SPEC CHECKSUMS:
|
||||||
Introspect: 2be020f30f084ada52bb4387fff83fa52c5c400e
|
Introspect: 2be020f30f084ada52bb4387fff83fa52c5c400e
|
||||||
JitsiMeetSDK: 2f118fa770f23e518f3560fc224fae3ac7062223
|
JitsiMeetSDK: 2f118fa770f23e518f3560fc224fae3ac7062223
|
||||||
KeychainAccess: c0c4f7f38f6fc7bbe58f5702e25f7bd2f65abf51
|
KeychainAccess: c0c4f7f38f6fc7bbe58f5702e25f7bd2f65abf51
|
||||||
Keys: a576f4c9c1c641ca913a959a9c62ed3f215a8de9
|
|
||||||
KituraContracts: e845e60dc8627ad0a76fa55ef20a45451d8f830b
|
KituraContracts: e845e60dc8627ad0a76fa55ef20a45451d8f830b
|
||||||
KTCenterFlowLayout: 6e02b50ab2bd865025ae82fe266ed13b6d9eaf97
|
KTCenterFlowLayout: 6e02b50ab2bd865025ae82fe266ed13b6d9eaf97
|
||||||
libbase58: 7c040313537b8c44b6e2d15586af8e21f7354efd
|
libbase58: 7c040313537b8c44b6e2d15586af8e21f7354efd
|
||||||
|
@ -231,6 +224,6 @@ SPEC CHECKSUMS:
|
||||||
zxcvbn-ios: fef98b7c80f1512ff0eec47ac1fa399fc00f7e3c
|
zxcvbn-ios: fef98b7c80f1512ff0eec47ac1fa399fc00f7e3c
|
||||||
ZXingObjC: fdbb269f25dd2032da343e06f10224d62f537bdb
|
ZXingObjC: fdbb269f25dd2032da343e06f10224d62f537bdb
|
||||||
|
|
||||||
PODFILE CHECKSUM: 6d24497e38de7332dbb2c2ff21ad7ed8090c81de
|
PODFILE CHECKSUM: 06d0fee10c99dee2531993f8cb2e54ec04f0752b
|
||||||
|
|
||||||
COCOAPODS: 1.11.2
|
COCOAPODS: 1.11.2
|
||||||
|
|
|
@ -71,7 +71,10 @@ import PostHog
|
||||||
func startIfEnabled() {
|
func startIfEnabled() {
|
||||||
guard RiotSettings.shared.enableAnalytics, !isRunning else { return }
|
guard RiotSettings.shared.enableAnalytics, !isRunning else { return }
|
||||||
|
|
||||||
postHog = PHGPostHog(configuration: PHGPostHogConfiguration.standard)
|
// Ensures that analytics are configured BuildSettings
|
||||||
|
guard let configuration = PHGPostHogConfiguration.standard else { return }
|
||||||
|
|
||||||
|
postHog = PHGPostHog(configuration: configuration)
|
||||||
postHog?.enable()
|
postHog?.enable()
|
||||||
MXLog.debug("[Analytics] Started.")
|
MXLog.debug("[Analytics] Started.")
|
||||||
|
|
||||||
|
|
|
@ -35,11 +35,7 @@ struct AnalyticsSettings {
|
||||||
/// Generate a new random analytics ID. This method has no effect if an ID already exists.
|
/// Generate a new random analytics ID. This method has no effect if an ID already exists.
|
||||||
mutating func generateID() {
|
mutating func generateID() {
|
||||||
guard id == nil else { return }
|
guard id == nil else { return }
|
||||||
|
id = UUID().uuidString
|
||||||
// Generate a 32 character analytics ID containing the characters 0-f.
|
|
||||||
id = [UInt8](repeating: 0, count: 16)
|
|
||||||
.map { _ in String(format: "%02x", UInt8.random(in: 0...UInt8.max)) }
|
|
||||||
.joined()
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -15,11 +15,12 @@
|
||||||
//
|
//
|
||||||
|
|
||||||
import PostHog
|
import PostHog
|
||||||
import Keys
|
|
||||||
|
|
||||||
extension PHGPostHogConfiguration {
|
extension PHGPostHogConfiguration {
|
||||||
static var standard: PHGPostHogConfiguration {
|
static var standard: PHGPostHogConfiguration? {
|
||||||
let configuration = PHGPostHogConfiguration(apiKey: RiotKeys().postHog, host: BuildSettings.analyticsHost)
|
guard let apiKey = BuildSettings.analyticsKey, let host = BuildSettings.analyticsHost else { return nil }
|
||||||
|
|
||||||
|
let configuration = PHGPostHogConfiguration(apiKey: apiKey, host: host)
|
||||||
configuration.shouldSendDeviceID = false
|
configuration.shouldSendDeviceID = false
|
||||||
|
|
||||||
return configuration
|
return configuration
|
||||||
|
|
Loading…
Reference in a new issue