Skip to content

Commit 2c16e5d

Browse files
bsneedBrandon Sneed
andauthored
Post-Beta Release Fixes (#157)
* fix(android): fixed issued with defautKotlinVersion not being found * fix(android): fixed dependency reference * fix(android): correct segment reference in integration generator Co-authored-by: Brandon Sneed <[email protected]>
1 parent d7eb73c commit 2c16e5d

File tree

5 files changed

+112
-7
lines changed

5 files changed

+112
-7
lines changed

packages/core/android/build.gradle

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,20 @@
11
apply plugin: 'com.android.library'
22
apply plugin: 'kotlin-android'
33

4-
def defaultKotlinVersion = '1.3.21'
54
def safeExtGet(prop, fallback) {
6-
rootProject.ext.has(prop) ? rootProject.ext.get(prop) : fallback
5+
return rootProject.ext.has(prop) ? rootProject.ext.get(prop) : fallback
76
}
87

98
buildscript {
9+
def defaultKotlinVersion = '1.3.21'
10+
1011
repositories {
1112
jcenter()
1213
maven { url 'https://maven.google.com' }
1314
}
1415
dependencies {
1516
classpath 'com.android.tools.build:gradle:3.1.4'
16-
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:${safeExtGet("kotlinVersion", defaultKotlinVersion)}"
17+
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:${rootProject.ext.has("kotlinVersion") ? rootProject.ext.get("kotlinVersion") : defaultKotlinVersion}"
1718
}
1819
}
1920

@@ -37,10 +38,9 @@ repositories {
3738
mavenCentral()
3839
}
3940

40-
4141
dependencies {
4242
api 'com.segment.analytics.android:analytics:4.5.0-beta.0'
4343

4444
api 'com.facebook.react:react-native:+'
45-
api "org.jetbrains.kotlin:kotlin-stdlib:${safeExtGet("kotlinVersion", defaultKotlinVersion)}"
45+
api "org.jetbrains.kotlin:kotlin-stdlib:${rootProject.ext.has("kotlinVersion") ? rootProject.ext.get("kotlinVersion") : defaultKotlinVersion}"
4646
}

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

Lines changed: 83 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,10 @@
4141

4242
*Defined in analytics.ts:96*
4343

44+
Whether the client is ready to send events to Segment.
45+
46+
This becomes `true` when `.setup()` succeeds. All calls will be queued until it becomes `true`.
47+
4448
___
4549

4650
## Methods
@@ -53,6 +57,10 @@ ___
5357

5458
*Defined in analytics.ts:266*
5559

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

5866
| Name | Type | Default value | Description |
@@ -71,6 +79,10 @@ ___
7179

7280
*Defined in analytics.ts:111*
7381

82+
Catch React-Native bridge errors
83+
84+
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.
85+
7486
**Parameters:**
7587

7688
| Name | Type |
@@ -88,6 +100,10 @@ ___
88100

89101
*Defined in analytics.ts:305*
90102

103+
Completely disable the sending of any analytics data.
104+
105+
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.
106+
91107
**Returns:** `Promise`<`void`>
92108

93109
___
@@ -99,6 +115,10 @@ ___
99115

100116
*Defined in analytics.ts:295*
101117

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

104124
___
@@ -110,6 +130,10 @@ ___
110130

111131
*Defined in analytics.ts:286*
112132

133+
Trigger an upload of all queued events.
134+
135+
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.
136+
113137
**Returns:** `Promise`<`void`>
114138

115139
___
@@ -121,6 +145,8 @@ ___
121145

122146
*Defined in analytics.ts:310*
123147

148+
Retrieve the anonymousId.
149+
124150
**Returns:** `Promise`<`string`>
125151

126152
___
@@ -132,6 +158,10 @@ ___
132158

133159
*Defined in analytics.ts:253*
134160

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

137167
| Name | Type | Default value | Description |
@@ -151,6 +181,10 @@ ___
151181

152182
*Defined in analytics.ts:240*
153183

184+
Associate a user with their unique ID and record traits about them.
185+
186+
When you learn more about who your user is, you can record that information with identify.
187+
154188
**Parameters:**
155189

156190
| Name | Type | Default value | Description |
@@ -170,6 +204,27 @@ ___
170204

171205
*Defined in analytics.ts:149*
172206

207+
Append a new middleware to the middleware chain.
208+
209+
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.
210+
211+
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.
212+
213+
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!
214+
215+
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 :
216+
217+
```js
218+
import DeviceYearClass from 'react-native-device-year-class'
219+
220+
analytics.middleware(async ({next, context}) =>
221+
next({
222+
...context,
223+
device_year_class: await DeviceYearClass()
224+
})
225+
)
226+
```
227+
173228
**Parameters:**
174229

175230
| Name | Type | Description |
@@ -187,6 +242,10 @@ ___
187242

188243
*Defined in analytics.ts:276*
189244

245+
Reset any user state that is cached on the device.
246+
247+
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.
248+
190249
**Returns:** `Promise`<`void`>
191250

192251
___
@@ -198,6 +257,10 @@ ___
198257

199258
*Defined in analytics.ts:225*
200259

260+
Record the screens or views your users see.
261+
262+
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".
263+
201264
**Parameters:**
202265

203266
| Name | Type | Default value | Description |
@@ -217,6 +280,18 @@ ___
217280

218281
*Defined in analytics.ts:188*
219282

283+
Setup the Analytics module. All calls made before are queued and only executed if the configuration was successful.
284+
285+
```js
286+
await analytics.setup('YOUR_WRITE_KEY', {
287+
using: [Mixpanel, GoogleAnalytics],
288+
trackAppLifecycleEvents: true,
289+
ios: {
290+
trackDeepLinks: true
291+
}
292+
})
293+
```
294+
220295
**Parameters:**
221296

222297
| Name | Type | Default value | Description |
@@ -235,6 +310,10 @@ ___
235310

236311
*Defined in analytics.ts:207*
237312

313+
Record the actions your users perform.
314+
315+
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.
316+
238317
**Parameters:**
239318

240319
| Name | Type | Default value | Description |
@@ -254,6 +333,10 @@ ___
254333

255334
*Defined in analytics.ts:161*
256335

336+
Use the native configuration.
337+
338+
You'll need to call this method when you configure Analytics's singleton using the native API.
339+
257340
**Returns:** `this`
258341

259342
___

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

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,8 @@
3131

3232
*Defined in analytics.ts:69*
3333

34+
Android specific settings.
35+
3436
___
3537
<a id="debug"></a>
3638

@@ -49,6 +51,10 @@ ___
4951

5052
*Defined in analytics.ts:46*
5153

54+
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.
55+
56+
`20` by default.
57+
5258
___
5359
<a id="ios"></a>
5460

@@ -58,6 +64,8 @@ ___
5864

5965
*Defined in analytics.ts:51*
6066

67+
iOS specific settings.
68+
6169
___
6270
<a id="recordscreenviews"></a>
6371

@@ -67,6 +75,10 @@ ___
6775

6876
*Defined in analytics.ts:19*
6977

78+
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.
79+
80+
Disabled by default.
81+
7082
___
7183
<a id="trackapplifecycleevents"></a>
7284

@@ -76,6 +88,10 @@ ___
7688

7789
*Defined in analytics.ts:26*
7890

91+
Whether the analytics client should automatically track application lifecycle events, such as "Application Installed", "Application Updated" and "Application Opened".
92+
93+
Disabled by default.
94+
7995
___
8096
<a id="trackattributiondata"></a>
8197

@@ -85,6 +101,10 @@ ___
85101

86102
*Defined in analytics.ts:32*
87103

104+
Whether the analytics client should automatically track attribution data from enabled providers using the mobile service.
105+
106+
Disabled by default.
107+
88108
___
89109
<a id="using"></a>
90110

@@ -94,5 +114,7 @@ ___
94114

95115
*Defined in analytics.ts:37*
96116

117+
Register a set of integrations to be used with this Analytics instance.
118+
97119
___
98120

packages/integrations/src/gen-integrations.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ async function prepareiOS({
6969
const xcodeProject = 'ios/RNAnalyticsIntegration.xcodeproj'
7070
const targetXcodeProject = `ios/${nativeModule}.xcodeproj`
7171
const pod_name = `RNAnalyticsIntegration-${slug('-')}`
72-
const framework_name = `Segment_${slug()}`
72+
const framework_name = `Segment-${slug()}`
7373
const {
7474
pod: {
7575
name: pod_dependency = `Segment-${slug()}`,

packages/integrations/template/android/build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ repositories {
4141

4242

4343
dependencies {
44-
api project(":@segment/analytics-react-native")
44+
api project(":@segment_analytics-react-native")
4545
api('{{{dependency}}}') {
4646
transitive = true
4747
}

0 commit comments

Comments
 (0)