From 1df0a1fe7ade0c97c8eac12343176c21558ae636 Mon Sep 17 00:00:00 2001 From: atavism Date: Wed, 30 Aug 2023 01:05:16 -0700 Subject: [PATCH] Add ability to track user actions via method channel, merge latest --- Makefile | 6 +++--- .../app/src/main/kotlin/io/lantern/model/SessionModel.kt | 4 ++++ lib/account/split_tunneling.dart | 2 +- lib/common/session_model.dart | 8 ++++++++ 4 files changed, 16 insertions(+), 4 deletions(-) diff --git a/Makefile b/Makefile index 4b6167b82..2d2944606 100644 --- a/Makefile +++ b/Makefile @@ -298,6 +298,8 @@ vault-secret-base64: dart-defines-debug: @DART_DEFINES=$(shell make vault-secret-base64 VAULT_FIELD=INTERSTITIAL_AD_UNIT_ID VAULT_PATH=secret/googleAds); \ + DART_DEFINES+=$(shell printf ',' && make vault-secret-base64 VAULT_FIELD=DD_APPLICATION_ID VAULT_PATH=secret/apps/datadog/android); \ + DART_DEFINES+=$(shell printf ',' && make vault-secret-base64 VAULT_FIELD=DD_CLIENT_TOKEN VAULT_PATH=secret/apps/datadog/android); \ DART_DEFINES+=",$(CIBASE)"; \ echo "$$DART_DEFINES" @@ -367,9 +369,7 @@ $(MOBILE_BUNDLE): $(MOBILE_SOURCES) $(GO_SOURCES) $(MOBILE_ANDROID_LIB) require- cp $(MOBILE_ANDROID_BUNDLE) $(MOBILE_BUNDLE) android-debug: - DD_APPLICATION_ID=`make vault-secret-application_id` && \ - DD_CLIENT_TOKEN=`make vault-secret-client_token` && \ - make $(MOBILE_DEBUG_APK) + DD_APPLICATION_ID=`make vault-secret-DD_APPLICATION_ID` DD_CLIENT_TOKEN=`make vault-secret-DD_CLIENT_TOKEN` make $(MOBILE_DEBUG_APK) android-release: pubget $(MOBILE_RELEASE_APK) diff --git a/android/app/src/main/kotlin/io/lantern/model/SessionModel.kt b/android/app/src/main/kotlin/io/lantern/model/SessionModel.kt index 9ef39f399..ed0a22e69 100644 --- a/android/app/src/main/kotlin/io/lantern/model/SessionModel.kt +++ b/android/app/src/main/kotlin/io/lantern/model/SessionModel.kt @@ -24,6 +24,7 @@ import org.getlantern.lantern.R import org.getlantern.lantern.activity.FreeKassaActivity_ import org.getlantern.lantern.activity.WebViewActivity_ import org.getlantern.mobilesdk.model.IssueReporter +import org.getlantern.lantern.datadog.Datadog import org.getlantern.lantern.model.LanternHttpClient import org.getlantern.lantern.model.LanternHttpClient.ProCallback import org.getlantern.lantern.model.LanternHttpClient.ProUserCallback @@ -157,6 +158,9 @@ class SessionModel( activity.startActivity(intent) } } + "trackUserAction" -> { + Datadog.trackUserClick(call.argument("message")!!) + } "acceptTerms" -> { LanternApp.getSession().acceptTerms() } diff --git a/lib/account/split_tunneling.dart b/lib/account/split_tunneling.dart index df7770a96..785cff384 100644 --- a/lib/account/split_tunneling.dart +++ b/lib/account/split_tunneling.dart @@ -25,6 +25,7 @@ class _SplitTunnelingState extends State { void init() async { unawaited(sessionModel.refreshAppsList()); + await sessionModel.trackUserAction('Split tunneling screen shown to user'); var _vpnConnected = await vpnModel.isVpnConnected(); setState(() { vpnConnected = _vpnConnected; @@ -33,7 +34,6 @@ class _SplitTunnelingState extends State { @override Widget build(BuildContext context) { - Datadog.trackUserCustom('Split tunneling screen shown to user'); return BaseScreen( title: 'split_tunneling'.i18n, body: sessionModel.splitTunneling( diff --git a/lib/common/session_model.dart b/lib/common/session_model.dart index 427f6a218..406bf81b5 100644 --- a/lib/common/session_model.dart +++ b/lib/common/session_model.dart @@ -345,6 +345,14 @@ class SessionModel extends Model { ); } + Future trackUserAction( + String message, + ) async { + return methodChannel.invokeMethod('trackUserAction', { + 'message': message, + }); + } + Future redeemResellerCode( String email, String resellerCode,