Skip to content

Commit 06cc421

Browse files
committed
Update the Flutter SDK documentation
1 parent 6e543f5 commit 06cc421

File tree

2 files changed

+40
-81
lines changed

2 files changed

+40
-81
lines changed

fern/docs/pages/sdks/mobile/flutter/features.mdx

Lines changed: 39 additions & 80 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ DevRev.identifyAnonymousUser(userID);
2929
The unverified identification method identifies users with a unique identifier, but it does not verify their identity with the DevRev backend.
3030

3131
```dart
32-
DevRev.identifyUnverifiedUser(identity);
32+
DevRev.identifyUnverifiedUser(userID, organizationID);
3333
```
3434

3535
### Verified identification
@@ -98,21 +98,17 @@ DevRev.identifyVerifiedUser(userID, sessionToken);
9898
You can update the user's information using the following method:
9999

100100
```dart
101-
DevRev.updateUser(identity)
101+
DevRev.updateUser(identity);
102102
```
103103

104104
<Callout intent="warning">
105105
The `userID` property cannot be updated.
106106
</Callout>
107107

108-
<Callout intent="tip">
109-
The identification functions are asynchronous. Ensure you wrap them in a `Task` when calling from synchronous contexts.
110-
</Callout>
111-
112108
Use this property to check whether the user is identified in the current session:
113109

114110
```dart
115-
await DevRev.isUserIdentified
111+
DevRev.isUserIdentified;
116112
```
117113

118114
#### Logout
@@ -128,29 +124,29 @@ The user is logged out by clearing their credentials, as well as unregistering t
128124
For example:
129125

130126
```dart
131-
// Identify an anonymous user without a user identifier.
132-
await DevRev.identifyAnonymousUser()
127+
// Identify an anonymous user with a user identifier.
128+
DevRev.identifyAnonymousUser("[email protected]");
133129
134130
// Identify an unverified user using their email address as the user identifier.
135-
await DevRev.identifyUnverifiedUser(Identity(userID: "[email protected]"))
131+
DevRev.identifyUnverifiedUser("[email protected]", "organization-1337");
136132
137133
// Identify a verified user using their email address as the user identifier.
138-
await DevRev.identifyVerifiedUser("[email protected]", sessionToken: "bar-1337")
134+
DevRev.identifyVerifiedUser("[email protected]", "bar-1337");
139135
140136
// Update the user's information.
141-
await DevRev.updateUser(Identity(organizationID: "organization-1337"))
137+
DevRev.updateUser({"organizationRef": "organization-1337"});
142138
143139
// Logout the identified user.
144-
await DevRev.logout(deviceID: "dvc32423")
140+
DevRev.logout("dvc32423");
145141
```
146142

147143
### Identity model
148144

149-
The `Identity` interface is used to provide user, organization, and account information when identifying users or updating their details. This class is used primarily with the `identifyUnverifiedUser` and `updateUser` methods.
145+
User identity information is passed as a `Map<String, dynamic>` to the `updateUser` method. The map can contain user, organization, and account information.
150146

151147
#### Properties
152148

153-
The `Identity` class contains the following properties:
149+
The identity map can contain the following properties:
154150

155151
| Property | Type | Required | Description |
156152
|----------|------|----------|-------------|
@@ -242,6 +238,14 @@ DevRev.setShouldDismissModalsOnOpenLink(value);
242238

243239
Setting this flag to true applies the system's default behavior for opening links, which includes dismissing any DevRev modal screens to facilitate handling your own deep links.
244240

241+
## Dynamic theme configuration
242+
243+
The DevRev SDK allows you to configure the theme dynamically based on the system appearance, or use the theme configured on the DevRev portal. By default, the theme will be dynamic and follow the system appearance.
244+
245+
```dart
246+
DevRev.setPrefersSystemTheme(value: boolean);
247+
```
248+
245249
## Analytics
246250

247251
The DevRev SDK allows you to send custom analytic events by using a properties map. You can track these events using the following function:
@@ -253,7 +257,7 @@ DevRev.trackEvent(name, properties);
253257
For example:
254258

255259
```dart
256-
await DevRev.trackEvent(name: "open-message-screen", properties: ["id": "message-1337"])
260+
DevRev.trackEvent("open-message-screen", {"id": "message-1337"});
257261
```
258262

259263
## Session analytics
@@ -310,7 +314,7 @@ DevRev.clearSessionProperties();
310314

311315
To protect sensitive data, you can mask sensitive UI elements such as text fields, text views, and web views using `DevRevMask` widget, as shown below.
312316

313-
#### Example (masked element):
317+
For example:
314318

315319
```dart
316320
DevRevMask(
@@ -320,9 +324,11 @@ DevRevMask(
320324
)
321325
```
322326

327+
### Unmasking sensitive data
328+
323329
You can also manually unmask UI elements that would otherwise be automatically masked using `DevRevUnmask`:
324330

325-
#### Example (unmasked element):
331+
For example:
326332

327333
```dart
328334
DevRevUnmask(
@@ -332,7 +338,7 @@ DevRevUnmask(
332338
)
333339
```
334340

335-
#### Advanced session recording control while masking
341+
### Advanced session recording control while masking
336342

337343
For enhanced session recording and screen transition handling, you can use `DevRevMonitoredApp` as a drop-in replacement for `MaterialApp`. This widget automatically handles screen transition states and ensures proper masking during navigation.
338344

@@ -364,23 +370,23 @@ The mechanism uses balanced start and stop methods, both of which accept a timer
364370
To start a timer, use the following method:
365371

366372
```dart
367-
DevRev.startTimer(name, properties)
373+
DevRev.startTimer(name, properties);
368374
```
369375

370376
To stop a timer, use the following method:
371377

372378
```dart
373-
DevRev.stopTimer(name, properties)
379+
DevRev.endTimer(name, properties);
374380
```
375381

376382
For example:
377383

378384
```dart
379-
DevRev.startTimer("response-time", properties: ["id": "task-1337"])
385+
DevRev.startTimer("response-time", {"id": "task-1337"});
380386
381387
// Perform the task that you want to measure.
382388
383-
DevRev.stopTimer("response-time", properties: ["id": "task-1337"])
389+
DevRev.endTimer("response-time", {"id": "task-1337"});
384390
```
385391

386392
### Screen tracking
@@ -394,23 +400,20 @@ DevRev.trackScreenName(screenName);
394400
For example:
395401

396402
```dart
397-
DevRev.trackScreenName("profile-screen")
403+
DevRev.trackScreenName("profile-screen");
398404
```
399405

400-
#### Screen transition tracking (Android only)
406+
### Screen transition management (Android only)
401407

402-
On Android, the DevRev SDK provides methods to manually track the screen transitions.
403-
404-
When a screen transition begins, you must call the following method:
408+
The DevRev SDK allows tracking of screen transitions to understand the user navigation within your app.
409+
You can manually update the state using the following methods:
405410

406411
```dart
407-
DevRev.setInScreenTransitioning(true)
408-
```
409-
410-
When a screen transition ends, you must call the following method:
412+
// Mark the transition as started.
413+
DevRev.setInScreenTransitioning(true);
411414
412-
```dart
413-
DevRev.setInScreenTransitioning(false)
415+
// Mark the transition as ended.
416+
DevRev.setInScreenTransitioning(false);
414417
```
415418

416419
## Push notifications
@@ -432,7 +435,7 @@ Push notifications require that the SDK has been configured and the user has bee
432435
The DevRev SDK offers a method to register your device for receiving push notifications. You can register for push notifications using the following method:
433436

434437
```dart
435-
DevRev.registerDeviceToken(deviceID, deviceToken);
438+
DevRev.registerDeviceToken(deviceToken, deviceID);
436439
```
437440

438441
On Android devices, the `deviceToken` should be the Firebase Cloud Messaging (FCM) token value, while on iOS devices, it should be the Apple Push Notification Service (APNs) token.
@@ -461,54 +464,10 @@ To process the notification, use the following method:
461464
DevRev.processPushNotification(payload);
462465
```
463466

464-
Here, the `message` object from the notification payload needs to be passed to this function.
465-
466-
##### Example
467-
468-
```dart
469-
const notificationPayload = {
470-
"message": {
471-
"title": "New Message",
472-
"body": "You have received a new message.",
473-
"data": {
474-
"messageId": "12345",
475-
"sender": "John Doe"
476-
}
477-
}
478-
};
479-
480-
const messageJson = notificationPayload["message"];
481-
482-
if (messageJson != null) {
483-
DevRev.processPushNotification(jsonEncode(messageJson));
484-
}
485-
```
486-
487467
#### iOS
488468

489469
On iOS devices, you must pass the received push notification payload to the DevRev SDK for processing. The SDK will then handle the notification and execute the necessary actions.
490470

491471
```dart
492-
DevRev.processPushNotification(payload: String)
493-
```
494-
495-
##### Example
496-
497-
```dart
498-
const notificationPayload = {
499-
"message": {
500-
"title": "New Message",
501-
"body": "You have received a new message.",
502-
"data": {
503-
"messageId": "12345",
504-
"sender": "John Doe"
505-
}
506-
}
507-
};
508-
509-
const messageJson = notificationPayload["message"];
510-
511-
if (messageJson != null) {
512-
DevRev.processPushNotification(jsonEncode(messageJson));
513-
}
472+
DevRev.processPushNotification(payload);
514473
```

fern/docs/pages/sdks/mobile/flutter/migration-guide.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,4 +16,4 @@ This guide helps you transition from the legacy UserExperior SDK to the new DevR
1616
| Masking sensitive data | `UEMarker(child: TextField(controller: provider.fieldController, decoration: InputDecoration(border: OutlineInputBorder(borderRadius: BorderRadius.circular(15))),)` | `DevRevMask(child: TextField(decoration: InputDecoration(labelText: "foo-bar"),),)`<br />`DevRevUnmask(child: TextField(decoration: InputDecoration(labelText: "foo-bar"),),)` |
1717
| Timers | `userExperior.startTimer(timerName, properties)`<br />`userExperior.endTimer(timerName, properties)` | `DevRev.startTimer(name, properties)`<br />`DevRev.endTimer(name, properties)` |
1818
| PLuG support chat | Not supported. | `DevRev.showSupport()`<br /> `DevRev.createSupportConversation()` |
19-
| Push notifications | Not supported. | `DevRev.registerDeviceToken(deviceID, deviceToken)`<br />`DevRev.unregisterDevice(deviceID)` |
19+
| Push notifications | Not supported. | `DevRev.registerDeviceToken(deviceToken, deviceID)`<br />`DevRev.unregisterDevice(deviceID)` |

0 commit comments

Comments
 (0)