Skip to content
Open
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
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
262 changes: 199 additions & 63 deletions .circleci/config.yml

Large diffs are not rendered by default.

7 changes: 5 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
# Generated files
*.mocks.dart
*.g.dart
android/**/generated/
ios/**/Generated/
packages/**/android/**/generated/
packages/**/ios/**/Generated/

# Miscellaneous
*.class
Expand Down Expand Up @@ -63,6 +63,8 @@ android/gradlew.bat
**/ios/**/DerivedData/
**/ios/**/Icon?
**/ios/**/Pods/
**/ios/**/Pods/

**/ios/**/.symlinks/
**/ios/**/profile
**/ios/**/xcuserdata
Expand All @@ -84,3 +86,4 @@ android/gradlew.bat
!**/ios/**/default.pbxuser
!**/ios/**/default.perspectivev3
!/packages/flutter_tools/test/data/dart_dependencies_test/**/.packages
/packages/**/lib/src/generated/
127 changes: 25 additions & 102 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,116 +1,39 @@
# Instabug for Flutter
<!--
This README describes the package. If you publish this package to pub.dev,
this README's contents appear on the landing page for your package.

[![pub package](https://img.shields.io/pub/v/instabug_flutter.svg)](https://pub.dev/packages/instabug_flutter)
For information about how to write a good package README, see the guide for
[writing package pages](https://dart.dev/tools/pub/writing-package-pages).

A Flutter plugin for [Instabug](https://instabug.com/).
For general information about developing packages, see the Dart guide for
[creating packages](https://dart.dev/guides/libraries/create-packages)
and the Flutter guide for
[developing packages and plugins](https://flutter.dev/to/develop-packages).
-->

## Available Features
TODO: Put a short description of the package here that helps potential users
know whether this package might be useful for them.

| Feature | Status |
|:---------------------------------------------------------:|:-------:|
| [Bug Reporting](https://docs.instabug.com/docs/flutter-bug-reporting) | ✅ |
| [Crash Reporting](https://docs.instabug.com/docs/flutter-crash-reporting) | ✅ |
| [App Performance Monitoring](https://docs.instabug.com/docs/flutter-apm) | ✅ |
| [In-App Replies](https://docs.instabug.com/docs/flutter-in-app-replies) | ✅ |
| [In-App Surveys](https://docs.instabug.com/docs/flutter-in-app-surveys) | ✅ |
| [Feature Requests](https://docs.instabug.com/docs/flutter-in-app-feature-requests) | ✅ |
## Features

* ✅ Stable
* ⚙️ Under active development
TODO: List what your package can do. Maybe include images, gifs, or videos.

## Integration
## Getting started

### Installation
TODO: List prerequisites and provide or point to information on how to
start using the package.

1. Add Instabug to your `pubspec.yaml` file.
## Usage

```yaml
dependencies:
instabug_flutter:
```

2. Install the package by running the following command.

```bash
flutter packages get
```

### Initializing Instabug

Initialize the SDK in your `main` function. This starts the SDK with the default behavior and sets it to be shown when the device is shaken.
TODO: Include short and useful examples for package users. Add longer examples
to `/example` folder.

```dart
import 'package:instabug_flutter/instabug_flutter.dart';

void main() {
WidgetsFlutterBinding.ensureInitialized();

Instabug.init(
token: 'APP_TOKEN',
invocationEvents: [InvocationEvent.shake],
);

runApp(MyApp());
}
const like = 'sample';
```

> :warning: If you're updating the SDK from versions prior to v11, please check our [migration guide](https://docs.instabug.com/docs/flutter-migration-guide).

## Crash reporting

Instabug automatically captures every crash of your app and sends relevant details to the crashes page of your dashboard.

⚠️ **Crashes will only be reported in release mode and not in debug mode.**

```dart
void main() {
runZonedGuarded(
() {
WidgetsFlutterBinding.ensureInitialized();

Instabug.init(
token: 'APP_TOKEN',
invocationEvents: [InvocationEvent.shake],
);

FlutterError.onError = (FlutterErrorDetails details) {
Zone.current.handleUncaughtError(details.exception, details.stack!);
};

runApp(MyApp());
},
CrashReporting.reportCrash,
);
}
```

## Repro Steps
Repro Steps list all of the actions an app user took before reporting a bug or crash, grouped by the screens they visited in your app.

To enable this feature, you need to add `InstabugNavigatorObserver` to the `navigatorObservers` :
```
runApp(MaterialApp(
navigatorObservers: [InstabugNavigatorObserver()],
));
```

## Network Logging
You can choose to attach all your network requests to the reports being sent to the dashboard. To enable the feature when using the `dart:io` package `HttpClient`, please refer to the [Instabug Dart IO Http Client](https://github.com/Instabug/instabug-dart-io-http-client) repository.

We also support the packages `http` and `dio`. For details on how to enable network logging for these external packages, refer to the [Instabug Dart Http Adapter](https://github.com/Instabug/Instabug-Dart-http-Adapter) and the [Instabug Dio Interceptor](https://github.com/Instabug/Instabug-Dio-Interceptor) repositories.

## Microphone and Photo Library Usage Description (iOS Only)

Instabug needs access to the microphone and photo library to be able to let users add audio and video attachments. Starting from iOS 10, apps that don’t provide a usage description for those 2 permissions would be rejected when submitted to the App Store.

For your app not to be rejected, you’ll need to add the following 2 keys to your app’s info.plist file with text explaining to the user why those permissions are needed:

* `NSMicrophoneUsageDescription`
* `NSPhotoLibraryUsageDescription`

If your app doesn’t already access the microphone or photo library, we recommend using a usage description like:

* "`<app name>` needs access to the microphone to be able to attach voice notes."
* "`<app name>` needs access to your photo library for you to be able to attach images."
## Additional information

**The permission alert for accessing the microphone/photo library will NOT appear unless users attempt to attach a voice note/photo while using Instabug.**
TODO: Tell users more about the package: where to find more information, how to
contribute to the package, how to file issues, what response they can expect
from the package authors, and more.
5 changes: 3 additions & 2 deletions analysis_options.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,9 @@ include: package:lint/analysis_options_package.yaml

analyzer:
exclude:
- "example/**"
- "**/*.g.dart"
- "packages/**/*.g.dart"
- "packages/**/example/**"


linter:
rules:
Expand Down
30 changes: 22 additions & 8 deletions dangerfile.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { danger, fail, schedule, warn } from 'danger';
import collectCoverage, { ReportType } from '@instabug/danger-plugin-coverage';
import collectCoverage, {ReportOptions, ReportType} from '@instabug/danger-plugin-coverage';
import * as fs from 'fs';

const hasSourceChanges = danger.git.modified_files.some((file) =>
file.startsWith('lib/')
Expand All @@ -20,7 +21,7 @@ async function hasDescription() {
);
}

if (!danger.git.modified_files.includes('CHANGELOG.md') && !declaredTrivial) {
if (!danger.git.modified_files.includes('packages/instabug-Flutter/CHANGELOG.md') && !declaredTrivial) {
warn(
'You have not included a CHANGELOG entry! \nYou can find it at [CHANGELOG.md](https://github.com/Instabug/Instabug-Flutter/blob/master/CHANGELOG.md).'
);
Expand All @@ -29,9 +30,22 @@ async function hasDescription() {

schedule(hasDescription());

collectCoverage({
label: 'Dart',
type: ReportType.LCOV,
filePath: 'coverage/lcov.info',
threshold: 80,
});
// Function to extract the second part of the filename using '-' as a separator
const getLabelFromFilename = (filename: string): string | null => {
const parts = filename.split('-');
return parts[1] ? parts[1].replace(/\.[^/.]+$/, '') : null; // Removes extension
};

console.log(JSON.stringify(getLabelFromFilename));
const files = fs.readdirSync('coverage');
let reportOptions: ReportOptions[] = [];
for (let file of files) {
reportOptions.push({
label: getLabelFromFilename(file),
type: ReportType.LCOV,
filePath: "coverage/"+file,
threshold: 80,
});
}
collectCoverage(reportOptions);

Loading