Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
460 commits
Select commit Hold shift + click to select a range
9cb0fef
adds identity resolution to config
Sep 18, 2024
da30daa
minor edits
Sep 18, 2024
19aefde
reverts change
Sep 18, 2024
7d5f184
updates unit tests
Sep 18, 2024
dd12a2e
Merge branch 'feature/itbl-track-anon-user' into evan/MOB-9559-identi…
evantk91 Sep 18, 2024
cc99f2b
addresses unit test
Sep 18, 2024
4e93a7e
updates criterias to criteriaSets in constant
Sep 18, 2024
65b059d
updates unit tests
Sep 18, 2024
0ef6134
MOB-9203 - Add test to validate object created by custom event api calls
megha-iterable Sep 18, 2024
0a57282
Merge branch 'feature/itbl-track-anon-user' into evan/MOB-9583
evantk91 Sep 19, 2024
2d92211
Merge pull request #803 from Iterable/evan/MOB-9583
evantk91 Sep 19, 2024
ad76527
Merge branch 'feature/itbl-track-anon-user' into feature/MOB-9203-Add…
evantk91 Sep 19, 2024
c56ca27
renaming criterias to criteriaSets
Sep 19, 2024
5ae179c
cleanup
Sep 19, 2024
db86ebd
Merge pull request #801 from Iterable/feature/MOB-9203-Add-test-to-va…
evantk91 Sep 19, 2024
da7c725
addresses misnamed parameter
Sep 21, 2024
7671a6d
Merge branch 'feature/itbl-track-anon-user' into evan/MOB-9559-identi…
evantk91 Sep 21, 2024
cd47083
updates unit test
Sep 21, 2024
b6dd04c
updates replay to false for several unit tests
Sep 21, 2024
8966520
refactors setting of merge and replay parameters
Sep 23, 2024
b170464
sets email or user id before event replay occurs
Sep 23, 2024
0dba934
Merge pull request #804 from Iterable/evan/MOB-9519-fix-event-replay
evantk91 Sep 24, 2024
ed8014f
unit test updates
Sep 24, 2024
47297ef
updates unit tests
Sep 24, 2024
74c3262
updates unit tests
Sep 25, 2024
35d585c
updates unit tests
Sep 25, 2024
4794b30
unit test updates
Sep 25, 2024
f3453cb
removes event replay from merging function
Sep 25, 2024
354753e
adds check for user being logged in
Sep 25, 2024
a3a2a7b
correction
Sep 25, 2024
1a6d1ef
MOB-9651 - Add support to check for nested criteria a.b.c
megha-iterable Sep 26, 2024
38c598c
removes identity resolution from tester app
Sep 26, 2024
e3352e1
resolves comments and cleanup
Sep 26, 2024
e21a0ba
Merge pull request #800 from Iterable/evan/MOB-9559-identity-resolution
evantk91 Sep 26, 2024
38abe65
Merge pull request #806 from Iterable/evan/decouple-replay-from-merge
evantk91 Sep 27, 2024
2487af5
Merge branch 'evan/MOB-9620' into feature/itbl-track-anon-user
Sep 27, 2024
4918ace
fixes unit test
Sep 27, 2024
d78987d
Merge branch 'feature/itbl-track-anon-user' into feature/MOB-9651-Add…
evantk91 Sep 27, 2024
e4d4456
adds comments for readability
Sep 30, 2024
804a3a2
Merge pull request #808 from Iterable/feature/MOB-9651-Add-support-to…
evantk91 Sep 30, 2024
92938d8
MOB-9638 - Add handlers for notifying customer app of a newly created…
megha-iterable Sep 30, 2024
96a2e35
Write automated unit tests against Complex criteria
megha-iterable Sep 30, 2024
ed64a9f
Merge pull request #809 from Iterable/feature/MOB-9638-Add-handlers-f…
evantk91 Sep 30, 2024
f847eca
Merge branch 'feature/itbl-track-anon-user' into feature/MOB-9311-Wri…
evantk91 Sep 30, 2024
55b73ff
MOB-9668 - Add support for Nested JSON with Array Criteria Match
megha-iterable Oct 4, 2024
f0e6bf8
adds comments
Oct 4, 2024
e4297d5
removes changes outside of PR
Oct 4, 2024
4d4bd05
minor changes
Oct 4, 2024
9fb6552
Merge pull request #814 from Iterable/bugfix/MOB-9668-Nested-JSON-wit…
evantk91 Oct 4, 2024
ab6f3c8
Merge branch 'feature/itbl-track-anon-user' into feature/MOB-9311-Wri…
evantk91 Oct 8, 2024
b08a251
updates unit tests
Oct 8, 2024
d342619
adds additional passing case
Oct 8, 2024
2bac136
- remove commas in 'jsonString' for valid json
megha-iterable Oct 9, 2024
948c0e8
MOB-9679 - Keep AUT off until consent to track has been granted
megha-iterable Oct 9, 2024
96f1ef2
Merge pull request #810 from Iterable/feature/MOB-9311-Write-automate…
evantk91 Oct 9, 2024
787f9d8
Merge branch 'feature/itbl-track-anon-user' into feature/MOB-9679-Kee…
evantk91 Oct 9, 2024
85209d1
cleanup
Oct 9, 2024
8f0b3dd
Merge pull request #815 from Iterable/feature/MOB-9679-Keep-AUT-off-u…
evantk91 Oct 9, 2024
f25b8a5
adds AUT enablement check
Oct 14, 2024
13c2693
Merge pull request #816 from Iterable/evan/MOB-9931
evantk91 Oct 15, 2024
74781ce
creates separate local storage for user updates
Oct 17, 2024
820e1ef
removes unused import
Oct 18, 2024
01679cd
updates to clear stored user update object
Oct 18, 2024
ca964fc
stashed changes
Oct 21, 2024
13ad6f6
adds update user call and renamed syncEvents function
Oct 21, 2024
cb59505
addresses comments
Oct 21, 2024
8185129
minor updates
Oct 21, 2024
f0359da
Merge pull request #819 from Iterable/evan/MOB-9997-bug-fix-user-upda…
evantk91 Oct 21, 2024
5908010
clears user update when consent is updated
Oct 22, 2024
77cd595
Merge pull request #820 from Iterable/evan/corrections
evantk91 Oct 23, 2024
0e2af59
updates user update aggregation
Oct 23, 2024
3e6aa4a
Merge pull request #822 from Iterable/evan/MOB-10031-user-update-arra…
evantk91 Oct 23, 2024
b6b2025
MOB-9745 - Update mobile SDKs to support fetching a new JWT to use fo…
megha-iterable Oct 23, 2024
0469733
MOB-9716 - single primitive array bug
megha-iterable Oct 24, 2024
cc619ee
renames createAnonymousUser
Oct 24, 2024
1530eb0
Merge pull request #823 from Iterable/bugfix/MOB-9716-single-primitiv…
evantk91 Oct 24, 2024
b3d901e
Merge branch 'feature/itbl-track-anon-user' into evan/MOB-10054
evantk91 Oct 24, 2024
35d7ee0
Merge pull request #824 from Iterable/evan/MOB-10054
evantk91 Oct 24, 2024
d2be9ea
Merge branch 'feature/itbl-track-anon-user' into feature/MOB-9745-Use…
evantk91 Oct 24, 2024
949694f
removes GenerateJWTSucess callback and introduces new function for th…
Oct 28, 2024
6d3cb0d
updates null check for email
Oct 28, 2024
642f59a
adds check for auth handler
Oct 28, 2024
b9b8bde
addresses check
Oct 28, 2024
c8a0c36
updates auth handler check flow
Oct 28, 2024
307dadd
addresses check
Oct 28, 2024
527acc4
restores anonymous user clearing for setEmail
Oct 29, 2024
3062d52
removes sync events call from anonymous user manager
Oct 29, 2024
f1910d4
adds check for merge since return statement added
Oct 29, 2024
c6df5e5
Merge pull request #821 from Iterable/feature/MOB-9745-Use-destinatio…
evantk91 Oct 29, 2024
9027e94
renaming
Oct 30, 2024
dbe6471
Merge pull request #825 from Iterable/evan/MOB-10088-rename-setVisito…
evantk91 Oct 30, 2024
a818e81
renames config to enableAnonActivation
Oct 31, 2024
75f4f21
renames references to config
Oct 31, 2024
cee003c
Merge pull request #826 from Iterable/evan/MOB-10092-rename-config-to…
evantk91 Oct 31, 2024
9bd4618
moves clearing of anon user id
Nov 1, 2024
62bbef3
updates user update parsing
Nov 4, 2024
7782470
minor edit
Nov 4, 2024
2944287
Merge pull request #828 from Iterable/evan/MOB-10098
evantk91 Nov 4, 2024
6662883
removes update user change
Nov 4, 2024
3fa6de3
updates user update processing
Nov 5, 2024
96991ce
minor edits
Nov 5, 2024
3188724
removes return statement in syncEvents
Nov 5, 2024
8d090d2
stashed changes
Nov 5, 2024
592aa7b
removes markdown files
Nov 5, 2024
53fa126
Merge pull request #834 from Iterable/evan/MOB-10119
evantk91 Nov 5, 2024
889b1ac
removes assertion for testing event list
Nov 6, 2024
38d715f
Merge branch 'feature/itbl-track-anon-user' into evan/MOB-10094
evantk91 Nov 6, 2024
dd21046
Merge pull request #827 from Iterable/evan/MOB-10094
evantk91 Nov 6, 2024
a917955
updates testCriteriaMetEmailDefault test
Nov 6, 2024
da62844
updates unit test
Nov 6, 2024
26309f0
renaming
Nov 6, 2024
8df7f13
Merge branch 'feature/itbl-track-anon-user' into evan/MOB-10125
evantk91 Nov 6, 2024
27c9d19
Merge pull request #835 from Iterable/evan/MOB-10125
evantk91 Nov 6, 2024
1e855e3
unit test update
Nov 7, 2024
fbc9e3d
update unit tests
Nov 7, 2024
19883fd
Merge branch 'feature/itbl-track-anon-user' into evan/MOB-10098
evantk91 Nov 7, 2024
3f51428
reverts change
Nov 7, 2024
98cccbc
clears locally stored data when replay is false
Nov 7, 2024
2d858f3
testing
Nov 7, 2024
8fa32bb
testing
Nov 7, 2024
59b1603
updates user data passed to session
Nov 7, 2024
3a1f41a
Merge pull request #836 from Iterable/evan/MOB-10098
evantk91 Nov 7, 2024
2a22ebd
Merge branch 'feature/itbl-track-anon-user' into evan/MOB-10137
evantk91 Nov 7, 2024
f7cce92
Merge pull request #837 from Iterable/evan/MOB-10137
evantk91 Nov 7, 2024
1d39def
fixes update user bug
Nov 7, 2024
4d0091e
updates unit tests
Nov 7, 2024
b28e3d8
updating testCriteriaMetEmailDefault
Nov 7, 2024
d02980f
fixed assertions
Nov 7, 2024
83a807f
reverts unit tests
Nov 7, 2024
10c25ae
Merge pull request #838 from Iterable/evan/MOB-10109-update-merge-tests
evantk91 Nov 8, 2024
5f56098
updates testCriteriaMetEmailDefault
Nov 8, 2024
e6248c2
prepares for 3.6.0-beta release
Nov 8, 2024
2993980
updates unit test
Nov 8, 2024
e4b9657
updates testCriteriaNotMetUserIdDefault
Nov 8, 2024
6614413
updates unit test
Nov 8, 2024
fff2575
updates unit test
Nov 8, 2024
2e73a6b
updates unit test
Nov 8, 2024
3698ba3
updates unit test
Nov 8, 2024
65ca7df
updates unit test
Nov 8, 2024
4e5c6b0
updates unit tests for user id criteria not met
Nov 9, 2024
c3ed8bb
updates unit tests for user id paths
Nov 9, 2024
eab14b1
updates remaining email unit tests
Nov 9, 2024
ff711b7
updates pointers
Nov 11, 2024
5aed92b
updates identity resolution parameters
Nov 11, 2024
6ca540c
Merge pull request #839 from Iterable/evan/MOB-10109
evantk91 Nov 11, 2024
dca9271
Merge branch 'feature/itbl-track-anon-user' into evan/MOB-10116-3.6.0…
evantk91 Nov 11, 2024
3b87dec
Merge pull request #840 from Iterable/evan/MOB-10116-3.6.0-beta
evantk91 Nov 11, 2024
3cf5e6d
sets up disableForegroundCriteriaFetching config value
Jan 15, 2025
5da3e52
adds missing comments to config file
Jan 15, 2025
6ac0049
Merge branch 'master' into feature/itbl-track-anon-user
Jan 16, 2025
7a02d68
Merge branch 'feature/itbl-track-anon-user' into evan/MOB-10615-impro…
evantk91 Jan 16, 2025
6c81086
cleanup
Jan 16, 2025
2ae35c8
adds anon user id to keychain and migrator
Jan 21, 2025
3a0859f
remove duplicate encryption handler
Jan 21, 2025
3e16143
removes anon user id migrator
Jan 22, 2025
026a784
addresses check
Jan 22, 2025
6ead82d
cleanup
Jan 22, 2025
ce342d0
resolves check
Jan 22, 2025
1e3e28d
Revert "resolves check"
Jan 22, 2025
f3d1bce
resolves check
Jan 22, 2025
7e659d8
resolves check
Jan 22, 2025
cc5eae9
addresses check
Jan 22, 2025
12f0cc4
Merge pull request #868 from Iterable/evan/MOB-10624-add-anonymous-us…
evantk91 Jan 23, 2025
edd365e
Merge branch 'feature/itbl-track-anon-user' into evan/MOB-10615-impro…
evantk91 Jan 23, 2025
3ef4fe5
updates naming
Jan 23, 2025
f76f3ee
adds criteria fetching on foregrounding
Jan 23, 2025
94ec39b
adds cooldown timer
Jan 23, 2025
9bac4e9
adds gating for disabling foreground criteria fetching
Jan 23, 2025
6ef4030
adds unit tests
Jan 27, 2025
7afe25f
addresses checks
Jan 27, 2025
94618c9
separates unit tests into new file
Jan 28, 2025
2b39e20
resolves check
Jan 28, 2025
41f2857
unit test fixes
Jan 28, 2025
f3471bd
addresses check
Jan 28, 2025
6f9a014
updates unit tests
Jan 28, 2025
f0ef193
added constant for criteria cooldown
Jan 28, 2025
ebead63
addresses comments
Jan 28, 2025
4593db8
minor corrections
Jan 28, 2025
3595432
updates config naming
Jan 28, 2025
720313b
sets up app state callback on AnonymousUserManager
Jan 28, 2025
44609c2
update unit tests
Jan 28, 2025
4ac4a81
minor updates
Jan 29, 2025
5a0b8dd
Merge pull request #863 from Iterable/evan/MOB-10615-improve-criteria…
evantk91 Jan 29, 2025
7aabcb2
Fix AUT issue where multiple users are created
megha-iterable Feb 4, 2025
60d30dc
adds unit test
Feb 14, 2025
eabab8b
Merge pull request #880 from Iterable/bugfix/AUT_issue_multiple_users…
evantk91 Feb 14, 2025
1d4c3bc
Merge branch 'master' into feature/itbl-track-anon-user
Jun 25, 2025
be522cc
renaming on config
Jul 7, 2025
3b8c1a7
updates anon user manager to unknown user manager
Jul 7, 2025
7d1674e
updates naming for UnknownUserMerge
Jul 7, 2025
1c273c3
renaming in IterableApi
Jul 7, 2025
2417c63
reverts endpoint renaming
Jul 7, 2025
4244fa9
continued renaming
Jul 7, 2025
4e99755
addresses check
Jul 7, 2025
c6540e4
addresses check
Jul 7, 2025
2ca491e
addresses check
Jul 7, 2025
5940b70
Merge pull request #919 from Iterable/evan/MOB-11686-renaming
evantk91 Jul 7, 2025
75b67c3
[MOB-10806] - Part 1. Fixes track calls with JWT in place
Jul 8, 2025
e54733e
adds timestamp to shared preferences
Jul 9, 2025
50c7881
removes unused imports
Jul 9, 2025
ca7d2a6
removes redundant function
Jul 9, 2025
f385a3e
Merge pull request #922 from Iterable/evan/MOB-11705
evantk91 Jul 10, 2025
c1560d8
adds track consent calls
Jul 14, 2025
b36d5a3
[MOB-10806 - 2] Part 2 fix
Jul 10, 2025
9791dc7
Merge branch 'feature/itbl-track-anon-user' into JWT-fix
evantk91 Jul 14, 2025
cb6f8d0
Merge branch 'JWT-fix' into merge-when-jwt
evantk91 Jul 15, 2025
267c0e5
minor edits
Jul 15, 2025
575e845
Merge branch 'feature/itbl-track-anon-user' into evan/MOB-11677-conse…
evantk91 Jul 15, 2025
1892e3f
minor logic cleanup
Jul 16, 2025
d5e7b0d
Merge pull request #923 from Iterable/merge-when-jwt
Ayyanchira Jul 16, 2025
a58b905
adds unit tests
Jul 16, 2025
4a60628
stashed changes
Jul 16, 2025
77515f7
updates consent logging call
Jul 16, 2025
8fd5392
removes fetching of time of consent
Jul 16, 2025
be85493
Merge pull request #920 from Iterable/JWT-fix
Ayyanchira Jul 17, 2025
a8ab8db
Merge branch 'feature/itbl-track-anon-user' into evan/MOB-11677-conse…
evantk91 Jul 17, 2025
525da5f
sets event replay and consent logging to occur once
Jul 17, 2025
59b1127
updates unit tests
Jul 17, 2025
34e2079
addresses checks
Jul 17, 2025
937242c
updates endpoints, payloads, and changelog
Jul 18, 2025
a80dee0
updates endpoint naming in unit tests
Jul 18, 2025
2ef7954
address checkstyle errors
Jul 18, 2025
12a4e92
addresses check
Jul 18, 2025
494a5d2
clears consent timestamp if consent is revoked
Jul 21, 2025
d570bcc
addresses check
Jul 21, 2025
86775bb
Merge pull request #926 from Iterable/evan/MOB-11686-renaming-endpoints
evantk91 Jul 21, 2025
4d87b3e
Merge branch 'master' into feature/itbl-track-anon-user
evantk91 Jul 21, 2025
31e8721
addresses comments and removes unnecessary flag
Jul 21, 2025
27e5c56
Merge branch 'feature/itbl-track-anon-user' into evan/MOB-11677-conse…
evantk91 Jul 21, 2025
0fe1d47
addresses check
Jul 21, 2025
db478b1
updates unit tests
Jul 22, 2025
ae8d983
addresses checks
Jul 22, 2025
4e69dd1
Merge pull request #924 from Iterable/evan/MOB-11677-consent-logging
evantk91 Jul 23, 2025
0c82456
[MOB-11814] - Prepare for Beta 3.6.0-beta3
Jul 30, 2025
1278edf
Merge pull request #932 from Iterable/Prepare-for-3.6.0-beta3
Ayyanchira Jul 30, 2025
a4d81fa
Merge branch 'master' into feature/itbl-track-anon-user
Jul 30, 2025
f71da94
moves consent logging to complete user login
Aug 20, 2025
ccec456
minor edits
Aug 21, 2025
30f1d73
addresses checks
Aug 21, 2025
fe8ba35
adds unit tests
Aug 22, 2025
ee468db
resolves checks
Aug 22, 2025
8ce9f8e
refactoring
Aug 27, 2025
65e7e7a
Revert "refactoring"
Aug 27, 2025
bbcd698
refactoring
Aug 27, 2025
599723e
clears stored unknown user on log out
Aug 28, 2025
498748f
Merge pull request #937 from Iterable/evan/MOB-11904
evantk91 Aug 28, 2025
b44adfc
Merge branch 'feature/itbl-track-anon-user' into evan/MOB-11965
evantk91 Aug 28, 2025
9243d18
Merge pull request #938 from Iterable/evan/MOB-11965
evantk91 Aug 28, 2025
b7406dc
adds failure handler
Aug 28, 2025
5f2df82
Merge pull request #939 from Iterable/evan/MOB-11993
evantk91 Aug 29, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 31 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,19 @@ This project adheres to [Semantic Versioning](http://semver.org/).

## [Unreleased]

## [3.6.0-beta3]

### Added
- Added consent logging functionality for unknown user activation feature

### Changed
- Enhanced unknown user activation with improved criteria fetching and user ID generation logic

### Fixed
- Fixed unknown user activation to ensure criteria is fetched on foregrounding the app by default
- Fixed unknown user ID generation to only occur once when multiple track calls are made
- Fixed consent timestamp handling when consent is revoked

## [3.5.14]
### Fixed
- Fixed auth token refresh when app is in background, ensuring reliable token refresh in all app states.
Expand Down Expand Up @@ -46,6 +59,14 @@ IterableApi.initialize(context, apiKey, config);
- Added support for providing a list of placement ids to sync only certain placement ids.
- support for pre-release automation

## [3.6.0-beta2]

### Fixed
- This release includes fixes for the Unknown user activation private beta:
- Criteria is now fetched on foregrounding the app by default. This feature can be turned off setting enableForegroundCriteriaFetch flag to false.
- Unknown user ids are only generated once when multiple track calls are made.
- Unknown user activation is currently in private beta. If you'd like to learn more about it or discuss using it, talk to your Iterable customer success manager (who can also provide detailed documentation).

## [3.5.10]

### Added
Expand Down Expand Up @@ -92,6 +113,16 @@ IterableApi.initialize(context, apiKey, config);
- Addressed a text truncation issue in Embedded Message templates for applications targeting Android 14 and Android 15.
- Improved InboxActivity compatibility with edge-to-edge layouts, ensuring seamless handling of notches and display cutouts.

## [3.6.0-beta1]

#### Added
- This release includes initial support for Unknown user activation, a feature that allows marketers to convert valuable visitors into customers. With this feature, the SDK can:
- Fetch unknown user profile creation criteria from your Iterable project, and then automatically create Iterable user profiles for unknown users who meet these criteria.
- Save information about a visitor's previous interactions with your application to their unknown user profile, after it's created.
- Display personalized messages for unknown users (in-app, push, and embedded messages).
- Merge unknown user profiles into an existing, known user profiles (when needed).
- Unknown user activation is currently in private beta. If you'd like to learn more about it or discuss using it, talk to your Iterable customer success manager (who can also provide detailed documentation).

## [3.5.3]
#### Fixed
- Fixed an [issue](https://github.com/Iterable/react-native-sdk/issues/547) where the SDK would crash if the `IterableInAppMessage` object was null when consuming an in-app message.
Expand Down
135 changes: 135 additions & 0 deletions app/.idea/workspace.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ dependencies {
implementation 'androidx.annotation:annotation:1.1.0'
implementation 'androidx.fragment:fragment:1.8.5'
androidTestImplementation 'androidx.fragment:fragment-testing:1.8.5'
implementation 'androidx.constraintlayout:constraintlayout:2.1.4'

implementation project(':iterableapi')
implementation project(':iterableapi-ui')
Expand Down
4 changes: 4 additions & 0 deletions app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,9 @@
android:supportsRtl="true"
android:usesCleartextTraffic="true"
android:theme="@style/AppTheme">
<activity
android:name="com.iterable.androidsdk.UnknownUserTrackingTestActivity"
android:exported="false" />
<activity
android:name="com.iterable.androidsdk.MainActivity"
android:label="@string/app_name"
Expand All @@ -22,4 +25,5 @@
</intent-filter>
</activity>
</application>

</manifest>
54 changes: 54 additions & 0 deletions app/src/main/java/com/iterable/androidsdk/MainActivity.java
Original file line number Diff line number Diff line change
@@ -1,16 +1,28 @@
package com.iterable.androidsdk;

import android.content.Intent;
import android.os.Bundle;

import com.google.android.material.floatingactionbutton.FloatingActionButton;
import com.google.android.material.snackbar.Snackbar;

import androidx.appcompat.app.AppCompatActivity;
import androidx.appcompat.widget.Toolbar;

import android.view.View;
import android.view.Menu;
import android.view.MenuItem;

import com.iterable.iterableapi.CommerceItem;
import com.iterable.iterableapi.IterableApi;
import com.iterable.iterableapi.testapp.R;

import org.json.JSONException;
import org.json.JSONObject;

import java.util.ArrayList;
import java.util.List;

public class MainActivity extends AppCompatActivity {

@Override
Expand All @@ -19,6 +31,8 @@ protected void onCreate(Bundle savedInstanceState) {
setContentView(R.layout.activity_main);
Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
setSupportActionBar(toolbar);
//Below api key is used to display merge user feature
IterableApi.initialize(this, "289895aa038648ee9e4ce60bd0a46e9c");

FloatingActionButton fab = (FloatingActionButton) findViewById(R.id.fab);
fab.setOnClickListener(new View.OnClickListener() {
Expand All @@ -28,6 +42,46 @@ public void onClick(View view) {
.setAction("Action", null).show();
}
});

findViewById(R.id.mainLayout).setOnLongClickListener(v -> {
Intent intent = new Intent(this, UnknownUserTrackingTestActivity.class);
startActivity(intent);
return true;
});

findViewById(R.id.btn_track_event).setOnClickListener(v -> IterableApi.getInstance().track("Browse Mocha"));

findViewById(R.id.btn_update_cart).setOnClickListener(v -> {
List<CommerceItem> items = new ArrayList<>();
items.add(new CommerceItem("123", "Mocha", 1, 1));
IterableApi.getInstance().updateCart(items);
});

findViewById(R.id.btn_buy_mocha).setOnClickListener(v -> {
List<CommerceItem> items = new ArrayList<>();
items.add(new CommerceItem("456", "Black Coffee", 2, 1));
IterableApi.getInstance().trackPurchase(4, items);
});

findViewById(R.id.btn_buy_coffee).setOnClickListener(v -> {
List<CommerceItem> items = new ArrayList<>();
items.add(new CommerceItem("456", "Black Coffee", 5, 1));
IterableApi.getInstance().trackPurchase(5, items);
});

findViewById(R.id.btn_set_user).setOnClickListener(v -> IterableApi.getInstance().setUserId("hani7"));

findViewById(R.id.btn_update_user).setOnClickListener(v -> {
try {
JSONObject jsonObject = new JSONObject();
jsonObject.put("firstName", "Hani");
IterableApi.getInstance().updateUser(jsonObject);
} catch (JSONException e) {
throw new RuntimeException(e);
}
});

findViewById(R.id.btn_logout).setOnClickListener(view -> IterableApi.getInstance().setUserId(null));
}

@Override
Expand Down
Loading