Skip to content

Commit

Permalink
Merge pull request #3 from embrace-io/revert-2-update-flutter-docs
Browse files Browse the repository at this point in the history
Revert "Update flutter docs for 3.0.0"
  • Loading branch information
fractalwrench authored Sep 17, 2024
2 parents 32bdb4a + fbec02d commit c345e0d
Show file tree
Hide file tree
Showing 18 changed files with 303 additions and 186 deletions.
6 changes: 0 additions & 6 deletions docs/flutter/changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,6 @@ sidebar_position: 4

# Flutter SDK Changelog

# 3.0.0
*Sep 17, 2024*
* Updated Embrace Android SDK to 6.13.0.
* Updated Embrace iOS SDK to 6.4.0.
* Added Tracing API for capturing spans/events

## 2.0.0
*Mar 13, 2024*
* Removed deprecated methods.
Expand Down
2 changes: 1 addition & 1 deletion docs/flutter/features/identify-users.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ sidebar_position: 2

# Know Your Users

Embrace offers two methods of annotating sessions with information that will help developers and customer service agents find
Embrace offers two ways you can annotate sessions with information that will help developers and customer service agents find
sessions for an unhappy user.

1. [**User Personas**](/flutter/features/identify-users/#user-personas). This is data you can set and update about the user of a session.
Expand Down
4 changes: 2 additions & 2 deletions docs/flutter/features/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,10 @@ sidebar_position: 2

# Flutter Feature Reference

Embrace's SDK includes many advanced features that help you understand more about
Embrace's SDK includes many advanced features that you can enable to help you understand more about
how your application is performing in production.

1. [**Tracing.**](/flutter/features/tracing/) In this section you will learn how you can use Embrace to go beyond logging and crashes and start to examine critical user flows within your application. Measure performance, completion and abandonment easily and consistently.
1. [**Moments.**](/flutter/features/moments/) In this section you will learn how you can use Embrace to go beyond logging and crashes and start to examine critical user flows within your application. Measure performance, completion and abandonment easily and consistently.
1. [**Know your users.**](/flutter/features/identify-users/) Add your own custom identifiers to users and sessions to make sure you can aggregate and find sessions correctly.
1. [**Capture network requests.**](/flutter/features/network-requests/) Automatically capture network requests made by your application.
1. [**Push Notifications.**](/flutter/features/push-notifications) Embrace can automatically capture push notifications received. Learn how to configure this feature.
Expand Down
2 changes: 1 addition & 1 deletion docs/flutter/features/last-run-end-state.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ final didCrashLastRun = await Embrace.instance.getLastRunEndState() == LastRunEn

- The API can only be called after the SDK has been started. If a call is made prior to starting the Embrace SDK you will get a response of `LastRunEndState.invalid`
- It will return that a crash occurred if the app crashed any time since the app last came to the foreground. This includes if the app crashed while running in the background.
- On iOS, this feature only works when the Embrace crash reporter is enabled. It is **not** compatible if you use Crashlytics for crash reporting.
- This feature only works with the Embrace crash reporter on iOS. It is **not** compatible if you use Crashlytics for crash reporting.

### Version

Expand Down
50 changes: 50 additions & 0 deletions docs/flutter/features/moments.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
---
title: Moments
description: Measure the performance of your Flutter application using Embrace
sidebar_position: 1
---

# Moments

## Overview

Embrace also contains a powerful stopwatch and abandonment tracking feature, which we call **moments**.
This mechanism is the same one used to measure application launch performance, which we covered in the [Session Reporting](/flutter/integration/session-reporting) section.

## Starting a Moment

Here's how you start a moment.

```dart
Embrace.instance.startMoment('addItem');
```

In a sample scenario, this is a moment we're using to measure how quickly an item is added to a list after a user selects the plus button.

You can also start a moment with **properties** and **identifier**.
For more on this, check out the [API docs](/api/flutter/).

import PropertyLimit from '@site/shared/property-limit.md';

<PropertyLimit />

## Ending a Moment

Next, here's how you end a moment.

```dart
Embrace.instance.endMoment('addItem');
```

A timer is started once you make a call to start a moment.
If you end the moment within a configurable threshold, then the timer ends and the client's measurement is used to report performance.
You can end the moment from multiple locations in your app.

## Tracking Abandonment

In addition to measuring performance, moments can also measure abandonment.
Moments measure abandonment by default. If the moment never completes, because:

- the user exits the app before the moment ends
- the app crashes
- an unexpected code path is taken
7 changes: 3 additions & 4 deletions docs/flutter/features/network-requests.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,11 @@ sidebar_position: 3

# Network Requests

If you use the [http package](https://pub.dev/packages/http) or the [Dio package](https://pub.dev/packages/dio) to perform network operations, Embrace can capture that information with minimal modification to your codebase. If you are using other solutions, network requests can be manually logged through the Embrace SDK.
If you are using the [http package](https://pub.dev/packages/http) or the [Dio package](https://pub.dev/packages/dio) to perform your network operations, Embrace can capture that information with minimal modification to your codebase. Also, if you are using other method, network requests can be manually logged through the Embrace SDK.

## Using the http package

If you use the [http package](https://pub.dev/packages/http), you should use an instance of `EmbraceHttpClient` to perform
If you are using the [http package](https://pub.dev/packages/http), you should use an instance of `EmbraceHttpClient` to perform
network operations, like this:

```dart
Expand Down Expand Up @@ -46,7 +46,7 @@ var dio = Dio();
dio.interceptors.add(EmbraceInterceptor());
```

Keep in mind that you will need to add the `embrace_dio` package to your `pubspec.yaml` to use `EmbraceInterceptor`.
Keep in mind that you will need to add the `embrace_dio` package to your `pubspec.yaml` to be able to use `EmbraceInterceptor`.

## Manually logging network requests

Expand All @@ -71,6 +71,5 @@ void logNetworkRequest({
required int statusCode,
String? error,
String? traceId,
String? w3cTraceParent,
});
```
20 changes: 4 additions & 16 deletions docs/flutter/features/push-notifications.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,23 +24,11 @@ If you want to capture data from inside the notifications then you can set the c

## iOS configuration

Push notifications capture is controlled by supplying a `captureService` when initializing the iOS SDK. To enable this functionality, add the following to where Embrace is initialized in your `AppDelegate`:
Push notifications capture is controlled by the local config `PUSH_NOTIFICATIONS_CAPTURE_MODE` in the `Embrace-Info.plist` file. To enable this functionality, this config must be set to `automatic` (to disable it again, the config can be set to the default `manual`).

```swift
let builder = CaptureServiceBuilder().addDefaults()
builder.add(.pushNotification())
let services = builder.build()

try Embrace
.setup(
options: Embrace.Options(
appId: "", // Your app ID
captureServices: services,
crashReporter: EmbraceCrashReporter()
)
)
.start()
```
:::info
If you want to prevent any data inside the notifications from being captured, you can set the local config `ENABLE_PUSH_NOTIFICATIONS_DATA_CAPTURE` to `NO`.
:::

## Manually logging push notifications

Expand Down
101 changes: 0 additions & 101 deletions docs/flutter/features/tracing.md

This file was deleted.

110 changes: 85 additions & 25 deletions docs/flutter/integration/add-embrace-sdk.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,43 +8,99 @@ sidebar_position: 3

## Add the Embrace Flutter SDK to the project

Add the Embrace package to your `pubspec.yaml`:
Add the Embrace package to `pubspec.yaml` with the following command:

```shell-session
flutter pub add embrace
```

## iOS setup
## Automated integration

Firstly alter the AppDelegate to initialize Embrace in the `init` function:

```swift
@UIApplicationMain
@objc class AppDelegate: FlutterAppDelegate {
override init() {
super.init()
do {
try Embrace
.setup(
options: Embrace.Options(
appId: "", // Your App ID from Embrace Dash
platform: .flutter
)
)
.start()
} catch let e {
print("Error starting Embrace \(e.localizedDescription)")
}
}
}
You can use the `embrace-cli` Dart package to configure your Android and iOS projects to use the Embrace SDK. Alternatively, you can perform the configuration manually.

To install the Embrace CLI, run the following command from any directory:

```shell-session
dart pub global activate embrace_cli
```

### Uploading Symbol Files
## Using the Embrace CLI

```mdx-code-block
import Tabs from '@theme/Tabs';
import TabItem from '@theme/TabItem';
```

Run the following command to configure your project:

<Tabs groupId="platform" queryString="platform">
<TabItem value="ios" label="iOS">

```shell-session
embrace_cli installIos YOUR_APP_ID YOUR_API_TOKEN
```

</TabItem>
<TabItem value="android" label="Android">

```shell-session
embrace_cli installAndroid YOUR_APP_ID YOUR_API_TOKEN
```

</TabItem>
</Tabs>

You can use git to see the changes that the script made.

```shell-session
git diff
```

## iOS setup

:::info
Embrace uploads the dSYM symbol files of your application using a script bundled with the Embrace iOS SDK. This makes stacktraces from crashes human-readable.
These steps can be performed automatically with the `installIos` command when using the [Embrace CLI.](#using-the-embrace-cli)
:::

### Add the Embrace App ID

You'll need to add an `Embrace-Info.plist` file at the root of the iOS project.

1. Create a file called `Embrace-Info.plist` with the following content (you can find your 5-character app ID and API token in the Embrace dashboard):


```xml
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>API_KEY</key>
<string>{YOUR_APP_ID}</string>
<key>API_TOKEN</key>
<string>{YOUR_API_TOKEN}</string>
<key>CRASH_REPORT_ENABLED</key>
<true/>
</dict>
</plist>
```

2. Identify your root iOS Project.
<img src={require('@site/static/images/addEmbraceInfo-1.png').default} />

3. Right click on that project and select `Add Files to YOUR_PROJECT`.
<img src={require('@site/static/images/addEmbraceInfo-2.png').default} />

4. Select `Embrace-Info.plist` and click on `Add`. Do not forget to select which `Targets` you are using.
<img src={require('@site/static/images/addEmbraceInfo-3.png').default} />

5. Check if the file appears inside YOUR_PROJECT.
<img src={require('@site/static/images/addEmbraceInfo-4.png').default} />


### Uploading Symbol Files

To make stack traces of native crashes readable, Embrace needs the dSym symbol files of your application. These can be uploaded with a script included in the Embrace iOS SDK.

On the Xcode Build Phase tab, add a new run script. You can find your 5-character app ID and API token in the Embrace dashboard:

```
Expand All @@ -53,6 +109,10 @@ EMBRACE_ID={YOUR_APP_ID} EMBRACE_TOKEN={YOUR_API_TOKEN} "${PODS_ROOT}/EmbraceIO/

## Android setup

:::info
These steps can be performed automatically with the `installAndroid` command when using the [Embrace CLI.](#using-the-embrace-cli)
:::

In the root-level `build.gradle` file, add the `embrace-swazzler` dependency:

```gradle
Expand Down
Loading

0 comments on commit c345e0d

Please sign in to comment.