Skip to content

Commit 1149c04

Browse files
committed
add checkout finish/abort by user telemetry
1 parent 14acf4f commit 1149c04

File tree

4 files changed

+15
-2
lines changed

4 files changed

+15
-2
lines changed

build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ allprojects {
2424
}
2525

2626
project.ext {
27-
sdkVersion='0.9.0-beta5'
27+
sdkVersion='0.9.0-beta6'
2828
versionCode=1
2929

3030
compileSdkVersion=28

ui-integration/src/main/java/io/snabble/sdk/ui/integration/CheckoutFragment.java

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,9 @@
66
import android.view.View;
77
import android.view.ViewGroup;
88

9+
import io.snabble.sdk.Checkout;
910
import io.snabble.sdk.ui.SnabbleUI;
11+
import io.snabble.sdk.ui.telemetry.Telemetry;
1012

1113
public class CheckoutFragment extends Fragment {
1214
@Override
@@ -18,6 +20,12 @@ public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle sa
1820
public void onDestroyView() {
1921
super.onDestroyView();
2022

21-
SnabbleUI.getProject().getCheckout().cancel();
23+
Checkout checkout = SnabbleUI.getProject().getCheckout();
24+
checkout.cancel();
25+
26+
if(checkout.getState() != Checkout.State.PAYMENT_APPROVED
27+
&& checkout.getState() != Checkout.State.NONE) {
28+
Telemetry.event(Telemetry.Event.CheckoutAbortByUser);
29+
}
2230
}
2331
}

ui/src/main/java/io/snabble/sdk/ui/checkout/CheckoutEncodedCodesView.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@
2525
import io.snabble.sdk.ui.SnabbleUICallback;
2626
import io.snabble.sdk.ui.scanner.BarcodeFormat;
2727
import io.snabble.sdk.ui.scanner.BarcodeView;
28+
import io.snabble.sdk.ui.telemetry.Telemetry;
2829

2930
class CheckoutEncodedCodesView extends FrameLayout implements View.OnLayoutChangeListener {
3031
private static final int MAX_CHARS = 2953; // qr-code 8 bit max
@@ -69,6 +70,8 @@ public void onClick(View v) {
6970
if (uiCallback != null) {
7071
uiCallback.showMainscreen();
7172
}
73+
74+
Telemetry.event(Telemetry.Event.CheckoutFinishByUser);
7275
}
7376
});
7477

ui/src/main/java/io/snabble/sdk/ui/telemetry/Telemetry.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@ public enum Event {
99
CheckoutSuccessful,
1010
CheckoutDeniedBySupervisor,
1111
CheckoutDeniedByPaymentProvider,
12+
CheckoutFinishByUser,
13+
CheckoutAbortByUser,
1214
ManuallyEnteredProduct,
1315
ScannedProduct,
1416
ScannedOnlineProduct,

0 commit comments

Comments
 (0)