Skip to content

Commit

Permalink
Add ability to track user actions via method channel, merge latest
Browse files Browse the repository at this point in the history
  • Loading branch information
atavism committed Aug 30, 2023
1 parent acc1676 commit 1df0a1f
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 4 deletions.
6 changes: 3 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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"

Expand Down Expand Up @@ -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)

Expand Down
4 changes: 4 additions & 0 deletions android/app/src/main/kotlin/io/lantern/model/SessionModel.kt
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -157,6 +158,9 @@ class SessionModel(
activity.startActivity(intent)
}
}
"trackUserAction" -> {
Datadog.trackUserClick(call.argument("message")!!)
}
"acceptTerms" -> {
LanternApp.getSession().acceptTerms()
}
Expand Down
2 changes: 1 addition & 1 deletion lib/account/split_tunneling.dart
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ class _SplitTunnelingState extends State<SplitTunneling> {

void init() async {
unawaited(sessionModel.refreshAppsList());
await sessionModel.trackUserAction('Split tunneling screen shown to user');
var _vpnConnected = await vpnModel.isVpnConnected();
setState(() {
vpnConnected = _vpnConnected;
Expand All @@ -33,7 +34,6 @@ class _SplitTunnelingState extends State<SplitTunneling> {

@override
Widget build(BuildContext context) {
Datadog.trackUserCustom('Split tunneling screen shown to user');
return BaseScreen(
title: 'split_tunneling'.i18n,
body: sessionModel.splitTunneling(
Expand Down
8 changes: 8 additions & 0 deletions lib/common/session_model.dart
Original file line number Diff line number Diff line change
Expand Up @@ -345,6 +345,14 @@ class SessionModel extends Model {
);
}

Future<void> trackUserAction(
String message,
) async {
return methodChannel.invokeMethod('trackUserAction', <String, dynamic>{
'message': message,
});
}

Future<void> redeemResellerCode(
String email,
String resellerCode,
Expand Down

0 comments on commit 1df0a1f

Please sign in to comment.