Skip to content

Commit 20f6000

Browse files
committed
Merge branch 'release/1.3.0'
2 parents b76c84c + 2e33df8 commit 20f6000

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

53 files changed

+26315
-6475
lines changed

.github/workflows/build.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ jobs:
1717
- name: Setup Node
1818
uses: actions/setup-node@v2
1919
with:
20-
node-version: 14
20+
node-version: 16
2121

2222
- name: Install node modules
2323
run: npm ci
@@ -45,7 +45,7 @@ jobs:
4545
- name: Setup Node
4646
uses: actions/setup-node@v2
4747
with:
48-
node-version: 14
48+
node-version: 16
4949

5050
- name: Build tracker dist files
5151
run: |
@@ -68,7 +68,7 @@ jobs:
6868
6969
build_ios:
7070
needs: ["test"]
71-
runs-on: macos-10.15
71+
runs-on: macos-latest
7272

7373
steps:
7474
- name: Checkout
@@ -77,7 +77,7 @@ jobs:
7777
- name: Setup Node
7878
uses: actions/setup-node@v2
7979
with:
80-
node-version: 14
80+
node-version: 16
8181

8282
- name: Build tracker dist files
8383
run: |

.github/workflows/deploy.yml

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ jobs:
1616
- name: Setup Node
1717
uses: actions/setup-node@v2
1818
with:
19-
node-version: 14
19+
node-version: 16
2020

2121
- name: Install node modules
2222
run: npm ci
@@ -42,7 +42,7 @@ jobs:
4242
- name: Setup Node
4343
uses: actions/setup-node@v2
4444
with:
45-
node-version: 14
45+
node-version: 16
4646

4747
- name: Get tag and tracker versions
4848
id: version
@@ -84,7 +84,7 @@ jobs:
8484
- name: Setup Node
8585
uses: actions/setup-node@v2
8686
with:
87-
node-version: 14
87+
node-version: 16
8888

8989
- name: Build dist files
9090
run: |
@@ -107,7 +107,7 @@ jobs:
107107
108108
build_ios:
109109
needs: ["test", "version_check"]
110-
runs-on: macos-10.15
110+
runs-on: macos-latest
111111

112112
steps:
113113
- name: Checkout
@@ -116,7 +116,7 @@ jobs:
116116
- name: Setup Node
117117
uses: actions/setup-node@v2
118118
with:
119-
node-version: 14
119+
node-version: 16
120120

121121
- name: Build dist files
122122
run: |
@@ -157,7 +157,7 @@ jobs:
157157
- name: Setup Node
158158
uses: actions/setup-node@v2
159159
with:
160-
node-version: 14
160+
node-version: 16
161161
registry-url: 'https://registry.npmjs.org'
162162

163163
- name: Build dist files

.github/workflows/e2e-android.yml

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ on:
55

66
jobs:
77
e2e:
8-
runs-on: macos-10.15
8+
runs-on: macos-latest
99
timeout-minutes: 30
1010

1111
steps:
@@ -16,13 +16,13 @@ jobs:
1616
- name: Setup Node
1717
uses: actions/setup-node@v2
1818
with:
19-
node-version: 14
19+
node-version: 16
2020

2121
- name: Setup Java
22-
uses: actions/setup-java@v2
22+
uses: actions/setup-java@v3
2323
with:
24-
distribution: 'adopt'
25-
java-version: '8'
24+
distribution: 'zulu'
25+
java-version: '11'
2626

2727
# -- Micro --
2828
- name: Cache Micro
@@ -34,7 +34,7 @@ jobs:
3434

3535
- name: Get micro
3636
if: steps.cache-micro.outputs.cache-hit != 'true'
37-
run: curl -o micro.jar -L https://github.com/snowplow-incubator/snowplow-micro/releases/download/micro-1.1.2/snowplow-micro-1.1.2.jar
37+
run: curl -o micro.jar -L https://github.com/snowplow-incubator/snowplow-micro/releases/download/micro-1.3.3/snowplow-micro-1.3.3.jar
3838

3939
- name: Run Micro in background
4040
run: java -jar micro.jar --collector-config DemoApp/tests/micro/micro.conf --iglu DemoApp/tests/micro/iglu.json &
@@ -45,7 +45,7 @@ jobs:
4545

4646
- name: Prepare DemoApp for Micro
4747
working-directory: DemoApp
48-
run: perl -i -pe "s/^.*endpoint:\K.*/ \'http:\/\/10.0.2.2:9090\'\,/" App.js
48+
run: perl -i -pe "s/^.*collectorEndpoint =\K.*/ \'http:\/\/10.0.2.2:9090\'\;/" App.js
4949

5050
# -- Tracker --
5151
- name: Use npm cache
@@ -82,8 +82,8 @@ jobs:
8282
# -- Emulator --
8383
- name: Get AOSP system image and create Android virtual device
8484
run: |
85-
echo 'y' | ${ANDROID_SDK_ROOT}/tools/bin/sdkmanager "system-images;android-28;default;x86_64"
86-
echo 'no' | $ANDROID_SDK_ROOT/tools/bin/avdmanager create avd --force --name Pixel_API_28_AOSP -d pixel --package "system-images;android-28;default;x86_64"
85+
echo 'y' | ${ANDROID_SDK_ROOT}/cmdline-tools/latest/bin/sdkmanager "system-images;android-28;default;x86_64"
86+
echo 'no' | $ANDROID_SDK_ROOT/cmdline-tools/latest/bin/avdmanager create avd --force --name Pixel_API_28_AOSP -d pixel --package "system-images;android-28;default;x86_64"
8787
8888
- name: Start Android emulator
8989
timeout-minutes: 10

.github/workflows/e2e-ios.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ on:
55

66
jobs:
77
e2e:
8-
runs-on: macos-10.15
8+
runs-on: macos-latest
99
timeout-minutes: 30
1010

1111
steps:
@@ -16,7 +16,7 @@ jobs:
1616
- name: Setup Node
1717
uses: actions/setup-node@v2
1818
with:
19-
node-version: 14
19+
node-version: 16
2020

2121
# -- Micro --
2222
- name: Cache Micro
@@ -28,7 +28,7 @@ jobs:
2828

2929
- name: Get micro
3030
if: steps.cache-micro.outputs.cache-hit != 'true'
31-
run: curl -o micro.jar -L https://github.com/snowplow-incubator/snowplow-micro/releases/download/micro-1.1.2/snowplow-micro-1.1.2.jar
31+
run: curl -o micro.jar -L https://github.com/snowplow-incubator/snowplow-micro/releases/download/micro-1.3.3/snowplow-micro-1.3.3.jar
3232

3333
- name: Run Micro in background
3434
run: java -jar micro.jar --collector-config DemoApp/tests/micro/micro.conf --iglu DemoApp/tests/micro/iglu.json &
@@ -39,7 +39,7 @@ jobs:
3939

4040
- name: Prepare DemoApp for Micro
4141
working-directory: DemoApp
42-
run: perl -i -pe "s/^.*endpoint:\K.*/ \'http:\/\/0.0.0.0:9090\'\,/" App.js
42+
run: perl -i -pe "s/^.*collectorEndpoint =\K.*/ \'http:\/\/0.0.0.0:9090\'\;/" App.js
4343

4444
# -- Tracker --
4545
- name: Use npm cache

.npmignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
# Demo app
22
#
33
DemoApp/
4+
DemoAppTV/
45

56
# Local testing workflow
67
#

CHANGELOG

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,13 @@
1+
Version 1.3.0 (2022-10-03)
2+
--------------------------
3+
Upgrade Snowplow mobile trackers to v4 (#167)
4+
Add anonymous tracking features (#168)
5+
Add interface to subscribe for events tracked in Web views (#169)
6+
Add option to add custom headers (#165)
7+
Enable setting custom path for POST requests (#178)
8+
Upgrade internal and demo app dependencies (#172)
9+
Remove circular imports of demo app dependencies when running in demo apps (#174)
10+
111
Version 1.2.1 (2022-04-12)
212
--------------------------
313
Fix import of non-published NSDictionary helpers from SnowplowTracker on iOS (#161)

DemoApp/.babelrc

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
{
2+
"env": {
3+
"test": {
4+
"plugins": ["@babel/plugin-transform-modules-commonjs"]
5+
}
6+
}
7+
}

DemoApp/App.js

Lines changed: 65 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,16 +16,28 @@ import {
1616
useColorScheme,
1717
View,
1818
Button,
19+
Dimensions,
1920
} from 'react-native';
21+
import {WebView} from 'react-native-webview';
2022

2123
import {Colors, Header} from 'react-native/Libraries/NewAppScreen';
2224

2325
import {
2426
createTracker,
2527
removeTracker,
26-
// removeAllTrackers,
28+
getWebViewCallback,
2729
} from '@snowplow/react-native-tracker';
2830

31+
/**
32+
* URI of the Snowplow collector (e.g., Micro, Mini, or BDP) to send events to
33+
*/
34+
const collectorEndpoint = 'placeholder';
35+
36+
/**
37+
* URI of a website to load in the webview component
38+
*/
39+
const webViewEndpoint = '';
40+
2941
const Section = ({children, title}) => {
3042
const isDarkMode = useColorScheme() === 'dark';
3143
return (
@@ -62,7 +74,10 @@ const App = () => {
6274
const tracker = createTracker(
6375
'sp1',
6476
{
65-
endpoint: 'placeholder',
77+
endpoint: collectorEndpoint,
78+
requestHeaders: {
79+
test: 'works',
80+
},
6681
},
6782
{
6883
trackerConfig: {
@@ -106,12 +121,29 @@ const App = () => {
106121
const secTracker = createTracker(
107122
'sp2',
108123
{
109-
endpoint: 'placeholder',
124+
endpoint: collectorEndpoint,
125+
},
126+
{
127+
trackerConfig: {
128+
screenViewAutotracking: false, // for tests predictability
129+
installAutotracking: false,
130+
},
131+
},
132+
);
133+
134+
const anonymousTracker = createTracker(
135+
'sp_anon',
136+
{
137+
endpoint: collectorEndpoint,
110138
},
111139
{
112140
trackerConfig: {
113141
screenViewAutotracking: false, // for tests predictability
114142
installAutotracking: false,
143+
userAnonymisation: true,
144+
},
145+
emitterConfig: {
146+
serverAnonymisation: true,
115147
},
116148
},
117149
);
@@ -298,6 +330,14 @@ const App = () => {
298330
});
299331
};
300332

333+
const onPressTestAnonymousTracker = () => {
334+
anonymousTracker.trackScreenViewEvent({name: 'fromAnonymousTracker'});
335+
anonymousTracker.trackStructuredEvent({
336+
category: 'AnonymousTracker',
337+
action: 'trackAnonymous',
338+
});
339+
};
340+
301341
const onPressPlayGC = async () => {
302342
try {
303343
await tracker.removeGlobalContexts('testTag');
@@ -415,6 +455,14 @@ const App = () => {
415455
accessibilityLabel="testSecTracker"
416456
/>
417457
</Section>
458+
<Section title="Anonymous tracker">
459+
<Button
460+
onPress={onPressTestAnonymousTracker}
461+
title="Track events with anonymous tracking"
462+
color="#841584"
463+
accessibilityLabel="testAnonymousTracker"
464+
/>
465+
</Section>
418466
<Section title="Warnings">
419467
<Button
420468
onPress={onPressShowMeSomeWarnings}
@@ -456,6 +504,20 @@ const App = () => {
456504
accessibilityLabel="testRemove"
457505
/>
458506
</Section>
507+
<Section title="Web view">
508+
{webViewEndpoint ? (
509+
<WebView
510+
onMessage={getWebViewCallback()}
511+
source={{uri: webViewEndpoint}}
512+
style={{
513+
height: 400,
514+
width:
515+
Dimensions.get('window').width -
516+
styles.sectionContainer.paddingHorizontal,
517+
}}
518+
/>
519+
) : null}
520+
</Section>
459521
</View>
460522
</ScrollView>
461523
</SafeAreaView>

DemoApp/__mocks__/WebView.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
export default function WebView() {
2+
return null;
3+
}

DemoApp/android/app/build.gradle

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -190,7 +190,7 @@ dependencies {
190190
//noinspection GradleDynamicVersion
191191
implementation "com.facebook.react:react-native:+" // From node_modules
192192

193-
implementation "androidx.swiperefreshlayout:swiperefreshlayout:1.0.0"
193+
implementation "androidx.swiperefreshlayout:swiperefreshlayout:1.1.0"
194194

195195
debugImplementation("com.facebook.flipper:flipper:${FLIPPER_VERSION}") {
196196
exclude group:'com.facebook.fbjni'
@@ -206,7 +206,7 @@ dependencies {
206206
}
207207

208208
androidTestImplementation 'com.wix:detox:+'
209-
androidTestImplementation 'junit:junit:4.12'
209+
androidTestImplementation 'junit:junit:4.13.2'
210210

211211
if (enableHermes) {
212212
def hermesPath = "../../node_modules/hermes-engine/android/";
@@ -216,13 +216,13 @@ dependencies {
216216
implementation jscFlavor
217217
}
218218

219-
implementation 'com.snowplowanalytics:snowplow-android-tracker:3.+'
219+
implementation 'com.snowplowanalytics:snowplow-android-tracker:4.+'
220220
}
221221

222222
// Run this once to be able to run the application with BUCK
223223
// puts all compile dependencies into folder libs for BUCK to use
224224
task copyDownloadableDepsToLibs(type: Copy) {
225-
from configurations.compile
225+
from configurations.implementation
226226
into 'libs'
227227
}
228228

0 commit comments

Comments
 (0)