-
Notifications
You must be signed in to change notification settings - Fork 78
Expand file tree
/
Copy pathposthog_flutter_platform_interface.dart
More file actions
252 lines (207 loc) · 7.39 KB
/
Copy pathposthog_flutter_platform_interface.dart
File metadata and controls
252 lines (207 loc) · 7.39 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
import 'package:plugin_platform_interface/plugin_platform_interface.dart';
import 'feature_flag_result.dart';
import 'logs/posthog_log_severity.dart';
import 'posthog_config.dart';
import 'posthog_flutter_io.dart';
/// Defines the callback signature for when feature flags are loaded.
///
/// Use [Posthog.getFeatureFlag] or [Posthog.isFeatureEnabled] within this
/// callback to access the loaded flag values.
typedef OnFeatureFlagsCallback = void Function();
abstract class PosthogFlutterPlatformInterface extends PlatformInterface {
/// Constructs a PosthogFlutterPlatform.
PosthogFlutterPlatformInterface() : super(token: _token);
static final Object _token = Object();
static PosthogFlutterPlatformInterface _instance = PosthogFlutterIO();
/// The default instance of [PosthogFlutterPlatformInterface] to use.
///
/// Defaults to [PosthogFlutterIO].
static PosthogFlutterPlatformInterface get instance => _instance;
/// Platform-specific implementations should set this with their own
/// platform-specific class that extends [PosthogFlutterPlatformInterface] when
/// they register themselves.
static set instance(PosthogFlutterPlatformInterface instance) {
PlatformInterface.verifyToken(instance, _token);
_instance = instance;
}
Future<void> setup(PostHogConfig config) {
throw UnimplementedError('setup() has not been implemented.');
}
/// Applies a runtime [PostHogSessionReplayConfig.captureNativeScreens]
/// change by starting or stopping the native occlusion detector.
///
/// A no-op by default: only the mobile platforms have a detector, and web
/// must not throw when the config setter fires.
Future<void> setCaptureNativeScreens(bool enabled) async {}
Future<void> identify({
required String userId,
Map<String, Object>? userProperties,
Map<String, Object>? userPropertiesSetOnce,
}) {
throw UnimplementedError('identify() has not been implemented.');
}
Future<void> setPersonProperties({
Map<String, Object>? userPropertiesToSet,
Map<String, Object>? userPropertiesToSetOnce,
}) {
throw UnimplementedError('setPersonProperties() has not been implemented.');
}
Future<void> capture({
required String eventName,
Map<String, Object>? properties,
Map<String, Object>? userProperties,
Map<String, Object>? userPropertiesSetOnce,
}) {
throw UnimplementedError('capture() has not been implemented.');
}
Future<void> screen({
required String screenName,
Map<String, Object>? properties,
}) {
throw UnimplementedError('screen() has not been implemented.');
}
Future<void> captureLog({
required String body,
PostHogLogSeverity level = PostHogLogSeverity.info,
Map<String, Object>? attributes,
String? traceId,
String? spanId,
int? traceFlags,
}) {
throw UnimplementedError('captureLog() has not been implemented.');
}
/// Opens a URL using the platform's default browser
Future<void> openUrl(String url) {
throw UnimplementedError('openUrl() has not been implemented.');
}
Future<void> alias({required String alias}) {
throw UnimplementedError('alias() has not been implemented.');
}
Future<String> getDistinctId() {
throw UnimplementedError('getDistinctId() has not been implemented.');
}
Future<void> reset() {
throw UnimplementedError('reset() has not been implemented.');
}
Future<void> disable() {
throw UnimplementedError('disable() has not been implemented.');
}
Future<void> enable() {
throw UnimplementedError('enable() has not been implemented.');
}
Future<bool> isOptOut() {
throw UnimplementedError('isOptOut() has not been implemented.');
}
Future<void> debug(bool enabled) {
throw UnimplementedError('debug() has not been implemented.');
}
Future<void> register(String key, Object value) {
throw UnimplementedError('register() has not been implemented.');
}
Future<void> unregister(String key) {
throw UnimplementedError('unregister() has not been implemented.');
}
Future<bool> isFeatureEnabled(String key) {
throw UnimplementedError('isFeatureEnabled() has not been implemented.');
}
Future<void> reloadFeatureFlags() {
throw UnimplementedError('reloadFeatureFlags() has not been implemented.');
}
Future<void> setPersonPropertiesForFlags(Map<String, Object> userProperties) {
throw UnimplementedError(
'setPersonPropertiesForFlags() has not been implemented.',
);
}
Future<void> resetPersonPropertiesForFlags() {
throw UnimplementedError(
'resetPersonPropertiesForFlags() has not been implemented.',
);
}
Future<void> setGroupPropertiesForFlags(
String groupType,
Map<String, Object> groupProperties,
) {
throw UnimplementedError(
'setGroupPropertiesForFlags() has not been implemented.',
);
}
Future<void> resetGroupPropertiesForFlags({String? groupType}) {
throw UnimplementedError(
'resetGroupPropertiesForFlags() has not been implemented.',
);
}
Future<void> showSurvey(Map<String, dynamic> survey) {
throw UnimplementedError('showSurvey() has not been implemented.');
}
Future<void> displaySurvey(String surveyId) {
throw UnimplementedError('displaySurvey() has not been implemented.');
}
Future<void> group({
required String groupType,
required String groupKey,
Map<String, Object>? groupProperties,
}) {
throw UnimplementedError('group() has not been implemented.');
}
Future<Object?> getFeatureFlag({required String key}) {
throw UnimplementedError('getFeatureFlag() has not been implemented.');
}
Future<Object?> getFeatureFlagPayload({required String key}) {
throw UnimplementedError(
'getFeatureFlagPayload() has not been implemented.',
);
}
Future<PostHogFeatureFlagResult?> getFeatureFlagResult({
required String key,
bool sendEvent = true,
}) {
throw UnimplementedError(
'getFeatureFlagResult() has not been implemented.',
);
}
Future<void> flush() {
throw UnimplementedError('flush() has not been implemented.');
}
Future<void> captureException({
required Object error,
StackTrace? stackTrace,
Map<String, Object>? properties,
}) {
throw UnimplementedError('captureException() has not been implemented.');
}
Future<void> addExceptionStep(
String message, {
Map<String, Object>? properties,
}) {
throw UnimplementedError('addExceptionStep() has not been implemented.');
}
Future<void> close() {
throw UnimplementedError('close() has not been implemented.');
}
Future<String?> getSessionId() async {
throw UnimplementedError('getSessionId() not implemented');
}
/// Starts session recording.
///
/// [resumeCurrent] - If true, resumes recording of the current session.
/// If false, starts a new session and begins recording.
/// Defaults to true.
Future<void> startSessionRecording({bool resumeCurrent = true}) {
throw UnimplementedError(
'startSessionRecording() has not been implemented.',
);
}
/// Stops the current session recording if one is in progress.
Future<void> stopSessionRecording() {
throw UnimplementedError(
'stopSessionRecording() has not been implemented.',
);
}
/// Returns whether session replay is currently active.
Future<bool> isSessionReplayActive() {
throw UnimplementedError(
'isSessionReplayActive() has not been implemented.',
);
}
// TODO: missing capture with more parameters
}