Skip to content

Commit 8fa5502

Browse files
alanjcharlesAlan Charlesprayansh
authored
Update test app (#304)
* chore(deps): update y18n from 3.2.1 to 4.0.1 * chore(deps): update react-native in test-app from 0.62.2 to 0.64 * chore(deps): update react-core dependency and deployment ios * chore(deps); update podfile in test app to reflect react native update * force run ci * ci: force run * ci: force run * chore(deps): update podfile to match test app names * chore(deps): update top-level package.json bump react-native from 0.62.2 to 0.64 and babel from 7.4 to 7,12,9 * chore(deps): correct babel version * chore(deps): bump jest and detox to get around node 14 build error * chore(deps): update babel-core and ts-tests * ci: force run * chore(deps): downgrade typescript * chore(deps): downgrade jest-mock-console * chore(deps): change version in analytics.spec.ts * test: fix jest no input calls * ci: force run * fix: fix lint issue with array type * test: change test-app minSdkVersion to 21 * test: try ios podfile fix * ci: bump xcode version * test: update test app detox config * fix: remove mocha and remove cirleCi config in e2e setup * fix: deleted vanilla config fix lint * fix: re-add jest config to core package.json * fix: revert devDependencies in core package.json * fix: remove jest Config from core Co-authored-by: Alan Charles <alan.charles@Alans-MacBook-Pro.local> Co-authored-by: Prayansh Srivastava <prayansh@gmail.com>
1 parent 5a2ed9b commit 8fa5502

File tree

24 files changed

+4421
-10300
lines changed

24 files changed

+4421
-10300
lines changed

.circleci/config.yml

Lines changed: 1 addition & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -97,25 +97,10 @@ jobs:
9797
- *attach
9898
- run: yarn test-app test:android
9999

100-
test-ios-vanilla:
101-
<<: *job
102-
macos:
103-
xcode: '11.5.0'
104-
steps:
105-
- checkout
106-
# macOS VMs doesn't support Docker based caches
107-
- run: yarn install --frozen-lockfile
108-
- *attach
109-
- run: brew update-reset
110-
- run: brew tap wix/brew
111-
- run: brew install wix/brew/applesimutils
112-
113-
- run: yarn test-app test:ios:vanilla
114-
115100
test-ios-cocoapods:
116101
<<: *job
117102
macos:
118-
xcode: '11.5.0'
103+
xcode: '12.4.0'
119104
steps:
120105
- checkout
121106
# macOS VMs doesn't support Docker based caches
@@ -181,12 +166,6 @@ workflows:
181166
filters:
182167
tags:
183168
only: /.*/
184-
- test-ios-vanilla:
185-
requires:
186-
- build-test-app
187-
filters:
188-
tags:
189-
only: /.*/
190169
- test-ios-cocoapods:
191170
requires:
192171
- build-test-app
@@ -204,7 +183,6 @@ workflows:
204183
requires:
205184
- build-test-app
206185
- test-android
207-
- test-ios-vanilla
208186
- test-ios-cocoapods
209187
- test-core
210188
- lint

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -177,6 +177,7 @@ In Xcode:
177177
| [Facebook App Events](https://www.npmjs.com/package/@segment/analytics-react-native-facebook-app-events-ios) | :white_check_mark: | :x: | `@segment/analytics-react-native-facebook-app-events-ios` |
178178
| [Firebase](https://www.npmjs.com/package/@segment/analytics-react-native-firebase) | :white_check_mark: | :white_check_mark: | `@segment/analytics-react-native-firebase` |
179179
| [Flurry](https://www.npmjs.com/package/@segment/analytics-react-native-flurry) | :white_check_mark: | :white_check_mark: | `@segment/analytics-react-native-flurry` |
180+
| [Google Analytics](https://www.npmjs.com/package/@segment/analytics-react-native-google-analytics) | :white_check_mark: | :white_check_mark: | `@segment/analytics-react-native-google-analytics` |
180181
| [Intercom](https://www.npmjs.com/package/@segment/analytics-react-native-intercom) | :white_check_mark: | :white_check_mark: | `@segment/analytics-react-native-intercom` |
181182
| [Localytics](https://www.npmjs.com/package/@segment/analytics-react-native-localytics) | :white_check_mark: | :white_check_mark: | `@segment/analytics-react-native-localytics` |
182183
| [Mixpanel](https://www.npmjs.com/package/@segment/analytics-react-native-mixpanel) | :white_check_mark: | :white_check_mark: | `@segment/analytics-react-native-mixpanel` |

package.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@
5858
]
5959
},
6060
"devDependencies": {
61-
"@babel/core": "^7.4.0",
61+
"@babel/core": "^7.12.9",
6262
"@commitlint/cli": "^7.0.0",
6363
"@commitlint/config-conventional": "^7.0.1",
6464
"codecov": "^3.0.4",
@@ -69,8 +69,8 @@
6969
"lint-staged": "^7.2.0",
7070
"npm-run-all": "^4.1.3",
7171
"prettier": "^1.14.2",
72-
"react": "16.8.3",
73-
"react-native": "0.62.2",
72+
"react": "17.0.1",
73+
"react-native": "0.64",
7474
"rimraf": "^2.6.2"
7575
},
7676
"dependencies": {

packages/core/docs/classes/analytics.client.md

Lines changed: 2 additions & 87 deletions
Original file line numberDiff line numberDiff line change
@@ -42,10 +42,6 @@
4242

4343
*Defined in [analytics.ts:152](https://github.com/segmentio/analytics-react-native/blob/master/packages/core/src/analytics.ts#L152)*
4444

45-
Whether the client is ready to send events to Segment.
46-
47-
This becomes `true` when `.setup()` succeeds. All calls will be queued until it becomes `true`.
48-
4945
___
5046

5147
## Methods
@@ -58,10 +54,6 @@ ___
5854

5955
*Defined in [analytics.ts:330](https://github.com/segmentio/analytics-react-native/blob/master/packages/core/src/analytics.ts#L330)*
6056

61-
Merge two user identities, effectively connecting two sets of user data as one. This may not be supported by all integrations.
62-
63-
When you learn more about who the group is, you can record that information with group.
64-
6557
**Parameters:**
6658

6759
| Name | Type | Default value | Description |
@@ -80,10 +72,6 @@ ___
8072

8173
*Defined in [analytics.ts:167](https://github.com/segmentio/analytics-react-native/blob/master/packages/core/src/analytics.ts#L167)*
8274

83-
Catch React-Native bridge errors
84-
85-
These errors are emitted when calling the native counterpart. This only applies to methods with no return value (`Promise<void>`), methods like `getAnonymousId` do reject promises.
86-
8775
**Parameters:**
8876

8977
| Name | Type |
@@ -101,10 +89,6 @@ ___
10189

10290
*Defined in [analytics.ts:369](https://github.com/segmentio/analytics-react-native/blob/master/packages/core/src/analytics.ts#L369)*
10391

104-
Completely disable the sending of any analytics data.
105-
106-
If you have a way for users to actively or passively (sometimes based on location) opt-out of analytics data collection, you can use this method to turn off all data collection.
107-
10892
**Returns:** `Promise`<`void`>
10993

11094
___
@@ -116,10 +100,6 @@ ___
116100

117101
*Defined in [analytics.ts:359](https://github.com/segmentio/analytics-react-native/blob/master/packages/core/src/analytics.ts#L359)*
118102

119-
Enable the sending of analytics data. Enabled by default.
120-
121-
Occasionally used in conjunction with disable user opt-out handling.
122-
123103
**Returns:** `Promise`<`void`>
124104

125105
___
@@ -131,10 +111,6 @@ ___
131111

132112
*Defined in [analytics.ts:350](https://github.com/segmentio/analytics-react-native/blob/master/packages/core/src/analytics.ts#L350)*
133113

134-
Trigger an upload of all queued events.
135-
136-
This is useful when you want to force all messages queued on the device to be uploaded. Please note that not all integrations respond to this method.
137-
138114
**Returns:** `Promise`<`void`>
139115

140116
___
@@ -146,8 +122,6 @@ ___
146122

147123
*Defined in [analytics.ts:374](https://github.com/segmentio/analytics-react-native/blob/master/packages/core/src/analytics.ts#L374)*
148124

149-
Retrieve the anonymousId.
150-
151125
**Returns:** `Promise`<`string`>
152126

153127
___
@@ -159,10 +133,6 @@ ___
159133

160134
*Defined in [analytics.ts:317](https://github.com/segmentio/analytics-react-native/blob/master/packages/core/src/analytics.ts#L317)*
161135

162-
Associate a user with a group, organization, company, project, or w/e _you_ call them.
163-
164-
When you learn more about who the group is, you can record that information with group.
165-
166136
**Parameters:**
167137

168138
| Name | Type | Default value | Description |
@@ -178,19 +148,15 @@ ___
178148

179149
### identify
180150

181-
**identify**(user: *`string`*, traits?: *[JsonMap]()*, options?: *[Options]()*): `Promise`<`void`>
151+
**identify**(user: *`string` \| `null`*, traits?: *[JsonMap]()*, options?: *[Options]()*): `Promise`<`void`>
182152

183153
*Defined in [analytics.ts:304](https://github.com/segmentio/analytics-react-native/blob/master/packages/core/src/analytics.ts#L304)*
184154

185-
Associate a user with their unique ID and record traits about them.
186-
187-
When you learn more about who your user is, you can record that information with identify.
188-
189155
**Parameters:**
190156

191157
| Name | Type | Default value | Description |
192158
| ------ | ------ | ------ | ------ |
193-
| user | `string` | - | database ID (or email address) for this user. If you don't have a userId but want to record traits, you should pass nil. For more information on how we generate the UUID and Apple's policies on IDs, see [https://segment.io/libraries/ios#ids](https://segment.io/libraries/ios#ids) |
159+
| user | `string` \| `null` | - | database ID (or email address) for this user. If you don't have a userId but want to record traits, you should pass nil. For more information on how we generate the UUID and Apple's policies on IDs, see [https://segment.io/libraries/ios#ids](https://segment.io/libraries/ios#ids) |
194160
| `Default value` traits | [JsonMap]() | {} | A dictionary of traits you know about the user. Things like: email, name, plan, etc. |
195161
| `Default value` options | [Options]() | {} | A dictionary of options, e.g. integrations (thigh analytics integration to forward the event to) |
196162

@@ -205,27 +171,6 @@ ___
205171

206172
*Defined in [analytics.ts:213](https://github.com/segmentio/analytics-react-native/blob/master/packages/core/src/analytics.ts#L213)*
207173

208-
Append a new middleware to the middleware chain.
209-
210-
Middlewares are a powerful mechanism that can augment the events collected by the SDK. A middleware is a simple function that is invoked by the Segment SDK and can be used to monitor, modify or reject events.
211-
212-
Middlewares are invoked for all events, including automatically tracked events, and external event sources like Adjust and Optimizely. This offers you the ability the customize those messages to fit your use case even if the event was sent outside your source code.
213-
214-
The key thing to observe here is that the output produced by the first middleware feeds into the second. This allows you to chain and compose independent middlewares!
215-
216-
For example, you might want to record the device year class with your events. Previously, you would have to do this everywhere you trigger an event with the Segment SDK. With middlewares, you can do this in a single place :
217-
218-
```js
219-
import DeviceYearClass from 'react-native-device-year-class'
220-
221-
analytics.middleware(async ({next, context}) =>
222-
next({
223-
...context,
224-
device_year_class: await DeviceYearClass()
225-
})
226-
)
227-
```
228-
229174
**Parameters:**
230175

231176
| Name | Type | Description |
@@ -243,10 +188,6 @@ ___
243188

244189
*Defined in [analytics.ts:340](https://github.com/segmentio/analytics-react-native/blob/master/packages/core/src/analytics.ts#L340)*
245190

246-
Reset any user state that is cached on the device.
247-
248-
This is useful when a user logs out and you want to clear the identity. It will clear any traits or userId's cached on the device.
249-
250191
**Returns:** `Promise`<`void`>
251192

252193
___
@@ -258,10 +199,6 @@ ___
258199

259200
*Defined in [analytics.ts:289](https://github.com/segmentio/analytics-react-native/blob/master/packages/core/src/analytics.ts#L289)*
260201

261-
Record the screens or views your users see.
262-
263-
When a user views a screen in your app, you'll want to record that here. For some tools like Google Analytics and Flurry, screen views are treated specially, and are different from "events" kind of like "page views" on the web. For services that don't treat "screen views" specially, we map "screen" straight to "track" with the same parameters. For example, Mixpanel doesn't treat "screen views" any differently. So a call to "screen" will be tracked as a normal event in Mixpanel, but get sent to Google Analytics and Flurry as a "screen".
264-
265202
**Parameters:**
266203

267204
| Name | Type | Default value | Description |
@@ -281,8 +218,6 @@ ___
281218

282219
*Defined in [analytics.ts:177](https://github.com/segmentio/analytics-react-native/blob/master/packages/core/src/analytics.ts#L177)*
283220

284-
Sets the IDFA value on iOS. Customers are now responsible for collecting IDFA on their own.
285-
286221
**Parameters:**
287222

288223
| Name | Type |
@@ -300,18 +235,6 @@ ___
300235

301236
*Defined in [analytics.ts:252](https://github.com/segmentio/analytics-react-native/blob/master/packages/core/src/analytics.ts#L252)*
302237

303-
Setup the Analytics module. All calls made before are queued and only executed if the configuration was successful.
304-
305-
```js
306-
await analytics.setup('YOUR_WRITE_KEY', {
307-
using: [Mixpanel, GoogleAnalytics],
308-
trackAppLifecycleEvents: true,
309-
ios: {
310-
trackDeepLinks: true
311-
}
312-
})
313-
```
314-
315238
**Parameters:**
316239

317240
| Name | Type | Default value | Description |
@@ -330,10 +253,6 @@ ___
330253

331254
*Defined in [analytics.ts:271](https://github.com/segmentio/analytics-react-native/blob/master/packages/core/src/analytics.ts#L271)*
332255

333-
Record the actions your users perform.
334-
335-
When a user performs an action in your app, you'll want to track that action for later analysis. Use the event name to say what the user did, and properties to specify any interesting details of the action.
336-
337256
**Parameters:**
338257

339258
| Name | Type | Default value | Description |
@@ -353,10 +272,6 @@ ___
353272

354273
*Defined in [analytics.ts:225](https://github.com/segmentio/analytics-react-native/blob/master/packages/core/src/analytics.ts#L225)*
355274

356-
Use the native configuration.
357-
358-
You'll need to call this method when you configure Analytics's singleton using the native API.
359-
360275
**Returns:** `this`
361276

362277
___

packages/core/docs/interfaces/analytics.configuration.md

Lines changed: 0 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,6 @@
3333

3434
*Defined in [analytics.ts:119](https://github.com/segmentio/analytics-react-native/blob/master/packages/core/src/analytics.ts#L119)*
3535

36-
Android specific settings.
37-
3836
___
3937
<a id="debug"></a>
4038

@@ -53,8 +51,6 @@ ___
5351

5452
*Defined in [analytics.ts:45](https://github.com/segmentio/analytics-react-native/blob/master/packages/core/src/analytics.ts#L45)*
5553

56-
Default project settings to use, if Segment.com cannot be reached. An example configuration can be found here, using your write key: [](https://cdn-settings.segment.com/v1/projects/YOUR_WRITE_KEY/settings)[https://cdn-settings.segment.com/v1/projects/YOUR\_WRITE\_KEY/settings](https://cdn-settings.segment.com/v1/projects/YOUR_WRITE_KEY/settings)
57-
5854
___
5955
<a id="flushat"></a>
6056

@@ -64,10 +60,6 @@ ___
6460

6561
*Defined in [analytics.ts:53](https://github.com/segmentio/analytics-react-native/blob/master/packages/core/src/analytics.ts#L53)*
6662

67-
The number of queued events that the analytics client should flush at. Setting this to `1` will not queue any events and will use more battery.
68-
69-
`20` by default.
70-
7163
___
7264
<a id="ios"></a>
7365

@@ -77,8 +69,6 @@ ___
7769

7870
*Defined in [analytics.ts:101](https://github.com/segmentio/analytics-react-native/blob/master/packages/core/src/analytics.ts#L101)*
7971

80-
iOS specific settings.
81-
8272
___
8373
<a id="proxy"></a>
8474

@@ -88,10 +78,6 @@ ___
8878

8979
*Defined in [analytics.ts:71](https://github.com/segmentio/analytics-react-native/blob/master/packages/core/src/analytics.ts#L71)*
9080

91-
Whether the analytics client should send all requests through your own hosted proxy rather than directly to Segment. See: iOS: [https://segment.com/docs/connections/sources/catalog/libraries/mobile/ios/#proxy-http-calls](https://segment.com/docs/connections/sources/catalog/libraries/mobile/ios/#proxy-http-calls) android: [https://segment.com/docs/connections/sources/catalog/libraries/mobile/android/#proxy-http-calls](https://segment.com/docs/connections/sources/catalog/libraries/mobile/android/#proxy-http-calls)
92-
93-
Ex. For a desired proxy through `http://localhost:64000/segment` the configuration would look like such { scheme: 'http', host: 'localhost', port: 64000, path: '/segment' }
94-
9581
___
9682
<a id="recordscreenviews"></a>
9783

@@ -101,10 +87,6 @@ ___
10187

10288
*Defined in [analytics.ts:19](https://github.com/segmentio/analytics-react-native/blob/master/packages/core/src/analytics.ts#L19)*
10389

104-
Whether the analytics client should automatically make a screen call when a view controller is added to a view hierarchy. Because the iOS underlying implementation uses method swizzling, we recommend initializing the analytics client as early as possible.
105-
106-
Disabled by default.
107-
10890
___
10991
<a id="trackapplifecycleevents"></a>
11092

@@ -114,10 +96,6 @@ ___
11496

11597
*Defined in [analytics.ts:26](https://github.com/segmentio/analytics-react-native/blob/master/packages/core/src/analytics.ts#L26)*
11698

117-
Whether the analytics client should automatically track application lifecycle events, such as "Application Installed", "Application Updated" and "Application Opened".
118-
119-
Disabled by default.
120-
12199
___
122100
<a id="trackattributiondata"></a>
123101

@@ -127,8 +105,6 @@ ___
127105

128106
*Defined in [analytics.ts:31](https://github.com/segmentio/analytics-react-native/blob/master/packages/core/src/analytics.ts#L31)*
129107

130-
*__deprecated__*: The property should not be used
131-
132108
___
133109
<a id="using"></a>
134110

@@ -138,7 +114,5 @@ ___
138114

139115
*Defined in [analytics.ts:36](https://github.com/segmentio/analytics-react-native/blob/master/packages/core/src/analytics.ts#L36)*
140116

141-
Register a set of integrations to be used with this Analytics instance.
142-
143117
___
144118

packages/core/package.json

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -35,14 +35,14 @@
3535
},
3636
"devDependencies": {
3737
"@types/jest": "^23.3.1",
38-
"babel-core": "^6.26.3",
39-
"babel-jest": "^23.4.2",
40-
"jest": "^23.4.2",
38+
"@babel/core": "^7.12.9",
39+
"babel-jest": "^26.6.3",
40+
"jest": "^26.6.3",
4141
"jest-mock-console": "^0.4.0",
4242
"standard-version": "^4.4.0",
43-
"ts-jest": "^23.1.3",
44-
"ts-node": "^7.0.1",
45-
"tslint": "^5.11.0",
43+
"ts-jest": "^26.5.5",
44+
"ts-node": "^9.1.1",
45+
"tslint": "^6.1.3",
4646
"tslint-config-prettier": "^1.14.0",
4747
"tslint-plugin-prettier": "^2.0.0",
4848
"typedoc": "^0.12.0",

0 commit comments

Comments
 (0)