Skip to content

Commit

Permalink
chore: minor fixes and cleanups
Browse files Browse the repository at this point in the history
  • Loading branch information
oscb committed Dec 7, 2023
1 parent b92f265 commit d9ad83f
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 91 deletions.
14 changes: 3 additions & 11 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -54,20 +54,12 @@ The hassle-free way to add Segment analytics to your React-Native app.
Install `@segment/analytics-react-native`, [`@segment/sovran-react-native`](https://github.com/segmentio/analytics-react-native/blob/master/packages/sovran) and [`react-native-get-random-values`](https://github.com/LinusU/react-native-get-random-values):

```sh
yarn add @segment/analytics-react-native @segment/sovran-react-native react-native-get-random-values
yarn add @segment/analytics-react-native @segment/sovran-react-native react-native-get-random-values @react-native-async-storage/async-storage
# or
npm install --save @segment/analytics-react-native @segment/sovran-react-native react-native-get-random-values
npm install --save @segment/analytics-react-native @segment/sovran-react-native react-native-get-random-values @react-native-async-storage/async-storage
```

If you want to use the default persistor for the Segment Analytics client, you also have to install [`react-native-async-storage/async-storage`](https://github.com/react-native-async-storage/async-storage).

```sh
yarn add @react-native-async-storage/async-storage
# or
npm install --save @react-native-async-storage/async-storage
```

*Note: If you wish to use your own persistence layer you can use the `storePersistor` option when initializing the client. Make sure you always have a persistor (either by having AsyncStorage package installed or by explicitly passing a value), else you might get unexpected sideeffects like multiple 'Application Installed' events. Read more [Client Options](#client-options)*
*Note: `@react-native-async-storage/async-storage` is an optional dependency. If you wish to use your own persistence layer you can use the `storePersistor` option when initializing the client. Make sure you always have a persistor (either by having AsyncStorage package installed or by explicitly passing a value), else you might get unexpected side-effects like multiple 'Application Installed' events. Read more [Client Options](#client-options)*

For iOS, install native modules with:

Expand Down
75 changes: 0 additions & 75 deletions examples/E2E/plugins/ConsentManager.tsx

This file was deleted.

2 changes: 1 addition & 1 deletion packages/core/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ export {
export { SegmentClient } from './analytics';
export { SegmentDestination } from './plugins/SegmentDestination';
export {
CategoryConsentStatusProvider,
type CategoryConsentStatusProvider,
ConsentPlugin,
} from './plugins/ConsentPlugin';
export * from './flushPolicies';
Expand Down
12 changes: 9 additions & 3 deletions packages/core/src/plugins/ConsentPlugin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,12 +30,16 @@ export interface CategoryConsentStatusProvider {
*/
export class ConsentPlugin extends Plugin {
type = PluginType.before;
private consentCategoryProvider: CategoryConsentStatusProvider;
private categories: string[];

constructor(
private consentCategoryProvider: CategoryConsentStatusProvider,
private categories: string[]
consentCategoryProvider: CategoryConsentStatusProvider,
categories: string[]
) {
super();
this.consentCategoryProvider = consentCategoryProvider;
this.categories = categories;
}

configure(analytics: SegmentClient): void {
Expand Down Expand Up @@ -135,9 +139,11 @@ export class ConsentPlugin extends Plugin {
*/
class ConsentFilterPlugin extends Plugin {
type = PluginType.before;
private shouldAllowEvent: (event: SegmentEvent) => boolean;

constructor(private shouldAllowEvent: (event: SegmentEvent) => boolean) {
constructor(shouldAllowEvent: (event: SegmentEvent) => boolean) {
super();
this.shouldAllowEvent = shouldAllowEvent;
}

execute(event: SegmentEvent): SegmentEvent | undefined {
Expand Down
Submodule analytics-swift-consent deleted from 8e2324

0 comments on commit d9ad83f

Please sign in to comment.