Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refactor: merge http plugin into mono-repo #520

Open
wants to merge 12 commits into
base: refactor/monorepo
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 10 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
34 changes: 28 additions & 6 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -131,10 +131,10 @@ commands:
steps:
- run:
name: Generate Pigeons
command: melos pigeon
command: melos pigeon --no-select
- run:
name: Build Pigeons
command: melos generate
command: melos generate --no-select
- when:
condition:
equal:
Expand Down Expand Up @@ -188,7 +188,7 @@ jobs:
- setup_flutter:
version: <<parameters.version>>
use_melos: true
- run: melos test-coverage
- run: melos test-coverage --no-select
- persist_to_workspace:
root: ~/project
paths:
Expand Down Expand Up @@ -307,8 +307,16 @@ jobs:
- setup_flutter
- run:
name: Check Package Score
command: melos score
- run: melos dryPublish
command: melos score --no-select
- run: melos dryPublish --no-select

release_http_adapter_plugin:
executor: flutter-executor
steps:
- advanced-checkout/shallow-checkout
- setup_flutter
- run: chmod +x packages/Instabug-Dart-http-Adapter/release.sh
- run: ./packages/Instabug-Dart-http-Adapter/release.sh

release_instabug_flutter:
macos:
Expand All @@ -332,7 +340,7 @@ jobs:
- run:
name: Generate Pigeons
working_directory: project
command: melos pigeon
command: melos pigeon --no-select
- run:
name: Clone Escape
command: git clone [email protected]:Instabug/Escape.git
Expand Down Expand Up @@ -388,6 +396,20 @@ workflows:
filters:
branches:
only: master
- hold_release_http_adapter_plugin:
type: approval
requires:
- test_flutter-stable
filters:
branches:
only: master
- release_http_adapter_plugin:
requires:
- hold_release_http_adapter_plugin
- verify_pub
filters:
branches:
only: master
- release_instabug_flutter:
requires:
- hold_release_instabug_flutter
Expand Down
7 changes: 3 additions & 4 deletions packages/instabug_flutter/example/pubspec.lock
Original file line number Diff line number Diff line change
Expand Up @@ -111,10 +111,9 @@ packages:
instabug_http_client:
dependency: "direct main"
description:
name: instabug_http_client
sha256: "7d52803c0dd639f6dddbe07333418eb251ae02f3f9f4d30402517533ca692784"
url: "https://pub.dev"
source: hosted
path: "../../instabug_http_client"
relative: true
source: path
version: "2.4.0"
leak_tracker:
dependency: transitive
Expand Down
37 changes: 37 additions & 0 deletions packages/instabug_http_client/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
# Changelog

## Unreleased

- Enables `InstabugHttpClient` to wrap an internal `http` client.
- Add support for `http` v1 ([#20](https://github.com/Instabug/Instabug-Dart-http-Adapter/pull/20)).

## [2.4.0] - 7/05/2024

### Added

- Add support for Instabug Flutter SDK v12 and v13 ([#17](https://github.com/Instabug/Instabug-Dart-http-Adapter/pull/17)).

## [2.3.0] - 3/11/2022

- Adds support for MultipartRequest.

## [2.2.1] - 2/8/2022

- Bumps [instabug_flutter](https://pub.dev/packages/instabug_flutter) to v11

## [2.2.0] - 11/4/2022

- Adds support for logging network requests using `send` method.

## [2.1.0] - 5/1/2022

- Fixes network log compilation error.
- Adds payload size for network log.

## [2.0.0] - 30/11/2021

- Upgrades to null safety.

## [1.0.0] - 29/7/2019

- Adds implementation for the instabug_http_client library which supports Instabug network logging for the dart library: http.
21 changes: 21 additions & 0 deletions packages/instabug_http_client/LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
MIT License

Copyright (c) Instabug

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
36 changes: 36 additions & 0 deletions packages/instabug_http_client/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
# instabug_http_client

A dart package to support Instabug network logging for the external dart [http](https://pub.dev/packages/http) package.

## Getting Started

You can choose to attach all your network requests data to the Instabug reports being sent to the dashboard. See the details below on how to enable the feature for the `http` package.

### Installation

1. Add the dependency to your project `pubspec.yml`:

```yaml
dependencies:
instabug_http_client:
```

2. Install the package by running the following command.

```bash
flutter packages get
```

### Usage

To enable logging, use the custom http client provided by Instabug:

```dart
final client = InstabugHttpClient();
```

Then proceed to use the package normally:

```dart
final response = await client.get(Uri.parse(URL));
```
10 changes: 10 additions & 0 deletions packages/instabug_http_client/example/.metadata
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
# This file tracks properties of this Flutter project.
# Used by Flutter tool to assess capabilities and perform upgrades etc.
#
# This file should be version controlled and should not be manually edited.

version:
revision: 7e9793dee1b85a243edd0e06cb1658e98b077561
channel: stable

project_type: app
16 changes: 16 additions & 0 deletions packages/instabug_http_client/example/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# example

A new Flutter project.

## Getting Started

This project is a starting point for a Flutter application.

A few resources to get you started if this is your first Flutter project:

- [Lab: Write your first Flutter app](https://flutter.dev/docs/get-started/codelab)
- [Cookbook: Useful Flutter samples](https://flutter.dev/docs/cookbook)

For help getting started with Flutter, view our
[online documentation](https://flutter.dev/docs), which offers tutorials,
samples, guidance on mobile development, and a full API reference.
29 changes: 29 additions & 0 deletions packages/instabug_http_client/example/analysis_options.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
# This file configures the analyzer, which statically analyzes Dart code to
# check for errors, warnings, and lints.
#
# The issues identified by the analyzer are surfaced in the UI of Dart-enabled
# IDEs (https://dart.dev/tools#ides-and-editors). The analyzer can also be
# invoked from the command line by running `flutter analyze`.

# The following line activates a set of recommended lints for Flutter apps,
# packages, and plugins designed to encourage good coding practices.
include: package:flutter_lints/flutter.yaml

linter:
# The lint rules applied to this project can be customized in the
# section below to disable rules from the `package:flutter_lints/flutter.yaml`
# included above or to enable additional rules. A list of all available lints
# and their documentation is published at
# https://dart-lang.github.io/linter/lints/index.html.
#
# Instead of disabling a lint rule for the entire project in the
# section below, it can also be suppressed for a single line of code
# or a specific dart file by using the `// ignore: name_of_lint` and
# `// ignore_for_file: name_of_lint` syntax on the line or in the file
# producing the lint.
rules:
# avoid_print: false # Uncomment to disable the `avoid_print` rule
# prefer_single_quotes: true # Uncomment to enable the `prefer_single_quotes` rule

# Additional information about this file can be found at
# https://dart.dev/guides/language/analysis-options
13 changes: 13 additions & 0 deletions packages/instabug_http_client/example/android/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
gradle-wrapper.jar
/.gradle
/captures/
/gradlew
/gradlew.bat
/local.properties
GeneratedPluginRegistrant.java

# Remember to never publicly share your keystore.
# See https://flutter.dev/docs/deployment/android#reference-the-keystore-from-the-app
key.properties
**/*.keystore
**/*.jks
68 changes: 68 additions & 0 deletions packages/instabug_http_client/example/android/app/build.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
def localProperties = new Properties()
def localPropertiesFile = rootProject.file('local.properties')
if (localPropertiesFile.exists()) {
localPropertiesFile.withReader('UTF-8') { reader ->
localProperties.load(reader)
}
}

def flutterRoot = localProperties.getProperty('flutter.sdk')
if (flutterRoot == null) {
throw new GradleException("Flutter SDK not found. Define location with flutter.sdk in the local.properties file.")
}

def flutterVersionCode = localProperties.getProperty('flutter.versionCode')
if (flutterVersionCode == null) {
flutterVersionCode = '1'
}

def flutterVersionName = localProperties.getProperty('flutter.versionName')
if (flutterVersionName == null) {
flutterVersionName = '1.0'
}

apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'
apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle"

android {
compileSdkVersion flutter.compileSdkVersion

compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}

kotlinOptions {
jvmTarget = '1.8'
}

sourceSets {
main.java.srcDirs += 'src/main/kotlin'
}

defaultConfig {
// TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html).
applicationId "com.example.example"
minSdkVersion flutter.minSdkVersion
targetSdkVersion flutter.targetSdkVersion
versionCode flutterVersionCode.toInteger()
versionName flutterVersionName
}

buildTypes {
release {
// TODO: Add your own signing config for the release build.
// Signing with the debug keys for now, so `flutter run --release` works.
signingConfig signingConfigs.debug
}
}
}

flutter {
source '../..'
}

dependencies {
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.example">
<!-- Flutter needs it to communicate with the running application
to allow setting breakpoints, to provide hot reload, etc.
-->
<uses-permission android:name="android.permission.INTERNET"/>
</manifest>
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.example">
<application
android:label="example"
android:name="${applicationName}"
android:icon="@mipmap/ic_launcher">
<activity
android:name=".MainActivity"
android:exported="true"
android:launchMode="singleTop"
android:theme="@style/LaunchTheme"
android:configChanges="orientation|keyboardHidden|keyboard|screenSize|smallestScreenSize|locale|layoutDirection|fontScale|screenLayout|density|uiMode"
android:hardwareAccelerated="true"
android:windowSoftInputMode="adjustResize">
<!-- Specifies an Android theme to apply to this Activity as soon as
the Android process has started. This theme is visible to the user
while the Flutter UI initializes. After that, this theme continues
to determine the Window background behind the Flutter UI. -->
<meta-data
android:name="io.flutter.embedding.android.NormalTheme"
android:resource="@style/NormalTheme"
/>
<intent-filter>
<action android:name="android.intent.action.MAIN"/>
<category android:name="android.intent.category.LAUNCHER"/>
</intent-filter>
</activity>
<!-- Don't delete the meta-data below.
This is used by the Flutter tool to generate GeneratedPluginRegistrant.java -->
<meta-data
android:name="flutterEmbedding"
android:value="2" />
</application>
</manifest>
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
// Generated file.
// If you wish to remove Flutter's multidex support, delete this entire file.

package io.flutter.app;

import android.content.Context;
import androidx.annotation.CallSuper;
import androidx.multidex.MultiDex;

/**
* Extension of {@link io.flutter.app.FlutterApplication}, adding multidex support.
*/
public class FlutterMultiDexApplication extends FlutterApplication {
@Override
@CallSuper
protected void attachBaseContext(Context base) {
super.attachBaseContext(base);
MultiDex.install(this);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
package com.example.example

import io.flutter.embedding.android.FlutterActivity

class MainActivity: FlutterActivity() {
}
Loading