Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
8 changes: 4 additions & 4 deletions example/ios/Podfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -286,10 +286,10 @@ PODS:
- React
- RNGestureHandler (2.3.0):
- React-Core
- segment-analytics-react-native (2.1.8):
- segment-analytics-react-native (2.1.9):
- React-Core
- sovran-react-native
- segment-analytics-react-native-plugin-idfa (0.2.0-beta):
- segment-analytics-react-native-plugin-idfa (0.2.1):
- React-Core
- sovran-react-native (0.2.6):
- React-Core
Expand Down Expand Up @@ -459,8 +459,8 @@ SPEC CHECKSUMS:
RNCAsyncStorage: b49b4e38a1548d03b74b30e558a1d18465b94be7
RNCMaskedView: 0e1bc4bfa8365eba5fbbb71e07fbdc0555249489
RNGestureHandler: 77d59828d40838c9fabb76a12d2d0a80c006906f
segment-analytics-react-native: 1b6238e92a7d9e85148b7113ef3b6c529d1cfc29
segment-analytics-react-native-plugin-idfa: 2dc6e38506a5b034db4a4cf16db48643b2f356a2
segment-analytics-react-native: 4b7a033f75bd5f0d50ca700c36048bdd2a997a76
segment-analytics-react-native-plugin-idfa: 80e5d610f537156833eabea12a1804523355de95
sovran-react-native: ef02f663b489ac5e63ea7b80cd8426bf82992263
Yoga: 90dcd029e45d8a7c1ff059e8b3c6612ff409061a

Expand Down
4 changes: 3 additions & 1 deletion packages/core/src/analytics.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ import {
UserInfoState,
UserTraits,
} from './types';
import { getPluginsWithFlush } from './util';
import { getPluginsWithFlush, getPluginsWithReset } from './util';
import { getUUID } from './uuid';

export class SegmentClient {
Expand Down Expand Up @@ -663,6 +663,8 @@ export class SegmentClient {
traits: undefined,
});

getPluginsWithReset(this.timeline).forEach((plugin) => plugin.reset());

this.logger.info('Client has been reset');
}
}
15 changes: 15 additions & 0 deletions packages/core/src/util.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,3 +38,18 @@ export const getPluginsWithFlush = (timeline: Timeline) => {

return eventPlugins;
};

export const getPluginsWithReset = (timeline: Timeline) => {
if (!timeline) {
return [];
}

const allPlugins = getAllPlugins(timeline);

// checking for the existence of .reset()
const eventPlugins = allPlugins?.filter(
(f) => (f as EventPlugin).reset
) as EventPlugin[];

return eventPlugins;
};