diff --git a/.circleci/config.yml b/.circleci/config.yml index 67e56d8fa..3c4365122 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -2,18 +2,36 @@ version: 2.1 orbs: android: circleci/android@2.5.0 - flutter: circleci/flutter@2.0.2 + flutter: circleci/flutter@2.0.4 node: circleci/node@5.2.0 advanced-checkout: vsco/advanced-checkout@1.1.0 +executors: + flutter-executor: + docker: + - image: cimg/base:stable + + commands: setup_flutter: + parameters: + version: + type: string + default: 3.24.3 + use_melos: + type: boolean + default: true + working_dir: + type: string + default: "~/project" steps: - flutter/install_sdk_and_pub: - version: 3.10.5 - - run: - name: Generate Pigeons - command: sh ./scripts/pigeon.sh + version: <> + app-dir: <> + - install_flutter_and_dart_packages: + generate_pigeons: true + use_melos: <> + working_dir: <> setup_ios: steps: # Flutter doesn't support Apple Silicon yet, so we need to install Rosetta use Flutter on M1 machines. @@ -26,7 +44,7 @@ commands: command: sudo gem install cocoapods - run: name: Install Pods - working_directory: example/ios + working_directory: packages/instabug_flutter/example/ios command: pod install --repo-update setup_captain: parameters: @@ -77,32 +95,71 @@ commands: name: Configure Captain Platform command: echo 'export CAPTAIN_PLATFORM=<>' >> $BASH_ENV # This runs `flutter pub get` and `dart pub get` if we pass parameter `generate_pigeons` to the job it also runs the following: - # - `sh ./scripts/pigeon.sh` - # - `dart run build_runner build --delete-conflicting-outputs` + # - `melos pigeon` + # - `melos generate` install_flutter_and_dart_packages: parameters: generate_pigeons: type: boolean + use_melos: + type: boolean + default: true + working_dir: + type: string steps: - - run: - name: Install Flutter Packages - command: flutter pub get - - run: - name: Install Dart Packages - command: dart pub get - description: Install Dart Packages (for dart explicit packages) - when: condition: equal: - - <> + - <> - true steps: - run: - name: Generate Pigeons - command: sh ./scripts/pigeon.sh + name: Install melos + command: dart pub global activate melos && echo 'export PATH="$PATH:$HOME/.pub-cache/bin"' >> $BASH_ENV + - run: + name: Install Flutter Packages + command: melos bootstrap + - run: + name: Install Dart Packages + command: melos dart_bootstrap + description: Install Dart Packages (for dart explicit packages) + - when: + condition: + equal: + - <> + - true + steps: + - run: + name: Generate Pigeons + command: melos pigeon --no-select + - run: + name: Build Pigeons + command: melos generate --no-select + - when: + condition: + equal: + - <> + - false + steps: + - run: + name: Install Flutter Packages + command: flutter pub get - run: - name: Build Pigeons - command: dart run build_runner build --delete-conflicting-outputs + name: Install Dart Packages + command: dart pub get + description: Install Dart Packages (for dart explicit packages) + - when: + condition: + equal: + - <> + - true + steps: + - run: + name: Generate Pigeons + command: sh scripts/pigeon.sh + - run: + name: Build Pigeons + command: dart run build_runner build --delete-conflicting-outputs jobs: danger: @@ -114,7 +171,7 @@ jobs: pkg-manager: yarn override-ci-command: yarn install --frozen-lockfile --network-concurrency 1 - attach_workspace: - at: coverage + at: ~/project - run: name: Run Danger command: yarn danger ci @@ -123,20 +180,38 @@ jobs: parameters: version: type: string - docker: - - image: cirrusci/flutter:<> + default: "3.24.3" + executor: flutter-executor steps: - advanced-checkout/shallow-checkout - - install_flutter_and_dart_packages: - generate_pigeons: true - - run: flutter test --coverage - - run: - working_directory: coverage - command: lcov --remove lcov.info '*.g.dart' '*.mocks.dart' -o lcov.info + - run: sudo apt-get update&& sudo apt-get -y install lcov + - setup_flutter: + version: <> + use_melos: true + - run: melos test-coverage --no-select - persist_to_workspace: - root: coverage + root: ~/project paths: - - lcov.info + - coverage + + + test_flutter_without_melos: + parameters: + version: + type: string + default: "2.10.0" + app-dir: + type: string + executor: flutter-executor + working_directory: <> + steps: + - advanced-checkout/shallow-checkout: + path: ~/project + - setup_flutter: + version: <> + use_melos: false + working_dir: <> + - run: flutter test test_android: executor: @@ -147,7 +222,7 @@ jobs: - advanced-checkout/shallow-checkout - setup_flutter - android/run-tests: - working-directory: example/android + working-directory: packages/instabug_flutter/example/android test-command: ./gradlew test e2e_android_captain: @@ -162,9 +237,9 @@ jobs: - setup_flutter - android/start-emulator-and-run-tests: run-tests-working-directory: e2e - additional-avd-args: --device 3 + additional-avd-args: --device 25 system-image: system-images;android-33;default;x86_64 - post-emulator-launch-assemble-command: cd example && flutter build apk --debug + post-emulator-launch-assemble-command: cd packages/instabug_flutter/example && flutter build apk --debug test-command: dotnet test test_ios: @@ -178,7 +253,7 @@ jobs: - setup_ios - run: name: Build and run tests - working_directory: ~/project/example/ios + working_directory: ~/project/packages/instabug_flutter/example/ios command: | xcodebuild -allowProvisioningUpdates \ -workspace Runner.xcworkspace \ @@ -199,53 +274,72 @@ jobs: - setup_ios - run: name: Build Example App - working_directory: example + working_directory: packages/instabug_flutter/example command: flutter build ios --simulator - run: name: Run E2E Tests - no_output_timeout: 30m + no_output_timeout: 20m working_directory: e2e command: dotnet test format_flutter: - docker: - - image: cirrusci/flutter + executor: flutter-executor steps: - advanced-checkout/shallow-checkout - - install_flutter_and_dart_packages: - generate_pigeons: false + - setup_flutter - run: name: Check Format - command: dart format . --set-exit-if-changed + command: melos format lint_flutter: - docker: - - image: cirrusci/flutter + executor: flutter-executor steps: - advanced-checkout/shallow-checkout - - install_flutter_and_dart_packages: - generate_pigeons: true + - setup_flutter - run: name: Perform Static Analysis - command: flutter analyze + command: melos analyze verify_pub: - docker: - - image: cirrusci/flutter + executor: flutter-executor steps: - advanced-checkout/shallow-checkout - - install_flutter_and_dart_packages: - generate_pigeons: true + - setup_flutter - run: name: Check Package Score - command: dart run pana --no-warning --exit-code-threshold 0 - - run: flutter pub publish --dry-run + command: melos score --no-select + - run: melos dryPublish --no-select - release: + release_dio_plugin: + executor: flutter-executor + steps: + - advanced-checkout/shallow-checkout + - setup_flutter + - run: chmod +x packages/Instabug-Dio-Interceptor/release.sh + - run: ./packages/Instabug-Dio-Interceptor/release.sh + + 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_modular_plugin: + executor: flutter-executor + steps: + - advanced-checkout/shallow-checkout + - setup_flutter + - run: chmod +x packages/instabug_flutter_modular/release.sh + - run: ./packages/instabug_flutter_modular/release.sh + + + release_instabug_flutter: macos: xcode: 15.2.0 resource_class: macos.m1.medium.gen1 - working_directory: "~" + working_directory: "~/project" steps: - advanced-checkout/shallow-checkout: path: ~/project @@ -254,7 +348,7 @@ jobs: name: Install Rosetta command: softwareupdate --install-rosetta --agree-to-license - flutter/install_sdk_and_pub: - version: 3.3.6 + version: 3.10.5 app-dir: project - run: name: Install pub packages @@ -263,7 +357,7 @@ jobs: - run: name: Generate Pigeons working_directory: project - command: sh ./scripts/pigeon.sh + command: melos pigeon --no-select - run: name: Clone Escape command: git clone git@github.com:Instabug/Escape.git @@ -288,10 +382,10 @@ workflows: - test_flutter-stable - test_flutter: name: test_flutter-stable - version: stable - - test_flutter: + - test_flutter_without_melos: name: test_flutter-2.10.5 version: 2.10.5 + app-dir: "~/project/packages/instabug_flutter/" - e2e_android_captain - test_ios - e2e_ios_captain @@ -302,7 +396,7 @@ workflows: - verify_pub: requires: - lint_flutter - - hold_release: + - hold_release_instabug_flutter: type: approval requires: - danger @@ -319,9 +413,51 @@ workflows: filters: branches: only: master - - release: + - hold_release_dio_plugin: + type: approval + requires: + - test_flutter-stable + filters: + branches: + only: master + - release_dio_plugin: requires: - - hold_release + - hold_release_dio_plugin + - verify_pub filters: branches: - only: master \ No newline at end of file + 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 + - hold_release_modular_plugin: + type: approval + requires: + - test_flutter-stable + filters: + branches: + only: master + - release_modular_plugin: + requires: + - hold_release_modular_plugin + - verify_pub + filters: + branches: + only: master + - release_instabug_flutter: + requires: + - hold_release_instabug_flutter + filters: + branches: + only: master diff --git a/.gitignore b/.gitignore index 071964ca9..dfa529b28 100644 --- a/.gitignore +++ b/.gitignore @@ -1,8 +1,8 @@ # Generated files *.mocks.dart *.g.dart -android/**/generated/ -ios/**/Generated/ +packages/**/android/**/generated/ +packages/**/ios/**/Generated/ # Miscellaneous *.class @@ -63,6 +63,8 @@ android/gradlew.bat **/ios/**/DerivedData/ **/ios/**/Icon? **/ios/**/Pods/ +**/ios/**/Pods/ + **/ios/**/.symlinks/ **/ios/**/profile **/ios/**/xcuserdata @@ -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/ diff --git a/README.md b/README.md index 88080febd..4a260d8d2 100644 --- a/README.md +++ b/README.md @@ -1,116 +1,39 @@ -# Instabug for Flutter + -## 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: - -* "`` needs access to the microphone to be able to attach voice notes." -* "`` 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. diff --git a/analysis_options.yaml b/analysis_options.yaml index 9e956095e..4f1f095e4 100644 --- a/analysis_options.yaml +++ b/analysis_options.yaml @@ -2,8 +2,9 @@ include: package:lint/analysis_options_package.yaml analyzer: exclude: - - "example/**" - - "**/*.g.dart" + - "packages/**/*.g.dart" + - "packages/**/example/**" + linter: rules: diff --git a/android/src/main/java/com/instabug/flutter/modules/ApmApi.java b/android/src/main/java/com/instabug/flutter/modules/ApmApi.java deleted file mode 100644 index b28545745..000000000 --- a/android/src/main/java/com/instabug/flutter/modules/ApmApi.java +++ /dev/null @@ -1,292 +0,0 @@ -package com.instabug.flutter.modules; - -import android.util.Log; - -import androidx.annotation.NonNull; -import androidx.annotation.Nullable; - -import com.instabug.apm.APM; -import com.instabug.apm.InternalAPM; -import com.instabug.apm.configuration.cp.APMFeature; -import com.instabug.apm.configuration.cp.FeatureAvailabilityCallback; -import com.instabug.apm.model.ExecutionTrace; -import com.instabug.apm.networking.APMNetworkLogger; -import com.instabug.flutter.generated.ApmPigeon; -import com.instabug.flutter.util.Reflection; -import com.instabug.flutter.util.ThreadManager; -import com.instabug.apm.networkinterception.cp.APMCPNetworkLog; - -import io.flutter.plugin.common.BinaryMessenger; - -import org.jetbrains.annotations.NotNull; -import org.json.JSONObject; - -import java.lang.reflect.Method; -import java.util.HashMap; -import java.util.Map; - -public class ApmApi implements ApmPigeon.ApmHostApi { - private final String TAG = ApmApi.class.getName(); - private final HashMap traces = new HashMap<>(); - - public static void init(BinaryMessenger messenger) { - final ApmApi api = new ApmApi(); - ApmPigeon.ApmHostApi.setup(messenger, api); - } - - @Override - public void setEnabled(@NonNull Boolean isEnabled) { - try { - APM.setEnabled(isEnabled); - } catch (Exception e) { - e.printStackTrace(); - } - } - - @Override - public void setColdAppLaunchEnabled(@NonNull Boolean isEnabled) { - try { - APM.setColdAppLaunchEnabled(isEnabled); - } catch (Exception e) { - e.printStackTrace(); - } - } - - @Override - public void setAutoUITraceEnabled(@NonNull Boolean isEnabled) { - try { - APM.setAutoUITraceEnabled(isEnabled); - } catch (Exception e) { - e.printStackTrace(); - } - } - - @Override - public void startExecutionTrace(@NonNull String id, @NonNull String name, ApmPigeon.Result result) { - ThreadManager.runOnBackground( - new Runnable() { - @Override - public void run() { - try { - ExecutionTrace trace = APM.startExecutionTrace(name); - if (trace != null) { - traces.put(id, trace); - - ThreadManager.runOnMainThread(new Runnable() { - @Override - public void run() { - result.success(id); - } - }); - } else { - ThreadManager.runOnMainThread(new Runnable() { - @Override - public void run() { - result.success(null); - } - }); - } - } catch (Exception e) { - e.printStackTrace(); - - ThreadManager.runOnMainThread(new Runnable() { - @Override - public void run() { - result.success(null); - } - }); - } - } - } - ); - } - - @Override - public void startFlow(@NonNull String name) { - try { - APM.startFlow(name); - } catch (Exception e) { - e.printStackTrace(); - } - } - - @Override - public void setFlowAttribute(@NonNull String name, @NonNull String key, @Nullable String value) { - try { - APM.setFlowAttribute(name, key, value); - } catch (Exception e) { - e.printStackTrace(); - } - } - - @Override - public void endFlow(@NonNull String name) { - try { - APM.endFlow(name); - } catch (Exception e) { - e.printStackTrace(); - } - } - - @Override - public void setExecutionTraceAttribute(@NonNull String id, @NonNull String key, @NonNull String value) { - try { - traces.get(id).setAttribute(key, value); - } catch (Exception e) { - e.printStackTrace(); - } - } - - @Override - public void endExecutionTrace(@NonNull String id) { - try { - traces.get(id).end(); - } catch (Exception e) { - e.printStackTrace(); - } - } - - @Override - public void startUITrace(@NonNull String name) { - try { - APM.startUITrace(name); - } catch (Exception e) { - e.printStackTrace(); - } - } - - @Override - public void endUITrace() { - try { - APM.endUITrace(); - } catch (Exception e) { - e.printStackTrace(); - } - } - - @Override - public void endAppLaunch() { - try { - APM.endAppLaunch(); - } catch (Exception e) { - e.printStackTrace(); - } - } - - @Override - public void networkLogAndroid(@NonNull Map data) { - try { - APMNetworkLogger apmNetworkLogger = new APMNetworkLogger(); - final String requestUrl = (String) data.get("url"); - final String requestBody = (String) data.get("requestBody"); - final String responseBody = (String) data.get("responseBody"); - final String requestMethod = (String) data.get("method"); - //-------------------------------------------- - final String requestContentType = (String) data.get("requestContentType"); - final String responseContentType = (String) data.get("responseContentType"); - //-------------------------------------------- - final long requestBodySize = ((Number) data.get("requestBodySize")).longValue(); - final long responseBodySize = ((Number) data.get("responseBodySize")).longValue(); - //-------------------------------------------- - final String errorDomain = (String) data.get("errorDomain"); - final Integer statusCode = (Integer) data.get("responseCode"); - final long requestDuration = ((Number) data.get("duration")).longValue() / 1000; - final long requestStartTime = ((Number) data.get("startTime")).longValue() * 1000; - final String requestHeaders = (new JSONObject((HashMap) data.get("requestHeaders"))).toString(4); - final String responseHeaders = (new JSONObject((HashMap) data.get("responseHeaders"))).toString(4); - final String errorMessage; - - if (errorDomain.equals("")) { - errorMessage = null; - } else { - errorMessage = errorDomain; - } - //-------------------------------------------------- - String gqlQueryName = null; - if (data.containsKey("gqlQueryName")) { - gqlQueryName = (String) data.get("gqlQueryName"); - } - String serverErrorMessage = ""; - if (data.containsKey("serverErrorMessage")) { - serverErrorMessage = (String) data.get("serverErrorMessage"); - } - - Method method = Reflection.getMethod(Class.forName("com.instabug.apm.networking.APMNetworkLogger"), "log", long.class, long.class, String.class, String.class, long.class, String.class, String.class, String.class, String.class, String.class, long.class, int.class, String.class, String.class, String.class, String.class, APMCPNetworkLog.W3CExternalTraceAttributes.class); - if (method != null) { - method.invoke(apmNetworkLogger, requestStartTime, requestDuration, requestHeaders, requestBody, requestBodySize, requestMethod, requestUrl, requestContentType, responseHeaders, responseBody, responseBodySize, statusCode, responseContentType, errorMessage, gqlQueryName, serverErrorMessage, null); - } else { - Log.e(TAG, "APMNetworkLogger.log was not found by reflection"); - } - - } catch (Exception e) { - e.printStackTrace(); - } - } - - - @Override - public void startCpUiTrace(@NonNull String screenName, @NonNull Long microTimeStamp, @NonNull Long traceId) { - try { - InternalAPM._startUiTraceCP(screenName, microTimeStamp, traceId); - } catch (Exception e) { - e.printStackTrace(); - } - } - - @Override - public void reportScreenLoadingCP(@NonNull Long startTimeStampMicro, @NonNull Long durationMicro, @NonNull Long uiTraceId) { - try { - InternalAPM._reportScreenLoadingCP(startTimeStampMicro, durationMicro, uiTraceId); - } catch (Exception e) { - e.printStackTrace(); - } - } - - @Override - public void endScreenLoadingCP(@NonNull Long timeStampMicro, @NonNull Long uiTraceId) { - try { - InternalAPM._endScreenLoadingCP(timeStampMicro, uiTraceId); - } catch (Exception e) { - e.printStackTrace(); - } - } - - @Override - public void isEndScreenLoadingEnabled(@NonNull ApmPigeon.Result result) { - isScreenLoadingEnabled(result); - } - - @Override - public void isEnabled(@NonNull ApmPigeon.Result result) { - try { - // TODO: replace true with an actual implementation of APM.isEnabled once implemented - // in the Android SDK. - result.success(true); - } catch (Exception e) { - e.printStackTrace(); - } - } - - @Override - public void isScreenLoadingEnabled(@NonNull ApmPigeon.Result result) { - try { - InternalAPM._isFeatureEnabledCP(APMFeature.SCREEN_LOADING, "InstabugCaptureScreenLoading", new FeatureAvailabilityCallback() { - @Override - public void invoke(boolean isFeatureAvailable) { - result.success(isFeatureAvailable); - } - }); - } catch (Exception e) { - e.printStackTrace(); - } - } - - @Override - public void setScreenLoadingEnabled(@NonNull Boolean isEnabled) { - try { - APM.setScreenLoadingEnabled(isEnabled); - } catch (Exception e) { - e.printStackTrace(); - } - } -} diff --git a/dangerfile.ts b/dangerfile.ts index 670ae0b05..ee0fb4944 100644 --- a/dangerfile.ts +++ b/dangerfile.ts @@ -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/') @@ -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).' ); @@ -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); + diff --git a/e2e/.gitignore b/e2e/.gitignore index a72f3ddc5..2afa2e272 100644 --- a/e2e/.gitignore +++ b/e2e/.gitignore @@ -1,454 +1,454 @@ -## Ignore Visual Studio temporary files, build results, and -## files generated by popular Visual Studio add-ons. -## -## Get latest from https://github.com/github/gitignore/blob/master/VisualStudio.gitignore - -# User-specific files -*.rsuser -*.suo -*.user -*.userosscache -*.sln.docstates - -# User-specific files (MonoDevelop/Xamarin Studio) -*.userprefs - -# Mono auto generated files -mono_crash.* - -# Build results -[Dd]ebug/ -[Dd]ebugPublic/ -[Rr]elease/ -[Rr]eleases/ -x64/ -x86/ -[Ww][Ii][Nn]32/ -[Aa][Rr][Mm]/ -[Aa][Rr][Mm]64/ -bld/ -[Bb]in/ -[Oo]bj/ -[Ll]og/ -[Ll]ogs/ - -# Visual Studio 2015/2017 cache/options directory -.vs/ -# Uncomment if you have tasks that create the project's static files in wwwroot -#wwwroot/ - -# Visual Studio 2017 auto generated files -Generated\ Files/ - -# MSTest test Results -[Tt]est[Rr]esult*/ -[Bb]uild[Ll]og.* - -# NUnit -*.VisualState.xml -TestResult.xml -nunit-*.xml - -# Build Results of an ATL Project -[Dd]ebugPS/ -[Rr]eleasePS/ -dlldata.c - -# Benchmark Results -BenchmarkDotNet.Artifacts/ - -# .NET -project.lock.json -project.fragment.lock.json -artifacts/ - -# Tye -.tye/ - -# ASP.NET Scaffolding -ScaffoldingReadMe.txt - -# StyleCop -StyleCopReport.xml - -# Files built by Visual Studio -*_i.c -*_p.c -*_h.h -*.ilk -*.meta -*.obj -*.iobj -*.pch -*.pdb -*.ipdb -*.pgc -*.pgd -*.rsp -*.sbr -*.tlb -*.tli -*.tlh -*.tmp -*.tmp_proj -*_wpftmp.csproj -*.log -*.vspscc -*.vssscc -.builds -*.pidb -*.svclog -*.scc - -# Chutzpah Test files -_Chutzpah* - -# Visual C++ cache files -ipch/ -*.aps -*.ncb -*.opendb -*.opensdf -*.sdf -*.cachefile -*.VC.db -*.VC.VC.opendb - -# Visual Studio profiler -*.psess -*.vsp -*.vspx -*.sap - -# Visual Studio Trace Files -*.e2e - -# TFS 2012 Local Workspace -$tf/ - -# Guidance Automation Toolkit -*.gpState - -# ReSharper is a .NET coding add-in -_ReSharper*/ -*.[Rr]e[Ss]harper -*.DotSettings.user - -# TeamCity is a build add-in -_TeamCity* - -# DotCover is a Code Coverage Tool -*.dotCover - -# AxoCover is a Code Coverage Tool -.axoCover/* -!.axoCover/settings.json - -# Coverlet is a free, cross platform Code Coverage Tool -coverage*.json -coverage*.xml -coverage*.info - -# Visual Studio code coverage results -*.coverage -*.coveragexml - -# NCrunch -_NCrunch_* -.*crunch*.local.xml -nCrunchTemp_* - -# MightyMoose -*.mm.* -AutoTest.Net/ - -# Web workbench (sass) -.sass-cache/ - -# Installshield output folder -[Ee]xpress/ - -# DocProject is a documentation generator add-in -DocProject/buildhelp/ -DocProject/Help/*.HxT -DocProject/Help/*.HxC -DocProject/Help/*.hhc -DocProject/Help/*.hhk -DocProject/Help/*.hhp -DocProject/Help/Html2 -DocProject/Help/html - -# Click-Once directory -publish/ - -# Publish Web Output -*.[Pp]ublish.xml -*.azurePubxml -# Note: Comment the next line if you want to checkin your web deploy settings, -# but database connection strings (with potential passwords) will be unencrypted -*.pubxml -*.publishproj - -# Microsoft Azure Web App publish settings. Comment the next line if you want to -# checkin your Azure Web App publish settings, but sensitive information contained -# in these scripts will be unencrypted -PublishScripts/ - -# NuGet Packages -*.nupkg -# NuGet Symbol Packages -*.snupkg -# The packages folder can be ignored because of Package Restore -**/[Pp]ackages/* -# except build/, which is used as an MSBuild target. -!**/[Pp]ackages/build/ -# Uncomment if necessary however generally it will be regenerated when needed -#!**/[Pp]ackages/repositories.config -# NuGet v3's project.json files produces more ignorable files -*.nuget.props -*.nuget.targets - -# Microsoft Azure Build Output -csx/ -*.build.csdef - -# Microsoft Azure Emulator -ecf/ -rcf/ - -# Windows Store app package directories and files -AppPackages/ -BundleArtifacts/ -Package.StoreAssociation.xml -_pkginfo.txt -*.appx -*.appxbundle -*.appxupload - -# Visual Studio cache files -# files ending in .cache can be ignored -*.[Cc]ache -# but keep track of directories ending in .cache -!?*.[Cc]ache/ - -# Others -ClientBin/ -~$* -*~ -*.dbmdl -*.dbproj.schemaview -*.jfm -*.pfx -*.publishsettings -orleans.codegen.cs - -# Including strong name files can present a security risk -# (https://github.com/github/gitignore/pull/2483#issue-259490424) -#*.snk - -# Since there are multiple workflows, uncomment next line to ignore bower_components -# (https://github.com/github/gitignore/pull/1529#issuecomment-104372622) -#bower_components/ - -# RIA/Silverlight projects -Generated_Code/ - -# Backup & report files from converting an old project file -# to a newer Visual Studio version. Backup files are not needed, -# because we have git ;-) -_UpgradeReport_Files/ -Backup*/ -UpgradeLog*.XML -UpgradeLog*.htm -ServiceFabricBackup/ -*.rptproj.bak - -# SQL Server files -*.mdf -*.ldf -*.ndf - -# Business Intelligence projects -*.rdl.data -*.bim.layout -*.bim_*.settings -*.rptproj.rsuser -*- [Bb]ackup.rdl -*- [Bb]ackup ([0-9]).rdl -*- [Bb]ackup ([0-9][0-9]).rdl - -# Microsoft Fakes -FakesAssemblies/ - -# GhostDoc plugin setting file -*.GhostDoc.xml - -# Node.js Tools for Visual Studio -.ntvs_analysis.dat -node_modules/ - -# Visual Studio 6 build log -*.plg - -# Visual Studio 6 workspace options file -*.opt - -# Visual Studio 6 auto-generated workspace file (contains which files were open etc.) -*.vbw - -# Visual Studio LightSwitch build output -**/*.HTMLClient/GeneratedArtifacts -**/*.DesktopClient/GeneratedArtifacts -**/*.DesktopClient/ModelManifest.xml -**/*.Server/GeneratedArtifacts -**/*.Server/ModelManifest.xml -_Pvt_Extensions - -# Paket dependency manager -.paket/paket.exe -paket-files/ - -# FAKE - F# Make -.fake/ - -# CodeRush personal settings -.cr/personal - -# Python Tools for Visual Studio (PTVS) -__pycache__/ -*.pyc - -# Cake - Uncomment if you are using it -# tools/** -# !tools/packages.config - -# Tabs Studio -*.tss - -# Telerik's JustMock configuration file -*.jmconfig - -# BizTalk build output -*.btp.cs -*.btm.cs -*.odx.cs -*.xsd.cs - -# OpenCover UI analysis results -OpenCover/ - -# Azure Stream Analytics local run output -ASALocalRun/ - -# MSBuild Binary and Structured Log -*.binlog - -# NVidia Nsight GPU debugger configuration file -*.nvuser - -# MFractors (Xamarin productivity tool) working folder -.mfractor/ - -# Local History for Visual Studio -.localhistory/ - -# BeatPulse healthcheck temp database -healthchecksdb - -# Backup folder for Package Reference Convert tool in Visual Studio 2017 -MigrationBackup/ - -# Ionide (cross platform F# VS Code tools) working folder -.ionide/ - -# Fody - auto-generated XML schema -FodyWeavers.xsd - -## -## Visual studio for Mac -## - - -# globs -Makefile.in -*.userprefs -*.usertasks -config.make -config.status -aclocal.m4 -install-sh -autom4te.cache/ -*.tar.gz -tarballs/ -test-results/ - -# Mac bundle stuff -*.dmg -*.app - -# content below from: https://github.com/github/gitignore/blob/master/Global/macOS.gitignore -# General -.DS_Store -.AppleDouble -.LSOverride - -# Icon must end with two \r -Icon - - -# Thumbnails -._* - -# Files that might appear in the root of a volume -.DocumentRevisions-V100 -.fseventsd -.Spotlight-V100 -.TemporaryItems -.Trashes -.VolumeIcon.icns -.com.apple.timemachine.donotpresent - -# Directories potentially created on remote AFP share -.AppleDB -.AppleDesktop -Network Trash Folder -Temporary Items -.apdisk - -# content below from: https://github.com/github/gitignore/blob/master/Global/Windows.gitignore -# Windows thumbnail cache files -Thumbs.db -ehthumbs.db -ehthumbs_vista.db - -# Dump file -*.stackdump - -# Folder config file -[Dd]esktop.ini - -# Recycle Bin used on file shares -$RECYCLE.BIN/ - -# Windows Installer files -*.cab -*.msi -*.msix -*.msm -*.msp - -# Windows shortcuts -*.lnk - -# JetBrains Rider -.idea/ -*.sln.iml - -## -## Visual Studio Code -## -.vscode/* -!.vscode/settings.json -!.vscode/tasks.json -!.vscode/launch.json -!.vscode/extensions.json +## Ignore Visual Studio temporary files, build results, and +## files generated by popular Visual Studio add-ons. +## +## Get latest from https://github.com/github/gitignore/blob/master/VisualStudio.gitignore + +# User-specific files +*.rsuser +*.suo +*.user +*.userosscache +*.sln.docstates + +# User-specific files (MonoDevelop/Xamarin Studio) +*.userprefs + +# Mono auto generated files +mono_crash.* + +# Build results +[Dd]ebug/ +[Dd]ebugPublic/ +[Rr]elease/ +[Rr]eleases/ +x64/ +x86/ +[Ww][Ii][Nn]32/ +[Aa][Rr][Mm]/ +[Aa][Rr][Mm]64/ +bld/ +[Bb]in/ +[Oo]bj/ +[Ll]og/ +[Ll]ogs/ + +# Visual Studio 2015/2017 cache/options directory +.vs/ +# Uncomment if you have tasks that create the project's static files in wwwroot +#wwwroot/ + +# Visual Studio 2017 auto generated files +Generated\ Files/ + +# MSTest test Results +[Tt]est[Rr]esult*/ +[Bb]uild[Ll]og.* + +# NUnit +*.VisualState.xml +TestResult.xml +nunit-*.xml + +# Build Results of an ATL Project +[Dd]ebugPS/ +[Rr]eleasePS/ +dlldata.c + +# Benchmark Results +BenchmarkDotNet.Artifacts/ + +# .NET +project.lock.json +project.fragment.lock.json +artifacts/ + +# Tye +.tye/ + +# ASP.NET Scaffolding +ScaffoldingReadMe.txt + +# StyleCop +StyleCopReport.xml + +# Files built by Visual Studio +*_i.c +*_p.c +*_h.h +*.ilk +*.meta +*.obj +*.iobj +*.pch +*.pdb +*.ipdb +*.pgc +*.pgd +*.rsp +*.sbr +*.tlb +*.tli +*.tlh +*.tmp +*.tmp_proj +*_wpftmp.csproj +*.log +*.vspscc +*.vssscc +.builds +*.pidb +*.svclog +*.scc + +# Chutzpah Test files +_Chutzpah* + +# Visual C++ cache files +ipch/ +*.aps +*.ncb +*.opendb +*.opensdf +*.sdf +*.cachefile +*.VC.db +*.VC.VC.opendb + +# Visual Studio profiler +*.psess +*.vsp +*.vspx +*.sap + +# Visual Studio Trace Files +*.e2e + +# TFS 2012 Local Workspace +$tf/ + +# Guidance Automation Toolkit +*.gpState + +# ReSharper is a .NET coding add-in +_ReSharper*/ +*.[Rr]e[Ss]harper +*.DotSettings.user + +# TeamCity is a build add-in +_TeamCity* + +# DotCover is a Code Coverage Tool +*.dotCover + +# AxoCover is a Code Coverage Tool +.axoCover/* +!.axoCover/settings.json + +# Coverlet is a free, cross platform Code Coverage Tool +coverage*.json +coverage*.xml +coverage*.info + +# Visual Studio code coverage results +*.coverage +*.coveragexml + +# NCrunch +_NCrunch_* +.*crunch*.local.xml +nCrunchTemp_* + +# MightyMoose +*.mm.* +AutoTest.Net/ + +# Web workbench (sass) +.sass-cache/ + +# Installshield output folder +[Ee]xpress/ + +# DocProject is a documentation generator add-in +DocProject/buildhelp/ +DocProject/Help/*.HxT +DocProject/Help/*.HxC +DocProject/Help/*.hhc +DocProject/Help/*.hhk +DocProject/Help/*.hhp +DocProject/Help/Html2 +DocProject/Help/html + +# Click-Once directory +publish/ + +# Publish Web Output +*.[Pp]ublish.xml +*.azurePubxml +# Note: Comment the next line if you want to checkin your web deploy settings, +# but database connection strings (with potential passwords) will be unencrypted +*.pubxml +*.publishproj + +# Microsoft Azure Web App publish settings. Comment the next line if you want to +# checkin your Azure Web App publish settings, but sensitive information contained +# in these scripts will be unencrypted +PublishScripts/ + +# NuGet Packages +*.nupkg +# NuGet Symbol Packages +*.snupkg +# The packages folder can be ignored because of Package Restore +**/[Pp]ackages/* +# except build/, which is used as an MSBuild target. +!**/[Pp]ackages/build/ +# Uncomment if necessary however generally it will be regenerated when needed +#!**/[Pp]ackages/repositories.config +# NuGet v3's project.json files produces more ignorable files +*.nuget.props +*.nuget.targets + +# Microsoft Azure Build Output +csx/ +*.build.csdef + +# Microsoft Azure Emulator +ecf/ +rcf/ + +# Windows Store app package directories and files +AppPackages/ +BundleArtifacts/ +Package.StoreAssociation.xml +_pkginfo.txt +*.appx +*.appxbundle +*.appxupload + +# Visual Studio cache files +# files ending in .cache can be ignored +*.[Cc]ache +# but keep track of directories ending in .cache +!?*.[Cc]ache/ + +# Others +ClientBin/ +~$* +*~ +*.dbmdl +*.dbproj.schemaview +*.jfm +*.pfx +*.publishsettings +orleans.codegen.cs + +# Including strong name files can present a security risk +# (https://github.com/github/gitignore/pull/2483#issue-259490424) +#*.snk + +# Since there are multiple workflows, uncomment next line to ignore bower_components +# (https://github.com/github/gitignore/pull/1529#issuecomment-104372622) +#bower_components/ + +# RIA/Silverlight projects +Generated_Code/ + +# Backup & report files from converting an old project file +# to a newer Visual Studio version. Backup files are not needed, +# because we have git ;-) +_UpgradeReport_Files/ +Backup*/ +UpgradeLog*.XML +UpgradeLog*.htm +ServiceFabricBackup/ +*.rptproj.bak + +# SQL Server files +*.mdf +*.ldf +*.ndf + +# Business Intelligence projects +*.rdl.data +*.bim.layout +*.bim_*.settings +*.rptproj.rsuser +*- [Bb]ackup.rdl +*- [Bb]ackup ([0-9]).rdl +*- [Bb]ackup ([0-9][0-9]).rdl + +# Microsoft Fakes +FakesAssemblies/ + +# GhostDoc plugin setting file +*.GhostDoc.xml + +# Node.js Tools for Visual Studio +.ntvs_analysis.dat +node_modules/ + +# Visual Studio 6 build log +*.plg + +# Visual Studio 6 workspace options file +*.opt + +# Visual Studio 6 auto-generated workspace file (contains which files were open etc.) +*.vbw + +# Visual Studio LightSwitch build output +**/*.HTMLClient/GeneratedArtifacts +**/*.DesktopClient/GeneratedArtifacts +**/*.DesktopClient/ModelManifest.xml +**/*.Server/GeneratedArtifacts +**/*.Server/ModelManifest.xml +_Pvt_Extensions + +# Paket dependency manager +.paket/paket.exe +paket-files/ + +# FAKE - F# Make +.fake/ + +# CodeRush personal settings +.cr/personal + +# Python Tools for Visual Studio (PTVS) +__pycache__/ +*.pyc + +# Cake - Uncomment if you are using it +# tools/** +# !tools/packages.config + +# Tabs Studio +*.tss + +# Telerik's JustMock configuration file +*.jmconfig + +# BizTalk build output +*.btp.cs +*.btm.cs +*.odx.cs +*.xsd.cs + +# OpenCover UI analysis results +OpenCover/ + +# Azure Stream Analytics local run output +ASALocalRun/ + +# MSBuild Binary and Structured Log +*.binlog + +# NVidia Nsight GPU debugger configuration file +*.nvuser + +# MFractors (Xamarin productivity tool) working folder +.mfractor/ + +# Local History for Visual Studio +.localhistory/ + +# BeatPulse healthcheck temp database +healthchecksdb + +# Backup folder for Package Reference Convert tool in Visual Studio 2017 +MigrationBackup/ + +# Ionide (cross platform F# VS Code tools) working folder +.ionide/ + +# Fody - auto-generated XML schema +FodyWeavers.xsd + +## +## Visual studio for Mac +## + + +# globs +Makefile.in +*.userprefs +*.usertasks +config.make +config.status +aclocal.m4 +install-sh +autom4te.cache/ +*.tar.gz +tarballs/ +test-results/ + +# Mac bundle stuff +*.dmg +*.app + +# content below from: https://github.com/github/gitignore/blob/master/Global/macOS.gitignore +# General +.DS_Store +.AppleDouble +.LSOverride + +# Icon must end with two \r +Icon + + +# Thumbnails +._* + +# Files that might appear in the root of a volume +.DocumentRevisions-V100 +.fseventsd +.Spotlight-V100 +.TemporaryItems +.Trashes +.VolumeIcon.icns +.com.apple.timemachine.donotpresent + +# Directories potentially created on remote AFP share +.AppleDB +.AppleDesktop +Network Trash Folder +Temporary Items +.apdisk + +# content below from: https://github.com/github/gitignore/blob/master/Global/Windows.gitignore +# Windows thumbnail cache files +Thumbs.db +ehthumbs.db +ehthumbs_vista.db + +# Dump file +*.stackdump + +# Folder config file +[Dd]esktop.ini + +# Recycle Bin used on file shares +$RECYCLE.BIN/ + +# Windows Installer files +*.cab +*.msi +*.msix +*.msm +*.msp + +# Windows shortcuts +*.lnk + +# JetBrains Rider +.idea/ +*.sln.iml + +## +## Visual Studio Code +## +.vscode/* +!.vscode/settings.json +!.vscode/tasks.json +!.vscode/launch.json +!.vscode/extensions.json diff --git a/e2e/BugReportingTests.cs b/e2e/BugReportingTests.cs index f938cfcbd..f48afbf3b 100644 --- a/e2e/BugReportingTests.cs +++ b/e2e/BugReportingTests.cs @@ -1,9 +1,9 @@ -using System.Drawing; using E2E.Utils; using Xunit; using Instabug.Captain; using NoSuchElementException = OpenQA.Selenium.NoSuchElementException; +using System.Drawing; namespace E2E; @@ -46,6 +46,9 @@ public void ReportABug() [Fact] public void FloatingButtonInvocationEvent() { + + Console.WriteLine("FloatingButtonInvocationEvent"); + captain.FindById( android: "instabug_floating_button", ios: "IBGFloatingButtonAccessibilityIdentifier" @@ -57,9 +60,13 @@ public void FloatingButtonInvocationEvent() [Fact] public void ShakeInvocationEvent() { + + Console.WriteLine("ShakeInvocationEvent"); + if (!Platform.IsIOS) return; - captain.FindByText("Shake").Tap(); + + captain.FindByTextScroll("Shake").Tap(); captain.Shake(); @@ -69,8 +76,12 @@ public void ShakeInvocationEvent() [Fact] public void TwoFingersSwipeLeftInvocationEvent() { - ScrollUp(); - captain.FindByText("Two Fingers Swipe Left").Tap(); + + Console.WriteLine("TwoFingersSwipeLeftInvocationEvent"); + + + + captain.FindByTextScroll("Two Fingers Swipe Left").Tap(); Thread.Sleep(500); @@ -89,7 +100,11 @@ public void TwoFingersSwipeLeftInvocationEvent() [Fact] public void NoneInvocationEvent() { - captain.FindByText("None").Tap(); + + Console.WriteLine("NoneInvocationEvent"); + + + captain.FindByTextScroll("None").Tap(); captain.WaitForAssertion(() => Assert.Throws(() => @@ -105,7 +120,13 @@ public void NoneInvocationEvent() [Fact] public void ManualInvocation() { - captain.FindByText("Invoke").Tap(); + + + Console.WriteLine("ManualInvocation"); + + + + captain.FindByTextScroll("Invoke").Tap(); AssertOptionsPromptIsDisplayed(); } @@ -113,14 +134,24 @@ public void ManualInvocation() [Fact] public void MultipleScreenshotsInReproSteps() { - ScrollDownLittle(); - captain.FindByText("Enter screen name").Tap(); + + Console.WriteLine("MultipleScreenshotsInReproSteps"); + + + + +captain.FindByTextScroll("Enter screen name").Tap(); captain.Type("My Screen"); captain.HideKeyboard(); - captain.FindByText("Report Screen Change").Tap(); - captain.FindByText("Send Bug Report").Tap(); + captain.HideKeyboard(); + Thread.Sleep(500); + + captain.FindByTextScroll("Report Screen Change")?.Tap(); + Thread.Sleep(500); + captain.FindByTextScroll("Send Bug Report")?.Tap(); + captain.FindById( android: "instabug_text_view_repro_steps_disclaimer", ios: "IBGBugVCReproStepsDisclaimerAccessibilityIdentifier" @@ -136,27 +167,30 @@ public void MultipleScreenshotsInReproSteps() [Fact(Skip = "The test is flaky on iOS so we're skipping it to unblock the v13.2.0 release")] public void ChangeReportTypes() { - ScrollUp(); - captain.FindByText("Bug", exact: true).Tap(); + + Console.WriteLine("ChangeReportTypes"); + + + captain.FindByTextScroll("Bug", exact: true).Tap(); if (Platform.IsAndroid) { - captain.FindByText("Invoke").Tap(); + captain.FindByTextScroll("Invoke").Tap(); // Shows bug reporting screen Assert.True(captain.FindById("ib_bug_scroll_view").Displayed); // Close bug reporting screen captain.GoBack(); - captain.FindByText("DISCARD").Tap(); + captain.FindByTextScroll("DISCARD").Tap(); Thread.Sleep(500); } - captain.FindByText("Feedback").Tap(); + captain.FindByTextScroll("Feedback").Tap(); - captain.FindByText("Invoke").Tap(); + captain.FindByTextScroll("Invoke").Tap(); // Shows both bug reporting and feature requests in prompt options AssertOptionsPromptIsDisplayed(); @@ -169,10 +203,12 @@ public void ChangeReportTypes() [Fact] public void ChangeFloatingButtonEdge() { - ScrollDown(); - captain.FindByText("Move Floating Button to Left").Tap(); - Thread.Sleep(500); + Console.WriteLine("ChangeFloatingButtonEdge"); + + + captain.FindByTextScroll("Move Floating Button to Left",false,false)?.Tap(); + captain.WaitForAssertion(() => { @@ -189,16 +225,16 @@ public void ChangeFloatingButtonEdge() [Fact] public void OnDismissCallbackIsCalled() { - ScrollDownLittle(); - captain.FindByText("Set On Dismiss Callback").Tap(); - captain.FindByText("Invoke").Tap(); + captain.FindByTextScroll("Set On Dismiss Callback",false,false).Tap(); + captain.FindByTextScroll("Invoke",false,false).Tap(); AssertOptionsPromptIsDisplayed(); - captain.FindByText("Cancel").Tap(); + captain.FindByTextScroll("Cancel").Tap(); var popUpText = captain.FindByText("onDismiss callback called with DismissType.cancel and ReportType.other"); Assert.True(popUpText.Displayed); + } } diff --git a/e2e/E2E.csproj b/e2e/E2E.csproj index 7e6759754..f54272903 100644 --- a/e2e/E2E.csproj +++ b/e2e/E2E.csproj @@ -1,23 +1,23 @@ - - - - net6.0 - enable - enable - - false - - - - - - - runtime; build; native; contentfiles; analyzers; buildtransitive - all - - - - - - - + + + + net6.0 + enable + enable + + false + + + + + + + runtime; build; native; contentfiles; analyzers; buildtransitive + all + + + + + + + diff --git a/e2e/E2E.sln b/e2e/E2E.sln index 23c0ba9eb..c2e05e1e2 100644 --- a/e2e/E2E.sln +++ b/e2e/E2E.sln @@ -1,31 +1,31 @@ - -Microsoft Visual Studio Solution File, Format Version 12.00 -# Visual Studio Version 16 -VisualStudioVersion = 25.0.1703.5 -MinimumVisualStudioVersion = 10.0.40219.1 -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "E2E", "E2E.csproj", "{99118060-0344-4CAD-AE3A-CC74A5E0F3C7}" -EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Instabug.Captain", "..\..\Instabug.Captain\Instabug.Captain\Instabug.Captain.csproj", "{597F3BAD-11D3-43B7-A95C-6C41CD2096A8}" -EndProject -Global - GlobalSection(SolutionConfigurationPlatforms) = preSolution - Debug|Any CPU = Debug|Any CPU - Release|Any CPU = Release|Any CPU - EndGlobalSection - GlobalSection(ProjectConfigurationPlatforms) = postSolution - {99118060-0344-4CAD-AE3A-CC74A5E0F3C7}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {99118060-0344-4CAD-AE3A-CC74A5E0F3C7}.Debug|Any CPU.Build.0 = Debug|Any CPU - {99118060-0344-4CAD-AE3A-CC74A5E0F3C7}.Release|Any CPU.ActiveCfg = Release|Any CPU - {99118060-0344-4CAD-AE3A-CC74A5E0F3C7}.Release|Any CPU.Build.0 = Release|Any CPU - {597F3BAD-11D3-43B7-A95C-6C41CD2096A8}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {597F3BAD-11D3-43B7-A95C-6C41CD2096A8}.Debug|Any CPU.Build.0 = Debug|Any CPU - {597F3BAD-11D3-43B7-A95C-6C41CD2096A8}.Release|Any CPU.ActiveCfg = Release|Any CPU - {597F3BAD-11D3-43B7-A95C-6C41CD2096A8}.Release|Any CPU.Build.0 = Release|Any CPU - EndGlobalSection - GlobalSection(SolutionProperties) = preSolution - HideSolutionNode = FALSE - EndGlobalSection - GlobalSection(ExtensibilityGlobals) = postSolution - SolutionGuid = {3E37F932-775C-4756-A8FF-28DFC6CAC624} - EndGlobalSection -EndGlobal + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio Version 16 +VisualStudioVersion = 25.0.1703.5 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "E2E", "E2E.csproj", "{99118060-0344-4CAD-AE3A-CC74A5E0F3C7}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Instabug.Captain", "..\..\Instabug.Captain\Instabug.Captain\Instabug.Captain.csproj", "{597F3BAD-11D3-43B7-A95C-6C41CD2096A8}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {99118060-0344-4CAD-AE3A-CC74A5E0F3C7}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {99118060-0344-4CAD-AE3A-CC74A5E0F3C7}.Debug|Any CPU.Build.0 = Debug|Any CPU + {99118060-0344-4CAD-AE3A-CC74A5E0F3C7}.Release|Any CPU.ActiveCfg = Release|Any CPU + {99118060-0344-4CAD-AE3A-CC74A5E0F3C7}.Release|Any CPU.Build.0 = Release|Any CPU + {597F3BAD-11D3-43B7-A95C-6C41CD2096A8}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {597F3BAD-11D3-43B7-A95C-6C41CD2096A8}.Debug|Any CPU.Build.0 = Debug|Any CPU + {597F3BAD-11D3-43B7-A95C-6C41CD2096A8}.Release|Any CPU.ActiveCfg = Release|Any CPU + {597F3BAD-11D3-43B7-A95C-6C41CD2096A8}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + SolutionGuid = {3E37F932-775C-4756-A8FF-28DFC6CAC624} + EndGlobalSection +EndGlobal diff --git a/e2e/FeatureRequestsTests.cs b/e2e/FeatureRequestsTests.cs index 41c97f684..724758bee 100644 --- a/e2e/FeatureRequestsTests.cs +++ b/e2e/FeatureRequestsTests.cs @@ -10,10 +10,10 @@ public class FeatureRequestsTests : CaptainTest [Fact] public void ShowFeatureRequetsScreen() { - ScrollDown(); - ScrollDown(); - captain.FindByText("Show Feature Requests").Tap(); + Console.WriteLine("ShowFeatureRequetsScreen"); + + captain.FindByTextScroll("Show Feature Requests",false,false).Tap(); var screenTitle = captain.FindById( android: "ib_fr_toolbar_main", diff --git a/e2e/InstabugTests.cs b/e2e/InstabugTests.cs index 1b67ae8cd..e376f87bf 100644 --- a/e2e/InstabugTests.cs +++ b/e2e/InstabugTests.cs @@ -11,14 +11,16 @@ public class InstabugTests : CaptainTest [Fact] public void ChangePrimaryColor() { + Console.WriteLine("ChangePrimaryColor"); + var color = "#FF0000"; var expected = Color.FromArgb(255, 0, 0); - captain.FindByText("Enter primary color").Tap(); + captain.FindByTextScroll("Enter primary color").Tap(); captain.Type(color); captain.HideKeyboard(); - captain.FindByText("Change Primary Color").Tap(); + captain.FindByTextScroll("Change Primary Color").Tap(); captain.WaitForAssertion(() => { diff --git a/e2e/SurveysTests.cs b/e2e/SurveysTests.cs index 1ed0eba48..0d67f99ab 100644 --- a/e2e/SurveysTests.cs +++ b/e2e/SurveysTests.cs @@ -10,8 +10,9 @@ public class SurveysTests : CaptainTest [Fact] public void ShowManualSurvey() { - ScrollDownLittle(); - captain.FindByText("Show Manual Survey").Tap(); + Console.WriteLine("ShowManualSurvey"); + + captain.FindByTextScroll("Show Manual Survey",false,false).Tap(); captain.WaitForAssertion(() => { diff --git a/e2e/Utils/CaptainTest.cs b/e2e/Utils/CaptainTest.cs index 35749d727..e32255d4b 100644 --- a/e2e/Utils/CaptainTest.cs +++ b/e2e/Utils/CaptainTest.cs @@ -1,5 +1,7 @@ using System.Drawing; using Instabug.Captain; +using OpenQA.Selenium; +using OpenQA.Selenium.Appium.MultiTouch; namespace E2E.Utils; @@ -7,10 +9,11 @@ public class CaptainTest : IDisposable { private static readonly CaptainConfig _config = new() { - AndroidApp = Path.GetFullPath("../../../../example/build/app/outputs/flutter-apk/app-debug.apk"), + AndroidApp = Path.GetFullPath("../../../../packages/instabug_flutter/example/build/app/outputs/flutter-apk/app-debug.apk"), AndroidAppId = "com.instabug.flutter.example", AndroidVersion = "13", - IosApp = Path.GetFullPath("../../../../example/build/ios/iphonesimulator/Runner.app"), + + IosApp = Path.GetFullPath("../../../../packages/instabug_flutter/example/build/ios/iphonesimulator/Runner.app"), IosAppId = "com.instabug.InstabugSample", IosVersion = "17.2", IosDevice = "iPhone 15 Pro Max" @@ -28,28 +31,5 @@ public void Dispose() captain.RestartApp(); } - protected void ScrollDown() - { - captain.Swipe( - start: new Point(captain.Window.Size.Width / 2, captain.Window.Size.Height - 200), - end: new Point(captain.Window.Size.Width / 2, 250) - ); - } - - protected void ScrollDownLittle() - { - captain.Swipe( - start: new Point(captain.Window.Size.Width / 2, captain.Window.Size.Height - 200), - end: new Point(captain.Window.Size.Width / 2, captain.Window.Size.Height - 220) - ); - } - - protected void ScrollUp() - { - captain.Swipe( - start: new Point(captain.Window.Size.Width / 2, 250), - end: new Point(captain.Window.Size.Width / 2, captain.Window.Size.Height - 200) - ); - } } diff --git a/example/lib/src/components/traces_content.dart b/example/lib/src/components/traces_content.dart deleted file mode 100644 index 888460d43..000000000 --- a/example/lib/src/components/traces_content.dart +++ /dev/null @@ -1,157 +0,0 @@ -part of '../../main.dart'; - -class TracesContent extends StatefulWidget { - const TracesContent({Key? key}) : super(key: key); - - @override - State createState() => _TracesContentState(); -} - -class _TracesContentState extends State { - final traceNameController = TextEditingController(); - final traceKeyAttributeController = TextEditingController(); - final traceValueAttributeController = TextEditingController(); - - bool? didTraceEnd; - - Trace? trace; - - @override - Widget build(BuildContext context) { - final textTheme = Theme.of(context).textTheme; - return Column( - children: [ - InstabugTextField( - label: 'Trace name', - labelStyle: textTheme.labelMedium, - controller: traceNameController, - ), - SizedBox.fromSize( - size: const Size.fromHeight(10.0), - ), - Row( - children: [ - Flexible( - flex: 5, - child: InstabugButton.smallFontSize( - text: 'Start Trace', - onPressed: () => _startTrace(traceNameController.text), - margin: const EdgeInsetsDirectional.only( - start: 20.0, - end: 10.0, - ), - ), - ), - Flexible( - flex: 5, - child: InstabugButton.smallFontSize( - text: 'Start Trace With Delay', - onPressed: () => _startTrace( - traceNameController.text, - delayInMilliseconds: 5000, - ), - margin: const EdgeInsetsDirectional.only( - start: 10.0, - end: 20.0, - ), - ), - ), - ], - ), - Row( - children: [ - Flexible( - flex: 5, - child: InstabugTextField( - label: 'Trace Key Attribute', - controller: traceKeyAttributeController, - labelStyle: textTheme.labelMedium, - margin: const EdgeInsetsDirectional.only( - end: 10.0, - start: 20.0, - ), - ), - ), - Flexible( - flex: 5, - child: InstabugTextField( - label: 'Trace Value Attribute', - labelStyle: textTheme.labelMedium, - controller: traceValueAttributeController, - margin: const EdgeInsetsDirectional.only( - start: 10.0, - end: 20.0, - ), - ), - ), - ], - ), - SizedBox.fromSize( - size: const Size.fromHeight(10.0), - ), - InstabugButton( - text: 'Set Trace Attribute', - onPressed: () => _setTraceAttribute( - trace, - traceKeyAttribute: traceKeyAttributeController.text, - traceValueAttribute: traceValueAttributeController.text, - ), - ), - InstabugButton( - text: 'End Trace', - onPressed: () => _endTrace(), - ), - ], - ); - } - - void _startTrace( - String traceName, { - int delayInMilliseconds = 0, - }) { - if (traceName.trim().isNotEmpty) { - log('_startTrace — traceName: $traceName, delay in Milliseconds: $delayInMilliseconds'); - log('traceName: $traceName'); - Future.delayed( - Duration(milliseconds: delayInMilliseconds), - () => APM - .startExecutionTrace(traceName) - .then((value) => trace = value)); - } else { - log('startTrace - Please enter a trace name'); - } - } - - void _endTrace() { - if (didTraceEnd == true) { - log('_endTrace — Please, start a new trace before setting attributes.'); - } - if (trace == null) { - log('_endTrace — Please, start a trace before ending it.'); - } - log('_endTrace — ending Trace.'); - trace?.end(); - didTraceEnd = true; - } - - void _setTraceAttribute( - Trace? trace, { - required String traceKeyAttribute, - required String traceValueAttribute, - }) { - if (trace == null) { - log('_setTraceAttribute — Please, start a trace before setting attributes.'); - } - if (didTraceEnd == true) { - log('_setTraceAttribute — Please, start a new trace before setting attributes.'); - } - if (traceKeyAttribute.trim().isEmpty) { - log('_setTraceAttribute — Please, fill the trace key attribute input before settings attributes.'); - } - if (traceValueAttribute.trim().isEmpty) { - log('_setTraceAttribute — Please, fill the trace value attribute input before settings attributes.'); - } - log('_setTraceAttribute — setting attributes -> key: $traceKeyAttribute, value: $traceValueAttribute.'); - trace?.setAttribute(traceKeyAttribute, traceValueAttribute); - } -} diff --git a/lib/src/models/trace.dart b/lib/src/models/trace.dart deleted file mode 100644 index bf267640b..000000000 --- a/lib/src/models/trace.dart +++ /dev/null @@ -1,44 +0,0 @@ -import 'package:instabug_flutter/src/modules/apm.dart'; - -class Trace { - Trace({ - required this.id, - required this.name, - }); - - final String id; - final String name; - final Map attributes = {}; - - /// Sets attribute of execution trace. - /// [String] id of the trace. - /// [String] key of attribute. - /// [String] value of attribute. - /// - /// Please migrate to the App Flows APIs: [APM.startFlow], [APM.setFlowAttribute], and [APM.endFlow]. - @Deprecated( - 'Please migrate to the App Flows APIs: APM.startAppFlow, APM.endFlow, and APM.setFlowAttribute. This feature was deprecated in v13.0.0', - ) - void setAttribute(String key, String value) { - APM.setExecutionTraceAttribute(id, key, value); - attributes[key] = value; - } - - /// Ends Execution Trace - /// - /// Please migrate to the App Flows APIs: [APM.startFlow], [APM.setFlowAttribute], and [APM.endFlow]. - @Deprecated( - 'Please migrate to the App Flows APIs: APM.startAppFlow, APM.endFlow, and APM.setFlowAttribute. This feature was deprecated in v13.0.0', - ) - void end() { - APM.endExecutionTrace(id); - } - - Map toJson() { - return { - 'id': id, - 'name': name, - 'attributes': attributes, - }; - } -} diff --git a/lib/src/modules/apm.dart b/lib/src/modules/apm.dart deleted file mode 100644 index 70f7bf6b0..000000000 --- a/lib/src/modules/apm.dart +++ /dev/null @@ -1,236 +0,0 @@ -// ignore_for_file: avoid_classes_with_only_static_members - -import 'dart:async'; - -import 'package:flutter/widgets.dart' show WidgetBuilder; -import 'package:instabug_flutter/src/generated/apm.api.g.dart'; -import 'package:instabug_flutter/src/models/network_data.dart'; -import 'package:instabug_flutter/src/models/trace.dart'; -import 'package:instabug_flutter/src/utils/ibg_build_info.dart'; -import 'package:instabug_flutter/src/utils/ibg_date_time.dart'; -import 'package:instabug_flutter/src/utils/instabug_logger.dart'; -import 'package:instabug_flutter/src/utils/screen_loading/screen_loading_manager.dart'; -import 'package:meta/meta.dart'; - -class APM { - static var _host = ApmHostApi(); - static String tag = 'Instabug - APM'; - - /// @nodoc - @visibleForTesting - // ignore: use_setters_to_change_properties - static void $setHostApi(ApmHostApi host) { - _host = host; - } - - /// Enables or disables APM feature. - /// [boolean] isEnabled - static Future setEnabled(bool isEnabled) async { - return _host.setEnabled(isEnabled); - } - - /// @nodoc - @internal - static Future isEnabled() async { - return _host.isEnabled(); - } - - /// Enables or disables the screenLoading Monitoring feature. - /// [boolean] isEnabled - static Future setScreenLoadingEnabled(bool isEnabled) { - return _host.setScreenLoadingEnabled(isEnabled); - } - - /// @nodoc - @internal - static Future isScreenLoadingEnabled() async { - return _host.isScreenLoadingEnabled(); - } - - /// Enables or disables cold app launch tracking. - /// [boolean] isEnabled - static Future setColdAppLaunchEnabled(bool isEnabled) async { - return _host.setColdAppLaunchEnabled(isEnabled); - } - - /// Starts an execution trace. - /// [String] name of the trace. - /// - /// Please migrate to the App Flows APIs: [startFlow], [setFlowAttribute], and [endFlow]. - @Deprecated( - 'Please migrate to the App Flows APIs: APM.startAppFlow, APM.endFlow, and APM.setFlowAttribute. This feature was deprecated in v13.0.0', - ) - static Future startExecutionTrace(String name) async { - final id = IBGDateTime.instance.now(); - final traceId = await _host.startExecutionTrace(id.toString(), name); - - if (traceId == null) { - return Future.error( - "Execution trace $name wasn't created. Please make sure to enable APM first by following " - 'the instructions at this link: https://docs.instabug.com/reference#enable-or-disable-apm', - ); - } - - return Trace( - id: traceId, - name: name, - ); - } - - /// Sets attribute of an execution trace. - /// [String] id of the trace. - /// [String] key of attribute. - /// [String] value of attribute. - /// - /// Please migrate to the App Flows APIs: [startFlow], [setFlowAttribute], and [endFlow]. - @Deprecated( - 'Please migrate to the App Flows APIs: APM.startAppFlow, APM.endFlow, and APM.setFlowAttribute. This feature was deprecated in v13.0.0', - ) - static Future setExecutionTraceAttribute( - String id, - String key, - String value, - ) async { - return _host.setExecutionTraceAttribute(id, key, value); - } - - /// Ends an execution trace. - /// [String] id of the trace. - /// - /// Please migrate to the App Flows APIs: [startFlow], [setFlowAttribute], and [endFlow]. - @Deprecated( - 'Please migrate to the App Flows APIs: APM.startAppFlow, APM.endFlow, and APM.setFlowAttribute. This feature was deprecated in v13.0.0', - ) - static Future endExecutionTrace(String id) async { - return _host.endExecutionTrace(id); - } - - /// Starts an AppFlow with the given [name]. - /// - /// The [name] must not be an empty string. It should be unique and not exceed 150 characters, - /// ignoring leading and trailing spaces. - /// - /// Duplicate [name]s will terminate the older AppFlow with the termination reason recorded as - /// 'force abandon end reason'. - /// - /// The method will only execute if APM is enabled, the feature is - /// active, and the SDK has been initialized. - static Future startFlow(String name) async { - if (name.isNotEmpty) { - return _host.startFlow(name.trim()); - } - } - - /// Assigns a custom attribute to an AppFlow with the specified [name], [key], and [value]. - /// - /// The [name] must not be an empty string. The [key] should not exceed 30 characters, - /// and [value] should not exceed 60 characters, with both ignoring leading and trailing spaces. - /// - /// To remove an attribute, set its [value] to null. Attributes cannot be added or - /// modified after an AppFlow has concluded. - static Future setFlowAttribute( - String name, - String key, - String? value, - ) async { - return _host.setFlowAttribute(name, key, value); - } - - /// Ends the AppFlow with the given [name]. - static Future endFlow(String name) async { - return _host.endFlow(name); - } - - /// Enables or disables auto UI tracing. - /// [boolean] isEnabled - static Future setAutoUITraceEnabled(bool isEnabled) async { - return _host.setAutoUITraceEnabled(isEnabled); - } - - /// Starts UI trace. - /// [String] name - static Future startUITrace(String name) async { - return _host.startUITrace(name); - } - - /// Ends UI trace. - static Future endUITrace() async { - return _host.endUITrace(); - } - - /// Ends App Launch. - static Future endAppLaunch() async { - return _host.endAppLaunch(); - } - - static FutureOr networkLogAndroid(NetworkData data) { - if (IBGBuildInfo.instance.isAndroid) { - return _host.networkLogAndroid(data.toJson()); - } - } - - /// @nodoc - @internal - static Future startCpUiTrace( - String screenName, - int startTimeInMicroseconds, - int traceId, - ) { - InstabugLogger.I.d( - 'Starting Ui trace — traceId: $traceId, screenName: $screenName, microTimeStamp: $startTimeInMicroseconds', - tag: APM.tag, - ); - return _host.startCpUiTrace(screenName, startTimeInMicroseconds, traceId); - } - - /// @nodoc - @internal - static Future reportScreenLoadingCP( - int startTimeInMicroseconds, - int durationInMicroseconds, - int uiTraceId, - ) { - InstabugLogger.I.d( - 'Reporting screen loading trace — traceId: $uiTraceId, startTimeInMicroseconds: $startTimeInMicroseconds, durationInMicroseconds: $durationInMicroseconds', - tag: APM.tag, - ); - return _host.reportScreenLoadingCP( - startTimeInMicroseconds, - durationInMicroseconds, - uiTraceId, - ); - } - - /// @nodoc - @internal - static Future endScreenLoadingCP( - int endTimeInMicroseconds, - int uiTraceId, - ) { - InstabugLogger.I.d( - 'Extending screen loading trace — traceId: $uiTraceId, endTimeInMicroseconds: $endTimeInMicroseconds', - tag: APM.tag, - ); - return _host.endScreenLoadingCP(endTimeInMicroseconds, uiTraceId); - } - - /// Extends the currently active screen loading trace - static Future endScreenLoading() { - return ScreenLoadingManager.I.endScreenLoading(); - } - - /// @nodoc - @internal - static Future isEndScreenLoadingEnabled() async { - return _host.isEndScreenLoadingEnabled(); - } - - /// Wraps the given routes with [InstabugCaptureScreenLoading] widgets. - /// This allows Instabug to automatically capture screen loading times. - static Map wrapRoutes( - Map routes, { - List exclude = const [], - }) { - return ScreenLoadingManager.wrapRoutes(routes, exclude: exclude); - } -} diff --git a/melos.yaml b/melos.yaml new file mode 100644 index 000000000..b96ab7100 --- /dev/null +++ b/melos.yaml @@ -0,0 +1,82 @@ +name: instabug_flutter_mono + +packages: + - packages/* + - packages/*/** +scripts: + dart_bootstrap: + run: dart pub get + analyze: + run: dart analyze . + format: + run: dart format . --set-exit-if-changed + exec: + concurrency: 1 + failFast: true + orderDependents: true + pigeon: + run: sh scripts/pigeon.sh + exec: + concurrency: 1 + failFast: true + orderDependents: true + packageFilters: + fileExists: 'scripts/pigeon.sh' + generate: + run: dart run build_runner build -d + description: Build all generated files for Dart & Flutter packages in this project.t + exec: + concurrency: 1 + failFast: true + orderDependents: true + packageFilters: + dependsOn: build_runner + test: + run: flutter test + description: Tests all packages. + exec: + concurrency: 1 + failFast: true + orderDependents: true + packageFilters: + dependsOn: flutter_test + test-coverage: + run: flutter test --coverage && cd coverage && lcov --ignore-errors unused --remove lcov.info '*.g.dart' '*.mocks.dart' -o lcov.info && sh ../../../scripts/move_coverage_files.sh + description: Tests all packages. + exec: + concurrency: 1 + failFast: true + orderDependents: true + select-package: + dir-exists: + - test + packageFilters: + dependsOn: flutter_test + dirExists: test + dryPublish: + run: flutter pub publish --dry-run + description: Tests publishing (dry run). + exec: + concurrency: 1 + orderDependents: true + packageFilters: + flutter: true + dependsOn: pana + private: false + pods: + run: cd ios && pod install --repo-update + description: running pod install + exec: + concurrency: 1 + orderDependents: true + packageFilters: + fileExists: 'ios/PodFile' + score: + run: dart run pana --no-warning --exit-code-threshold 0 + exec: + concurrency: 1 + orderDependents: true + packageFilters: + dependsOn: pana + private: false + diff --git a/packages/instabug_dio_interceptor/CHANGELOG.md b/packages/instabug_dio_interceptor/CHANGELOG.md new file mode 100644 index 000000000..4fd938e6f --- /dev/null +++ b/packages/instabug_dio_interceptor/CHANGELOG.md @@ -0,0 +1,55 @@ +# Changelog + +## [2.5.0] (2025-07-17) + +### Added +- supports Instabug SDK above 3.0.0 ([#33](https://github.com/Instabug/Instabug-Dio-Interceptor/pull/33)). + +## [2.4.1] (2025-04-21) + +### Added +- supports Dart versions above 3.0.0 ([#32](https://github.com/Instabug/Instabug-Dio-Interceptor/pull/32)). + +## [2.4.0] (2024-11-18) + +### Added + +- Add support for tracing network requests from Instabug to services like Datadog and New Relic ([#30](https://github.com/Instabug/Instabug-Dio-Interceptor/pull/30)). + +## [2.3.0] - (2024-05-07) + +### Added + +- Add support for Instabug Flutter SDK v13 ([#28](https://github.com/Instabug/Instabug-Dio-Interceptor/pull/28)). +- Add support for Instabug Flutter SDK v12 ([#26](https://github.com/Instabug/Instabug-Dio-Interceptor/pull/26)), closes [#25](https://github.com/Instabug/Instabug-Dio-Interceptor/issues/25). + +## v2.2.0 (2022-03-14) + +- Adds support for Dio v5 +- Relaxes dependencies version constraints + +## v2.1.1 (2022-08-01) + +- Bumps [instabug_flutter](https://pub.dev/packages/instabug_flutter) to v11 + +## v2.1.0 (2022-01-06) + +- Fixes network log compilation error. +- Adds payload size for network log. + +## v2.0.1 (2021-09-29) + +- Fixes an issue with APM network logger not reporting to the dashboard + +## v2.0.0 (2021-09-20) + +- Adds support for Dio v4.0 +- Upgrades to null safety + +## v1.0.0 (2019-07-29) + +- Updates instabug_flutter dependency name + +## v0.0.1 (2019-07-22) + +- Initial release diff --git a/packages/instabug_dio_interceptor/LICENSE b/packages/instabug_dio_interceptor/LICENSE new file mode 100644 index 000000000..e4ca5a0ed --- /dev/null +++ b/packages/instabug_dio_interceptor/LICENSE @@ -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. diff --git a/packages/instabug_dio_interceptor/README.md b/packages/instabug_dio_interceptor/README.md new file mode 100644 index 000000000..4fc3ec30d --- /dev/null +++ b/packages/instabug_dio_interceptor/README.md @@ -0,0 +1,17 @@ +# Instabug Dio Interceptor + +[![CircleCI](https://circleci.com/gh/Instabug/Instabug-Dio-Interceptor.svg?style=svg)](https://circleci.com/gh/Instabug/Instabug-Dio-Interceptor) +[![pub package](https://img.shields.io/pub/v/instabug_dio_interceptor.svg)](https://pub.dev/packages/instabug_dio_interceptor) + +This package is an add on to [Instabug-Flutter](https://github.com/Instabug/Instabug-Flutter). + +It intercepts any requests performed with `Dio` Package and sends them to the report that will be sent to the dashboard. + +## Integration + +To enable network logging, simply add the `InstabugDioInterceptor` to the dio object interceptors as follows: + +```dart +var dio = new Dio(); +dio.interceptors.add(InstabugDioInterceptor()); +``` diff --git a/packages/instabug_dio_interceptor/example/.metadata b/packages/instabug_dio_interceptor/example/.metadata new file mode 100644 index 000000000..5a023280a --- /dev/null +++ b/packages/instabug_dio_interceptor/example/.metadata @@ -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 diff --git a/packages/instabug_dio_interceptor/example/README.md b/packages/instabug_dio_interceptor/example/README.md new file mode 100644 index 000000000..a13562602 --- /dev/null +++ b/packages/instabug_dio_interceptor/example/README.md @@ -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. diff --git a/packages/instabug_dio_interceptor/example/android/.gitignore b/packages/instabug_dio_interceptor/example/android/.gitignore new file mode 100644 index 000000000..6f568019d --- /dev/null +++ b/packages/instabug_dio_interceptor/example/android/.gitignore @@ -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 diff --git a/example/android/app/build.gradle b/packages/instabug_dio_interceptor/example/android/app/build.gradle similarity index 76% rename from example/android/app/build.gradle rename to packages/instabug_dio_interceptor/example/android/app/build.gradle index 13ed775e2..5fe3c929f 100644 --- a/example/android/app/build.gradle +++ b/packages/instabug_dio_interceptor/example/android/app/build.gradle @@ -27,7 +27,6 @@ apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle" android { compileSdkVersion flutter.compileSdkVersion - ndkVersion flutter.ndkVersion compileOptions { sourceCompatibility JavaVersion.VERSION_1_8 @@ -43,13 +42,12 @@ android { } defaultConfig { - applicationId "com.instabug.flutter.example" + // TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html). + applicationId "com.example.example" minSdkVersion flutter.minSdkVersion - targetSdkVersion 30 + targetSdkVersion flutter.targetSdkVersion versionCode flutterVersionCode.toInteger() versionName flutterVersionName - testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" - multiDexEnabled true } buildTypes { @@ -59,10 +57,6 @@ android { signingConfig signingConfigs.debug } } - - configurations.all { - resolutionStrategy.force 'org.hamcrest:hamcrest-core:1.3' - } } flutter { @@ -71,8 +65,4 @@ flutter { dependencies { implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version" - implementation 'com.android.support:multidex:1.0.3' - implementation 'org.mockito:mockito-core:1.10.19' - testImplementation 'junit:junit:4.12' - testImplementation 'org.mockito:mockito-core:1.10.19' } diff --git a/example/android/app/src/debug/AndroidManifest.xml b/packages/instabug_dio_interceptor/example/android/app/src/debug/AndroidManifest.xml similarity index 86% rename from example/android/app/src/debug/AndroidManifest.xml rename to packages/instabug_dio_interceptor/example/android/app/src/debug/AndroidManifest.xml index ed546497f..c208884f3 100644 --- a/example/android/app/src/debug/AndroidManifest.xml +++ b/packages/instabug_dio_interceptor/example/android/app/src/debug/AndroidManifest.xml @@ -1,5 +1,5 @@ + package="com.example.example"> diff --git a/packages/instabug_dio_interceptor/example/android/app/src/main/AndroidManifest.xml b/packages/instabug_dio_interceptor/example/android/app/src/main/AndroidManifest.xml new file mode 100644 index 000000000..633ee18ba --- /dev/null +++ b/packages/instabug_dio_interceptor/example/android/app/src/main/AndroidManifest.xml @@ -0,0 +1,36 @@ + + + + + + + + + + + + + + + diff --git a/packages/instabug_dio_interceptor/example/android/app/src/main/java/io/flutter/app/FlutterMultiDexApplication.java b/packages/instabug_dio_interceptor/example/android/app/src/main/java/io/flutter/app/FlutterMultiDexApplication.java new file mode 100644 index 000000000..752fc185d --- /dev/null +++ b/packages/instabug_dio_interceptor/example/android/app/src/main/java/io/flutter/app/FlutterMultiDexApplication.java @@ -0,0 +1,25 @@ +// Generated file. +// +// If you wish to remove Flutter's multidex support, delete this entire file. +// +// Modifications to this file should be done in a copy under a different name +// as this file may be regenerated. + +package io.flutter.app; + +import android.app.Application; +import android.content.Context; +import androidx.annotation.CallSuper; +import androidx.multidex.MultiDex; + +/** + * Extension of {@link android.app.Application}, adding multidex support. + */ +public class FlutterMultiDexApplication extends Application { + @Override + @CallSuper + protected void attachBaseContext(Context base) { + super.attachBaseContext(base); + MultiDex.install(this); + } +} diff --git a/packages/instabug_dio_interceptor/example/android/app/src/main/kotlin/com/example/example/MainActivity.kt b/packages/instabug_dio_interceptor/example/android/app/src/main/kotlin/com/example/example/MainActivity.kt new file mode 100644 index 000000000..e793a000d --- /dev/null +++ b/packages/instabug_dio_interceptor/example/android/app/src/main/kotlin/com/example/example/MainActivity.kt @@ -0,0 +1,6 @@ +package com.example.example + +import io.flutter.embedding.android.FlutterActivity + +class MainActivity: FlutterActivity() { +} diff --git a/packages/instabug_dio_interceptor/example/android/app/src/main/res/drawable-v21/launch_background.xml b/packages/instabug_dio_interceptor/example/android/app/src/main/res/drawable-v21/launch_background.xml new file mode 100644 index 000000000..f74085f3f --- /dev/null +++ b/packages/instabug_dio_interceptor/example/android/app/src/main/res/drawable-v21/launch_background.xml @@ -0,0 +1,12 @@ + + + + + + + + diff --git a/example/android/app/src/main/res/drawable/launch_background.xml b/packages/instabug_dio_interceptor/example/android/app/src/main/res/drawable/launch_background.xml similarity index 100% rename from example/android/app/src/main/res/drawable/launch_background.xml rename to packages/instabug_dio_interceptor/example/android/app/src/main/res/drawable/launch_background.xml diff --git a/example/android/app/src/main/res/mipmap-hdpi/ic_launcher.png b/packages/instabug_dio_interceptor/example/android/app/src/main/res/mipmap-hdpi/ic_launcher.png similarity index 100% rename from example/android/app/src/main/res/mipmap-hdpi/ic_launcher.png rename to packages/instabug_dio_interceptor/example/android/app/src/main/res/mipmap-hdpi/ic_launcher.png diff --git a/example/android/app/src/main/res/mipmap-mdpi/ic_launcher.png b/packages/instabug_dio_interceptor/example/android/app/src/main/res/mipmap-mdpi/ic_launcher.png similarity index 100% rename from example/android/app/src/main/res/mipmap-mdpi/ic_launcher.png rename to packages/instabug_dio_interceptor/example/android/app/src/main/res/mipmap-mdpi/ic_launcher.png diff --git a/example/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png b/packages/instabug_dio_interceptor/example/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png similarity index 100% rename from example/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png rename to packages/instabug_dio_interceptor/example/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png diff --git a/example/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png b/packages/instabug_dio_interceptor/example/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png similarity index 100% rename from example/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png rename to packages/instabug_dio_interceptor/example/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png diff --git a/example/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png b/packages/instabug_dio_interceptor/example/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png similarity index 100% rename from example/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png rename to packages/instabug_dio_interceptor/example/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png diff --git a/packages/instabug_dio_interceptor/example/android/app/src/main/res/values-night/styles.xml b/packages/instabug_dio_interceptor/example/android/app/src/main/res/values-night/styles.xml new file mode 100644 index 000000000..3db14bb53 --- /dev/null +++ b/packages/instabug_dio_interceptor/example/android/app/src/main/res/values-night/styles.xml @@ -0,0 +1,18 @@ + + + + + + + diff --git a/packages/instabug_dio_interceptor/example/android/app/src/main/res/values/styles.xml b/packages/instabug_dio_interceptor/example/android/app/src/main/res/values/styles.xml new file mode 100644 index 000000000..d460d1e92 --- /dev/null +++ b/packages/instabug_dio_interceptor/example/android/app/src/main/res/values/styles.xml @@ -0,0 +1,18 @@ + + + + + + + diff --git a/packages/instabug_dio_interceptor/example/android/app/src/main/res/xml/network_security_config.xml b/packages/instabug_dio_interceptor/example/android/app/src/main/res/xml/network_security_config.xml new file mode 100644 index 000000000..be9989192 --- /dev/null +++ b/packages/instabug_dio_interceptor/example/android/app/src/main/res/xml/network_security_config.xml @@ -0,0 +1,13 @@ + + + + localhost + api.instabug.com + + + + + + + + diff --git a/example/android/app/src/profile/AndroidManifest.xml b/packages/instabug_dio_interceptor/example/android/app/src/profile/AndroidManifest.xml similarity index 86% rename from example/android/app/src/profile/AndroidManifest.xml rename to packages/instabug_dio_interceptor/example/android/app/src/profile/AndroidManifest.xml index ed546497f..c208884f3 100644 --- a/example/android/app/src/profile/AndroidManifest.xml +++ b/packages/instabug_dio_interceptor/example/android/app/src/profile/AndroidManifest.xml @@ -1,5 +1,5 @@ + package="com.example.example"> diff --git a/example/android/build.gradle b/packages/instabug_dio_interceptor/example/android/build.gradle similarity index 79% rename from example/android/build.gradle rename to packages/instabug_dio_interceptor/example/android/build.gradle index 713d7f6e6..4256f9173 100644 --- a/example/android/build.gradle +++ b/packages/instabug_dio_interceptor/example/android/build.gradle @@ -1,12 +1,12 @@ buildscript { - ext.kotlin_version = '1.7.10' + ext.kotlin_version = '1.6.10' repositories { google() mavenCentral() } dependencies { - classpath 'com.android.tools.build:gradle:7.2.0' + classpath 'com.android.tools.build:gradle:4.1.0' classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version" } } @@ -26,6 +26,6 @@ subprojects { project.evaluationDependsOn(':app') } -tasks.register("clean", Delete) { +task clean(type: Delete) { delete rootProject.buildDir } diff --git a/example/android/gradle.properties b/packages/instabug_dio_interceptor/example/android/gradle.properties similarity index 100% rename from example/android/gradle.properties rename to packages/instabug_dio_interceptor/example/android/gradle.properties diff --git a/example/android/gradle/wrapper/gradle-wrapper.properties b/packages/instabug_dio_interceptor/example/android/gradle/wrapper/gradle-wrapper.properties similarity index 93% rename from example/android/gradle/wrapper/gradle-wrapper.properties rename to packages/instabug_dio_interceptor/example/android/gradle/wrapper/gradle-wrapper.properties index 6b665338b..bc6a58afd 100644 --- a/example/android/gradle/wrapper/gradle-wrapper.properties +++ b/packages/instabug_dio_interceptor/example/android/gradle/wrapper/gradle-wrapper.properties @@ -3,4 +3,4 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-7.5-all.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-6.7-all.zip diff --git a/example/android/settings.gradle b/packages/instabug_dio_interceptor/example/android/settings.gradle similarity index 92% rename from example/android/settings.gradle rename to packages/instabug_dio_interceptor/example/android/settings.gradle index 8f6a080fc..44e62bcf0 100644 --- a/example/android/settings.gradle +++ b/packages/instabug_dio_interceptor/example/android/settings.gradle @@ -1,4 +1,3 @@ -rootProject.name = 'InstabugExample' include ':app' def localPropertiesFile = new File(rootProject.projectDir, "local.properties") diff --git a/packages/instabug_dio_interceptor/example/ios/.gitignore b/packages/instabug_dio_interceptor/example/ios/.gitignore new file mode 100644 index 000000000..7a7f9873a --- /dev/null +++ b/packages/instabug_dio_interceptor/example/ios/.gitignore @@ -0,0 +1,34 @@ +**/dgph +*.mode1v3 +*.mode2v3 +*.moved-aside +*.pbxuser +*.perspectivev3 +**/*sync/ +.sconsign.dblite +.tags* +**/.vagrant/ +**/DerivedData/ +Icon? +**/Pods/ +**/.symlinks/ +profile +xcuserdata +**/.generated/ +Flutter/App.framework +Flutter/Flutter.framework +Flutter/Flutter.podspec +Flutter/Generated.xcconfig +Flutter/ephemeral/ +Flutter/app.flx +Flutter/app.zip +Flutter/flutter_assets/ +Flutter/flutter_export_environment.sh +ServiceDefinitions.json +Runner/GeneratedPluginRegistrant.* + +# Exceptions to above rules. +!default.mode1v3 +!default.mode2v3 +!default.pbxuser +!default.perspectivev3 diff --git a/packages/instabug_dio_interceptor/example/ios/Flutter/AppFrameworkInfo.plist b/packages/instabug_dio_interceptor/example/ios/Flutter/AppFrameworkInfo.plist new file mode 100644 index 000000000..9625e105d --- /dev/null +++ b/packages/instabug_dio_interceptor/example/ios/Flutter/AppFrameworkInfo.plist @@ -0,0 +1,26 @@ + + + + + CFBundleDevelopmentRegion + en + CFBundleExecutable + App + CFBundleIdentifier + io.flutter.flutter.app + CFBundleInfoDictionaryVersion + 6.0 + CFBundleName + App + CFBundlePackageType + FMWK + CFBundleShortVersionString + 1.0 + CFBundleSignature + ???? + CFBundleVersion + 1.0 + MinimumOSVersion + 11.0 + + diff --git a/packages/instabug_dio_interceptor/example/ios/Flutter/Debug.xcconfig b/packages/instabug_dio_interceptor/example/ios/Flutter/Debug.xcconfig new file mode 100644 index 000000000..ec97fc6f3 --- /dev/null +++ b/packages/instabug_dio_interceptor/example/ios/Flutter/Debug.xcconfig @@ -0,0 +1,2 @@ +#include? "Pods/Target Support Files/Pods-Runner/Pods-Runner.debug.xcconfig" +#include "Generated.xcconfig" diff --git a/packages/instabug_dio_interceptor/example/ios/Flutter/Release.xcconfig b/packages/instabug_dio_interceptor/example/ios/Flutter/Release.xcconfig new file mode 100644 index 000000000..c4855bfe2 --- /dev/null +++ b/packages/instabug_dio_interceptor/example/ios/Flutter/Release.xcconfig @@ -0,0 +1,2 @@ +#include? "Pods/Target Support Files/Pods-Runner/Pods-Runner.release.xcconfig" +#include "Generated.xcconfig" diff --git a/packages/instabug_dio_interceptor/example/ios/Podfile b/packages/instabug_dio_interceptor/example/ios/Podfile new file mode 100644 index 000000000..313ea4a15 --- /dev/null +++ b/packages/instabug_dio_interceptor/example/ios/Podfile @@ -0,0 +1,41 @@ +# Uncomment this line to define a global platform for your project +platform :ios, '11.0' + +# CocoaPods analytics sends network stats synchronously affecting flutter build latency. +ENV['COCOAPODS_DISABLE_STATS'] = 'true' + +project 'Runner', { + 'Debug' => :debug, + 'Profile' => :release, + 'Release' => :release, +} + +def flutter_root + generated_xcode_build_settings_path = File.expand_path(File.join('..', 'Flutter', 'Generated.xcconfig'), __FILE__) + unless File.exist?(generated_xcode_build_settings_path) + raise "#{generated_xcode_build_settings_path} must exist. If you're running pod install manually, make sure flutter pub get is executed first" + end + + File.foreach(generated_xcode_build_settings_path) do |line| + matches = line.match(/FLUTTER_ROOT\=(.*)/) + return matches[1].strip if matches + end + raise "FLUTTER_ROOT not found in #{generated_xcode_build_settings_path}. Try deleting Generated.xcconfig, then run flutter pub get" +end + +require File.expand_path(File.join('packages', 'flutter_tools', 'bin', 'podhelper'), flutter_root) + +flutter_ios_podfile_setup + +target 'Runner' do + use_frameworks! + use_modular_headers! + + flutter_install_all_ios_pods File.dirname(File.realpath(__FILE__)) +end + +post_install do |installer| + installer.pods_project.targets.each do |target| + flutter_additional_ios_build_settings(target) + end +end diff --git a/packages/instabug_dio_interceptor/example/ios/Runner.xcodeproj/project.pbxproj b/packages/instabug_dio_interceptor/example/ios/Runner.xcodeproj/project.pbxproj new file mode 100644 index 000000000..90bc9fee8 --- /dev/null +++ b/packages/instabug_dio_interceptor/example/ios/Runner.xcodeproj/project.pbxproj @@ -0,0 +1,552 @@ +// !$*UTF8*$! +{ + archiveVersion = 1; + classes = { + }; + objectVersion = 50; + objects = { + +/* Begin PBXBuildFile section */ + 1498D2341E8E89220040F4C2 /* GeneratedPluginRegistrant.m in Sources */ = {isa = PBXBuildFile; fileRef = 1498D2331E8E89220040F4C2 /* GeneratedPluginRegistrant.m */; }; + 3B3967161E833CAA004F5970 /* AppFrameworkInfo.plist in Resources */ = {isa = PBXBuildFile; fileRef = 3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */; }; + 74858FAF1ED2DC5600515810 /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 74858FAE1ED2DC5600515810 /* AppDelegate.swift */; }; + 97C146FC1CF9000F007C117D /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FA1CF9000F007C117D /* Main.storyboard */; }; + 97C146FE1CF9000F007C117D /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FD1CF9000F007C117D /* Assets.xcassets */; }; + 97C147011CF9000F007C117D /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FF1CF9000F007C117D /* LaunchScreen.storyboard */; }; + AD44C4DB39F7C3968B8C56EB /* Pods_Runner.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 18B300F826F2074CB5E450C4 /* Pods_Runner.framework */; }; +/* End PBXBuildFile section */ + +/* Begin PBXCopyFilesBuildPhase section */ + 9705A1C41CF9048500538489 /* Embed Frameworks */ = { + isa = PBXCopyFilesBuildPhase; + buildActionMask = 2147483647; + dstPath = ""; + dstSubfolderSpec = 10; + files = ( + ); + name = "Embed Frameworks"; + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXCopyFilesBuildPhase section */ + +/* Begin PBXFileReference section */ + 1498D2321E8E86230040F4C2 /* GeneratedPluginRegistrant.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = GeneratedPluginRegistrant.h; sourceTree = ""; }; + 1498D2331E8E89220040F4C2 /* GeneratedPluginRegistrant.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = GeneratedPluginRegistrant.m; sourceTree = ""; }; + 18B300F826F2074CB5E450C4 /* Pods_Runner.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_Runner.framework; sourceTree = BUILT_PRODUCTS_DIR; }; + 3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; name = AppFrameworkInfo.plist; path = Flutter/AppFrameworkInfo.plist; sourceTree = ""; }; + 3E0436312822B722E186D653 /* Pods-Runner.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Runner.release.xcconfig"; path = "Target Support Files/Pods-Runner/Pods-Runner.release.xcconfig"; sourceTree = ""; }; + 74858FAD1ED2DC5600515810 /* Runner-Bridging-Header.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "Runner-Bridging-Header.h"; sourceTree = ""; }; + 74858FAE1ED2DC5600515810 /* AppDelegate.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = ""; }; + 7AFA3C8E1D35360C0083082E /* Release.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; name = Release.xcconfig; path = Flutter/Release.xcconfig; sourceTree = ""; }; + 90FF03378459C589A4D9DA6E /* Pods-Runner.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Runner.debug.xcconfig"; path = "Target Support Files/Pods-Runner/Pods-Runner.debug.xcconfig"; sourceTree = ""; }; + 9740EEB21CF90195004384FC /* Debug.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; name = Debug.xcconfig; path = Flutter/Debug.xcconfig; sourceTree = ""; }; + 9740EEB31CF90195004384FC /* Generated.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; name = Generated.xcconfig; path = Flutter/Generated.xcconfig; sourceTree = ""; }; + 97C146EE1CF9000F007C117D /* Runner.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = Runner.app; sourceTree = BUILT_PRODUCTS_DIR; }; + 97C146FB1CF9000F007C117D /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = ""; }; + 97C146FD1CF9000F007C117D /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = ""; }; + 97C147001CF9000F007C117D /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = ""; }; + 97C147021CF9000F007C117D /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; + DE25EB3DE5B281AB8980A728 /* Pods-Runner.profile.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Runner.profile.xcconfig"; path = "Target Support Files/Pods-Runner/Pods-Runner.profile.xcconfig"; sourceTree = ""; }; +/* End PBXFileReference section */ + +/* Begin PBXFrameworksBuildPhase section */ + 97C146EB1CF9000F007C117D /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( + AD44C4DB39F7C3968B8C56EB /* Pods_Runner.framework in Frameworks */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXFrameworksBuildPhase section */ + +/* Begin PBXGroup section */ + 3456E8E25F114A239880D241 /* Frameworks */ = { + isa = PBXGroup; + children = ( + 18B300F826F2074CB5E450C4 /* Pods_Runner.framework */, + ); + name = Frameworks; + sourceTree = ""; + }; + 4955E253C000584F8EA1A042 /* Pods */ = { + isa = PBXGroup; + children = ( + 90FF03378459C589A4D9DA6E /* Pods-Runner.debug.xcconfig */, + 3E0436312822B722E186D653 /* Pods-Runner.release.xcconfig */, + DE25EB3DE5B281AB8980A728 /* Pods-Runner.profile.xcconfig */, + ); + name = Pods; + path = Pods; + sourceTree = ""; + }; + 9740EEB11CF90186004384FC /* Flutter */ = { + isa = PBXGroup; + children = ( + 3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */, + 9740EEB21CF90195004384FC /* Debug.xcconfig */, + 7AFA3C8E1D35360C0083082E /* Release.xcconfig */, + 9740EEB31CF90195004384FC /* Generated.xcconfig */, + ); + name = Flutter; + sourceTree = ""; + }; + 97C146E51CF9000F007C117D = { + isa = PBXGroup; + children = ( + 9740EEB11CF90186004384FC /* Flutter */, + 97C146F01CF9000F007C117D /* Runner */, + 97C146EF1CF9000F007C117D /* Products */, + 4955E253C000584F8EA1A042 /* Pods */, + 3456E8E25F114A239880D241 /* Frameworks */, + ); + sourceTree = ""; + }; + 97C146EF1CF9000F007C117D /* Products */ = { + isa = PBXGroup; + children = ( + 97C146EE1CF9000F007C117D /* Runner.app */, + ); + name = Products; + sourceTree = ""; + }; + 97C146F01CF9000F007C117D /* Runner */ = { + isa = PBXGroup; + children = ( + 97C146FA1CF9000F007C117D /* Main.storyboard */, + 97C146FD1CF9000F007C117D /* Assets.xcassets */, + 97C146FF1CF9000F007C117D /* LaunchScreen.storyboard */, + 97C147021CF9000F007C117D /* Info.plist */, + 1498D2321E8E86230040F4C2 /* GeneratedPluginRegistrant.h */, + 1498D2331E8E89220040F4C2 /* GeneratedPluginRegistrant.m */, + 74858FAE1ED2DC5600515810 /* AppDelegate.swift */, + 74858FAD1ED2DC5600515810 /* Runner-Bridging-Header.h */, + ); + path = Runner; + sourceTree = ""; + }; +/* End PBXGroup section */ + +/* Begin PBXNativeTarget section */ + 97C146ED1CF9000F007C117D /* Runner */ = { + isa = PBXNativeTarget; + buildConfigurationList = 97C147051CF9000F007C117D /* Build configuration list for PBXNativeTarget "Runner" */; + buildPhases = ( + F412A5213E8CA6290AF8A003 /* [CP] Check Pods Manifest.lock */, + 9740EEB61CF901F6004384FC /* Run Script */, + 97C146EA1CF9000F007C117D /* Sources */, + 97C146EB1CF9000F007C117D /* Frameworks */, + 97C146EC1CF9000F007C117D /* Resources */, + 9705A1C41CF9048500538489 /* Embed Frameworks */, + 3B06AD1E1E4923F5004D2608 /* Thin Binary */, + 9BDEDB79123E51897883C720 /* [CP] Embed Pods Frameworks */, + ); + buildRules = ( + ); + dependencies = ( + ); + name = Runner; + productName = Runner; + productReference = 97C146EE1CF9000F007C117D /* Runner.app */; + productType = "com.apple.product-type.application"; + }; +/* End PBXNativeTarget section */ + +/* Begin PBXProject section */ + 97C146E61CF9000F007C117D /* Project object */ = { + isa = PBXProject; + attributes = { + LastUpgradeCheck = 1300; + ORGANIZATIONNAME = ""; + TargetAttributes = { + 97C146ED1CF9000F007C117D = { + CreatedOnToolsVersion = 7.3.1; + LastSwiftMigration = 1100; + }; + }; + }; + buildConfigurationList = 97C146E91CF9000F007C117D /* Build configuration list for PBXProject "Runner" */; + compatibilityVersion = "Xcode 9.3"; + developmentRegion = en; + hasScannedForEncodings = 0; + knownRegions = ( + en, + Base, + ); + mainGroup = 97C146E51CF9000F007C117D; + productRefGroup = 97C146EF1CF9000F007C117D /* Products */; + projectDirPath = ""; + projectRoot = ""; + targets = ( + 97C146ED1CF9000F007C117D /* Runner */, + ); + }; +/* End PBXProject section */ + +/* Begin PBXResourcesBuildPhase section */ + 97C146EC1CF9000F007C117D /* Resources */ = { + isa = PBXResourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + 97C147011CF9000F007C117D /* LaunchScreen.storyboard in Resources */, + 3B3967161E833CAA004F5970 /* AppFrameworkInfo.plist in Resources */, + 97C146FE1CF9000F007C117D /* Assets.xcassets in Resources */, + 97C146FC1CF9000F007C117D /* Main.storyboard in Resources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXResourcesBuildPhase section */ + +/* Begin PBXShellScriptBuildPhase section */ + 3B06AD1E1E4923F5004D2608 /* Thin Binary */ = { + isa = PBXShellScriptBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + inputPaths = ( + ); + name = "Thin Binary"; + outputPaths = ( + ); + runOnlyForDeploymentPostprocessing = 0; + shellPath = /bin/sh; + shellScript = "/bin/sh \"$FLUTTER_ROOT/packages/flutter_tools/bin/xcode_backend.sh\" embed_and_thin"; + }; + 9740EEB61CF901F6004384FC /* Run Script */ = { + isa = PBXShellScriptBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + inputPaths = ( + ); + name = "Run Script"; + outputPaths = ( + ); + runOnlyForDeploymentPostprocessing = 0; + shellPath = /bin/sh; + shellScript = "/bin/sh \"$FLUTTER_ROOT/packages/flutter_tools/bin/xcode_backend.sh\" build"; + }; + 9BDEDB79123E51897883C720 /* [CP] Embed Pods Frameworks */ = { + isa = PBXShellScriptBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + inputFileListPaths = ( + "${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-frameworks-${CONFIGURATION}-input-files.xcfilelist", + ); + name = "[CP] Embed Pods Frameworks"; + outputFileListPaths = ( + "${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-frameworks-${CONFIGURATION}-output-files.xcfilelist", + ); + runOnlyForDeploymentPostprocessing = 0; + shellPath = /bin/sh; + shellScript = "\"${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-frameworks.sh\"\n"; + showEnvVarsInLog = 0; + }; + F412A5213E8CA6290AF8A003 /* [CP] Check Pods Manifest.lock */ = { + isa = PBXShellScriptBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + inputFileListPaths = ( + ); + inputPaths = ( + "${PODS_PODFILE_DIR_PATH}/Podfile.lock", + "${PODS_ROOT}/Manifest.lock", + ); + name = "[CP] Check Pods Manifest.lock"; + outputFileListPaths = ( + ); + outputPaths = ( + "$(DERIVED_FILE_DIR)/Pods-Runner-checkManifestLockResult.txt", + ); + runOnlyForDeploymentPostprocessing = 0; + shellPath = /bin/sh; + shellScript = "diff \"${PODS_PODFILE_DIR_PATH}/Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n# This output is used by Xcode 'outputs' to avoid re-running this script phase.\necho \"SUCCESS\" > \"${SCRIPT_OUTPUT_FILE_0}\"\n"; + showEnvVarsInLog = 0; + }; +/* End PBXShellScriptBuildPhase section */ + +/* Begin PBXSourcesBuildPhase section */ + 97C146EA1CF9000F007C117D /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + 74858FAF1ED2DC5600515810 /* AppDelegate.swift in Sources */, + 1498D2341E8E89220040F4C2 /* GeneratedPluginRegistrant.m in Sources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXSourcesBuildPhase section */ + +/* Begin PBXVariantGroup section */ + 97C146FA1CF9000F007C117D /* Main.storyboard */ = { + isa = PBXVariantGroup; + children = ( + 97C146FB1CF9000F007C117D /* Base */, + ); + name = Main.storyboard; + sourceTree = ""; + }; + 97C146FF1CF9000F007C117D /* LaunchScreen.storyboard */ = { + isa = PBXVariantGroup; + children = ( + 97C147001CF9000F007C117D /* Base */, + ); + name = LaunchScreen.storyboard; + sourceTree = ""; + }; +/* End PBXVariantGroup section */ + +/* Begin XCBuildConfiguration section */ + 249021D3217E4FDB00AE95B9 /* Profile */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + CLANG_ANALYZER_NONNULL = YES; + CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; + CLANG_CXX_LIBRARY = "libc++"; + CLANG_ENABLE_MODULES = YES; + CLANG_ENABLE_OBJC_ARC = YES; + CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; + CLANG_WARN_BOOL_CONVERSION = YES; + CLANG_WARN_COMMA = YES; + CLANG_WARN_CONSTANT_CONVERSION = YES; + CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; + CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; + CLANG_WARN_EMPTY_BODY = YES; + CLANG_WARN_ENUM_CONVERSION = YES; + CLANG_WARN_INFINITE_RECURSION = YES; + CLANG_WARN_INT_CONVERSION = YES; + CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; + CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; + CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; + CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; + CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; + CLANG_WARN_STRICT_PROTOTYPES = YES; + CLANG_WARN_SUSPICIOUS_MOVE = YES; + CLANG_WARN_UNREACHABLE_CODE = YES; + CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; + "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; + COPY_PHASE_STRIP = NO; + DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; + ENABLE_NS_ASSERTIONS = NO; + ENABLE_STRICT_OBJC_MSGSEND = YES; + GCC_C_LANGUAGE_STANDARD = gnu99; + GCC_NO_COMMON_BLOCKS = YES; + GCC_WARN_64_TO_32_BIT_CONVERSION = YES; + GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; + GCC_WARN_UNDECLARED_SELECTOR = YES; + GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; + GCC_WARN_UNUSED_FUNCTION = YES; + GCC_WARN_UNUSED_VARIABLE = YES; + IPHONEOS_DEPLOYMENT_TARGET = 11.0; + MTL_ENABLE_DEBUG_INFO = NO; + SDKROOT = iphoneos; + SUPPORTED_PLATFORMS = iphoneos; + TARGETED_DEVICE_FAMILY = "1,2"; + VALIDATE_PRODUCT = YES; + }; + name = Profile; + }; + 249021D4217E4FDB00AE95B9 /* Profile */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = 7AFA3C8E1D35360C0083082E /* Release.xcconfig */; + buildSettings = { + ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; + CLANG_ENABLE_MODULES = YES; + CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)"; + DEVELOPMENT_TEAM = XNK224R4SF; + ENABLE_BITCODE = NO; + INFOPLIST_FILE = Runner/Info.plist; + LD_RUNPATH_SEARCH_PATHS = ( + "$(inherited)", + "@executable_path/Frameworks", + ); + PRODUCT_BUNDLE_IDENTIFIER = com.example.example; + PRODUCT_NAME = "$(TARGET_NAME)"; + SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h"; + SWIFT_VERSION = 5.0; + VERSIONING_SYSTEM = "apple-generic"; + }; + name = Profile; + }; + 97C147031CF9000F007C117D /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + CLANG_ANALYZER_NONNULL = YES; + CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; + CLANG_CXX_LIBRARY = "libc++"; + CLANG_ENABLE_MODULES = YES; + CLANG_ENABLE_OBJC_ARC = YES; + CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; + CLANG_WARN_BOOL_CONVERSION = YES; + CLANG_WARN_COMMA = YES; + CLANG_WARN_CONSTANT_CONVERSION = YES; + CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; + CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; + CLANG_WARN_EMPTY_BODY = YES; + CLANG_WARN_ENUM_CONVERSION = YES; + CLANG_WARN_INFINITE_RECURSION = YES; + CLANG_WARN_INT_CONVERSION = YES; + CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; + CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; + CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; + CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; + CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; + CLANG_WARN_STRICT_PROTOTYPES = YES; + CLANG_WARN_SUSPICIOUS_MOVE = YES; + CLANG_WARN_UNREACHABLE_CODE = YES; + CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; + "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; + COPY_PHASE_STRIP = NO; + DEBUG_INFORMATION_FORMAT = dwarf; + ENABLE_STRICT_OBJC_MSGSEND = YES; + ENABLE_TESTABILITY = YES; + GCC_C_LANGUAGE_STANDARD = gnu99; + GCC_DYNAMIC_NO_PIC = NO; + GCC_NO_COMMON_BLOCKS = YES; + GCC_OPTIMIZATION_LEVEL = 0; + GCC_PREPROCESSOR_DEFINITIONS = ( + "DEBUG=1", + "$(inherited)", + ); + GCC_WARN_64_TO_32_BIT_CONVERSION = YES; + GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; + GCC_WARN_UNDECLARED_SELECTOR = YES; + GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; + GCC_WARN_UNUSED_FUNCTION = YES; + GCC_WARN_UNUSED_VARIABLE = YES; + IPHONEOS_DEPLOYMENT_TARGET = 11.0; + MTL_ENABLE_DEBUG_INFO = YES; + ONLY_ACTIVE_ARCH = YES; + SDKROOT = iphoneos; + TARGETED_DEVICE_FAMILY = "1,2"; + }; + name = Debug; + }; + 97C147041CF9000F007C117D /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + CLANG_ANALYZER_NONNULL = YES; + CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; + CLANG_CXX_LIBRARY = "libc++"; + CLANG_ENABLE_MODULES = YES; + CLANG_ENABLE_OBJC_ARC = YES; + CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; + CLANG_WARN_BOOL_CONVERSION = YES; + CLANG_WARN_COMMA = YES; + CLANG_WARN_CONSTANT_CONVERSION = YES; + CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; + CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; + CLANG_WARN_EMPTY_BODY = YES; + CLANG_WARN_ENUM_CONVERSION = YES; + CLANG_WARN_INFINITE_RECURSION = YES; + CLANG_WARN_INT_CONVERSION = YES; + CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; + CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; + CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; + CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; + CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; + CLANG_WARN_STRICT_PROTOTYPES = YES; + CLANG_WARN_SUSPICIOUS_MOVE = YES; + CLANG_WARN_UNREACHABLE_CODE = YES; + CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; + "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; + COPY_PHASE_STRIP = NO; + DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; + ENABLE_NS_ASSERTIONS = NO; + ENABLE_STRICT_OBJC_MSGSEND = YES; + GCC_C_LANGUAGE_STANDARD = gnu99; + GCC_NO_COMMON_BLOCKS = YES; + GCC_WARN_64_TO_32_BIT_CONVERSION = YES; + GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; + GCC_WARN_UNDECLARED_SELECTOR = YES; + GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; + GCC_WARN_UNUSED_FUNCTION = YES; + GCC_WARN_UNUSED_VARIABLE = YES; + IPHONEOS_DEPLOYMENT_TARGET = 11.0; + MTL_ENABLE_DEBUG_INFO = NO; + SDKROOT = iphoneos; + SUPPORTED_PLATFORMS = iphoneos; + SWIFT_COMPILATION_MODE = wholemodule; + SWIFT_OPTIMIZATION_LEVEL = "-O"; + TARGETED_DEVICE_FAMILY = "1,2"; + VALIDATE_PRODUCT = YES; + }; + name = Release; + }; + 97C147061CF9000F007C117D /* Debug */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = 9740EEB21CF90195004384FC /* Debug.xcconfig */; + buildSettings = { + ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; + CLANG_ENABLE_MODULES = YES; + CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)"; + DEVELOPMENT_TEAM = XNK224R4SF; + ENABLE_BITCODE = NO; + INFOPLIST_FILE = Runner/Info.plist; + LD_RUNPATH_SEARCH_PATHS = ( + "$(inherited)", + "@executable_path/Frameworks", + ); + PRODUCT_BUNDLE_IDENTIFIER = com.example.example; + PRODUCT_NAME = "$(TARGET_NAME)"; + SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h"; + SWIFT_OPTIMIZATION_LEVEL = "-Onone"; + SWIFT_VERSION = 5.0; + VERSIONING_SYSTEM = "apple-generic"; + }; + name = Debug; + }; + 97C147071CF9000F007C117D /* Release */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = 7AFA3C8E1D35360C0083082E /* Release.xcconfig */; + buildSettings = { + ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; + CLANG_ENABLE_MODULES = YES; + CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)"; + DEVELOPMENT_TEAM = XNK224R4SF; + ENABLE_BITCODE = NO; + INFOPLIST_FILE = Runner/Info.plist; + LD_RUNPATH_SEARCH_PATHS = ( + "$(inherited)", + "@executable_path/Frameworks", + ); + PRODUCT_BUNDLE_IDENTIFIER = com.example.example; + PRODUCT_NAME = "$(TARGET_NAME)"; + SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h"; + SWIFT_VERSION = 5.0; + VERSIONING_SYSTEM = "apple-generic"; + }; + name = Release; + }; +/* End XCBuildConfiguration section */ + +/* Begin XCConfigurationList section */ + 97C146E91CF9000F007C117D /* Build configuration list for PBXProject "Runner" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 97C147031CF9000F007C117D /* Debug */, + 97C147041CF9000F007C117D /* Release */, + 249021D3217E4FDB00AE95B9 /* Profile */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; + 97C147051CF9000F007C117D /* Build configuration list for PBXNativeTarget "Runner" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 97C147061CF9000F007C117D /* Debug */, + 97C147071CF9000F007C117D /* Release */, + 249021D4217E4FDB00AE95B9 /* Profile */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; +/* End XCConfigurationList section */ + }; + rootObject = 97C146E61CF9000F007C117D /* Project object */; +} diff --git a/example/ios/Runner.xcodeproj/project.xcworkspace/contents.xcworkspacedata b/packages/instabug_dio_interceptor/example/ios/Runner.xcodeproj/project.xcworkspace/contents.xcworkspacedata similarity index 100% rename from example/ios/Runner.xcodeproj/project.xcworkspace/contents.xcworkspacedata rename to packages/instabug_dio_interceptor/example/ios/Runner.xcodeproj/project.xcworkspace/contents.xcworkspacedata diff --git a/example/ios/Runner.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist b/packages/instabug_dio_interceptor/example/ios/Runner.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist similarity index 100% rename from example/ios/Runner.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist rename to packages/instabug_dio_interceptor/example/ios/Runner.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist diff --git a/example/ios/Runner.xcodeproj/project.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings b/packages/instabug_dio_interceptor/example/ios/Runner.xcodeproj/project.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings similarity index 100% rename from example/ios/Runner.xcodeproj/project.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings rename to packages/instabug_dio_interceptor/example/ios/Runner.xcodeproj/project.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings diff --git a/packages/instabug_dio_interceptor/example/ios/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme b/packages/instabug_dio_interceptor/example/ios/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme new file mode 100644 index 000000000..c87d15a33 --- /dev/null +++ b/packages/instabug_dio_interceptor/example/ios/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme @@ -0,0 +1,87 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/example/ios/Runner.xcworkspace/contents.xcworkspacedata b/packages/instabug_dio_interceptor/example/ios/Runner.xcworkspace/contents.xcworkspacedata similarity index 100% rename from example/ios/Runner.xcworkspace/contents.xcworkspacedata rename to packages/instabug_dio_interceptor/example/ios/Runner.xcworkspace/contents.xcworkspacedata diff --git a/example/ios/Runner.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist b/packages/instabug_dio_interceptor/example/ios/Runner.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist similarity index 100% rename from example/ios/Runner.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist rename to packages/instabug_dio_interceptor/example/ios/Runner.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist diff --git a/example/ios/Runner.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings b/packages/instabug_dio_interceptor/example/ios/Runner.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings similarity index 100% rename from example/ios/Runner.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings rename to packages/instabug_dio_interceptor/example/ios/Runner.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings diff --git a/packages/instabug_dio_interceptor/example/ios/Runner/AppDelegate.swift b/packages/instabug_dio_interceptor/example/ios/Runner/AppDelegate.swift new file mode 100644 index 000000000..70693e4a8 --- /dev/null +++ b/packages/instabug_dio_interceptor/example/ios/Runner/AppDelegate.swift @@ -0,0 +1,13 @@ +import UIKit +import Flutter + +@UIApplicationMain +@objc class AppDelegate: FlutterAppDelegate { + override func application( + _ application: UIApplication, + didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]? + ) -> Bool { + GeneratedPluginRegistrant.register(with: self) + return super.application(application, didFinishLaunchingWithOptions: launchOptions) + } +} diff --git a/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Contents.json b/packages/instabug_dio_interceptor/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Contents.json similarity index 100% rename from example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Contents.json rename to packages/instabug_dio_interceptor/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Contents.json diff --git a/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-1024x1024@1x.png b/packages/instabug_dio_interceptor/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-1024x1024@1x.png similarity index 100% rename from example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-1024x1024@1x.png rename to packages/instabug_dio_interceptor/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-1024x1024@1x.png diff --git a/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@1x.png b/packages/instabug_dio_interceptor/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@1x.png similarity index 100% rename from example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@1x.png rename to packages/instabug_dio_interceptor/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@1x.png diff --git a/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@2x.png b/packages/instabug_dio_interceptor/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@2x.png similarity index 100% rename from example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@2x.png rename to packages/instabug_dio_interceptor/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@2x.png diff --git a/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@3x.png b/packages/instabug_dio_interceptor/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@3x.png similarity index 100% rename from example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@3x.png rename to packages/instabug_dio_interceptor/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@3x.png diff --git a/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@1x.png b/packages/instabug_dio_interceptor/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@1x.png similarity index 100% rename from example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@1x.png rename to packages/instabug_dio_interceptor/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@1x.png diff --git a/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@2x.png b/packages/instabug_dio_interceptor/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@2x.png similarity index 100% rename from example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@2x.png rename to packages/instabug_dio_interceptor/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@2x.png diff --git a/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@3x.png b/packages/instabug_dio_interceptor/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@3x.png similarity index 100% rename from example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@3x.png rename to packages/instabug_dio_interceptor/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@3x.png diff --git a/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@1x.png b/packages/instabug_dio_interceptor/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@1x.png similarity index 100% rename from example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@1x.png rename to packages/instabug_dio_interceptor/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@1x.png diff --git a/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@2x.png b/packages/instabug_dio_interceptor/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@2x.png similarity index 100% rename from example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@2x.png rename to packages/instabug_dio_interceptor/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@2x.png diff --git a/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@3x.png b/packages/instabug_dio_interceptor/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@3x.png similarity index 100% rename from example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@3x.png rename to packages/instabug_dio_interceptor/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@3x.png diff --git a/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@2x.png b/packages/instabug_dio_interceptor/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@2x.png similarity index 100% rename from example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@2x.png rename to packages/instabug_dio_interceptor/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@2x.png diff --git a/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@3x.png b/packages/instabug_dio_interceptor/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@3x.png similarity index 100% rename from example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@3x.png rename to packages/instabug_dio_interceptor/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@3x.png diff --git a/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@1x.png b/packages/instabug_dio_interceptor/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@1x.png similarity index 100% rename from example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@1x.png rename to packages/instabug_dio_interceptor/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@1x.png diff --git a/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@2x.png b/packages/instabug_dio_interceptor/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@2x.png similarity index 100% rename from example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@2x.png rename to packages/instabug_dio_interceptor/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@2x.png diff --git a/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-83.5x83.5@2x.png b/packages/instabug_dio_interceptor/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-83.5x83.5@2x.png similarity index 100% rename from example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-83.5x83.5@2x.png rename to packages/instabug_dio_interceptor/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-83.5x83.5@2x.png diff --git a/example/ios/Runner/Assets.xcassets/LaunchImage.imageset/Contents.json b/packages/instabug_dio_interceptor/example/ios/Runner/Assets.xcassets/LaunchImage.imageset/Contents.json similarity index 100% rename from example/ios/Runner/Assets.xcassets/LaunchImage.imageset/Contents.json rename to packages/instabug_dio_interceptor/example/ios/Runner/Assets.xcassets/LaunchImage.imageset/Contents.json diff --git a/example/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage.png b/packages/instabug_dio_interceptor/example/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage.png similarity index 100% rename from example/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage.png rename to packages/instabug_dio_interceptor/example/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage.png diff --git a/example/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@2x.png b/packages/instabug_dio_interceptor/example/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@2x.png similarity index 100% rename from example/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@2x.png rename to packages/instabug_dio_interceptor/example/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@2x.png diff --git a/example/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@3x.png b/packages/instabug_dio_interceptor/example/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@3x.png similarity index 100% rename from example/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@3x.png rename to packages/instabug_dio_interceptor/example/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@3x.png diff --git a/example/ios/Runner/Assets.xcassets/LaunchImage.imageset/README.md b/packages/instabug_dio_interceptor/example/ios/Runner/Assets.xcassets/LaunchImage.imageset/README.md similarity index 100% rename from example/ios/Runner/Assets.xcassets/LaunchImage.imageset/README.md rename to packages/instabug_dio_interceptor/example/ios/Runner/Assets.xcassets/LaunchImage.imageset/README.md diff --git a/example/ios/Runner/Base.lproj/LaunchScreen.storyboard b/packages/instabug_dio_interceptor/example/ios/Runner/Base.lproj/LaunchScreen.storyboard similarity index 100% rename from example/ios/Runner/Base.lproj/LaunchScreen.storyboard rename to packages/instabug_dio_interceptor/example/ios/Runner/Base.lproj/LaunchScreen.storyboard diff --git a/example/ios/Runner/Base.lproj/Main.storyboard b/packages/instabug_dio_interceptor/example/ios/Runner/Base.lproj/Main.storyboard similarity index 100% rename from example/ios/Runner/Base.lproj/Main.storyboard rename to packages/instabug_dio_interceptor/example/ios/Runner/Base.lproj/Main.storyboard diff --git a/packages/instabug_dio_interceptor/example/ios/Runner/Info.plist b/packages/instabug_dio_interceptor/example/ios/Runner/Info.plist new file mode 100644 index 000000000..907f329fe --- /dev/null +++ b/packages/instabug_dio_interceptor/example/ios/Runner/Info.plist @@ -0,0 +1,49 @@ + + + + + CFBundleDevelopmentRegion + $(DEVELOPMENT_LANGUAGE) + CFBundleDisplayName + Example + CFBundleExecutable + $(EXECUTABLE_NAME) + CFBundleIdentifier + $(PRODUCT_BUNDLE_IDENTIFIER) + CFBundleInfoDictionaryVersion + 6.0 + CFBundleName + example + CFBundlePackageType + APPL + CFBundleShortVersionString + $(FLUTTER_BUILD_NAME) + CFBundleSignature + ???? + CFBundleVersion + $(FLUTTER_BUILD_NUMBER) + LSRequiresIPhoneOS + + UILaunchStoryboardName + LaunchScreen + UIMainStoryboardFile + Main + UISupportedInterfaceOrientations + + UIInterfaceOrientationPortrait + UIInterfaceOrientationLandscapeLeft + UIInterfaceOrientationLandscapeRight + + UISupportedInterfaceOrientations~ipad + + UIInterfaceOrientationPortrait + UIInterfaceOrientationPortraitUpsideDown + UIInterfaceOrientationLandscapeLeft + UIInterfaceOrientationLandscapeRight + + UIViewControllerBasedStatusBarAppearance + + CADisableMinimumFrameDurationOnPhone + + + diff --git a/packages/instabug_dio_interceptor/example/ios/Runner/Runner-Bridging-Header.h b/packages/instabug_dio_interceptor/example/ios/Runner/Runner-Bridging-Header.h new file mode 100644 index 000000000..308a2a560 --- /dev/null +++ b/packages/instabug_dio_interceptor/example/ios/Runner/Runner-Bridging-Header.h @@ -0,0 +1 @@ +#import "GeneratedPluginRegistrant.h" diff --git a/packages/instabug_dio_interceptor/example/lib/main.dart b/packages/instabug_dio_interceptor/example/lib/main.dart new file mode 100644 index 000000000..fcd29a3cb --- /dev/null +++ b/packages/instabug_dio_interceptor/example/lib/main.dart @@ -0,0 +1,78 @@ +import 'package:dio/dio.dart'; +import 'package:flutter/material.dart'; +import 'package:instabug_dio_interceptor/instabug_dio_interceptor.dart'; +import 'package:instabug_flutter/instabug_flutter.dart'; + +Future main() async { + runApp(const MyApp()); + + Instabug.init( + token: 'ed6f659591566da19b67857e1b9d40ab', + invocationEvents: [InvocationEvent.floatingButton], + ); + + final dio = Dio()..interceptors.add(InstabugDioInterceptor()); + final response = await dio.get('https://google.com'); + debugPrint(response.data); +} + +class MyApp extends StatelessWidget { + const MyApp({Key? key}) : super(key: key); + + @override + Widget build(BuildContext context) { + return MaterialApp( + title: 'Flutter Demo', + theme: ThemeData( + primarySwatch: Colors.blue, + ), + home: const MyHomePage(title: 'Flutter Demo Home Page'), + ); + } +} + +class MyHomePage extends StatefulWidget { + const MyHomePage({Key? key, required this.title}) : super(key: key); + final String title; + + @override + State createState() => _MyHomePageState(); +} + +class _MyHomePageState extends State { + int _counter = 0; + + void _incrementCounter() { + setState(() { + _counter++; + }); + } + + @override + Widget build(BuildContext context) { + return Scaffold( + appBar: AppBar( + title: Text(widget.title), + ), + body: Center( + child: Column( + mainAxisAlignment: MainAxisAlignment.center, + children: [ + const Text( + 'You have pushed the button this many times:', + ), + Text( + '$_counter', + style: Theme.of(context).textTheme.headlineMedium, + ), + ], + ), + ), + floatingActionButton: FloatingActionButton( + onPressed: _incrementCounter, + tooltip: 'Increment', + child: const Icon(Icons.add), + ), + ); + } +} diff --git a/example/pubspec.lock b/packages/instabug_dio_interceptor/example/pubspec.lock similarity index 67% rename from example/pubspec.lock rename to packages/instabug_dio_interceptor/example/pubspec.lock index 31cb6f5dd..c0f5398c3 100644 --- a/example/pubspec.lock +++ b/packages/instabug_dio_interceptor/example/pubspec.lock @@ -37,44 +37,47 @@ packages: dependency: transitive description: name: collection - sha256: ee67cb0715911d28db6bf4af1026078bd6f0128b07a5f66fb2ed94ec6783c09a + sha256: a1ace0a119f20aabc852d165077c036cd864315bd99b7eaa10a60100341941bf url: "https://pub.dev" source: hosted - version: "1.18.0" - espresso: - dependency: "direct dev" + version: "1.19.0" + cupertino_icons: + dependency: "direct main" description: - name: espresso - sha256: "641bdfcaec98b2fe2f5c90d61a16cdf6879ddac4d7333a6467ef03d60933596b" + name: cupertino_icons + sha256: ba631d1c7f7bef6b729a622b7b752645a2d076dba9976925b8f25725a30e1ee6 url: "https://pub.dev" source: hosted - version: "0.2.0+5" - fake_async: + version: "1.0.8" + dio: + dependency: "direct main" + description: + name: dio + sha256: "5598aa796bbf4699afd5c67c0f5f6e2ed542afc956884b9cd58c306966efc260" + url: "https://pub.dev" + source: hosted + version: "5.7.0" + dio_web_adapter: dependency: transitive description: - name: fake_async - sha256: "511392330127add0b769b75a987850d136345d9227c6b94c96a04cf4a391bf78" + name: dio_web_adapter + sha256: "33259a9276d6cea88774a0000cfae0d861003497755969c92faa223108620dc8" url: "https://pub.dev" source: hosted - version: "1.3.1" - file: + version: "2.0.0" + fake_async: dependency: transitive description: - name: file - sha256: "5fc22d7c25582e38ad9a8515372cd9a93834027aacf1801cf01164dac0ffa08c" + name: fake_async + sha256: "511392330127add0b769b75a987850d136345d9227c6b94c96a04cf4a391bf78" url: "https://pub.dev" source: hosted - version: "7.0.0" + version: "1.3.1" flutter: dependency: "direct main" description: flutter source: sdk version: "0.0.0" - flutter_driver: - dependency: "direct dev" - description: flutter - source: sdk - version: "0.0.0" flutter_lints: dependency: "direct dev" description: @@ -88,19 +91,6 @@ packages: description: flutter source: sdk version: "0.0.0" - fuchsia_remote_debug_protocol: - dependency: transitive - description: flutter - source: sdk - version: "0.0.0" - http: - dependency: "direct main" - description: - name: http - sha256: "5895291c13fa8a3bd82e76d5627f69e0d85ca6a30dcac95c4ea19a5d555879c2" - url: "https://pub.dev" - source: hosted - version: "0.13.6" http_parser: dependency: transitive description: @@ -109,37 +99,36 @@ packages: url: "https://pub.dev" source: hosted version: "4.0.2" - instabug_flutter: + instabug_dio_interceptor: dependency: "direct main" description: path: ".." relative: true source: path - version: "13.4.0" - instabug_http_client: - dependency: "direct main" + version: "2.5.0" + instabug_flutter: + dependency: "direct overridden" description: - name: instabug_http_client - sha256: "7d52803c0dd639f6dddbe07333418eb251ae02f3f9f4d30402517533ca692784" - url: "https://pub.dev" - source: hosted - version: "2.4.0" + path: "../../instabug_flutter" + relative: true + source: path + version: "15.0.2" leak_tracker: dependency: transitive description: name: leak_tracker - sha256: "7f0df31977cb2c0b88585095d168e689669a2cc9b97c309665e3386f3e9d341a" + sha256: "7bb2830ebd849694d1ec25bf1f44582d6ac531a57a365a803a6034ff751d2d06" url: "https://pub.dev" source: hosted - version: "10.0.4" + version: "10.0.7" leak_tracker_flutter_testing: dependency: transitive description: name: leak_tracker_flutter_testing - sha256: "06e98f569d004c1315b991ded39924b21af84cf14cc94791b8aea337d25b57f8" + sha256: "9491a714cca3667b60b5c420da8217e6de0d1ba7a5ec322fab01758f6998f379" url: "https://pub.dev" source: hosted - version: "3.0.3" + version: "3.0.8" leak_tracker_testing: dependency: transitive description: @@ -168,18 +157,18 @@ packages: dependency: transitive description: name: material_color_utilities - sha256: "0e0a020085b65b6083975e499759762399b4475f766c21668c4ecca34ea74e5a" + sha256: f7142bb1154231d7ea5f96bc7bde4bda2a0945d2806bb11670e30b850d56bdec url: "https://pub.dev" source: hosted - version: "0.8.0" + version: "0.11.1" meta: dependency: transitive description: name: meta - sha256: "7687075e408b093f36e6bbf6c91878cc0d4cd10f409506f7bc996f68220b9136" + sha256: bdb68674043280c3428e9ec998512fb681678676b3c54e773629ffe74419f8c7 url: "https://pub.dev" source: hosted - version: "1.12.0" + version: "1.15.0" path: dependency: transitive description: @@ -188,27 +177,11 @@ packages: url: "https://pub.dev" source: hosted version: "1.9.0" - platform: - dependency: transitive - description: - name: platform - sha256: "12220bb4b65720483f8fa9450b4332347737cf8213dd2840d8b2c823e47243ec" - url: "https://pub.dev" - source: hosted - version: "3.1.4" - process: - dependency: transitive - description: - name: process - sha256: "21e54fd2faf1b5bdd5102afd25012184a6793927648ea81eea80552ac9405b32" - url: "https://pub.dev" - source: hosted - version: "5.0.2" sky_engine: dependency: transitive description: flutter source: sdk - version: "0.0.99" + version: "0.0.0" source_span: dependency: transitive description: @@ -221,10 +194,10 @@ packages: dependency: transitive description: name: stack_trace - sha256: "73713990125a6d93122541237550ee3352a2d84baad52d375a4cad2eb9b7ce0b" + sha256: "9f47fd3630d76be3ab26f0ee06d213679aa425996925ff3feffdec504931c377" url: "https://pub.dev" source: hosted - version: "1.11.1" + version: "1.12.0" stream_channel: dependency: transitive description: @@ -237,18 +210,10 @@ packages: dependency: transitive description: name: string_scanner - sha256: "556692adab6cfa87322a115640c11f13cb77b3f076ddcc5d6ae3c20242bedcde" - url: "https://pub.dev" - source: hosted - version: "1.2.0" - sync_http: - dependency: transitive - description: - name: sync_http - sha256: "7f0cd72eca000d2e026bcd6f990b81d0ca06022ef4e32fb257b30d3d1014a961" + sha256: "688af5ed3402a4bde5b3a6c15fd768dbf2621a614950b17f04626c431ab3c4c3" url: "https://pub.dev" source: hosted - version: "0.3.1" + version: "1.3.0" term_glyph: dependency: transitive description: @@ -261,18 +226,18 @@ packages: dependency: transitive description: name: test_api - sha256: "9955ae474176f7ac8ee4e989dadfb411a58c30415bcfb648fa04b2b8a03afa7f" + sha256: "664d3a9a64782fcdeb83ce9c6b39e78fd2971d4e37827b9b06c3aa1edc5e760c" url: "https://pub.dev" source: hosted - version: "0.7.0" + version: "0.7.3" typed_data: dependency: transitive description: name: typed_data - sha256: facc8d6582f16042dd49f2463ff1bd6e2c9ef9f3d5da3d9b087e244a7b564b3c + sha256: f9049c039ebfeb4cf7a7104a675823cd72dba8297f264b6637062516699fa006 url: "https://pub.dev" source: hosted - version: "1.3.2" + version: "1.4.0" vector_math: dependency: transitive description: @@ -285,18 +250,18 @@ packages: dependency: transitive description: name: vm_service - sha256: "3923c89304b715fb1eb6423f017651664a03bf5f4b29983627c4da791f74a4ec" + sha256: f6be3ed8bd01289b34d679c2b62226f63c0e69f9fd2e50a6b3c1c729a961041b url: "https://pub.dev" source: hosted - version: "14.2.1" - webdriver: + version: "14.3.0" + web: dependency: transitive description: - name: webdriver - sha256: "003d7da9519e1e5f329422b36c4dcdf18d7d2978d1ba099ea4e45ba490ed845e" + name: web + sha256: cd3543bd5798f6ad290ea73d210f423502e71900302dde696f8bff84bf89a1cb url: "https://pub.dev" source: hosted - version: "3.0.3" + version: "1.1.0" sdks: - dart: ">=3.3.0 <4.0.0" + dart: ">=3.5.0 <4.0.0" flutter: ">=3.18.0-18.0.pre.54" diff --git a/packages/instabug_dio_interceptor/example/pubspec.yaml b/packages/instabug_dio_interceptor/example/pubspec.yaml new file mode 100644 index 000000000..a2dbaf01b --- /dev/null +++ b/packages/instabug_dio_interceptor/example/pubspec.yaml @@ -0,0 +1,25 @@ +name: instabug_dio_interceptor_example +description: Demonstrates how to use the instabug_dio_interceptor package. + +publish_to: "none" + +version: 1.0.0+1 + +environment: + sdk: ">=2.12.0 <3.0.0" + +dependencies: + flutter: + sdk: flutter + cupertino_icons: ^1.0.2 + dio: ^5.0.0 + instabug_dio_interceptor: + path: ../ + +dev_dependencies: + flutter_test: + sdk: flutter + flutter_lints: ^1.0.0 + +flutter: + uses-material-design: true diff --git a/packages/instabug_dio_interceptor/example/pubspec_overrides.yaml b/packages/instabug_dio_interceptor/example/pubspec_overrides.yaml new file mode 100644 index 000000000..b7e298895 --- /dev/null +++ b/packages/instabug_dio_interceptor/example/pubspec_overrides.yaml @@ -0,0 +1,6 @@ +# melos_managed_dependency_overrides: instabug_dio_interceptor,instabug_flutter +dependency_overrides: + instabug_dio_interceptor: + path: .. + instabug_flutter: + path: ../../instabug_flutter diff --git a/packages/instabug_dio_interceptor/lib/instabug_dio_interceptor.dart b/packages/instabug_dio_interceptor/lib/instabug_dio_interceptor.dart new file mode 100644 index 000000000..71f8d0676 --- /dev/null +++ b/packages/instabug_dio_interceptor/lib/instabug_dio_interceptor.dart @@ -0,0 +1,100 @@ +import 'package:dio/dio.dart'; +import 'package:instabug_flutter/instabug_flutter.dart'; + +class InstabugDioInterceptor extends Interceptor { + static final Map _requests = {}; + static final NetworkLogger _networklogger = NetworkLogger(); + + @override + Future onRequest( + RequestOptions options, RequestInterceptorHandler handler) async { + final Map headers = options.headers; + final DateTime startTime = DateTime.now(); + // ignore: invalid_use_of_internal_member + final W3CHeader? w3Header = await _networklogger.getW3CHeader( + headers, startTime.millisecondsSinceEpoch); + if (w3Header?.isW3cHeaderFound == false && + w3Header?.w3CGeneratedHeader != null) { + headers['traceparent'] = w3Header?.w3CGeneratedHeader; + } + options.headers = headers; + final NetworkData data = NetworkData( + startTime: startTime, + url: options.uri.toString(), + w3cHeader: w3Header, + method: options.method); + _requests[options.hashCode] = data; + handler.next(options); + } + + @override + void onResponse( + Response response, ResponseInterceptorHandler handler) { + final NetworkData data = _map(response); + _networklogger.networkLog(data); + handler.next(response); + } + + @override + // Keep `DioError` instead of `DioException` for backward-compatibility, for now. + // ignore: deprecated_member_use + void onError(DioError err, ErrorInterceptorHandler handler) { + if (err.response != null) { + final NetworkData data = _map(err.response!); + _networklogger.networkLog(data); + } + + handler.next(err); + } + + static NetworkData _getRequestData(int requestHashCode) { + final NetworkData data = _requests[requestHashCode]!; + _requests.remove(requestHashCode); + return data; + } + + NetworkData _map(Response response) { + final NetworkData data = _getRequestData(response.requestOptions.hashCode); + final Map responseHeaders = {}; + final DateTime endTime = DateTime.now(); + + response.headers + .forEach((String name, dynamic value) => responseHeaders[name] = value); + + String responseContentType = ''; + if (responseHeaders.containsKey('content-type')) { + responseContentType = responseHeaders['content-type'].toString(); + } + + int requestBodySize = 0; + if (response.requestOptions.headers.containsKey('content-length')) { + requestBodySize = + int.parse(response.requestOptions.headers['content-length'] ?? '0'); + } else if (response.requestOptions.data != null) { + requestBodySize = response.requestOptions.data.toString().length; + } + + int responseBodySize = 0; + if (responseHeaders.containsKey('content-length')) { + responseBodySize = int.parse(responseHeaders['content-length'][0] ?? '0'); + } else if (response.data != null) { + responseBodySize = response.data.toString().length; + } + + return data.copyWith( + endTime: endTime, + duration: endTime.difference(data.startTime).inMicroseconds, + url: response.requestOptions.uri.toString(), + method: response.requestOptions.method, + requestBody: response.requestOptions.data.toString(), + requestHeaders: response.requestOptions.headers, + requestContentType: response.requestOptions.contentType, + requestBodySize: requestBodySize, + status: response.statusCode, + responseBody: response.data.toString(), + responseHeaders: responseHeaders, + responseContentType: responseContentType, + responseBodySize: responseBodySize, + ); + } +} diff --git a/packages/instabug_dio_interceptor/pubspec.lock b/packages/instabug_dio_interceptor/pubspec.lock new file mode 100644 index 000000000..aa2ae6c9f --- /dev/null +++ b/packages/instabug_dio_interceptor/pubspec.lock @@ -0,0 +1,737 @@ +# Generated by pub +# See https://dart.dev/tools/pub/glossary#lockfile +packages: + _fe_analyzer_shared: + dependency: transitive + description: + name: _fe_analyzer_shared + sha256: "16e298750b6d0af7ce8a3ba7c18c69c3785d11b15ec83f6dcd0ad2a0009b3cab" + url: "https://pub.dev" + source: hosted + version: "76.0.0" + _macros: + dependency: transitive + description: dart + source: sdk + version: "0.3.3" + analyzer: + dependency: transitive + description: + name: analyzer + sha256: "1f14db053a8c23e260789e9b0980fa27f2680dd640932cae5e1137cce0e46e1e" + url: "https://pub.dev" + source: hosted + version: "6.11.0" + args: + dependency: transitive + description: + name: args + sha256: bf9f5caeea8d8fe6721a9c358dd8a5c1947b27f1cfaa18b39c301273594919e6 + url: "https://pub.dev" + source: hosted + version: "2.6.0" + async: + dependency: transitive + description: + name: async + sha256: "947bfcf187f74dbc5e146c9eb9c0f10c9f8b30743e341481c1e2ed3ecc18c20c" + url: "https://pub.dev" + source: hosted + version: "2.11.0" + boolean_selector: + dependency: transitive + description: + name: boolean_selector + sha256: "6cfb5af12253eaf2b368f07bacc5a80d1301a071c73360d746b7f2e32d762c66" + url: "https://pub.dev" + source: hosted + version: "2.1.1" + build: + dependency: transitive + description: + name: build + sha256: "80184af8b6cb3e5c1c4ec6d8544d27711700bc3e6d2efad04238c7b5290889f0" + url: "https://pub.dev" + source: hosted + version: "2.4.1" + build_config: + dependency: transitive + description: + name: build_config + sha256: bf80fcfb46a29945b423bd9aad884590fb1dc69b330a4d4700cac476af1708d1 + url: "https://pub.dev" + source: hosted + version: "1.1.1" + build_daemon: + dependency: transitive + description: + name: build_daemon + sha256: "79b2aef6ac2ed00046867ed354c88778c9c0f029df8a20fe10b5436826721ef9" + url: "https://pub.dev" + source: hosted + version: "4.0.2" + build_resolvers: + dependency: transitive + description: + name: build_resolvers + sha256: "339086358431fa15d7eca8b6a36e5d783728cf025e559b834f4609a1fcfb7b0a" + url: "https://pub.dev" + source: hosted + version: "2.4.2" + build_runner: + dependency: "direct dev" + description: + name: build_runner + sha256: "028819cfb90051c6b5440c7e574d1896f8037e3c96cf17aaeb054c9311cfbf4d" + url: "https://pub.dev" + source: hosted + version: "2.4.13" + build_runner_core: + dependency: transitive + description: + name: build_runner_core + sha256: f8126682b87a7282a339b871298cc12009cb67109cfa1614d6436fb0289193e0 + url: "https://pub.dev" + source: hosted + version: "7.3.2" + built_collection: + dependency: transitive + description: + name: built_collection + sha256: "376e3dd27b51ea877c28d525560790aee2e6fbb5f20e2f85d5081027d94e2100" + url: "https://pub.dev" + source: hosted + version: "5.1.1" + built_value: + dependency: transitive + description: + name: built_value + sha256: c7913a9737ee4007efedaffc968c049fd0f3d0e49109e778edc10de9426005cb + url: "https://pub.dev" + source: hosted + version: "8.9.2" + characters: + dependency: transitive + description: + name: characters + sha256: "04a925763edad70e8443c99234dc3328f442e811f1d8fd1a72f1c8ad0f69a605" + url: "https://pub.dev" + source: hosted + version: "1.3.0" + checked_yaml: + dependency: transitive + description: + name: checked_yaml + sha256: feb6bed21949061731a7a75fc5d2aa727cf160b91af9a3e464c5e3a32e28b5ff + url: "https://pub.dev" + source: hosted + version: "2.0.3" + cli_config: + dependency: transitive + description: + name: cli_config + sha256: ac20a183a07002b700f0c25e61b7ee46b23c309d76ab7b7640a028f18e4d99ec + url: "https://pub.dev" + source: hosted + version: "0.2.0" + cli_util: + dependency: transitive + description: + name: cli_util + sha256: ff6785f7e9e3c38ac98b2fb035701789de90154024a75b6cb926445e83197d1c + url: "https://pub.dev" + source: hosted + version: "0.4.2" + clock: + dependency: transitive + description: + name: clock + sha256: cb6d7f03e1de671e34607e909a7213e31d7752be4fb66a86d29fe1eb14bfb5cf + url: "https://pub.dev" + source: hosted + version: "1.1.1" + code_builder: + dependency: transitive + description: + name: code_builder + sha256: "0ec10bf4a89e4c613960bf1e8b42c64127021740fb21640c29c909826a5eea3e" + url: "https://pub.dev" + source: hosted + version: "4.10.1" + collection: + dependency: transitive + description: + name: collection + sha256: a1ace0a119f20aabc852d165077c036cd864315bd99b7eaa10a60100341941bf + url: "https://pub.dev" + source: hosted + version: "1.19.0" + convert: + dependency: transitive + description: + name: convert + sha256: b30acd5944035672bc15c6b7a8b47d773e41e2f17de064350988c5d02adb1c68 + url: "https://pub.dev" + source: hosted + version: "3.1.2" + coverage: + dependency: transitive + description: + name: coverage + sha256: "802bd084fb82e55df091ec8ad1553a7331b61c08251eef19a508b6f3f3a9858d" + url: "https://pub.dev" + source: hosted + version: "1.13.1" + crypto: + dependency: transitive + description: + name: crypto + sha256: "1e445881f28f22d6140f181e07737b22f1e099a5e1ff94b0af2f9e4a463f4855" + url: "https://pub.dev" + source: hosted + version: "3.0.6" + csslib: + dependency: transitive + description: + name: csslib + sha256: "09bad715f418841f976c77db72d5398dc1253c21fb9c0c7f0b0b985860b2d58e" + url: "https://pub.dev" + source: hosted + version: "1.0.2" + dart_style: + dependency: transitive + description: + name: dart_style + sha256: "7856d364b589d1f08986e140938578ed36ed948581fbc3bc9aef1805039ac5ab" + url: "https://pub.dev" + source: hosted + version: "2.3.7" + dio: + dependency: "direct main" + description: + name: dio + sha256: "5598aa796bbf4699afd5c67c0f5f6e2ed542afc956884b9cd58c306966efc260" + url: "https://pub.dev" + source: hosted + version: "5.7.0" + dio_web_adapter: + dependency: transitive + description: + name: dio_web_adapter + sha256: "33259a9276d6cea88774a0000cfae0d861003497755969c92faa223108620dc8" + url: "https://pub.dev" + source: hosted + version: "2.0.0" + fake_async: + dependency: transitive + description: + name: fake_async + sha256: "511392330127add0b769b75a987850d136345d9227c6b94c96a04cf4a391bf78" + url: "https://pub.dev" + source: hosted + version: "1.3.1" + file: + dependency: transitive + description: + name: file + sha256: a3b4f84adafef897088c160faf7dfffb7696046cb13ae90b508c2cbc95d3b8d4 + url: "https://pub.dev" + source: hosted + version: "7.0.1" + fixnum: + dependency: transitive + description: + name: fixnum + sha256: b6dc7065e46c974bc7c5f143080a6764ec7a4be6da1285ececdc37be96de53be + url: "https://pub.dev" + source: hosted + version: "1.1.1" + flutter: + dependency: "direct main" + description: flutter + source: sdk + version: "0.0.0" + flutter_test: + dependency: "direct dev" + description: flutter + source: sdk + version: "0.0.0" + frontend_server_client: + dependency: transitive + description: + name: frontend_server_client + sha256: f64a0333a82f30b0cca061bc3d143813a486dc086b574bfb233b7c1372427694 + url: "https://pub.dev" + source: hosted + version: "4.0.0" + glob: + dependency: transitive + description: + name: glob + sha256: "0e7014b3b7d4dac1ca4d6114f82bf1782ee86745b9b42a92c9289c23d8a0ab63" + url: "https://pub.dev" + source: hosted + version: "2.1.2" + graphs: + dependency: transitive + description: + name: graphs + sha256: "741bbf84165310a68ff28fe9e727332eef1407342fca52759cb21ad8177bb8d0" + url: "https://pub.dev" + source: hosted + version: "2.3.2" + html: + dependency: transitive + description: + name: html + sha256: "6d1264f2dffa1b1101c25a91dff0dc2daee4c18e87cd8538729773c073dbf602" + url: "https://pub.dev" + source: hosted + version: "0.15.6" + http: + dependency: transitive + description: + name: http + sha256: bb2ce4590bc2667c96f318d68cac1b5a7987ec819351d32b1c987239a815e007 + url: "https://pub.dev" + source: hosted + version: "1.5.0" + http_multi_server: + dependency: transitive + description: + name: http_multi_server + sha256: "97486f20f9c2f7be8f514851703d0119c3596d14ea63227af6f7a481ef2b2f8b" + url: "https://pub.dev" + source: hosted + version: "3.2.1" + http_parser: + dependency: transitive + description: + name: http_parser + sha256: "2aa08ce0341cc9b354a498388e30986515406668dbcc4f7c950c3e715496693b" + url: "https://pub.dev" + source: hosted + version: "4.0.2" + instabug_flutter: + dependency: "direct main" + description: + path: "../instabug_flutter" + relative: true + source: path + version: "15.0.2" + io: + dependency: transitive + description: + name: io + sha256: "2ec25704aba361659e10e3e5f5d672068d332fc8ac516421d483a11e5cbd061e" + url: "https://pub.dev" + source: hosted + version: "1.0.4" + js: + dependency: transitive + description: + name: js + sha256: c1b2e9b5ea78c45e1a0788d29606ba27dc5f71f019f32ca5140f61ef071838cf + url: "https://pub.dev" + source: hosted + version: "0.7.1" + json_annotation: + dependency: transitive + description: + name: json_annotation + sha256: "1ce844379ca14835a50d2f019a3099f419082cfdd231cd86a142af94dd5c6bb1" + url: "https://pub.dev" + source: hosted + version: "4.9.0" + leak_tracker: + dependency: transitive + description: + name: leak_tracker + sha256: "7bb2830ebd849694d1ec25bf1f44582d6ac531a57a365a803a6034ff751d2d06" + url: "https://pub.dev" + source: hosted + version: "10.0.7" + leak_tracker_flutter_testing: + dependency: transitive + description: + name: leak_tracker_flutter_testing + sha256: "9491a714cca3667b60b5c420da8217e6de0d1ba7a5ec322fab01758f6998f379" + url: "https://pub.dev" + source: hosted + version: "3.0.8" + leak_tracker_testing: + dependency: transitive + description: + name: leak_tracker_testing + sha256: "6ba465d5d76e67ddf503e1161d1f4a6bc42306f9d66ca1e8f079a47290fb06d3" + url: "https://pub.dev" + source: hosted + version: "3.0.1" + lints: + dependency: transitive + description: + name: lints + sha256: cbf8d4b858bb0134ef3ef87841abdf8d63bfc255c266b7bf6b39daa1085c4290 + url: "https://pub.dev" + source: hosted + version: "3.0.0" + logging: + dependency: transitive + description: + name: logging + sha256: c8245ada5f1717ed44271ed1c26b8ce85ca3228fd2ffdb75468ab01979309d61 + url: "https://pub.dev" + source: hosted + version: "1.3.0" + macros: + dependency: transitive + description: + name: macros + sha256: "1d9e801cd66f7ea3663c45fc708450db1fa57f988142c64289142c9b7ee80656" + url: "https://pub.dev" + source: hosted + version: "0.1.3-main.0" + markdown: + dependency: transitive + description: + name: markdown + sha256: "935e23e1ff3bc02d390bad4d4be001208ee92cc217cb5b5a6c19bc14aaa318c1" + url: "https://pub.dev" + source: hosted + version: "7.3.0" + matcher: + dependency: transitive + description: + name: matcher + sha256: d2323aa2060500f906aa31a895b4030b6da3ebdcc5619d14ce1aada65cd161cb + url: "https://pub.dev" + source: hosted + version: "0.12.16+1" + material_color_utilities: + dependency: transitive + description: + name: material_color_utilities + sha256: f7142bb1154231d7ea5f96bc7bde4bda2a0945d2806bb11670e30b850d56bdec + url: "https://pub.dev" + source: hosted + version: "0.11.1" + meta: + dependency: transitive + description: + name: meta + sha256: bdb68674043280c3428e9ec998512fb681678676b3c54e773629ffe74419f8c7 + url: "https://pub.dev" + source: hosted + version: "1.15.0" + mime: + dependency: transitive + description: + name: mime + sha256: "41a20518f0cb1256669420fdba0cd90d21561e560ac240f26ef8322e45bb7ed6" + url: "https://pub.dev" + source: hosted + version: "2.0.0" + mockito: + dependency: "direct dev" + description: + name: mockito + sha256: "6841eed20a7befac0ce07df8116c8b8233ed1f4486a7647c7fc5a02ae6163917" + url: "https://pub.dev" + source: hosted + version: "5.4.4" + node_preamble: + dependency: transitive + description: + name: node_preamble + sha256: "6e7eac89047ab8a8d26cf16127b5ed26de65209847630400f9aefd7cd5c730db" + url: "https://pub.dev" + source: hosted + version: "2.0.2" + package_config: + dependency: transitive + description: + name: package_config + sha256: "1c5b77ccc91e4823a5af61ee74e6b972db1ef98c2ff5a18d3161c982a55448bd" + url: "https://pub.dev" + source: hosted + version: "2.1.0" + pana: + dependency: "direct dev" + description: + name: pana + sha256: "3fc3fe8e7a9fd4827fa4d625a423eec95d305b2bc3538a3adf7fd6c49217af97" + url: "https://pub.dev" + source: hosted + version: "0.21.45" + path: + dependency: transitive + description: + name: path + sha256: "087ce49c3f0dc39180befefc60fdb4acd8f8620e5682fe2476afd0b3688bb4af" + url: "https://pub.dev" + source: hosted + version: "1.9.0" + pool: + dependency: transitive + description: + name: pool + sha256: "20fe868b6314b322ea036ba325e6fc0711a22948856475e2c2b6306e8ab39c2a" + url: "https://pub.dev" + source: hosted + version: "1.5.1" + pub_semver: + dependency: transitive + description: + name: pub_semver + sha256: "40d3ab1bbd474c4c2328c91e3a7df8c6dd629b79ece4c4bd04bee496a224fb0c" + url: "https://pub.dev" + source: hosted + version: "2.1.4" + pubspec_parse: + dependency: transitive + description: + name: pubspec_parse + sha256: c799b721d79eb6ee6fa56f00c04b472dcd44a30d258fac2174a6ec57302678f8 + url: "https://pub.dev" + source: hosted + version: "1.3.0" + retry: + dependency: transitive + description: + name: retry + sha256: "822e118d5b3aafed083109c72d5f484c6dc66707885e07c0fbcb8b986bba7efc" + url: "https://pub.dev" + source: hosted + version: "3.1.2" + safe_url_check: + dependency: transitive + description: + name: safe_url_check + sha256: "49a3e060a7869cbafc8f4845ca1ecbbaaa53179980a32f4fdfeab1607e90f41d" + url: "https://pub.dev" + source: hosted + version: "1.1.2" + shelf: + dependency: transitive + description: + name: shelf + sha256: ad29c505aee705f41a4d8963641f91ac4cee3c8fad5947e033390a7bd8180fa4 + url: "https://pub.dev" + source: hosted + version: "1.4.1" + shelf_packages_handler: + dependency: transitive + description: + name: shelf_packages_handler + sha256: "89f967eca29607c933ba9571d838be31d67f53f6e4ee15147d5dc2934fee1b1e" + url: "https://pub.dev" + source: hosted + version: "3.0.2" + shelf_static: + dependency: transitive + description: + name: shelf_static + sha256: c87c3875f91262785dade62d135760c2c69cb217ac759485334c5857ad89f6e3 + url: "https://pub.dev" + source: hosted + version: "1.1.3" + shelf_web_socket: + dependency: transitive + description: + name: shelf_web_socket + sha256: "073c147238594ecd0d193f3456a5fe91c4b0abbcc68bf5cd95b36c4e194ac611" + url: "https://pub.dev" + source: hosted + version: "2.0.0" + sky_engine: + dependency: transitive + description: flutter + source: sdk + version: "0.0.0" + source_gen: + dependency: transitive + description: + name: source_gen + sha256: "14658ba5f669685cd3d63701d01b31ea748310f7ab854e471962670abcf57832" + url: "https://pub.dev" + source: hosted + version: "1.5.0" + source_map_stack_trace: + dependency: transitive + description: + name: source_map_stack_trace + sha256: c0713a43e323c3302c2abe2a1cc89aa057a387101ebd280371d6a6c9fa68516b + url: "https://pub.dev" + source: hosted + version: "2.1.2" + source_maps: + dependency: transitive + description: + name: source_maps + sha256: "190222579a448b03896e0ca6eca5998fa810fda630c1d65e2f78b3f638f54812" + url: "https://pub.dev" + source: hosted + version: "0.10.13" + source_span: + dependency: transitive + description: + name: source_span + sha256: "53e943d4206a5e30df338fd4c6e7a077e02254531b138a15aec3bd143c1a8b3c" + url: "https://pub.dev" + source: hosted + version: "1.10.0" + stack_trace: + dependency: transitive + description: + name: stack_trace + sha256: "9f47fd3630d76be3ab26f0ee06d213679aa425996925ff3feffdec504931c377" + url: "https://pub.dev" + source: hosted + version: "1.12.0" + stream_channel: + dependency: transitive + description: + name: stream_channel + sha256: ba2aa5d8cc609d96bbb2899c28934f9e1af5cddbd60a827822ea467161eb54e7 + url: "https://pub.dev" + source: hosted + version: "2.1.2" + stream_transform: + dependency: transitive + description: + name: stream_transform + sha256: "14a00e794c7c11aa145a170587321aedce29769c08d7f58b1d141da75e3b1c6f" + url: "https://pub.dev" + source: hosted + version: "2.1.0" + string_scanner: + dependency: transitive + description: + name: string_scanner + sha256: "688af5ed3402a4bde5b3a6c15fd768dbf2621a614950b17f04626c431ab3c4c3" + url: "https://pub.dev" + source: hosted + version: "1.3.0" + tar: + dependency: transitive + description: + name: tar + sha256: "22f67e2d77b51050436620b2a5de521c58ca6f0b75af1d9ab3c8cae2eae58fcd" + url: "https://pub.dev" + source: hosted + version: "1.0.5" + term_glyph: + dependency: transitive + description: + name: term_glyph + sha256: a29248a84fbb7c79282b40b8c72a1209db169a2e0542bce341da992fe1bc7e84 + url: "https://pub.dev" + source: hosted + version: "1.2.1" + test: + dependency: transitive + description: + name: test + sha256: "713a8789d62f3233c46b4a90b174737b2c04cb6ae4500f2aa8b1be8f03f5e67f" + url: "https://pub.dev" + source: hosted + version: "1.25.8" + test_api: + dependency: transitive + description: + name: test_api + sha256: "664d3a9a64782fcdeb83ce9c6b39e78fd2971d4e37827b9b06c3aa1edc5e760c" + url: "https://pub.dev" + source: hosted + version: "0.7.3" + test_core: + dependency: transitive + description: + name: test_core + sha256: "12391302411737c176b0b5d6491f466b0dd56d4763e347b6714efbaa74d7953d" + url: "https://pub.dev" + source: hosted + version: "0.6.5" + timing: + dependency: transitive + description: + name: timing + sha256: "70a3b636575d4163c477e6de42f247a23b315ae20e86442bebe32d3cabf61c32" + url: "https://pub.dev" + source: hosted + version: "1.0.1" + typed_data: + dependency: transitive + description: + name: typed_data + sha256: f9049c039ebfeb4cf7a7104a675823cd72dba8297f264b6637062516699fa006 + url: "https://pub.dev" + source: hosted + version: "1.4.0" + vector_math: + dependency: transitive + description: + name: vector_math + sha256: "80b3257d1492ce4d091729e3a67a60407d227c27241d6927be0130c98e741803" + url: "https://pub.dev" + source: hosted + version: "2.1.4" + vm_service: + dependency: transitive + description: + name: vm_service + sha256: f6be3ed8bd01289b34d679c2b62226f63c0e69f9fd2e50a6b3c1c729a961041b + url: "https://pub.dev" + source: hosted + version: "14.3.0" + watcher: + dependency: transitive + description: + name: watcher + sha256: "3d2ad6751b3c16cf07c7fca317a1413b3f26530319181b37e3b9039b84fc01d8" + url: "https://pub.dev" + source: hosted + version: "1.1.0" + web: + dependency: transitive + description: + name: web + sha256: cd3543bd5798f6ad290ea73d210f423502e71900302dde696f8bff84bf89a1cb + url: "https://pub.dev" + source: hosted + version: "1.1.0" + web_socket: + dependency: transitive + description: + name: web_socket + sha256: "3c12d96c0c9a4eec095246debcea7b86c0324f22df69893d538fcc6f1b8cce83" + url: "https://pub.dev" + source: hosted + version: "0.1.6" + web_socket_channel: + dependency: transitive + description: + name: web_socket_channel + sha256: "9f187088ed104edd8662ca07af4b124465893caf063ba29758f97af57e61da8f" + url: "https://pub.dev" + source: hosted + version: "3.0.1" + webkit_inspection_protocol: + dependency: transitive + description: + name: webkit_inspection_protocol + sha256: "87d3f2333bb240704cd3f1c6b5b7acd8a10e7f0bc28c28dcf14e782014f4a572" + url: "https://pub.dev" + source: hosted + version: "1.2.1" + yaml: + dependency: transitive + description: + name: yaml + sha256: "75769501ea3489fca56601ff33454fe45507ea3bfb014161abc3b43ae25989d5" + url: "https://pub.dev" + source: hosted + version: "3.1.2" +sdks: + dart: ">=3.5.0 <4.0.0" + flutter: ">=3.18.0-18.0.pre.54" diff --git a/packages/instabug_dio_interceptor/pubspec.yaml b/packages/instabug_dio_interceptor/pubspec.yaml new file mode 100644 index 000000000..cadd6616d --- /dev/null +++ b/packages/instabug_dio_interceptor/pubspec.yaml @@ -0,0 +1,60 @@ +name: instabug_dio_interceptor +description: + This package is an add on to instabug_flutter. It intercepts any requests performed + with Dio Package and sends them to the report that will be sent to the dashboard. +version: 2.5.0 +homepage: https://github.com/Instabug/Instabug-Flutter#readme +repository: https://github.com/Instabug/Instabug-Flutter/tree/refactor/monorepo/packages/instabug_dio_interceptor + +environment: + sdk: '>=2.12.0 <4.0.0' + +dependencies: + dio: '>=4.0.0 <6.0.0' + flutter: + sdk: flutter + instabug_flutter: '>=14.0.0 <17.0.0' + + +dev_dependencies: + build_runner: ^2.0.3 + flutter_test: + sdk: flutter + mockito: ^5.0.10 + pana: ^0.21.0 +# For information on the generic Dart part of this file, see the +# following page: https://dart.dev/tools/pub/pubspec + +# The following section is specific to Flutter. +flutter: + + # To add assets to your package, add an assets section, like this: + # assets: + # - images/a_dot_burr.jpeg + # - images/a_dot_ham.jpeg + # + # For details regarding assets in packages, see + # https://flutter.dev/assets-and-images/#from-packages + # + # An image asset can refer to one or more resolution-specific "variants", see + # https://flutter.dev/assets-and-images/#resolution-aware. + + # To add custom fonts to your package, add a fonts section here, + # in this "flutter" section. Each entry in this list should have a + # "family" key with the font family name, and a "fonts" key with a + # list giving the asset and other descriptors for the font. For + # example: + # fonts: + # - family: Schyler + # fonts: + # - asset: fonts/Schyler-Regular.ttf + # - asset: fonts/Schyler-Italic.ttf + # style: italic + # - family: Trajan Pro + # fonts: + # - asset: fonts/TrajanPro.ttf + # - asset: fonts/TrajanPro_Bold.ttf + # weight: 700 + # + # For details regarding fonts in packages, see + # https://flutter.dev/custom-fonts/#from-packages diff --git a/packages/instabug_dio_interceptor/pubspec_overrides.yaml b/packages/instabug_dio_interceptor/pubspec_overrides.yaml new file mode 100644 index 000000000..1f0beaf62 --- /dev/null +++ b/packages/instabug_dio_interceptor/pubspec_overrides.yaml @@ -0,0 +1,4 @@ +# melos_managed_dependency_overrides: instabug_flutter +dependency_overrides: + instabug_flutter: + path: ../instabug_flutter diff --git a/packages/instabug_dio_interceptor/release.sh b/packages/instabug_dio_interceptor/release.sh new file mode 100755 index 000000000..6b211fe17 --- /dev/null +++ b/packages/instabug_dio_interceptor/release.sh @@ -0,0 +1,13 @@ +#!/bin/sh +VERSION=$(egrep -o "version: ([0-9]-*.*)+[0-9]" pubspec.yaml | cut -d ":" -f 2) +if [ ! "${VERSION}" ] || [ -z "${VERSION}" ];then + echo "Instabug: err: Version Number not found." + exit 1 +else + mkdir -p .pub-cache + cat < $HOME/.pub-cache/credentials.json + ${PUB_CREDENTIALS} + +EOF + flutter packages pub publish -f +fi \ No newline at end of file diff --git a/packages/instabug_dio_interceptor/test/instabug_dio_interceptor_test.dart b/packages/instabug_dio_interceptor/test/instabug_dio_interceptor_test.dart new file mode 100644 index 000000000..21826c116 --- /dev/null +++ b/packages/instabug_dio_interceptor/test/instabug_dio_interceptor_test.dart @@ -0,0 +1,111 @@ +import 'package:dio/dio.dart'; +import 'package:flutter/material.dart'; +import 'package:flutter_test/flutter_test.dart'; +import 'package:instabug_dio_interceptor/instabug_dio_interceptor.dart'; +import 'package:instabug_flutter/instabug_flutter.dart'; +import 'package:instabug_flutter/src/generated/instabug.api.g.dart'; +import 'package:mockito/annotations.dart'; +import 'package:mockito/mockito.dart'; + +import 'instabug_dio_interceptor_test.mocks.dart'; +import 'mock_adapter.dart'; + +class MyInterceptor extends InstabugDioInterceptor { + int requestCount = 0; + int resposneCount = 0; + int errorCount = 0; + + @override + Future onRequest( + RequestOptions options, RequestInterceptorHandler handler) async { + requestCount++; + super.onRequest(options, handler); + } + + @override + void onResponse( + Response response, ResponseInterceptorHandler handler) { + resposneCount++; + super.onResponse(response, handler); + } + + @override + // ignore: deprecated_member_use + void onError(DioError err, ErrorInterceptorHandler handler) { + errorCount++; + super.onError(err, handler); + } +} + +@GenerateMocks([ + InstabugHostApi, +]) +void main() { + TestWidgetsFlutterBinding.ensureInitialized(); + WidgetsFlutterBinding.ensureInitialized(); + + final MockInstabugHostApi mHost = MockInstabugHostApi(); + + late Dio dio; + late MyInterceptor instabugDioInterceptor; + const String appToken = '068ba9a8c3615035e163dc5f829c73be'; + + setUpAll(() { + Instabug.$setHostApi(mHost); + NetworkLogger.$setHostApi(mHost); + when(mHost.isW3CFeatureFlagsEnabled()) + .thenAnswer((_) => Future>.value({ + 'isW3cCaughtHeaderEnabled': true, + 'isW3cExternalGeneratedHeaderEnabled': true, + 'isW3cExternalTraceIDEnabled': true, + })); + }); + + setUp(() { + dio = Dio(); + dio.options.baseUrl = MockAdapter.mockBase; + dio.httpClientAdapter = MockAdapter(); + final List events = []; + instabugDioInterceptor = MyInterceptor(); + dio.interceptors.add(instabugDioInterceptor); + Instabug.init(token: appToken, invocationEvents: events); + }); + + test('onResponse Test', () async { + try { + await dio.get('/test'); + // ignore: deprecated_member_use + } on DioError { + // ignor + } + + expect(instabugDioInterceptor.requestCount, 1); + expect(instabugDioInterceptor.resposneCount, 1); + expect(instabugDioInterceptor.errorCount, 0); + }); + + test('onError Test', () async { + try { + await dio.get('/test-error'); + // ignore: deprecated_member_use + } on DioError { + // ignor + } + + expect(instabugDioInterceptor.requestCount, 1); + expect(instabugDioInterceptor.resposneCount, 0); + expect(instabugDioInterceptor.errorCount, 1); + }); + + test('Stress Test', () async { + for (int i = 0; i < 1000; i++) { + try { + await dio.get('/test'); + // ignore: deprecated_member_use + } on DioError { + // ignor + } + } + expect(instabugDioInterceptor.requestCount, 1000); + }); +} diff --git a/packages/instabug_dio_interceptor/test/mock_adapter.dart b/packages/instabug_dio_interceptor/test/mock_adapter.dart new file mode 100644 index 000000000..a00e8c560 --- /dev/null +++ b/packages/instabug_dio_interceptor/test/mock_adapter.dart @@ -0,0 +1,40 @@ +import 'dart:async'; +import 'dart:convert'; +import 'dart:typed_data'; + +import 'package:dio/dio.dart'; +import 'package:dio/io.dart'; + +class MockAdapter implements HttpClientAdapter { + static const String mockHost = 'mockserver'; + static const String mockBase = 'http://$mockHost'; + final IOHttpClientAdapter _adapter = IOHttpClientAdapter(); + + @override + Future fetch(RequestOptions options, + Stream? requestStream, Future? cancelFuture) async { + final Uri uri = options.uri; + + if (uri.host == mockHost) { + switch (uri.path) { + case '/test': + return ResponseBody.fromString( + jsonEncode({ + 'errCode': 0, + 'data': {'path': uri.path} + }), + 200, + ); + + default: + return ResponseBody.fromString('', 404); + } + } + return _adapter.fetch(options, requestStream, cancelFuture); + } + + @override + void close({bool force = false}) { + _adapter.close(force: force); + } +} diff --git a/.metadata b/packages/instabug_flutter/.metadata similarity index 100% rename from .metadata rename to packages/instabug_flutter/.metadata diff --git a/.pubignore b/packages/instabug_flutter/.pubignore similarity index 100% rename from .pubignore rename to packages/instabug_flutter/.pubignore diff --git a/CHANGELOG.md b/packages/instabug_flutter/CHANGELOG.md similarity index 83% rename from CHANGELOG.md rename to packages/instabug_flutter/CHANGELOG.md index 418e317c8..bf5266132 100644 --- a/CHANGELOG.md +++ b/packages/instabug_flutter/CHANGELOG.md @@ -1,5 +1,85 @@ # Changelog +## [Unreleased](https://github.com/Instabug/Instabug-Flutter/compare/v15.0.2...dev) + +### Added + +- Add support for Advanced UI customization with comprehensive theming capabilities ([#599](https://github.com/Instabug/Instabug-Flutter/pull/599)) + +- Add support for private views and automasking ([#519](https://github.com/Instabug/Instabug-Flutter/pull/519)) + +- Add support for user steps ([#519](https://github.com/Instabug/Instabug-Flutter/pull/519)) + +- Add support for App variant. ([#585](https://github.com/Instabug/Instabug-Flutter/pull/585)) + +### Changed + +- **BREAKING** Remove deprecated APIs ([#614](https://github.com/Instabug/Instabug-Flutter/pull/614)). See migration guide for more details. + + +## [15.0.2](https://github.com/Instabug/Instabug-Flutter/compare/v14.3.0...15.0.2) (Jul 7, 2025) + +### Added + + +- Add support for xCode 16. ([#574](https://github.com/Instabug/Instabug-Flutter/pull/574)) + +- Add support for BugReporting user consents. ([#573](https://github.com/Instabug/Instabug-Flutter/pull/573)) + +### Changed + +- Bump Instabug iOS SDK to v15.1.1 ([#581](https://github.com/Instabug/Instabug-Flutter/pull/581)). [See release notes](https://github.com/Instabug/Instabug-iOS/releases/tag/15.1.1). + +- Bump Instabug Android SDK to v15.0.2 ([#581](https://github.com/Instabug/Instabug-Flutter/pull/581)). [See release notes](https://github.com/Instabug/Instabug-Android/releases/tag/v15.0.2). + +## [14.3.1](https://github.com/Instabug/Instabug-Flutter/compare/v14.3.0...14.3.1) (May 20, 2025) + +### Changed + +- Bump Instabug Android SDK to v14.3.1 ([#577](https://github.com/Instabug/Instabug-Flutter/pull/577)). [See release notes](https://github.com/Instabug/Instabug-Android/releases/tag/v14.3.1). + + +## [14.3.0](https://github.com/Instabug/Instabug-Flutter/compare/v14.1.0...14.3.0) (April 21, 2025) + +### Added + +- Add support enable/disable capturing network body. ([#561](https://github.com/Instabug/Instabug-Flutter/pull/561)) + +### Changed + +- Bump Instabug iOS SDK to v14.3.0 ([#569](https://github.com/Instabug/Instabug-Flutter/pull/569)). [See release notes](https://github.com/Instabug/Instabug-iOS/releases/tag/14.3.0). + +- Bump Instabug Android SDK to v14.3.0 ([#569](https://github.com/Instabug/Instabug-Flutter/pull/569)). [See release notes](https://github.com/Instabug/Instabug-Android/releases/tag/v14.3.0). + +### Fixed + +- Fixed an issue with `SetReproStepsConfig` on Android platform ([#543](https://github.com/Instabug/Instabug-Flutter/pull/543)). + +## [14.1.0](https://github.com/Instabug/Instabug-Flutter/compare/v14.0.0...v14.1.0) (January 2, 2025) + +### Changed + +- Bump Instabug Android SDK to v14.1.0 ([#539](https://github.com/Instabug/Instabug-Flutter/pull/539)). [See release notes](https://github.com/Instabug/Instabug-Android/releases/tag/v14.1.0). +- Bump Instabug iOS SDK to v14.1.0 ([#539](https://github.com/Instabug/Instabug-Flutter/pull/539)). [See release notes](https://github.com/Instabug/Instabug-iOS/releases/tag/14.1.0), + +## [14.1.0](https://github.com/Instabug/Instabug-Flutter/compare/v14.0.0...v14.1.0) (January 2, 2025) + +### Changed + +- Bump Instabug Android SDK to v14.1.0 ([#539](https://github.com/Instabug/Instabug-Flutter/pull/539)). [See release notes](https://github.com/Instabug/Instabug-Android/releases/tag/v14.1.0). +- Bump Instabug iOS SDK to v14.1.0 ([#539](https://github.com/Instabug/Instabug-Flutter/pull/539)). [See release notes](https://github.com/Instabug/Instabug-iOS/releases/tag/14.1.0), + +## [14.0.0](https://github.com/Instabug/Instabug-Flutter/compare/v13.4.0...v14.0.0) (November 18, 2024) + +### Added + +- Add support for tracing network requests from Instabug to services like Datadog and New Relic ([#481](https://github.com/Instabug/Instabug-Flutter/pull/481)). + +### Changed + +- Bump Instabug Android SDK to v14.0.0 ([#532](https://github.com/Instabug/Instabug-Flutter/pull/532)). [See release notes](https://github.com/Instabug/Instabug-Android/releases/tag/v14.0.0). +- Bump Instabug iOS SDK to v14.0.0 ([#532](https://github.com/Instabug/Instabug-Flutter/pull/532)). [See release notes](https://github.com/Instabug/Instabug-iOS/releases/tag/14.0.0), + ## [13.4.0](https://github.com/Instabug/Instabug-Flutter/compare/v13.3.0...v13.4.0) (September 29, 2024) ### Added diff --git a/packages/instabug_flutter/Gemfile b/packages/instabug_flutter/Gemfile new file mode 100644 index 000000000..19b2c91d4 --- /dev/null +++ b/packages/instabug_flutter/Gemfile @@ -0,0 +1 @@ +source "https://rubygems.org" diff --git a/packages/instabug_flutter/Gemfile.lock b/packages/instabug_flutter/Gemfile.lock new file mode 100644 index 000000000..3c10ae234 --- /dev/null +++ b/packages/instabug_flutter/Gemfile.lock @@ -0,0 +1,11 @@ +GEM + remote: https://rubygems.org/ + specs: + +PLATFORMS + ruby + +DEPENDENCIES + +BUNDLED WITH + 1.17.2 diff --git a/LICENSE b/packages/instabug_flutter/LICENSE similarity index 100% rename from LICENSE rename to packages/instabug_flutter/LICENSE diff --git a/packages/instabug_flutter/README.md b/packages/instabug_flutter/README.md new file mode 100644 index 000000000..88080febd --- /dev/null +++ b/packages/instabug_flutter/README.md @@ -0,0 +1,116 @@ +# Instabug for Flutter + +[![pub package](https://img.shields.io/pub/v/instabug_flutter.svg)](https://pub.dev/packages/instabug_flutter) + +A Flutter plugin for [Instabug](https://instabug.com/). + +## Available Features + +| 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) | ✅ | + +* ✅ Stable +* ⚙️ Under active development + +## Integration + +### Installation + +1. Add Instabug to your `pubspec.yaml` file. + +```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. + +```dart +import 'package:instabug_flutter/instabug_flutter.dart'; + +void main() { + WidgetsFlutterBinding.ensureInitialized(); + + Instabug.init( + token: 'APP_TOKEN', + invocationEvents: [InvocationEvent.shake], + ); + + runApp(MyApp()); +} +``` + +> :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: + +* "`` needs access to the microphone to be able to attach voice notes." +* "`` needs access to your photo library for you to be able to attach images." + +**The permission alert for accessing the microphone/photo library will NOT appear unless users attempt to attach a voice note/photo while using Instabug.** diff --git a/android/.gitignore b/packages/instabug_flutter/android/.gitignore similarity index 100% rename from android/.gitignore rename to packages/instabug_flutter/android/.gitignore diff --git a/android/build.gradle b/packages/instabug_flutter/android/build.gradle similarity index 72% rename from android/build.gradle rename to packages/instabug_flutter/android/build.gradle index 92654b91b..fc3642caf 100644 --- a/android/build.gradle +++ b/packages/instabug_flutter/android/build.gradle @@ -1,5 +1,5 @@ group 'com.instabug.flutter' -version '13.4.0' +version '15.0.2' buildscript { repositories { @@ -16,13 +16,19 @@ rootProject.allprojects { repositories { google() mavenCentral() + maven { + url 'https://oss.sonatype.org/content/repositories/snapshots' + } } } apply plugin: 'com.android.library' android { - compileSdkVersion 28 + if (project.android.hasProperty("namespace")) { + namespace "com.instabug.flutter" + } + compileSdkVersion 33 compileOptions { sourceCompatibility JavaVersion.VERSION_1_8 @@ -41,10 +47,11 @@ android { } dependencies { - api 'com.instabug.library:instabug:13.4.1' - + api 'com.instabug.library:instabug:15.0.2' testImplementation 'junit:junit:4.13.2' testImplementation "org.mockito:mockito-inline:3.12.1" + testImplementation "io.mockk:mockk:1.13.13" + testImplementation "org.robolectric:robolectric:4.12.2" } // add upload_symbols task diff --git a/android/gradle.properties b/packages/instabug_flutter/android/gradle.properties similarity index 100% rename from android/gradle.properties rename to packages/instabug_flutter/android/gradle.properties diff --git a/android/gradle/wrapper/gradle-wrapper.properties b/packages/instabug_flutter/android/gradle/wrapper/gradle-wrapper.properties similarity index 100% rename from android/gradle/wrapper/gradle-wrapper.properties rename to packages/instabug_flutter/android/gradle/wrapper/gradle-wrapper.properties diff --git a/android/proguard-rules.txt b/packages/instabug_flutter/android/proguard-rules.txt similarity index 100% rename from android/proguard-rules.txt rename to packages/instabug_flutter/android/proguard-rules.txt diff --git a/android/settings.gradle b/packages/instabug_flutter/android/settings.gradle similarity index 100% rename from android/settings.gradle rename to packages/instabug_flutter/android/settings.gradle diff --git a/android/src/main/AndroidManifest.xml b/packages/instabug_flutter/android/src/main/AndroidManifest.xml similarity index 84% rename from android/src/main/AndroidManifest.xml rename to packages/instabug_flutter/android/src/main/AndroidManifest.xml index 8c678b4e2..c6dec7d9d 100644 --- a/android/src/main/AndroidManifest.xml +++ b/packages/instabug_flutter/android/src/main/AndroidManifest.xml @@ -1,5 +1,4 @@ - + `. This parameter is used to provide the result of the execution trace + * operation back to the caller. The `success` method of the `result` object is called with the + * + * @deprecated see {@link #startFlow} + */ + + + /** + * Starts an AppFlow with the specified name. + *
+ * On starting two flows with the same name the older flow will end with force abandon end reason. + * AppFlow name cannot exceed 150 characters otherwise it's truncated, + * leading and trailing whitespaces are also ignored. + * + * @param name AppFlow name. It can not be empty string or null. + * Starts a new AppFlow, if APM is enabled, feature is enabled + * and Instabug SDK is initialized. + */ + @Override + public void startFlow(@NonNull String name) { + try { + APM.startFlow(name); + } catch (Exception e) { + e.printStackTrace(); + } + } + + /** + * Sets custom attributes for AppFlow with a given name. + *
+ * Setting an attribute value to null will remove its corresponding key if it already exists. + *
+ * Attribute key name cannot exceed 30 characters. + * Leading and trailing whitespaces are also ignored. + * Does not accept empty strings or null. + *
+ * Attribute value name cannot exceed 60 characters, + * leading and trailing whitespaces are also ignored. + * Does not accept empty strings. + *
+ * If a trace is ended, attributes will not be added and existing ones will not be updated. + *
+ * + * @param name AppFlow name. It can not be empty string or null + * @param key AppFlow attribute key. It can not be empty string or null + * @param value AppFlow attribute value. It can not be empty string. Null to remove attribute + */ + @Override + public void setFlowAttribute(@NonNull String name, @NonNull String key, @Nullable String value) { + try { + APM.setFlowAttribute(name, key, value); + } catch (Exception e) { + e.printStackTrace(); + } + } + + /** + * Ends AppFlow with a given name. + * + * @param name AppFlow name to be ended. It can not be empty string or null + */ + @Override + public void endFlow(@NonNull String name) { + try { + APM.endFlow(name); + } catch (Exception e) { + e.printStackTrace(); + } + } + + + + /** + * Starts a UI trace. + * + * @param name string name of the UI trace. + */ + @Override + public void startUITrace(@NonNull String name) { + try { + APM.startUITrace(name); + } catch (Exception e) { + e.printStackTrace(); + } + } + + /** + * This method is used to terminate the currently active UI trace. + */ + @Override + public void endUITrace() { + try { + APM.endUITrace(); + } catch (Exception e) { + e.printStackTrace(); + } + } + + /** + * This method is used to signal the end of the app launch process. + */ + @Override + public void endAppLaunch() { + try { + APM.endAppLaunch(); + } catch (Exception e) { + e.printStackTrace(); + } + } + + + /** + * logs network-related information + * + * @param data Map of network data object. + */ + @Override + public void networkLogAndroid(@NonNull Map data) { + try { + APMNetworkLogger apmNetworkLogger = new APMNetworkLogger(); + final String requestUrl = (String) data.get("url"); + final String requestBody = (String) data.get("requestBody"); + final String responseBody = (String) data.get("responseBody"); + final String requestMethod = (String) data.get("method"); + //-------------------------------------------- + final String requestContentType = (String) data.get("requestContentType"); + final String responseContentType = (String) data.get("responseContentType"); + //-------------------------------------------- + final long requestBodySize = ((Number) data.get("requestBodySize")).longValue(); + final long responseBodySize = ((Number) data.get("responseBodySize")).longValue(); + //-------------------------------------------- + final String errorDomain = (String) data.get("errorDomain"); + final Integer statusCode = (Integer) data.get("responseCode"); + final long requestDuration = ((Number) data.get("duration")).longValue() / 1000; + final long requestStartTime = ((Number) data.get("startTime")).longValue() * 1000; + final String requestHeaders = (new JSONObject((HashMap) data.get("requestHeaders"))).toString(4); + final String responseHeaders = (new JSONObject((HashMap) data.get("responseHeaders"))).toString(4); + final String errorMessage; + + if (errorDomain.equals("")) { + errorMessage = null; + } else { + errorMessage = errorDomain; + } + //-------------------------------------------------- + String gqlQueryName = null; + if (data.containsKey("gqlQueryName")) { + gqlQueryName = (String) data.get("gqlQueryName"); + } + String serverErrorMessage = ""; + if (data.containsKey("serverErrorMessage")) { + serverErrorMessage = (String) data.get("serverErrorMessage"); + } + Boolean isW3cHeaderFound = null; + Number partialId = null; + Number networkStartTimeInSeconds = null; + String w3CGeneratedHeader = null; + String w3CCaughtHeader = null; + + if (data.containsKey("isW3cHeaderFound")) { + isW3cHeaderFound = (Boolean) data.get("isW3cHeaderFound"); + } + + if (data.containsKey("partialId")) { + + + partialId = ((Number) data.get("partialId")); + + } + if (data.containsKey("networkStartTimeInSeconds")) { + networkStartTimeInSeconds = ((Number) data.get("networkStartTimeInSeconds")); + } + + if (data.containsKey("w3CGeneratedHeader")) { + + w3CGeneratedHeader = (String) data.get("w3CGeneratedHeader"); + + + } + if (data.containsKey("w3CCaughtHeader")) { + w3CCaughtHeader = (String) data.get("w3CCaughtHeader"); + + } + + + APMCPNetworkLog.W3CExternalTraceAttributes w3cExternalTraceAttributes = + null; + if (isW3cHeaderFound != null) { + w3cExternalTraceAttributes = new APMCPNetworkLog.W3CExternalTraceAttributes( + isW3cHeaderFound, partialId == null ? null : partialId.longValue(), + networkStartTimeInSeconds == null ? null : networkStartTimeInSeconds.longValue(), + w3CGeneratedHeader, w3CCaughtHeader + + ); + } + + Method method = Reflection.getMethod(Class.forName("com.instabug.apm.networking.APMNetworkLogger"), "log", long.class, long.class, String.class, String.class, long.class, String.class, String.class, String.class, String.class, String.class, long.class, int.class, String.class, String.class, String.class, String.class, APMCPNetworkLog.W3CExternalTraceAttributes.class); + if (method != null) { + method.invoke(apmNetworkLogger, requestStartTime, requestDuration, requestHeaders, requestBody, requestBodySize, requestMethod, requestUrl, requestContentType, responseHeaders, responseBody, responseBodySize, statusCode, responseContentType, errorMessage, gqlQueryName, serverErrorMessage, w3cExternalTraceAttributes); + } else { + Log.e(TAG, "APMNetworkLogger.log was not found by reflection"); + } + + } catch(Exception e){ + e.printStackTrace(); + } + } + + + /** + * This method is responsible for initiating a custom performance UI trace + * in the APM module. It takes three parameters: + * @param screenName: A string representing the name of the screen or UI element being traced. + * @param microTimeStamp: A number representing the timestamp in microseconds when the trace is started. + * @param traceId: A number representing the unique identifier for the trace. + */ + @Override + public void startCpUiTrace(@NonNull String screenName, @NonNull Long microTimeStamp, @NonNull Long traceId) { + try { + InternalAPM._startUiTraceCP(screenName, microTimeStamp, traceId); + } catch (Exception e) { + e.printStackTrace(); + } + } + + + /** + * This method is responsible for reporting the screen + * loading data from Dart side to Android side. It takes three parameters: + * @param startTimeStampMicro: A number representing the start timestamp in microseconds of the screen + * loading custom performance data. + * @param durationMicro: A number representing the duration in microseconds of the screen loading custom + * performance data. + * @param uiTraceId: A number representing the unique identifier for the UI trace associated with the + * screen loading. + */ + @Override + public void reportScreenLoadingCP(@NonNull Long startTimeStampMicro, @NonNull Long durationMicro, @NonNull Long uiTraceId) { + try { + InternalAPM._reportScreenLoadingCP(startTimeStampMicro, durationMicro, uiTraceId); + } catch (Exception e) { + e.printStackTrace(); + } + } + + + /** + * This method is responsible for extend the end time if the screen loading custom + * trace. It takes two parameters: + * @param timeStampMicro: A number representing the timestamp in microseconds when the screen loading + * custom trace is ending. + * @param uiTraceId: A number representing the unique identifier for the UI trace associated with the + * screen loading. + */ + @Override + public void endScreenLoadingCP(@NonNull Long timeStampMicro, @NonNull Long uiTraceId) { + try { + InternalAPM._endScreenLoadingCP(timeStampMicro, uiTraceId); + } catch (Exception e) { + e.printStackTrace(); + } + } + + + /** + * This method is used to check whether the end screen loading feature is enabled or not. + */ + @Override + public void isEndScreenLoadingEnabled(@NonNull ApmPigeon.Result result) { + isScreenLoadingEnabled(result); + } + + + @Override + public void isEnabled(@NonNull ApmPigeon.Result result) { + try { + // TODO: replace true with an actual implementation of APM.isEnabled once implemented + // in the Android SDK. + result.success(true); + } catch (Exception e) { + e.printStackTrace(); + } + } + + /** + * checks whether the screen loading feature is enabled. + * */ + @Override + public void isScreenLoadingEnabled(@NonNull ApmPigeon.Result result) { + try { + InternalAPM._isFeatureEnabledCP(APMFeature.SCREEN_LOADING, "InstabugCaptureScreenLoading", new FeatureAvailabilityCallback() { + @Override + public void invoke(boolean isFeatureAvailable) { + result.success(isFeatureAvailable); + } + }); + } catch (Exception e) { + e.printStackTrace(); + } + } + + /** + * This method is setting the enabled state of the screen loading feature. + */ + @Override + public void setScreenLoadingEnabled(@NonNull Boolean isEnabled) { + try { + APM.setScreenLoadingEnabled(isEnabled); + } catch (Exception e) { + e.printStackTrace(); + } + } +} diff --git a/android/src/main/java/com/instabug/flutter/modules/BugReportingApi.java b/packages/instabug_flutter/android/src/main/java/com/instabug/flutter/modules/BugReportingApi.java similarity index 89% rename from android/src/main/java/com/instabug/flutter/modules/BugReportingApi.java rename to packages/instabug_flutter/android/src/main/java/com/instabug/flutter/modules/BugReportingApi.java index 56d91600b..c845de0c1 100644 --- a/android/src/main/java/com/instabug/flutter/modules/BugReportingApi.java +++ b/packages/instabug_flutter/android/src/main/java/com/instabug/flutter/modules/BugReportingApi.java @@ -184,6 +184,28 @@ public void setCommentMinimumCharacterCount(@NonNull Long limit, @Nullable List< reportTypesArray[i] = ArgsRegistry.reportTypes.get(key); } } - BugReporting.setCommentMinimumCharacterCount(limit.intValue(), reportTypesArray); - } + BugReporting.setCommentMinimumCharacterCountForBugReportType(limit.intValue(), reportTypesArray); + } + + @Override +public void addUserConsents(String key, String description, Boolean mandatory, Boolean checked, String actionType) { + ThreadManager.runOnMainThread(new Runnable() { + @Override + public void run() { + String mappedActionType; + try { + if (actionType==null) { + mappedActionType = null; + } + else { + mappedActionType = ArgsRegistry.userConsentActionType.get(actionType); + } + + BugReporting.addUserConsent(key, description, mandatory, checked, mappedActionType); + } catch (Exception e) { + e.printStackTrace(); + } + } + }); +} } diff --git a/android/src/main/java/com/instabug/flutter/modules/CrashReportingApi.java b/packages/instabug_flutter/android/src/main/java/com/instabug/flutter/modules/CrashReportingApi.java similarity index 100% rename from android/src/main/java/com/instabug/flutter/modules/CrashReportingApi.java rename to packages/instabug_flutter/android/src/main/java/com/instabug/flutter/modules/CrashReportingApi.java diff --git a/android/src/main/java/com/instabug/flutter/modules/FeatureRequestsApi.java b/packages/instabug_flutter/android/src/main/java/com/instabug/flutter/modules/FeatureRequestsApi.java similarity index 100% rename from android/src/main/java/com/instabug/flutter/modules/FeatureRequestsApi.java rename to packages/instabug_flutter/android/src/main/java/com/instabug/flutter/modules/FeatureRequestsApi.java diff --git a/android/src/main/java/com/instabug/flutter/modules/InstabugApi.java b/packages/instabug_flutter/android/src/main/java/com/instabug/flutter/modules/InstabugApi.java similarity index 52% rename from android/src/main/java/com/instabug/flutter/modules/InstabugApi.java rename to packages/instabug_flutter/android/src/main/java/com/instabug/flutter/modules/InstabugApi.java index 74c4e4ba4..5dd22556f 100644 --- a/android/src/main/java/com/instabug/flutter/modules/InstabugApi.java +++ b/packages/instabug_flutter/android/src/main/java/com/instabug/flutter/modules/InstabugApi.java @@ -5,14 +5,23 @@ import android.graphics.Bitmap; import android.graphics.BitmapFactory; import android.net.Uri; +import android.graphics.Typeface; import android.util.Log; + import androidx.annotation.NonNull; import androidx.annotation.Nullable; import androidx.annotation.VisibleForTesting; + import com.instabug.flutter.generated.InstabugPigeon; import com.instabug.flutter.util.ArgsRegistry; import com.instabug.flutter.util.Reflection; import com.instabug.flutter.util.ThreadManager; +import com.instabug.library.ReproMode; +import com.instabug.library.internal.crossplatform.CoreFeature; +import com.instabug.library.internal.crossplatform.CoreFeaturesState; +import com.instabug.library.internal.crossplatform.FeaturesStateListener; +import com.instabug.library.internal.crossplatform.InternalCore; +import com.instabug.flutter.util.privateViews.ScreenshotCaptor; import com.instabug.library.Feature; import com.instabug.library.Instabug; import com.instabug.library.InstabugColorTheme; @@ -21,13 +30,17 @@ import com.instabug.library.Platform; import com.instabug.library.ReproConfigurations; import com.instabug.library.featuresflags.model.IBGFeatureFlag; +import com.instabug.library.internal.crossplatform.InternalCore; import com.instabug.library.internal.module.InstabugLocale; import com.instabug.library.invocation.InstabugInvocationEvent; import com.instabug.library.model.NetworkLog; +import com.instabug.library.screenshot.instacapture.ScreenshotRequest; import com.instabug.library.ui.onboarding.WelcomeMessage; + import io.flutter.FlutterInjector; import io.flutter.embedding.engine.loader.FlutterLoader; import io.flutter.plugin.common.BinaryMessenger; + import org.jetbrains.annotations.NotNull; import org.json.JSONObject; @@ -36,6 +49,8 @@ import java.io.InputStream; import java.lang.reflect.Method; import java.util.ArrayList; +import java.util.Arrays; +import java.util.Date; import java.util.HashMap; import java.util.List; import java.util.Locale; @@ -48,14 +63,19 @@ public class InstabugApi implements InstabugPigeon.InstabugHostApi { private final Callable screenshotProvider; private final InstabugCustomTextPlaceHolder placeHolder = new InstabugCustomTextPlaceHolder(); + private final InstabugPigeon.FeatureFlagsFlutterApi featureFlagsFlutterApi; + public static void init(BinaryMessenger messenger, Context context, Callable screenshotProvider) { - final InstabugApi api = new InstabugApi(context, screenshotProvider); + final InstabugPigeon.FeatureFlagsFlutterApi flutterApi = new InstabugPigeon.FeatureFlagsFlutterApi(messenger); + + final InstabugApi api = new InstabugApi(context, screenshotProvider, flutterApi); InstabugPigeon.InstabugHostApi.setup(messenger, api); } - public InstabugApi(Context context, Callable screenshotProvider) { + public InstabugApi(Context context, Callable screenshotProvider, InstabugPigeon.FeatureFlagsFlutterApi featureFlagsFlutterApi) { this.context = context; this.screenshotProvider = screenshotProvider; + this.featureFlagsFlutterApi = featureFlagsFlutterApi; } @VisibleForTesting @@ -92,10 +112,12 @@ public Boolean isEnabled() { @NotNull @Override - public Boolean isBuilt() { return Instabug.isBuilt(); } + public Boolean isBuilt() { + return Instabug.isBuilt(); + } @Override - public void init(@NonNull String token, @NonNull List invocationEvents, @NonNull String debugLogsLevel) { + public void init(@NonNull String token, @NonNull List invocationEvents, @NonNull String debugLogsLevel, @Nullable String appVariant) { setCurrentPlatform(); InstabugInvocationEvent[] invocationEventsArray = new InstabugInvocationEvent[invocationEvents.size()]; @@ -106,13 +128,36 @@ public void init(@NonNull String token, @NonNull List invocationEvents, final Application application = (Application) context; final int parsedLogLevel = ArgsRegistry.sdkLogLevels.get(debugLogsLevel); - - new Instabug.Builder(application, token) + Instabug.Builder builder = new Instabug.Builder(application, token) .setInvocationEvents(invocationEventsArray) - .setSdkDebugLogsLevel(parsedLogLevel) - .build(); + .setSdkDebugLogsLevel(parsedLogLevel); + if (appVariant != null) { + builder.setAppVariant(appVariant); + } + + builder.build(); Instabug.setScreenshotProvider(screenshotProvider); + try { + Class myClass = Class.forName("com.instabug.library.Instabug"); + // Enable/Disable native user steps capturing + Method method = myClass.getDeclaredMethod("shouldDisableNativeUserStepsCapturing", boolean.class); + method.setAccessible(true); + method.invoke(null, true); + } catch (Exception e) { + e.printStackTrace(); + } + } + + @Override + public void enableAutoMasking(@NonNull List autoMasking) { + int[] autoMaskingArray = new int[autoMasking.size()]; + for (int i = 0; i < autoMasking.size(); i++) { + String key = autoMasking.get(i); + autoMaskingArray[i] = ArgsRegistry.autoMasking.get(key); + } + + Instabug.setAutoMaskScreenshotsTypes(Arrays.copyOf(autoMaskingArray, autoMaskingArray.length)); } @Override @@ -136,6 +181,17 @@ public void setUserData(@NonNull String data) { Instabug.setUserData(data); } + @Override + public void setAppVariant(@NonNull String appVariant) { + try { + Instabug.setAppVariant(appVariant); + + } catch (Exception e) { + e.printStackTrace(); + } + + } + @Override public void logUserEvent(@NonNull String name) { Instabug.logUserEvent(name); @@ -146,6 +202,33 @@ public void logOut() { Instabug.logoutUser(); } + @Override + public void setEnableUserSteps(@NonNull Boolean isEnabled) { + Instabug.setTrackingUserStepsState(isEnabled ? Feature.State.ENABLED : Feature.State.DISABLED); + } + + @Override + + public void logUserSteps(@NonNull String gestureType, @NonNull String message, @Nullable String viewName) { + try { + final String stepType = ArgsRegistry.gestureStepType.get(gestureType); + final long timeStamp = System.currentTimeMillis(); + String view = ""; + + Method method = Reflection.getMethod(Class.forName("com.instabug.library.Instabug"), "addUserStep", + long.class, String.class, String.class, String.class, String.class); + if (method != null) { + if (viewName != null) { + view = viewName; + } + + method.invoke(null, timeStamp, stepType, message, null, view); + } + } catch (Exception e) { + e.printStackTrace(); + } + } + @Override public void setLocale(@NonNull String locale) { final InstabugLocale resolvedLocale = ArgsRegistry.locales.get(locale); @@ -166,7 +249,6 @@ public void setWelcomeMessageMode(@NonNull String mode) { @Override public void setPrimaryColor(@NonNull Long color) { - Instabug.setPrimaryColor(color.intValue()); } @Override @@ -218,20 +300,7 @@ public void run() { ); } - @Override - public void addExperiments(@NonNull List experiments) { - Instabug.addExperiments(experiments); - } - - @Override - public void removeExperiments(@NonNull List experiments) { - Instabug.removeExperiments(experiments); - } - @Override - public void clearAllExperiments() { - Instabug.clearAllExperiments(); - } @Override public void addFeatureFlags(@NonNull Map featureFlags) { @@ -325,7 +394,7 @@ public void setReproStepsConfig(@Nullable String bugMode, @Nullable String crash if (crashMode != null) { final Integer resolvedCrashMode = ArgsRegistry.reproModes.get(crashMode); - builder.setIssueMode(IssueType.Crash, resolvedCrashMode); + builder.setIssueMode(IssueType.AllCrashes, resolvedCrashMode); } if (sessionReplayMode != null) { @@ -349,6 +418,12 @@ public void reportScreenChange(@NonNull String screenName) { if (method != null) { method.invoke(null, null, screenName); } + Method reportView = Reflection.getMethod(Class.forName("com.instabug.library.Instabug"), "reportCurrentViewChange", + String.class); + + if (reportView != null) { + reportView.invoke(null, screenName); + } } catch (Exception e) { e.printStackTrace(); } @@ -437,8 +512,242 @@ public void networkLog(@NonNull Map data) { } } + @Override + public void registerFeatureFlagChangeListener() { + + try { + InternalCore.INSTANCE._setFeaturesStateListener(new FeaturesStateListener() { + @Override + public void invoke(@NonNull CoreFeaturesState featuresState) { + ThreadManager.runOnMainThread(new Runnable() { + @Override + public void run() { + featureFlagsFlutterApi.onW3CFeatureFlagChange(featuresState.isW3CExternalTraceIdEnabled(), + featuresState.isAttachingGeneratedHeaderEnabled(), + featuresState.isAttachingCapturedHeaderEnabled(), + new InstabugPigeon.FeatureFlagsFlutterApi.Reply() { + @Override + public void reply(Void reply) { + + } + }); + } + }); + } + + }); + } catch (Exception e) { + e.printStackTrace(); + } + + } + + @NonNull + @Override + public Map isW3CFeatureFlagsEnabled() { + Map params = new HashMap(); + params.put("isW3cExternalTraceIDEnabled", InternalCore.INSTANCE._isFeatureEnabled(CoreFeature.W3C_EXTERNAL_TRACE_ID)); + params.put("isW3cExternalGeneratedHeaderEnabled", InternalCore.INSTANCE._isFeatureEnabled(CoreFeature.W3C_ATTACHING_GENERATED_HEADER)); + params.put("isW3cCaughtHeaderEnabled", InternalCore.INSTANCE._isFeatureEnabled(CoreFeature.W3C_ATTACHING_CAPTURED_HEADER)); + + + return params; + } + @Override public void willRedirectToStore() { Instabug.willRedirectToStore(); } + + public static void setScreenshotCaptor(ScreenshotCaptor screenshotCaptor, InternalCore internalCore) { + internalCore._setScreenshotCaptor(new com.instabug.library.screenshot.ScreenshotCaptor() { + @Override + public void capture(@NonNull ScreenshotRequest screenshotRequest) { + screenshotCaptor.capture(new ScreenshotCaptor.CapturingCallback() { + @Override + public void onCapturingFailure(Throwable throwable) { + screenshotRequest.getListener().onCapturingFailure(throwable); + } + + @Override + public void onCapturingSuccess(Bitmap bitmap) { + screenshotRequest.getListener().onCapturingSuccess(bitmap); + } + }); + } + }); + } + + @Override + public void setNetworkLogBodyEnabled(@NonNull Boolean isEnabled) { + try { + Instabug.setNetworkLogBodyEnabled(isEnabled); + } catch (Exception e) { + e.printStackTrace(); + } + } + + @Override + public void setTheme(@NonNull Map themeConfig) { + try { + Log.d(TAG, "setTheme called with config: " + themeConfig.toString()); + + com.instabug.library.model.IBGTheme.Builder builder = new com.instabug.library.model.IBGTheme.Builder(); + + if (themeConfig.containsKey("primaryColor")) { + builder.setPrimaryColor(getColor(themeConfig, "primaryColor")); + } + if (themeConfig.containsKey("secondaryTextColor")) { + builder.setSecondaryTextColor(getColor(themeConfig, "secondaryTextColor")); + } + if (themeConfig.containsKey("primaryTextColor")) { + builder.setPrimaryTextColor(getColor(themeConfig, "primaryTextColor")); + } + if (themeConfig.containsKey("titleTextColor")) { + builder.setTitleTextColor(getColor(themeConfig, "titleTextColor")); + } + if (themeConfig.containsKey("backgroundColor")) { + builder.setBackgroundColor(getColor(themeConfig, "backgroundColor")); + } + + if (themeConfig.containsKey("primaryTextStyle")) { + builder.setPrimaryTextStyle(getTextStyle(themeConfig, "primaryTextStyle")); + } + if (themeConfig.containsKey("secondaryTextStyle")) { + builder.setSecondaryTextStyle(getTextStyle(themeConfig, "secondaryTextStyle")); + } + if (themeConfig.containsKey("ctaTextStyle")) { + builder.setCtaTextStyle(getTextStyle(themeConfig, "ctaTextStyle")); + } + + setFontIfPresent(themeConfig, builder, "primaryFontPath", "primaryFontAsset", "primary"); + setFontIfPresent(themeConfig, builder, "secondaryFontPath", "secondaryFontAsset", "secondary"); + setFontIfPresent(themeConfig, builder, "ctaFontPath", "ctaFontAsset", "CTA"); + + com.instabug.library.model.IBGTheme theme = builder.build(); + Instabug.setTheme(theme); + Log.d(TAG, "Theme applied successfully"); + + } catch (Exception e) { + Log.e(TAG, "Error in setTheme: " + e.getMessage()); + e.printStackTrace(); + } + } + + + + /** + * Retrieves a color value from the Map. + * + * @param map The Map object. + * @param key The key to look for. + * @return The parsed color as an integer, or black if missing or invalid. + */ + private int getColor(Map map, String key) { + try { + if (map != null && map.containsKey(key) && map.get(key) != null) { + String colorString = (String) map.get(key); + return android.graphics.Color.parseColor(colorString); + } + } catch (Exception e) { + e.printStackTrace(); + } + return android.graphics.Color.BLACK; + } + + /** + * Retrieves a text style from the Map. + * + * @param map The Map object. + * @param key The key to look for. + * @return The corresponding Typeface style, or Typeface.NORMAL if missing or invalid. + */ + private int getTextStyle(Map map, String key) { + try { + if (map != null && map.containsKey(key) && map.get(key) != null) { + String style = (String) map.get(key); + switch (style.toLowerCase()) { + case "bold": + return Typeface.BOLD; + case "italic": + return Typeface.ITALIC; + case "bold_italic": + return Typeface.BOLD_ITALIC; + case "normal": + default: + return Typeface.NORMAL; + } + } + } catch (Exception e) { + e.printStackTrace(); + } + return Typeface.NORMAL; + } + + /** + * Sets a font on the theme builder if the font configuration is present in the theme config. + * + * @param themeConfig The theme configuration map + * @param builder The theme builder + * @param fileKey The key for font file path + * @param assetKey The key for font asset path + * @param fontType The type of font (for logging purposes) + */ + private void setFontIfPresent(Map themeConfig, com.instabug.library.model.IBGTheme.Builder builder, + String fileKey, String assetKey, String fontType) { + if (themeConfig.containsKey(fileKey) || themeConfig.containsKey(assetKey)) { + Typeface typeface = getTypeface(themeConfig, fileKey, assetKey); + if (typeface != null) { + switch (fontType) { + case "primary": + builder.setPrimaryTextFont(typeface); + break; + case "secondary": + builder.setSecondaryTextFont(typeface); + break; + case "CTA": + builder.setCtaTextFont(typeface); + break; + } + } + } + } + + private Typeface getTypeface(Map map, String fileKey, String assetKey) { + String fontName = null; + + if (assetKey != null && map.containsKey(assetKey) && map.get(assetKey) != null) { + fontName = (String) map.get(assetKey); + } else if (fileKey != null && map.containsKey(fileKey) && map.get(fileKey) != null) { + fontName = (String) map.get(fileKey); + } + + if (fontName == null) { + return Typeface.DEFAULT; + } + + try { + String assetPath = "fonts/" + fontName; + return Typeface.createFromAsset(context.getAssets(), assetPath); + } catch (Exception e) { + try { + return Typeface.create(fontName, Typeface.NORMAL); + } catch (Exception e2) { + return Typeface.DEFAULT; + } + } + } + /** + * Enables or disables displaying in full-screen mode, hiding the status and navigation bars. + * @param isEnabled A boolean to enable/disable setFullscreen. + */ + @Override + public void setFullscreen(@NonNull final Boolean isEnabled) { + try { + Instabug.setFullscreen(isEnabled); + } catch (Exception e) { + e.printStackTrace(); + } + } + } diff --git a/android/src/main/java/com/instabug/flutter/modules/InstabugLogApi.java b/packages/instabug_flutter/android/src/main/java/com/instabug/flutter/modules/InstabugLogApi.java similarity index 100% rename from android/src/main/java/com/instabug/flutter/modules/InstabugLogApi.java rename to packages/instabug_flutter/android/src/main/java/com/instabug/flutter/modules/InstabugLogApi.java diff --git a/packages/instabug_flutter/android/src/main/java/com/instabug/flutter/modules/InstabugPrivateView.java b/packages/instabug_flutter/android/src/main/java/com/instabug/flutter/modules/InstabugPrivateView.java new file mode 100644 index 000000000..53ed0ac23 --- /dev/null +++ b/packages/instabug_flutter/android/src/main/java/com/instabug/flutter/modules/InstabugPrivateView.java @@ -0,0 +1,47 @@ +package com.instabug.flutter.modules; + +import android.os.Handler; +import android.os.Looper; + +import com.instabug.flutter.generated.InstabugPrivateViewPigeon; +import com.instabug.flutter.util.privateViews.ScreenshotCaptor; +import com.instabug.library.internal.crossplatform.InternalCore; + +import io.flutter.plugin.common.BinaryMessenger; + +public class InstabugPrivateView implements InstabugPrivateViewPigeon.InstabugPrivateViewHostApi { + PrivateViewManager privateViewManager; + + public static void init(BinaryMessenger messenger, PrivateViewManager privateViewManager) { + final InstabugPrivateView api = new InstabugPrivateView(messenger, privateViewManager); + InstabugPrivateViewPigeon.InstabugPrivateViewHostApi.setup(messenger, api); + } + + public InstabugPrivateView(BinaryMessenger messenger, PrivateViewManager privateViewManager) { + this.privateViewManager = privateViewManager; + InstabugPrivateViewPigeon.InstabugPrivateViewHostApi.setup(messenger, this); + init(); + } + + static long time = System.currentTimeMillis(); + + @Override + public void init() { + InstabugApi.setScreenshotCaptor(new ScreenshotCaptor() { + @Override + public void capture(CapturingCallback listener) { + + (new Handler(Looper.getMainLooper())).postDelayed(new Runnable() { + @Override + public void run() { + time = System.currentTimeMillis(); + privateViewManager.mask(listener); + + } + }, 300); + + + } + }, InternalCore.INSTANCE); + } +} diff --git a/packages/instabug_flutter/android/src/main/java/com/instabug/flutter/modules/PrivateViewManager.java b/packages/instabug_flutter/android/src/main/java/com/instabug/flutter/modules/PrivateViewManager.java new file mode 100644 index 000000000..fd105be5a --- /dev/null +++ b/packages/instabug_flutter/android/src/main/java/com/instabug/flutter/modules/PrivateViewManager.java @@ -0,0 +1,147 @@ +package com.instabug.flutter.modules; + +import android.app.Activity; +import android.graphics.Bitmap; +import android.graphics.Canvas; +import android.graphics.Paint; +import android.os.Build; + +import androidx.annotation.NonNull; +import androidx.annotation.VisibleForTesting; + +import com.instabug.flutter.generated.InstabugPrivateViewPigeon; +import com.instabug.flutter.model.ScreenshotResult; +import com.instabug.flutter.modules.capturing.CaptureManager; +import com.instabug.flutter.modules.capturing.ScreenshotResultCallback; +import com.instabug.flutter.util.ThreadManager; +import com.instabug.flutter.util.privateViews.ScreenshotCaptor; + +import java.util.List; +import java.util.concurrent.CountDownLatch; +import java.util.concurrent.ExecutorService; +import java.util.concurrent.Executors; +import java.util.concurrent.atomic.AtomicReference; + +public class PrivateViewManager { + private static final String THREAD_NAME = "IBG-Flutter-Screenshot"; + public static final String EXCEPTION_MESSAGE = "IBG-Flutter-Screenshot: error capturing screenshot"; + + private final ExecutorService screenshotExecutor = Executors.newSingleThreadExecutor(runnable -> { + Thread thread = new Thread(runnable); + thread.setName(THREAD_NAME); + return thread; + }); + + private final InstabugPrivateViewPigeon.InstabugPrivateViewFlutterApi instabugPrivateViewApi; + private Activity activity; + final CaptureManager pixelCopyScreenshotCaptor; + final CaptureManager boundryScreenshotCaptor; + + public PrivateViewManager(@NonNull InstabugPrivateViewPigeon.InstabugPrivateViewFlutterApi instabugPrivateViewApi, CaptureManager pixelCopyCaptureManager, CaptureManager boundryCaptureManager) { + this.instabugPrivateViewApi = instabugPrivateViewApi; + this.pixelCopyScreenshotCaptor = pixelCopyCaptureManager; + this.boundryScreenshotCaptor = boundryCaptureManager; + + + } + + public void setActivity(Activity activity) { + this.activity = activity; + } + + + public void mask(ScreenshotCaptor.CapturingCallback capturingCallback) { + if (activity != null) { + CountDownLatch latch = new CountDownLatch(1); + AtomicReference> privateViews = new AtomicReference<>(); + final ScreenshotResultCallback boundryScreenshotResult = new ScreenshotResultCallback() { + + @Override + public void onScreenshotResult(ScreenshotResult screenshotResult) { + processScreenshot(screenshotResult, privateViews, latch, capturingCallback); + + } + + @Override + public void onError() { + capturingCallback.onCapturingFailure(new Exception(EXCEPTION_MESSAGE)); + } + }; + + try { + ThreadManager.runOnMainThread(new Runnable() { + @Override + public void run() { + instabugPrivateViewApi.getPrivateViews(result -> { + privateViews.set(result); + latch.countDown(); + }); + } + }); + + + if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) { + pixelCopyScreenshotCaptor.capture(activity, new ScreenshotResultCallback() { + @Override + public void onScreenshotResult(ScreenshotResult result) { + processScreenshot(result, privateViews, latch, capturingCallback); + + } + + @Override + public void onError() { + boundryScreenshotCaptor.capture(activity, boundryScreenshotResult); + + } + }); + } else { + boundryScreenshotCaptor.capture(activity, boundryScreenshotResult); + } + + } catch (Exception e) { + capturingCallback.onCapturingFailure(e); + } + } else { + capturingCallback.onCapturingFailure(new Exception(EXCEPTION_MESSAGE)); + } + } + + + private void processScreenshot(ScreenshotResult result, AtomicReference> privateViews, CountDownLatch latch, ScreenshotCaptor.CapturingCallback capturingCallback) { + screenshotExecutor.execute(() -> { + try { + latch.await(); // Wait + Bitmap bitmap = result.getScreenshot(); + maskPrivateViews(result, privateViews.get()); + capturingCallback.onCapturingSuccess(bitmap); + long lastTime = System.currentTimeMillis(); + System.out.println("Time:" + (lastTime - InstabugPrivateView.time)); + + } catch (InterruptedException e) { + capturingCallback.onCapturingFailure(e); + } + }); + } + + @VisibleForTesting + public void maskPrivateViews(ScreenshotResult result, List privateViews) { + try { + if (privateViews == null || privateViews.isEmpty()) return; + + Bitmap bitmap = result.getScreenshot(); + float pixelRatio = result.getPixelRatio(); + Canvas canvas = new Canvas(bitmap); + Paint paint = new Paint(); // Default color is black + + for (int i = 0; i < privateViews.size(); i += 4) { + float left = privateViews.get(i).floatValue() * pixelRatio; + float top = privateViews.get(i + 1).floatValue() * pixelRatio; + float right = privateViews.get(i + 2).floatValue() * pixelRatio; + float bottom = privateViews.get(i + 3).floatValue() * pixelRatio; + canvas.drawRect(left, top, right, bottom, paint); // Mask private view + } + } catch (Exception e) { + e.printStackTrace(); + } + } +} \ No newline at end of file diff --git a/android/src/main/java/com/instabug/flutter/modules/RepliesApi.java b/packages/instabug_flutter/android/src/main/java/com/instabug/flutter/modules/RepliesApi.java similarity index 100% rename from android/src/main/java/com/instabug/flutter/modules/RepliesApi.java rename to packages/instabug_flutter/android/src/main/java/com/instabug/flutter/modules/RepliesApi.java diff --git a/android/src/main/java/com/instabug/flutter/modules/SessionReplayApi.java b/packages/instabug_flutter/android/src/main/java/com/instabug/flutter/modules/SessionReplayApi.java similarity index 100% rename from android/src/main/java/com/instabug/flutter/modules/SessionReplayApi.java rename to packages/instabug_flutter/android/src/main/java/com/instabug/flutter/modules/SessionReplayApi.java diff --git a/android/src/main/java/com/instabug/flutter/modules/SurveysApi.java b/packages/instabug_flutter/android/src/main/java/com/instabug/flutter/modules/SurveysApi.java similarity index 100% rename from android/src/main/java/com/instabug/flutter/modules/SurveysApi.java rename to packages/instabug_flutter/android/src/main/java/com/instabug/flutter/modules/SurveysApi.java diff --git a/packages/instabug_flutter/android/src/main/java/com/instabug/flutter/modules/capturing/BoundryCaptureManager.java b/packages/instabug_flutter/android/src/main/java/com/instabug/flutter/modules/capturing/BoundryCaptureManager.java new file mode 100644 index 000000000..6f8409749 --- /dev/null +++ b/packages/instabug_flutter/android/src/main/java/com/instabug/flutter/modules/capturing/BoundryCaptureManager.java @@ -0,0 +1,43 @@ +package com.instabug.flutter.modules.capturing; + +import android.app.Activity; +import android.graphics.Bitmap; +import android.util.DisplayMetrics; +import android.view.View; + +import com.instabug.flutter.model.ScreenshotResult; +import com.instabug.flutter.util.ThreadManager; + +import io.flutter.embedding.engine.renderer.FlutterRenderer; + +public class BoundryCaptureManager implements CaptureManager { + FlutterRenderer renderer; + + public BoundryCaptureManager(FlutterRenderer renderer) { + this.renderer = renderer; + } + + @Override + public void capture(Activity activity, ScreenshotResultCallback screenshotResultCallback) { + ThreadManager.runOnMainThread(new Runnable() { + @Override + public void run() { + try { + if (activity == null) { + screenshotResultCallback.onError(); + return; + } + View rootView = activity.getWindow().getDecorView().getRootView(); + rootView.setDrawingCacheEnabled(true); + Bitmap bitmap = renderer.getBitmap(); + rootView.setDrawingCacheEnabled(false); + DisplayMetrics displayMetrics = activity.getResources().getDisplayMetrics(); + screenshotResultCallback.onScreenshotResult(new ScreenshotResult(displayMetrics.density, bitmap)); + + } catch (Exception e) { + screenshotResultCallback.onError(); + } + } + }); + } +} diff --git a/packages/instabug_flutter/android/src/main/java/com/instabug/flutter/modules/capturing/CaptureManager.java b/packages/instabug_flutter/android/src/main/java/com/instabug/flutter/modules/capturing/CaptureManager.java new file mode 100644 index 000000000..f15aa4780 --- /dev/null +++ b/packages/instabug_flutter/android/src/main/java/com/instabug/flutter/modules/capturing/CaptureManager.java @@ -0,0 +1,7 @@ +package com.instabug.flutter.modules.capturing; + +import android.app.Activity; + +public interface CaptureManager { + void capture(Activity activity, ScreenshotResultCallback screenshotResultCallback); +} diff --git a/packages/instabug_flutter/android/src/main/java/com/instabug/flutter/modules/capturing/PixelCopyCaptureManager.java b/packages/instabug_flutter/android/src/main/java/com/instabug/flutter/modules/capturing/PixelCopyCaptureManager.java new file mode 100644 index 000000000..be19f1ca6 --- /dev/null +++ b/packages/instabug_flutter/android/src/main/java/com/instabug/flutter/modules/capturing/PixelCopyCaptureManager.java @@ -0,0 +1,86 @@ +package com.instabug.flutter.modules.capturing; + +import android.app.Activity; +import android.graphics.Bitmap; +import android.os.Build; +import android.os.Handler; +import android.os.Looper; +import android.util.DisplayMetrics; +import android.view.PixelCopy; +import android.view.SurfaceView; + +import androidx.annotation.RequiresApi; + +import com.instabug.flutter.model.ScreenshotResult; +import com.instabug.library.util.memory.MemoryUtils; + +import io.flutter.embedding.android.FlutterActivity; +import io.flutter.embedding.android.FlutterFragment; +import io.flutter.embedding.android.FlutterView; + +public class PixelCopyCaptureManager implements CaptureManager { + + @RequiresApi(api = Build.VERSION_CODES.N) + @Override + public void capture(Activity activity, ScreenshotResultCallback screenshotResultCallback) { + FlutterView flutterView = getFlutterView(activity); + if (flutterView == null || !isValidFlutterView(flutterView)) { + screenshotResultCallback.onError(); + return; + } + + SurfaceView surfaceView = (SurfaceView) flutterView.getChildAt(0); + Bitmap bitmap = createBitmapFromSurface(surfaceView); + + if (bitmap == null) { + screenshotResultCallback.onError(); + return; + } + + PixelCopy.request(surfaceView, bitmap, copyResult -> { + if (copyResult == PixelCopy.SUCCESS) { + DisplayMetrics displayMetrics = activity.getResources().getDisplayMetrics(); + screenshotResultCallback.onScreenshotResult(new ScreenshotResult(displayMetrics.density, bitmap)); + } else { + screenshotResultCallback.onError(); + } + }, new Handler(Looper.getMainLooper())); + } + + private FlutterView getFlutterView(Activity activity) { + FlutterView flutterViewInActivity = activity.findViewById(FlutterActivity.FLUTTER_VIEW_ID); + FlutterView flutterViewInFragment = activity.findViewById(FlutterFragment.FLUTTER_VIEW_ID); + return flutterViewInActivity != null ? flutterViewInActivity : flutterViewInFragment; + } + + private boolean isValidFlutterView(FlutterView flutterView) { + boolean hasChildren = flutterView.getChildCount() > 0; + boolean isSurfaceView = flutterView.getChildAt(0) instanceof SurfaceView; + return hasChildren && isSurfaceView; + } + + private Bitmap createBitmapFromSurface(SurfaceView surfaceView) { + int width = surfaceView.getWidth(); + int height = surfaceView.getHeight(); + + if (width <= 0 || height <= 0) { + return null; + } + Bitmap bitmap; + try { + if (((long) width * height * 4) < MemoryUtils.getFreeMemory(surfaceView.getContext())) { + // ARGB_8888 store each pixel in 4 bytes + bitmap = Bitmap.createBitmap(width, height, Bitmap.Config.ARGB_8888); + } else { + // RGB_565 store each pixel in 2 bytes + bitmap = Bitmap.createBitmap(width, height, Bitmap.Config.RGB_565); + } + + } catch (IllegalArgumentException | OutOfMemoryError e) { + bitmap = Bitmap.createBitmap(width, height, Bitmap.Config.RGB_565); + } + + + return bitmap; + } +} diff --git a/packages/instabug_flutter/android/src/main/java/com/instabug/flutter/modules/capturing/ScreenshotResultCallback.java b/packages/instabug_flutter/android/src/main/java/com/instabug/flutter/modules/capturing/ScreenshotResultCallback.java new file mode 100644 index 000000000..e01b9b95d --- /dev/null +++ b/packages/instabug_flutter/android/src/main/java/com/instabug/flutter/modules/capturing/ScreenshotResultCallback.java @@ -0,0 +1,9 @@ +package com.instabug.flutter.modules.capturing; + + +import com.instabug.flutter.model.ScreenshotResult; + +public interface ScreenshotResultCallback { + void onScreenshotResult(ScreenshotResult screenshotResult); + void onError(); +} diff --git a/android/src/main/java/com/instabug/flutter/util/ArgsRegistry.java b/packages/instabug_flutter/android/src/main/java/com/instabug/flutter/util/ArgsRegistry.java similarity index 91% rename from android/src/main/java/com/instabug/flutter/util/ArgsRegistry.java rename to packages/instabug_flutter/android/src/main/java/com/instabug/flutter/util/ArgsRegistry.java index 222a72836..db41068da 100644 --- a/android/src/main/java/com/instabug/flutter/util/ArgsRegistry.java +++ b/packages/instabug_flutter/android/src/main/java/com/instabug/flutter/util/ArgsRegistry.java @@ -9,6 +9,7 @@ import com.instabug.featuresrequest.ActionType; import com.instabug.library.InstabugColorTheme; import com.instabug.library.InstabugCustomTextPlaceHolder.Key; +import com.instabug.library.MaskingType; import com.instabug.library.OnSdkDismissCallback.DismissType; import com.instabug.library.ReproMode; import com.instabug.library.extendedbugreport.ExtendedBugReport; @@ -16,6 +17,7 @@ import com.instabug.library.invocation.InstabugInvocationEvent; import com.instabug.library.invocation.util.InstabugFloatingButtonEdge; import com.instabug.library.invocation.util.InstabugVideoRecordingButtonPosition; +import com.instabug.library.model.StepType; import com.instabug.library.ui.onboarding.WelcomeMessage; import java.util.HashMap; @@ -57,6 +59,14 @@ public T get(Object key) { put("ColorTheme.light", InstabugColorTheme.InstabugColorThemeLight); put("ColorTheme.dark", InstabugColorTheme.InstabugColorThemeDark); }}; + + public static final ArgsMap autoMasking = new ArgsMap() {{ + put("AutoMasking.labels", MaskingType.LABELS); + put("AutoMasking.textInputs", MaskingType.TEXT_INPUTS); + put("AutoMasking.media", MaskingType.MEDIA); + put("AutoMasking.none", MaskingType.MASK_NOTHING); + }}; + public static ArgsMap nonFatalExceptionLevel = new ArgsMap() {{ put("NonFatalExceptionLevel.critical", IBGNonFatalException.Level.CRITICAL); put("NonFatalExceptionLevel.error", IBGNonFatalException.Level.ERROR); @@ -75,6 +85,12 @@ public T get(Object key) { put("Position.bottomRight", InstabugVideoRecordingButtonPosition.BOTTOM_RIGHT); }}; + public static final ArgsMap userConsentActionType = new ArgsMap() {{ + put("UserConsentActionType.dropAutoCapturedMedia", com.instabug.bug.userConsent.ActionType.DROP_AUTO_CAPTURED_MEDIA); + put("UserConsentActionType.dropLogs", com.instabug.bug.userConsent.ActionType.DROP_LOGS); + put("UserConsentActionType.noChat", com.instabug.bug.userConsent.ActionType.NO_CHAT); + }}; + public static ArgsMap welcomeMessageStates = new ArgsMap() {{ put("WelcomeMessageMode.live", WelcomeMessage.State.LIVE); put("WelcomeMessageMode.beta", WelcomeMessage.State.BETA); @@ -206,4 +222,13 @@ public T get(Object key) { put("CustomTextPlaceHolderKey.messagesNotificationAndOthers", Key.CHATS_MULTIPLE_MESSAGE_NOTIFICATION); put("CustomTextPlaceHolderKey.insufficientContentMessage", Key.COMMENT_FIELD_INSUFFICIENT_CONTENT); }}; + + public static final ArgsMap gestureStepType = new ArgsMap() {{ + put("GestureType.swipe", StepType.SWIPE); + put("GestureType.scroll", StepType.SCROLL); + put("GestureType.tap", StepType.TAP); + put("GestureType.pinch", StepType.PINCH); + put("GestureType.longPress", StepType.LONG_PRESS); + put("GestureType.doubleTap", StepType.DOUBLE_TAP); + }}; } diff --git a/android/src/main/java/com/instabug/flutter/util/Reflection.java b/packages/instabug_flutter/android/src/main/java/com/instabug/flutter/util/Reflection.java similarity index 100% rename from android/src/main/java/com/instabug/flutter/util/Reflection.java rename to packages/instabug_flutter/android/src/main/java/com/instabug/flutter/util/Reflection.java diff --git a/android/src/main/java/com/instabug/flutter/util/ThreadManager.java b/packages/instabug_flutter/android/src/main/java/com/instabug/flutter/util/ThreadManager.java similarity index 100% rename from android/src/main/java/com/instabug/flutter/util/ThreadManager.java rename to packages/instabug_flutter/android/src/main/java/com/instabug/flutter/util/ThreadManager.java diff --git a/packages/instabug_flutter/android/src/main/java/com/instabug/flutter/util/privateViews/ScreenshotCaptor.java b/packages/instabug_flutter/android/src/main/java/com/instabug/flutter/util/privateViews/ScreenshotCaptor.java new file mode 100644 index 000000000..86eb40007 --- /dev/null +++ b/packages/instabug_flutter/android/src/main/java/com/instabug/flutter/util/privateViews/ScreenshotCaptor.java @@ -0,0 +1,13 @@ +package com.instabug.flutter.util.privateViews; + +import android.graphics.Bitmap; + +public interface ScreenshotCaptor { + public void capture(CapturingCallback listener); + + public interface CapturingCallback { + public void onCapturingFailure(Throwable throwable); + + public void onCapturingSuccess(Bitmap bitmap); + } +} \ No newline at end of file diff --git a/android/src/test/java/com/instabug/flutter/ApmApiTest.java b/packages/instabug_flutter/android/src/test/java/com/instabug/flutter/ApmApiTest.java similarity index 85% rename from android/src/test/java/com/instabug/flutter/ApmApiTest.java rename to packages/instabug_flutter/android/src/test/java/com/instabug/flutter/ApmApiTest.java index 935521466..39728c20c 100644 --- a/android/src/test/java/com/instabug/flutter/ApmApiTest.java +++ b/packages/instabug_flutter/android/src/test/java/com/instabug/flutter/ApmApiTest.java @@ -1,10 +1,22 @@ package com.instabug.flutter; +import static com.instabug.flutter.util.GlobalMocks.reflected; +import static com.instabug.flutter.util.MockResult.makeResult; +import static org.junit.Assert.assertEquals; +import static org.mockito.ArgumentMatchers.any; +import static org.mockito.ArgumentMatchers.anyInt; +import static org.mockito.ArgumentMatchers.anyString; +import static org.mockito.ArgumentMatchers.eq; +import static org.mockito.Mockito.mock; +import static org.mockito.Mockito.mockConstruction; +import static org.mockito.Mockito.mockStatic; +import static org.mockito.Mockito.verify; +import static org.mockito.Mockito.when; + import com.instabug.apm.APM; import com.instabug.apm.InternalAPM; import com.instabug.apm.configuration.cp.APMFeature; import com.instabug.apm.configuration.cp.FeatureAvailabilityCallback; -import com.instabug.apm.model.ExecutionTrace; import com.instabug.apm.networking.APMNetworkLogger; import com.instabug.flutter.generated.ApmPigeon; import com.instabug.flutter.modules.ApmApi; @@ -55,16 +67,6 @@ public void cleanUp() { GlobalMocks.close(); } - private ExecutionTrace mockTrace(String id) { - String name = "trace-name"; - ExecutionTrace mTrace = mock(ExecutionTrace.class); - - mAPM.when(() -> APM.startExecutionTrace(name)).thenReturn(mTrace); - - api.startExecutionTrace(id, name, makeResult()); - - return mTrace; - } @Test public void testInit() { @@ -102,53 +104,7 @@ public void testSetAutoUITraceEnabled() { mAPM.verify(() -> APM.setAutoUITraceEnabled(isEnabled)); } - @Test - public void testStartExecutionTraceWhenTraceNotNull() { - String expectedId = "trace-id"; - String name = "trace-name"; - ApmPigeon.Result result = makeResult((String actualId) -> assertEquals(expectedId, actualId)); - - mAPM.when(() -> APM.startExecutionTrace(name)).thenReturn(new ExecutionTrace(name)); - - api.startExecutionTrace(expectedId, name, result); - - mAPM.verify(() -> APM.startExecutionTrace(name)); - } - - @Test - public void testStartExecutionTraceWhenTraceIsNull() { - String id = "trace-id"; - String name = "trace-name"; - ApmPigeon.Result result = makeResult(Assert::assertNull); - - mAPM.when(() -> APM.startExecutionTrace(name)).thenReturn(null); - - api.startExecutionTrace(id, name, result); - - mAPM.verify(() -> APM.startExecutionTrace(name)); - } - - @Test - public void testSetExecutionTraceAttribute() { - String id = "trace-id"; - String key = "is_premium"; - String value = "true"; - ExecutionTrace mTrace = mockTrace(id); - api.setExecutionTraceAttribute(id, key, value); - - verify(mTrace).setAttribute(key, value); - } - - @Test - public void testEndExecutionTrace() { - String id = "trace-id"; - ExecutionTrace mTrace = mockTrace(id); - - api.endExecutionTrace(id); - - verify(mTrace).end(); - } @Test public void testStartFlow() { diff --git a/android/src/test/java/com/instabug/flutter/ArgsRegistryTest.java b/packages/instabug_flutter/android/src/test/java/com/instabug/flutter/ArgsRegistryTest.java similarity index 100% rename from android/src/test/java/com/instabug/flutter/ArgsRegistryTest.java rename to packages/instabug_flutter/android/src/test/java/com/instabug/flutter/ArgsRegistryTest.java diff --git a/android/src/test/java/com/instabug/flutter/BugReportingApiTest.java b/packages/instabug_flutter/android/src/test/java/com/instabug/flutter/BugReportingApiTest.java similarity index 90% rename from android/src/test/java/com/instabug/flutter/BugReportingApiTest.java rename to packages/instabug_flutter/android/src/test/java/com/instabug/flutter/BugReportingApiTest.java index 683b5f49a..50722762f 100644 --- a/android/src/test/java/com/instabug/flutter/BugReportingApiTest.java +++ b/packages/instabug_flutter/android/src/test/java/com/instabug/flutter/BugReportingApiTest.java @@ -27,7 +27,7 @@ import java.util.List; import io.flutter.plugin.common.BinaryMessenger; - +import com.instabug.bug.userConsent.ActionType; public class BugReportingApiTest { private final BinaryMessenger mMessenger = mock(BinaryMessenger.class); @@ -192,6 +192,21 @@ public void testSetCommentMinimumCharacterCount() { api.setCommentMinimumCharacterCount(limit, reportTypes); - mBugReporting.verify(() -> BugReporting.setCommentMinimumCharacterCount(limit.intValue(), BugReporting.ReportType.BUG, BugReporting.ReportType.QUESTION)); + mBugReporting.verify(() -> BugReporting.setCommentMinimumCharacterCountForBugReportType(limit.intValue(), BugReporting.ReportType.BUG, BugReporting.ReportType.QUESTION)); + } + + @Test + public void TestAddUserConsents() { + + final String key = "testKey"; + final String description = "Consent description"; + final boolean mandatory = true; + final boolean checked = true; + final String actionType = "UserConsentActionType.dropAutoCapturedMedia"; + + + api.addUserConsents(key, description, mandatory, checked, actionType); + + mBugReporting.verify(()->BugReporting.addUserConsent(key, description, mandatory, checked,"drop_auto_captured_media")); } } diff --git a/android/src/test/java/com/instabug/flutter/CrashReportingApiTest.java b/packages/instabug_flutter/android/src/test/java/com/instabug/flutter/CrashReportingApiTest.java similarity index 100% rename from android/src/test/java/com/instabug/flutter/CrashReportingApiTest.java rename to packages/instabug_flutter/android/src/test/java/com/instabug/flutter/CrashReportingApiTest.java diff --git a/android/src/test/java/com/instabug/flutter/FeatureRequestsApiTest.java b/packages/instabug_flutter/android/src/test/java/com/instabug/flutter/FeatureRequestsApiTest.java similarity index 100% rename from android/src/test/java/com/instabug/flutter/FeatureRequestsApiTest.java rename to packages/instabug_flutter/android/src/test/java/com/instabug/flutter/FeatureRequestsApiTest.java diff --git a/android/src/test/java/com/instabug/flutter/InstabugApiTest.java b/packages/instabug_flutter/android/src/test/java/com/instabug/flutter/InstabugApiTest.java similarity index 67% rename from android/src/test/java/com/instabug/flutter/InstabugApiTest.java rename to packages/instabug_flutter/android/src/test/java/com/instabug/flutter/InstabugApiTest.java index 2abb8987e..23e2e3242 100644 --- a/android/src/test/java/com/instabug/flutter/InstabugApiTest.java +++ b/packages/instabug_flutter/android/src/test/java/com/instabug/flutter/InstabugApiTest.java @@ -6,8 +6,10 @@ import static org.junit.Assert.assertTrue; import static org.mockito.ArgumentMatchers.any; import static org.mockito.ArgumentMatchers.anyInt; +import static org.mockito.ArgumentMatchers.anyLong; import static org.mockito.ArgumentMatchers.anyString; import static org.mockito.ArgumentMatchers.eq; +import static org.mockito.ArgumentMatchers.isNull; import static org.mockito.Mockito.doReturn; import static org.mockito.Mockito.mock; import static org.mockito.Mockito.mockConstruction; @@ -17,13 +19,20 @@ import static org.mockito.Mockito.verify; import static org.mockito.Mockito.when; +import static io.mockk.MockKKt.every; +import static io.mockk.MockKKt.mockkObject; + +import io.mockk.*; + import android.app.Application; import android.graphics.Bitmap; import android.net.Uri; +import com.instabug.apm.InternalAPM; import com.instabug.bug.BugReporting; import com.instabug.flutter.generated.InstabugPigeon; import com.instabug.flutter.modules.InstabugApi; +import com.instabug.flutter.util.ArgsRegistry; import com.instabug.flutter.util.GlobalMocks; import com.instabug.flutter.util.MockReflected; import com.instabug.library.Feature; @@ -32,13 +41,22 @@ import com.instabug.library.InstabugCustomTextPlaceHolder; import com.instabug.library.IssueType; import com.instabug.library.LogLevel; +import com.instabug.library.MaskingType; import com.instabug.library.Platform; import com.instabug.library.ReproConfigurations; import com.instabug.library.ReproMode; import com.instabug.library.featuresflags.model.IBGFeatureFlag; +import com.instabug.library.internal.crossplatform.CoreFeature; +import com.instabug.library.internal.crossplatform.FeaturesStateListener; +import com.instabug.library.internal.crossplatform.InternalCore; +import com.instabug.library.featuresflags.model.IBGFeatureFlag; +import com.instabug.library.internal.crossplatform.InternalCore; import com.instabug.library.invocation.InstabugInvocationEvent; import com.instabug.library.model.NetworkLog; +import com.instabug.library.screenshot.ScreenshotCaptor; import com.instabug.library.ui.onboarding.WelcomeMessage; +import com.instabug.survey.Surveys; +import com.instabug.survey.callbacks.OnShowCallback; import org.json.JSONObject; import org.junit.After; @@ -56,11 +74,21 @@ import java.util.List; import java.util.Locale; import java.util.Map; +import java.util.Random; import java.util.concurrent.Callable; import io.flutter.plugin.common.BinaryMessenger; + +import kotlin.jvm.functions.Function1; + +import org.mockito.Mockito; +import org.mockito.invocation.InvocationOnMock; +import org.mockito.stubbing.Answer; +import org.mockito.verification.VerificationMode; import org.mockito.verification.VerificationMode; +import android.graphics.Typeface; + public class InstabugApiTest { private final Callable screenshotProvider = () -> mock(Bitmap.class); private final Application mContext = mock(Application.class); @@ -69,11 +97,15 @@ public class InstabugApiTest { private MockedStatic mBugReporting; private MockedConstruction mCustomTextPlaceHolder; private MockedStatic mHostApi; - + private InternalCore internalCore; @Before public void setUp() throws NoSuchMethodException { mCustomTextPlaceHolder = mockConstruction(InstabugCustomTextPlaceHolder.class); - api = spy(new InstabugApi(mContext, screenshotProvider)); + internalCore=spy(InternalCore.INSTANCE); + + BinaryMessenger mMessenger = mock(BinaryMessenger.class); + final InstabugPigeon.FeatureFlagsFlutterApi flutterApi = new InstabugPigeon.FeatureFlagsFlutterApi(mMessenger); + api = spy(new InstabugApi(mContext, screenshotProvider, flutterApi)); mInstabug = mockStatic(Instabug.class); mBugReporting = mockStatic(BugReporting.class); mHostApi = mockStatic(InstabugPigeon.InstabugHostApi.class); @@ -87,6 +119,7 @@ public void cleanUp() { mBugReporting.close(); mHostApi.close(); GlobalMocks.close(); + } @Test @@ -108,6 +141,8 @@ public void testSetCurrentPlatform() { @Test public void testSdkInit() { String token = "app-token"; + String appVariant = "app-variant"; + List invocationEvents = Collections.singletonList("InvocationEvent.floatingButton"); String logLevel = "LogLevel.error"; @@ -119,7 +154,7 @@ public void testSdkInit() { when(mock.setSdkDebugLogsLevel(anyInt())).thenReturn(mock); }); - api.init(token, invocationEvents, logLevel); + api.init(token, invocationEvents, logLevel,appVariant); Instabug.Builder builder = mInstabugBuilder.constructed().get(0); @@ -131,6 +166,8 @@ public void testSdkInit() { ); verify(builder).setInvocationEvents(InstabugInvocationEvent.FLOATING_BUTTON); verify(builder).setSdkDebugLogsLevel(LogLevel.ERROR); + verify(builder).setAppVariant(appVariant); + verify(builder).build(); // Sets screenshot provider @@ -252,13 +289,7 @@ public void testSetWelcomeMessageMode() { @Test public void testSetPrimaryColor() { - Long color = 0xFF0000L; - - api.setPrimaryColor(color); - - mInstabug.verify(() -> Instabug.setPrimaryColor(0xFF0000)); } - @Test public void testSetSessionProfilerEnabledGivenTrue() { Boolean isEnabled = true; @@ -322,38 +353,15 @@ public void testGetTags() { mInstabug.verify(Instabug::getTags); } - @Test - public void testAddExperiments() { - List experiments = Arrays.asList("premium", "star"); - - api.addExperiments(experiments); - - mInstabug.verify(() -> Instabug.addExperiments(experiments)); - } - - @Test - public void testRemoveExperiments() { - List experiments = Arrays.asList("premium", "star"); - - api.removeExperiments(experiments); - mInstabug.verify(() -> Instabug.removeExperiments(experiments)); - } - - @Test - public void testClearAllExperiments() { - api.clearAllExperiments(); - - mInstabug.verify(Instabug::clearAllExperiments); - } @Test public void testAddFeatureFlags() { - Map featureFlags = new HashMap<>(); - featureFlags.put("key1","variant1"); + Map featureFlags = new HashMap<>(); + featureFlags.put("key1", "variant1"); api.addFeatureFlags(featureFlags); - List flags=new ArrayList(); - flags.add(new IBGFeatureFlag("key1","variant1")); + List flags = new ArrayList(); + flags.add(new IBGFeatureFlag("key1", "variant1")); mInstabug.verify(() -> Instabug.addFeatureFlags(flags)); } @@ -436,7 +444,7 @@ public void testSetReproStepsConfig() { ReproConfigurations.Builder builder = mReproConfigurationsBuilder.constructed().get(0); verify(builder).setIssueMode(IssueType.Bug, ReproMode.EnableWithScreenshots); - verify(builder).setIssueMode(IssueType.Crash, ReproMode.Disable); + verify(builder).setIssueMode(IssueType.AllCrashes, ReproMode.Disable); verify(builder).setIssueMode(IssueType.SessionReplay, ReproMode.Disable); verify(builder).build(); @@ -450,6 +458,7 @@ public void testReportScreenChange() { api.reportScreenChange(screenName); reflected.verify(() -> MockReflected.reportScreenChange(null, screenName)); + reflected.verify(() -> MockReflected.reportCurrentViewChange(screenName)); } @Test @@ -598,4 +607,165 @@ public void testWillRedirectToStore() { api.willRedirectToStore(); mInstabug.verify(Instabug::willRedirectToStore); } + + + @Test + public void isW3CFeatureFlagsEnabled() { + mockkObject(new InternalCore[]{InternalCore.INSTANCE},false); + Random random=new Random(); + Boolean isW3cExternalGeneratedHeaderEnabled = random.nextBoolean(); + Boolean isW3cExternalTraceIDEnabled = random.nextBoolean(); + Boolean isW3cCaughtHeaderEnabled = random.nextBoolean(); + + every((Function1) mockKMatcherScope -> InternalCore.INSTANCE._isFeatureEnabled(CoreFeature.W3C_ATTACHING_GENERATED_HEADER)).returns(isW3cExternalGeneratedHeaderEnabled); + every((Function1) mockKMatcherScope -> InternalCore.INSTANCE._isFeatureEnabled(CoreFeature.W3C_EXTERNAL_TRACE_ID)).returns(isW3cExternalTraceIDEnabled); + every((Function1) mockKMatcherScope -> InternalCore.INSTANCE._isFeatureEnabled(CoreFeature.W3C_ATTACHING_CAPTURED_HEADER)).returns(isW3cCaughtHeaderEnabled); + + + Map flags = api.isW3CFeatureFlagsEnabled(); + assertEquals(isW3cExternalGeneratedHeaderEnabled, flags.get("isW3cExternalGeneratedHeaderEnabled")); + assertEquals(isW3cExternalTraceIDEnabled, flags.get("isW3cExternalTraceIDEnabled")); + assertEquals(isW3cCaughtHeaderEnabled, flags.get("isW3cCaughtHeaderEnabled")); + + } + + @Test + public void testSetNetworkLogBodyEnabled() { + api.setNetworkLogBodyEnabled(true); + + mInstabug.verify(() -> Instabug.setNetworkLogBodyEnabled(true)); + } + + @Test + public void testSetAppVariant() { + String appVariant = "app-variant"; + api.setAppVariant(appVariant); + + mInstabug.verify(() -> Instabug.setAppVariant(appVariant)); + } + + @Test + public void testSetNetworkLogBodyDisabled() { + api.setNetworkLogBodyEnabled(false); + + mInstabug.verify(() -> Instabug.setNetworkLogBodyEnabled(false)); + } + + @Test + public void testSetThemeWithAllProperties() { + Map themeConfig = new HashMap<>(); + themeConfig.put("primaryColor", "#FF6B6B"); + themeConfig.put("backgroundColor", "#FFFFFF"); + themeConfig.put("titleTextColor", "#000000"); + themeConfig.put("primaryTextColor", "#333333"); + themeConfig.put("secondaryTextColor", "#666666"); + themeConfig.put("primaryTextStyle", "bold"); + themeConfig.put("secondaryTextStyle", "italic"); + themeConfig.put("ctaTextStyle", "bold_italic"); + themeConfig.put("primaryFontAsset", "assets/fonts/CustomFont-Regular.ttf"); + themeConfig.put("secondaryFontAsset", "assets/fonts/CustomFont-Bold.ttf"); + themeConfig.put("ctaFontAsset", "assets/fonts/CustomFont-Italic.ttf"); + + MockedConstruction mThemeBuilder = + mockConstruction(com.instabug.library.model.IBGTheme.Builder.class, (mock, context) -> { + when(mock.setPrimaryColor(anyInt())).thenReturn(mock); + when(mock.setBackgroundColor(anyInt())).thenReturn(mock); + when(mock.setTitleTextColor(anyInt())).thenReturn(mock); + when(mock.setPrimaryTextColor(anyInt())).thenReturn(mock); + when(mock.setSecondaryTextColor(anyInt())).thenReturn(mock); + when(mock.setPrimaryTextStyle(anyInt())).thenReturn(mock); + when(mock.setSecondaryTextStyle(anyInt())).thenReturn(mock); + when(mock.setCtaTextStyle(anyInt())).thenReturn(mock); + when(mock.setPrimaryTextFont(any(Typeface.class))).thenReturn(mock); + when(mock.setSecondaryTextFont(any(Typeface.class))).thenReturn(mock); + when(mock.setCtaTextFont(any(Typeface.class))).thenReturn(mock); + when(mock.build()).thenReturn(mock(com.instabug.library.model.IBGTheme.class)); + }); + + api.setTheme(themeConfig); + + com.instabug.library.model.IBGTheme.Builder builder = mThemeBuilder.constructed().get(0); + + verify(builder).setPrimaryColor(anyInt()); + verify(builder).setBackgroundColor(anyInt()); + verify(builder).setTitleTextColor(anyInt()); + verify(builder).setPrimaryTextColor(anyInt()); + verify(builder).setSecondaryTextColor(anyInt()); + verify(builder).setPrimaryTextStyle(Typeface.BOLD); + verify(builder).setSecondaryTextStyle(Typeface.ITALIC); + verify(builder).setCtaTextStyle(Typeface.BOLD_ITALIC); + + mInstabug.verify(() -> Instabug.setTheme(any(com.instabug.library.model.IBGTheme.class))); + } + + @Test + public void testSetFullscreen() { + boolean isEnabled = true; + + api.setFullscreen(isEnabled); + + mInstabug.verify(() -> Instabug.setFullscreen(isEnabled)); + } + + @Test + public void testSetFullscreenDisabled() { + boolean isEnabled = false; + + api.setFullscreen(isEnabled); + + mInstabug.verify(() -> Instabug.setFullscreen(isEnabled)); + } + + @Test + public void testSetScreenshotCaptor() { + InternalCore internalCore = spy(InternalCore.INSTANCE); + + InstabugApi.setScreenshotCaptor(any(), internalCore); + verify(internalCore)._setScreenshotCaptor(any(ScreenshotCaptor.class)); + } + + @Test + public void testSetUserStepsEnabledGivenTrue() { + boolean isEnabled = true; + + api.setEnableUserSteps(isEnabled); + + mInstabug.verify(() -> Instabug.setTrackingUserStepsState(Feature.State.ENABLED)); + } + + @Test + public void testSetUserStepsEnabledGivenFalse() { + boolean isEnabled = false; + + api.setEnableUserSteps(isEnabled); + + mInstabug.verify(() -> Instabug.setTrackingUserStepsState(Feature.State.DISABLED)); + } + + @Test + public void testLogUserSteps() { + + final String gestureType = "GestureType.tap"; + final String message = "message"; + final String view = "view"; + + api.logUserSteps(gestureType, message,view); + + reflected.verify(() -> MockReflected.addUserStep(anyLong(), eq(ArgsRegistry.gestureStepType.get(gestureType)), eq(message), isNull(), eq(view))); + + } + + @Test + public void testAutoMasking() { + String maskLabel = "AutoMasking.labels"; + String maskTextInputs = "AutoMasking.textInputs"; + String maskMedia = "AutoMasking.media"; + String maskNone = "AutoMasking.none"; + + + api.enableAutoMasking(List.of(maskLabel, maskMedia, maskTextInputs,maskNone)); + + mInstabug.verify(() -> Instabug.setAutoMaskScreenshotsTypes(MaskingType.LABELS,MaskingType.MEDIA,MaskingType.TEXT_INPUTS,MaskingType.MASK_NOTHING)); + } + } diff --git a/android/src/test/java/com/instabug/flutter/InstabugLogApiTest.java b/packages/instabug_flutter/android/src/test/java/com/instabug/flutter/InstabugLogApiTest.java similarity index 100% rename from android/src/test/java/com/instabug/flutter/InstabugLogApiTest.java rename to packages/instabug_flutter/android/src/test/java/com/instabug/flutter/InstabugLogApiTest.java diff --git a/android/src/test/java/com/instabug/flutter/RepliesApiTest.java b/packages/instabug_flutter/android/src/test/java/com/instabug/flutter/RepliesApiTest.java similarity index 100% rename from android/src/test/java/com/instabug/flutter/RepliesApiTest.java rename to packages/instabug_flutter/android/src/test/java/com/instabug/flutter/RepliesApiTest.java diff --git a/android/src/test/java/com/instabug/flutter/SessionReplayApiTest.java b/packages/instabug_flutter/android/src/test/java/com/instabug/flutter/SessionReplayApiTest.java similarity index 100% rename from android/src/test/java/com/instabug/flutter/SessionReplayApiTest.java rename to packages/instabug_flutter/android/src/test/java/com/instabug/flutter/SessionReplayApiTest.java diff --git a/android/src/test/java/com/instabug/flutter/SurveysApiTest.java b/packages/instabug_flutter/android/src/test/java/com/instabug/flutter/SurveysApiTest.java similarity index 100% rename from android/src/test/java/com/instabug/flutter/SurveysApiTest.java rename to packages/instabug_flutter/android/src/test/java/com/instabug/flutter/SurveysApiTest.java diff --git a/android/src/test/java/com/instabug/flutter/util/Callback.java b/packages/instabug_flutter/android/src/test/java/com/instabug/flutter/util/Callback.java similarity index 100% rename from android/src/test/java/com/instabug/flutter/util/Callback.java rename to packages/instabug_flutter/android/src/test/java/com/instabug/flutter/util/Callback.java diff --git a/android/src/test/java/com/instabug/flutter/util/GlobalMocks.java b/packages/instabug_flutter/android/src/test/java/com/instabug/flutter/util/GlobalMocks.java similarity index 87% rename from android/src/test/java/com/instabug/flutter/util/GlobalMocks.java rename to packages/instabug_flutter/android/src/test/java/com/instabug/flutter/util/GlobalMocks.java index 0795acf77..797921341 100644 --- a/android/src/test/java/com/instabug/flutter/util/GlobalMocks.java +++ b/packages/instabug_flutter/android/src/test/java/com/instabug/flutter/util/GlobalMocks.java @@ -57,6 +57,13 @@ public static void setUp() throws NoSuchMethodException { Bitmap.class, String.class)) .thenReturn(mReportScreenChange); + Method mReportCurrentViewChange= MockReflected.class.getDeclaredMethod("reportCurrentViewChange", String.class); + mReportCurrentViewChange.setAccessible(true); + reflection + .when(() -> Reflection.getMethod(Class.forName("com.instabug.library.Instabug"), "reportCurrentViewChange", + String.class)) + .thenReturn(mReportCurrentViewChange); + Method mSetCustomBrandingImage = MockReflected.class.getDeclaredMethod("setCustomBrandingImage", Bitmap.class, Bitmap.class); mSetCustomBrandingImage.setAccessible(true); reflection @@ -106,6 +113,14 @@ public static void setUp() throws NoSuchMethodException { Method mEndScreenLoadingCP = MockReflected.class.getDeclaredMethod("endScreenLoadingCP", Long.class, Long.class); mEndScreenLoadingCP.setAccessible(true); reflection.when(() -> Reflection.getMethod(Class.forName("com.instabug.apm.APM"), "endScreenLoadingCP", Long.class, Long.class)).thenReturn(mEndScreenLoadingCP); + + + Method mAddUserStepCp = MockReflected.class.getDeclaredMethod("addUserStep", + long.class, String.class, String.class, String.class, String.class); + mAddUserStepCp.setAccessible(true); + reflection.when(() -> Reflection.getMethod(Class.forName("com.instabug.library.Instabug"), "addUserStep", + long.class, String.class, String.class, String.class, String.class)).thenReturn(mAddUserStepCp);; + } public static void close() { diff --git a/android/src/test/java/com/instabug/flutter/util/MockReflected.java b/packages/instabug_flutter/android/src/test/java/com/instabug/flutter/util/MockReflected.java similarity index 88% rename from android/src/test/java/com/instabug/flutter/util/MockReflected.java rename to packages/instabug_flutter/android/src/test/java/com/instabug/flutter/util/MockReflected.java index 42c85664b..09c07f21a 100644 --- a/android/src/test/java/com/instabug/flutter/util/MockReflected.java +++ b/packages/instabug_flutter/android/src/test/java/com/instabug/flutter/util/MockReflected.java @@ -21,6 +21,11 @@ public class MockReflected { */ public static void reportScreenChange(Bitmap screenshot, String name) {} + /** + * Instabug.reportCurrentViewChange + */ + public static void reportCurrentViewChange(String name) {} + /** * Instabug.setCustomBrandingImage */ @@ -48,4 +53,6 @@ public static void startUiTraceCP(String screenName, Long microTimeStamp, Long t public static void reportScreenLoadingCP(Long startTimeStampMicro, Long durationMicro, Long uiTraceId) {} public static void endScreenLoadingCP(Long timeStampMicro, Long uiTraceId) {} + public static void addUserStep(long timestamp, @StepType String stepType, String message, String label, String viewType) { + } } diff --git a/android/src/test/java/com/instabug/flutter/util/MockResult.java b/packages/instabug_flutter/android/src/test/java/com/instabug/flutter/util/MockResult.java similarity index 100% rename from android/src/test/java/com/instabug/flutter/util/MockResult.java rename to packages/instabug_flutter/android/src/test/java/com/instabug/flutter/util/MockResult.java diff --git a/packages/instabug_flutter/android/src/test/java/com/instabug/flutter/util/private_views/BoundryScreenshotCaptorTest.java b/packages/instabug_flutter/android/src/test/java/com/instabug/flutter/util/private_views/BoundryScreenshotCaptorTest.java new file mode 100644 index 000000000..a555345e0 --- /dev/null +++ b/packages/instabug_flutter/android/src/test/java/com/instabug/flutter/util/private_views/BoundryScreenshotCaptorTest.java @@ -0,0 +1,77 @@ +package com.instabug.flutter.util.private_views; + +import static org.mockito.ArgumentMatchers.any; +import static org.mockito.ArgumentMatchers.argThat; +import static org.mockito.Mockito.mock; +import static org.mockito.Mockito.never; +import static org.mockito.Mockito.spy; +import static org.mockito.Mockito.verify; +import static org.mockito.Mockito.when; +import static org.robolectric.Shadows.shadowOf; + +import android.app.Activity; +import android.graphics.Bitmap; +import android.os.Looper; + +import com.instabug.flutter.model.ScreenshotResult; +import com.instabug.flutter.modules.capturing.BoundryCaptureManager; +import com.instabug.flutter.modules.capturing.CaptureManager; +import com.instabug.flutter.modules.capturing.ScreenshotResultCallback; + +import org.junit.Before; +import org.junit.Test; +import org.junit.runner.RunWith; +import org.mockito.ArgumentMatcher; +import org.robolectric.Robolectric; +import org.robolectric.RobolectricTestRunner; +import org.robolectric.annotation.Config; + +import io.flutter.embedding.engine.renderer.FlutterRenderer; + +@RunWith(RobolectricTestRunner.class) +@Config(sdk = {28}, manifest = Config.NONE) +public class BoundryScreenshotCaptorTest { + private Activity activityMock; + private Bitmap bitmap; + private CaptureManager captureManager; + + @Before + public void setUp() { + FlutterRenderer rendererMock = mock(FlutterRenderer.class); + activityMock = spy(Robolectric.buildActivity(Activity.class).setup().create().start().resume().get()); + bitmap = Bitmap.createBitmap(200, 200, Bitmap.Config.ARGB_8888); + when(rendererMock.getBitmap()).thenReturn(bitmap); + captureManager = new BoundryCaptureManager(rendererMock); + } + + @Test + public void testCaptureGivenEmptyActivity() { + ScreenshotResultCallback mockCallback = mock(ScreenshotResultCallback.class); + + captureManager.capture(null, mockCallback); + shadowOf(Looper.getMainLooper()).idle(); + + verify(mockCallback).onError(); + verify(mockCallback, never()).onScreenshotResult(any(ScreenshotResult.class)); + + } + + @Test + public void testCapture() { + ScreenshotResultCallback mockCallback = mock(ScreenshotResultCallback.class); + captureManager.capture(activityMock, mockCallback); + shadowOf(Looper.getMainLooper()).idle(); + + verify(mockCallback, never()).onError(); + verify(mockCallback).onScreenshotResult(argThat(new ArgumentMatcher() { + @Override + public boolean matches(ScreenshotResult argument) { + return (Math.abs(activityMock.getResources().getDisplayMetrics().density - argument.getPixelRatio()) < 0.01)&& + bitmap == argument.getScreenshot(); + + } + })); + } + + +} diff --git a/packages/instabug_flutter/android/src/test/java/com/instabug/flutter/util/private_views/PixelCopyScreenshotCaptorTest.java b/packages/instabug_flutter/android/src/test/java/com/instabug/flutter/util/private_views/PixelCopyScreenshotCaptorTest.java new file mode 100644 index 000000000..868712312 --- /dev/null +++ b/packages/instabug_flutter/android/src/test/java/com/instabug/flutter/util/private_views/PixelCopyScreenshotCaptorTest.java @@ -0,0 +1,91 @@ +package com.instabug.flutter.util.private_views; + +import static org.mockito.ArgumentMatchers.any; +import static org.mockito.Mockito.mock; +import static org.mockito.Mockito.mockStatic; +import static org.mockito.Mockito.spy; +import static org.mockito.Mockito.timeout; +import static org.mockito.Mockito.verify; +import static org.mockito.Mockito.when; +import static org.robolectric.Shadows.shadowOf; + +import android.app.Activity; +import android.graphics.Bitmap; +import android.os.Looper; +import android.view.SurfaceView; + +import com.instabug.flutter.model.ScreenshotResult; +import com.instabug.flutter.modules.capturing.CaptureManager; +import com.instabug.flutter.modules.capturing.PixelCopyCaptureManager; +import com.instabug.flutter.modules.capturing.ScreenshotResultCallback; +import com.instabug.library.util.memory.MemoryUtils; + +import org.junit.Before; +import org.junit.Test; +import org.junit.runner.RunWith; +import org.mockito.MockedStatic; +import org.robolectric.Robolectric; +import org.robolectric.RobolectricTestRunner; +import org.robolectric.annotation.Config; + +import io.flutter.embedding.android.FlutterActivity; +import io.flutter.embedding.android.FlutterView; +import io.flutter.embedding.engine.renderer.FlutterRenderer; + +@RunWith(RobolectricTestRunner.class) +@Config(sdk = {28}, manifest = Config.NONE) +public class PixelCopyScreenshotCaptorTest { + private Activity activityMock; + private Bitmap bitmap; + private CaptureManager captureManager; + + @Before + public void setUp() { + FlutterRenderer rendererMock = mock(FlutterRenderer.class); + activityMock = spy(Robolectric.buildActivity(Activity.class).setup().create().start().resume().get()); + bitmap = Bitmap.createBitmap(200, 200, Bitmap.Config.ARGB_8888); + when(rendererMock.getBitmap()).thenReturn(bitmap); + captureManager = new PixelCopyCaptureManager(); + } + + @Test + public void testCaptureWithPixelCopyGivenEmptyView() { + + ScreenshotResultCallback mockScreenshotResultCallback = mock(ScreenshotResultCallback.class); + when(activityMock.findViewById(FlutterActivity.FLUTTER_VIEW_ID)).thenReturn(null); + captureManager.capture(activityMock,mockScreenshotResultCallback); + + verify(mockScreenshotResultCallback).onError(); + } + + @Test + public void testCaptureWithPixelCopy() { + try (MockedStatic mockedStatic = mockStatic(MemoryUtils.class)) { + mockedStatic.when(() -> MemoryUtils.getFreeMemory(any())).thenReturn(Long.MAX_VALUE); + + mockFlutterViewInPixelCopy(); + + ScreenshotResultCallback mockScreenshotResultCallback = mock(ScreenshotResultCallback.class); + + + captureManager.capture(activityMock, mockScreenshotResultCallback); + shadowOf(Looper.getMainLooper()).idle(); + + verify(mockScreenshotResultCallback, timeout(1000)).onScreenshotResult(any(ScreenshotResult.class)); // PixelCopy success + + } + } + + + private void mockFlutterViewInPixelCopy() { + + SurfaceView mockSurfaceView = mock(SurfaceView.class); + FlutterView flutterView = mock(FlutterView.class); + when(flutterView.getChildAt(0)).thenReturn(mockSurfaceView); + when(flutterView.getChildCount()).thenReturn(1); + + when(activityMock.findViewById(FlutterActivity.FLUTTER_VIEW_ID)).thenReturn(flutterView); + when(mockSurfaceView.getWidth()).thenReturn(100); + when(mockSurfaceView.getHeight()).thenReturn(100); + } +} diff --git a/packages/instabug_flutter/android/src/test/java/com/instabug/flutter/util/private_views/PrivateViewManagerTest.java b/packages/instabug_flutter/android/src/test/java/com/instabug/flutter/util/private_views/PrivateViewManagerTest.java new file mode 100644 index 000000000..a996fb8a2 --- /dev/null +++ b/packages/instabug_flutter/android/src/test/java/com/instabug/flutter/util/private_views/PrivateViewManagerTest.java @@ -0,0 +1,146 @@ +package com.instabug.flutter.util.private_views; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNotNull; +import static org.mockito.ArgumentMatchers.any; +import static org.mockito.Mockito.doAnswer; +import static org.mockito.Mockito.mock; +import static org.mockito.Mockito.never; +import static org.mockito.Mockito.spy; +import static org.mockito.Mockito.timeout; +import static org.mockito.Mockito.verify; +import static org.mockito.Mockito.when; +import static org.robolectric.Shadows.shadowOf; + +import android.app.Activity; +import android.graphics.Bitmap; +import android.os.Build; +import android.os.Looper; +import android.view.SurfaceView; + +import com.instabug.flutter.generated.InstabugPrivateViewPigeon; +import com.instabug.flutter.model.ScreenshotResult; +import com.instabug.flutter.modules.PrivateViewManager; +import com.instabug.flutter.modules.capturing.BoundryCaptureManager; +import com.instabug.flutter.modules.capturing.CaptureManager; +import com.instabug.flutter.modules.capturing.PixelCopyCaptureManager; +import com.instabug.flutter.util.privateViews.ScreenshotCaptor; + +import org.junit.Before; +import org.junit.Test; +import org.junit.runner.RunWith; +import org.mockito.ArgumentCaptor; +import org.robolectric.Robolectric; +import org.robolectric.RobolectricTestRunner; +import org.robolectric.annotation.Config; + +import java.util.Arrays; +import java.util.List; + +import io.flutter.embedding.android.FlutterActivity; +import io.flutter.embedding.android.FlutterView; +import io.flutter.embedding.engine.renderer.FlutterRenderer; + +@RunWith(RobolectricTestRunner.class) +@Config(sdk = {28}, manifest = Config.NONE) +public class PrivateViewManagerTest { + + private PrivateViewManager privateViewManager; + private InstabugPrivateViewPigeon.InstabugPrivateViewFlutterApi InstabugPrivateViewFlutterApiMock; + private Activity activityMock; + private Bitmap bitmap; + private CaptureManager pixelCopyScreenCaptor, boundryScreenCaptor; + + @Before + public void setUp() { + InstabugPrivateViewFlutterApiMock = mock(InstabugPrivateViewPigeon.InstabugPrivateViewFlutterApi.class); + FlutterRenderer rendererMock = mock(FlutterRenderer.class); + activityMock = spy(Robolectric.buildActivity(Activity.class).setup().create().start().resume().get()); + bitmap = Bitmap.createBitmap(200, 200, Bitmap.Config.ARGB_8888); + when(rendererMock.getBitmap()).thenReturn(bitmap); + pixelCopyScreenCaptor = spy(new PixelCopyCaptureManager()); + boundryScreenCaptor = spy(new BoundryCaptureManager(rendererMock)); + privateViewManager = spy(new PrivateViewManager(InstabugPrivateViewFlutterApiMock, pixelCopyScreenCaptor, boundryScreenCaptor)); + privateViewManager.setActivity(activityMock); + + } + + + @Test + public void testMaskGivenEmptyActivity() { + com.instabug.flutter.util.privateViews.ScreenshotCaptor.CapturingCallback capturingCallbackMock = mock(ScreenshotCaptor.CapturingCallback.class); + privateViewManager.setActivity(null); + privateViewManager.mask(capturingCallbackMock); + ArgumentCaptor argumentCaptor = ArgumentCaptor.forClass(Throwable.class); + verify(capturingCallbackMock).onCapturingFailure(argumentCaptor.capture()); + assertEquals( PrivateViewManager.EXCEPTION_MESSAGE, argumentCaptor.getValue().getMessage()); + } + + @Test + public void testMask() throws InterruptedException { + com.instabug.flutter.util.privateViews.ScreenshotCaptor.CapturingCallback capturingCallbackMock = mock(com.instabug.flutter.util.privateViews.ScreenshotCaptor.CapturingCallback.class); + doAnswer(invocation -> { + InstabugPrivateViewPigeon.InstabugPrivateViewFlutterApi.Reply> callback = invocation.getArgument(0); // Get the callback + callback.reply(Arrays.asList(10.0, 20.0, 100.0, 200.0)); // Trigger the success callback + return null; + }).when(InstabugPrivateViewFlutterApiMock).getPrivateViews(any(InstabugPrivateViewPigeon.InstabugPrivateViewFlutterApi.Reply.class)); // Mock the method call + + + // Trigger the mask operation + privateViewManager.mask(capturingCallbackMock); + // Mock that latch.await() has been called + shadowOf(Looper.getMainLooper()).idle(); + + // Simulate a successful bitmap capture + verify(capturingCallbackMock, timeout(1000)).onCapturingSuccess(bitmap); + } + + + private void mockFlutterViewInPixelCopy() { + SurfaceView mockSurfaceView = mock(SurfaceView.class); + FlutterView flutterView = mock(FlutterView.class); + when(flutterView.getChildAt(0)).thenReturn(mockSurfaceView); + when(flutterView.getChildCount()).thenReturn(1); + + when(activityMock.findViewById(FlutterActivity.FLUTTER_VIEW_ID)).thenReturn(flutterView); + when(mockSurfaceView.getWidth()).thenReturn(100); + when(mockSurfaceView.getHeight()).thenReturn(100); + } + + + @Test + public void testMaskPrivateViews() { + ScreenshotResult mockResult = mock(ScreenshotResult.class); + when(mockResult.getScreenshot()).thenReturn(Bitmap.createBitmap(200, 200, Bitmap.Config.ARGB_8888)); + when(mockResult.getPixelRatio()).thenReturn(2.0f); + + List privateViews = Arrays.asList(10.0, 20.0, 100.0, 200.0); + + privateViewManager.maskPrivateViews(mockResult, privateViews); + + assertNotNull(mockResult.getScreenshot()); + } + + @Test + @Config(sdk = {Build.VERSION_CODES.M}) + public void testMaskShouldGetScreenshotWhenAPIVersionLessThan28() { + ScreenshotCaptor.CapturingCallback capturingCallbackMock = mock(ScreenshotCaptor.CapturingCallback.class); + privateViewManager.mask(capturingCallbackMock); + shadowOf(Looper.getMainLooper()).idle(); + + verify(boundryScreenCaptor).capture(any(), any()); + + } + + @Test + public void testMaskShouldCallPixelCopyWhenAPIVersionMoreThan28() { + com.instabug.flutter.util.privateViews.ScreenshotCaptor.CapturingCallback capturingCallbackMock = mock(com.instabug.flutter.util.privateViews.ScreenshotCaptor.CapturingCallback.class); + mockFlutterViewInPixelCopy(); + privateViewManager.mask(capturingCallbackMock); + shadowOf(Looper.getMainLooper()).idle(); + verify(boundryScreenCaptor, never()).capture(any(), any()); + verify(pixelCopyScreenCaptor).capture(any(), any()); + + + } +} \ No newline at end of file diff --git a/android/upload_symbols.gradle b/packages/instabug_flutter/android/upload_symbols.gradle similarity index 100% rename from android/upload_symbols.gradle rename to packages/instabug_flutter/android/upload_symbols.gradle diff --git a/packages/instabug_flutter/dangerfile.ts b/packages/instabug_flutter/dangerfile.ts new file mode 100644 index 000000000..670ae0b05 --- /dev/null +++ b/packages/instabug_flutter/dangerfile.ts @@ -0,0 +1,37 @@ +import { danger, fail, schedule, warn } from 'danger'; +import collectCoverage, { ReportType } from '@instabug/danger-plugin-coverage'; + +const hasSourceChanges = danger.git.modified_files.some((file) => + file.startsWith('lib/') +); +const declaredTrivial = + !hasSourceChanges || + danger.github.issue.labels.some((label) => label.name === 'trivial'); + +// Make sure PR has a description. +async function hasDescription() { + const linesOfCode = (await danger.git.linesOfCode()) ?? 0; + const hasNoDescription = danger.github.pr.body.includes( + '> Description goes here' + ); + if (hasNoDescription && linesOfCode > 10) { + fail( + 'Please provide a summary of the changes in the pull request description.' + ); + } + + if (!danger.git.modified_files.includes('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).' + ); + } +} + +schedule(hasDescription()); + +collectCoverage({ + label: 'Dart', + type: ReportType.LCOV, + filePath: 'coverage/lcov.info', + threshold: 80, +}); diff --git a/example/.gitignore b/packages/instabug_flutter/example/.gitignore similarity index 100% rename from example/.gitignore rename to packages/instabug_flutter/example/.gitignore diff --git a/example/.metadata b/packages/instabug_flutter/example/.metadata similarity index 100% rename from example/.metadata rename to packages/instabug_flutter/example/.metadata diff --git a/example/README.md b/packages/instabug_flutter/example/README.md similarity index 100% rename from example/README.md rename to packages/instabug_flutter/example/README.md diff --git a/example/android/.gitignore b/packages/instabug_flutter/example/android/.gitignore similarity index 100% rename from example/android/.gitignore rename to packages/instabug_flutter/example/android/.gitignore diff --git a/packages/instabug_flutter/example/android/app/build.gradle b/packages/instabug_flutter/example/android/app/build.gradle new file mode 100644 index 000000000..f29331c1f --- /dev/null +++ b/packages/instabug_flutter/example/android/app/build.gradle @@ -0,0 +1,57 @@ + +plugins { + id "com.android.application" + id "kotlin-android" + // The Flutter Gradle Plugin must be applied after the Android and Kotlin Gradle plugins. + id "dev.flutter.flutter-gradle-plugin" +} + +android { + namespace = "com.instabug.flutter.example" + compileSdk = flutter.compileSdkVersion + ndkVersion = flutter.ndkVersion + + compileOptions { + sourceCompatibility = JavaVersion.VERSION_1_8 + targetCompatibility = JavaVersion.VERSION_1_8 + } + + kotlinOptions { + jvmTarget = JavaVersion.VERSION_1_8 + } + + defaultConfig { + applicationId "com.instabug.flutter.example" + minSdkVersion 21 + targetSdkVersion 34 + versionCode flutter.versionCode + versionName flutter.versionName + testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" + multiDexEnabled true + } + + 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 + } + } + namespace 'com.instabug.flutter.example' + + configurations.all { + resolutionStrategy.force 'org.hamcrest:hamcrest-core:1.3' + } +} + +flutter { + source '../..' +} + +dependencies { + implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:1.7.20" + implementation 'com.android.support:multidex:1.0.3' + implementation 'org.mockito:mockito-core:1.10.19' + testImplementation 'junit:junit:4.12' + testImplementation 'org.mockito:mockito-core:1.10.19' +} diff --git a/packages/instabug_flutter/example/android/app/src/debug/AndroidManifest.xml b/packages/instabug_flutter/example/android/app/src/debug/AndroidManifest.xml new file mode 100644 index 000000000..f880684a6 --- /dev/null +++ b/packages/instabug_flutter/example/android/app/src/debug/AndroidManifest.xml @@ -0,0 +1,6 @@ + + + + diff --git a/example/android/app/src/main/AndroidManifest.xml b/packages/instabug_flutter/example/android/app/src/main/AndroidManifest.xml similarity index 98% rename from example/android/app/src/main/AndroidManifest.xml rename to packages/instabug_flutter/example/android/app/src/main/AndroidManifest.xml index 2416f09d0..483f4dd2e 100644 --- a/example/android/app/src/main/AndroidManifest.xml +++ b/packages/instabug_flutter/example/android/app/src/main/AndroidManifest.xml @@ -1,5 +1,4 @@ - + + + + + + + diff --git a/packages/instabug_flutter/example/android/app/src/main/res/mipmap-hdpi/ic_launcher.png b/packages/instabug_flutter/example/android/app/src/main/res/mipmap-hdpi/ic_launcher.png new file mode 100644 index 000000000..db77bb4b7 Binary files /dev/null and b/packages/instabug_flutter/example/android/app/src/main/res/mipmap-hdpi/ic_launcher.png differ diff --git a/packages/instabug_flutter/example/android/app/src/main/res/mipmap-mdpi/ic_launcher.png b/packages/instabug_flutter/example/android/app/src/main/res/mipmap-mdpi/ic_launcher.png new file mode 100644 index 000000000..17987b79b Binary files /dev/null and b/packages/instabug_flutter/example/android/app/src/main/res/mipmap-mdpi/ic_launcher.png differ diff --git a/packages/instabug_flutter/example/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png b/packages/instabug_flutter/example/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png new file mode 100644 index 000000000..09d439148 Binary files /dev/null and b/packages/instabug_flutter/example/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png differ diff --git a/packages/instabug_flutter/example/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png b/packages/instabug_flutter/example/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png new file mode 100644 index 000000000..d5f1c8d34 Binary files /dev/null and b/packages/instabug_flutter/example/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png differ diff --git a/packages/instabug_flutter/example/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png b/packages/instabug_flutter/example/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png new file mode 100644 index 000000000..4d6372eeb Binary files /dev/null and b/packages/instabug_flutter/example/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png differ diff --git a/example/android/app/src/main/res/values/styles.xml b/packages/instabug_flutter/example/android/app/src/main/res/values/styles.xml similarity index 100% rename from example/android/app/src/main/res/values/styles.xml rename to packages/instabug_flutter/example/android/app/src/main/res/values/styles.xml diff --git a/example/android/app/src/main/res/xml/network_security_config.xml b/packages/instabug_flutter/example/android/app/src/main/res/xml/network_security_config.xml similarity index 100% rename from example/android/app/src/main/res/xml/network_security_config.xml rename to packages/instabug_flutter/example/android/app/src/main/res/xml/network_security_config.xml diff --git a/packages/instabug_flutter/example/android/app/src/profile/AndroidManifest.xml b/packages/instabug_flutter/example/android/app/src/profile/AndroidManifest.xml new file mode 100644 index 000000000..f880684a6 --- /dev/null +++ b/packages/instabug_flutter/example/android/app/src/profile/AndroidManifest.xml @@ -0,0 +1,6 @@ + + + + diff --git a/packages/instabug_flutter/example/android/build.gradle b/packages/instabug_flutter/example/android/build.gradle new file mode 100644 index 000000000..6cc62edd7 --- /dev/null +++ b/packages/instabug_flutter/example/android/build.gradle @@ -0,0 +1,21 @@ +rootProject.buildDir = '../build' + +//android { +// namespace 'com.instabug.flutter.example' +//} +subprojects { + project.buildDir = "${rootProject.buildDir}/${project.name}" +} +subprojects { + project.evaluationDependsOn(':app') + tasks.withType(Test) { + // Prevent tests in moduleA from running + if (project.name == 'video_player_android') { + exclude '**/*' + } + } +} + +tasks.register("clean", Delete) { + delete rootProject.buildDir +} diff --git a/packages/instabug_flutter/example/android/gradle.properties b/packages/instabug_flutter/example/android/gradle.properties new file mode 100644 index 000000000..b9a9a2464 --- /dev/null +++ b/packages/instabug_flutter/example/android/gradle.properties @@ -0,0 +1,6 @@ +org.gradle.jvmargs=-Xmx1536M +android.useAndroidX=true +android.enableJetifier=true +android.defaults.buildfeatures.buildconfig=true +android.nonTransitiveRClass=false +android.nonFinalResIds=false diff --git a/example/android/gradle/wrapper/gradle-wrapper.jar b/packages/instabug_flutter/example/android/gradle/wrapper/gradle-wrapper.jar similarity index 100% rename from example/android/gradle/wrapper/gradle-wrapper.jar rename to packages/instabug_flutter/example/android/gradle/wrapper/gradle-wrapper.jar diff --git a/packages/instabug_flutter/example/android/gradle/wrapper/gradle-wrapper.properties b/packages/instabug_flutter/example/android/gradle/wrapper/gradle-wrapper.properties new file mode 100644 index 000000000..4cf0c849a --- /dev/null +++ b/packages/instabug_flutter/example/android/gradle/wrapper/gradle-wrapper.properties @@ -0,0 +1,6 @@ +#Fri Jun 23 08:50:38 CEST 2017 +distributionBase=GRADLE_USER_HOME +distributionPath=wrapper/dists +zipStoreBase=GRADLE_USER_HOME +zipStorePath=wrapper/dists +distributionUrl=https\://services.gradle.org/distributions/gradle-8.5-all.zip diff --git a/example/android/gradlew b/packages/instabug_flutter/example/android/gradlew similarity index 100% rename from example/android/gradlew rename to packages/instabug_flutter/example/android/gradlew diff --git a/example/android/gradlew.bat b/packages/instabug_flutter/example/android/gradlew.bat similarity index 96% rename from example/android/gradlew.bat rename to packages/instabug_flutter/example/android/gradlew.bat index aec99730b..8a0b282aa 100644 --- a/example/android/gradlew.bat +++ b/packages/instabug_flutter/example/android/gradlew.bat @@ -1,90 +1,90 @@ -@if "%DEBUG%" == "" @echo off -@rem ########################################################################## -@rem -@rem Gradle startup script for Windows -@rem -@rem ########################################################################## - -@rem Set local scope for the variables with windows NT shell -if "%OS%"=="Windows_NT" setlocal - -@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. -set DEFAULT_JVM_OPTS= - -set DIRNAME=%~dp0 -if "%DIRNAME%" == "" set DIRNAME=. -set APP_BASE_NAME=%~n0 -set APP_HOME=%DIRNAME% - -@rem Find java.exe -if defined JAVA_HOME goto findJavaFromJavaHome - -set JAVA_EXE=java.exe -%JAVA_EXE% -version >NUL 2>&1 -if "%ERRORLEVEL%" == "0" goto init - -echo. -echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. -echo. -echo Please set the JAVA_HOME variable in your environment to match the -echo location of your Java installation. - -goto fail - -:findJavaFromJavaHome -set JAVA_HOME=%JAVA_HOME:"=% -set JAVA_EXE=%JAVA_HOME%/bin/java.exe - -if exist "%JAVA_EXE%" goto init - -echo. -echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% -echo. -echo Please set the JAVA_HOME variable in your environment to match the -echo location of your Java installation. - -goto fail - -:init -@rem Get command-line arguments, handling Windowz variants - -if not "%OS%" == "Windows_NT" goto win9xME_args -if "%@eval[2+2]" == "4" goto 4NT_args - -:win9xME_args -@rem Slurp the command line arguments. -set CMD_LINE_ARGS= -set _SKIP=2 - -:win9xME_args_slurp -if "x%~1" == "x" goto execute - -set CMD_LINE_ARGS=%* -goto execute - -:4NT_args -@rem Get arguments from the 4NT Shell from JP Software -set CMD_LINE_ARGS=%$ - -:execute -@rem Setup the command line - -set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar - -@rem Execute Gradle -"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS% - -:end -@rem End local scope for the variables with windows NT shell -if "%ERRORLEVEL%"=="0" goto mainEnd - -:fail -rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of -rem the _cmd.exe /c_ return code! -if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1 -exit /b 1 - -:mainEnd -if "%OS%"=="Windows_NT" endlocal - -:omega +@if "%DEBUG%" == "" @echo off +@rem ########################################################################## +@rem +@rem Gradle startup script for Windows +@rem +@rem ########################################################################## + +@rem Set local scope for the variables with windows NT shell +if "%OS%"=="Windows_NT" setlocal + +@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. +set DEFAULT_JVM_OPTS= + +set DIRNAME=%~dp0 +if "%DIRNAME%" == "" set DIRNAME=. +set APP_BASE_NAME=%~n0 +set APP_HOME=%DIRNAME% + +@rem Find java.exe +if defined JAVA_HOME goto findJavaFromJavaHome + +set JAVA_EXE=java.exe +%JAVA_EXE% -version >NUL 2>&1 +if "%ERRORLEVEL%" == "0" goto init + +echo. +echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. +echo. +echo Please set the JAVA_HOME variable in your environment to match the +echo location of your Java installation. + +goto fail + +:findJavaFromJavaHome +set JAVA_HOME=%JAVA_HOME:"=% +set JAVA_EXE=%JAVA_HOME%/bin/java.exe + +if exist "%JAVA_EXE%" goto init + +echo. +echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% +echo. +echo Please set the JAVA_HOME variable in your environment to match the +echo location of your Java installation. + +goto fail + +:init +@rem Get command-line arguments, handling Windowz variants + +if not "%OS%" == "Windows_NT" goto win9xME_args +if "%@eval[2+2]" == "4" goto 4NT_args + +:win9xME_args +@rem Slurp the command line arguments. +set CMD_LINE_ARGS= +set _SKIP=2 + +:win9xME_args_slurp +if "x%~1" == "x" goto execute + +set CMD_LINE_ARGS=%* +goto execute + +:4NT_args +@rem Get arguments from the 4NT Shell from JP Software +set CMD_LINE_ARGS=%$ + +:execute +@rem Setup the command line + +set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar + +@rem Execute Gradle +"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS% + +:end +@rem End local scope for the variables with windows NT shell +if "%ERRORLEVEL%"=="0" goto mainEnd + +:fail +rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of +rem the _cmd.exe /c_ return code! +if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1 +exit /b 1 + +:mainEnd +if "%OS%"=="Windows_NT" endlocal + +:omega diff --git a/packages/instabug_flutter/example/android/settings.gradle b/packages/instabug_flutter/example/android/settings.gradle new file mode 100644 index 000000000..32cfc43dc --- /dev/null +++ b/packages/instabug_flutter/example/android/settings.gradle @@ -0,0 +1,27 @@ +pluginManagement { + def flutterSdkPath = { + def properties = new Properties() + file("local.properties").withInputStream { properties.load(it) } + def flutterSdkPath = properties.getProperty("flutter.sdk") + assert flutterSdkPath != null, "flutter.sdk not set in local.properties" + return flutterSdkPath + }() + + includeBuild("$flutterSdkPath/packages/flutter_tools/gradle") + + repositories { + google() + mavenCentral() + gradlePluginPortal() + maven { url 'https://storage.googleapis.com/flutter-plugins' } + + } +} + +plugins { + id "dev.flutter.flutter-plugin-loader" version "1.0.0" + id "com.android.application" version "8.1.0" apply false + id "org.jetbrains.kotlin.android" version "1.8.22" apply false +} + +include ":app" diff --git a/example/android/settings_aar.gradle b/packages/instabug_flutter/example/android/settings_aar.gradle similarity index 100% rename from example/android/settings_aar.gradle rename to packages/instabug_flutter/example/android/settings_aar.gradle diff --git a/packages/instabug_flutter/example/assets/img.png b/packages/instabug_flutter/example/assets/img.png new file mode 100644 index 000000000..fff04770f Binary files /dev/null and b/packages/instabug_flutter/example/assets/img.png differ diff --git a/example/ios/.gitignore b/packages/instabug_flutter/example/ios/.gitignore similarity index 100% rename from example/ios/.gitignore rename to packages/instabug_flutter/example/ios/.gitignore diff --git a/example/ios/Flutter/AppFrameworkInfo.plist b/packages/instabug_flutter/example/ios/Flutter/AppFrameworkInfo.plist similarity index 100% rename from example/ios/Flutter/AppFrameworkInfo.plist rename to packages/instabug_flutter/example/ios/Flutter/AppFrameworkInfo.plist diff --git a/example/ios/Flutter/Debug.xcconfig b/packages/instabug_flutter/example/ios/Flutter/Debug.xcconfig similarity index 100% rename from example/ios/Flutter/Debug.xcconfig rename to packages/instabug_flutter/example/ios/Flutter/Debug.xcconfig diff --git a/example/ios/Flutter/Release.xcconfig b/packages/instabug_flutter/example/ios/Flutter/Release.xcconfig similarity index 100% rename from example/ios/Flutter/Release.xcconfig rename to packages/instabug_flutter/example/ios/Flutter/Release.xcconfig diff --git a/example/ios/InstabugTests/ApmApiTests.m b/packages/instabug_flutter/example/ios/InstabugTests/ApmApiTests.m similarity index 70% rename from example/ios/InstabugTests/ApmApiTests.m rename to packages/instabug_flutter/example/ios/InstabugTests/ApmApiTests.m index 073937c04..3be2288d2 100644 --- a/example/ios/InstabugTests/ApmApiTests.m +++ b/packages/instabug_flutter/example/ios/InstabugTests/ApmApiTests.m @@ -1,8 +1,8 @@ #import #import "OCMock/OCMock.h" #import "ApmApi.h" -#import "Instabug/IBGAPM.h" -#import "Instabug/Instabug.h" +#import "InstabugSDK/IBGAPM.h" +#import "InstabugSDK/InstabugSDK.h" #import "IBGAPM+PrivateAPIs.h" @interface ApmApiTests : XCTestCase @@ -19,16 +19,6 @@ - (void)setUp { self.api = [[ApmApi alloc] init]; } -- (IBGExecutionTrace *)mockTraceWithId:(NSString *)traceId { - NSString* name = @"trace-name"; - IBGExecutionTrace *mTrace = OCMClassMock([IBGExecutionTrace class]); - - OCMStub([self.mAPM startExecutionTraceWithName:name]).andReturn(mTrace); - - [self.api startExecutionTraceId:traceId name:name completion:^(NSString * _Nullable _, FlutterError * _Nullable __) {}]; - - return mTrace; -} - (void)testSetEnabled { NSNumber *isEnabled = @1; @@ -116,63 +106,6 @@ - (void)testSetAutoUITraceEnabled { OCMVerify([self.mAPM setAutoUITraceEnabled:YES]); } -- (void)testStartExecutionTraceWhenTraceNotNil { - NSString *expectedId = @"trace-id"; - NSString *name = @"trace-name"; - XCTestExpectation *expectation = [self expectationWithDescription:@"Call completion handler"]; - - IBGExecutionTrace *mTrace = OCMClassMock([IBGExecutionTrace class]); - OCMStub([self.mAPM startExecutionTraceWithName:name]).andReturn(mTrace); - - [self.api startExecutionTraceId:expectedId name:name completion:^(NSString *actualId, FlutterError *error) { - [expectation fulfill]; - XCTAssertEqual(actualId, expectedId); - XCTAssertNil(error); - }]; - - OCMVerify([self.mAPM startExecutionTraceWithName:name]); - [self waitForExpectations:@[expectation] timeout:5.0]; -} - -- (void)testStartExecutionTraceWhenTraceIsNil { - NSString *traceId = @"trace-id"; - NSString *name = @"trace-name"; - XCTestExpectation *expectation = [self expectationWithDescription:@"Call completion handler"]; - - OCMStub([self.mAPM startExecutionTraceWithName:name]).andReturn(nil); - - [self.api startExecutionTraceId:traceId name:name completion:^(NSString *actualId, FlutterError *error) { - [expectation fulfill]; - XCTAssertNil(actualId); - XCTAssertNil(error); - }]; - - OCMVerify([self.mAPM startExecutionTraceWithName:name]); - [self waitForExpectations:@[expectation] timeout:5.0]; -} - - -- (void)testSetExecutionTraceAttribute { - NSString *traceId = @"trace-id"; - NSString *key = @"is_premium"; - NSString *value = @"true"; - FlutterError *error; - id mTrace = [self mockTraceWithId:traceId]; - - [self.api setExecutionTraceAttributeId:traceId key:key value:value error:&error]; - - OCMVerify([mTrace setAttributeWithKey:key value:value]); -} - -- (void)testEndExecutionTrace { - NSString *traceId = @"trace-id"; - FlutterError *error; - IBGExecutionTrace *mTrace = [self mockTraceWithId:traceId]; - - [self.api endExecutionTraceId:traceId error:&error]; - - OCMVerify([mTrace end]); -} - (void) testStartFlow { NSString* appFlowName = @"app-flow-name"; diff --git a/example/ios/InstabugTests/ArgsRegistryTests.m b/packages/instabug_flutter/example/ios/InstabugTests/ArgsRegistryTests.m similarity index 100% rename from example/ios/InstabugTests/ArgsRegistryTests.m rename to packages/instabug_flutter/example/ios/InstabugTests/ArgsRegistryTests.m diff --git a/example/ios/InstabugTests/BugReportingApiTests.m b/packages/instabug_flutter/example/ios/InstabugTests/BugReportingApiTests.m similarity index 82% rename from example/ios/InstabugTests/BugReportingApiTests.m rename to packages/instabug_flutter/example/ios/InstabugTests/BugReportingApiTests.m index 16f5fbee0..5b6954d59 100644 --- a/example/ios/InstabugTests/BugReportingApiTests.m +++ b/packages/instabug_flutter/example/ios/InstabugTests/BugReportingApiTests.m @@ -1,7 +1,7 @@ #import #import "OCMock/OCMock.h" #import "BugReportingApi.h" -#import "Instabug/IBGBugReporting.h" +#import "InstabugSDK/IBGBugReporting.h" @interface BugReportingApiTests : XCTestCase @@ -162,7 +162,7 @@ - (void)testSetCommentMinimumCharacterCountGivenReportTypes { [self.api setCommentMinimumCharacterCountLimit:limit reportTypes:reportTypes error:&error]; - OCMVerify([self.mBugReporting setCommentMinimumCharacterCountForReportTypes:IBGBugReportingReportTypeBug | IBGBugReportingReportTypeQuestion withLimit:limit.intValue]); + OCMVerify([self.mBugReporting setCommentMinimumCharacterCount:limit.intValue forBugReportType:IBGBugReportingReportTypeBug | IBGBugReportingReportTypeQuestion]); } - (void)testSetCommentMinimumCharacterCountGivenNoReportTypes { @@ -172,7 +172,28 @@ - (void)testSetCommentMinimumCharacterCountGivenNoReportTypes { [self.api setCommentMinimumCharacterCountLimit:limit reportTypes:reportTypes error:&error]; - OCMVerify([self.mBugReporting setCommentMinimumCharacterCountForReportTypes:IBGBugReportingReportTypeBug | IBGBugReportingReportTypeFeedback | IBGBugReportingReportTypeQuestion withLimit:limit.intValue]); + OCMVerify([self.mBugReporting setCommentMinimumCharacterCount:limit.intValue forBugReportType:IBGBugReportingReportTypeBug | IBGBugReportingReportTypeFeedback | IBGBugReportingReportTypeQuestion]); +} +- (void)testAddUserConsentWithKey { + NSString *key = @"testKey"; + NSString *description = @"Consent description"; + NSNumber *mandatory = @1; + NSNumber *checked = @0; + NSString *actionType= @"UserConsentActionType.dropAutoCapturedMedia"; + FlutterError *error; + IBGActionType mappedActionType = IBGActionTypeDropAutoCapturedMedia; + + [self.api addUserConsentsKey:key + description:description + mandatory:mandatory + checked:checked + actionType:actionType + error: &error + ]; + OCMVerify([self.mBugReporting addUserConsentWithKey:key + description:description + mandatory:[mandatory boolValue] + checked:[checked boolValue] + actionType:mappedActionType]); } - @end diff --git a/example/ios/InstabugTests/CrashReportingApiTests.m b/packages/instabug_flutter/example/ios/InstabugTests/CrashReportingApiTests.m similarity index 95% rename from example/ios/InstabugTests/CrashReportingApiTests.m rename to packages/instabug_flutter/example/ios/InstabugTests/CrashReportingApiTests.m index 7b067b329..770342eaf 100644 --- a/example/ios/InstabugTests/CrashReportingApiTests.m +++ b/packages/instabug_flutter/example/ios/InstabugTests/CrashReportingApiTests.m @@ -1,8 +1,8 @@ #import #import "OCMock/OCMock.h" #import "CrashReportingApi.h" -#import "Instabug/IBGCrashReporting.h" -#import "Instabug/Instabug.h" +#import "InstabugSDK/IBGCrashReporting.h" +#import "InstabugSDK/InstabugSDK.h" #import "Util/Instabug+Test.h" #import "Util/IBGCrashReporting+CP.h" diff --git a/example/ios/InstabugTests/FeatureRequestsApiTests.m b/packages/instabug_flutter/example/ios/InstabugTests/FeatureRequestsApiTests.m similarity index 95% rename from example/ios/InstabugTests/FeatureRequestsApiTests.m rename to packages/instabug_flutter/example/ios/InstabugTests/FeatureRequestsApiTests.m index c0d6dd1fc..e888652c5 100644 --- a/example/ios/InstabugTests/FeatureRequestsApiTests.m +++ b/packages/instabug_flutter/example/ios/InstabugTests/FeatureRequestsApiTests.m @@ -1,7 +1,7 @@ #import #import "OCMock/OCMock.h" #import "FeatureRequestsApi.h" -#import "Instabug/IBGFeatureRequests.h" +#import "InstabugSDK/IBGFeatureRequests.h" @interface FeatureRequestsApiTests : XCTestCase diff --git a/example/ios/InstabugTests/Info.plist b/packages/instabug_flutter/example/ios/InstabugTests/Info.plist similarity index 100% rename from example/ios/InstabugTests/Info.plist rename to packages/instabug_flutter/example/ios/InstabugTests/Info.plist diff --git a/example/ios/InstabugTests/InstabugApiTests.m b/packages/instabug_flutter/example/ios/InstabugTests/InstabugApiTests.m similarity index 58% rename from example/ios/InstabugTests/InstabugApiTests.m rename to packages/instabug_flutter/example/ios/InstabugTests/InstabugApiTests.m index 3e83aec1c..d96ed0562 100644 --- a/example/ios/InstabugTests/InstabugApiTests.m +++ b/packages/instabug_flutter/example/ios/InstabugTests/InstabugApiTests.m @@ -2,10 +2,12 @@ #import #import "OCMock/OCMock.h" #import "InstabugApi.h" -#import "Instabug/Instabug.h" +#import "InstabugSDK/InstabugSDK.h" #import "Util/Instabug+Test.h" #import "IBGNetworkLogger+CP.h" #import "Flutter/Flutter.h" +#import "instabug_flutter/IBGAPM+PrivateAPIs.h" +#import "instabug_flutter/IBGNetworkLogger+CP.h" @interface InstabugTests : XCTestCase @@ -36,15 +38,22 @@ - (void)testSetEnabled { - (void)testInit { NSString *token = @"app-token"; + NSString *appVariant = @"app-variant"; + NSArray *invocationEvents = @[@"InvocationEvent.floatingButton", @"InvocationEvent.screenshot"]; NSString *logLevel = @"LogLevel.error"; FlutterError *error; - [self.api initToken:token invocationEvents:invocationEvents debugLogsLevel:logLevel error:&error]; + [self.api initToken:token invocationEvents:invocationEvents debugLogsLevel:logLevel appVariant:appVariant error:&error]; OCMVerify([self.mInstabug setCurrentPlatform:IBGPlatformFlutter]); + OCMVerify([self.mInstabug setSdkDebugLogsLevel:IBGSDKDebugLogsLevelError]); + OCMVerify([self.mInstabug startWithToken:token invocationEvents:(IBGInvocationEventFloatingButton | IBGInvocationEventScreenshot)]); + + XCTAssertEqual(Instabug.appVariant, appVariant); + } - (void)testShow { @@ -198,31 +207,6 @@ - (void)testGetTags { [self waitForExpectations:@[expectation] timeout:5.0]; } -- (void)testAddExperiments { - NSArray *experiments = @[@"premium", @"star"]; - FlutterError *error; - - [self.api addExperimentsExperiments:experiments error:&error]; - - OCMVerify([self.mInstabug addExperiments:experiments]); -} - -- (void)testRemoveExperiments { - NSArray *experiments = @[@"premium", @"star"]; - FlutterError *error; - - [self.api removeExperimentsExperiments:experiments error:&error]; - - OCMVerify([self.mInstabug removeExperiments:experiments]); -} - -- (void)testClearAllExperiments { - FlutterError *error; - - [self.api clearAllExperimentsWithError:&error]; - - OCMVerify([self.mInstabug clearAllExperiments]); -} - (void)testAddFeatureFlags { NSDictionary *featureFlagsMap = @{ @"key13" : @"value1", @"key2" : @"value2"}; @@ -323,7 +307,7 @@ - (void)testSetReproStepsConfig { [self.api setReproStepsConfigBugMode:bugMode crashMode:crashMode sessionReplayMode:sessionReplayMode error:&error]; OCMVerify([self.mInstabug setReproStepsFor:IBGIssueTypeBug withMode:IBGUserStepsModeEnable]); - OCMVerify([self.mInstabug setReproStepsFor:IBGIssueTypeCrash withMode:IBGUserStepsModeDisable]); + OCMVerify([self.mInstabug setReproStepsFor:IBGIssueTypeAllCrashes withMode:IBGUserStepsModeDisable]); OCMVerify([self.mInstabug setReproStepsFor:IBGIssueTypeSessionReplay withMode:IBGUserStepsModeDisable]); } @@ -449,4 +433,229 @@ - (void)testWillRedirectToAppStore { OCMVerify([self.mInstabug willRedirectToAppStore]); } +- (void)testSetNetworkLogBodyEnabled { + NSNumber *isEnabled = @1; + FlutterError *error; + + [self.api setNetworkLogBodyEnabledIsEnabled:isEnabled error:&error]; + + XCTAssertTrue(IBGNetworkLogger.logBodyEnabled); +} + +- (void)testNetworkLogWithW3Caught { + NSString *url = @"https://example.com"; + NSString *requestBody = @"hi"; + NSNumber *requestBodySize = @17; + NSString *responseBody = @"{\"hello\":\"world\"}"; + NSNumber *responseBodySize = @153; + NSString *method = @"POST"; + NSNumber *responseCode = @201; + NSString *responseContentType = @"application/json"; + NSNumber *duration = @23000; + NSNumber *startTime = @1670156107523; + NSString *w3CCaughtHeader = @"1234"; + NSDictionary *requestHeaders = @{ @"Accepts": @"application/json",@"traceparent":w3CCaughtHeader}; + NSDictionary *responseHeaders = @{ @"Content-Type": @"text/plain" }; + NSDictionary *data = @{ + @"url": url, + @"requestBody": requestBody, + @"requestBodySize": requestBodySize, + @"responseBody": responseBody, + @"responseBodySize": responseBodySize, + @"method": method, + @"responseCode": responseCode, + @"requestHeaders": requestHeaders, + @"responseHeaders": responseHeaders, + @"responseContentType": responseContentType, + @"duration": duration, + @"startTime": startTime, + @"isW3cHeaderFound":@1, + @"w3CCaughtHeader":w3CCaughtHeader + }; + + FlutterError* error; + + [self.api networkLogData:data error:&error]; + + OCMVerify([self.mNetworkLogger addNetworkLogWithUrl:url + method:method + requestBody:requestBody + requestBodySize:requestBodySize.integerValue + responseBody:responseBody + responseBodySize:responseBodySize.integerValue + responseCode:(int32_t) responseCode.integerValue + requestHeaders:requestHeaders + responseHeaders:responseHeaders + contentType:responseContentType + errorDomain:nil + errorCode:0 + startTime:startTime.integerValue * 1000 + duration:duration.integerValue + gqlQueryName:nil + serverErrorMessage:nil + isW3cCaughted:@1 + partialID:nil + timestamp:nil + generatedW3CTraceparent:nil + caughtedW3CTraceparent:@"1234" + ]); +} + +- (void)testNetworkLogWithW3GeneratedHeader { + NSString *url = @"https://example.com"; + NSString *requestBody = @"hi"; + NSNumber *requestBodySize = @17; + NSString *responseBody = @"{\"hello\":\"world\"}"; + NSNumber *responseBodySize = @153; + NSString *method = @"POST"; + NSNumber *responseCode = @201; + NSString *responseContentType = @"application/json"; + NSNumber *duration = @23000; + NSNumber *startTime = @1670156107523; + NSDictionary *requestHeaders = @{ @"Accepts": @"application/json" }; + NSDictionary *responseHeaders = @{ @"Content-Type": @"text/plain" }; + NSNumber *partialID = @12; + + NSNumber *timestamp = @34; + + NSString *generatedW3CTraceparent = @"12-34"; + + NSString *caughtedW3CTraceparent = nil; + NSDictionary *data = @{ + @"url": url, + @"requestBody": requestBody, + @"requestBodySize": requestBodySize, + @"responseBody": responseBody, + @"responseBodySize": responseBodySize, + @"method": method, + @"responseCode": responseCode, + @"requestHeaders": requestHeaders, + @"responseHeaders": responseHeaders, + @"responseContentType": responseContentType, + @"duration": duration, + @"startTime": startTime, + @"isW3cHeaderFound": @0, + @"partialId": partialID, + @"networkStartTimeInSeconds": timestamp, + @"w3CGeneratedHeader": generatedW3CTraceparent, + + }; + NSNumber *isW3cCaughted = @0; + + FlutterError* error; + + [self.api networkLogData:data error:&error]; + + OCMVerify([self.mNetworkLogger addNetworkLogWithUrl:url + method:method + requestBody:requestBody + requestBodySize:requestBodySize.integerValue + responseBody:responseBody + responseBodySize:responseBodySize.integerValue + responseCode:(int32_t) responseCode.integerValue + requestHeaders:requestHeaders + responseHeaders:responseHeaders + contentType:responseContentType + errorDomain:nil + errorCode:0 + startTime:startTime.integerValue * 1000 + duration:duration.integerValue + gqlQueryName:nil + serverErrorMessage:nil + isW3cCaughted:isW3cCaughted + partialID:partialID + timestamp:timestamp + generatedW3CTraceparent:generatedW3CTraceparent + caughtedW3CTraceparent:caughtedW3CTraceparent + + + + ]); +} + +- (void)testisW3CFeatureFlagsEnabled { + FlutterError *error; + + id mock = OCMClassMock([IBGNetworkLogger class]); + NSNumber *isW3cExternalTraceIDEnabled = @(YES); + + OCMStub([mock w3ExternalTraceIDEnabled]).andReturn([isW3cExternalTraceIDEnabled boolValue]); + OCMStub([mock w3ExternalGeneratedHeaderEnabled]).andReturn([isW3cExternalTraceIDEnabled boolValue]); + OCMStub([mock w3CaughtHeaderEnabled]).andReturn([isW3cExternalTraceIDEnabled boolValue]); + + + + NSDictionary * result= [self.api isW3CFeatureFlagsEnabledWithError:&error]; + + XCTAssertEqual(result[@"isW3cExternalTraceIDEnabled"],isW3cExternalTraceIDEnabled); + XCTAssertEqual(result[@"isW3cExternalGeneratedHeaderEnabled"],isW3cExternalTraceIDEnabled); + XCTAssertEqual(result[@"isW3cCaughtHeaderEnabled"],isW3cExternalTraceIDEnabled); + +} + +- (void)testSetThemeWithAllProperties { + NSDictionary *themeConfig = @{ + @"primaryColor": @"#FF6B6B", + @"backgroundColor": @"#FFFFFF", + @"titleTextColor": @"#000000", + @"primaryTextColor": @"#333333", + @"secondaryTextColor": @"#666666", + @"callToActionTextColor": @"#FF6B6B", + @"primaryFontPath": @"assets/fonts/CustomFont-Regular.ttf", + @"secondaryFontPath": @"assets/fonts/CustomFont-Bold.ttf", + @"ctaFontPath": @"assets/fonts/CustomFont-Italic.ttf" + }; + + id mockTheme = OCMClassMock([IBGTheme class]); + OCMStub([mockTheme primaryColor]).andReturn([UIColor redColor]); + OCMStub([mockTheme backgroundColor]).andReturn([UIColor whiteColor]); + OCMStub([mockTheme titleTextColor]).andReturn([UIColor blackColor]); + OCMStub([mockTheme primaryTextColor]).andReturn([UIColor darkGrayColor]); + OCMStub([mockTheme secondaryTextColor]).andReturn([UIColor grayColor]); + OCMStub([mockTheme callToActionTextColor]).andReturn([UIColor redColor]); + + FlutterError *error; + + [self.api setThemeThemeConfig:themeConfig error:&error]; + + OCMVerify([self.mInstabug setTheme:[OCMArg isNotNil]]); +} + +- (void)testSetFullscreen { + NSNumber *isEnabled = @1; + FlutterError *error; + + [self.api setFullscreenIsEnabled:isEnabled error:&error]; + + // Since this is an empty implementation, we just verify the method can be called without error + XCTAssertNil(error); +} +- (void)testSetEnableUserStepsIsEnabled{ + NSNumber *isEnabled = @1; + FlutterError *error; + + [self.api setEnableUserStepsIsEnabled:isEnabled error:&error]; + + OCMVerify([self.mInstabug setTrackUserSteps:YES]); + +} + +- (void)testLogUserStepsGestureType{ + NSString* message = @"message"; + NSString* view = @"viewName"; + FlutterError *error; + + [self.api logUserStepsGestureType:@"GestureType.tap" message:message viewName:view error: &error]; + + XCTAssertNil(error, @"Error should be nil"); + +} +- (void)testAutoMasking { + NSArray *autoMaskingTypes = @[@"AutoMasking.labels", @"AutoMasking.textInputs",@"AutoMasking.media",@"AutoMasking.none"]; + FlutterError *error; + + [self.api enableAutoMaskingAutoMasking:autoMaskingTypes error:&error]; + + OCMVerify([self.mInstabug setAutoMaskScreenshots: (IBGAutoMaskScreenshotOptionMaskNothing | IBGAutoMaskScreenshotOptionTextInputs | IBGAutoMaskScreenshotOptionLabels | IBGAutoMaskScreenshotOptionMedia)]); +} @end diff --git a/example/ios/InstabugTests/InstabugLogApiTests.m b/packages/instabug_flutter/example/ios/InstabugTests/InstabugLogApiTests.m similarity index 98% rename from example/ios/InstabugTests/InstabugLogApiTests.m rename to packages/instabug_flutter/example/ios/InstabugTests/InstabugLogApiTests.m index 1947ce965..b006ae53c 100644 --- a/example/ios/InstabugTests/InstabugLogApiTests.m +++ b/packages/instabug_flutter/example/ios/InstabugTests/InstabugLogApiTests.m @@ -1,7 +1,7 @@ #import #import "OCMock/OCMock.h" #import "InstabugLogApi.h" -#import "Instabug/IBGLog.h" +#import "InstabugSDK/IBGLog.h" @interface InstabugLogApiTests : XCTestCase diff --git a/packages/instabug_flutter/example/ios/InstabugTests/PrivateViewApiTests.m b/packages/instabug_flutter/example/ios/InstabugTests/PrivateViewApiTests.m new file mode 100644 index 000000000..ac3f17efc --- /dev/null +++ b/packages/instabug_flutter/example/ios/InstabugTests/PrivateViewApiTests.m @@ -0,0 +1,191 @@ +#import +#import +#import +#import +#import "FlutterPluginRegistrar+FlutterEngine.h" + + +@interface MockFlutterPluginRegistrar : NSObject +@end + +@implementation MockFlutterPluginRegistrar + +@end + + +@interface PrivateViewApiTests : XCTestCase +@property (nonatomic, strong) PrivateViewApi *api; +@property (nonatomic, strong) id mockFlutterApi; +@property (nonatomic, strong) id mockRegistrar; +@property (nonatomic, strong) id mockFlutterViewController; +@property (nonatomic, strong) id mockEngine; + +@end + +@implementation PrivateViewApiTests + +#pragma mark - Setup / Teardown + +- (void)setUp { + [super setUp]; + + + self.mockFlutterApi = OCMClassMock([InstabugPrivateViewFlutterApi class]); + + + MockFlutterPluginRegistrar *mockRegistrar = [[MockFlutterPluginRegistrar alloc] init]; + + self.mockRegistrar = OCMPartialMock(mockRegistrar); + + self.mockEngine = OCMClassMock([FlutterEngine class]); + OCMStub([self.mockRegistrar flutterEngine]).andReturn(self.mockEngine); + + self.mockFlutterViewController = OCMClassMock([UIViewController class]); + + OCMStub([self.mockEngine viewController]).andReturn(_mockFlutterViewController); + + self.api = OCMPartialMock([[PrivateViewApi alloc] initWithFlutterApi:self.mockFlutterApi registrar: self.mockRegistrar]); +} + +- (void)tearDown { + [self.mockFlutterApi stopMocking]; + [self.mockRegistrar stopMocking]; + [self.mockFlutterViewController stopMocking]; + [self.mockEngine stopMocking]; + + self.api = nil; + + [super tearDown]; +} + +#pragma mark - Tests + +- (void)testMask_Success { + XCTestExpectation *expectation = [self expectationWithDescription:@"Mask method success"]; + + CGSize imageSize = CGSizeMake(100, 100); // 100x100 pixels + + // Step 2: Create the image using UIGraphicsImageRenderer + UIGraphicsImageRenderer *renderer = [[UIGraphicsImageRenderer alloc] initWithSize:imageSize]; + + UIImage *screenshot = [renderer imageWithActions:^(UIGraphicsImageRendererContext * _Nonnull rendererContext) { + // Draw a red rectangle as an example + [[UIColor redColor] setFill]; + CGRect rect = CGRectMake(0, 0, imageSize.width, imageSize.height); + UIRectFill(rect); + }]; + + NSArray *rectangles = @[@10, @20, @30, @40]; + UIView *mockView = [[UIView alloc] initWithFrame:CGRectMake(10, 20, 30, 40)]; + + OCMStub([self.mockFlutterApi getPrivateViewsWithCompletion:([OCMArg invokeBlockWithArgs:rectangles, [NSNull null], nil])]); + + + + OCMStub([self.mockFlutterViewController view]).andReturn(mockView); + + + [self.api mask:screenshot completion:^(UIImage *result) { + XCTAssertNotNil(result, @"Masked image should be returned."); + [expectation fulfill]; + }]; + + [self waitForExpectationsWithTimeout:1 handler:nil]; +} + + +- (void)testGetFlutterViewOrigin_ValidView { + UIView *mockView = [[UIView alloc] initWithFrame:CGRectMake(10, 20, 100, 100)]; + + OCMStub([self.mockFlutterViewController view]).andReturn(mockView); + + UIWindow* testWindow = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]]; + [testWindow addSubview:mockView]; + + CGPoint origin = [self.api getFlutterViewOrigin]; + + XCTAssertEqual(origin.x, 10); + XCTAssertEqual(origin.y, 20); +} + +- (void)testGetFlutterViewOrigin_NilView { + + OCMStub([self.mockFlutterViewController view]).andReturn(nil); +// + CGPoint origin = [self.api getFlutterViewOrigin]; + + XCTAssertEqual(origin.x, 0); + XCTAssertEqual(origin.y, 0); +} + +- (void)testDrawMaskedImage { + CGSize size = CGSizeMake(100, 100); + UIGraphicsBeginImageContext(size); + UIImage *screenshot = UIGraphicsGetImageFromCurrentImageContext(); + UIGraphicsEndImageContext(); + + NSArray *privateViews = @[ + [NSValue valueWithCGRect:CGRectMake(10, 10, 20, 20)], + [NSValue valueWithCGRect:CGRectMake(30, 30, 10, 10)] + ]; + + UIImage *result = [self.api drawMaskedImage:screenshot withPrivateViews:privateViews]; + + XCTAssertNotNil(result); + XCTAssertEqual(result.size.width, 100); + XCTAssertEqual(result.size.height, 100); +} + +- (void)testConvertToRectangles_ValidInput { + NSArray *rectangles = @[@10, @20, @30, @40]; + UIView *mockView = [[UIView alloc] initWithFrame:CGRectMake(5, 5, 100, 100)]; + OCMStub([self.mockFlutterViewController view]).andReturn(mockView); + + + NSArray *converted = [self.api convertToRectangles:rectangles]; + + XCTAssertEqual(converted.count, 1); + CGRect rect = [converted[0] CGRectValue]; + XCTAssertTrue(CGRectEqualToRect(rect, CGRectMake(10, 20, 21, 21))); +} + +- (void)testConcurrentMaskCalls { + XCTestExpectation *expectation = [self expectationWithDescription:@"Handle concurrent calls"]; + + CGSize imageSize = CGSizeMake(100, 100); // 100x100 pixels + + // Step 2: Create the image using UIGraphicsImageRenderer + UIGraphicsImageRenderer *renderer = [[UIGraphicsImageRenderer alloc] initWithSize:imageSize]; + + UIImage *screenshot = [renderer imageWithActions:^(UIGraphicsImageRendererContext * _Nonnull rendererContext) { + // Draw a red rectangle as an example + [[UIColor redColor] setFill]; + CGRect rect = CGRectMake(0, 0, imageSize.width, imageSize.height); + UIRectFill(rect); + }]; + + NSArray *rectangles = @[@10, @20, @30, @40]; + + + OCMStub([self.mockFlutterApi getPrivateViewsWithCompletion:([OCMArg invokeBlockWithArgs:rectangles, [NSNull null], nil])]); + + + dispatch_group_t group = dispatch_group_create(); + + for (int i = 0; i < 5; i++) { + dispatch_group_enter(group); + + [self.api mask:screenshot completion:^(UIImage *result) { + XCTAssertNotNil(result, @"Each call should return a valid image."); + dispatch_group_leave(group); + }]; + } + + dispatch_group_notify(group, dispatch_get_main_queue(), ^{ + [expectation fulfill]; + }); + + [self waitForExpectationsWithTimeout:2 handler:nil]; +} + +@end diff --git a/packages/instabug_flutter/example/ios/InstabugTests/PrivateViewHostApiTests.m b/packages/instabug_flutter/example/ios/InstabugTests/PrivateViewHostApiTests.m new file mode 100644 index 000000000..27b2599ec --- /dev/null +++ b/packages/instabug_flutter/example/ios/InstabugTests/PrivateViewHostApiTests.m @@ -0,0 +1,57 @@ +#import +#import +#import +#import "PrivateViewApi.h" +#import "InstabugApi.h" +#import "PrivateViewHostApi.h" + +@interface PrivateViewHostApiTests : XCTestCase + +@property (nonatomic, strong) PrivateViewHostApi *api; +@property (nonatomic, strong) id privateViewApiMock; + +@end + +@implementation PrivateViewHostApiTests + +- (void)setUp { + [super setUp]; + + // Set up a mock for PrivateViewApi + self.privateViewApiMock = OCMClassMock([PrivateViewApi class]); + + // Initialize the PrivateViewHostApi instance + self.api = [[PrivateViewHostApi alloc] init]; + self.api.privateViewApi = self.privateViewApiMock; +} + +- (void)tearDown { + self.api = nil; + self.privateViewApiMock = nil; + [super tearDown]; +} + +- (void)testInitWithError_setsScreenshotMaskingHandler { + // Define an expectation for the screenshot masking handler + UIImage *mockScreenshot = [[UIImage alloc] init]; + UIImage *mockMaskedImage = [[UIImage alloc] init]; + FlutterError *error = nil; + + + + OCMStub([self.privateViewApiMock mask:mockScreenshot completion:([OCMArg invokeBlockWithArgs:mockMaskedImage, nil])]); + + + // Call initWithError and set up the screenshot masking handler + [self.api initWithError:&error]; + + // Invoke the screenshot masking handler + void (^completionHandler)(UIImage * _Nullable) = ^(UIImage * _Nullable maskedImage) { + XCTAssertEqual(maskedImage, mockMaskedImage, @"The masked image should be returned by the completion handler."); + }; + [InstabugApi setScreenshotMaskingHandler:^(UIImage * _Nonnull screenshot, void (^ _Nonnull completion)(UIImage * _Nullable)) { + completionHandler(screenshot); + }]; +} + +@end diff --git a/example/ios/InstabugTests/RepliesApiTests.m b/packages/instabug_flutter/example/ios/InstabugTests/RepliesApiTests.m similarity index 98% rename from example/ios/InstabugTests/RepliesApiTests.m rename to packages/instabug_flutter/example/ios/InstabugTests/RepliesApiTests.m index 5680cd5a1..ec71f0619 100644 --- a/example/ios/InstabugTests/RepliesApiTests.m +++ b/packages/instabug_flutter/example/ios/InstabugTests/RepliesApiTests.m @@ -1,7 +1,7 @@ #import #import "OCMock/OCMock.h" #import "RepliesApi.h" -#import "Instabug/IBGReplies.h" +#import "InstabugSDK/IBGReplies.h" @interface RepliesApiTests : XCTestCase diff --git a/example/ios/InstabugTests/SessionReplayApiTests.m b/packages/instabug_flutter/example/ios/InstabugTests/SessionReplayApiTests.m similarity index 97% rename from example/ios/InstabugTests/SessionReplayApiTests.m rename to packages/instabug_flutter/example/ios/InstabugTests/SessionReplayApiTests.m index d00ef0af2..558d07460 100644 --- a/example/ios/InstabugTests/SessionReplayApiTests.m +++ b/packages/instabug_flutter/example/ios/InstabugTests/SessionReplayApiTests.m @@ -3,7 +3,7 @@ #import #import "OCMock/OCMock.h" #import "SessionReplayApi.h" -#import "Instabug/IBGSessionReplay.h" +#import "InstabugSDK/IBGSessionReplay.h" @interface SessionReplayApiTests : XCTestCase diff --git a/example/ios/InstabugTests/SurveysApiTests.m b/packages/instabug_flutter/example/ios/InstabugTests/SurveysApiTests.m similarity index 99% rename from example/ios/InstabugTests/SurveysApiTests.m rename to packages/instabug_flutter/example/ios/InstabugTests/SurveysApiTests.m index 5feae8bf7..fa552e409 100644 --- a/example/ios/InstabugTests/SurveysApiTests.m +++ b/packages/instabug_flutter/example/ios/InstabugTests/SurveysApiTests.m @@ -1,7 +1,7 @@ #import #import "OCMock/OCMock.h" #import "SurveysApi.h" -#import "Instabug/IBGSurveys.h" +#import "InstabugSDK/IBGSurveys.h" #import "Util/IBGSurvey+Test.h" @interface SurveysApiTests : XCTestCase diff --git a/example/ios/InstabugTests/Util/Apm+Test.h b/packages/instabug_flutter/example/ios/InstabugTests/Util/Apm+Test.h similarity index 87% rename from example/ios/InstabugTests/Util/Apm+Test.h rename to packages/instabug_flutter/example/ios/InstabugTests/Util/Apm+Test.h index c3bddc4bf..48b93744f 100644 --- a/example/ios/InstabugTests/Util/Apm+Test.h +++ b/packages/instabug_flutter/example/ios/InstabugTests/Util/Apm+Test.h @@ -1,7 +1,7 @@ // This header file defines Instabug methods that are called using selectors for test verification. -#import -#import +#import +#import @interface IBGAPM (Test) + (void)startUITraceCPWithName:(NSString *)name startTimestampMUS:(NSTimeInterval)startTimestampMUS; diff --git a/ios/Classes/Util/IBGCrashReporting+CP.h b/packages/instabug_flutter/example/ios/InstabugTests/Util/IBGCrashReporting+CP.h similarity index 92% rename from ios/Classes/Util/IBGCrashReporting+CP.h rename to packages/instabug_flutter/example/ios/InstabugTests/Util/IBGCrashReporting+CP.h index 4229dbcea..cf3a1c200 100644 --- a/ios/Classes/Util/IBGCrashReporting+CP.h +++ b/packages/instabug_flutter/example/ios/InstabugTests/Util/IBGCrashReporting+CP.h @@ -1,4 +1,4 @@ -#import +#import @interface IBGCrashReporting (CP) diff --git a/example/ios/InstabugTests/Util/IBGNetworkLogger+Test.h b/packages/instabug_flutter/example/ios/InstabugTests/Util/IBGNetworkLogger+Test.h similarity index 72% rename from example/ios/InstabugTests/Util/IBGNetworkLogger+Test.h rename to packages/instabug_flutter/example/ios/InstabugTests/Util/IBGNetworkLogger+Test.h index 55475a81f..6f9687768 100644 --- a/example/ios/InstabugTests/Util/IBGNetworkLogger+Test.h +++ b/packages/instabug_flutter/example/ios/InstabugTests/Util/IBGNetworkLogger+Test.h @@ -1,6 +1,6 @@ // This header file defines IBGNetworkLogger methods that are called using selectors for test verification. -#import +#import @interface IBGNetworkLogger (Test) + (void)addNetworkLogWithUrl:(NSString *)url @@ -18,5 +18,10 @@ startTime:(int64_t)startTime duration:(int64_t) duration gqlQueryName:(NSString *_Nullable)gqlQueryName - serverErrorMessage:(NSString *_Nullable)gqlServerError; + serverErrorMessage:(NSString *_Nullable)gqlServerError + isW3cCaughted:(NSNumber *_Nullable)isW3cCaughted + partialID:(NSNumber *_Nullable)partialId + timestamp:(NSNumber *_Nullable)timestamp + generatedW3CTraceparent:(NSString *_Nullable)generatedW3CTraceparent + caughtedW3CTraceparent:(NSString *_Nullable)caughtedW3CTraceparent; @end diff --git a/example/ios/InstabugTests/Util/IBGSurvey+Test.h b/packages/instabug_flutter/example/ios/InstabugTests/Util/IBGSurvey+Test.h similarity index 82% rename from example/ios/InstabugTests/Util/IBGSurvey+Test.h rename to packages/instabug_flutter/example/ios/InstabugTests/Util/IBGSurvey+Test.h index b17f9107e..631438b9b 100644 --- a/example/ios/InstabugTests/Util/IBGSurvey+Test.h +++ b/packages/instabug_flutter/example/ios/InstabugTests/Util/IBGSurvey+Test.h @@ -1,6 +1,6 @@ // This header file makes IBGSurvey title property editable to be used in tests. -#import +#import @interface IBGSurvey (Test) @property (nonatomic, strong) NSString *title; diff --git a/example/ios/InstabugTests/Util/Instabug+Test.h b/packages/instabug_flutter/example/ios/InstabugTests/Util/Instabug+Test.h similarity index 88% rename from example/ios/InstabugTests/Util/Instabug+Test.h rename to packages/instabug_flutter/example/ios/InstabugTests/Util/Instabug+Test.h index d86927c5b..5bb37257a 100644 --- a/example/ios/InstabugTests/Util/Instabug+Test.h +++ b/packages/instabug_flutter/example/ios/InstabugTests/Util/Instabug+Test.h @@ -1,6 +1,6 @@ // This header file defines Instabug methods that are called using selectors for test verification. -#import +#import @interface Instabug (Test) + (void)setCurrentPlatform:(IBGPlatform)platform; diff --git a/example/ios/Podfile b/packages/instabug_flutter/example/ios/Podfile similarity index 98% rename from example/ios/Podfile rename to packages/instabug_flutter/example/ios/Podfile index cdffbc5db..bf8d827c6 100644 --- a/example/ios/Podfile +++ b/packages/instabug_flutter/example/ios/Podfile @@ -1,5 +1,5 @@ # Uncomment this line to define a global platform for your project -platform :ios, '13.4' +platform :ios, '14.4' # CocoaPods analytics sends network stats synchronously affecting flutter build latency. ENV['COCOAPODS_DISABLE_STATS'] = 'true' @@ -27,9 +27,9 @@ require File.expand_path(File.join('packages', 'flutter_tools', 'bin', 'podhelpe flutter_ios_podfile_setup target 'Runner' do + use_frameworks! use_modular_headers! - flutter_install_all_ios_pods File.dirname(File.realpath(__FILE__)) end diff --git a/packages/instabug_flutter/example/ios/Podfile.lock b/packages/instabug_flutter/example/ios/Podfile.lock new file mode 100644 index 000000000..70850705a --- /dev/null +++ b/packages/instabug_flutter/example/ios/Podfile.lock @@ -0,0 +1,40 @@ +PODS: + - Flutter (1.0.0) + - Instabug (15.1.1) + - instabug_flutter (15.0.2): + - Flutter + - Instabug (= 15.1.1) + - OCMock (3.6) + - video_player_avfoundation (0.0.1): + - Flutter + - FlutterMacOS + +DEPENDENCIES: + - Flutter (from `Flutter`) + - instabug_flutter (from `.symlinks/plugins/instabug_flutter/ios`) + - OCMock (= 3.6) + - video_player_avfoundation (from `.symlinks/plugins/video_player_avfoundation/darwin`) + +SPEC REPOS: + trunk: + - Instabug + - OCMock + +EXTERNAL SOURCES: + Flutter: + :path: Flutter + instabug_flutter: + :path: ".symlinks/plugins/instabug_flutter/ios" + video_player_avfoundation: + :path: ".symlinks/plugins/video_player_avfoundation/darwin" + +SPEC CHECKSUMS: + Flutter: e0871f40cf51350855a761d2e70bf5af5b9b5de7 + Instabug: 3e7af445c14d7823fcdecba223f09b5f7c0c6ce1 + instabug_flutter: c5a8cb73d6c50dd193fc267b0b283087dc05c37a + OCMock: 5ea90566be239f179ba766fd9fbae5885040b992 + video_player_avfoundation: 2cef49524dd1f16c5300b9cd6efd9611ce03639b + +PODFILE CHECKSUM: 986d650b5bc8e230d8a9612663af4b3b1a9d6236 + +COCOAPODS: 1.16.2 diff --git a/example/ios/Runner.xcodeproj/project.pbxproj b/packages/instabug_flutter/example/ios/Runner.xcodeproj/project.pbxproj similarity index 99% rename from example/ios/Runner.xcodeproj/project.pbxproj rename to packages/instabug_flutter/example/ios/Runner.xcodeproj/project.pbxproj index 858ba01e5..d32f983fc 100644 --- a/example/ios/Runner.xcodeproj/project.pbxproj +++ b/packages/instabug_flutter/example/ios/Runner.xcodeproj/project.pbxproj @@ -536,7 +536,7 @@ GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; GCC_WARN_UNUSED_FUNCTION = YES; GCC_WARN_UNUSED_VARIABLE = YES; - IPHONEOS_DEPLOYMENT_TARGET = 12.0; + IPHONEOS_DEPLOYMENT_TARGET = 15.6; MTL_ENABLE_DEBUG_INFO = NO; SDKROOT = iphoneos; SUPPORTED_PLATFORMS = iphoneos; @@ -559,6 +559,7 @@ "$(PROJECT_DIR)/Flutter", ); INFOPLIST_FILE = Runner/Info.plist; + IPHONEOS_DEPLOYMENT_TARGET = 15.6; LD_RUNPATH_SEARCH_PATHS = ( "$(inherited)", "@executable_path/Frameworks", @@ -696,6 +697,7 @@ "$(PROJECT_DIR)/Flutter", ); INFOPLIST_FILE = Runner/Info.plist; + IPHONEOS_DEPLOYMENT_TARGET = 15.6; LD_RUNPATH_SEARCH_PATHS = ( "$(inherited)", "@executable_path/Frameworks", @@ -727,6 +729,7 @@ "$(PROJECT_DIR)/Flutter", ); INFOPLIST_FILE = Runner/Info.plist; + IPHONEOS_DEPLOYMENT_TARGET = 15.6; LD_RUNPATH_SEARCH_PATHS = ( "$(inherited)", "@executable_path/Frameworks", diff --git a/packages/instabug_flutter/example/ios/Runner.xcodeproj/project.xcworkspace/contents.xcworkspacedata b/packages/instabug_flutter/example/ios/Runner.xcodeproj/project.xcworkspace/contents.xcworkspacedata new file mode 100644 index 000000000..919434a62 --- /dev/null +++ b/packages/instabug_flutter/example/ios/Runner.xcodeproj/project.xcworkspace/contents.xcworkspacedata @@ -0,0 +1,7 @@ + + + + + diff --git a/packages/instabug_flutter/example/ios/Runner.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist b/packages/instabug_flutter/example/ios/Runner.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist new file mode 100644 index 000000000..18d981003 --- /dev/null +++ b/packages/instabug_flutter/example/ios/Runner.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist @@ -0,0 +1,8 @@ + + + + + IDEDidComputeMac32BitWarning + + + diff --git a/packages/instabug_flutter/example/ios/Runner.xcodeproj/project.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings b/packages/instabug_flutter/example/ios/Runner.xcodeproj/project.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings new file mode 100644 index 000000000..f9b0d7c5e --- /dev/null +++ b/packages/instabug_flutter/example/ios/Runner.xcodeproj/project.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings @@ -0,0 +1,8 @@ + + + + + PreviewsEnabled + + + diff --git a/example/ios/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme b/packages/instabug_flutter/example/ios/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme similarity index 100% rename from example/ios/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme rename to packages/instabug_flutter/example/ios/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme diff --git a/packages/instabug_flutter/example/ios/Runner.xcworkspace/contents.xcworkspacedata b/packages/instabug_flutter/example/ios/Runner.xcworkspace/contents.xcworkspacedata new file mode 100644 index 000000000..21a3cc14c --- /dev/null +++ b/packages/instabug_flutter/example/ios/Runner.xcworkspace/contents.xcworkspacedata @@ -0,0 +1,10 @@ + + + + + + + diff --git a/packages/instabug_flutter/example/ios/Runner.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist b/packages/instabug_flutter/example/ios/Runner.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist new file mode 100644 index 000000000..18d981003 --- /dev/null +++ b/packages/instabug_flutter/example/ios/Runner.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist @@ -0,0 +1,8 @@ + + + + + IDEDidComputeMac32BitWarning + + + diff --git a/packages/instabug_flutter/example/ios/Runner.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings b/packages/instabug_flutter/example/ios/Runner.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings new file mode 100644 index 000000000..f9b0d7c5e --- /dev/null +++ b/packages/instabug_flutter/example/ios/Runner.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings @@ -0,0 +1,8 @@ + + + + + PreviewsEnabled + + + diff --git a/example/ios/Runner/AppDelegate.swift b/packages/instabug_flutter/example/ios/Runner/AppDelegate.swift similarity index 97% rename from example/ios/Runner/AppDelegate.swift rename to packages/instabug_flutter/example/ios/Runner/AppDelegate.swift index 11f416a26..b8991863b 100644 --- a/example/ios/Runner/AppDelegate.swift +++ b/packages/instabug_flutter/example/ios/Runner/AppDelegate.swift @@ -1,7 +1,7 @@ import UIKit import Flutter -@UIApplicationMain +@main @objc class AppDelegate: FlutterAppDelegate { override func application( _ application: UIApplication, diff --git a/packages/instabug_flutter/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Contents.json b/packages/instabug_flutter/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Contents.json new file mode 100644 index 000000000..d36b1fab2 --- /dev/null +++ b/packages/instabug_flutter/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Contents.json @@ -0,0 +1,122 @@ +{ + "images" : [ + { + "size" : "20x20", + "idiom" : "iphone", + "filename" : "Icon-App-20x20@2x.png", + "scale" : "2x" + }, + { + "size" : "20x20", + "idiom" : "iphone", + "filename" : "Icon-App-20x20@3x.png", + "scale" : "3x" + }, + { + "size" : "29x29", + "idiom" : "iphone", + "filename" : "Icon-App-29x29@1x.png", + "scale" : "1x" + }, + { + "size" : "29x29", + "idiom" : "iphone", + "filename" : "Icon-App-29x29@2x.png", + "scale" : "2x" + }, + { + "size" : "29x29", + "idiom" : "iphone", + "filename" : "Icon-App-29x29@3x.png", + "scale" : "3x" + }, + { + "size" : "40x40", + "idiom" : "iphone", + "filename" : "Icon-App-40x40@2x.png", + "scale" : "2x" + }, + { + "size" : "40x40", + "idiom" : "iphone", + "filename" : "Icon-App-40x40@3x.png", + "scale" : "3x" + }, + { + "size" : "60x60", + "idiom" : "iphone", + "filename" : "Icon-App-60x60@2x.png", + "scale" : "2x" + }, + { + "size" : "60x60", + "idiom" : "iphone", + "filename" : "Icon-App-60x60@3x.png", + "scale" : "3x" + }, + { + "size" : "20x20", + "idiom" : "ipad", + "filename" : "Icon-App-20x20@1x.png", + "scale" : "1x" + }, + { + "size" : "20x20", + "idiom" : "ipad", + "filename" : "Icon-App-20x20@2x.png", + "scale" : "2x" + }, + { + "size" : "29x29", + "idiom" : "ipad", + "filename" : "Icon-App-29x29@1x.png", + "scale" : "1x" + }, + { + "size" : "29x29", + "idiom" : "ipad", + "filename" : "Icon-App-29x29@2x.png", + "scale" : "2x" + }, + { + "size" : "40x40", + "idiom" : "ipad", + "filename" : "Icon-App-40x40@1x.png", + "scale" : "1x" + }, + { + "size" : "40x40", + "idiom" : "ipad", + "filename" : "Icon-App-40x40@2x.png", + "scale" : "2x" + }, + { + "size" : "76x76", + "idiom" : "ipad", + "filename" : "Icon-App-76x76@1x.png", + "scale" : "1x" + }, + { + "size" : "76x76", + "idiom" : "ipad", + "filename" : "Icon-App-76x76@2x.png", + "scale" : "2x" + }, + { + "size" : "83.5x83.5", + "idiom" : "ipad", + "filename" : "Icon-App-83.5x83.5@2x.png", + "scale" : "2x" + }, + { + "size" : "1024x1024", + "idiom" : "ios-marketing", + "filename" : "Icon-App-1024x1024@1x.png", + "scale" : "1x" + } + ], + "info" : { + "version" : 1, + "author" : "xcode" + } +} diff --git a/packages/instabug_flutter/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-1024x1024@1x.png b/packages/instabug_flutter/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-1024x1024@1x.png new file mode 100644 index 000000000..dc9ada472 Binary files /dev/null and b/packages/instabug_flutter/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-1024x1024@1x.png differ diff --git a/packages/instabug_flutter/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@1x.png b/packages/instabug_flutter/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@1x.png new file mode 100644 index 000000000..28c6bf030 Binary files /dev/null and b/packages/instabug_flutter/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@1x.png differ diff --git a/packages/instabug_flutter/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@2x.png b/packages/instabug_flutter/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@2x.png new file mode 100644 index 000000000..2ccbfd967 Binary files /dev/null and b/packages/instabug_flutter/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@2x.png differ diff --git a/packages/instabug_flutter/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@3x.png b/packages/instabug_flutter/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@3x.png new file mode 100644 index 000000000..f091b6b0b Binary files /dev/null and b/packages/instabug_flutter/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@3x.png differ diff --git a/packages/instabug_flutter/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@1x.png b/packages/instabug_flutter/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@1x.png new file mode 100644 index 000000000..4cde12118 Binary files /dev/null and b/packages/instabug_flutter/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@1x.png differ diff --git a/packages/instabug_flutter/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@2x.png b/packages/instabug_flutter/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@2x.png new file mode 100644 index 000000000..d0ef06e7e Binary files /dev/null and b/packages/instabug_flutter/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@2x.png differ diff --git a/packages/instabug_flutter/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@3x.png b/packages/instabug_flutter/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@3x.png new file mode 100644 index 000000000..dcdc2306c Binary files /dev/null and b/packages/instabug_flutter/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@3x.png differ diff --git a/packages/instabug_flutter/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@1x.png b/packages/instabug_flutter/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@1x.png new file mode 100644 index 000000000..2ccbfd967 Binary files /dev/null and b/packages/instabug_flutter/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@1x.png differ diff --git a/packages/instabug_flutter/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@2x.png b/packages/instabug_flutter/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@2x.png new file mode 100644 index 000000000..c8f9ed8f5 Binary files /dev/null and b/packages/instabug_flutter/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@2x.png differ diff --git a/packages/instabug_flutter/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@3x.png b/packages/instabug_flutter/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@3x.png new file mode 100644 index 000000000..a6d6b8609 Binary files /dev/null and b/packages/instabug_flutter/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@3x.png differ diff --git a/packages/instabug_flutter/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@2x.png b/packages/instabug_flutter/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@2x.png new file mode 100644 index 000000000..a6d6b8609 Binary files /dev/null and b/packages/instabug_flutter/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@2x.png differ diff --git a/packages/instabug_flutter/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@3x.png b/packages/instabug_flutter/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@3x.png new file mode 100644 index 000000000..75b2d164a Binary files /dev/null and b/packages/instabug_flutter/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@3x.png differ diff --git a/packages/instabug_flutter/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@1x.png b/packages/instabug_flutter/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@1x.png new file mode 100644 index 000000000..c4df70d39 Binary files /dev/null and b/packages/instabug_flutter/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@1x.png differ diff --git a/packages/instabug_flutter/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@2x.png b/packages/instabug_flutter/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@2x.png new file mode 100644 index 000000000..6a84f41e1 Binary files /dev/null and b/packages/instabug_flutter/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@2x.png differ diff --git a/packages/instabug_flutter/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-83.5x83.5@2x.png b/packages/instabug_flutter/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-83.5x83.5@2x.png new file mode 100644 index 000000000..d0e1f5853 Binary files /dev/null and b/packages/instabug_flutter/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-83.5x83.5@2x.png differ diff --git a/packages/instabug_flutter/example/ios/Runner/Assets.xcassets/LaunchImage.imageset/Contents.json b/packages/instabug_flutter/example/ios/Runner/Assets.xcassets/LaunchImage.imageset/Contents.json new file mode 100644 index 000000000..0bedcf2fd --- /dev/null +++ b/packages/instabug_flutter/example/ios/Runner/Assets.xcassets/LaunchImage.imageset/Contents.json @@ -0,0 +1,23 @@ +{ + "images" : [ + { + "idiom" : "universal", + "filename" : "LaunchImage.png", + "scale" : "1x" + }, + { + "idiom" : "universal", + "filename" : "LaunchImage@2x.png", + "scale" : "2x" + }, + { + "idiom" : "universal", + "filename" : "LaunchImage@3x.png", + "scale" : "3x" + } + ], + "info" : { + "version" : 1, + "author" : "xcode" + } +} diff --git a/packages/instabug_flutter/example/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage.png b/packages/instabug_flutter/example/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage.png new file mode 100644 index 000000000..9da19eaca Binary files /dev/null and b/packages/instabug_flutter/example/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage.png differ diff --git a/packages/instabug_flutter/example/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@2x.png b/packages/instabug_flutter/example/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@2x.png new file mode 100644 index 000000000..9da19eaca Binary files /dev/null and b/packages/instabug_flutter/example/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@2x.png differ diff --git a/packages/instabug_flutter/example/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@3x.png b/packages/instabug_flutter/example/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@3x.png new file mode 100644 index 000000000..9da19eaca Binary files /dev/null and b/packages/instabug_flutter/example/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@3x.png differ diff --git a/packages/instabug_flutter/example/ios/Runner/Assets.xcassets/LaunchImage.imageset/README.md b/packages/instabug_flutter/example/ios/Runner/Assets.xcassets/LaunchImage.imageset/README.md new file mode 100644 index 000000000..89c2725b7 --- /dev/null +++ b/packages/instabug_flutter/example/ios/Runner/Assets.xcassets/LaunchImage.imageset/README.md @@ -0,0 +1,5 @@ +# Launch Screen Assets + +You can customize the launch screen with your own desired assets by replacing the image files in this directory. + +You can also do it by opening your Flutter project's Xcode project with `open ios/Runner.xcworkspace`, selecting `Runner/Assets.xcassets` in the Project Navigator and dropping in the desired images. \ No newline at end of file diff --git a/packages/instabug_flutter/example/ios/Runner/Base.lproj/LaunchScreen.storyboard b/packages/instabug_flutter/example/ios/Runner/Base.lproj/LaunchScreen.storyboard new file mode 100644 index 000000000..f2e259c7c --- /dev/null +++ b/packages/instabug_flutter/example/ios/Runner/Base.lproj/LaunchScreen.storyboard @@ -0,0 +1,37 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/packages/instabug_flutter/example/ios/Runner/Base.lproj/Main.storyboard b/packages/instabug_flutter/example/ios/Runner/Base.lproj/Main.storyboard new file mode 100644 index 000000000..f3c28516f --- /dev/null +++ b/packages/instabug_flutter/example/ios/Runner/Base.lproj/Main.storyboard @@ -0,0 +1,26 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/example/ios/Runner/Info.plist b/packages/instabug_flutter/example/ios/Runner/Info.plist similarity index 100% rename from example/ios/Runner/Info.plist rename to packages/instabug_flutter/example/ios/Runner/Info.plist diff --git a/example/ios/Runner/InstabugExampleMethodCallHandler.h b/packages/instabug_flutter/example/ios/Runner/InstabugExampleMethodCallHandler.h similarity index 100% rename from example/ios/Runner/InstabugExampleMethodCallHandler.h rename to packages/instabug_flutter/example/ios/Runner/InstabugExampleMethodCallHandler.h diff --git a/example/ios/Runner/InstabugExampleMethodCallHandler.m b/packages/instabug_flutter/example/ios/Runner/InstabugExampleMethodCallHandler.m similarity index 97% rename from example/ios/Runner/InstabugExampleMethodCallHandler.m rename to packages/instabug_flutter/example/ios/Runner/InstabugExampleMethodCallHandler.m index 6b1331587..3e4ee70d6 100644 --- a/example/ios/Runner/InstabugExampleMethodCallHandler.m +++ b/packages/instabug_flutter/example/ios/Runner/InstabugExampleMethodCallHandler.m @@ -1,7 +1,7 @@ #import #import "InstabugExampleMethodCallHandler.h" -#import -#import +#import +#import #import // MARK: - Private Interface diff --git a/example/ios/Runner/Runner-Bridging-Header.h b/packages/instabug_flutter/example/ios/Runner/Runner-Bridging-Header.h similarity index 100% rename from example/ios/Runner/Runner-Bridging-Header.h rename to packages/instabug_flutter/example/ios/Runner/Runner-Bridging-Header.h diff --git a/example/lib/main.dart b/packages/instabug_flutter/example/lib/main.dart similarity index 78% rename from example/lib/main.dart rename to packages/instabug_flutter/example/lib/main.dart index cda7ff3ec..b50053a91 100644 --- a/example/lib/main.dart +++ b/packages/instabug_flutter/example/lib/main.dart @@ -5,6 +5,8 @@ import 'dart:convert'; import 'package:flutter/material.dart'; import 'package:instabug_flutter/instabug_flutter.dart'; +import 'package:instabug_flutter_example/src/components/apm_switch.dart'; +import 'package:instabug_flutter_example/src/screens/private_view_page.dart'; import 'package:instabug_http_client/instabug_http_client.dart'; import 'package:instabug_flutter_example/src/app_routes.dart'; import 'package:instabug_flutter_example/src/widget/nested_view.dart'; @@ -18,6 +20,7 @@ import 'package:instabug_flutter/src/utils/screen_loading/screen_loading_manager import 'src/widget/section_title.dart'; part 'src/screens/crashes_page.dart'; +part 'src/screens/user_steps_page.dart'; part 'src/screens/complex_page.dart'; @@ -37,8 +40,6 @@ part 'src/components/network_content.dart'; part 'src/components/page.dart'; -part 'src/components/traces_content.dart'; - part 'src/components/flows_content.dart'; void main() { @@ -47,16 +48,22 @@ void main() { WidgetsFlutterBinding.ensureInitialized(); Instabug.init( - token: 'ed6f659591566da19b67857e1b9d40ab', - invocationEvents: [InvocationEvent.floatingButton], - debugLogsLevel: LogLevel.verbose, - ); + token: 'ed6f659591566da19b67857e1b9d40ab', + invocationEvents: [InvocationEvent.floatingButton], + debugLogsLevel: LogLevel.verbose, + appVariant: 'variant 1'); FlutterError.onError = (FlutterErrorDetails details) { Zone.current.handleUncaughtError(details.exception, details.stack!); }; - runApp(const MyApp()); + runApp( + const InstabugWidget(automasking: [ + AutoMasking.labels, + AutoMasking.textInputs, + AutoMasking.media + ], child: MyApp()), + ); }, CrashReporting.reportCrash, ); diff --git a/example/lib/src/app_routes.dart b/packages/instabug_flutter/example/lib/src/app_routes.dart similarity index 100% rename from example/lib/src/app_routes.dart rename to packages/instabug_flutter/example/lib/src/app_routes.dart diff --git a/packages/instabug_flutter/example/lib/src/components/apm_switch.dart b/packages/instabug_flutter/example/lib/src/components/apm_switch.dart new file mode 100644 index 000000000..df8dd6123 --- /dev/null +++ b/packages/instabug_flutter/example/lib/src/components/apm_switch.dart @@ -0,0 +1,33 @@ +import 'package:flutter/material.dart'; +import 'package:instabug_flutter/instabug_flutter.dart'; +import 'package:instabug_flutter_example/src/utils/show_messages.dart'; + +class APMSwitch extends StatefulWidget { + const APMSwitch({Key? key}) : super(key: key); + + @override + State createState() => _APMSwitchState(); +} + +class _APMSwitchState extends State { + bool isEnabled = false; + + @override + Widget build(BuildContext context) { + return Column( + children: [ + SwitchListTile.adaptive( + title: const Text('APM Enabled'), + value: isEnabled, + onChanged: (value) => onAPMChanged(context, value), + ), + ], + ); + } + + void onAPMChanged(BuildContext context, bool value) { + APM.setEnabled(value); + showSnackBar(context, "APM is ${value ? "enabled" : "disabled"}"); + setState(() => isEnabled = value); + } +} diff --git a/example/lib/src/components/fatal_crashes_content.dart b/packages/instabug_flutter/example/lib/src/components/fatal_crashes_content.dart similarity index 100% rename from example/lib/src/components/fatal_crashes_content.dart rename to packages/instabug_flutter/example/lib/src/components/fatal_crashes_content.dart diff --git a/example/lib/src/components/flows_content.dart b/packages/instabug_flutter/example/lib/src/components/flows_content.dart similarity index 100% rename from example/lib/src/components/flows_content.dart rename to packages/instabug_flutter/example/lib/src/components/flows_content.dart diff --git a/example/lib/src/components/network_content.dart b/packages/instabug_flutter/example/lib/src/components/network_content.dart similarity index 59% rename from example/lib/src/components/network_content.dart rename to packages/instabug_flutter/example/lib/src/components/network_content.dart index f55af5c95..d531e17bd 100644 --- a/example/lib/src/components/network_content.dart +++ b/packages/instabug_flutter/example/lib/src/components/network_content.dart @@ -18,22 +18,34 @@ class _NetworkContentState extends State { Widget build(BuildContext context) { return Column( children: [ - InstabugClipboardInput( - label: 'Endpoint Url', - controller: endpointUrlController, + InstabugPrivateView( + child: InstabugClipboardInput( + label: 'Endpoint Url', + controller: endpointUrlController, + ), ), InstabugButton( text: 'Send Request To Url', onPressed: () => _sendRequestToUrl(endpointUrlController.text), ), + Text("W3C Header Section"), + InstabugButton( + text: 'Send Request With Custom traceparent header', + onPressed: () => _sendRequestToUrl(endpointUrlController.text, + headers: {"traceparent": "Custom traceparent header"}), + ), + InstabugButton( + text: 'Send Request Without Custom traceparent header', + onPressed: () => _sendRequestToUrl(endpointUrlController.text), + ), ], ); } - void _sendRequestToUrl(String text) async { + void _sendRequestToUrl(String text, {Map? headers}) async { try { String url = text.trim().isEmpty ? widget.defaultRequestUrl : text; - final response = await http.get(Uri.parse(url)); + final response = await http.get(Uri.parse(url), headers: headers); // Handle the response here if (response.statusCode == 200) { diff --git a/example/lib/src/components/non_fatal_crashes_content.dart b/packages/instabug_flutter/example/lib/src/components/non_fatal_crashes_content.dart similarity index 100% rename from example/lib/src/components/non_fatal_crashes_content.dart rename to packages/instabug_flutter/example/lib/src/components/non_fatal_crashes_content.dart diff --git a/example/lib/src/components/page.dart b/packages/instabug_flutter/example/lib/src/components/page.dart similarity index 100% rename from example/lib/src/components/page.dart rename to packages/instabug_flutter/example/lib/src/components/page.dart diff --git a/example/lib/src/native/instabug_flutter_example_method_channel.dart b/packages/instabug_flutter/example/lib/src/native/instabug_flutter_example_method_channel.dart similarity index 80% rename from example/lib/src/native/instabug_flutter_example_method_channel.dart rename to packages/instabug_flutter/example/lib/src/native/instabug_flutter_example_method_channel.dart index 9507cc403..118097dc3 100644 --- a/example/lib/src/native/instabug_flutter_example_method_channel.dart +++ b/packages/instabug_flutter/example/lib/src/native/instabug_flutter_example_method_channel.dart @@ -54,6 +54,22 @@ class InstabugFlutterExampleMethodChannel { log("Failed to send out of memory: '${e.message}'.", name: _tag); } } + + static Future setFullscreen(bool isEnabled) async { + if (!Platform.isAndroid) { + return; + } + + try { + await _channel.invokeMethod(Constants.setFullscreenMethodName, { + 'isEnabled': isEnabled, + }); + } on PlatformException catch (e) { + log("Failed to set fullscreen: '${e.message}'.", name: _tag); + } catch (e) { + log("Unexpected error setting fullscreen: '$e'.", name: _tag); + } + } } class Constants { @@ -65,4 +81,5 @@ class Constants { static const sendNativeFatalHangMethodName = "sendNativeFatalHang"; static const sendAnrMethodName = "sendAnr"; static const sendOomMethodName = "sendOom"; + static const setFullscreenMethodName = "setFullscreen"; } diff --git a/example/lib/src/screens/apm_page.dart b/packages/instabug_flutter/example/lib/src/screens/apm_page.dart similarity index 86% rename from example/lib/src/screens/apm_page.dart rename to packages/instabug_flutter/example/lib/src/screens/apm_page.dart index 8580e203f..d4ad53ca6 100644 --- a/example/lib/src/screens/apm_page.dart +++ b/packages/instabug_flutter/example/lib/src/screens/apm_page.dart @@ -22,15 +22,20 @@ class _ApmPageState extends State { ); } + _endAppLaunch() => APM.endAppLaunch(); + @override Widget build(BuildContext context) { return Page( title: 'APM', children: [ + const APMSwitch(), + InstabugButton( + text: 'End App Launch', + onPressed: _endAppLaunch, + ), const SectionTitle('Network'), const NetworkContent(), - const SectionTitle('Traces'), - const TracesContent(), const SectionTitle('Flows'), const FlowsContent(), const SectionTitle('Screen Loading'), diff --git a/example/lib/src/screens/complex_page.dart b/packages/instabug_flutter/example/lib/src/screens/complex_page.dart similarity index 100% rename from example/lib/src/screens/complex_page.dart rename to packages/instabug_flutter/example/lib/src/screens/complex_page.dart diff --git a/example/lib/src/screens/crashes_page.dart b/packages/instabug_flutter/example/lib/src/screens/crashes_page.dart similarity index 100% rename from example/lib/src/screens/crashes_page.dart rename to packages/instabug_flutter/example/lib/src/screens/crashes_page.dart diff --git a/example/lib/src/screens/my_home_page.dart b/packages/instabug_flutter/example/lib/src/screens/my_home_page.dart similarity index 89% rename from example/lib/src/screens/my_home_page.dart rename to packages/instabug_flutter/example/lib/src/screens/my_home_page.dart index 404d79cdd..f0fc1d14b 100644 --- a/example/lib/src/screens/my_home_page.dart +++ b/packages/instabug_flutter/example/lib/src/screens/my_home_page.dart @@ -35,6 +35,10 @@ class _MyHomePageState extends State { BugReporting.setInvocationEvents([InvocationEvent.floatingButton]); } + void disableInstabug() { + Instabug.setEnabled(false); + } + void setOnDismissCallback() { BugReporting.setOnDismissCallback((dismissType, reportType) { showDialog( @@ -114,10 +118,10 @@ class _MyHomePageState extends State { BugReporting.setInvocationEvents([invocationEvent]); } - void changePrimaryColor() { - String text = 'FF' + primaryColorController.text.replaceAll('#', ''); - Color color = Color(int.parse(text, radix: 16)); - Instabug.setPrimaryColor(color); + void changePrimaryColor() async { + String text = primaryColorController.text.replaceAll('#', ''); + await Instabug.setTheme(ThemeConfig(primaryColor: '#$text')); + await Future.delayed(const Duration(milliseconds: 500)); } void setColorTheme(ColorTheme colorTheme) { @@ -161,6 +165,26 @@ class _MyHomePageState extends State { ); } + void _navigateToPrivateViewPage() { + Navigator.push( + context, + MaterialPageRoute( + builder: (context) => const PrivateViewPage(), + settings: const RouteSettings(name: PrivateViewPage.screenName), + ), + ); + } + + void _navigateToUserStepsPage() { + Navigator.push( + context, + MaterialPageRoute( + builder: (context) => const UserStepsPage(), + settings: const RouteSettings(name: UserStepsPage.screenName), + ), + ); + } + @override Widget build(BuildContext context) { return Page( @@ -178,6 +202,10 @@ class _MyHomePageState extends State { onPressed: restartInstabug, text: 'Restart Instabug', ), + InstabugButton( + onPressed: disableInstabug, + text: 'Disable Instabug', + ), const SectionTitle('Primary Color'), InstabugTextField( controller: primaryColorController, @@ -290,9 +318,11 @@ class _MyHomePageState extends State { onPressed: showManualSurvey, text: 'Show Multiple Questions Survey', ), - InstabugButton( - onPressed: showFeatureRequests, - text: 'Show Feature Requests', + InstabugPrivateView( + child: InstabugButton( + onPressed: showFeatureRequests, + text: 'Show Feature Requests', + ), ), InstabugButton( onPressed: _navigateToCrashes, @@ -306,6 +336,10 @@ class _MyHomePageState extends State { onPressed: _navigateToComplex, text: 'Complex', ), + InstabugButton( + onPressed: _navigateToPrivateViewPage, + text: 'Private views', + ), const SectionTitle('Sessions Replay'), InstabugButton( onPressed: getCurrentSessionReplaylink, @@ -334,6 +368,10 @@ class _MyHomePageState extends State { ), ], ), + InstabugButton( + text: 'User Steps', + onPressed: _navigateToUserStepsPage, + ), SectionTitle('FeatureFlags'), InstabugTextField( controller: featureFlagsController, diff --git a/packages/instabug_flutter/example/lib/src/screens/private_view_page.dart b/packages/instabug_flutter/example/lib/src/screens/private_view_page.dart new file mode 100644 index 000000000..5b7829e65 --- /dev/null +++ b/packages/instabug_flutter/example/lib/src/screens/private_view_page.dart @@ -0,0 +1,258 @@ +import 'package:flutter/material.dart'; +import 'package:instabug_flutter/instabug_flutter.dart'; +import 'package:instabug_flutter_example/src/widget/section_title.dart'; +import 'package:video_player/video_player.dart'; + +class PrivateViewPage extends StatefulWidget { + static const screenName = 'private'; + + const PrivateViewPage({Key? key}) : super(key: key); + + @override + _PrivateViewPageState createState() => _PrivateViewPageState(); +} + +class _PrivateViewPageState extends State { + late VideoPlayerController _controller; + double _currentSliderValue = 20.0; + + RangeValues _currentRangeValues = const RangeValues(40, 80); + + String? _sliderStatus; + + bool? isChecked = true; + + int? _selectedValue = 1; + + bool light = true; + double _scale = 1.0; // Initial scale of the image + + TextEditingController _controller2 = TextEditingController(); + + String _currentValue = ''; + List _items = List.generate(20, (index) => 'Item ${index + 1}'); + + @override + void initState() { + super.initState(); + _controller = VideoPlayerController.networkUrl( + Uri.parse( + 'https://flutter.github.io/assets-for-api-docs/assets/videos/bee.mp4'), + )..initialize().then((_) { + setState(() {}); + }); + _controller2.addListener(() { + setState(() { + _currentValue = _controller2.text; + }); + }); + } + + @override + void dispose() { + _controller.dispose(); + super.dispose(); + } + + void _handleRadioValueChanged(int? value) { + setState(() { + _selectedValue = value; + }); + } + + int count = 200; + final list = List.generate( + 20, + (_) => InstabugPrivateView( + child: Container( + margin: const EdgeInsets.all(2), + width: 4, + height: 4, + color: Colors.red, + ), + )); + @override + Widget build(BuildContext context) { + return Scaffold( + appBar: AppBar(title: const Text("Private Views page")), + body: SingleChildScrollView( + child: Padding( + padding: const EdgeInsets.all(8.0), + child: Column( + crossAxisAlignment: CrossAxisAlignment.center, + children: [ + const SizedBox(height: 16), + const InstabugPrivateView( + child: Text( + 'Private TextView', + style: TextStyle(fontSize: 18), + textAlign: TextAlign.center, + ), + ), + const SizedBox(height: 16), + Wrap( + children: list, + ), + const SizedBox(height: 16), + InstabugPrivateView( + child: ElevatedButton( + onPressed: () { + const snackBar = SnackBar( + content: Text('Hello, you clicked on a private button'), + ); + ScaffoldMessenger.of(context).showSnackBar(snackBar); + }, + child: const Text('I am a private button'), + ), + ), + const SizedBox(height: 16), + const BackButton(), + const SectionTitle('TextInput'), + Column( + children: [ + Padding( + padding: const EdgeInsets.all(16.0), + // Set the padding value + child: Column( + children: [ + TextField( + key: const Key('text_field'), + controller: _controller2, + // Bind the controller to the TextField + decoration: const InputDecoration( + labelText: + "Type something in a text field with key", + border: OutlineInputBorder(), + ), + ), + InstabugPrivateView( + child: TextField( + controller: _controller2, + // Bind the controller to the TextField + decoration: const InputDecoration( + labelText: "Private view", + border: OutlineInputBorder(), + ), + ), + ), + InstabugPrivateView( + child: TextField( + controller: _controller2, + // Bind the controller to the TextField + obscureText: true, + decoration: const InputDecoration( + border: OutlineInputBorder(), + labelText: 'Password', + ), + ), + ), + TextFormField( + obscureText: true, + controller: _controller2, + // Bind the controller to the TextField + decoration: const InputDecoration( + icon: Icon(Icons.person), + hintText: 'What do people call you?', + labelText: 'Name *', + ), + onSaved: (String? value) { + // This optional block of code can be used to run + // code when the user saves the form. + }, + validator: (String? value) { + return (value != null && value.contains('@')) + ? 'Do not use the @ char.' + : null; + }, + ), + ], + ), + ), + ], + ), + InstabugPrivateView( + child: Image.asset( + 'assets/img.png', + // Add this image to your assets folder + height: 100, + ), + ), + const SizedBox(height: 33), + const InstabugPrivateView( + child: TextField( + obscureText: true, + decoration: InputDecoration( + hintText: 'password', + labelText: 'Password', + border: OutlineInputBorder(), + ), + ), + ), + const SizedBox(height: 16), + const TextField( + keyboardType: TextInputType.emailAddress, + decoration: InputDecoration( + hintText: 'Email', + labelText: 'Email', + border: OutlineInputBorder(), + ), + ), + const SizedBox(height: 16), + const Column( + children: [ + InstabugPrivateView( + child: Text( + 'Private TextView in column', + style: TextStyle(fontSize: 18), + textAlign: TextAlign.center, + ), + ), + SizedBox( + height: 10, + ), + Text( + 'TextView in column', + style: TextStyle(fontSize: 18), + textAlign: TextAlign.center, + ), + ], + ), + const SizedBox(height: 24), + Container( + height: 300, + child: _controller.value.isInitialized + ? AspectRatio( + aspectRatio: _controller.value.aspectRatio, + child: VideoPlayer(_controller), + ) + : const Center(child: CircularProgressIndicator()), + ), + const SizedBox(height: 24), + const SizedBox(height: 24), + const SizedBox(height: 24), + SizedBox( + height: 200, + child: CustomScrollView( + slivers: [ + InstabugSliverPrivateView( + sliver: SliverToBoxAdapter( + child: Container( + color: Colors.red, + child: const Text( + "Private Sliver Widget", + style: TextStyle(fontSize: 18), + textAlign: TextAlign.center, + ), + ), + ), + ) + ], + ), + ) + ], + ), + ), + ), + ); + } +} diff --git a/example/lib/src/screens/screen_capture_premature_extension_page.dart b/packages/instabug_flutter/example/lib/src/screens/screen_capture_premature_extension_page.dart similarity index 100% rename from example/lib/src/screens/screen_capture_premature_extension_page.dart rename to packages/instabug_flutter/example/lib/src/screens/screen_capture_premature_extension_page.dart diff --git a/example/lib/src/screens/screen_loading_page.dart b/packages/instabug_flutter/example/lib/src/screens/screen_loading_page.dart similarity index 100% rename from example/lib/src/screens/screen_loading_page.dart rename to packages/instabug_flutter/example/lib/src/screens/screen_loading_page.dart diff --git a/packages/instabug_flutter/example/lib/src/screens/user_steps_page.dart b/packages/instabug_flutter/example/lib/src/screens/user_steps_page.dart new file mode 100644 index 000000000..f97cfacc2 --- /dev/null +++ b/packages/instabug_flutter/example/lib/src/screens/user_steps_page.dart @@ -0,0 +1,262 @@ +part of '../../main.dart'; + +class UserStepsPage extends StatefulWidget { + static const screenName = 'user_steps'; + + const UserStepsPage({Key? key}) : super(key: key); + + @override + _UserStepsPageState createState() => _UserStepsPageState(); +} + +class _UserStepsPageState extends State { + double _currentSliderValue = 20.0; + + RangeValues _currentRangeValues = const RangeValues(40, 80); + + String? _sliderStatus; + + bool? isChecked = true; + + int? _selectedValue = 1; + + bool light = true; + double _scale = 1.0; // Initial scale of the image + + TextEditingController _controller = TextEditingController(); + + String _currentValue = ''; + List _items = List.generate(20, (index) => 'Item ${index + 1}'); + + @override + void initState() { + super.initState(); + + _controller.addListener(() { + setState(() { + _currentValue = _controller.text; + }); + }); + } + + void _handleRadioValueChanged(int? value) { + setState(() { + _selectedValue = value; + }); + } + + @override + Widget build(BuildContext context) { + return Page( + title: 'User Steps', + children: [ + BackButton(), + NotificationListener( + onNotification: (ScrollNotification notification) { + return false; + }, + child: SingleChildScrollView( + scrollDirection: Axis.horizontal, + child: Row( + children: List.generate( + 100, + (_) => InkWell( + onTap: () {}, + child: Container( + width: 100, + height: 100, + color: Colors.red, + margin: EdgeInsets.all(8), + ), + ), + ), + ), + ), + ), + SectionTitle('Sliders'), + Slider( + value: _currentSliderValue, + max: 100, + divisions: 5, + label: _currentSliderValue.round().toString(), + onChanged: (double value) { + setState(() { + _currentSliderValue = value; + }); + }, + ), + RangeSlider( + values: _currentRangeValues, + max: 100, + divisions: 5, + labels: RangeLabels( + _currentRangeValues.start.round().toString(), + _currentRangeValues.end.round().toString(), + ), + onChanged: (RangeValues values) { + setState(() { + _currentRangeValues = values; + }); + }, + ), + SectionTitle('Images'), + Row( + children: [ + Image.asset( + 'assets/img.png', + height: 100, + ), + Image.network( + "https://t3.ftcdn.net/jpg/00/50/07/64/360_F_50076454_TCvZEw37VyB5ZhcwEjkJHddtuV1cFmKY.jpg", + height: 100, + ), + ], + ), + InstabugButton(text: "I'm a button"), + ElevatedButton(onPressed: () {}, child: Text("data")), + SectionTitle('Toggles'), + Row( + children: [ + Checkbox( + tristate: true, + value: isChecked, + onChanged: (bool? value) { + setState(() { + isChecked = value; + }); + }, + ), + Radio( + value: 0, + groupValue: _selectedValue, + onChanged: _handleRadioValueChanged, + ), + Switch( + value: light, + activeColor: Colors.red, + onChanged: (bool value) { + setState(() { + light = value; + }); + }, + ), + ], + ), + GestureDetector( + onScaleUpdate: (details) { + setState(() { + _scale = details.scale; + _scale = _scale.clamp(1.0, + 3.0); // Limit zoom between 1x and 3x// Update scale based on pinch gesture + }); + }, + onScaleEnd: (details) { + // You can add logic to reset or clamp the scale if needed + if (_scale < 1.0) { + _scale = 1.0; // Prevent shrinking below original size + } + }, + child: Transform.scale( + scale: _scale, // Apply the scale transformation + child: Image.asset( + "assets/img.png", + height: 300, + ), + ), + ), + SectionTitle('TextInput'), + Column( + children: [ + Padding( + padding: EdgeInsets.all(16.0), // Set the padding value + child: Column( + children: [ + TextField( + key: Key('text_field'), + controller: _controller, + // Bind the controller to the TextField + decoration: InputDecoration( + labelText: "Type something in a text field with key", + border: OutlineInputBorder(), + ), + ), + TextField( + controller: _controller, + // Bind the controller to the TextField + decoration: InputDecoration( + labelText: "Private view", + border: OutlineInputBorder(), + ), + ), + TextField( + controller: _controller, + // Bind the controller to the TextField + obscureText: true, + decoration: InputDecoration( + border: OutlineInputBorder(), + labelText: 'Password', + ), + ), + TextFormField( + obscureText: true, + controller: _controller, + // Bind the controller to the TextField + decoration: const InputDecoration( + icon: Icon(Icons.person), + hintText: 'What do people call you?', + labelText: 'Name *', + ), + onSaved: (String? value) { + // This optional block of code can be used to run + // code when the user saves the form. + }, + validator: (String? value) { + return (value != null && value.contains('@')) + ? 'Do not use the @ char.' + : null; + }, + ), + ], + ), + ), + ListView.builder( + itemCount: _items.length, + shrinkWrap: true, + itemBuilder: (context, index) { + return Dismissible( + key: Key(_items[index]), + // Unique key for each item + onDismissed: (direction) { + // Remove the item from the list + setState(() { + _items.removeAt(index); + }); + + // Show a snackbar or other UI feedback on dismissal + ScaffoldMessenger.of(context).showSnackBar( + SnackBar(content: Text('Item dismissed')), + ); + }, + background: Container(color: Colors.red), + // Background color when swiped + direction: DismissDirection.endToStart, + // Swipe direction (left to right) + child: ListTile( + title: Text(_items[index]), + ), + ); + }, + ), + ], + ), + ], + ); + } + + @override + void dispose() { + _controller + .dispose(); // Dispose of the controller when the widget is destroyed + super.dispose(); + } +} diff --git a/packages/instabug_flutter/example/lib/src/utils/show_messages.dart b/packages/instabug_flutter/example/lib/src/utils/show_messages.dart new file mode 100644 index 000000000..2bb62b05f --- /dev/null +++ b/packages/instabug_flutter/example/lib/src/utils/show_messages.dart @@ -0,0 +1,11 @@ +import 'package:flutter/material.dart'; + +void showSnackBar(BuildContext context, String message) { + final messenger = ScaffoldMessenger.of(context); + messenger.clearSnackBars(); + messenger.showSnackBar( + SnackBar( + content: Text(message), + ), + ); +} diff --git a/example/lib/src/widget/instabug_button.dart b/packages/instabug_flutter/example/lib/src/widget/instabug_button.dart similarity index 100% rename from example/lib/src/widget/instabug_button.dart rename to packages/instabug_flutter/example/lib/src/widget/instabug_button.dart diff --git a/example/lib/src/widget/instabug_clipboard_icon_button.dart b/packages/instabug_flutter/example/lib/src/widget/instabug_clipboard_icon_button.dart similarity index 100% rename from example/lib/src/widget/instabug_clipboard_icon_button.dart rename to packages/instabug_flutter/example/lib/src/widget/instabug_clipboard_icon_button.dart diff --git a/example/lib/src/widget/instabug_clipboard_input.dart b/packages/instabug_flutter/example/lib/src/widget/instabug_clipboard_input.dart similarity index 100% rename from example/lib/src/widget/instabug_clipboard_input.dart rename to packages/instabug_flutter/example/lib/src/widget/instabug_clipboard_input.dart diff --git a/example/lib/src/widget/instabug_text_field.dart b/packages/instabug_flutter/example/lib/src/widget/instabug_text_field.dart similarity index 100% rename from example/lib/src/widget/instabug_text_field.dart rename to packages/instabug_flutter/example/lib/src/widget/instabug_text_field.dart diff --git a/example/lib/src/widget/nested_view.dart b/packages/instabug_flutter/example/lib/src/widget/nested_view.dart similarity index 77% rename from example/lib/src/widget/nested_view.dart rename to packages/instabug_flutter/example/lib/src/widget/nested_view.dart index e61099f8c..8ef9e46ad 100644 --- a/example/lib/src/widget/nested_view.dart +++ b/packages/instabug_flutter/example/lib/src/widget/nested_view.dart @@ -1,4 +1,5 @@ import 'package:flutter/material.dart'; +import 'package:instabug_flutter/instabug_flutter.dart'; import 'package:instabug_flutter_example/main.dart'; class NestedView extends StatelessWidget { @@ -31,10 +32,12 @@ class NestedView extends StatelessWidget { Row( children: List.generate( breadth, - (index) => NestedView( - depth: depth - 1, - breadth: breadth, - child: child, + (index) => InstabugPrivateView( + child: NestedView( + depth: depth - 1, + breadth: breadth, + child: child, + ), ), ), ), diff --git a/example/lib/src/widget/section_title.dart b/packages/instabug_flutter/example/lib/src/widget/section_title.dart similarity index 100% rename from example/lib/src/widget/section_title.dart rename to packages/instabug_flutter/example/lib/src/widget/section_title.dart diff --git a/packages/instabug_flutter/example/pubspec.lock b/packages/instabug_flutter/example/pubspec.lock new file mode 100644 index 000000000..82d164c46 --- /dev/null +++ b/packages/instabug_flutter/example/pubspec.lock @@ -0,0 +1,370 @@ +# Generated by pub +# See https://dart.dev/tools/pub/glossary#lockfile +packages: + async: + dependency: transitive + description: + name: async + sha256: "947bfcf187f74dbc5e146c9eb9c0f10c9f8b30743e341481c1e2ed3ecc18c20c" + url: "https://pub.dev" + source: hosted + version: "2.11.0" + boolean_selector: + dependency: transitive + description: + name: boolean_selector + sha256: "6cfb5af12253eaf2b368f07bacc5a80d1301a071c73360d746b7f2e32d762c66" + url: "https://pub.dev" + source: hosted + version: "2.1.1" + characters: + dependency: transitive + description: + name: characters + sha256: "04a925763edad70e8443c99234dc3328f442e811f1d8fd1a72f1c8ad0f69a605" + url: "https://pub.dev" + source: hosted + version: "1.3.0" + clock: + dependency: transitive + description: + name: clock + sha256: cb6d7f03e1de671e34607e909a7213e31d7752be4fb66a86d29fe1eb14bfb5cf + url: "https://pub.dev" + source: hosted + version: "1.1.1" + collection: + dependency: transitive + description: + name: collection + sha256: a1ace0a119f20aabc852d165077c036cd864315bd99b7eaa10a60100341941bf + url: "https://pub.dev" + source: hosted + version: "1.19.0" + csslib: + dependency: transitive + description: + name: csslib + sha256: "09bad715f418841f976c77db72d5398dc1253c21fb9c0c7f0b0b985860b2d58e" + url: "https://pub.dev" + source: hosted + version: "1.0.2" + fake_async: + dependency: transitive + description: + name: fake_async + sha256: "511392330127add0b769b75a987850d136345d9227c6b94c96a04cf4a391bf78" + url: "https://pub.dev" + source: hosted + version: "1.3.1" + file: + dependency: transitive + description: + name: file + sha256: "5fc22d7c25582e38ad9a8515372cd9a93834027aacf1801cf01164dac0ffa08c" + url: "https://pub.dev" + source: hosted + version: "7.0.0" + flutter: + dependency: "direct main" + description: flutter + source: sdk + version: "0.0.0" + flutter_driver: + dependency: "direct dev" + description: flutter + source: sdk + version: "0.0.0" + flutter_lints: + dependency: "direct dev" + description: + name: flutter_lints + sha256: b543301ad291598523947dc534aaddc5aaad597b709d2426d3a0e0d44c5cb493 + url: "https://pub.dev" + source: hosted + version: "1.0.4" + flutter_test: + dependency: "direct dev" + description: flutter + source: sdk + version: "0.0.0" + flutter_web_plugins: + dependency: transitive + description: flutter + source: sdk + version: "0.0.0" + fuchsia_remote_debug_protocol: + dependency: transitive + description: flutter + source: sdk + version: "0.0.0" + html: + dependency: transitive + description: + name: html + sha256: "6d1264f2dffa1b1101c25a91dff0dc2daee4c18e87cd8538729773c073dbf602" + url: "https://pub.dev" + source: hosted + version: "0.15.6" + http: + dependency: "direct main" + description: + name: http + sha256: "5895291c13fa8a3bd82e76d5627f69e0d85ca6a30dcac95c4ea19a5d555879c2" + url: "https://pub.dev" + source: hosted + version: "0.13.6" + http_parser: + dependency: transitive + description: + name: http_parser + sha256: "2aa08ce0341cc9b354a498388e30986515406668dbcc4f7c950c3e715496693b" + url: "https://pub.dev" + source: hosted + version: "4.0.2" + instabug_flutter: + dependency: "direct main" + description: + path: ".." + relative: true + source: path + version: "15.0.2" + instabug_http_client: + dependency: "direct main" + description: + path: "../../instabug_http_client" + relative: true + source: path + version: "2.6.0" + leak_tracker: + dependency: transitive + description: + name: leak_tracker + sha256: "7bb2830ebd849694d1ec25bf1f44582d6ac531a57a365a803a6034ff751d2d06" + url: "https://pub.dev" + source: hosted + version: "10.0.7" + leak_tracker_flutter_testing: + dependency: transitive + description: + name: leak_tracker_flutter_testing + sha256: "9491a714cca3667b60b5c420da8217e6de0d1ba7a5ec322fab01758f6998f379" + url: "https://pub.dev" + source: hosted + version: "3.0.8" + leak_tracker_testing: + dependency: transitive + description: + name: leak_tracker_testing + sha256: "6ba465d5d76e67ddf503e1161d1f4a6bc42306f9d66ca1e8f079a47290fb06d3" + url: "https://pub.dev" + source: hosted + version: "3.0.1" + lints: + dependency: transitive + description: + name: lints + sha256: a2c3d198cb5ea2e179926622d433331d8b58374ab8f29cdda6e863bd62fd369c + url: "https://pub.dev" + source: hosted + version: "1.0.1" + matcher: + dependency: transitive + description: + name: matcher + sha256: d2323aa2060500f906aa31a895b4030b6da3ebdcc5619d14ce1aada65cd161cb + url: "https://pub.dev" + source: hosted + version: "0.12.16+1" + material_color_utilities: + dependency: transitive + description: + name: material_color_utilities + sha256: f7142bb1154231d7ea5f96bc7bde4bda2a0945d2806bb11670e30b850d56bdec + url: "https://pub.dev" + source: hosted + version: "0.11.1" + meta: + dependency: transitive + description: + name: meta + sha256: bdb68674043280c3428e9ec998512fb681678676b3c54e773629ffe74419f8c7 + url: "https://pub.dev" + source: hosted + version: "1.15.0" + path: + dependency: transitive + description: + name: path + sha256: "087ce49c3f0dc39180befefc60fdb4acd8f8620e5682fe2476afd0b3688bb4af" + url: "https://pub.dev" + source: hosted + version: "1.9.0" + platform: + dependency: transitive + description: + name: platform + sha256: "9b71283fc13df574056616011fb138fd3b793ea47cc509c189a6c3fa5f8a1a65" + url: "https://pub.dev" + source: hosted + version: "3.1.5" + plugin_platform_interface: + dependency: transitive + description: + name: plugin_platform_interface + sha256: "4820fbfdb9478b1ebae27888254d445073732dae3d6ea81f0b7e06d5dedc3f02" + url: "https://pub.dev" + source: hosted + version: "2.1.8" + process: + dependency: transitive + description: + name: process + sha256: "21e54fd2faf1b5bdd5102afd25012184a6793927648ea81eea80552ac9405b32" + url: "https://pub.dev" + source: hosted + version: "5.0.2" + sky_engine: + dependency: transitive + description: flutter + source: sdk + version: "0.0.0" + source_span: + dependency: transitive + description: + name: source_span + sha256: "53e943d4206a5e30df338fd4c6e7a077e02254531b138a15aec3bd143c1a8b3c" + url: "https://pub.dev" + source: hosted + version: "1.10.0" + stack_trace: + dependency: transitive + description: + name: stack_trace + sha256: "9f47fd3630d76be3ab26f0ee06d213679aa425996925ff3feffdec504931c377" + url: "https://pub.dev" + source: hosted + version: "1.12.0" + stream_channel: + dependency: transitive + description: + name: stream_channel + sha256: ba2aa5d8cc609d96bbb2899c28934f9e1af5cddbd60a827822ea467161eb54e7 + url: "https://pub.dev" + source: hosted + version: "2.1.2" + string_scanner: + dependency: transitive + description: + name: string_scanner + sha256: "688af5ed3402a4bde5b3a6c15fd768dbf2621a614950b17f04626c431ab3c4c3" + url: "https://pub.dev" + source: hosted + version: "1.3.0" + sync_http: + dependency: transitive + description: + name: sync_http + sha256: "7f0cd72eca000d2e026bcd6f990b81d0ca06022ef4e32fb257b30d3d1014a961" + url: "https://pub.dev" + source: hosted + version: "0.3.1" + term_glyph: + dependency: transitive + description: + name: term_glyph + sha256: a29248a84fbb7c79282b40b8c72a1209db169a2e0542bce341da992fe1bc7e84 + url: "https://pub.dev" + source: hosted + version: "1.2.1" + test_api: + dependency: transitive + description: + name: test_api + sha256: "664d3a9a64782fcdeb83ce9c6b39e78fd2971d4e37827b9b06c3aa1edc5e760c" + url: "https://pub.dev" + source: hosted + version: "0.7.3" + typed_data: + dependency: transitive + description: + name: typed_data + sha256: f9049c039ebfeb4cf7a7104a675823cd72dba8297f264b6637062516699fa006 + url: "https://pub.dev" + source: hosted + version: "1.4.0" + vector_math: + dependency: transitive + description: + name: vector_math + sha256: "80b3257d1492ce4d091729e3a67a60407d227c27241d6927be0130c98e741803" + url: "https://pub.dev" + source: hosted + version: "2.1.4" + video_player: + dependency: "direct main" + description: + name: video_player + sha256: "0d55b1f1a31e5ad4c4967bfaa8ade0240b07d20ee4af1dfef5f531056512961a" + url: "https://pub.dev" + source: hosted + version: "2.10.0" + video_player_android: + dependency: transitive + description: + name: video_player_android + sha256: "28dcc4122079f40f93a0965b3679aff1a5f4251cf79611bd8011f937eb6b69de" + url: "https://pub.dev" + source: hosted + version: "2.8.4" + video_player_avfoundation: + dependency: transitive + description: + name: video_player_avfoundation + sha256: f52261d11f97bf14c43e8ed5714f71d8ce4538552b8cc87f45e5d87d3c205e41 + url: "https://pub.dev" + source: hosted + version: "2.8.3" + video_player_platform_interface: + dependency: transitive + description: + name: video_player_platform_interface + sha256: cf2a1d29a284db648fd66cbd18aacc157f9862d77d2cc790f6f9678a46c1db5a + url: "https://pub.dev" + source: hosted + version: "6.4.0" + video_player_web: + dependency: transitive + description: + name: video_player_web + sha256: "9f3c00be2ef9b76a95d94ac5119fb843dca6f2c69e6c9968f6f2b6c9e7afbdeb" + url: "https://pub.dev" + source: hosted + version: "2.4.0" + vm_service: + dependency: transitive + description: + name: vm_service + sha256: f6be3ed8bd01289b34d679c2b62226f63c0e69f9fd2e50a6b3c1c729a961041b + url: "https://pub.dev" + source: hosted + version: "14.3.0" + web: + dependency: transitive + description: + name: web + sha256: "868d88a33d8a87b18ffc05f9f030ba328ffefba92d6c127917a2ba740f9cfe4a" + url: "https://pub.dev" + source: hosted + version: "1.1.1" + webdriver: + dependency: transitive + description: + name: webdriver + sha256: "3d773670966f02a646319410766d3b5e1037efb7f07cc68f844d5e06cd4d61c8" + url: "https://pub.dev" + source: hosted + version: "3.0.4" +sdks: + dart: ">=3.6.0 <4.0.0" + flutter: ">=3.27.0" diff --git a/example/pubspec.yaml b/packages/instabug_flutter/example/pubspec.yaml similarity index 95% rename from example/pubspec.yaml rename to packages/instabug_flutter/example/pubspec.yaml index 7f3e9e622..2f766b535 100644 --- a/example/pubspec.yaml +++ b/packages/instabug_flutter/example/pubspec.yaml @@ -27,9 +27,8 @@ dependencies: instabug_flutter: path: ../ instabug_http_client: ^2.4.0 - + video_player: dev_dependencies: - espresso: 0.2.0+5 flutter_driver: sdk: flutter flutter_test: @@ -52,6 +51,7 @@ flutter: # To add assets to your application, add an assets section, like this: # assets: + # - assets/fonts/ # - images/a_dot_burr.jpeg # - images/a_dot_ham.jpeg @@ -67,6 +67,9 @@ flutter: # list giving the asset and other descriptors for the font. For # example: # fonts: + # - family: ManufacturingConsent + # fonts: + # - asset: assets/fonts/ManufacturingConsent-Regular.ttf # - family: Schyler # fonts: # - asset: fonts/Schyler-Regular.ttf diff --git a/packages/instabug_flutter/example/pubspec_overrides.yaml b/packages/instabug_flutter/example/pubspec_overrides.yaml new file mode 100644 index 000000000..c41d20248 --- /dev/null +++ b/packages/instabug_flutter/example/pubspec_overrides.yaml @@ -0,0 +1,6 @@ +# melos_managed_dependency_overrides: instabug_flutter,instabug_http_client +dependency_overrides: + instabug_flutter: + path: ../ + instabug_http_client: + path: ../../instabug_http_client diff --git a/example/test_driver/example.dart b/packages/instabug_flutter/example/test_driver/example.dart similarity index 100% rename from example/test_driver/example.dart rename to packages/instabug_flutter/example/test_driver/example.dart diff --git a/ios/.gitignore b/packages/instabug_flutter/ios/.gitignore similarity index 100% rename from ios/.gitignore rename to packages/instabug_flutter/ios/.gitignore diff --git a/ios/Assets/.gitkeep b/packages/instabug_flutter/ios/Assets/.gitkeep similarity index 100% rename from ios/Assets/.gitkeep rename to packages/instabug_flutter/ios/Assets/.gitkeep diff --git a/ios/Classes/InstabugFlutterPlugin.h b/packages/instabug_flutter/ios/Classes/InstabugFlutterPlugin.h similarity index 100% rename from ios/Classes/InstabugFlutterPlugin.h rename to packages/instabug_flutter/ios/Classes/InstabugFlutterPlugin.h diff --git a/ios/Classes/InstabugFlutterPlugin.m b/packages/instabug_flutter/ios/Classes/InstabugFlutterPlugin.m similarity index 74% rename from ios/Classes/InstabugFlutterPlugin.m rename to packages/instabug_flutter/ios/Classes/InstabugFlutterPlugin.m index 9b9182ae7..12ab5a58b 100644 --- a/ios/Classes/InstabugFlutterPlugin.m +++ b/packages/instabug_flutter/ios/Classes/InstabugFlutterPlugin.m @@ -9,6 +9,8 @@ #import "RepliesApi.h" #import "SessionReplayApi.h" #import "SurveysApi.h" +#import "PrivateViewApi.h" +#import "PrivateViewHostApi.h" @implementation InstabugFlutterPlugin @@ -22,6 +24,9 @@ + (void)registerWithRegistrar:(NSObject *)registrar { InitRepliesApi([registrar messenger]); InitSessionReplayApi([registrar messenger]); InitSurveysApi([registrar messenger]); + PrivateViewApi* privateViewApi = InitPrivateViewApi([registrar messenger],registrar); + InitPrivateViewApi([registrar messenger], registrar); + InitPrivateViewHostApi([registrar messenger], privateViewApi); } @end diff --git a/ios/Classes/Modules/ApmApi.h b/packages/instabug_flutter/ios/Classes/Modules/ApmApi.h similarity index 100% rename from ios/Classes/Modules/ApmApi.h rename to packages/instabug_flutter/ios/Classes/Modules/ApmApi.h diff --git a/ios/Classes/Modules/ApmApi.m b/packages/instabug_flutter/ios/Classes/Modules/ApmApi.m similarity index 50% rename from ios/Classes/Modules/ApmApi.m rename to packages/instabug_flutter/ios/Classes/Modules/ApmApi.m index 83efce69d..a8c5c1bd3 100644 --- a/ios/Classes/Modules/ApmApi.m +++ b/packages/instabug_flutter/ios/Classes/Modules/ApmApi.m @@ -1,4 +1,4 @@ -#import "Instabug.h" +#import "InstabugSDK.h" #import "ApmApi.h" #import "ArgsRegistry.h" #import "IBGAPM+PrivateAPIs.h" @@ -19,10 +19,16 @@ - (instancetype)init { return self; } +// This method is setting the enabled state of the APM feature. It +// takes a boolean value wrapped in an NSNumber object as a parameter and sets the APM enabled state +// based on that value. The `IBGAPM.enabled` property is being set to the boolean value extracted from +// the NSNumber parameter using the `boolValue` method. - (void)setEnabledIsEnabled:(NSNumber *)isEnabled error:(FlutterError *_Nullable *_Nonnull)error { IBGAPM.enabled = [isEnabled boolValue]; } +// This method is used to check if the APM feature is enabled. +// `completion` handler is a way for implementing callback functionality. - (void)isEnabledWithCompletion:(nonnull void (^)(NSNumber * _Nullable, FlutterError * _Nullable))completion { BOOL isEnabled = IBGAPM.enabled; @@ -31,72 +37,74 @@ - (void)isEnabledWithCompletion:(nonnull void (^)(NSNumber * _Nullable, FlutterE completion(isEnabledNumber, nil); } +// This method is setting the enabled state of the screen loading feature in the APM module. +// It takes a boolean value wrapped in an NSNumber object as a parameter. +//The method then extracts the boolean value from the NSNumber parameter using the +// `boolValue` method and sets the screen loading enabled state in the APM module based on that value. - (void)setScreenLoadingEnabledIsEnabled:(nonnull NSNumber *)isEnabled error:(FlutterError * _Nullable __autoreleasing * _Nonnull)error { [IBGAPM setScreenLoadingEnabled:[isEnabled boolValue]]; } +// checks whether the screen loading feature is enabled. +//`completion` handler is a way for implementing callback functionality. - (void)isScreenLoadingEnabledWithCompletion:(nonnull void (^)(NSNumber * _Nullable, FlutterError * _Nullable))completion { BOOL isScreenLoadingEnabled = IBGAPM.screenLoadingEnabled; NSNumber *isEnabledNumber = @(isScreenLoadingEnabled); completion(isEnabledNumber, nil); } +// This method is setting the enabled state of the cold app launch feature in the APM module. It takes +// a boolean value wrapped in an NSNumber object as a parameter. The method then extracts the boolean +// value from the NSNumber parameter using the `boolValue` method and sets the cold app launch enabled +// state in the APM module based on that value. - (void)setColdAppLaunchEnabledIsEnabled:(NSNumber *)isEnabled error:(FlutterError *_Nullable *_Nonnull)error { IBGAPM.coldAppLaunchEnabled = [isEnabled boolValue]; } +// This method is setting the enabled state of the auto UI trace feature in the APM module. It takes a +// boolean value wrapped in an NSNumber object as a parameter. The method then extracts the boolean +// value from the NSNumber parameter using the `boolValue` method and sets the auto UI trace enabled +// state in the APM module based on that value. - (void)setAutoUITraceEnabledIsEnabled:(NSNumber *)isEnabled error:(FlutterError *_Nullable *_Nonnull)error { IBGAPM.autoUITraceEnabled = [isEnabled boolValue]; } -- (void)startExecutionTraceId:(NSString *)id name:(NSString *)name completion:(void(^)(NSString *_Nullable, FlutterError *_Nullable))completion { - IBGExecutionTrace *trace = [IBGAPM startExecutionTraceWithName:name]; - - if (trace != nil) { - [traces setObject:trace forKey:id]; - return completion(id, nil); - } else { - return completion(nil, nil); - } -} - -- (void)setExecutionTraceAttributeId:(NSString *)id key:(NSString *)key value:(NSString *)value error:(FlutterError *_Nullable *_Nonnull)error { - IBGExecutionTrace *trace = [traces objectForKey:id]; - - if (trace != nil) { - [trace setAttributeWithKey:key value:value]; - } -} - -- (void)endExecutionTraceId:(NSString *)id error:(FlutterError *_Nullable *_Nonnull)error { - IBGExecutionTrace *trace = [traces objectForKey:id]; - - if (trace != nil) { - [trace end]; - } -} +// This method is responsible for starting a flow with the given `name`. This functionality is used to +// track and monitor the performance of specific flows within the application. - (void)startFlowName:(nonnull NSString *)name error:(FlutterError * _Nullable __autoreleasing * _Nonnull)error { [IBGAPM startFlowWithName:name]; } +// This method sets an attribute for a specific flow identified by the +// provided `name`. It takes three parameters: +// 1. `name`: The name of the flow for which the attribute needs to be set. +// 2. `key`: The key of the attribute being set. +// 3. `value`: The value of the attribute being set. - (void)setFlowAttributeName:(nonnull NSString *)name key:(nonnull NSString *)key value:(nullable NSString *)value error:(FlutterError * _Nullable __autoreleasing * _Nonnull)error { [IBGAPM setAttributeForFlowWithName:name key:key value:value]; } +// This method is responsible for ending a flow with the given `name`. +// This functionality helps in monitoring and tracking the performance of different flows within the application. - (void)endFlowName:(nonnull NSString *)name error:(FlutterError * _Nullable __autoreleasing * _Nonnull)error { [IBGAPM endFlowWithName:name]; } +// This method is responsible for starting a UI trace with the given `name`. +// Which initiates the tracking of user interface interactions for monitoring the performance of the application. - (void)startUITraceName:(NSString *)name error:(FlutterError *_Nullable *_Nonnull)error { [IBGAPM startUITraceWithName:name]; } +// The method is responsible for ending the currently active UI trace. +// Which signifies the completion of tracking user interface interactions. - (void)endUITraceWithError:(FlutterError *_Nullable *_Nonnull)error { [IBGAPM endUITrace]; } +// The method is responsible for ending the app launch process in the APM module. - (void)endAppLaunchWithError:(FlutterError *_Nullable *_Nonnull)error { [IBGAPM endAppLaunch]; } @@ -106,6 +114,11 @@ - (void)networkLogAndroidData:(NSDictionary *)data error:(Flutte } +// This method is responsible for initiating a custom performance UI trace +// in the APM module. It takes three parameters: +// 1. `screenName`: A string representing the name of the screen or UI element being traced. +// 2. `microTimeStamp`: A number representing the timestamp in microseconds when the trace is started. +// 3. `traceId`: A number representing the unique identifier for the trace. - (void)startCpUiTraceScreenName:(nonnull NSString *)screenName microTimeStamp:(nonnull NSNumber *)microTimeStamp traceId:(nonnull NSNumber *)traceId error:(FlutterError * _Nullable __autoreleasing * _Nonnull)error { NSTimeInterval startTimeStampMUS = [microTimeStamp doubleValue]; [IBGAPM startUITraceCPWithName:screenName startTimestampMUS:startTimeStampMUS]; @@ -113,17 +126,33 @@ - (void)startCpUiTraceScreenName:(nonnull NSString *)screenName microTimeStamp:( +// This method is responsible for reporting the screen +// loading data from Dart side to iOS side. It takes three parameters: +// 1. `startTimeStampMicro`: A number representing the start timestamp in microseconds of the screen +// loading custom performance data. +// 2. `durationMicro`: A number representing the duration in microseconds of the screen loading custom +// performance data. +// 3. `uiTraceId`: A number representing the unique identifier for the UI trace associated with the +// screen loading. - (void)reportScreenLoadingCPStartTimeStampMicro:(nonnull NSNumber *)startTimeStampMicro durationMicro:(nonnull NSNumber *)durationMicro uiTraceId:(nonnull NSNumber *)uiTraceId error:(FlutterError * _Nullable __autoreleasing * _Nonnull)error { NSTimeInterval startTimeStampMicroMUS = [startTimeStampMicro doubleValue]; NSTimeInterval durationMUS = [durationMicro doubleValue]; [IBGAPM reportScreenLoadingCPWithStartTimestampMUS:startTimeStampMicroMUS durationMUS:durationMUS]; } +// This method is responsible for extend the end time if the screen loading custom +// trace. It takes two parameters: +// 1. `timeStampMicro`: A number representing the timestamp in microseconds when the screen loading +// custom trace is ending. +// 2. `uiTraceId`: A number representing the unique identifier for the UI trace associated with the +// screen loading. - (void)endScreenLoadingCPTimeStampMicro:(nonnull NSNumber *)timeStampMicro uiTraceId:(nonnull NSNumber *)uiTraceId error:(FlutterError * _Nullable __autoreleasing * _Nonnull)error { NSTimeInterval endScreenLoadingCPWithEndTimestampMUS = [timeStampMicro doubleValue]; [IBGAPM endScreenLoadingCPWithEndTimestampMUS:endScreenLoadingCPWithEndTimestampMUS]; } +// This method is used to check whether the end screen loading feature is enabled or not. +//`completion` handler is a way for implementing callback functionality. - (void)isEndScreenLoadingEnabledWithCompletion:(nonnull void (^)(NSNumber * _Nullable, FlutterError * _Nullable))completion { BOOL isEndScreenLoadingEnabled = IBGAPM.endScreenLoadingEnabled; NSNumber *isEnabledNumber = @(isEndScreenLoadingEnabled); diff --git a/ios/Classes/Modules/BugReportingApi.h b/packages/instabug_flutter/ios/Classes/Modules/BugReportingApi.h similarity index 100% rename from ios/Classes/Modules/BugReportingApi.h rename to packages/instabug_flutter/ios/Classes/Modules/BugReportingApi.h diff --git a/ios/Classes/Modules/BugReportingApi.m b/packages/instabug_flutter/ios/Classes/Modules/BugReportingApi.m similarity index 87% rename from ios/Classes/Modules/BugReportingApi.m rename to packages/instabug_flutter/ios/Classes/Modules/BugReportingApi.m index 3c914b789..7a92a9563 100644 --- a/ios/Classes/Modules/BugReportingApi.m +++ b/packages/instabug_flutter/ios/Classes/Modules/BugReportingApi.m @@ -1,5 +1,5 @@ #import -#import "Instabug.h" +#import "InstabugSDK.h" #import "BugReportingApi.h" #import "ArgsRegistry.h" @@ -151,8 +151,7 @@ - (void)setDisclaimerTextText:(NSString *)text error:(FlutterError *_Nullable *_ } - (void)setCommentMinimumCharacterCountLimit:(NSNumber *)limit reportTypes:(nullable NSArray *)reportTypes error:(FlutterError *_Nullable *_Nonnull)error { - IBGBugReportingReportType resolvedTypes = 0; - + IBGBugReportingType resolvedTypes = 0; if (![reportTypes count]) { resolvedTypes = (ArgsRegistry.reportTypes[@"ReportType.bug"]).integerValue | (ArgsRegistry.reportTypes[@"ReportType.feedback"]).integerValue | (ArgsRegistry.reportTypes[@"ReportType.question"]).integerValue; } @@ -162,7 +161,24 @@ - (void)setCommentMinimumCharacterCountLimit:(NSNumber *)limit reportTypes:(null } } - [IBGBugReporting setCommentMinimumCharacterCountForReportTypes:resolvedTypes withLimit:limit.intValue]; + [IBGBugReporting setCommentMinimumCharacterCount:[limit integerValue] forBugReportType:resolvedTypes]; +} + +- (void)addUserConsentsKey:(NSString *)key + description:(NSString *)description + mandatory:(NSNumber *)mandatory + checked:(NSNumber *)checked + actionType:(nullable NSString *)actionType + error:(FlutterError *_Nullable *_Nonnull)error { + + IBGActionType mappedActionType = (ArgsRegistry.userConsentActionTypes[actionType]).integerValue; + + [IBGBugReporting addUserConsentWithKey:key + description:description + mandatory:[mandatory boolValue] + checked:[checked boolValue] + actionType:mappedActionType]; } + @end diff --git a/ios/Classes/Modules/CrashReportingApi.h b/packages/instabug_flutter/ios/Classes/Modules/CrashReportingApi.h similarity index 100% rename from ios/Classes/Modules/CrashReportingApi.h rename to packages/instabug_flutter/ios/Classes/Modules/CrashReportingApi.h diff --git a/ios/Classes/Modules/CrashReportingApi.m b/packages/instabug_flutter/ios/Classes/Modules/CrashReportingApi.m similarity index 99% rename from ios/Classes/Modules/CrashReportingApi.m rename to packages/instabug_flutter/ios/Classes/Modules/CrashReportingApi.m index f36e821cf..0103aa766 100644 --- a/ios/Classes/Modules/CrashReportingApi.m +++ b/packages/instabug_flutter/ios/Classes/Modules/CrashReportingApi.m @@ -1,4 +1,4 @@ -#import "Instabug.h" +#import "InstabugSDK.h" #import "CrashReportingApi.h" #import "../Util/IBGCrashReporting+CP.h" #import "ArgsRegistry.h" diff --git a/ios/Classes/Modules/FeatureRequestsApi.h b/packages/instabug_flutter/ios/Classes/Modules/FeatureRequestsApi.h similarity index 100% rename from ios/Classes/Modules/FeatureRequestsApi.h rename to packages/instabug_flutter/ios/Classes/Modules/FeatureRequestsApi.h diff --git a/ios/Classes/Modules/FeatureRequestsApi.m b/packages/instabug_flutter/ios/Classes/Modules/FeatureRequestsApi.m similarity index 97% rename from ios/Classes/Modules/FeatureRequestsApi.m rename to packages/instabug_flutter/ios/Classes/Modules/FeatureRequestsApi.m index 391bdf06b..8c71bbddd 100644 --- a/ios/Classes/Modules/FeatureRequestsApi.m +++ b/packages/instabug_flutter/ios/Classes/Modules/FeatureRequestsApi.m @@ -1,4 +1,4 @@ -#import "Instabug.h" +#import "InstabugSDK.h" #import "FeatureRequestsApi.h" #import "ArgsRegistry.h" diff --git a/ios/Classes/Modules/InstabugApi.h b/packages/instabug_flutter/ios/Classes/Modules/InstabugApi.h similarity index 70% rename from ios/Classes/Modules/InstabugApi.h rename to packages/instabug_flutter/ios/Classes/Modules/InstabugApi.h index 7030617c9..777013ee0 100644 --- a/ios/Classes/Modules/InstabugApi.h +++ b/packages/instabug_flutter/ios/Classes/Modules/InstabugApi.h @@ -6,5 +6,6 @@ extern void InitInstabugApi(id messenger); - (UIImage *)getImageForAsset:(NSString *)assetName; - (UIFont *)getFontForAsset:(NSString *)assetName error:(FlutterError *_Nullable *_Nonnull)error; ++ (void)setScreenshotMaskingHandler:(nullable void (^)(UIImage *_Nonnull, void (^_Nonnull)(UIImage *_Nonnull)))maskingHandler; @end diff --git a/ios/Classes/Modules/InstabugApi.m b/packages/instabug_flutter/ios/Classes/Modules/InstabugApi.m similarity index 56% rename from ios/Classes/Modules/InstabugApi.m rename to packages/instabug_flutter/ios/Classes/Modules/InstabugApi.m index 11ea09354..93566ae88 100644 --- a/ios/Classes/Modules/InstabugApi.m +++ b/packages/instabug_flutter/ios/Classes/Modules/InstabugApi.m @@ -1,11 +1,13 @@ #import #import #import -#import "Instabug.h" +#import "InstabugSDK.h" #import "IBGNetworkLogger+CP.h" #import "InstabugApi.h" #import "ArgsRegistry.h" +#import "../Util/IBGAPM+PrivateAPIs.h" +#import "../Util/Instabug+CP.h" #define UIColorFromRGB(rgbValue) [UIColor colorWithRed:((float)((rgbValue & 0xFF0000) >> 16)) / 255.0 green:((float)((rgbValue & 0xFF00) >> 8)) / 255.0 blue:((float)(rgbValue & 0xFF)) / 255.0 alpha:((float)((rgbValue & 0xFF000000) >> 24)) / 255.0]; extern void InitInstabugApi(id messenger) { @@ -13,7 +15,9 @@ extern void InitInstabugApi(id messenger) { InstabugHostApiSetup(messenger, api); } -@implementation InstabugApi +@implementation InstabugApi { + NSMutableSet *_registeredFonts; +} - (void)setEnabledIsEnabled:(NSNumber *)isEnabled error:(FlutterError *_Nullable *_Nonnull)error { Instabug.enabled = [isEnabled boolValue]; @@ -28,7 +32,13 @@ - (nullable NSNumber *)isEnabledWithError:(FlutterError * _Nullable __autoreleas return @(Instabug.enabled); } -- (void)initToken:(NSString *)token invocationEvents:(NSArray *)invocationEvents debugLogsLevel:(NSString *)debugLogsLevel error:(FlutterError *_Nullable *_Nonnull)error { +- (void)initToken:(nonnull NSString *)token invocationEvents:(nonnull NSArray *)invocationEvents debugLogsLevel:(nonnull NSString *)debugLogsLevel appVariant:(nullable NSString *)appVariant error:(FlutterError * _Nullable __autoreleasing * _Nonnull)error { + + if(appVariant != nil){ + Instabug.appVariant = appVariant; + } + + SEL setPrivateApiSEL = NSSelectorFromString(@"setCurrentPlatform:"); if ([[Instabug class] respondsToSelector:setPrivateApiSEL]) { NSInteger *platformID = IBGPlatformFlutter; @@ -45,6 +55,7 @@ - (void)initToken:(NSString *)token invocationEvents:(NSArray *)invo IBGInvocationEvent resolvedEvents = 0; + for (NSString *event in invocationEvents) { resolvedEvents |= (ArgsRegistry.invocationEvents[event]).integerValue; } @@ -53,6 +64,7 @@ - (void)initToken:(NSString *)token invocationEvents:(NSArray *)invo [Instabug setSdkDebugLogsLevel:resolvedLogLevel]; [Instabug startWithToken:token invocationEvents:resolvedEvents]; + Instabug.sendEventsSwizzling = false; } - (void)showWithError:(FlutterError *_Nullable *_Nonnull)error { @@ -126,17 +138,7 @@ - (void)getTagsWithCompletion:(nonnull void (^)(NSArray * _Nullable, completion([Instabug getTags], nil); } -- (void)addExperimentsExperiments:(NSArray *)experiments error:(FlutterError *_Nullable *_Nonnull)error { - [Instabug addExperiments:experiments]; -} - -- (void)removeExperimentsExperiments:(NSArray *)experiments error:(FlutterError *_Nullable *_Nonnull)error { - [Instabug removeExperiments:experiments]; -} -- (void)clearAllExperimentsWithError:(FlutterError *_Nullable *_Nonnull)error { - [Instabug clearAllExperiments]; -} - (void)setUserAttributeValue:(NSString *)value key:(NSString *)key error:(FlutterError *_Nullable *_Nonnull)error { [Instabug setUserAttribute:value withKey:key]; @@ -162,7 +164,7 @@ - (void)setReproStepsConfigBugMode:(nullable NSString *)bugMode crashMode:(nulla if (crashMode != nil) { IBGUserStepsMode resolvedCrashMode = ArgsRegistry.reproModes[crashMode].integerValue; - [Instabug setReproStepsFor:IBGIssueTypeCrash withMode:resolvedCrashMode]; + [Instabug setReproStepsFor:IBGIssueTypeAllCrashes withMode:resolvedCrashMode]; } if (sessionReplayMode != nil) { @@ -279,12 +281,39 @@ - (void)networkLogData:(NSDictionary *)data error:(FlutterError NSString *gqlQueryName = nil; NSString *serverErrorMessage = nil; + NSNumber *isW3cHeaderFound = nil; + NSNumber *partialId = nil; + NSNumber *networkStartTimeInSeconds = nil; + NSString *w3CGeneratedHeader = nil; + NSString *w3CCaughtHeader = nil; + if (data[@"gqlQueryName"] != [NSNull null]) { gqlQueryName = data[@"gqlQueryName"]; } if (data[@"serverErrorMessage"] != [NSNull null]) { serverErrorMessage = data[@"serverErrorMessage"]; } + if (data[@"partialId"] != [NSNull null]) { + partialId = data[@"partialId"]; + } + + if (data[@"isW3cHeaderFound"] != [NSNull null]) { + isW3cHeaderFound = data[@"isW3cHeaderFound"]; + } + + if (data[@"networkStartTimeInSeconds"] != [NSNull null]) { + networkStartTimeInSeconds = data[@"networkStartTimeInSeconds"]; + } + + if (data[@"w3CGeneratedHeader"] != [NSNull null]) { + w3CGeneratedHeader = data[@"w3CGeneratedHeader"]; + } + + if (data[@"w3CCaughtHeader"] != [NSNull null]) { + w3CCaughtHeader = data[@"w3CCaughtHeader"]; + } + + [IBGNetworkLogger addNetworkLogWithUrl:url method:method @@ -302,11 +331,11 @@ - (void)networkLogData:(NSDictionary *)data error:(FlutterError duration:duration gqlQueryName:gqlQueryName serverErrorMessage:serverErrorMessage - isW3cCaughted:nil - partialID:nil - timestamp:nil - generatedW3CTraceparent:nil - caughtedW3CTraceparent:nil]; + isW3cCaughted:isW3cHeaderFound + partialID:partialId + timestamp:networkStartTimeInSeconds + generatedW3CTraceparent:w3CGeneratedHeader + caughtedW3CTraceparent:w3CCaughtHeader]; } - (void)willRedirectToStoreWithError:(FlutterError * _Nullable __autoreleasing *)error { @@ -348,5 +377,239 @@ - (void)removeFeatureFlagsFeatureFlags:(nonnull NSArray *)featureFla } } +- (void)registerFeatureFlagChangeListenerWithError:(FlutterError * _Nullable __autoreleasing * _Nonnull)error { + // Android only. We still need this method to exist to match the Pigeon-generated protocol. + +} + + +- (nullable NSDictionary *)isW3CFeatureFlagsEnabledWithError:(FlutterError * _Nullable __autoreleasing * _Nonnull)error { + NSDictionary *result= @{ + @"isW3cExternalTraceIDEnabled":[NSNumber numberWithBool:IBGNetworkLogger.w3ExternalTraceIDEnabled] , + @"isW3cExternalGeneratedHeaderEnabled":[NSNumber numberWithBool:IBGNetworkLogger.w3ExternalGeneratedHeaderEnabled] , + @"isW3cCaughtHeaderEnabled":[NSNumber numberWithBool:IBGNetworkLogger.w3CaughtHeaderEnabled] , + + }; + return result; +} + +- (void)logUserStepsGestureType:(NSString *)gestureType message:(NSString *)message viewName:(NSString *)viewName error:(FlutterError * _Nullable __autoreleasing *)error +{ + @try { + + IBGUIEventType event = ArgsRegistry.userStepsGesture[gestureType].integerValue; + IBGUserStep *userStep = [[IBGUserStep alloc] initWithEvent:event automatic: YES]; + + userStep = [userStep setMessage: message]; + userStep = [userStep setViewTypeName:viewName]; + [userStep logUserStep]; + } + @catch (NSException *exception) { + NSLog(@"%@", exception); + + } +} + + +- (void)setEnableUserStepsIsEnabled:(nonnull NSNumber *)isEnabled error:(FlutterError * _Nullable __autoreleasing * _Nonnull)error { + Instabug.trackUserSteps = isEnabled.boolValue; +} + +- (void)enableAutoMaskingAutoMasking:(nonnull NSArray *)autoMasking error:(FlutterError * _Nullable __autoreleasing * _Nonnull)error { + IBGAutoMaskScreenshotOption resolvedEvents = 0; + + for (NSString *event in autoMasking) { + resolvedEvents |= (ArgsRegistry.autoMasking[event]).integerValue; + } + + [Instabug setAutoMaskScreenshots: resolvedEvents]; + +} ++ (void)setScreenshotMaskingHandler:(nullable void (^)(UIImage * _Nonnull __strong, void (^ _Nonnull __strong)(UIImage * _Nonnull __strong)))maskingHandler { + [Instabug setScreenshotMaskingHandler:maskingHandler]; +} + +- (void)setNetworkLogBodyEnabledIsEnabled:(NSNumber *)isEnabled + error:(FlutterError *_Nullable *_Nonnull)error { + IBGNetworkLogger.logBodyEnabled = [isEnabled boolValue]; +} + + +- (void)setAppVariantAppVariant:(nonnull NSString *)appVariant error:(FlutterError * _Nullable __autoreleasing * _Nonnull)error { + + Instabug.appVariant = appVariant; + +} + + +- (void)setThemeThemeConfig:(NSDictionary *)themeConfig error:(FlutterError *_Nullable *_Nonnull)error { + IBGTheme *theme = [[IBGTheme alloc] init]; + + NSDictionary *colorMapping = @{ + @"primaryColor": ^(UIColor *color) { theme.primaryColor = color; }, + @"backgroundColor": ^(UIColor *color) { theme.backgroundColor = color; }, + @"titleTextColor": ^(UIColor *color) { theme.titleTextColor = color; }, + @"subtitleTextColor": ^(UIColor *color) { theme.subtitleTextColor = color; }, + @"primaryTextColor": ^(UIColor *color) { theme.primaryTextColor = color; }, + @"secondaryTextColor": ^(UIColor *color) { theme.secondaryTextColor = color; }, + @"callToActionTextColor": ^(UIColor *color) { theme.callToActionTextColor = color; }, + @"headerBackgroundColor": ^(UIColor *color) { theme.headerBackgroundColor = color; }, + @"footerBackgroundColor": ^(UIColor *color) { theme.footerBackgroundColor = color; }, + @"rowBackgroundColor": ^(UIColor *color) { theme.rowBackgroundColor = color; }, + @"selectedRowBackgroundColor": ^(UIColor *color) { theme.selectedRowBackgroundColor = color; }, + @"rowSeparatorColor": ^(UIColor *color) { theme.rowSeparatorColor = color; } + }; + + for (NSString *key in colorMapping) { + if (themeConfig[key]) { + NSString *colorString = themeConfig[key]; + UIColor *color = [self colorFromHexString:colorString]; + if (color) { + void (^setter)(UIColor *) = colorMapping[key]; + setter(color); + } + } + } + + [self setFontIfPresent:themeConfig[@"primaryFontPath"] ?: themeConfig[@"primaryFontAsset"] forTheme:theme type:@"primary"]; + [self setFontIfPresent:themeConfig[@"secondaryFontPath"] ?: themeConfig[@"secondaryFontAsset"] forTheme:theme type:@"secondary"]; + [self setFontIfPresent:themeConfig[@"ctaFontPath"] ?: themeConfig[@"ctaFontAsset"] forTheme:theme type:@"cta"]; + + Instabug.theme = theme; +} + +- (void)setFontIfPresent:(NSString *)fontPath forTheme:(IBGTheme *)theme type:(NSString *)type { + if (!fontPath || fontPath.length == 0 || !theme || !type) return; + + if (!_registeredFonts) { + _registeredFonts = [NSMutableSet set]; + } + + // Check if font is already registered + if ([_registeredFonts containsObject:fontPath]) { + UIFont *font = [UIFont fontWithName:fontPath size:UIFont.systemFontSize]; + if (font) { + [self setFont:font forTheme:theme type:type]; + } + return; + } + + // Try to load font from system fonts first + UIFont *font = [UIFont fontWithName:fontPath size:UIFont.systemFontSize]; + if (font) { + [_registeredFonts addObject:fontPath]; + [self setFont:font forTheme:theme type:type]; + return; + } + + // Try to load font from bundle + font = [self loadFontFromPath:fontPath]; + if (font) { + [_registeredFonts addObject:fontPath]; + [self setFont:font forTheme:theme type:type]; + } +} + +- (UIFont *)loadFontFromPath:(NSString *)fontPath { + NSString *fontFileName = [fontPath stringByDeletingPathExtension]; + NSArray *fontExtensions = @[@"ttf", @"otf", @"woff", @"woff2"]; + + // Find font file in bundle + NSString *fontFilePath = nil; + for (NSString *extension in fontExtensions) { + fontFilePath = [[NSBundle mainBundle] pathForResource:fontFileName ofType:extension]; + if (fontFilePath) break; + } + + if (!fontFilePath) { + return nil; + } + + // Load font data + NSData *fontData = [NSData dataWithContentsOfFile:fontFilePath]; + if (!fontData) { + return nil; + } + + // Create data provider + CGDataProviderRef provider = CGDataProviderCreateWithCFData((__bridge CFDataRef)fontData); + if (!provider) { + return nil; + } + + // Create CG font + CGFontRef cgFont = CGFontCreateWithDataProvider(provider); + CGDataProviderRelease(provider); + + if (!cgFont) { + return nil; + } + + // Register font + CFErrorRef error = NULL; + BOOL registered = CTFontManagerRegisterGraphicsFont(cgFont, &error); + + if (!registered) { + if (error) { + CFStringRef description = CFErrorCopyDescription(error); + CFRelease(description); + CFRelease(error); + } + CGFontRelease(cgFont); + return nil; + } + + // Get PostScript name and create UIFont + NSString *postScriptName = (__bridge_transfer NSString *)CGFontCopyPostScriptName(cgFont); + CGFontRelease(cgFont); + + if (!postScriptName) { + return nil; + } + + return [UIFont fontWithName:postScriptName size:UIFont.systemFontSize]; +} + +- (void)setFont:(UIFont *)font forTheme:(IBGTheme *)theme type:(NSString *)type { + if (!font || !theme || !type) return; + + if ([type isEqualToString:@"primary"]) { + theme.primaryTextFont = font; + } else if ([type isEqualToString:@"secondary"]) { + theme.secondaryTextFont = font; + } else if ([type isEqualToString:@"cta"]) { + theme.callToActionTextFont = font; + } +} + +- (UIColor *)colorFromHexString:(NSString *)hexString { + NSString *cleanString = [hexString stringByReplacingOccurrencesOfString:@"#" withString:@""]; + + if (cleanString.length == 6) { + unsigned int rgbValue = 0; + NSScanner *scanner = [NSScanner scannerWithString:cleanString]; + [scanner scanHexInt:&rgbValue]; + + return [UIColor colorWithRed:((rgbValue & 0xFF0000) >> 16) / 255.0 + green:((rgbValue & 0xFF00) >> 8) / 255.0 + blue:(rgbValue & 0xFF) / 255.0 + alpha:1.0]; + } else if (cleanString.length == 8) { + unsigned int rgbaValue = 0; + NSScanner *scanner = [NSScanner scannerWithString:cleanString]; + [scanner scanHexInt:&rgbaValue]; + + return [UIColor colorWithRed:((rgbaValue & 0xFF000000) >> 24) / 255.0 + green:((rgbaValue & 0xFF0000) >> 16) / 255.0 + blue:((rgbaValue & 0xFF00) >> 8) / 255.0 + alpha:(rgbaValue & 0xFF) / 255.0]; + } + + return [UIColor blackColor]; +} + +- (void)setFullscreenIsEnabled:(NSNumber *)isEnabled error:(FlutterError *_Nullable *_Nonnull)error { + // Empty implementation as requested +} @end diff --git a/ios/Classes/Modules/InstabugLogApi.h b/packages/instabug_flutter/ios/Classes/Modules/InstabugLogApi.h similarity index 100% rename from ios/Classes/Modules/InstabugLogApi.h rename to packages/instabug_flutter/ios/Classes/Modules/InstabugLogApi.h diff --git a/ios/Classes/Modules/InstabugLogApi.m b/packages/instabug_flutter/ios/Classes/Modules/InstabugLogApi.m similarity index 97% rename from ios/Classes/Modules/InstabugLogApi.m rename to packages/instabug_flutter/ios/Classes/Modules/InstabugLogApi.m index 0ae811219..64e62ed2c 100644 --- a/ios/Classes/Modules/InstabugLogApi.m +++ b/packages/instabug_flutter/ios/Classes/Modules/InstabugLogApi.m @@ -1,4 +1,4 @@ -#import "Instabug.h" +#import "InstabugSDK.h" #import "InstabugLogApi.h" extern void InitInstabugLogApi(id messenger) { diff --git a/packages/instabug_flutter/ios/Classes/Modules/PrivateViewApi.h b/packages/instabug_flutter/ios/Classes/Modules/PrivateViewApi.h new file mode 100644 index 000000000..80aa0bd36 --- /dev/null +++ b/packages/instabug_flutter/ios/Classes/Modules/PrivateViewApi.h @@ -0,0 +1,34 @@ +#import +#import "InstabugPrivateViewPigeon.h" +#import + + +@interface PrivateViewApi : NSObject + +@property (nonatomic, strong) InstabugPrivateViewFlutterApi *flutterApi; +@property (nonatomic, strong) NSObject * flutterEngineRegistrar; + +- (instancetype)initWithFlutterApi:(InstabugPrivateViewFlutterApi *)api + registrar:(NSObject *)registrar; + +- (void)mask:(UIImage *)screenshot + completion:(void (^)(UIImage *maskedImage))completion; +- (void)handlePrivateViewsResult:(NSArray *)rectangles + error:(FlutterError *)error + screenshot:(UIImage *)screenshot + completion:(void (^)(UIImage *))completion; +- (NSArray *)convertToRectangles:(NSArray *)rectangles; + +- (UIImage *)drawMaskedImage:(UIImage *)screenshot withPrivateViews:(NSArray *)privateViews; +- (CGPoint)getFlutterViewOrigin; + +- (void)logError:(FlutterError *)error; + +@end + +// Extern function to initialize PrivateViewApi +extern PrivateViewApi* InitPrivateViewApi( + id messenger, + NSObject *flutterEngineRegistrar +); + diff --git a/packages/instabug_flutter/ios/Classes/Modules/PrivateViewApi.m b/packages/instabug_flutter/ios/Classes/Modules/PrivateViewApi.m new file mode 100644 index 000000000..be3e988a4 --- /dev/null +++ b/packages/instabug_flutter/ios/Classes/Modules/PrivateViewApi.m @@ -0,0 +1,144 @@ +#import "PrivateViewApi.h" +#import "../Util/FlutterPluginRegistrar+FlutterEngine.h" + +extern PrivateViewApi* InitPrivateViewApi( + id messenger, + NSObject *flutterEngineRegistrar +) { + InstabugPrivateViewFlutterApi *flutterApi = [[InstabugPrivateViewFlutterApi alloc] initWithBinaryMessenger:messenger]; + return [[PrivateViewApi alloc] initWithFlutterApi:flutterApi registrar:flutterEngineRegistrar]; +} + +@implementation PrivateViewApi + +// Initializer with proper memory management +- (instancetype)initWithFlutterApi:(InstabugPrivateViewFlutterApi *)api + registrar:( NSObject *) registrar { + if ((self = [super init])) { + _flutterApi = api; + _flutterEngineRegistrar = registrar; + } + return self; +} + +static long long currentTimeMillis; + + +- (void)mask:(UIImage *)screenshot + completion:(void (^)(UIImage *))completion { + + __weak typeof(self) weakSelf = self; + // Wait for the Cupertino animation to complete + dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(0.1 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{ + [self.flutterApi getPrivateViewsWithCompletion:^(NSArray *rectangles, FlutterError *error) { + UIImage *capturedScreenshot = [self captureScreenshot]; + [weakSelf handlePrivateViewsResult:rectangles + error:error + screenshot:capturedScreenshot + completion:completion]; + }]; + }); +} + +#pragma mark - Private Methods + +// Method to capture a screenshot of the app's main window +- (UIImage *)captureScreenshot { + CGSize imageSize = UIScreen.mainScreen.bounds.size; + UIGraphicsBeginImageContextWithOptions(imageSize, NO, UIScreen.mainScreen.scale); + + // Iterate over all windows, including the keyboard window + for (UIWindow *window in UIApplication.sharedApplication.windows) { + [window drawViewHierarchyInRect:window.bounds afterScreenUpdates:YES]; + } + + UIImage *screenshot = UIGraphicsGetImageFromCurrentImageContext(); + UIGraphicsEndImageContext(); + return screenshot; +} + +// Handle the result of fetching private views +- (void)handlePrivateViewsResult:(NSArray *)rectangles + error:(FlutterError *)error + screenshot:(UIImage *)screenshot + completion:(void (^)(UIImage *))completion { + if (error) { + [self logError:error]; + completion(screenshot); + return; + } + + NSArray *privateViews = [self convertToRectangles:rectangles]; + UIImage *maskedScreenshot = [self drawMaskedImage:screenshot withPrivateViews:privateViews]; + static long long currentTimeMillis2; + currentTimeMillis2 = (long long)([[NSDate date] timeIntervalSince1970] * 1000); + + long long timeDifference = currentTimeMillis2 - currentTimeMillis; + + completion(maskedScreenshot); + NSLog(@"Time Difference: %lld ms (Last: %lld, Current: %lld)", timeDifference, currentTimeMillis2, currentTimeMillis); + + +} + +// Convert the raw rectangles array into CGRect values +- (NSArray *)convertToRectangles:(NSArray *)rectangles { + + NSMutableArray *privateViews = [NSMutableArray arrayWithCapacity:rectangles.count / 4]; + CGPoint flutterOrigin = [self getFlutterViewOrigin]; + + for (NSUInteger i = 0; i < rectangles.count; i += 4) { + CGFloat left = rectangles[i].doubleValue; + CGFloat top = rectangles[i + 1].doubleValue; + CGFloat right = rectangles[i + 2].doubleValue; + CGFloat bottom = rectangles[i + 3].doubleValue; + + CGRect rect = CGRectMake(flutterOrigin.x + left, + flutterOrigin.y + top, + right - left + 1, + bottom - top + 1); + [privateViews addObject:[NSValue valueWithCGRect:rect]]; + } + return privateViews; +} + +// Draw the masked image by filling private views with black rectangles +- (UIImage *)drawMaskedImage:(UIImage *)screenshot withPrivateViews:(NSArray *)privateViews { + UIGraphicsBeginImageContextWithOptions(screenshot.size, NO, 0); + CGContextRef context = UIGraphicsGetCurrentContext(); + + @try { + [screenshot drawAtPoint:CGPointZero]; + CGContextSetFillColorWithColor(context, UIColor.blackColor.CGColor); + + for (NSValue *value in privateViews) { + CGContextFillRect(context, value.CGRectValue); + } + + return UIGraphicsGetImageFromCurrentImageContext(); + } @finally { + UIGraphicsEndImageContext(); + } +} + +// Retrieve the origin point of the Flutter view +- (CGPoint)getFlutterViewOrigin { + FlutterViewController *flutterVC = (FlutterViewController *)self.flutterEngineRegistrar.flutterEngine.viewController; + + UIView *flutterView = flutterVC.view; + if(!flutterView) + return CGPointZero; + UIWindow *window = flutterView.window; + CGRect globalFrame = [flutterView convertRect:flutterView.bounds toView:window]; + + return globalFrame.origin ; +} + + +// Log error details +- (void)logError:(FlutterError *)error { + NSLog(@"IBG-Flutter: Error getting private views: %@", error.message); +} + + +@end diff --git a/packages/instabug_flutter/ios/Classes/Modules/PrivateViewHostApi.h b/packages/instabug_flutter/ios/Classes/Modules/PrivateViewHostApi.h new file mode 100644 index 000000000..54ced156c --- /dev/null +++ b/packages/instabug_flutter/ios/Classes/Modules/PrivateViewHostApi.h @@ -0,0 +1,7 @@ +#import "PrivateViewApi.h" +#import "InstabugPrivateViewPigeon.h" +extern void InitPrivateViewHostApi(id _Nonnull messenger, PrivateViewApi * _Nonnull api); + +@interface PrivateViewHostApi : NSObject +@property (nonatomic, strong) PrivateViewApi* _Nonnull privateViewApi; +@end diff --git a/packages/instabug_flutter/ios/Classes/Modules/PrivateViewHostApi.m b/packages/instabug_flutter/ios/Classes/Modules/PrivateViewHostApi.m new file mode 100644 index 000000000..e7dbea5cf --- /dev/null +++ b/packages/instabug_flutter/ios/Classes/Modules/PrivateViewHostApi.m @@ -0,0 +1,33 @@ +// +// PrivateViewHostApi.m +// instabug_flutter +// +// Created by Ahmed alaa on 02/11/2024. +// + +#import "PrivateViewHostApi.h" +#import "instabug_flutter/InstabugApi.h" + +extern void InitPrivateViewHostApi(id _Nonnull messenger, PrivateViewApi * _Nonnull privateViewApi) { + PrivateViewHostApi *api = [[PrivateViewHostApi alloc] init]; + api.privateViewApi = privateViewApi; + InstabugPrivateViewHostApiSetup(messenger, api); +} + +@implementation PrivateViewHostApi + + +- (void)initWithError:(FlutterError * _Nullable __autoreleasing * _Nonnull)error { + [InstabugApi setScreenshotMaskingHandler:^(UIImage * _Nonnull screenshot, void (^ _Nonnull completion)(UIImage * _Nullable)) { + + + + [self.privateViewApi mask:screenshot completion:^(UIImage * _Nonnull maskedImage) { + if (maskedImage != nil) { + completion(maskedImage); + } + }]; + }]; +} + +@end diff --git a/ios/Classes/Modules/RepliesApi.h b/packages/instabug_flutter/ios/Classes/Modules/RepliesApi.h similarity index 100% rename from ios/Classes/Modules/RepliesApi.h rename to packages/instabug_flutter/ios/Classes/Modules/RepliesApi.h diff --git a/ios/Classes/Modules/RepliesApi.m b/packages/instabug_flutter/ios/Classes/Modules/RepliesApi.m similarity index 98% rename from ios/Classes/Modules/RepliesApi.m rename to packages/instabug_flutter/ios/Classes/Modules/RepliesApi.m index 636040181..b01dafef7 100644 --- a/ios/Classes/Modules/RepliesApi.m +++ b/packages/instabug_flutter/ios/Classes/Modules/RepliesApi.m @@ -1,4 +1,4 @@ -#import "Instabug.h" +#import "InstabugSDK.h" #import "RepliesApi.h" extern void InitRepliesApi(id messenger) { diff --git a/ios/Classes/Modules/SessionReplayApi.h b/packages/instabug_flutter/ios/Classes/Modules/SessionReplayApi.h similarity index 100% rename from ios/Classes/Modules/SessionReplayApi.h rename to packages/instabug_flutter/ios/Classes/Modules/SessionReplayApi.h diff --git a/ios/Classes/Modules/SessionReplayApi.m b/packages/instabug_flutter/ios/Classes/Modules/SessionReplayApi.m similarity index 98% rename from ios/Classes/Modules/SessionReplayApi.m rename to packages/instabug_flutter/ios/Classes/Modules/SessionReplayApi.m index 8a4c8d1bf..a7ad68ea3 100644 --- a/ios/Classes/Modules/SessionReplayApi.m +++ b/packages/instabug_flutter/ios/Classes/Modules/SessionReplayApi.m @@ -1,4 +1,4 @@ -#import "Instabug.h" +#import "InstabugSDK.h" #import "IBGSessionReplay.h" #import "SessionReplayApi.h" #import "ArgsRegistry.h" diff --git a/ios/Classes/Modules/SurveysApi.h b/packages/instabug_flutter/ios/Classes/Modules/SurveysApi.h similarity index 100% rename from ios/Classes/Modules/SurveysApi.h rename to packages/instabug_flutter/ios/Classes/Modules/SurveysApi.h diff --git a/ios/Classes/Modules/SurveysApi.m b/packages/instabug_flutter/ios/Classes/Modules/SurveysApi.m similarity index 99% rename from ios/Classes/Modules/SurveysApi.m rename to packages/instabug_flutter/ios/Classes/Modules/SurveysApi.m index fb6ee9fa4..1a435426c 100644 --- a/ios/Classes/Modules/SurveysApi.m +++ b/packages/instabug_flutter/ios/Classes/Modules/SurveysApi.m @@ -1,5 +1,5 @@ #import -#import "Instabug.h" +#import "InstabugSDK.h" #import "SurveysApi.h" extern void InitSurveysApi(id messenger) { diff --git a/ios/Classes/Util/ArgsRegistry.h b/packages/instabug_flutter/ios/Classes/Util/ArgsRegistry.h similarity index 82% rename from ios/Classes/Util/ArgsRegistry.h rename to packages/instabug_flutter/ios/Classes/Util/ArgsRegistry.h index a465365df..a0eec42e6 100644 --- a/ios/Classes/Util/ArgsRegistry.h +++ b/packages/instabug_flutter/ios/Classes/Util/ArgsRegistry.h @@ -1,5 +1,5 @@ #import -#import +#import typedef NSDictionary ArgsDictionary; @@ -18,8 +18,12 @@ typedef NSDictionary ArgsDictionary; + (ArgsDictionary *)extendedBugReportStates; + (ArgsDictionary *)reproModes; + (ArgsDictionary *)nonFatalExceptionLevel; ++ (ArgsDictionary *)autoMasking; + (ArgsDictionary *)locales; ++ (ArgsDictionary *)userStepsGesture; + + (NSDictionary *)placeholders; ++ (ArgsDictionary *) userConsentActionTypes; @end diff --git a/ios/Classes/Util/ArgsRegistry.m b/packages/instabug_flutter/ios/Classes/Util/ArgsRegistry.m similarity index 93% rename from ios/Classes/Util/ArgsRegistry.m rename to packages/instabug_flutter/ios/Classes/Util/ArgsRegistry.m index b8cdaa21a..c297f51ea 100644 --- a/ios/Classes/Util/ArgsRegistry.m +++ b/packages/instabug_flutter/ios/Classes/Util/ArgsRegistry.m @@ -44,6 +44,18 @@ + (ArgsDictionary *)floatingButtonEdges { }; } ++ (ArgsDictionary *)autoMasking { + return @{ + @"AutoMasking.labels" : @(IBGAutoMaskScreenshotOptionLabels), + @"AutoMasking.textInputs" : @(IBGAutoMaskScreenshotOptionTextInputs), + @"AutoMasking.media" : @(IBGAutoMaskScreenshotOptionMedia), + @"AutoMasking.none" : @(IBGAutoMaskScreenshotOptionMaskNothing +), + + }; +} + + + (ArgsDictionary *)recordButtonPositions { return @{ @"Position.topLeft" : @(IBGPositionTopLeft), @@ -212,4 +224,14 @@ + (ArgsDictionary *)locales { }; } ++ (ArgsDictionary *) userStepsGesture { + return @{ + @"GestureType.swipe" : @(IBGUIEventTypeSwipe), + @"GestureType.scroll" : @(IBGUIEventTypeScroll), + @"GestureType.tap" : @(IBGUIEventTypeTap), + @"GestureType.pinch" : @(IBGUIEventTypePinch), + @"GestureType.longPress" : @(IBGUIEventTypeLongPress), + @"GestureType.doubleTap" : @(IBGUIEventTypeDoubleTap), + }; +} @end diff --git a/packages/instabug_flutter/ios/Classes/Util/FlutterPluginRegistrar+FlutterEngine.h b/packages/instabug_flutter/ios/Classes/Util/FlutterPluginRegistrar+FlutterEngine.h new file mode 100644 index 000000000..ae31cbcd4 --- /dev/null +++ b/packages/instabug_flutter/ios/Classes/Util/FlutterPluginRegistrar+FlutterEngine.h @@ -0,0 +1,8 @@ +#import + +@interface NSObject (FlutterEngineAccess) + +// Method to access FlutterEngine +- (FlutterEngine *)flutterEngine; + +@end diff --git a/packages/instabug_flutter/ios/Classes/Util/FlutterPluginRegistrar+FlutterEngine.m b/packages/instabug_flutter/ios/Classes/Util/FlutterPluginRegistrar+FlutterEngine.m new file mode 100644 index 000000000..4e5109d3a --- /dev/null +++ b/packages/instabug_flutter/ios/Classes/Util/FlutterPluginRegistrar+FlutterEngine.m @@ -0,0 +1,13 @@ + +#import "FlutterPluginRegistrar+FlutterEngine.h" + +@implementation NSObject (FlutterEngineAccess) + +- (FlutterEngine *)flutterEngine { + if ([self respondsToSelector:@selector(engine)]) { + return (FlutterEngine *)[self performSelector:@selector(engine)]; + } + return nil; +} + +@end diff --git a/ios/Classes/Util/NativeUtils/IBGAPM+PrivateAPIs.h b/packages/instabug_flutter/ios/Classes/Util/IBGAPM+PrivateAPIs.h similarity index 90% rename from ios/Classes/Util/NativeUtils/IBGAPM+PrivateAPIs.h rename to packages/instabug_flutter/ios/Classes/Util/IBGAPM+PrivateAPIs.h index 2c2158479..22207d45b 100644 --- a/ios/Classes/Util/NativeUtils/IBGAPM+PrivateAPIs.h +++ b/packages/instabug_flutter/ios/Classes/Util/IBGAPM+PrivateAPIs.h @@ -6,12 +6,11 @@ // Copyright © 2020 Moataz. All rights reserved. // -#import +#import #import "IBGTimeIntervalUnits.h" @interface IBGAPM (PrivateAPIs) -@property (class, atomic, assign) BOOL networkEnabled; /// `endScreenLoadingEnabled` will be only true if APM, screenLoadingFeature.enabled and autoUITracesUserPreference are true @property (class, atomic, assign) BOOL endScreenLoadingEnabled; diff --git a/example/ios/InstabugTests/Util/IBGCrashReporting+CP.h b/packages/instabug_flutter/ios/Classes/Util/IBGCrashReporting+CP.h similarity index 92% rename from example/ios/InstabugTests/Util/IBGCrashReporting+CP.h rename to packages/instabug_flutter/ios/Classes/Util/IBGCrashReporting+CP.h index 4229dbcea..cf3a1c200 100644 --- a/example/ios/InstabugTests/Util/IBGCrashReporting+CP.h +++ b/packages/instabug_flutter/ios/Classes/Util/IBGCrashReporting+CP.h @@ -1,4 +1,4 @@ -#import +#import @interface IBGCrashReporting (CP) diff --git a/ios/Classes/Util/IBGNetworkLogger+CP.h b/packages/instabug_flutter/ios/Classes/Util/IBGNetworkLogger+CP.h similarity index 54% rename from ios/Classes/Util/IBGNetworkLogger+CP.h rename to packages/instabug_flutter/ios/Classes/Util/IBGNetworkLogger+CP.h index 764524fb2..54cb9d7ef 100644 --- a/ios/Classes/Util/IBGNetworkLogger+CP.h +++ b/packages/instabug_flutter/ios/Classes/Util/IBGNetworkLogger+CP.h @@ -1,8 +1,13 @@ -#import +#import NS_ASSUME_NONNULL_BEGIN -@interface IBGNetworkLogger (CP) + +@interface IBGNetworkLogger (PrivateAPIs) + +@property (class, atomic, assign) BOOL w3ExternalTraceIDEnabled; +@property (class, atomic, assign) BOOL w3ExternalGeneratedHeaderEnabled; +@property (class, atomic, assign) BOOL w3CaughtHeaderEnabled; + (void)disableAutomaticCapturingOfNetworkLogs; @@ -28,6 +33,22 @@ NS_ASSUME_NONNULL_BEGIN generatedW3CTraceparent:(NSString * _Nullable)generatedW3CTraceparent caughtedW3CTraceparent:(NSString * _Nullable)caughtedW3CTraceparent; ++ (void)addNetworkLogWithUrl:(NSString *_Nonnull)url + method:(NSString *_Nonnull)method + requestBody:(NSString *_Nonnull)request + requestBodySize:(int64_t)requestBodySize + responseBody:(NSString *_Nonnull)response + responseBodySize:(int64_t)responseBodySize + responseCode:(int32_t)code + requestHeaders:(NSDictionary *_Nonnull)requestHeaders + responseHeaders:(NSDictionary *_Nonnull)responseHeaders + contentType:(NSString *_Nonnull)contentType + errorDomain:(NSString *_Nullable)errorDomain + errorCode:(int32_t)errorCode + startTime:(int64_t)startTime + duration:(int64_t) duration + gqlQueryName:(NSString * _Nullable)gqlQueryName; + @end NS_ASSUME_NONNULL_END diff --git a/packages/instabug_flutter/ios/Classes/Util/Instabug+CP.h b/packages/instabug_flutter/ios/Classes/Util/Instabug+CP.h new file mode 100644 index 000000000..5e1ef85bb --- /dev/null +++ b/packages/instabug_flutter/ios/Classes/Util/Instabug+CP.h @@ -0,0 +1,9 @@ + +#import + +@interface Instabug (CP) + ++ (void)setScreenshotMaskingHandler:(nullable void (^)(UIImage *, void (^)(UIImage *)))maskingHandler; +@property(nonatomic, assign, class) BOOL sendEventsSwizzling; + +@end diff --git a/ios/Classes/Util/NativeUtils/IBGTimeIntervalUnits.h b/packages/instabug_flutter/ios/Classes/Util/NativeUtils/IBGTimeIntervalUnits.h similarity index 100% rename from ios/Classes/Util/NativeUtils/IBGTimeIntervalUnits.h rename to packages/instabug_flutter/ios/Classes/Util/NativeUtils/IBGTimeIntervalUnits.h diff --git a/ios/instabug_flutter.podspec b/packages/instabug_flutter/ios/instabug_flutter.podspec similarity index 88% rename from ios/instabug_flutter.podspec rename to packages/instabug_flutter/ios/instabug_flutter.podspec index 1d362767f..785f1c07b 100644 --- a/ios/instabug_flutter.podspec +++ b/packages/instabug_flutter/ios/instabug_flutter.podspec @@ -1,6 +1,6 @@ Pod::Spec.new do |s| s.name = 'instabug_flutter' - s.version = '13.4.0' + s.version = '15.0.2' s.summary = 'Flutter plugin for integrating the Instabug SDK.' s.author = 'Instabug' s.homepage = 'https://www.instabug.com/platforms/flutter' @@ -14,9 +14,9 @@ Pod::Spec.new do |s| s.public_header_files = 'Classes/**/*.h' s.ios.deployment_target = '10.0' - s.pod_target_xcconfig = { 'OTHER_LDFLAGS' => '-framework "Flutter" -framework "Instabug"'} + s.pod_target_xcconfig = { 'OTHER_LDFLAGS' => '-framework "Flutter" -framework "InstabugSDK"'} s.dependency 'Flutter' - s.dependency 'Instabug', '13.4.2' + s.dependency 'Instabug', '15.1.1' end diff --git a/lib/instabug_flutter.dart b/packages/instabug_flutter/lib/instabug_flutter.dart similarity index 68% rename from lib/instabug_flutter.dart rename to packages/instabug_flutter/lib/instabug_flutter.dart index 6dc949d1b..7911163a7 100644 --- a/lib/instabug_flutter.dart +++ b/packages/instabug_flutter/lib/instabug_flutter.dart @@ -3,7 +3,9 @@ export 'src/models/crash_data.dart'; export 'src/models/exception_data.dart'; export 'src/models/feature_flag.dart'; export 'src/models/network_data.dart'; -export 'src/models/trace.dart'; +export 'src/models/theme_config.dart'; +export 'src/models/w3c_header.dart'; + // Modules export 'src/modules/apm.dart'; export 'src/modules/bug_reporting.dart'; @@ -17,6 +19,11 @@ export 'src/modules/session_replay.dart'; export 'src/modules/surveys.dart'; // Utils export 'src/utils/instabug_navigator_observer.dart'; +export 'src/utils/instabug_widget.dart'; +export 'src/utils/private_views/instabug_private_view.dart'; +export 'src/utils/private_views/instabug_sliver_private_view.dart'; +export 'src/utils/private_views/private_views_manager.dart' show AutoMasking; export 'src/utils/screen_loading/instabug_capture_screen_loading.dart'; export 'src/utils/screen_loading/route_matcher.dart'; export 'src/utils/screen_name_masker.dart' show ScreenNameMaskingCallback; +export 'src/utils/user_steps/instabug_user_steps.dart'; diff --git a/lib/src/models/crash_data.dart b/packages/instabug_flutter/lib/src/models/crash_data.dart similarity index 100% rename from lib/src/models/crash_data.dart rename to packages/instabug_flutter/lib/src/models/crash_data.dart diff --git a/lib/src/models/exception_data.dart b/packages/instabug_flutter/lib/src/models/exception_data.dart similarity index 100% rename from lib/src/models/exception_data.dart rename to packages/instabug_flutter/lib/src/models/exception_data.dart diff --git a/lib/src/models/feature_flag.dart b/packages/instabug_flutter/lib/src/models/feature_flag.dart similarity index 100% rename from lib/src/models/feature_flag.dart rename to packages/instabug_flutter/lib/src/models/feature_flag.dart diff --git a/packages/instabug_flutter/lib/src/models/generated_w3c_header.dart b/packages/instabug_flutter/lib/src/models/generated_w3c_header.dart new file mode 100644 index 000000000..dc1e4c51f --- /dev/null +++ b/packages/instabug_flutter/lib/src/models/generated_w3c_header.dart @@ -0,0 +1,24 @@ +class GeneratedW3CHeader { + num timestampInSeconds; + int partialId; + String w3cHeader; + + GeneratedW3CHeader({ + required this.timestampInSeconds, + required this.partialId, + required this.w3cHeader, + }); + + @override + bool operator ==(Object other) => + identical(this, other) || + other is GeneratedW3CHeader && + runtimeType == other.runtimeType && + timestampInSeconds == other.timestampInSeconds && + partialId == other.partialId && + w3cHeader == other.w3cHeader; + + @override + int get hashCode => + timestampInSeconds.hashCode ^ partialId.hashCode ^ w3cHeader.hashCode; +} diff --git a/lib/src/models/instabug_route.dart b/packages/instabug_flutter/lib/src/models/instabug_route.dart similarity index 100% rename from lib/src/models/instabug_route.dart rename to packages/instabug_flutter/lib/src/models/instabug_route.dart diff --git a/lib/src/models/network_data.dart b/packages/instabug_flutter/lib/src/models/network_data.dart similarity index 60% rename from lib/src/models/network_data.dart rename to packages/instabug_flutter/lib/src/models/network_data.dart index 03a26abd2..6589bb109 100644 --- a/lib/src/models/network_data.dart +++ b/packages/instabug_flutter/lib/src/models/network_data.dart @@ -1,5 +1,7 @@ +import 'package:instabug_flutter/src/models/w3c_header.dart'; + class NetworkData { - const NetworkData({ + NetworkData({ required this.url, required this.method, this.requestBody = '', @@ -16,7 +18,10 @@ class NetworkData { required this.startTime, this.errorCode = 0, this.errorDomain = '', - }); + W3CHeader? w3cHeader, + }) { + _w3cHeader = w3cHeader; + } final String url; final String method; @@ -34,6 +39,50 @@ class NetworkData { final DateTime startTime; final int errorCode; final String errorDomain; + W3CHeader? _w3cHeader; + + @override + bool operator ==(Object other) => + identical(this, other) || + other is NetworkData && + runtimeType == other.runtimeType && + url == other.url && + method == other.method && + requestBody == other.requestBody && + responseBody == other.responseBody && + requestBodySize == other.requestBodySize && + responseBodySize == other.responseBodySize && + status == other.status && + requestHeaders == other.requestHeaders && + responseHeaders == other.responseHeaders && + duration == other.duration && + requestContentType == other.requestContentType && + responseContentType == other.responseContentType && + endTime == other.endTime && + startTime == other.startTime && + errorCode == other.errorCode && + errorDomain == other.errorDomain && + _w3cHeader == other._w3cHeader; + + @override + int get hashCode => + url.hashCode ^ + method.hashCode ^ + requestBody.hashCode ^ + responseBody.hashCode ^ + requestBodySize.hashCode ^ + responseBodySize.hashCode ^ + status.hashCode ^ + requestHeaders.hashCode ^ + responseHeaders.hashCode ^ + duration.hashCode ^ + requestContentType.hashCode ^ + responseContentType.hashCode ^ + endTime.hashCode ^ + startTime.hashCode ^ + errorCode.hashCode ^ + errorDomain.hashCode ^ + _w3cHeader.hashCode; NetworkData copyWith({ String? url, @@ -52,6 +101,7 @@ class NetworkData { DateTime? startTime, int? errorCode, String? errorDomain, + W3CHeader? w3cHeader, }) { return NetworkData( url: url ?? this.url, @@ -70,6 +120,7 @@ class NetworkData { startTime: startTime ?? this.startTime, errorCode: errorCode ?? this.errorCode, errorDomain: errorDomain ?? this.errorDomain, + w3cHeader: w3cHeader ?? _w3cHeader, ); } @@ -92,6 +143,11 @@ class NetworkData { 'responseBodySize': responseBodySize, 'errorDomain': errorDomain, 'errorCode': errorCode, + "isW3cHeaderFound": _w3cHeader?.isW3cHeaderFound, + "partialId": _w3cHeader?.partialId, + "networkStartTimeInSeconds": _w3cHeader?.networkStartTimeInSeconds, + "w3CGeneratedHeader": _w3cHeader?.w3CGeneratedHeader, + "w3CCaughtHeader": _w3cHeader?.w3CCaughtHeader, }; } } diff --git a/packages/instabug_flutter/lib/src/models/theme_config.dart b/packages/instabug_flutter/lib/src/models/theme_config.dart new file mode 100644 index 000000000..ea3a6754e --- /dev/null +++ b/packages/instabug_flutter/lib/src/models/theme_config.dart @@ -0,0 +1,121 @@ +class ThemeConfig { + /// Primary color for UI elements indicating interactivity or call to action. + final String? primaryColor; + + /// Background color for the main UI. + final String? backgroundColor; + + /// Color for title text elements. + final String? titleTextColor; + + /// Color for subtitle text elements. + final String? subtitleTextColor; + + /// Color for primary text elements. + final String? primaryTextColor; + + /// Color for secondary text elements. + final String? secondaryTextColor; + + /// Color for call-to-action text elements. + final String? callToActionTextColor; + + /// Background color for header elements. + final String? headerBackgroundColor; + + /// Background color for footer elements. + final String? footerBackgroundColor; + + /// Background color for row elements. + final String? rowBackgroundColor; + + /// Background color for selected row elements. + final String? selectedRowBackgroundColor; + + /// Color for row separator lines. + final String? rowSeparatorColor; + + /// Text style for primary text (Android only). + final String? primaryTextStyle; + + /// Text style for secondary text (Android only). + final String? secondaryTextStyle; + + /// Text style for title text (Android only). + final String? titleTextStyle; + + /// Text style for call-to-action text (Android only). + final String? ctaTextStyle; + + /// Path to primary font file. + final String? primaryFontPath; + + /// Asset path to primary font file. + final String? primaryFontAsset; + + /// Path to secondary font file. + final String? secondaryFontPath; + + /// Asset path to secondary font file. + final String? secondaryFontAsset; + + /// Path to call-to-action font file. + final String? ctaFontPath; + + /// Asset path to call-to-action font file. + final String? ctaFontAsset; + + const ThemeConfig({ + this.primaryColor, + this.backgroundColor, + this.titleTextColor, + this.subtitleTextColor, + this.primaryTextColor, + this.secondaryTextColor, + this.callToActionTextColor, + this.headerBackgroundColor, + this.footerBackgroundColor, + this.rowBackgroundColor, + this.selectedRowBackgroundColor, + this.rowSeparatorColor, + this.primaryTextStyle, + this.secondaryTextStyle, + this.titleTextStyle, + this.ctaTextStyle, + this.primaryFontPath, + this.primaryFontAsset, + this.secondaryFontPath, + this.secondaryFontAsset, + this.ctaFontPath, + this.ctaFontAsset, + }); + + Map toMap() { + return Map.fromEntries( + [ + MapEntry('primaryColor', primaryColor), + MapEntry('backgroundColor', backgroundColor), + MapEntry('titleTextColor', titleTextColor), + MapEntry('subtitleTextColor', subtitleTextColor), + MapEntry('primaryTextColor', primaryTextColor), + MapEntry('secondaryTextColor', secondaryTextColor), + MapEntry('callToActionTextColor', callToActionTextColor), + MapEntry('headerBackgroundColor', headerBackgroundColor), + MapEntry('footerBackgroundColor', footerBackgroundColor), + MapEntry('rowBackgroundColor', rowBackgroundColor), + MapEntry('selectedRowBackgroundColor', selectedRowBackgroundColor), + MapEntry('rowSeparatorColor', rowSeparatorColor), + MapEntry('primaryTextStyle', primaryTextStyle), + MapEntry('secondaryTextStyle', secondaryTextStyle), + MapEntry('titleTextStyle', titleTextStyle), + MapEntry('ctaTextStyle', ctaTextStyle), + MapEntry('primaryFontPath', primaryFontPath), + MapEntry('primaryFontAsset', primaryFontAsset), + MapEntry('secondaryFontPath', secondaryFontPath), + MapEntry('secondaryFontAsset', secondaryFontAsset), + MapEntry('ctaFontPath', ctaFontPath), + MapEntry('ctaFontAsset', ctaFontAsset), + ].where((entry) => entry.value != null), + ); + } +} diff --git a/packages/instabug_flutter/lib/src/models/trace_partial_id.dart b/packages/instabug_flutter/lib/src/models/trace_partial_id.dart new file mode 100644 index 000000000..ac5e59b87 --- /dev/null +++ b/packages/instabug_flutter/lib/src/models/trace_partial_id.dart @@ -0,0 +1,20 @@ +class TracePartialId { + int numberPartialId; + String hexPartialId; + + TracePartialId({ + required this.numberPartialId, + required this.hexPartialId, + }); + + @override + bool operator ==(Object other) => + identical(this, other) || + (other is TracePartialId && + runtimeType == other.runtimeType && + numberPartialId == other.numberPartialId && + hexPartialId == other.hexPartialId); + + @override + int get hashCode => numberPartialId.hashCode ^ hexPartialId.hashCode; +} diff --git a/packages/instabug_flutter/lib/src/models/w3c_feature_flags.dart b/packages/instabug_flutter/lib/src/models/w3c_feature_flags.dart new file mode 100644 index 000000000..4a298e57b --- /dev/null +++ b/packages/instabug_flutter/lib/src/models/w3c_feature_flags.dart @@ -0,0 +1,11 @@ +class W3cFeatureFlags { + bool isW3cExternalTraceIDEnabled; + bool isW3cExternalGeneratedHeaderEnabled; + bool isW3cCaughtHeaderEnabled; + + W3cFeatureFlags({ + required this.isW3cExternalTraceIDEnabled, + required this.isW3cExternalGeneratedHeaderEnabled, + required this.isW3cCaughtHeaderEnabled, + }); +} diff --git a/packages/instabug_flutter/lib/src/models/w3c_header.dart b/packages/instabug_flutter/lib/src/models/w3c_header.dart new file mode 100644 index 000000000..dfc7b67a2 --- /dev/null +++ b/packages/instabug_flutter/lib/src/models/w3c_header.dart @@ -0,0 +1,34 @@ +class W3CHeader { + final bool? isW3cHeaderFound; + final num? partialId; + final num? networkStartTimeInSeconds; + final String? w3CGeneratedHeader; + final String? w3CCaughtHeader; + + W3CHeader({ + this.isW3cHeaderFound, + this.partialId, + this.networkStartTimeInSeconds, + this.w3CGeneratedHeader, + this.w3CCaughtHeader, + }); + + @override + bool operator ==(Object other) => + identical(this, other) || + other is W3CHeader && + runtimeType == other.runtimeType && + isW3cHeaderFound == other.isW3cHeaderFound && + partialId == other.partialId && + networkStartTimeInSeconds == other.networkStartTimeInSeconds && + w3CGeneratedHeader == other.w3CGeneratedHeader && + w3CCaughtHeader == other.w3CCaughtHeader; + + @override + int get hashCode => + isW3cHeaderFound.hashCode ^ + partialId.hashCode ^ + networkStartTimeInSeconds.hashCode ^ + w3CGeneratedHeader.hashCode ^ + w3CCaughtHeader.hashCode; +} diff --git a/packages/instabug_flutter/lib/src/modules/apm.dart b/packages/instabug_flutter/lib/src/modules/apm.dart new file mode 100644 index 000000000..970c9330e --- /dev/null +++ b/packages/instabug_flutter/lib/src/modules/apm.dart @@ -0,0 +1,295 @@ +// ignore_for_file: avoid_classes_with_only_static_members + +import 'dart:async'; + +import 'package:flutter/widgets.dart' show WidgetBuilder; +import 'package:instabug_flutter/src/generated/apm.api.g.dart'; +import 'package:instabug_flutter/src/models/network_data.dart'; +import 'package:instabug_flutter/src/utils/ibg_build_info.dart'; +import 'package:instabug_flutter/src/utils/instabug_logger.dart'; +import 'package:instabug_flutter/src/utils/screen_loading/screen_loading_manager.dart'; +import 'package:meta/meta.dart'; + +class APM { + static var _host = ApmHostApi(); + static String tag = 'Instabug - APM'; + + /// @nodoc + @visibleForTesting + // ignore: use_setters_to_change_properties + static void $setHostApi(ApmHostApi host) { + _host = host; + } + + /// Enables or disables APM feature. + /// [boolean] isEnabled + static Future setEnabled(bool isEnabled) async { + return _host.setEnabled(isEnabled); + } + + /// Returns a Future indicating whether [APM] is enabled. + /// + /// Returns: + /// A Future object is being returned. + @internal + static Future isEnabled() async { + return _host.isEnabled(); + } + + /// Sets the screen loading state based on the provided boolean value. + /// + /// Args: + /// isEnabled (bool): The [isEnabled] parameter is a boolean value that determines whether screen + /// loading is enabled or disabled. If [isEnabled] is `true`, screen loading will be enabled; if + /// [isEnabled] is `false`, screen loading will be disabled. + /// + /// Returns: + /// A Future is being returned. + static Future setScreenLoadingEnabled(bool isEnabled) { + return _host.setScreenLoadingEnabled(isEnabled); + } + + /// Returns a Future indicating whether screen loading is enabled. + /// + /// Returns: + /// A Future object is being returned. + @internal + static Future isScreenLoadingEnabled() async { + return _host.isScreenLoadingEnabled(); + } + + /// Sets whether cold app launch is enabled or not. + /// + /// Args: + /// isEnabled (bool): The [setColdAppLaunchEnabled] method takes a boolean parameter [isEnabled] which + /// indicates whether cold app launch is enabled or not. + /// + /// Returns: + /// The method is returning a `Future`. + static Future setColdAppLaunchEnabled(bool isEnabled) async { + return _host.setColdAppLaunchEnabled(isEnabled); + } + + /// Starts an AppFlow with the given [name]. + /// + /// The [name] must not be an empty string. It should be unique and not exceed 150 characters, + /// ignoring leading and trailing spaces. + /// + /// Duplicate [name]s will terminate the older AppFlow with the termination reason recorded as + /// 'force abandon end reason'. + /// + /// The method will only execute if APM is enabled, the feature is + /// active, and the SDK has been initialized. + static Future startFlow(String name) async { + if (name.isNotEmpty) { + return _host.startFlow(name.trim()); + } + } + + /// Assigns a custom attribute to an AppFlow with the specified [name], [key], and [value]. + /// + /// The [name] must not be an empty string. The [key] should not exceed 30 characters, + /// and [value] should not exceed 60 characters, with both ignoring leading and trailing spaces. + /// + /// To remove an attribute, set its [value] to null. Attributes cannot be added or + /// modified after an AppFlow has concluded. + static Future setFlowAttribute( + String name, + String key, + String? value, + ) async { + return _host.setFlowAttribute(name, key, value); + } + + /// Ends a flow with the specified name. + /// + /// Args: + /// name (String): The [name] parameter is a required string that represents the name of the flow that you want + /// to end. + /// + /// Returns: + /// The method is returning a `Future`. + static Future endFlow(String name) async { + return _host.endFlow(name); + } + + /// Sets whether auto UI trace is enabled or not. + /// + /// Args: + /// isEnabled (bool): The [isEnabled] parameter is a boolean value that determines whether the auto + /// UI trace feature should be enabled or disabled. If [isEnabled] is set to `true`, the auto UI trace + /// feature will be enabled, and if it is set to `false`, the feature will be disabled. + /// + /// Returns: + /// The method returns a `Future`. + static Future setAutoUITraceEnabled(bool isEnabled) async { + return _host.setAutoUITraceEnabled(isEnabled); + } + + /// Starts a UI trace with the given name. + /// + /// Args: + /// name (String): The [name] parameter in the [startUITrace] method is a string that represents the + /// name of the UI trace that will be started. + /// + /// Returns: + /// The method is returning a `Future`. + static Future startUITrace(String name) async { + return _host.startUITrace(name); + } + + /// The [endUITrace] function ends a UI trace. + /// + /// Returns: + /// The method is returning a `Future`. + static Future endUITrace() async { + return _host.endUITrace(); + } + + /// Defines when an app launch is complete, + /// such as when it's intractable, use the end app launch API. + /// You can then view this data with the automatic cold and hot app launches. + /// + /// Returns: + /// The method is returning a `Future`. + static Future endAppLaunch() async { + return _host.endAppLaunch(); + } + + /// Logs network data for Instabug Android SDK if the app is running on an + /// Android platform. + /// + /// Args: + /// data (NetworkData): The [data] parameter in the `networkLogAndroid` function is of type + /// [NetworkData] and represents the network data that need to be logged. + /// + /// Returns: + /// The method is returning a `FutureOr`. + static FutureOr networkLogAndroid(NetworkData data) { + if (IBGBuildInfo.instance.isAndroid) { + return _host.networkLogAndroid(data.toJson()); + } + } + + /// Logs a message and then starts a UI trace with the provided screen + /// name, start time, and trace ID. + /// + /// Args: + /// screenName (String): The [screenName] parameter represents the identifier of the screen or + /// page where the UI trace is being started. It helps in identifying and tracking the performance of + /// that specific screen within the application. + /// startTimeInMicroseconds (int): The [startTimeInMicroseconds] parameter represents the time at + /// which the UI trace is starting, measured in microseconds. It is used to track the performance and + /// behavior of the user interface during a specific period of time. + /// traceId (int): The [traceId] parameter is used to uniquely identify a particular trace or + /// performance measurement within the system. It helps in tracking and distinguishing different traces + /// for analysis and debugging purposes. + /// + /// Returns: + /// The `startCpUiTrace` method is returning a `Future`. + @internal + static Future startCpUiTrace( + String screenName, + int startTimeInMicroseconds, + int traceId, + ) { + InstabugLogger.I.d( + 'Starting Ui trace — traceId: $traceId, screenName: $screenName, microTimeStamp: $startTimeInMicroseconds', + tag: APM.tag, + ); + return _host.startCpUiTrace(screenName, startTimeInMicroseconds, traceId); + } + + /// Reports screen loading trace with specific details. + /// + /// Args: + /// startTimeInMicroseconds (int): The [startTimeInMicroseconds] parameter represents the time when + /// the screen loading operation started, measured in microseconds. + /// durationInMicroseconds (int): The [durationInMicroseconds] parameter represents the duration of + /// the screen loading process in microseconds. It indicates the time taken for the screen to load + /// completely from the start time specified by [startTimeInMicroseconds]. This parameter helps in + /// measuring and analyzing the performance of the screen loading operation. + /// uiTraceId (int): The [uiTraceId] parameter is used to + /// identify a specific trace related to the screen loading process. It helps in tracking + /// and monitoring the performance of the screen loading operation. + /// + /// Returns: + /// The method is returning a `Future`. + @internal + static Future reportScreenLoadingCP( + int startTimeInMicroseconds, + int durationInMicroseconds, + int uiTraceId, + ) { + InstabugLogger.I.d( + 'Reporting screen loading trace — traceId: $uiTraceId, startTimeInMicroseconds: $startTimeInMicroseconds, durationInMicroseconds: $durationInMicroseconds', + tag: APM.tag, + ); + return _host.reportScreenLoadingCP( + startTimeInMicroseconds, + durationInMicroseconds, + uiTraceId, + ); + } + + /// Extends a screen loading trace with the provided end time and UI trace ID. + /// + /// Args: + /// endTimeInMicroseconds (int): The [endTimeInMicroseconds] parameter represents the time at which + /// the screen loading ends, measured in microseconds. + /// uiTraceId (int): The [uiTraceId] parameter is an identifier for the user interface trace being + /// monitored or tracked. It helps in associating the end time of the screen loading with the specific + /// trace for performance monitoring and analysis. + /// + /// Returns: + /// The method is returning a `Future`. + @internal + static Future endScreenLoadingCP( + int endTimeInMicroseconds, + int uiTraceId, + ) { + InstabugLogger.I.d( + 'Extending screen loading trace — traceId: $uiTraceId, endTimeInMicroseconds: $endTimeInMicroseconds', + tag: APM.tag, + ); + return _host.endScreenLoadingCP(endTimeInMicroseconds, uiTraceId); + } + + /// Extends the currently active screen loading trace using the [ScreenLoadingManager]. + /// + /// Returns: + /// A Future is being returned. + static Future endScreenLoading() { + return ScreenLoadingManager.I.endScreenLoading(); + } + + /// Returns a Future indicating whether the end screen + /// loading is enabled. + /// + /// Returns: + /// A Future is being returned. + @internal + static Future isEndScreenLoadingEnabled() async { + return _host.isEndScreenLoadingEnabled(); + } + + /// The function [wrapRoutes] wraps the given routes with a [InstabugCaptureScreenLoading] widget, excluding specified + /// routes. This allows Instabug to automatically capture screen loading times. + /// + /// Args: + /// routes (Map): The [routes] parameter is a map that contains route names as + /// keys and corresponding [WidgetBuilder] functions as values. This map is used to define the available + /// routes in a Flutter application. + /// exclude (List): The [exclude] parameter is a list of route names that you want to exclude + /// from the wrapping process. When the [wrapRoutes] function is called, it will wrap all routes except + /// the ones specified in the [exclude] list. Defaults to const [] + /// + /// Returns: + /// A Map that contains the new wrapped routes. + static Map wrapRoutes( + Map routes, { + List exclude = const [], + }) { + return ScreenLoadingManager.wrapRoutes(routes, exclude: exclude); + } +} diff --git a/lib/src/modules/bug_reporting.dart b/packages/instabug_flutter/lib/src/modules/bug_reporting.dart similarity index 90% rename from lib/src/modules/bug_reporting.dart rename to packages/instabug_flutter/lib/src/modules/bug_reporting.dart index bf2bca82c..b19147d3d 100644 --- a/lib/src/modules/bug_reporting.dart +++ b/packages/instabug_flutter/lib/src/modules/bug_reporting.dart @@ -15,6 +15,12 @@ enum InvocationOption { emailFieldOptional } +enum UserConsentActionType { + dropAutoCapturedMedia, + dropLogs, + noChat, +} + enum DismissType { cancel, submit, addAttachment } enum ReportType { bug, feedback, question, other } @@ -255,4 +261,26 @@ class BugReporting implements BugReportingFlutterApi { reportTypes?.mapToString(), ); } + + /// Adds a user consent item to the bug reporting form. + /// [key] A unique identifier string for the consent item. + /// [description] The text shown to the user describing the consent item. + /// [mandatory] Whether the user must agree to this item before submitting a report. + /// [checked] Whether the consent checkbox is pre-selected. + /// [actionType] A string representing the action type to map to SDK behavior. + static Future addUserConsents({ + required String key, + required String description, + required bool mandatory, + required bool checked, + UserConsentActionType? actionType, + }) async { + return _host.addUserConsents( + key, + description, + mandatory, + checked, + actionType?.toString(), + ); + } } diff --git a/lib/src/modules/crash_reporting.dart b/packages/instabug_flutter/lib/src/modules/crash_reporting.dart similarity index 100% rename from lib/src/modules/crash_reporting.dart rename to packages/instabug_flutter/lib/src/modules/crash_reporting.dart diff --git a/lib/src/modules/feature_requests.dart b/packages/instabug_flutter/lib/src/modules/feature_requests.dart similarity index 100% rename from lib/src/modules/feature_requests.dart rename to packages/instabug_flutter/lib/src/modules/feature_requests.dart diff --git a/lib/src/modules/instabug.dart b/packages/instabug_flutter/lib/src/modules/instabug.dart similarity index 83% rename from lib/src/modules/instabug.dart rename to packages/instabug_flutter/lib/src/modules/instabug.dart index bf457a4fb..da706e98f 100644 --- a/lib/src/modules/instabug.dart +++ b/packages/instabug_flutter/lib/src/modules/instabug.dart @@ -11,15 +11,18 @@ import 'dart:typed_data'; import 'dart:ui'; import 'package:flutter/material.dart'; + // to maintain supported versions prior to Flutter 3.3 // ignore: unused_import import 'package:flutter/services.dart'; import 'package:instabug_flutter/instabug_flutter.dart'; import 'package:instabug_flutter/src/generated/instabug.api.g.dart'; import 'package:instabug_flutter/src/utils/enum_converter.dart'; +import 'package:instabug_flutter/src/utils/feature_flags_manager.dart'; import 'package:instabug_flutter/src/utils/ibg_build_info.dart'; import 'package:instabug_flutter/src/utils/instabug_logger.dart'; import 'package:instabug_flutter/src/utils/screen_name_masker.dart'; +import 'package:instabug_flutter/src/utils/user_steps/user_step_details.dart'; import 'package:meta/meta.dart'; enum InvocationEvent { @@ -178,18 +181,22 @@ class Instabug { /// The [token] that identifies the app, you can find it on your dashboard. /// The [invocationEvents] are the events that invoke the SDK's UI. /// The [debugLogsLevel] used to debug Instabug's SDK. + /// The [appVariant] used to set current App variant name. static Future init({ required String token, required List invocationEvents, LogLevel debugLogsLevel = LogLevel.error, + String? appVariant, }) async { $setup(); InstabugLogger.I.logLevel = debugLogsLevel; - return _host.init( + await _host.init( token, invocationEvents.mapToString(), debugLogsLevel.toString(), + appVariant, ); + return FeatureFlagsManager().registerW3CFlagsListener(); } /// Sets a [callback] to be called wehenever a screen name is captured to mask @@ -256,31 +263,6 @@ class Instabug { return tags?.cast(); } - /// Adds experiments to the next report. - @Deprecated( - 'Please migrate to the new feature flags APIs: Instabug.addFeatureFlags.', - ) - static Future addExperiments(List experiments) async { - return _host.addExperiments(experiments); - } - - /// Removes certain experiments from the next report. - @Deprecated( - 'Please migrate to the new feature flags APIs: Instabug.removeFeatureFlags.', - ) - static Future removeExperiments(List experiments) async { - return _host.removeExperiments(experiments); - } - - /// Clears all experiments from the next report. - - @Deprecated( - 'Please migrate to the new feature flags APIs: Instabug.clearAllFeatureFlags.', - ) - static Future clearAllExperiments() async { - return _host.clearAllExperiments(); - } - /// Adds feature flags to the next report. static Future addFeatureFlags(List featureFlags) async { final map = {}; @@ -356,8 +338,13 @@ class Instabug { /// Sets the primary color of the SDK's UI. /// Sets the color of UI elements indicating interactivity or call to action. /// [color] primaryColor A color to set the UI elements of the SDK to. + /// + /// Note: This API is deprecated. Please use `Instabug.setTheme` instead. + @Deprecated( + 'This API is deprecated. Please use Instabug.setTheme instead.', + ) static Future setPrimaryColor(Color color) async { - return _host.setPrimaryColor(color.value); + await setTheme(ThemeConfig(primaryColor: color.toString())); } /// Adds specific user data that you need to be added to the reports @@ -447,9 +434,9 @@ class Instabug { } return _host.setReproStepsConfig( - bugMode.toString(), - crashMode.toString(), - sessionReplayMode.toString(), + bugMode?.toString(), + crashMode?.toString(), + sessionReplayMode?.toString(), ); } @@ -480,4 +467,67 @@ class Instabug { static Future willRedirectToStore() async { return _host.willRedirectToStore(); } + + /// This property sets the `appVariant` string to be included in all network requests. + /// It should be set before calling [init] method. + /// [appVariant] used to set current App variant name + static Future setAppVariant(String appVariant) async { + return _host.setAppVariant(appVariant); + } + + /// Sets a custom theme for Instabug UI elements. + /// + /// @param theme - Configuration object containing theme properties + /// + /// Example: + /// ```dart + /// + /// Instabug.setTheme(ThemeConfig( + /// primaryColor: '#FF6B6B', + /// secondaryTextColor: '#666666', + /// primaryTextColor: '#333333', + /// titleTextColor: '#000000', + /// backgroundColor: '#FFFFFF', + /// primaryTextStyle: 'bold', + /// secondaryTextStyle: 'normal', + /// titleTextStyle: 'bold', + /// ctaTextStyle: 'bold', + /// primaryFontPath: '/data/user/0/com.yourapp/files/fonts/YourFont.ttf', + /// secondaryFontPath: '/data/user/0/com.yourapp/files/fonts/YourFont.ttf', + /// ctaFontPath: '/data/user/0/com.yourapp/files/fonts/YourFont.ttf', + /// primaryFontAsset: 'fonts/YourFont.ttf', + /// secondaryFontAsset: 'fonts/YourFont.ttf' + /// )); + /// ``` + static Future setTheme(ThemeConfig themeConfig) async { + return _host.setTheme(themeConfig.toMap()); + } + + /// Sets the fullscreen mode for Instabug UI. + /// + /// [isFullscreen] - Whether to enable fullscreen mode or not. + /// + /// Example: + /// ```dart + /// Instabug.setFullscreen(true); + /// ``` + static Future setFullscreen(bool isEnabled) async { + return _host.setFullscreen(isEnabled); + } + + /// Enables and disables user interaction steps. + /// [boolean] isEnabled + static Future enableUserSteps(bool isEnabled) async { + return _host.setEnableUserSteps(isEnabled); + } + + /// Enables and disables manual invocation and prompt options for bug and feedback. + /// [boolean] isEnabled + static Future logUserSteps( + GestureType gestureType, + String message, + String? viewName, + ) async { + return _host.logUserSteps(gestureType.toString(), message, viewName); + } } diff --git a/lib/src/modules/instabug_log.dart b/packages/instabug_flutter/lib/src/modules/instabug_log.dart similarity index 100% rename from lib/src/modules/instabug_log.dart rename to packages/instabug_flutter/lib/src/modules/instabug_log.dart diff --git a/lib/src/modules/network_logger.dart b/packages/instabug_flutter/lib/src/modules/network_logger.dart similarity index 52% rename from lib/src/modules/network_logger.dart rename to packages/instabug_flutter/lib/src/modules/network_logger.dart index 83a88538c..b7acc74c2 100644 --- a/lib/src/modules/network_logger.dart +++ b/packages/instabug_flutter/lib/src/modules/network_logger.dart @@ -1,12 +1,15 @@ // ignore_for_file: avoid_classes_with_only_static_members import 'dart:async'; - -import 'package:flutter/foundation.dart'; import 'package:instabug_flutter/src/generated/instabug.api.g.dart'; import 'package:instabug_flutter/src/models/network_data.dart'; +import 'package:instabug_flutter/src/models/w3c_header.dart'; import 'package:instabug_flutter/src/modules/apm.dart'; +import 'package:instabug_flutter/src/utils/feature_flags_manager.dart'; +import 'package:instabug_flutter/src/utils/iterable_ext.dart'; import 'package:instabug_flutter/src/utils/network_manager.dart'; +import 'package:instabug_flutter/src/utils/w3c_header_utils.dart'; +import 'package:meta/meta.dart'; class NetworkLogger { static var _host = InstabugHostApi(); @@ -17,6 +20,8 @@ class NetworkLogger { // ignore: use_setters_to_change_properties static void $setHostApi(InstabugHostApi host) { _host = host; + // ignore: invalid_use_of_visible_for_testing_member + FeatureFlagsManager().$setHostApi(host); } /// @nodoc @@ -66,13 +71,65 @@ class NetworkLogger { } Future networkLog(NetworkData data) async { - final omit = await _manager.omitLog(data); + final w3Header = await getW3CHeader( + data.requestHeaders, + data.startTime.millisecondsSinceEpoch, + ); + if (w3Header?.isW3cHeaderFound == false && + w3Header?.w3CGeneratedHeader != null) { + data.requestHeaders['traceparent'] = w3Header?.w3CGeneratedHeader; + } + networkLogInternal(data); + } + @internal + Future networkLogInternal(NetworkData data) async { + final omit = await _manager.omitLog(data); if (omit) return; - final obfuscated = await _manager.obfuscateLog(data); - await _host.networkLog(obfuscated.toJson()); await APM.networkLogAndroid(obfuscated); } + + @internal + Future getW3CHeader( + Map header, + int startTime, + ) async { + final w3cFlags = await FeatureFlagsManager().getW3CFeatureFlagsHeader(); + + if (w3cFlags.isW3cExternalTraceIDEnabled == false) { + return null; + } + + final w3cHeaderFound = header.entries + .firstWhereOrNull( + (element) => element.key.toLowerCase() == 'traceparent', + ) + ?.value as String?; + final isW3cHeaderFound = w3cHeaderFound != null; + + if (isW3cHeaderFound && w3cFlags.isW3cCaughtHeaderEnabled) { + return W3CHeader(isW3cHeaderFound: true, w3CCaughtHeader: w3cHeaderFound); + } else if (w3cFlags.isW3cExternalGeneratedHeaderEnabled && + !isW3cHeaderFound) { + final w3cHeaderData = W3CHeaderUtils().generateW3CHeader( + startTime, + ); + + return W3CHeader( + isW3cHeaderFound: false, + partialId: w3cHeaderData.partialId, + networkStartTimeInSeconds: w3cHeaderData.timestampInSeconds, + w3CGeneratedHeader: w3cHeaderData.w3cHeader, + ); + } + return null; + } + + /// Enables or disables network body logs capturing. + /// [boolean] isEnabled + static Future setNetworkLogBodyEnabled(bool isEnabled) async { + return _host.setNetworkLogBodyEnabled(isEnabled); + } } diff --git a/lib/src/modules/replies.dart b/packages/instabug_flutter/lib/src/modules/replies.dart similarity index 100% rename from lib/src/modules/replies.dart rename to packages/instabug_flutter/lib/src/modules/replies.dart diff --git a/lib/src/modules/session_replay.dart b/packages/instabug_flutter/lib/src/modules/session_replay.dart similarity index 100% rename from lib/src/modules/session_replay.dart rename to packages/instabug_flutter/lib/src/modules/session_replay.dart diff --git a/lib/src/modules/surveys.dart b/packages/instabug_flutter/lib/src/modules/surveys.dart similarity index 100% rename from lib/src/modules/surveys.dart rename to packages/instabug_flutter/lib/src/modules/surveys.dart diff --git a/lib/src/utils/enum_converter.dart b/packages/instabug_flutter/lib/src/utils/enum_converter.dart similarity index 100% rename from lib/src/utils/enum_converter.dart rename to packages/instabug_flutter/lib/src/utils/enum_converter.dart diff --git a/packages/instabug_flutter/lib/src/utils/feature_flags_manager.dart b/packages/instabug_flutter/lib/src/utils/feature_flags_manager.dart new file mode 100644 index 000000000..b81dc9777 --- /dev/null +++ b/packages/instabug_flutter/lib/src/utils/feature_flags_manager.dart @@ -0,0 +1,92 @@ +import 'package:instabug_flutter/src/generated/instabug.api.g.dart'; +import 'package:instabug_flutter/src/models/w3c_feature_flags.dart'; +import 'package:instabug_flutter/src/utils/ibg_build_info.dart'; +import 'package:meta/meta.dart'; + +typedef OnW3CFeatureFlagChange = void Function( + bool isW3cExternalTraceIDEnabled, + bool isW3cExternalGeneratedHeaderEnabled, + bool isW3cCaughtHeaderEnabled, +); + +class FeatureFlagsManager implements FeatureFlagsFlutterApi { + // Access the singleton instance + factory FeatureFlagsManager() { + return _instance; + } + // Private constructor to prevent instantiation from outside the class + FeatureFlagsManager._(); + + // Singleton instance + static final FeatureFlagsManager _instance = FeatureFlagsManager._(); + + // Host API instance + static InstabugHostApi _host = InstabugHostApi(); + + /// @nodoc + @visibleForTesting + // Setter for the host API + // ignore: use_setters_to_change_properties + void $setHostApi(InstabugHostApi host) { + _host = host; + } + + @visibleForTesting + // Setter for the FeatureFlagsManager + void setFeatureFlagsManager(FeatureFlagsManager featureFlagsManager) { + // This can be used for testing, but should be avoided in production + // since it breaks the singleton pattern + } + + // Internal state flags + bool _isAndroidW3CExternalTraceID = false; + bool _isAndroidW3CExternalGeneratedHeader = false; + bool _isAndroidW3CCaughtHeader = false; + + Future getW3CFeatureFlagsHeader() async { + if (IBGBuildInfo.instance.isAndroid) { + return Future.value( + W3cFeatureFlags( + isW3cCaughtHeaderEnabled: _isAndroidW3CCaughtHeader, + isW3cExternalGeneratedHeaderEnabled: + _isAndroidW3CExternalGeneratedHeader, + isW3cExternalTraceIDEnabled: _isAndroidW3CExternalTraceID, + ), + ); + } + final flags = await _host.isW3CFeatureFlagsEnabled(); + return W3cFeatureFlags( + isW3cCaughtHeaderEnabled: flags['isW3cCaughtHeaderEnabled'] ?? false, + isW3cExternalGeneratedHeaderEnabled: + flags['isW3cExternalGeneratedHeaderEnabled'] ?? false, + isW3cExternalTraceIDEnabled: + flags['isW3cExternalTraceIDEnabled'] ?? false, + ); + } + + Future registerW3CFlagsListener() async { + FeatureFlagsFlutterApi.setup(this); // Use 'this' instead of _instance + + final featureFlags = await _host.isW3CFeatureFlagsEnabled(); + _isAndroidW3CCaughtHeader = + featureFlags['isW3cCaughtHeaderEnabled'] ?? false; + _isAndroidW3CExternalTraceID = + featureFlags['isW3cExternalTraceIDEnabled'] ?? false; + _isAndroidW3CExternalGeneratedHeader = + featureFlags['isW3cExternalGeneratedHeaderEnabled'] ?? false; + + return _host.registerFeatureFlagChangeListener(); + } + + @override + @internal + void onW3CFeatureFlagChange( + bool isW3cExternalTraceIDEnabled, + bool isW3cExternalGeneratedHeaderEnabled, + bool isW3cCaughtHeaderEnabled, + ) { + _isAndroidW3CCaughtHeader = isW3cCaughtHeaderEnabled; + _isAndroidW3CExternalTraceID = isW3cExternalTraceIDEnabled; + _isAndroidW3CExternalGeneratedHeader = isW3cExternalGeneratedHeaderEnabled; + } +} diff --git a/lib/src/utils/ibg_build_info.dart b/packages/instabug_flutter/lib/src/utils/ibg_build_info.dart similarity index 100% rename from lib/src/utils/ibg_build_info.dart rename to packages/instabug_flutter/lib/src/utils/ibg_build_info.dart diff --git a/lib/src/utils/ibg_date_time.dart b/packages/instabug_flutter/lib/src/utils/ibg_date_time.dart similarity index 100% rename from lib/src/utils/ibg_date_time.dart rename to packages/instabug_flutter/lib/src/utils/ibg_date_time.dart diff --git a/lib/src/utils/instabug_logger.dart b/packages/instabug_flutter/lib/src/utils/instabug_logger.dart similarity index 100% rename from lib/src/utils/instabug_logger.dart rename to packages/instabug_flutter/lib/src/utils/instabug_logger.dart diff --git a/lib/src/utils/instabug_montonic_clock.dart b/packages/instabug_flutter/lib/src/utils/instabug_montonic_clock.dart similarity index 100% rename from lib/src/utils/instabug_montonic_clock.dart rename to packages/instabug_flutter/lib/src/utils/instabug_montonic_clock.dart diff --git a/lib/src/utils/instabug_navigator_observer.dart b/packages/instabug_flutter/lib/src/utils/instabug_navigator_observer.dart similarity index 66% rename from lib/src/utils/instabug_navigator_observer.dart rename to packages/instabug_flutter/lib/src/utils/instabug_navigator_observer.dart index d9d6b02db..ccf2cf38b 100644 --- a/lib/src/utils/instabug_navigator_observer.dart +++ b/packages/instabug_flutter/lib/src/utils/instabug_navigator_observer.dart @@ -22,22 +22,23 @@ class InstabugNavigatorObserver extends NavigatorObserver { route: newRoute, name: maskedScreenName, ); + //ignore: invalid_null_aware_operator + WidgetsBinding.instance?.addPostFrameCallback((_) async { + // Starts a the new UI trace which is exclusive to screen loading + ScreenLoadingManager.I.startUiTrace(maskedScreenName, screenName); + // If there is a step that hasn't been pushed yet + if (_steps.isNotEmpty) { + await reportScreenChange(_steps.last.name); + // Report the last step and remove it from the list + _steps.removeLast(); + } + + // Add the new step to the list + _steps.add(route); - // Starts a the new UI trace which is exclusive to screen loading - ScreenLoadingManager.I.startUiTrace(maskedScreenName, screenName); - // If there is a step that hasn't been pushed yet - if (_steps.isNotEmpty) { - // Report the last step and remove it from the list - Instabug.reportScreenChange(_steps.last.name); - _steps.removeLast(); - } - - // Add the new step to the list - _steps.add(route); - Future.delayed(const Duration(milliseconds: 1000), () { // If this route is in the array, report it and remove it from the list if (_steps.contains(route)) { - Instabug.reportScreenChange(route.name); + await reportScreenChange(route.name); _steps.remove(route); } }); @@ -47,6 +48,13 @@ class InstabugNavigatorObserver extends NavigatorObserver { } } + Future reportScreenChange(String name) async { + // Wait for the animation to complete + await Future.delayed(const Duration(milliseconds: 100)); + + Instabug.reportScreenChange(name); + } + @override void didPop(Route route, Route? previousRoute) { if (previousRoute != null) { diff --git a/packages/instabug_flutter/lib/src/utils/instabug_widget.dart b/packages/instabug_flutter/lib/src/utils/instabug_widget.dart new file mode 100644 index 000000000..f63ca8776 --- /dev/null +++ b/packages/instabug_flutter/lib/src/utils/instabug_widget.dart @@ -0,0 +1,60 @@ +import 'package:flutter/material.dart'; +import 'package:instabug_flutter/instabug_flutter.dart'; +import 'package:instabug_flutter/src/generated/instabug_private_view.api.g.dart'; +import 'package:instabug_flutter/src/utils/private_views/private_views_manager.dart'; +import 'package:meta/meta.dart'; + +@internal +final instabugWidgetKey = GlobalKey(debugLabel: 'instabug_screenshot_widget'); + +class InstabugWidget extends StatefulWidget { + final Widget child; + final bool enablePrivateViews; + final bool enableUserSteps; + final List? automasking; + + const InstabugWidget({ + Key? key, + required this.child, + this.enableUserSteps = true, + this.enablePrivateViews = true, + this.automasking, + }) : super(key: key); + + @override + State createState() => _InstabugWidgetState(); +} + +class _InstabugWidgetState extends State { + @override + void initState() { + if (widget.enablePrivateViews) { + _enableInstabugMaskingPrivateViews(); + } + if (widget.automasking != null) { + PrivateViewsManager.I.addAutoMasking(widget.automasking!); + } + super.initState(); + } + + @override + Widget build(BuildContext context) { + final child = widget.enableUserSteps + ? InstabugUserSteps(child: widget.child) + : widget.child; + + if (widget.enablePrivateViews) { + return RepaintBoundary( + key: instabugWidgetKey, + child: child, + ); + } + return child; + } +} + +void _enableInstabugMaskingPrivateViews() { + final api = InstabugPrivateViewHostApi(); + api.init(); + InstabugPrivateViewFlutterApi.setup(PrivateViewsManager.I); +} diff --git a/packages/instabug_flutter/lib/src/utils/iterable_ext.dart b/packages/instabug_flutter/lib/src/utils/iterable_ext.dart new file mode 100644 index 000000000..e5c0099f5 --- /dev/null +++ b/packages/instabug_flutter/lib/src/utils/iterable_ext.dart @@ -0,0 +1,8 @@ +extension IterableExtenstions on Iterable { + T? firstWhereOrNull(bool Function(T element) where) { + for (final element in this) { + if (where(element)) return element; + } + return null; + } +} diff --git a/lib/src/utils/network_manager.dart b/packages/instabug_flutter/lib/src/utils/network_manager.dart similarity index 100% rename from lib/src/utils/network_manager.dart rename to packages/instabug_flutter/lib/src/utils/network_manager.dart diff --git a/packages/instabug_flutter/lib/src/utils/private_views/instabug_private_view.dart b/packages/instabug_flutter/lib/src/utils/private_views/instabug_private_view.dart new file mode 100644 index 000000000..6903bd47b --- /dev/null +++ b/packages/instabug_flutter/lib/src/utils/private_views/instabug_private_view.dart @@ -0,0 +1,12 @@ +import 'package:flutter/material.dart'; + +class InstabugPrivateView extends StatelessWidget { + final Widget child; + + const InstabugPrivateView({required this.child, Key? key}) : super(key: key); + + @override + Widget build(BuildContext context) { + return child; + } +} diff --git a/packages/instabug_flutter/lib/src/utils/private_views/instabug_sliver_private_view.dart b/packages/instabug_flutter/lib/src/utils/private_views/instabug_sliver_private_view.dart new file mode 100644 index 000000000..1ea626f5a --- /dev/null +++ b/packages/instabug_flutter/lib/src/utils/private_views/instabug_sliver_private_view.dart @@ -0,0 +1,14 @@ +import 'package:flutter/cupertino.dart'; +import 'package:flutter/material.dart'; + +class InstabugSliverPrivateView extends StatelessWidget { + final Widget sliver; + + const InstabugSliverPrivateView({required this.sliver, Key? key}) + : super(key: key); + + @override + Widget build(BuildContext context) { + return sliver; + } +} diff --git a/packages/instabug_flutter/lib/src/utils/private_views/private_views_manager.dart b/packages/instabug_flutter/lib/src/utils/private_views/private_views_manager.dart new file mode 100644 index 000000000..c6a8b1da6 --- /dev/null +++ b/packages/instabug_flutter/lib/src/utils/private_views/private_views_manager.dart @@ -0,0 +1,180 @@ +import 'package:flutter/material.dart'; +import 'package:flutter/rendering.dart'; +import 'package:instabug_flutter/instabug_flutter.dart'; +import 'package:instabug_flutter/src/generated/instabug.api.g.dart'; +import 'package:instabug_flutter/src/generated/instabug_private_view.api.g.dart'; +import 'package:instabug_flutter/src/utils/enum_converter.dart'; +import 'package:instabug_flutter/src/utils/user_steps/widget_utils.dart'; + +enum AutoMasking { labels, textInputs, media, none } + +extension ValidationMethod on AutoMasking { + bool Function(Widget) hides() { + switch (this) { + case AutoMasking.labels: + return isTextWidget; + case AutoMasking.textInputs: + return isTextInputWidget; + case AutoMasking.media: + return isMedia; + case AutoMasking.none: + return (_) => false; + } + } +} + +/// responsible for masking views +/// before they are sent to the native SDKs. +class PrivateViewsManager implements InstabugPrivateViewFlutterApi { + PrivateViewsManager._() { + _viewChecks = List.of([isPrivateWidget]); + } + + static PrivateViewsManager _instance = PrivateViewsManager._(); + + static PrivateViewsManager get instance => _instance; + static final _host = InstabugHostApi(); + + /// Shorthand for [instance] + static PrivateViewsManager get I => instance; + + @visibleForTesting + // ignore: use_setters_to_change_properties + static void setInstance(PrivateViewsManager instance) { + _instance = instance; + } + + static bool isPrivateWidget(Widget widget) { + final isPrivate = (widget.runtimeType == InstabugPrivateView) || + (widget.runtimeType == InstabugSliverPrivateView); + + return isPrivate; + } + + late List _viewChecks; + + void addAutoMasking(List masking) { + _viewChecks = List.of([isPrivateWidget]); + if (!(masking.contains(AutoMasking.none) && masking.length == 1)) { + _viewChecks.addAll(masking.map((e) => e.hides()).toList()); + } + _host.enableAutoMasking(masking.mapToString()); + } + + Rect? getLayoutRectInfoFromRenderObject(RenderObject? renderObject) { + if (renderObject == null || !renderObject.attached) { + return null; + } + + final globalOffset = _getRenderGlobalOffset(renderObject); + + // Case 1: RenderBox (e.g. Container, Text, etc.) + if (renderObject is RenderBox) { + return renderObject.paintBounds.shift(globalOffset); + } + + // Case 2: RenderSliver (e.g. SliverList, SliverToBoxAdapter, etc.) + if (renderObject is RenderSliver) { + final geometry = renderObject.geometry; + if (geometry == null) { + return null; + } + + final crossAxisExtent = renderObject.constraints.crossAxisExtent; + final paintExtent = geometry.paintExtent; + + return Rect.fromLTWH( + globalOffset.dx, + globalOffset.dy, + // assume vertical scroll by default + crossAxisExtent, + paintExtent, + ); + } + + return null; + } + + // The is the same implementation used in RenderBox.localToGlobal (a subclass of RenderObject) + Offset _getRenderGlobalOffset(RenderObject renderObject) { + // Find the nearest RenderBox ancestor to calculate global position + RenderObject? current = renderObject; + while (current != null && current is! RenderBox) { + final parentNode = current.parent; + if (parentNode is RenderObject) { + current = parentNode; + } else { + current = null; + } + } + + if (current is RenderBox) { + // Get transform from this object to screen root + final transform = renderObject.getTransformTo(null); + return MatrixUtils.transformPoint(transform, Offset.zero); + } + + // fallback: treat as zero offset (shouldn't happen if widget is mounted in tree) + return Offset.zero; + } + + List getRectsOfPrivateViews() { + final context = instabugWidgetKey.currentContext; + if (context == null) return []; + + final rootRenderObject = + context.findRenderObject() as RenderRepaintBoundary?; + if (rootRenderObject is! RenderBox) return []; + + final bounds = Offset.zero & rootRenderObject!.size; + + final rects = []; + + void findPrivateViews(Element element) { + final widget = element.widget; + final isPrivate = _viewChecks.any((e) => e.call(widget)); + if (isPrivate) { + final renderObject = element.findRenderObject(); + if ((renderObject is RenderBox || renderObject is RenderSliver) && + renderObject?.attached == true) { + final isElementInCurrentScreen = isElementInCurrentRoute(element); + final rect = getLayoutRectInfoFromRenderObject(renderObject); + if (rect != null && + rect.overlaps(bounds) && + isElementInCurrentScreen) { + rects.add(rect); + } + } + } else { + element.visitChildElements(findPrivateViews); + } + } + + rects.clear(); + context.visitChildElements(findPrivateViews); + + return rects; + } + + bool isElementInCurrentRoute(Element element) { + final modalRoute = ModalRoute.of(element); + return modalRoute?.isCurrent ?? false; + } + + @override + List getPrivateViews() { + final rects = getRectsOfPrivateViews(); + final result = []; + + for (final rect in rects) { + result.addAll([ + rect.left, + rect.top, + rect.right, + rect.bottom, + ]); + } + + return result; + } +} diff --git a/lib/src/utils/repro_steps_constants.dart b/packages/instabug_flutter/lib/src/utils/repro_steps_constants.dart similarity index 100% rename from lib/src/utils/repro_steps_constants.dart rename to packages/instabug_flutter/lib/src/utils/repro_steps_constants.dart diff --git a/lib/src/utils/screen_loading/flags_config.dart b/packages/instabug_flutter/lib/src/utils/screen_loading/flags_config.dart similarity index 100% rename from lib/src/utils/screen_loading/flags_config.dart rename to packages/instabug_flutter/lib/src/utils/screen_loading/flags_config.dart diff --git a/lib/src/utils/screen_loading/instabug_capture_screen_loading.dart b/packages/instabug_flutter/lib/src/utils/screen_loading/instabug_capture_screen_loading.dart similarity index 62% rename from lib/src/utils/screen_loading/instabug_capture_screen_loading.dart rename to packages/instabug_flutter/lib/src/utils/screen_loading/instabug_capture_screen_loading.dart index 3d400ae3d..9c9559af4 100644 --- a/lib/src/utils/screen_loading/instabug_capture_screen_loading.dart +++ b/packages/instabug_flutter/lib/src/utils/screen_loading/instabug_capture_screen_loading.dart @@ -4,15 +4,37 @@ import 'package:instabug_flutter/src/utils/instabug_montonic_clock.dart'; import 'package:instabug_flutter/src/utils/screen_loading/screen_loading_manager.dart'; import 'package:instabug_flutter/src/utils/screen_loading/screen_loading_trace.dart'; +/// A widget that tracks and reports screen loading times to Instabug. +/// +/// This widget wraps around a child widget and measures the time taken +/// for the screen to fully render. The recorded loading time is reported +/// using the [ScreenLoadingManager]. +/// +/// ## Usage +/// ```dart +/// InstabugCaptureScreenLoading( +/// screenName: "HomeScreen", +/// child: HomeScreenWidget(), +/// ) +/// ``` class InstabugCaptureScreenLoading extends StatefulWidget { + /// A unique identifier for the widget used internally for debugging purposes. static const tag = "InstabugCaptureScreenLoading"; + /// Creates an instance of [InstabugCaptureScreenLoading]. + /// + /// Requires [screenName] to identify the screen being tracked and [child] + /// which represents the UI component to be rendered. const InstabugCaptureScreenLoading({ Key? key, required this.screenName, required this.child, }) : super(key: key); + + /// The UI component whose loading time is being measured. final Widget child; + + /// The name of the screen being monitored for loading performance. final String screenName; @override @@ -22,9 +44,16 @@ class InstabugCaptureScreenLoading extends StatefulWidget { class _InstabugCaptureScreenLoadingState extends State { + /// Trace object that records screen loading details. ScreenLoadingTrace? trace; + + /// Timestamp in microseconds when the widget is created. final startTimeInMicroseconds = IBGDateTime.I.now().microsecondsSinceEpoch; + + /// Monotonic timestamp in microseconds for more precise duration tracking. final startMonotonicTimeInMicroseconds = InstabugMonotonicClock.I.now; + + /// Stopwatch to measure screen loading time. final stopwatch = Stopwatch()..start(); @override @@ -38,7 +67,7 @@ class _InstabugCaptureScreenLoadingState ScreenLoadingManager.I.startScreenLoadingTrace(trace!); - // to maintain supported versions prior to Flutter 3.0.0 + // Ensures compatibility with Flutter versions before 3.0.0 // ignore: invalid_null_aware_operator WidgetsBinding.instance?.addPostFrameCallback((_) { stopwatch.stop(); diff --git a/lib/src/utils/screen_loading/route_matcher.dart b/packages/instabug_flutter/lib/src/utils/screen_loading/route_matcher.dart similarity index 100% rename from lib/src/utils/screen_loading/route_matcher.dart rename to packages/instabug_flutter/lib/src/utils/screen_loading/route_matcher.dart diff --git a/lib/src/utils/screen_loading/screen_loading_manager.dart b/packages/instabug_flutter/lib/src/utils/screen_loading/screen_loading_manager.dart similarity index 94% rename from lib/src/utils/screen_loading/screen_loading_manager.dart rename to packages/instabug_flutter/lib/src/utils/screen_loading/screen_loading_manager.dart index 816ffebef..b01b77627 100644 --- a/lib/src/utils/screen_loading/screen_loading_manager.dart +++ b/packages/instabug_flutter/lib/src/utils/screen_loading/screen_loading_manager.dart @@ -9,7 +9,10 @@ import 'package:instabug_flutter/src/utils/screen_loading/screen_loading_trace.d import 'package:instabug_flutter/src/utils/screen_loading/ui_trace.dart'; import 'package:meta/meta.dart'; -/// @nodoc +/// Manages screen loading traces and UI traces for performance monitoring. +/// +/// This class handles the tracking of screen loading times and UI transitions, +/// providing an interface for Instabug APM to capture and report performance metrics. @internal class ScreenLoadingManager { ScreenLoadingManager._(); @@ -21,25 +24,33 @@ class ScreenLoadingManager { static ScreenLoadingManager _instance = ScreenLoadingManager._(); + /// Returns the singleton instance of [ScreenLoadingManager]. static ScreenLoadingManager get instance => _instance; /// Shorthand for [instance] static ScreenLoadingManager get I => instance; + + /// Logging tag for debugging purposes. static const tag = "ScreenLoadingManager"; + + /// Stores the current UI trace. UiTrace? currentUiTrace; + + /// Stores the current screen loading trace. ScreenLoadingTrace? currentScreenLoadingTrace; - /// @nodoc + /// Stores prematurely ended traces for debugging purposes. @internal final List prematurelyEndedTraces = []; + /// Allows setting a custom instance for testing. @visibleForTesting // ignore: use_setters_to_change_properties static void setInstance(ScreenLoadingManager instance) { _instance = instance; } - /// @nodoc + /// Resets the flag indicating a screen loading trace has started. @internal void resetDidStartScreenLoading() { // Allows starting a new screen loading capture trace in the same ui trace (without navigating out and in to the same screen) @@ -59,9 +70,8 @@ class ScreenLoadingManager { ); } - /// @nodoc + /// Checks if the Instabug SDK is built before calling API methods. Future _checkInstabugSDKBuilt(String apiName) async { - // Check if Instabug SDK is Built final isInstabugSDKBuilt = await Instabug.isBuilt(); if (!isInstabugSDKBuilt) { InstabugLogger.I.e( @@ -73,7 +83,7 @@ class ScreenLoadingManager { return isInstabugSDKBuilt; } - /// @nodoc + /// Resets the flag indicating a screen loading trace has been reported. @internal void resetDidReportScreenLoading() { // Allows reporting a new screen loading capture trace in the same ui trace even if one was reported before by resetting the flag which is used for checking. @@ -84,7 +94,7 @@ class ScreenLoadingManager { ); } - /// @nodoc + /// Starts a new UI trace with a given screen name. @internal void resetDidExtendScreenLoading() { // Allows reporting a new screen loading capture trace in the same ui trace even if one was reported before by resetting the flag which is used for checking. @@ -176,7 +186,7 @@ class ScreenLoadingManager { } } - /// @nodoc + /// Starts a screen loading trace. @internal Future startScreenLoadingTrace(ScreenLoadingTrace trace) async { try { @@ -225,7 +235,7 @@ class ScreenLoadingManager { } } - /// @nodoc + /// Reports the input [ScreenLoadingTrace] to the native side. @internal Future reportScreenLoading(ScreenLoadingTrace? trace) async { try { diff --git a/lib/src/utils/screen_loading/screen_loading_trace.dart b/packages/instabug_flutter/lib/src/utils/screen_loading/screen_loading_trace.dart similarity index 100% rename from lib/src/utils/screen_loading/screen_loading_trace.dart rename to packages/instabug_flutter/lib/src/utils/screen_loading/screen_loading_trace.dart diff --git a/lib/src/utils/screen_loading/ui_trace.dart b/packages/instabug_flutter/lib/src/utils/screen_loading/ui_trace.dart similarity index 100% rename from lib/src/utils/screen_loading/ui_trace.dart rename to packages/instabug_flutter/lib/src/utils/screen_loading/ui_trace.dart diff --git a/lib/src/utils/screen_name_masker.dart b/packages/instabug_flutter/lib/src/utils/screen_name_masker.dart similarity index 100% rename from lib/src/utils/screen_name_masker.dart rename to packages/instabug_flutter/lib/src/utils/screen_name_masker.dart diff --git a/packages/instabug_flutter/lib/src/utils/user_steps/instabug_user_steps.dart b/packages/instabug_flutter/lib/src/utils/user_steps/instabug_user_steps.dart new file mode 100644 index 000000000..891cd78e2 --- /dev/null +++ b/packages/instabug_flutter/lib/src/utils/user_steps/instabug_user_steps.dart @@ -0,0 +1,261 @@ +import 'dart:async'; +import 'package:flutter/material.dart'; +import 'package:flutter/rendering.dart'; +import 'package:instabug_flutter/instabug_flutter.dart'; +import 'package:instabug_flutter/src/utils/user_steps/user_step_details.dart'; +import 'package:instabug_flutter/src/utils/user_steps/widget_utils.dart'; + +Element? _clickTrackerElement; + +class InstabugUserSteps extends StatefulWidget { + final Widget child; + + const InstabugUserSteps({Key? key, required this.child}) : super(key: key); + + @override + InstabugUserStepsState createState() => InstabugUserStepsState(); + + @override + StatefulElement createElement() { + final element = super.createElement(); + _clickTrackerElement = element; + return element; + } +} + +class InstabugUserStepsState extends State { + static const double _doubleTapThreshold = 300.0; // milliseconds + static const double _pinchSensitivity = 20.0; + static const double _swipeSensitivity = 50.0; + static const double _scrollSensitivity = 50.0; + static const double _tapSensitivity = 20 * 20; + + Timer? _longPressTimer; + Offset? _pointerDownLocation; + GestureType? _gestureType; + String? _gestureMetaData; + DateTime? _lastTapTime; + double _pinchDistance = 0.0; + int _pointerCount = 0; + double? _previousOffset; + + void _onPointerDown(PointerDownEvent event) { + _resetGestureTracking(); + _pointerDownLocation = event.localPosition; + _pointerCount += event.buttons; + _longPressTimer = Timer(const Duration(milliseconds: 500), () { + _gestureType = GestureType.longPress; + }); + } + + void _onPointerUp(PointerUpEvent event, BuildContext context) { + _longPressTimer?.cancel(); + + final gestureType = _detectGestureType(event.localPosition); + if (_gestureType != GestureType.longPress) { + _gestureType = gestureType; + } + + _pointerCount = 0; + + if (_gestureType == null) { + return; + } + final tappedWidget = + _getWidgetDetails(event.localPosition, context, _gestureType!); + if (tappedWidget != null) { + final userStepDetails = tappedWidget.copyWith( + gestureType: _gestureType, + gestureMetaData: _gestureMetaData, + ); + if (userStepDetails.gestureType == null || + userStepDetails.message == null) { + return; + } + + Instabug.logUserSteps( + userStepDetails.gestureType!, + userStepDetails.message!, + userStepDetails.widgetName, + ); + } + } + + GestureType? _detectGestureType(Offset upLocation) { + final delta = upLocation - (_pointerDownLocation ?? Offset.zero); + + if (_pointerCount == 1) { + if (_isTap(delta)) return _detectTapType(); + if (_isSwipe(delta)) return GestureType.swipe; + } else if (_pointerCount == 2 && _isPinch()) { + return GestureType.pinch; + } + + return null; + } + + bool _isTap(Offset delta) => delta.distanceSquared < _tapSensitivity; + + GestureType? _detectTapType() { + final now = DateTime.now(); + final isDoubleTap = _lastTapTime != null && + now.difference(_lastTapTime!).inMilliseconds <= _doubleTapThreshold; + + _lastTapTime = now; + return isDoubleTap ? GestureType.doubleTap : GestureType.tap; + } + + bool _isSwipe(Offset delta) { + final isHorizontal = delta.dx.abs() > delta.dy.abs(); + + if (isHorizontal && delta.dx.abs() > _swipeSensitivity) { + _gestureMetaData = delta.dx > 0 ? "Right" : "Left"; + return true; + } + + if (!isHorizontal && delta.dy.abs() > _swipeSensitivity) { + _gestureMetaData = delta.dy > 0 ? "Down" : "Up"; + return true; + } + + return false; + } + + bool _isPinch() => _pinchDistance.abs() > _pinchSensitivity; + + void _resetGestureTracking() { + _gestureType = null; + _gestureMetaData = null; + _longPressTimer?.cancel(); + } + + UserStepDetails? _getWidgetDetails( + Offset location, + BuildContext context, + GestureType gestureType, + ) { + Element? tappedElement; + var isPrivate = false; + + final rootElement = _clickTrackerElement; + if (rootElement == null || rootElement.widget != widget) return null; + + final hitTestResult = BoxHitTestResult(); + final renderBox = context.findRenderObject()! as RenderBox; + + renderBox.hitTest(hitTestResult, position: _pointerDownLocation!); + + final targets = hitTestResult.path + .where((e) => e.target is RenderBox) + .map((e) => e.target) + .toList(); + + void visitor(Element visitedElement) { + final renderObject = visitedElement.renderObject; + if (renderObject == null) return; + + if (targets.contains(renderObject)) { + final transform = renderObject.getTransformTo(rootElement.renderObject); + final paintBounds = + MatrixUtils.transformRect(transform, renderObject.paintBounds); + + if (paintBounds.contains(_pointerDownLocation!)) { + final widget = visitedElement.widget; + if (!isPrivate) { + isPrivate = widget.runtimeType.toString() == + 'InstabugPrivateView' || + widget.runtimeType.toString() == 'InstabugSliverPrivateView'; + } + if (_isTargetWidget(widget, gestureType)) { + tappedElement = visitedElement; + return; + } + } + } + if (tappedElement == null) { + visitedElement.visitChildElements(visitor); + } + } + + rootElement.visitChildElements(visitor); + if (tappedElement == null) return null; + return UserStepDetails(element: tappedElement, isPrivate: isPrivate); + } + + bool _isTargetWidget(Widget? widget, GestureType type) { + if (widget == null) return false; + switch (type) { + case GestureType.swipe: + return isSwipedWidget(widget); + case GestureType.tap: + case GestureType.longPress: + case GestureType.doubleTap: + return isTappedWidget(widget); + case GestureType.pinch: + return isPinchWidget(widget); + case GestureType.scroll: + return false; + } + } + + void _detectScrollDirection(double currentOffset, Axis direction) { + if (_previousOffset == null) return; + + final delta = (currentOffset - _previousOffset!).abs(); + if (delta < _scrollSensitivity) return; + final String swipeDirection; + if (direction == Axis.horizontal) { + swipeDirection = currentOffset > _previousOffset! ? "Left" : "Right"; + } else { + swipeDirection = currentOffset > _previousOffset! ? "Down" : "Up"; + } + + final userStepDetails = UserStepDetails( + element: null, + isPrivate: false, + gestureMetaData: swipeDirection, + gestureType: GestureType.scroll, + ); + + if (userStepDetails.gestureType == null || + userStepDetails.message == null) { + return; + } + Instabug.logUserSteps( + userStepDetails.gestureType!, + userStepDetails.message!, + "ListView", + ); + } + + @override + Widget build(BuildContext context) { + return Listener( + behavior: HitTestBehavior.translucent, + onPointerDown: _onPointerDown, + onPointerMove: (event) { + if (_pointerCount == 2) { + _pinchDistance = + (event.localPosition - (_pointerDownLocation ?? Offset.zero)) + .distance; + } + }, + onPointerUp: (event) => _onPointerUp(event, context), + child: NotificationListener( + onNotification: (notification) { + if (notification is ScrollStartNotification) { + _previousOffset = notification.metrics.pixels; + } else if (notification is ScrollEndNotification) { + _detectScrollDirection( + notification.metrics.pixels, // Vertical position + notification.metrics.axis, + ); + } + + return true; + }, + child: widget.child, + ), + ); + } +} diff --git a/packages/instabug_flutter/lib/src/utils/user_steps/user_step_details.dart b/packages/instabug_flutter/lib/src/utils/user_steps/user_step_details.dart new file mode 100644 index 000000000..590758eeb --- /dev/null +++ b/packages/instabug_flutter/lib/src/utils/user_steps/user_step_details.dart @@ -0,0 +1,122 @@ +import 'package:flutter/material.dart'; +import 'package:instabug_flutter/src/utils/user_steps/widget_utils.dart'; + +enum GestureType { swipe, scroll, tap, pinch, longPress, doubleTap } + +extension GestureTypeText on GestureType { + String get text { + switch (this) { + case GestureType.swipe: + return "Swiped"; + case GestureType.scroll: + return "Scrolled"; + case GestureType.tap: + return "Tapped"; + case GestureType.pinch: + return "Pinched"; + case GestureType.longPress: + return "Long Pressed"; + case GestureType.doubleTap: + return "Double Tapped"; + } + } +} + +class UserStepDetails { + final Element? element; + final bool isPrivate; + final GestureType? gestureType; + final String? gestureMetaData; + final Widget? widget; + + UserStepDetails({ + required this.element, + required this.isPrivate, + this.gestureType, + this.gestureMetaData, + }) : widget = element?.widget; + + String? get key => widget == null ? null : keyToStringValue(widget!.key); + + String? get widgetName { + if (widget == null) return null; + if (widget is InkWell) { + final inkWell = widget! as InkWell; + if (inkWell.child == null) { + return widget.runtimeType.toString(); + } + return "${inkWell.child.runtimeType} Wrapped with ${widget.runtimeType}"; + } else if (widget is GestureDetector) { + final gestureDetector = widget! as GestureDetector; + + if (gestureDetector.child == null) { + return widget.runtimeType.toString(); + } + return "${gestureDetector.child.runtimeType} Wrapped with ${widget.runtimeType}"; + } + return widget.runtimeType.toString(); + } + + String? get message { + if (gestureType == null) return null; + if (gestureType == GestureType.pinch) { + return gestureType?.text; + } + var baseMessage = ""; + + if (gestureType == GestureType.scroll || gestureType == GestureType.swipe) { + baseMessage += + gestureMetaData?.isNotEmpty == true ? '$gestureMetaData ' : ''; + } + + if (widgetName != null) baseMessage += " $widgetName "; + + if (!isPrivate && widget != null) { + final additionalInfo = _getWidgetSpecificDetails(); + if (additionalInfo != null) baseMessage += additionalInfo; + } + + if (key != null) baseMessage += " with key '$key' "; + + return baseMessage.trimRight(); + } + + String? _getWidgetSpecificDetails() { + if (isSliderWidget(widget!)) { + final value = getSliderValue(widget!); + if (value?.isNotEmpty == true) { + return " to '$value'"; + } + } else if (isTextWidget(widget!) || isButtonWidget(widget!)) { + final label = getLabelRecursively(element!); + if (label?.isNotEmpty == true) { + return "'$label'"; + } + } else if (isToggleableWidget(widget!)) { + final value = getToggleValue(widget!); + if (value?.isNotEmpty == true) { + return " ('$value')"; + } + } else if (isTextInputWidget(widget!)) { + final value = getTextInputValue(widget!); + final hint = getTextHintValue(widget!); + if (value?.isNotEmpty == true) return " '$value'"; + if (hint?.isNotEmpty == true) return "(placeholder:'$hint')"; + } + return null; + } + + UserStepDetails copyWith({ + Element? element, + bool? isPrivate, + GestureType? gestureType, + String? gestureMetaData, + }) { + return UserStepDetails( + element: element ?? this.element, + isPrivate: isPrivate ?? this.isPrivate, + gestureType: gestureType ?? this.gestureType, + gestureMetaData: gestureMetaData ?? this.gestureMetaData, + ); + } +} diff --git a/packages/instabug_flutter/lib/src/utils/user_steps/widget_utils.dart b/packages/instabug_flutter/lib/src/utils/user_steps/widget_utils.dart new file mode 100644 index 000000000..939aa4660 --- /dev/null +++ b/packages/instabug_flutter/lib/src/utils/user_steps/widget_utils.dart @@ -0,0 +1,223 @@ +import 'package:flutter/cupertino.dart'; +import 'package:flutter/material.dart'; + +/// Converts a [Key] into a string representation, supporting various key types. +String? keyToStringValue(Key? key) { + if (key == null) return null; + + if (key is ValueKey) { + return key.value?.toString(); + } else if (key is GlobalObjectKey) { + return key.value.toString(); + } else if (key is ObjectKey) { + return key.value?.toString(); + } + + return key.toString(); +} + +/// Checks if a widget is a button or button-like component. +bool isButtonWidget(Widget widget) { + if (widget is ButtonStyleButton) return widget.enabled; + if (widget is MaterialButton) return widget.enabled; + if (widget is CupertinoButton) return widget.enabled; + if (widget is IconButton) return widget.onPressed != null; + if (widget is FloatingActionButton) return widget.onPressed != null; + if (widget is BackButton) return widget.onPressed != null; + if (widget is PopupMenuButton) return widget.enabled; + if (widget is DropdownButton) return widget.onTap != null; + + if (widget is GestureDetector) { + return widget.onTap != null || + widget.onLongPress != null || + widget.onDoubleTap != null || + widget.onTapDown != null; + } + + if (widget is InkWell) { + return widget.onTap != null || + widget.onLongPress != null || + widget.onDoubleTap != null || + widget.onTapDown != null; + } + + return false; +} + +/// Checks if a widget can respond to tap-related gestures. +bool isTappedWidget(Widget? widget) { + if (widget == null) return false; + + return isButtonWidget(widget) || + isToggleableWidget(widget) || + isSliderWidget(widget) || + isTextInputWidget(widget); +} + +/// Checks if a widget supports swipe gestures. +bool isSwipedWidget(Widget? widget) { + return widget is Slider || + widget is CupertinoSlider || + widget is RangeSlider || + widget is Dismissible; +} + +/// Determines if a widget supports pinch gestures (defaulting to those not tappable or swipeable). +bool isPinchWidget(Widget? widget) { + return !isSwipedWidget(widget); +} + +/// Checks if a widget is primarily for displaying text. +bool isTextWidget(Widget widget) { + return widget is Text || + widget is RichText || + widget is SelectableText || + widget is TextSpan || + widget is Placeholder || + widget is TextStyle; +} + +/// Checks if a widget is a slider. +bool isSliderWidget(Widget widget) { + return widget is Slider || widget is CupertinoSlider || widget is RangeSlider; +} + +/// Checks if a widget is an image or image-like. +bool isImageWidget(Widget? widget) { + if (widget == null) { + return false; + } + final isDefaultImage = widget is Image || + widget is FadeInImage || + widget is NetworkImage || + widget is AssetImage || + widget is Icon || + widget is FileImage || + widget is MemoryImage || + widget is ImageProvider; + + if (isDefaultImage) { + return true; + } + final imageWidgetTypes = { + 'CachedNetworkImage', // From cached_network_image package + 'SvgPicture', // flutter_svg package + 'OctoImage', // octo_image package + }; + + return imageWidgetTypes.contains(widget.runtimeType.toString()); +} + +bool isVideoPlayerWidget(Widget widget) { + final videoPlayerTypes = { + 'VideoPlayer', // flutter_video_player + 'Chewie', // chewie video player + 'BetterPlayer', // better_player package + 'YoutubePlayer', // youtube_player_flutter + 'VlcPlayer', // flutter_vlc_player + 'FlickVideoPlayer', // flick_video_player + }; + + return videoPlayerTypes.contains(widget.runtimeType.toString()); +} + +bool isMedia(Widget widget) { + return isImageWidget(widget) || isVideoPlayerWidget(widget); +} + +/// Checks if a widget is toggleable (e.g., switch, checkbox, etc.). +bool isToggleableWidget(Widget widget) { + return widget is Checkbox || + widget is CheckboxListTile || + widget is Radio || + widget is RadioListTile || + widget is Switch || + widget is SwitchListTile || + widget is CupertinoSwitch || + widget is ToggleButtons; +} + +/// Checks if a widget is a text input field. +bool isTextInputWidget(Widget widget) { + return widget is TextField || + widget is CupertinoTextField || + widget is EditableText; +} + +/// Retrieves the label of a widget if available. +String? getLabel(Widget widget) { + if (widget is Text) return widget.data; + if (widget is Semantics) return widget.properties.label; + if (widget is Icon) return widget.semanticLabel; + if (widget is Tooltip) return widget.message; + + return null; +} + +/// Retrieves the value of a toggleable widget. +String? getToggleValue(Widget widget) { + bool? value; + if (widget is Checkbox) value = widget.value; + if (widget is Radio) return widget.groupValue.toString(); + if (widget is RadioListTile) return widget.groupValue.toString(); + if (widget is Switch) value = widget.value; + if (widget is SwitchListTile) value = widget.value; + if (widget is CupertinoSwitch) value = widget.value; + if (widget is ToggleButtons) return widget.isSelected.toString(); + + if (value == false || value == null) { + return "UnSelected"; + } else if (value) { + return "Selected"; + } + return null; +} + +/// Retrieves the value entered in a text input field. +String? getTextInputValue(Widget widget) { + if (widget is TextField && !widget.obscureText) { + return widget.controller?.text; + } else if (widget is CupertinoTextField && !widget.obscureText) { + return widget.controller?.text; + } else if (widget is EditableText && !widget.obscureText) { + return widget.controller.text; + } + + return null; +} + +/// Retrieves the hint value of a text input widget. +String? getTextHintValue(Widget widget) { + if (widget is TextField && !widget.obscureText) { + return widget.decoration?.hintText ?? widget.decoration?.labelText; + } else if (widget is CupertinoTextField && !widget.obscureText) { + return widget.placeholder; + } + + return null; +} + +/// Retrieves the current value of a slider widget. +String? getSliderValue(Widget widget) { + if (widget is Slider) return widget.value.toString(); + if (widget is CupertinoSlider) return widget.value.toString(); + if (widget is RangeSlider) { + return "(${widget.values.start},${widget.values.end})"; + } + + return null; +} + +/// Recursively searches for a label within a widget hierarchy. +String? getLabelRecursively(Element element) { + String? label; + + void visitor(Element e) { + label ??= getLabel(e.widget); + if (label == null) e.visitChildren(visitor); + } + + visitor(element); + + return label; +} diff --git a/packages/instabug_flutter/lib/src/utils/w3c_header_utils.dart b/packages/instabug_flutter/lib/src/utils/w3c_header_utils.dart new file mode 100644 index 000000000..26c3a8896 --- /dev/null +++ b/packages/instabug_flutter/lib/src/utils/w3c_header_utils.dart @@ -0,0 +1,66 @@ +import 'dart:math'; + +import 'package:flutter/material.dart'; +import 'package:instabug_flutter/src/models/generated_w3c_header.dart'; +import 'package:instabug_flutter/src/models/trace_partial_id.dart'; + +class W3CHeaderUtils { + // Access the singleton instance + factory W3CHeaderUtils() { + return _instance; + } + // Private constructor to prevent instantiation + W3CHeaderUtils._(); + + // Singleton instance + static final W3CHeaderUtils _instance = W3CHeaderUtils._(); + + // Random instance + static Random _random = Random(); + + @visibleForTesting + // Setter for the Random instance + // ignore: use_setters_to_change_properties + void $setRandom(Random random) { + _random = random; + } + + /// Generate random 32-bit unsigned integer Hexadecimal (8 chars) lower case letters + /// Should not return all zeros + TracePartialId generateTracePartialId() { + int randomNumber; + String hexString; + + do { + randomNumber = _random.nextInt(0xffffffff); + hexString = randomNumber.toRadixString(16).padLeft(8, '0'); + } while (hexString == '00000000'); + + return TracePartialId( + numberPartialId: randomNumber, + hexPartialId: hexString.toLowerCase(), + ); + } + + /// Generate W3C header in the format of {version}-{trace-id}-{parent-id}-{trace-flag} + /// @param networkStartTime + /// @returns W3C header + GeneratedW3CHeader generateW3CHeader(int networkStartTime) { + final partialIdData = generateTracePartialId(); + final hexStringPartialId = partialIdData.hexPartialId; + final numberPartialId = partialIdData.numberPartialId; + + final timestampInSeconds = (networkStartTime / 1000).floor(); + final hexaDigitsTimestamp = + timestampInSeconds.toRadixString(16).toLowerCase(); + final traceId = + '$hexaDigitsTimestamp$hexStringPartialId$hexaDigitsTimestamp$hexStringPartialId'; + final parentId = '4942472d$hexStringPartialId'; + + return GeneratedW3CHeader( + timestampInSeconds: timestampInSeconds, + partialId: numberPartialId, + w3cHeader: '00-$traceId-$parentId-01', + ); + } +} diff --git a/packages/instabug_flutter/package.json b/packages/instabug_flutter/package.json new file mode 100644 index 000000000..52b3a844e --- /dev/null +++ b/packages/instabug_flutter/package.json @@ -0,0 +1,9 @@ +{ + "name": "Instabug-Flutter", + "version": "0.0.0", + "devDependencies": { + "@instabug/danger-plugin-coverage": "Instabug/danger-plugin-coverage", + "danger": "^11.2.5", + "typescript": "^5.0.4" + } +} diff --git a/pigeons/apm.api.dart b/packages/instabug_flutter/pigeons/apm.api.dart similarity index 82% rename from pigeons/apm.api.dart rename to packages/instabug_flutter/pigeons/apm.api.dart index 84fe9eb8e..25beca00e 100644 --- a/pigeons/apm.api.dart +++ b/packages/instabug_flutter/pigeons/apm.api.dart @@ -11,18 +11,9 @@ abstract class ApmHostApi { void setColdAppLaunchEnabled(bool isEnabled); void setAutoUITraceEnabled(bool isEnabled); - @async - String? startExecutionTrace(String id, String name); - void startFlow(String name); void setFlowAttribute(String name, String key, String? value); void endFlow(String name); - void setExecutionTraceAttribute( - String id, - String key, - String value, - ); - void endExecutionTrace(String id); void startUITrace(String name); void endUITrace(); void endAppLaunch(); diff --git a/pigeons/bug_reporting.api.dart b/packages/instabug_flutter/pigeons/bug_reporting.api.dart similarity index 89% rename from pigeons/bug_reporting.api.dart rename to packages/instabug_flutter/pigeons/bug_reporting.api.dart index faa180893..8bf127531 100644 --- a/pigeons/bug_reporting.api.dart +++ b/packages/instabug_flutter/pigeons/bug_reporting.api.dart @@ -32,4 +32,11 @@ abstract class BugReportingHostApi { int limit, List? reportTypes, ); + void addUserConsents( + String key, + String description, + bool mandatory, + bool checked, + String? actionType, + ); } diff --git a/pigeons/crash_reporting.api.dart b/packages/instabug_flutter/pigeons/crash_reporting.api.dart similarity index 100% rename from pigeons/crash_reporting.api.dart rename to packages/instabug_flutter/pigeons/crash_reporting.api.dart diff --git a/pigeons/feature_requests.api.dart b/packages/instabug_flutter/pigeons/feature_requests.api.dart similarity index 100% rename from pigeons/feature_requests.api.dart rename to packages/instabug_flutter/pigeons/feature_requests.api.dart diff --git a/pigeons/instabug.api.dart b/packages/instabug_flutter/pigeons/instabug.api.dart similarity index 65% rename from pigeons/instabug.api.dart rename to packages/instabug_flutter/pigeons/instabug.api.dart index b839f8d1e..acdedb5ff 100644 --- a/pigeons/instabug.api.dart +++ b/packages/instabug_flutter/pigeons/instabug.api.dart @@ -1,41 +1,80 @@ import 'package:pigeon/pigeon.dart'; +@FlutterApi() +abstract class FeatureFlagsFlutterApi { + void onW3CFeatureFlagChange( + bool isW3cExternalTraceIDEnabled, + bool isW3cExternalGeneratedHeaderEnabled, + bool isW3cCaughtHeaderEnabled, + ); +} + @HostApi() abstract class InstabugHostApi { void setEnabled(bool isEnabled); + bool isEnabled(); + bool isBuilt(); - void init(String token, List invocationEvents, String debugLogsLevel); + + void init( + String token, + List invocationEvents, + String debugLogsLevel, + String? appVariant, + ); + + void enableAutoMasking(List autoMasking); void show(); + void showWelcomeMessageWithMode(String mode); void identifyUser(String email, String? name, String? userId); + void setUserData(String data); + + void setAppVariant(String appVariant); + void logUserEvent(String name); + void logOut(); + void setEnableUserSteps(bool isEnabled); + + void logUserSteps( + String gestureType, + String message, + String? viewName, + ); + void setLocale(String locale); + void setColorTheme(String theme); + void setWelcomeMessageMode(String mode); + void setPrimaryColor(int color); + void setSessionProfilerEnabled(bool enabled); + void setValueForStringWithKey(String value, String key); void appendTags(List tags); + void resetTags(); @async List? getTags(); - void addExperiments(List experiments); - void removeExperiments(List experiments); - void clearAllExperiments(); void addFeatureFlags(Map featureFlagsMap); + void removeFeatureFlags(List featureFlags); + void removeAllFeatureFlags(); void setUserAttribute(String value, String key); + void removeUserAttribute(String key); @async @@ -49,16 +88,29 @@ abstract class InstabugHostApi { String? crashMode, String? sessionReplayMode, ); + void reportScreenChange(String screenName); void setCustomBrandingImage(String light, String dark); + void setFont(String font); void addFileAttachmentWithURL(String filePath, String fileName); + void addFileAttachmentWithData(Uint8List data, String fileName); + void clearFileAttachments(); void networkLog(Map data); + void registerFeatureFlagChangeListener(); + + Map isW3CFeatureFlagsEnabled(); + void willRedirectToStore(); + + void setNetworkLogBodyEnabled(bool isEnabled); + + void setTheme(Map themeConfig); + void setFullscreen(bool isEnabled); } diff --git a/pigeons/instabug_log.api.dart b/packages/instabug_flutter/pigeons/instabug_log.api.dart similarity index 100% rename from pigeons/instabug_log.api.dart rename to packages/instabug_flutter/pigeons/instabug_log.api.dart diff --git a/packages/instabug_flutter/pigeons/instabug_private_view.api.dart b/packages/instabug_flutter/pigeons/instabug_private_view.api.dart new file mode 100644 index 000000000..9a84a63f3 --- /dev/null +++ b/packages/instabug_flutter/pigeons/instabug_private_view.api.dart @@ -0,0 +1,11 @@ +import 'package:pigeon/pigeon.dart'; + +@FlutterApi() +abstract class InstabugPrivateViewFlutterApi { + List getPrivateViews(); +} + +@HostApi() +abstract class InstabugPrivateViewHostApi { + void init(); +} diff --git a/pigeons/replies.api.dart b/packages/instabug_flutter/pigeons/replies.api.dart similarity index 100% rename from pigeons/replies.api.dart rename to packages/instabug_flutter/pigeons/replies.api.dart diff --git a/pigeons/session_replay.api.dart b/packages/instabug_flutter/pigeons/session_replay.api.dart similarity index 100% rename from pigeons/session_replay.api.dart rename to packages/instabug_flutter/pigeons/session_replay.api.dart diff --git a/pigeons/surveys.api.dart b/packages/instabug_flutter/pigeons/surveys.api.dart similarity index 100% rename from pigeons/surveys.api.dart rename to packages/instabug_flutter/pigeons/surveys.api.dart diff --git a/packages/instabug_flutter/pubspec.lock b/packages/instabug_flutter/pubspec.lock new file mode 100644 index 000000000..5adceef62 --- /dev/null +++ b/packages/instabug_flutter/pubspec.lock @@ -0,0 +1,717 @@ +# Generated by pub +# See https://dart.dev/tools/pub/glossary#lockfile +packages: + _fe_analyzer_shared: + dependency: transitive + description: + name: _fe_analyzer_shared + sha256: ae92f5d747aee634b87f89d9946000c2de774be1d6ac3e58268224348cd0101a + url: "https://pub.dev" + source: hosted + version: "61.0.0" + analyzer: + dependency: transitive + description: + name: analyzer + sha256: ea3d8652bda62982addfd92fdc2d0214e5f82e43325104990d4f4c4a2a313562 + url: "https://pub.dev" + source: hosted + version: "5.13.0" + args: + dependency: transitive + description: + name: args + sha256: d0481093c50b1da8910eb0bb301626d4d8eb7284aa739614d2b394ee09e3ea04 + url: "https://pub.dev" + source: hosted + version: "2.7.0" + async: + dependency: transitive + description: + name: async + sha256: "947bfcf187f74dbc5e146c9eb9c0f10c9f8b30743e341481c1e2ed3ecc18c20c" + url: "https://pub.dev" + source: hosted + version: "2.11.0" + boolean_selector: + dependency: transitive + description: + name: boolean_selector + sha256: "6cfb5af12253eaf2b368f07bacc5a80d1301a071c73360d746b7f2e32d762c66" + url: "https://pub.dev" + source: hosted + version: "2.1.1" + build: + dependency: transitive + description: + name: build + sha256: "80184af8b6cb3e5c1c4ec6d8544d27711700bc3e6d2efad04238c7b5290889f0" + url: "https://pub.dev" + source: hosted + version: "2.4.1" + build_config: + dependency: transitive + description: + name: build_config + sha256: "4ae2de3e1e67ea270081eaee972e1bd8f027d459f249e0f1186730784c2e7e33" + url: "https://pub.dev" + source: hosted + version: "1.1.2" + build_daemon: + dependency: transitive + description: + name: build_daemon + sha256: "8e928697a82be082206edb0b9c99c5a4ad6bc31c9e9b8b2f291ae65cd4a25daa" + url: "https://pub.dev" + source: hosted + version: "4.0.4" + build_resolvers: + dependency: transitive + description: + name: build_resolvers + sha256: "339086358431fa15d7eca8b6a36e5d783728cf025e559b834f4609a1fcfb7b0a" + url: "https://pub.dev" + source: hosted + version: "2.4.2" + build_runner: + dependency: "direct dev" + description: + name: build_runner + sha256: "028819cfb90051c6b5440c7e574d1896f8037e3c96cf17aaeb054c9311cfbf4d" + url: "https://pub.dev" + source: hosted + version: "2.4.13" + build_runner_core: + dependency: transitive + description: + name: build_runner_core + sha256: f8126682b87a7282a339b871298cc12009cb67109cfa1614d6436fb0289193e0 + url: "https://pub.dev" + source: hosted + version: "7.3.2" + built_collection: + dependency: transitive + description: + name: built_collection + sha256: "376e3dd27b51ea877c28d525560790aee2e6fbb5f20e2f85d5081027d94e2100" + url: "https://pub.dev" + source: hosted + version: "5.1.1" + built_value: + dependency: transitive + description: + name: built_value + sha256: ba95c961bafcd8686d1cf63be864eb59447e795e124d98d6a27d91fcd13602fb + url: "https://pub.dev" + source: hosted + version: "8.11.1" + characters: + dependency: transitive + description: + name: characters + sha256: "04a925763edad70e8443c99234dc3328f442e811f1d8fd1a72f1c8ad0f69a605" + url: "https://pub.dev" + source: hosted + version: "1.3.0" + checked_yaml: + dependency: transitive + description: + name: checked_yaml + sha256: feb6bed21949061731a7a75fc5d2aa727cf160b91af9a3e464c5e3a32e28b5ff + url: "https://pub.dev" + source: hosted + version: "2.0.3" + cli_config: + dependency: transitive + description: + name: cli_config + sha256: ac20a183a07002b700f0c25e61b7ee46b23c309d76ab7b7640a028f18e4d99ec + url: "https://pub.dev" + source: hosted + version: "0.2.0" + cli_util: + dependency: transitive + description: + name: cli_util + sha256: ff6785f7e9e3c38ac98b2fb035701789de90154024a75b6cb926445e83197d1c + url: "https://pub.dev" + source: hosted + version: "0.4.2" + clock: + dependency: transitive + description: + name: clock + sha256: cb6d7f03e1de671e34607e909a7213e31d7752be4fb66a86d29fe1eb14bfb5cf + url: "https://pub.dev" + source: hosted + version: "1.1.1" + code_builder: + dependency: transitive + description: + name: code_builder + sha256: "0ec10bf4a89e4c613960bf1e8b42c64127021740fb21640c29c909826a5eea3e" + url: "https://pub.dev" + source: hosted + version: "4.10.1" + collection: + dependency: transitive + description: + name: collection + sha256: a1ace0a119f20aabc852d165077c036cd864315bd99b7eaa10a60100341941bf + url: "https://pub.dev" + source: hosted + version: "1.19.0" + convert: + dependency: transitive + description: + name: convert + sha256: b30acd5944035672bc15c6b7a8b47d773e41e2f17de064350988c5d02adb1c68 + url: "https://pub.dev" + source: hosted + version: "3.1.2" + coverage: + dependency: transitive + description: + name: coverage + sha256: "5da775aa218eaf2151c721b16c01c7676fbfdd99cebba2bf64e8b807a28ff94d" + url: "https://pub.dev" + source: hosted + version: "1.15.0" + crypto: + dependency: transitive + description: + name: crypto + sha256: "1e445881f28f22d6140f181e07737b22f1e099a5e1ff94b0af2f9e4a463f4855" + url: "https://pub.dev" + source: hosted + version: "3.0.6" + csslib: + dependency: transitive + description: + name: csslib + sha256: "09bad715f418841f976c77db72d5398dc1253c21fb9c0c7f0b0b985860b2d58e" + url: "https://pub.dev" + source: hosted + version: "1.0.2" + dart_style: + dependency: transitive + description: + name: dart_style + sha256: "1efa911ca7086affd35f463ca2fc1799584fb6aa89883cf0af8e3664d6a02d55" + url: "https://pub.dev" + source: hosted + version: "2.3.2" + fake_async: + dependency: "direct dev" + description: + name: fake_async + sha256: "511392330127add0b769b75a987850d136345d9227c6b94c96a04cf4a391bf78" + url: "https://pub.dev" + source: hosted + version: "1.3.1" + file: + dependency: transitive + description: + name: file + sha256: a3b4f84adafef897088c160faf7dfffb7696046cb13ae90b508c2cbc95d3b8d4 + url: "https://pub.dev" + source: hosted + version: "7.0.1" + fixnum: + dependency: transitive + description: + name: fixnum + sha256: b6dc7065e46c974bc7c5f143080a6764ec7a4be6da1285ececdc37be96de53be + url: "https://pub.dev" + source: hosted + version: "1.1.1" + flutter: + dependency: "direct main" + description: flutter + source: sdk + version: "0.0.0" + flutter_test: + dependency: "direct dev" + description: flutter + source: sdk + version: "0.0.0" + frontend_server_client: + dependency: transitive + description: + name: frontend_server_client + sha256: f64a0333a82f30b0cca061bc3d143813a486dc086b574bfb233b7c1372427694 + url: "https://pub.dev" + source: hosted + version: "4.0.0" + glob: + dependency: transitive + description: + name: glob + sha256: c3f1ee72c96f8f78935e18aa8cecced9ab132419e8625dc187e1c2408efc20de + url: "https://pub.dev" + source: hosted + version: "2.1.3" + graphs: + dependency: transitive + description: + name: graphs + sha256: "741bbf84165310a68ff28fe9e727332eef1407342fca52759cb21ad8177bb8d0" + url: "https://pub.dev" + source: hosted + version: "2.3.2" + html: + dependency: transitive + description: + name: html + sha256: "6d1264f2dffa1b1101c25a91dff0dc2daee4c18e87cd8538729773c073dbf602" + url: "https://pub.dev" + source: hosted + version: "0.15.6" + http: + dependency: transitive + description: + name: http + sha256: "2c11f3f94c687ee9bad77c171151672986360b2b001d109814ee7140b2cf261b" + url: "https://pub.dev" + source: hosted + version: "1.4.0" + http_multi_server: + dependency: transitive + description: + name: http_multi_server + sha256: aa6199f908078bb1c5efb8d8638d4ae191aac11b311132c3ef48ce352fb52ef8 + url: "https://pub.dev" + source: hosted + version: "3.2.2" + http_parser: + dependency: transitive + description: + name: http_parser + sha256: "178d74305e7866013777bab2c3d8726205dc5a4dd935297175b19a23a2e66571" + url: "https://pub.dev" + source: hosted + version: "4.1.2" + io: + dependency: transitive + description: + name: io + sha256: dfd5a80599cf0165756e3181807ed3e77daf6dd4137caaad72d0b7931597650b + url: "https://pub.dev" + source: hosted + version: "1.0.5" + js: + dependency: transitive + description: + name: js + sha256: c1b2e9b5ea78c45e1a0788d29606ba27dc5f71f019f32ca5140f61ef071838cf + url: "https://pub.dev" + source: hosted + version: "0.7.1" + json_annotation: + dependency: transitive + description: + name: json_annotation + sha256: "1ce844379ca14835a50d2f019a3099f419082cfdd231cd86a142af94dd5c6bb1" + url: "https://pub.dev" + source: hosted + version: "4.9.0" + leak_tracker: + dependency: transitive + description: + name: leak_tracker + sha256: "7bb2830ebd849694d1ec25bf1f44582d6ac531a57a365a803a6034ff751d2d06" + url: "https://pub.dev" + source: hosted + version: "10.0.7" + leak_tracker_flutter_testing: + dependency: transitive + description: + name: leak_tracker_flutter_testing + sha256: "9491a714cca3667b60b5c420da8217e6de0d1ba7a5ec322fab01758f6998f379" + url: "https://pub.dev" + source: hosted + version: "3.0.8" + leak_tracker_testing: + dependency: transitive + description: + name: leak_tracker_testing + sha256: "6ba465d5d76e67ddf503e1161d1f4a6bc42306f9d66ca1e8f079a47290fb06d3" + url: "https://pub.dev" + source: hosted + version: "3.0.1" + lint: + dependency: "direct dev" + description: + name: lint + sha256: "4a539aa34ec5721a2c7574ae2ca0336738ea4adc2a34887d54b7596310b33c85" + url: "https://pub.dev" + source: hosted + version: "1.10.0" + lints: + dependency: transitive + description: + name: lints + sha256: cbf8d4b858bb0134ef3ef87841abdf8d63bfc255c266b7bf6b39daa1085c4290 + url: "https://pub.dev" + source: hosted + version: "3.0.0" + logging: + dependency: transitive + description: + name: logging + sha256: c8245ada5f1717ed44271ed1c26b8ce85ca3228fd2ffdb75468ab01979309d61 + url: "https://pub.dev" + source: hosted + version: "1.3.0" + markdown: + dependency: transitive + description: + name: markdown + sha256: "935e23e1ff3bc02d390bad4d4be001208ee92cc217cb5b5a6c19bc14aaa318c1" + url: "https://pub.dev" + source: hosted + version: "7.3.0" + matcher: + dependency: transitive + description: + name: matcher + sha256: d2323aa2060500f906aa31a895b4030b6da3ebdcc5619d14ce1aada65cd161cb + url: "https://pub.dev" + source: hosted + version: "0.12.16+1" + material_color_utilities: + dependency: transitive + description: + name: material_color_utilities + sha256: f7142bb1154231d7ea5f96bc7bde4bda2a0945d2806bb11670e30b850d56bdec + url: "https://pub.dev" + source: hosted + version: "0.11.1" + meta: + dependency: "direct main" + description: + name: meta + sha256: bdb68674043280c3428e9ec998512fb681678676b3c54e773629ffe74419f8c7 + url: "https://pub.dev" + source: hosted + version: "1.15.0" + mime: + dependency: transitive + description: + name: mime + sha256: "41a20518f0cb1256669420fdba0cd90d21561e560ac240f26ef8322e45bb7ed6" + url: "https://pub.dev" + source: hosted + version: "2.0.0" + mockito: + dependency: "direct dev" + description: + name: mockito + sha256: "6841eed20a7befac0ce07df8116c8b8233ed1f4486a7647c7fc5a02ae6163917" + url: "https://pub.dev" + source: hosted + version: "5.4.4" + node_preamble: + dependency: transitive + description: + name: node_preamble + sha256: "6e7eac89047ab8a8d26cf16127b5ed26de65209847630400f9aefd7cd5c730db" + url: "https://pub.dev" + source: hosted + version: "2.0.2" + package_config: + dependency: transitive + description: + name: package_config + sha256: f096c55ebb7deb7e384101542bfba8c52696c1b56fca2eb62827989ef2353bbc + url: "https://pub.dev" + source: hosted + version: "2.2.0" + pana: + dependency: "direct dev" + description: + name: pana + sha256: "3fc3fe8e7a9fd4827fa4d625a423eec95d305b2bc3538a3adf7fd6c49217af97" + url: "https://pub.dev" + source: hosted + version: "0.21.45" + path: + dependency: transitive + description: + name: path + sha256: "087ce49c3f0dc39180befefc60fdb4acd8f8620e5682fe2476afd0b3688bb4af" + url: "https://pub.dev" + source: hosted + version: "1.9.0" + pigeon: + dependency: "direct dev" + description: + name: pigeon + sha256: "6eb9702acc25d5ec340bd1b751e511e2982189dfc40c12e2d69db6e05bab03be" + url: "https://pub.dev" + source: hosted + version: "10.1.5" + pool: + dependency: transitive + description: + name: pool + sha256: "20fe868b6314b322ea036ba325e6fc0711a22948856475e2c2b6306e8ab39c2a" + url: "https://pub.dev" + source: hosted + version: "1.5.1" + pub_semver: + dependency: transitive + description: + name: pub_semver + sha256: "5bfcf68ca79ef689f8990d1160781b4bad40a3bd5e5218ad4076ddb7f4081585" + url: "https://pub.dev" + source: hosted + version: "2.2.0" + pubspec_parse: + dependency: transitive + description: + name: pubspec_parse + sha256: "0560ba233314abbed0a48a2956f7f022cce7c3e1e73df540277da7544cad4082" + url: "https://pub.dev" + source: hosted + version: "1.5.0" + retry: + dependency: transitive + description: + name: retry + sha256: "822e118d5b3aafed083109c72d5f484c6dc66707885e07c0fbcb8b986bba7efc" + url: "https://pub.dev" + source: hosted + version: "3.1.2" + safe_url_check: + dependency: transitive + description: + name: safe_url_check + sha256: "49a3e060a7869cbafc8f4845ca1ecbbaaa53179980a32f4fdfeab1607e90f41d" + url: "https://pub.dev" + source: hosted + version: "1.1.2" + shelf: + dependency: transitive + description: + name: shelf + sha256: e7dd780a7ffb623c57850b33f43309312fc863fb6aa3d276a754bb299839ef12 + url: "https://pub.dev" + source: hosted + version: "1.4.2" + shelf_packages_handler: + dependency: transitive + description: + name: shelf_packages_handler + sha256: "89f967eca29607c933ba9571d838be31d67f53f6e4ee15147d5dc2934fee1b1e" + url: "https://pub.dev" + source: hosted + version: "3.0.2" + shelf_static: + dependency: transitive + description: + name: shelf_static + sha256: c87c3875f91262785dade62d135760c2c69cb217ac759485334c5857ad89f6e3 + url: "https://pub.dev" + source: hosted + version: "1.1.3" + shelf_web_socket: + dependency: transitive + description: + name: shelf_web_socket + sha256: cc36c297b52866d203dbf9332263c94becc2fe0ceaa9681d07b6ef9807023b67 + url: "https://pub.dev" + source: hosted + version: "2.0.1" + sky_engine: + dependency: transitive + description: flutter + source: sdk + version: "0.0.0" + source_gen: + dependency: transitive + description: + name: source_gen + sha256: "14658ba5f669685cd3d63701d01b31ea748310f7ab854e471962670abcf57832" + url: "https://pub.dev" + source: hosted + version: "1.5.0" + source_map_stack_trace: + dependency: transitive + description: + name: source_map_stack_trace + sha256: c0713a43e323c3302c2abe2a1cc89aa057a387101ebd280371d6a6c9fa68516b + url: "https://pub.dev" + source: hosted + version: "2.1.2" + source_maps: + dependency: transitive + description: + name: source_maps + sha256: "190222579a448b03896e0ca6eca5998fa810fda630c1d65e2f78b3f638f54812" + url: "https://pub.dev" + source: hosted + version: "0.10.13" + source_span: + dependency: transitive + description: + name: source_span + sha256: "53e943d4206a5e30df338fd4c6e7a077e02254531b138a15aec3bd143c1a8b3c" + url: "https://pub.dev" + source: hosted + version: "1.10.0" + stack_trace: + dependency: "direct main" + description: + name: stack_trace + sha256: "9f47fd3630d76be3ab26f0ee06d213679aa425996925ff3feffdec504931c377" + url: "https://pub.dev" + source: hosted + version: "1.12.0" + stream_channel: + dependency: transitive + description: + name: stream_channel + sha256: ba2aa5d8cc609d96bbb2899c28934f9e1af5cddbd60a827822ea467161eb54e7 + url: "https://pub.dev" + source: hosted + version: "2.1.2" + stream_transform: + dependency: transitive + description: + name: stream_transform + sha256: ad47125e588cfd37a9a7f86c7d6356dde8dfe89d071d293f80ca9e9273a33871 + url: "https://pub.dev" + source: hosted + version: "2.1.1" + string_scanner: + dependency: transitive + description: + name: string_scanner + sha256: "688af5ed3402a4bde5b3a6c15fd768dbf2621a614950b17f04626c431ab3c4c3" + url: "https://pub.dev" + source: hosted + version: "1.3.0" + tar: + dependency: transitive + description: + name: tar + sha256: "22f67e2d77b51050436620b2a5de521c58ca6f0b75af1d9ab3c8cae2eae58fcd" + url: "https://pub.dev" + source: hosted + version: "1.0.5" + term_glyph: + dependency: transitive + description: + name: term_glyph + sha256: a29248a84fbb7c79282b40b8c72a1209db169a2e0542bce341da992fe1bc7e84 + url: "https://pub.dev" + source: hosted + version: "1.2.1" + test: + dependency: transitive + description: + name: test + sha256: "713a8789d62f3233c46b4a90b174737b2c04cb6ae4500f2aa8b1be8f03f5e67f" + url: "https://pub.dev" + source: hosted + version: "1.25.8" + test_api: + dependency: transitive + description: + name: test_api + sha256: "664d3a9a64782fcdeb83ce9c6b39e78fd2971d4e37827b9b06c3aa1edc5e760c" + url: "https://pub.dev" + source: hosted + version: "0.7.3" + test_core: + dependency: transitive + description: + name: test_core + sha256: "12391302411737c176b0b5d6491f466b0dd56d4763e347b6714efbaa74d7953d" + url: "https://pub.dev" + source: hosted + version: "0.6.5" + timing: + dependency: transitive + description: + name: timing + sha256: "62ee18aca144e4a9f29d212f5a4c6a053be252b895ab14b5821996cff4ed90fe" + url: "https://pub.dev" + source: hosted + version: "1.0.2" + typed_data: + dependency: transitive + description: + name: typed_data + sha256: f9049c039ebfeb4cf7a7104a675823cd72dba8297f264b6637062516699fa006 + url: "https://pub.dev" + source: hosted + version: "1.4.0" + vector_math: + dependency: transitive + description: + name: vector_math + sha256: "80b3257d1492ce4d091729e3a67a60407d227c27241d6927be0130c98e741803" + url: "https://pub.dev" + source: hosted + version: "2.1.4" + vm_service: + dependency: transitive + description: + name: vm_service + sha256: f6be3ed8bd01289b34d679c2b62226f63c0e69f9fd2e50a6b3c1c729a961041b + url: "https://pub.dev" + source: hosted + version: "14.3.0" + watcher: + dependency: transitive + description: + name: watcher + sha256: "0b7fd4a0bbc4b92641dbf20adfd7e3fd1398fe17102d94b674234563e110088a" + url: "https://pub.dev" + source: hosted + version: "1.1.2" + web: + dependency: transitive + description: + name: web + sha256: "868d88a33d8a87b18ffc05f9f030ba328ffefba92d6c127917a2ba740f9cfe4a" + url: "https://pub.dev" + source: hosted + version: "1.1.1" + web_socket: + dependency: transitive + description: + name: web_socket + sha256: "34d64019aa8e36bf9842ac014bb5d2f5586ca73df5e4d9bf5c936975cae6982c" + url: "https://pub.dev" + source: hosted + version: "1.0.1" + web_socket_channel: + dependency: transitive + description: + name: web_socket_channel + sha256: d645757fb0f4773d602444000a8131ff5d48c9e47adfe9772652dd1a4f2d45c8 + url: "https://pub.dev" + source: hosted + version: "3.0.3" + webkit_inspection_protocol: + dependency: transitive + description: + name: webkit_inspection_protocol + sha256: "87d3f2333bb240704cd3f1c6b5b7acd8a10e7f0bc28c28dcf14e782014f4a572" + url: "https://pub.dev" + source: hosted + version: "1.2.1" + yaml: + dependency: transitive + description: + name: yaml + sha256: b9da305ac7c39faa3f030eccd175340f968459dae4af175130b3fc47e40d76ce + url: "https://pub.dev" + source: hosted + version: "3.1.3" +sdks: + dart: ">=3.6.0 <4.0.0" + flutter: ">=3.18.0-18.0.pre.54" diff --git a/packages/instabug_flutter/pubspec.yaml b/packages/instabug_flutter/pubspec.yaml new file mode 100644 index 000000000..86884fb71 --- /dev/null +++ b/packages/instabug_flutter/pubspec.yaml @@ -0,0 +1,39 @@ +name: instabug_flutter +version: 15.0.2 +description: >- + Instabug empowers mobile teams to monitor, prioritize, and debug + performance and stability issues throughout the app development lifecycle. +homepage: https://www.instabug.com/platforms/flutter +repository: https://github.com/Instabug/Instabug-Flutter +documentation: https://docs.instabug.com/docs/flutter-overview + +dependencies: + flutter: + sdk: flutter + meta: ^1.3.0 + stack_trace: ^1.10.0 + +dev_dependencies: + build_runner: ^2.0.3 + fake_async: ">=1.2.0 <1.4.0" + flutter_test: + sdk: flutter + lint: ^1.0.0 + # mockito v5.2.0 is needed for running Flutter 2 tests on CI + mockito: ">=5.2.0 <5.5.0" + pana: ^0.21.0 + # pigeon v3.0.0 is needed for running Flutter 2 tests on CI + pigeon: ">=3.0.0 <=10.1.5" + +flutter: + plugin: + platforms: + android: + package: com.instabug.flutter + pluginClass: InstabugFlutterPlugin + ios: + pluginClass: InstabugFlutterPlugin + +environment: + sdk: ">=2.14.0 <4.0.0" + flutter: ">=1.17.0" diff --git a/scripts/pigeon.sh b/packages/instabug_flutter/scripts/pigeon.sh similarity index 100% rename from scripts/pigeon.sh rename to packages/instabug_flutter/scripts/pigeon.sh diff --git a/test/apm_test.dart b/packages/instabug_flutter/test/apm_test.dart similarity index 82% rename from test/apm_test.dart rename to packages/instabug_flutter/test/apm_test.dart index c801926f3..16cc2f26d 100644 --- a/test/apm_test.dart +++ b/packages/instabug_flutter/test/apm_test.dart @@ -86,48 +86,6 @@ void main() { ).called(1); }); - test('[startExecutionTrace] should call host method', () async { - final id = DateTime.now(); - const name = "trace"; - - when(mDateTime.now()).thenAnswer((_) => id); - when(mHost.startExecutionTrace(id.toString(), name)) - .thenAnswer((_) async => id.toString()); - - // ignore: deprecated_member_use_from_same_package - final trace = await APM.startExecutionTrace(name); - - expect(trace.id, id.toString()); - - verify( - mHost.startExecutionTrace(id.toString(), name), - ).called(1); - }); - - test('[setExecutionTraceAttribute] should call host method', () async { - final id = DateTime.now().toString(); - const key = "attr-key"; - const attribute = "Trace Attribute"; - - // ignore: deprecated_member_use_from_same_package - await APM.setExecutionTraceAttribute(id, key, attribute); - - verify( - mHost.setExecutionTraceAttribute(id, key, attribute), - ).called(1); - }); - - test('[endExecutionTrace] should call host method', () async { - final id = DateTime.now().toString(); - - // ignore: deprecated_member_use_from_same_package - await APM.endExecutionTrace(id); - - verify( - mHost.endExecutionTrace(id), - ).called(1); - }); - test('[startFlow] should call host method', () async { const flowName = "flow-name"; await APM.startFlow(flowName); diff --git a/test/bug_reporting_test.dart b/packages/instabug_flutter/test/bug_reporting_test.dart similarity index 100% rename from test/bug_reporting_test.dart rename to packages/instabug_flutter/test/bug_reporting_test.dart diff --git a/test/crash_reporting_test.dart b/packages/instabug_flutter/test/crash_reporting_test.dart similarity index 100% rename from test/crash_reporting_test.dart rename to packages/instabug_flutter/test/crash_reporting_test.dart diff --git a/packages/instabug_flutter/test/feature_flags_manager_test.dart b/packages/instabug_flutter/test/feature_flags_manager_test.dart new file mode 100644 index 000000000..1a78f666c --- /dev/null +++ b/packages/instabug_flutter/test/feature_flags_manager_test.dart @@ -0,0 +1,84 @@ +import 'package:flutter/material.dart'; +import 'package:flutter_test/flutter_test.dart'; +import 'package:instabug_flutter/src/generated/instabug.api.g.dart'; +import 'package:instabug_flutter/src/utils/feature_flags_manager.dart'; +import 'package:instabug_flutter/src/utils/ibg_build_info.dart'; +import 'package:mockito/annotations.dart'; +import 'package:mockito/mockito.dart'; + +import 'feature_flags_manager_test.mocks.dart'; + +@GenerateMocks([InstabugHostApi, IBGBuildInfo]) +void main() { + TestWidgetsFlutterBinding.ensureInitialized(); + WidgetsFlutterBinding.ensureInitialized(); + + final mInstabugHost = MockInstabugHostApi(); + final mBuildInfo = MockIBGBuildInfo(); + + setUpAll(() { + FeatureFlagsManager().$setHostApi(mInstabugHost); + IBGBuildInfo.setInstance(mBuildInfo); + }); + + tearDown(() { + reset(mInstabugHost); + }); + + test('[getW3CFeatureFlagsHeader] should call host method on IOS', () async { + when(mBuildInfo.isAndroid).thenReturn(false); + when(mInstabugHost.isW3CFeatureFlagsEnabled()).thenAnswer( + (_) => Future.value({ + "isW3cExternalTraceIDEnabled": true, + "isW3cExternalGeneratedHeaderEnabled": true, + "isW3cCaughtHeaderEnabled": true, + }), + ); + final isW3CExternalTraceID = + await FeatureFlagsManager().getW3CFeatureFlagsHeader(); + expect(isW3CExternalTraceID.isW3cExternalTraceIDEnabled, true); + expect(isW3CExternalTraceID.isW3cExternalGeneratedHeaderEnabled, true); + expect(isW3CExternalTraceID.isW3cCaughtHeaderEnabled, true); + + verify( + mInstabugHost.isW3CFeatureFlagsEnabled(), + ).called(1); + }); + + test('[isW3CExternalTraceID] should call host method on Android', () async { + when(mBuildInfo.isAndroid).thenReturn(true); + when(mInstabugHost.isW3CFeatureFlagsEnabled()).thenAnswer( + (_) => Future.value({ + "isW3cExternalTraceIDEnabled": true, + "isW3cExternalGeneratedHeaderEnabled": true, + "isW3cCaughtHeaderEnabled": true, + }), + ); + await FeatureFlagsManager().registerW3CFlagsListener(); + + final isW3CExternalTraceID = + await FeatureFlagsManager().getW3CFeatureFlagsHeader(); + expect(isW3CExternalTraceID.isW3cExternalTraceIDEnabled, true); + expect(isW3CExternalTraceID.isW3cExternalGeneratedHeaderEnabled, true); + expect(isW3CExternalTraceID.isW3cCaughtHeaderEnabled, true); + verify( + mInstabugHost.isW3CFeatureFlagsEnabled(), + ).called(1); + }); + + test('[registerW3CFlagsListener] should call host method', () async { + when(mInstabugHost.isW3CFeatureFlagsEnabled()).thenAnswer( + (_) => Future.value({ + "isW3cExternalTraceIDEnabled": true, + "isW3cExternalGeneratedHeaderEnabled": true, + "isW3cCaughtHeaderEnabled": true, + }), + ); + + await FeatureFlagsManager().registerW3CFlagsListener(); + + verify( + mInstabugHost.registerFeatureFlagChangeListener(), + ).called(1); + }); +} diff --git a/test/feature_requests_test.dart b/packages/instabug_flutter/test/feature_requests_test.dart similarity index 100% rename from test/feature_requests_test.dart rename to packages/instabug_flutter/test/feature_requests_test.dart diff --git a/test/instabug_log_test.dart b/packages/instabug_flutter/test/instabug_log_test.dart similarity index 100% rename from test/instabug_log_test.dart rename to packages/instabug_flutter/test/instabug_log_test.dart diff --git a/test/instabug_test.dart b/packages/instabug_flutter/test/instabug_test.dart similarity index 91% rename from test/instabug_test.dart rename to packages/instabug_flutter/test/instabug_test.dart index 0e6f0f421..37ce0d538 100644 --- a/test/instabug_test.dart +++ b/packages/instabug_flutter/test/instabug_test.dart @@ -5,6 +5,7 @@ import 'package:flutter_test/flutter_test.dart'; import 'package:instabug_flutter/instabug_flutter.dart'; import 'package:instabug_flutter/src/generated/instabug.api.g.dart'; import 'package:instabug_flutter/src/utils/enum_converter.dart'; +import 'package:instabug_flutter/src/utils/feature_flags_manager.dart'; import 'package:instabug_flutter/src/utils/ibg_build_info.dart'; import 'package:instabug_flutter/src/utils/screen_name_masker.dart'; import 'package:mockito/annotations.dart'; @@ -27,6 +28,7 @@ void main() { setUpAll(() { Instabug.$setHostApi(mHost); + FeatureFlagsManager().$setHostApi(mHost); IBGBuildInfo.setInstance(mBuildInfo); ScreenNameMasker.setInstance(mScreenNameMasker); }); @@ -69,14 +71,20 @@ void main() { test('[start] should call host method', () async { const token = "068ba9a8c3615035e163dc5f829c73be"; const events = [InvocationEvent.shake, InvocationEvent.screenshot]; - + when(mHost.isW3CFeatureFlagsEnabled()).thenAnswer( + (_) => Future.value({ + "isW3cExternalTraceIDEnabled": true, + "isW3cExternalGeneratedHeaderEnabled": true, + "isW3cCaughtHeaderEnabled": true, + }), + ); await Instabug.init( token: token, invocationEvents: events, ); verify( - mHost.init(token, events.mapToString(), LogLevel.error.toString()), + mHost.init(token, events.mapToString(), LogLevel.error.toString(), null), ).called(1); }); @@ -189,16 +197,6 @@ void main() { ).called(1); }); - test('[setPrimaryColor] should call host method', () async { - const color = Color(0x00000000); - - await Instabug.setPrimaryColor(color); - - verify( - mHost.setPrimaryColor(color.value), - ).called(1); - }); - test('[setSessionProfilerEnabled] should call host method', () async { const enabled = true; @@ -250,37 +248,6 @@ void main() { ).called(1); }); - test('[addExperiments] should call host method', () async { - const experiments = ["exp-1", "exp-2"]; - - // ignore: deprecated_member_use_from_same_package - await Instabug.addExperiments(experiments); - - verify( - mHost.addExperiments(experiments), - ).called(1); - }); - - test('[removeExperiments] should call host method', () async { - const experiments = ["exp-1", "exp-2"]; - - // ignore: deprecated_member_use_from_same_package - await Instabug.removeExperiments(experiments); - - verify( - mHost.removeExperiments(experiments), - ).called(1); - }); - - test('[clearAllExperiments] should call host method', () async { - // ignore: deprecated_member_use_from_same_package - await Instabug.clearAllExperiments(); - - verify( - mHost.clearAllExperiments(), - ).called(1); - }); - test('[addFeatureFlags] should call host method', () async { await Instabug.addFeatureFlags([ FeatureFlag(name: 'name1', variant: 'variant1'), @@ -466,4 +433,34 @@ void main() { mHost.willRedirectToStore(), ).called(1); }); + + test('[setFullscreen] should call host method', () async { + const isEnabled = true; + + await Instabug.setFullscreen(isEnabled); + + verify( + mHost.setFullscreen(isEnabled), + ).called(1); + }); + + test('[setFullscreen] should call host method with false', () async { + const isEnabled = false; + + await Instabug.setFullscreen(isEnabled); + + verify( + mHost.setFullscreen(isEnabled), + ).called(1); + }); + + test('[setTheme] should call host method with theme config', () async { + const themeConfig = ThemeConfig(primaryColor: '#FF0000'); + + await Instabug.setTheme(themeConfig); + + verify( + mHost.setTheme(themeConfig.toMap()), + ).called(1); + }); } diff --git a/test/network_data_test.dart b/packages/instabug_flutter/test/network_data_test.dart similarity index 100% rename from test/network_data_test.dart rename to packages/instabug_flutter/test/network_data_test.dart diff --git a/packages/instabug_flutter/test/network_logger_test.dart b/packages/instabug_flutter/test/network_logger_test.dart new file mode 100644 index 000000000..cbdc2db93 --- /dev/null +++ b/packages/instabug_flutter/test/network_logger_test.dart @@ -0,0 +1,242 @@ +import 'dart:async'; +import 'dart:math'; + +import 'package:flutter/widgets.dart'; +import 'package:flutter_test/flutter_test.dart'; +import 'package:instabug_flutter/instabug_flutter.dart'; +import 'package:instabug_flutter/src/generated/apm.api.g.dart'; +import 'package:instabug_flutter/src/generated/instabug.api.g.dart'; +import 'package:instabug_flutter/src/utils/feature_flags_manager.dart'; +import 'package:instabug_flutter/src/utils/ibg_build_info.dart'; +import 'package:instabug_flutter/src/utils/network_manager.dart'; +import 'package:instabug_flutter/src/utils/w3c_header_utils.dart'; +import 'package:mockito/annotations.dart'; +import 'package:mockito/mockito.dart'; + +import 'network_logger_test.mocks.dart'; + +@GenerateMocks([ + ApmHostApi, + InstabugHostApi, + IBGBuildInfo, + NetworkManager, + W3CHeaderUtils, + FeatureFlagsManager, + Random, +]) +void main() { + TestWidgetsFlutterBinding.ensureInitialized(); + WidgetsFlutterBinding.ensureInitialized(); + + final mApmHost = MockApmHostApi(); + final mInstabugHost = MockInstabugHostApi(); + final mBuildInfo = MockIBGBuildInfo(); + final mManager = MockNetworkManager(); + final mRandom = MockRandom(); + final logger = NetworkLogger(); + final data = NetworkData( + url: "https://httpbin.org/get", + method: "GET", + startTime: DateTime.now(), + ); + + setUpAll(() { + APM.$setHostApi(mApmHost); + FeatureFlagsManager().$setHostApi(mInstabugHost); + NetworkLogger.$setHostApi(mInstabugHost); + NetworkLogger.$setManager(mManager); + IBGBuildInfo.setInstance(mBuildInfo); + }); + + setUp(() { + reset(mApmHost); + reset(mInstabugHost); + reset(mBuildInfo); + reset(mManager); + when(mInstabugHost.isW3CFeatureFlagsEnabled()).thenAnswer( + (_) => Future.value({ + "isW3cExternalTraceIDEnabled": true, + "isW3cExternalGeneratedHeaderEnabled": true, + "isW3cCaughtHeaderEnabled": true, + }), + ); + }); + + test('[networkLog] should call 1 host method on iOS', () async { + when(mBuildInfo.isAndroid).thenReturn(false); + when(mManager.obfuscateLog(data)).thenReturn(data); + when(mManager.omitLog(data)).thenReturn(false); + + await logger.networkLogInternal(data); + + verify( + mInstabugHost.networkLog(data.toJson()), + ).called(1); + + verifyNever( + mApmHost.networkLogAndroid(data.toJson()), + ); + }); + + test('[networkLog] should call 2 host methods on Android', () async { + when(mBuildInfo.isAndroid).thenReturn(true); + when(mManager.obfuscateLog(data)).thenReturn(data); + when(mManager.omitLog(data)).thenReturn(false); + + await logger.networkLogInternal(data); + + verify( + mInstabugHost.networkLog(data.toJson()), + ).called(1); + + verify( + mApmHost.networkLogAndroid(data.toJson()), + ).called(1); + }); + + test('[networkLog] should obfuscate network data before logging', () async { + final obfuscated = data.copyWith(requestBody: 'obfuscated'); + + when(mBuildInfo.isAndroid).thenReturn(true); + when(mManager.obfuscateLog(data)).thenReturn(obfuscated); + when(mManager.omitLog(data)).thenReturn(false); + + await logger.networkLogInternal(data); + + verify( + mManager.obfuscateLog(data), + ).called(1); + + verify( + mInstabugHost.networkLog(obfuscated.toJson()), + ).called(1); + + verify( + mApmHost.networkLogAndroid(obfuscated.toJson()), + ).called(1); + }); + + test('[networkLog] should not log data if it should be omitted', () async { + const omit = true; + + when(mBuildInfo.isAndroid).thenReturn(true); + when(mManager.obfuscateLog(data)).thenReturn(data); + when(mManager.omitLog(data)).thenReturn(omit); + + await logger.networkLogInternal(data); + + verify( + mManager.omitLog(data), + ).called(1); + + verifyNever( + mInstabugHost.networkLog(data.toJson()), + ); + + verifyNever( + mApmHost.networkLogAndroid(data.toJson()), + ); + }); + + test('[obfuscateLog] should set obfuscation callback on manager', () async { + FutureOr callback(NetworkData data) => data; + + NetworkLogger.obfuscateLog(callback); + + verify( + mManager.setObfuscateLogCallback(callback), + ).called(1); + }); + + test('[omitLog] should set omission callback on manager', () async { + FutureOr callback(NetworkData data) => true; + + NetworkLogger.omitLog(callback); + + verify( + mManager.setOmitLogCallback(callback), + ).called(1); + }); + + test( + '[getW3CHeader] should return null when isW3cExternalTraceIDEnabled disabled', + () async { + when(mBuildInfo.isAndroid).thenReturn(true); + + when(mInstabugHost.isW3CFeatureFlagsEnabled()).thenAnswer( + (_) => Future.value({ + "isW3cExternalTraceIDEnabled": false, + "isW3cExternalGeneratedHeaderEnabled": false, + "isW3cCaughtHeaderEnabled": false, + }), + ); + final time = DateTime.now().millisecondsSinceEpoch; + final w3cHeader = await logger.getW3CHeader({}, time); + expect(w3cHeader, null); + }); + + test( + '[getW3CHeader] should return transparent header when isW3cCaughtHeaderEnabled enabled', + () async { + when(mBuildInfo.isAndroid).thenReturn(false); + + final time = DateTime.now().millisecondsSinceEpoch; + final w3cHeader = + await logger.getW3CHeader({"traceparent": "Header test"}, time); + expect(w3cHeader!.isW3cHeaderFound, true); + expect(w3cHeader.w3CCaughtHeader, "Header test"); + }); + + test( + '[getW3CHeader] should return generated header when isW3cExternalGeneratedHeaderEnabled and no traceparent header', + () async { + W3CHeaderUtils().$setRandom(mRandom); + when(mBuildInfo.isAndroid).thenReturn(false); + + when(mRandom.nextInt(any)).thenReturn(217222); + + final time = DateTime.now().millisecondsSinceEpoch; + final w3cHeader = await logger.getW3CHeader({}, time); + final generatedW3CHeader = W3CHeaderUtils().generateW3CHeader(time); + + expect(w3cHeader!.isW3cHeaderFound, false); + expect(w3cHeader.w3CGeneratedHeader, generatedW3CHeader.w3cHeader); + expect(w3cHeader.partialId, generatedW3CHeader.partialId); + expect( + w3cHeader.networkStartTimeInSeconds, + generatedW3CHeader.timestampInSeconds, + ); + }); + + test( + '[networkLog] should add transparent header when isW3cCaughtHeaderEnabled disabled to every request', + () async { + final networkData = data.copyWith(requestHeaders: {}); + when(mBuildInfo.isAndroid).thenReturn(false); + when(mManager.obfuscateLog(networkData)).thenReturn(networkData); + when(mManager.omitLog(networkData)).thenReturn(false); + await logger.networkLog(networkData); + expect(networkData.requestHeaders.containsKey('traceparent'), isTrue); + }); + + test( + '[networkLog] should not add transparent header when there is traceparent', + () async { + final networkData = data.copyWith(requestHeaders: {'traceparent': 'test'}); + when(mBuildInfo.isAndroid).thenReturn(false); + when(mManager.obfuscateLog(networkData)).thenReturn(networkData); + when(mManager.omitLog(networkData)).thenReturn(false); + await logger.networkLog(networkData); + expect(networkData.requestHeaders['traceparent'], 'test'); + }); + + test('[setNetworkLogBodyEnabled] should call host method', () async { + const enabled = true; + + await NetworkLogger.setNetworkLogBodyEnabled(enabled); + + verify( + mInstabugHost.setNetworkLogBodyEnabled(enabled), + ).called(1); + }); +} diff --git a/test/network_manager_test.dart b/packages/instabug_flutter/test/network_manager_test.dart similarity index 100% rename from test/network_manager_test.dart rename to packages/instabug_flutter/test/network_manager_test.dart diff --git a/test/replies_test.dart b/packages/instabug_flutter/test/replies_test.dart similarity index 100% rename from test/replies_test.dart rename to packages/instabug_flutter/test/replies_test.dart diff --git a/test/route_matcher_test.dart b/packages/instabug_flutter/test/route_matcher_test.dart similarity index 100% rename from test/route_matcher_test.dart rename to packages/instabug_flutter/test/route_matcher_test.dart diff --git a/test/session_replay_test.dart b/packages/instabug_flutter/test/session_replay_test.dart similarity index 100% rename from test/session_replay_test.dart rename to packages/instabug_flutter/test/session_replay_test.dart diff --git a/test/surveys_test.dart b/packages/instabug_flutter/test/surveys_test.dart similarity index 100% rename from test/surveys_test.dart rename to packages/instabug_flutter/test/surveys_test.dart diff --git a/test/utils/instabug_navigator_observer_test.dart b/packages/instabug_flutter/test/utils/instabug_navigator_observer_test.dart similarity index 82% rename from test/utils/instabug_navigator_observer_test.dart rename to packages/instabug_flutter/test/utils/instabug_navigator_observer_test.dart index ebf541137..5f138ac8f 100644 --- a/test/utils/instabug_navigator_observer_test.dart +++ b/packages/instabug_flutter/test/utils/instabug_navigator_observer_test.dart @@ -1,3 +1,5 @@ +// ignore_for_file: invalid_null_aware_operator + import 'package:fake_async/fake_async.dart'; import 'package:flutter/material.dart'; import 'package:flutter_test/flutter_test.dart'; @@ -43,8 +45,9 @@ void main() { test('should report screen change when a route is pushed', () { fakeAsync((async) { observer.didPush(route, previousRoute); - - async.elapse(const Duration(milliseconds: 1000)); + WidgetsBinding.instance?.handleBeginFrame(Duration.zero); + WidgetsBinding.instance?.handleDrawFrame(); + async.elapse(const Duration(milliseconds: 2000)); verify( mScreenLoadingManager.startUiTrace(screen, screen), @@ -61,7 +64,8 @@ void main() { () { fakeAsync((async) { observer.didPop(route, previousRoute); - + WidgetsBinding.instance?.handleBeginFrame(Duration.zero); + WidgetsBinding.instance?.handleDrawFrame(); async.elapse(const Duration(milliseconds: 1000)); verify( @@ -79,7 +83,8 @@ void main() { () { fakeAsync((async) { observer.didPop(route, null); - + WidgetsBinding.instance?.handleBeginFrame(Duration.zero); + WidgetsBinding.instance?.handleDrawFrame(); async.elapse(const Duration(milliseconds: 1000)); verifyNever( @@ -98,7 +103,8 @@ void main() { const fallback = 'N/A'; observer.didPush(route, previousRoute); - + WidgetsBinding.instance?.handleBeginFrame(Duration.zero); + WidgetsBinding.instance?.handleDrawFrame(); async.elapse(const Duration(milliseconds: 1000)); verify( @@ -118,8 +124,9 @@ void main() { fakeAsync((async) { observer.didPush(route, previousRoute); - - async.elapse(const Duration(milliseconds: 1000)); + WidgetsBinding.instance?.handleBeginFrame(Duration.zero); + WidgetsBinding.instance?.handleDrawFrame(); + async.elapse(const Duration(milliseconds: 2000)); verify( mScreenLoadingManager.startUiTrace(maskedScreen, screen), diff --git a/packages/instabug_flutter/test/utils/private_views/private_views_manager_test.dart b/packages/instabug_flutter/test/utils/private_views/private_views_manager_test.dart new file mode 100644 index 000000000..ba9b1d5d7 --- /dev/null +++ b/packages/instabug_flutter/test/utils/private_views/private_views_manager_test.dart @@ -0,0 +1,161 @@ +import 'dart:typed_data'; +import 'dart:ui' as ui; + +import 'package:flutter/foundation.dart'; +import 'package:flutter/material.dart'; +import 'package:flutter_test/flutter_test.dart'; +import 'package:instabug_flutter/instabug_flutter.dart'; +import 'package:instabug_flutter/src/utils/private_views/private_views_manager.dart'; + +Future createTestImage() async { + // Create an empty 1x1 image + final recorder = ui.PictureRecorder(); + final canvas = Canvas(recorder); + final paint = Paint()..color = const Color(0xFFFF0000); // Red pixel + canvas.drawRect(const Rect.fromLTWH(0, 0, 1, 1), paint); + + final img = await recorder.endRecording().toImage(1, 1); + final byteData = await img.toByteData(format: ui.ImageByteFormat.png); + return byteData!.buffer.asUint8List(); +} + +void main() { + TestWidgetsFlutterBinding.ensureInitialized(); + WidgetsFlutterBinding.ensureInitialized(); + + group('PrivateViewsManager Tests', () { + late PrivateViewsManager manager; + + setUp(() { + manager = PrivateViewsManager.instance; + }); + + test('isPrivateWidget detects InstabugPrivateView', () { + final widget = InstabugPrivateView(child: Container()); + expect(PrivateViewsManager.isPrivateWidget(widget), isTrue); + }); + + test('isPrivateWidget detects InstabugSliverPrivateView', () { + final widget = InstabugSliverPrivateView(sliver: Container()); + expect(PrivateViewsManager.isPrivateWidget(widget), isTrue); + }); + + test('isPrivateWidget returns false for other widgets', () { + expect(PrivateViewsManager.isPrivateWidget(Container()), isFalse); + expect(PrivateViewsManager.isPrivateWidget(const Text('Hello')), isFalse); + }); + + testWidgets('getRectsOfPrivateViews detects masked views', (tester) async { + await tester.pumpWidget( + InstabugWidget( + child: MaterialApp( + home: Scaffold( + body: ListView( + children: const [ + SizedBox(width: 100, height: 100), + InstabugPrivateView(child: TextField()), + ], + ), + ), + ), + ), + ); + + final rects = manager.getRectsOfPrivateViews(); + expect(rects.length, 1); + }); + + testWidgets('getRectsOfPrivateViews detects masked labels', (tester) async { + await tester.pumpWidget( + InstabugWidget( + automasking: const [AutoMasking.labels], + child: MaterialApp( + home: Scaffold( + body: ListView( + children: const [ + SizedBox(width: 100, height: 100), + Text("Test 1"), + Text("Test 2"), + ], + ), + ), + ), + ), + ); + + final rects = manager.getRectsOfPrivateViews(); + expect(rects.length, 2); + }); + + testWidgets( + 'getPrivateViews returns correct list of masked view coordinates', + (tester) async { + await tester.pumpWidget( + MaterialApp( + home: Scaffold( + body: ListView( + children: const [ + InstabugPrivateView( + child: SizedBox(width: 50, height: 50), + ), + ], + ), + ), + ), + ); + + final privateViews = manager.getPrivateViews(); + expect( + privateViews.length % 4, + 0, + ); // Ensure coordinates come in sets of four + }); + + testWidgets('getRectsOfPrivateViews detects masked Media', (tester) async { + final validImage = await tester.runAsync(() => createTestImage()); + + await tester.pumpWidget( + InstabugWidget( + automasking: const [AutoMasking.media], + child: MaterialApp( + home: Scaffold( + body: Column( + children: [ + const SizedBox(width: 100, height: 100), + Image.memory( + validImage!, + ), + ], + ), + ), + ), + ), + ); + + final rects = manager.getRectsOfPrivateViews(); + expect(rects.length, 1); + }); + + testWidgets('getRectsOfPrivateViews detects masked textInputs', + (tester) async { + await tester.pumpWidget( + InstabugWidget( + automasking: const [AutoMasking.textInputs], + child: MaterialApp( + home: Scaffold( + body: ListView( + children: const [ + SizedBox(width: 100, height: 100), + TextField(), + ], + ), + ), + ), + ), + ); + + final rects = manager.getRectsOfPrivateViews(); + expect(rects.length, 1); + }); + }); +} diff --git a/packages/instabug_flutter/test/utils/screen_loading/instabug_capture_screen_loading_test.dart b/packages/instabug_flutter/test/utils/screen_loading/instabug_capture_screen_loading_test.dart new file mode 100644 index 000000000..26fc609d7 --- /dev/null +++ b/packages/instabug_flutter/test/utils/screen_loading/instabug_capture_screen_loading_test.dart @@ -0,0 +1,41 @@ +import 'package:flutter/material.dart'; +import 'package:flutter_test/flutter_test.dart'; +import 'package:instabug_flutter/instabug_flutter.dart'; +import 'package:instabug_flutter/src/utils/screen_loading/screen_loading_manager.dart'; +import 'package:mockito/mockito.dart'; +import '../instabug_navigator_observer_test.mocks.dart'; + +void main() { + late MockScreenLoadingManager mockScreenLoadingManager; + + setUp(() { + mockScreenLoadingManager = MockScreenLoadingManager(); + ScreenLoadingManager.setInstance(mockScreenLoadingManager); + }); + + testWidgets( + 'InstabugCaptureScreenLoading starts and reports screen loading trace', + (WidgetTester tester) async { + const screenName = "/TestScreen"; + + when(mockScreenLoadingManager.sanitizeScreenName(screenName)) + .thenReturn(screenName); + when(mockScreenLoadingManager.startScreenLoadingTrace(any)) + .thenAnswer((_) async {}); + when(mockScreenLoadingManager.reportScreenLoading(any)) + .thenAnswer((_) async {}); + + await tester.pumpWidget( + MaterialApp( + home: InstabugCaptureScreenLoading( + screenName: screenName, + child: Container(), + ), + ), + ); + + verify(mockScreenLoadingManager.startScreenLoadingTrace(any)).called(1); + await tester.pumpAndSettle(); + verify(mockScreenLoadingManager.reportScreenLoading(any)).called(1); + }); +} diff --git a/test/utils/screen_loading/screen_loading_manager_test.dart b/packages/instabug_flutter/test/utils/screen_loading/screen_loading_manager_test.dart similarity index 100% rename from test/utils/screen_loading/screen_loading_manager_test.dart rename to packages/instabug_flutter/test/utils/screen_loading/screen_loading_manager_test.dart diff --git a/packages/instabug_flutter/test/utils/screen_loading/screen_loading_trace_test.dart b/packages/instabug_flutter/test/utils/screen_loading/screen_loading_trace_test.dart new file mode 100644 index 000000000..e676959ba --- /dev/null +++ b/packages/instabug_flutter/test/utils/screen_loading/screen_loading_trace_test.dart @@ -0,0 +1,62 @@ +import 'package:flutter_test/flutter_test.dart'; +import 'package:instabug_flutter/src/utils/screen_loading/screen_loading_trace.dart'; + +void main() { + test( + 'ScreenLoadingTrace copyWith method should keep original values when no override happens', + () { + final trace = ScreenLoadingTrace( + 'TestScreen', + startTimeInMicroseconds: 1000, + startMonotonicTimeInMicroseconds: 2000, + endTimeInMicroseconds: 3000, + duration: 4000, + ); + + final updatedTrace = trace.copyWith(); + + expect(updatedTrace.screenName, 'TestScreen'); + expect(updatedTrace.startTimeInMicroseconds, 1000); + expect(updatedTrace.startMonotonicTimeInMicroseconds, 2000); + expect(updatedTrace.endTimeInMicroseconds, 3000); + expect(updatedTrace.duration, 4000); + }); + + test('ScreenLoadingTrace copyWith method updates fields correctly', () { + final trace = ScreenLoadingTrace( + 'TestScreen', + startTimeInMicroseconds: 1000, + startMonotonicTimeInMicroseconds: 2000, + endTimeInMicroseconds: 3000, + duration: 4000, + ); + + final updatedTrace = trace.copyWith( + startTimeInMicroseconds: 1500, + startMonotonicTimeInMicroseconds: 2500, + endTimeInMicroseconds: 3500, + duration: 4500, + ); + + expect(updatedTrace.screenName, 'TestScreen'); + expect(updatedTrace.startTimeInMicroseconds, 1500); + expect(updatedTrace.startMonotonicTimeInMicroseconds, 2500); + expect(updatedTrace.endTimeInMicroseconds, 3500); + expect(updatedTrace.duration, 4500); + }); + + test('ScreenLoadingTrace toString method returns correct format', () { + final trace = ScreenLoadingTrace( + 'TestScreen', + startTimeInMicroseconds: 1000, + startMonotonicTimeInMicroseconds: 2000, + endTimeInMicroseconds: 3000, + duration: 4000, + ); + + expect( + trace.toString(), + 'ScreenLoadingTrace{screenName: TestScreen, startTimeInMicroseconds: 1000, startMonotonicTimeInMicroseconds: 2000, endTimeInMicroseconds: 3000, duration: 4000}', + ); + }); +} diff --git a/packages/instabug_flutter/test/utils/screen_loading/ui_trace_test.dart b/packages/instabug_flutter/test/utils/screen_loading/ui_trace_test.dart new file mode 100644 index 000000000..11ed57c66 --- /dev/null +++ b/packages/instabug_flutter/test/utils/screen_loading/ui_trace_test.dart @@ -0,0 +1,58 @@ +import 'package:flutter_test/flutter_test.dart'; +import 'package:instabug_flutter/instabug_flutter.dart'; +import 'package:instabug_flutter/src/utils/screen_loading/ui_trace.dart'; +import 'package:mockito/annotations.dart'; +import 'package:mockito/mockito.dart'; + +import 'screen_loading_manager_test.mocks.dart'; + +@GenerateMocks([RouteMatcher]) +void main() { + test('UiTrace copyWith method updates fields correctly', () { + final trace = UiTrace( + screenName: 'TestScreen', + traceId: 123, + matchingScreenName: 'MatchingScreen', + ); + + final updatedTrace = trace.copyWith( + screenName: 'UpdatedScreen', + traceId: 456, + ); + + expect(updatedTrace.screenName, 'UpdatedScreen'); + expect(updatedTrace.traceId, 456); + }); + + test('UiTrace matches method returns correct result', () { + final mockRouteMatcher = MockRouteMatcher(); + RouteMatcher.setInstance(mockRouteMatcher); + when( + mockRouteMatcher.match( + routePath: 'test/path', + actualPath: 'MatchingScreen', + ), + ).thenReturn(true); + + final trace = UiTrace( + screenName: 'TestScreen', + traceId: 123, + matchingScreenName: 'MatchingScreen', + ); + + expect(trace.matches('test/path'), isTrue); + }); + + test('UiTrace toString method returns correct format', () { + final trace = UiTrace( + screenName: 'TestScreen', + traceId: 123, + matchingScreenName: 'MatchingScreen', + ); + + expect( + trace.toString(), + 'UiTrace{screenName: TestScreen, traceId: 123, isFirstScreenLoadingReported: false, isFirstScreenLoading: false}', + ); + }); +} diff --git a/test/utils/screen_name_masker_test.dart b/packages/instabug_flutter/test/utils/screen_name_masker_test.dart similarity index 100% rename from test/utils/screen_name_masker_test.dart rename to packages/instabug_flutter/test/utils/screen_name_masker_test.dart diff --git a/packages/instabug_flutter/test/utils/user_steps/instabug_user_steps_test.dart b/packages/instabug_flutter/test/utils/user_steps/instabug_user_steps_test.dart new file mode 100644 index 000000000..9ac05e4cb --- /dev/null +++ b/packages/instabug_flutter/test/utils/user_steps/instabug_user_steps_test.dart @@ -0,0 +1,298 @@ +import 'package:flutter/material.dart'; +import 'package:flutter_test/flutter_test.dart'; +import 'package:instabug_flutter/instabug_flutter.dart'; +import 'package:instabug_flutter/src/utils/user_steps/user_step_details.dart'; +import 'package:mockito/mockito.dart'; + +import '../../instabug_test.mocks.dart'; + +void main() { + late MockInstabugHostApi mockInstabugHostApi; + + setUp(() { + mockInstabugHostApi = MockInstabugHostApi(); + Instabug.$setHostApi(mockInstabugHostApi); + }); + + Widget buildTestWidget(Widget child) { + return MaterialApp(home: InstabugUserSteps(child: child)); + } + + group('InstabugUserSteps Widget', () { + testWidgets('builds child widget correctly', (tester) async { + await tester.pumpWidget(buildTestWidget(const Text('Test Widget'))); + expect(find.text('Test Widget'), findsOneWidget); + }); + + testWidgets('detects tap gestures', (tester) async { + await tester.pumpWidget( + buildTestWidget( + GestureDetector(onTap: () {}, child: const Text('Tap Me')), + ), + ); + + await tester.tap(find.text('Tap Me')); + await tester.pumpAndSettle(); + + verify( + mockInstabugHostApi.logUserSteps( + GestureType.tap.toString(), + any, + any, + ), + ).called(1); + }); + + testWidgets('detects long press gestures', (tester) async { + await tester.pumpWidget( + buildTestWidget( + GestureDetector( + onLongPress: () {}, + child: const Text('Long Press Me'), + ), + ), + ); + + final gesture = await tester + .startGesture(tester.getCenter(find.text('Long Press Me'))); + await tester + .pump(const Duration(seconds: 2)); // Simulate long press duration + await gesture.up(); + + await tester.pump(); + + verify( + mockInstabugHostApi.logUserSteps( + GestureType.longPress.toString(), + any, + any, + ), + ).called(1); + }); + + group('Swipe Gestures', () { + const scrollOffset = Offset(0, -200); + const smallScrollOffset = Offset(0, -20); + + testWidgets('detects scroll gestures', (tester) async { + await tester.pumpWidget( + buildTestWidget( + ListView(children: List.generate(50, (i) => Text('Item $i'))), + ), + ); + + await tester.fling(find.byType(ListView), scrollOffset, 1000); + await tester.pumpAndSettle(); + + verify( + mockInstabugHostApi.logUserSteps( + GestureType.scroll.toString(), + any, + any, + ), + ).called(1); + }); + + testWidgets('ignores small swipe gestures', (tester) async { + await tester.pumpWidget( + buildTestWidget( + ListView(children: List.generate(50, (i) => Text('Item $i'))), + ), + ); + + await tester.fling(find.byType(ListView), smallScrollOffset, 1000); + await tester.pumpAndSettle(); + + verifyNever( + mockInstabugHostApi.logUserSteps( + GestureType.scroll.toString(), + any, + any, + ), + ); + }); + + testWidgets('detects horizontal scroll', (tester) async { + await tester.pumpWidget( + buildTestWidget( + ListView( + scrollDirection: Axis.horizontal, + children: List.generate(20, (i) => Text('Item $i')), + ), + ), + ); + + await tester.drag(find.byType(ListView), const Offset(-300, 0)); + await tester.pumpAndSettle(); + + verify( + mockInstabugHostApi.logUserSteps( + GestureType.scroll.toString(), + argThat(contains('Left')), + "ListView", + ), + ).called(1); + }); + + testWidgets('detects vertical scroll direction', (tester) async { + await tester.pumpWidget( + buildTestWidget( + ListView(children: List.generate(20, (i) => Text('Item $i'))), + ), + ); + + await tester.drag(find.byType(ListView), const Offset(0, -300)); + await tester.pumpAndSettle(); + + verify( + mockInstabugHostApi.logUserSteps( + GestureType.scroll.toString(), + argThat(contains('Down')), + "ListView", + ), + ).called(1); + }); + + testWidgets('does not log small scroll gestures', (tester) async { + await tester.pumpWidget( + buildTestWidget( + ListView(children: List.generate(20, (i) => Text('Item $i'))), + ), + ); + + await tester.drag(find.byType(ListView), const Offset(0, -10)); + await tester.pumpAndSettle(); + + verifyNever( + mockInstabugHostApi.logUserSteps( + GestureType.scroll.toString(), + argThat(contains('Down')), + "ListView", + ), + ); + }); + }); + + group('Pinch Gestures', () { + testWidgets('handles pinch gestures', (tester) async { + await tester.pumpWidget( + buildTestWidget( + Transform.scale( + scale: 1.0, + child: const Icon(Icons.add, size: 300), + ), + ), + ); + + final iconFinder = find.byIcon(Icons.add); + final pinchStart = tester.getCenter(iconFinder); + + final gesture1 = await tester.startGesture(pinchStart); + final gesture2 = + await tester.startGesture(pinchStart + const Offset(100.0, 0.0)); + + await tester.pump(); + await gesture1.moveTo(pinchStart + const Offset(150.0, 0.0)); + await gesture2.moveTo(pinchStart + const Offset(70.0, 0.0)); + + await gesture1.up(); + await gesture2.up(); + + await tester.pump(const Duration(seconds: 1)); + + verify( + mockInstabugHostApi.logUserSteps( + GestureType.pinch.toString(), + any, + any, + ), + ).called(1); + }); + + testWidgets('ignores small pinch gestures', (tester) async { + await tester.pumpWidget( + buildTestWidget( + Transform.scale( + scale: 1.0, + child: const Icon(Icons.add, size: 300), + ), + ), + ); + + final iconFinder = find.byIcon(Icons.add); + final pinchStart = tester.getCenter(iconFinder); + + final gesture1 = await tester.startGesture(pinchStart); + final gesture2 = + await tester.startGesture(pinchStart + const Offset(100.0, 0.0)); + + await tester.pump(); + await gesture1.moveTo(pinchStart + const Offset(10.0, 0.0)); + await gesture2.moveTo(pinchStart + const Offset(110.0, 0.0)); + + await gesture1.up(); + await gesture2.up(); + + await tester.pump(const Duration(seconds: 1)); + + verifyNever( + mockInstabugHostApi.logUserSteps( + GestureType.pinch.toString(), + any, + any, + ), + ); + }); + }); + + group('Double Tap Gestures', () { + testWidgets('logs double tap gestures', (tester) async { + await tester.pumpWidget( + buildTestWidget( + GestureDetector( + onDoubleTap: () {}, + child: const Text('Double Tap Me'), + ), + ), + ); + + final doubleTapFinder = find.text('Double Tap Me'); + await tester.tap(doubleTapFinder); + await tester.pump(const Duration(milliseconds: 50)); + await tester.tap(doubleTapFinder); + await tester.pumpAndSettle(); + + verify( + mockInstabugHostApi.logUserSteps( + GestureType.doubleTap.toString(), + any, + any, + ), + ).called(1); + }); + + testWidgets('does not log single taps as double taps', (tester) async { + await tester.pumpWidget( + buildTestWidget( + GestureDetector( + onDoubleTap: () {}, + child: const Text('Double Tap Me'), + ), + ), + ); + + final doubleTapFinder = find.text('Double Tap Me'); + await tester.tap(doubleTapFinder); + await tester.pump(const Duration(milliseconds: 50)); + + verifyNever( + mockInstabugHostApi.logUserSteps( + GestureType.doubleTap.toString(), + any, + any, + ), + ); + }); + }); + }); +} diff --git a/packages/instabug_flutter/test/utils/user_steps/user_step_details_test.dart b/packages/instabug_flutter/test/utils/user_steps/user_step_details_test.dart new file mode 100644 index 000000000..0d992755f --- /dev/null +++ b/packages/instabug_flutter/test/utils/user_steps/user_step_details_test.dart @@ -0,0 +1,130 @@ +import 'package:flutter/material.dart'; +import 'package:flutter_test/flutter_test.dart'; +import 'package:instabug_flutter/src/utils/user_steps/user_step_details.dart'; + +void main() { + group('GestureTypeText Extension', () { + test('GestureType.text returns correct text', () { + expect(GestureType.swipe.text, 'Swiped'); + expect(GestureType.scroll.text, 'Scrolled'); + expect(GestureType.tap.text, 'Tapped'); + expect(GestureType.pinch.text, 'Pinched'); + expect(GestureType.longPress.text, 'Long Pressed'); + expect(GestureType.doubleTap.text, 'Double Tapped'); + }); + }); + + group('UserStepDetails', () { + test('key returns correct value', () { + final widget = Container(key: const ValueKey('testKey')); + final element = widget.createElement(); + final details = UserStepDetails( + element: element, + isPrivate: false, + ); + + expect(details.key, 'testKey'); + }); + + test('widgetName identifies widget types correctly', () { + const inkWell = InkWell( + child: Text('Child'), + ); + final detailsInkWell = UserStepDetails( + element: inkWell.createElement(), + isPrivate: false, + ); + expect(detailsInkWell.widgetName, "Text Wrapped with InkWell"); + + final gestureDetector = GestureDetector( + child: const Icon(Icons.add), + ); + final detailsGestureDetector = UserStepDetails( + element: gestureDetector.createElement(), + isPrivate: false, + ); + expect( + detailsGestureDetector.widgetName, + "Icon Wrapped with GestureDetector", + ); + }); + + test('message constructs correctly with gestureType', () { + final widget = Container(key: const ValueKey('testKey')); + final element = widget.createElement(); + + final details = UserStepDetails( + element: element, + isPrivate: false, + gestureType: GestureType.tap, + ); + + expect( + details.message, + " Container with key 'testKey'", + ); + }); + + test('_getWidgetSpecificDetails handles slider widgets', () { + final slider = Slider(value: 0.5, onChanged: (_) {}); + final element = slider.createElement(); + + final details = UserStepDetails( + element: element, + isPrivate: false, + gestureType: GestureType.tap, + ); + + expect( + details.message, + contains(" Slider to '0.5'"), + ); + }); + + test('_getWidgetSpecificDetails handles null widget gracefully', () { + final details = UserStepDetails( + element: null, + isPrivate: false, + ); + + expect(details.message, isNull); + }); + + test('widgetName handles null child gracefully in InkWell', () { + const inkWell = InkWell(); + final details = UserStepDetails( + element: inkWell.createElement(), + isPrivate: false, + ); + expect(details.widgetName, "InkWell"); + }); + + test('message includes additional metadata when gestureMetaData is empty', + () { + final widget = Container(key: const ValueKey('testKey')); + final element = widget.createElement(); + + final details = UserStepDetails( + element: element, + isPrivate: false, + gestureType: GestureType.tap, + gestureMetaData: '', + ); + + expect( + details.message, + " Container with key 'testKey'", + ); + }); + + test('widgetName handles GestureDetector without child', () { + final gestureDetector = GestureDetector(); + final details = UserStepDetails( + element: gestureDetector.createElement(), + isPrivate: false, + ); + expect(details.widgetName, "GestureDetector"); + }); + }); +// }); +} diff --git a/packages/instabug_flutter/test/utils/user_steps/widget_utils_test.dart b/packages/instabug_flutter/test/utils/user_steps/widget_utils_test.dart new file mode 100644 index 000000000..631d49c61 --- /dev/null +++ b/packages/instabug_flutter/test/utils/user_steps/widget_utils_test.dart @@ -0,0 +1,111 @@ +import 'package:flutter/material.dart'; +import 'package:flutter_test/flutter_test.dart'; +import 'package:instabug_flutter/src/utils/user_steps/widget_utils.dart'; + +void main() { + group('keyToStringValue', () { + test('returns null for null key', () { + expect(keyToStringValue(null), isNull); + }); + + test('returns value for ValueKey', () { + expect(keyToStringValue(const ValueKey('test')), 'test'); + }); + + test('returns value for GlobalObjectKey', () { + const globalKey = GlobalObjectKey('globalKey'); + expect(keyToStringValue(globalKey), 'globalKey'); + }); + + test('returns value for ObjectKey', () { + expect(keyToStringValue(const ObjectKey('objectKey')), 'objectKey'); + }); + + test('returns toString for unknown key type', () { + const customKey = Key('customKey'); + expect(keyToStringValue(customKey), 'customKey'); + }); + }); + + group('isButtonWidget', () { + test('detects ButtonStyleButton', () { + final button = + ElevatedButton(onPressed: () {}, child: const Text('Button')); + expect(isButtonWidget(button), true); + }); + + test('detects disabled MaterialButton', () { + const button = MaterialButton(onPressed: null); + expect(isButtonWidget(button), false); + }); + + test('detects IconButton with onPressed', () { + final button = IconButton(onPressed: () {}, icon: const Icon(Icons.add)); + expect(isButtonWidget(button), true); + }); + + test('returns false for non-button widget', () { + const widget = Text('Not a button'); + expect(isButtonWidget(widget), false); + }); + }); + + group('isTappedWidget', () { + test('detects button widget', () { + final button = + ElevatedButton(onPressed: () {}, child: const Text('Button')); + expect(isTappedWidget(button), true); + }); + + test('returns false for null widget', () { + expect(isTappedWidget(null), false); + }); + }); + + group('isTextWidget', () { + test('detects Text widget', () { + const widget = Text('Hello'); + expect(isTextWidget(widget), true); + }); + + test('returns false for non-text widget', () { + const widget = Icon(Icons.add); + expect(isTextWidget(widget), false); + }); + }); + + group('getLabel', () { + test('returns label from Text widget', () { + const widget = Text('Label'); + expect(getLabel(widget), 'Label'); + }); + + test('returns label from Tooltip', () { + const widget = Tooltip(message: 'Tooltip message', child: Text('Child')); + expect(getLabel(widget), 'Tooltip message'); + }); + + test('returns null for unlabeled widget', () { + const widget = Icon(Icons.add); + expect(getLabel(widget), isNull); + }); + }); + + group('getSliderValue', () { + test('returns value from Slider', () { + final widget = Slider(value: 0.5, onChanged: (_) {}); + expect(getSliderValue(widget), '0.5'); + }); + + test('returns value from RangeSlider', () { + final widget = + RangeSlider(values: const RangeValues(0.2, 0.8), onChanged: (_) {}); + expect(getSliderValue(widget), '(0.2,0.8)'); + }); + + test('returns null for non-slider widget', () { + const widget = Text('Not a slider'); + expect(getSliderValue(widget), isNull); + }); + }); +} diff --git a/packages/instabug_flutter/test/w3_header_utils_test.dart b/packages/instabug_flutter/test/w3_header_utils_test.dart new file mode 100644 index 000000000..1c10c45cf --- /dev/null +++ b/packages/instabug_flutter/test/w3_header_utils_test.dart @@ -0,0 +1,68 @@ +import 'dart:math'; + +import 'package:flutter_test/flutter_test.dart'; +import 'package:instabug_flutter/src/models/generated_w3c_header.dart'; +import 'package:instabug_flutter/src/utils/w3c_header_utils.dart'; +import 'package:mockito/annotations.dart'; +import 'package:mockito/mockito.dart'; +import 'w3_header_utils_test.mocks.dart'; + +@GenerateMocks([Random]) +void main() { + final mRandom = MockRandom(); + + setUpAll(() { + W3CHeaderUtils().$setRandom(mRandom); + }); + setUp(() { + when(mRandom.nextInt(any)).thenReturn(217222); + }); + + tearDown(() { + reset(mRandom); + }); + + test('generateTracePartialId should generate a non-zero hex string', () { + var callCount = 0; + + when(mRandom.nextInt(any)).thenAnswer((_) => [0, 217222][callCount++]); + + final hexString = W3CHeaderUtils().generateTracePartialId().hexPartialId; + + expect(hexString, isNot('00000000')); + }); + + test('generateTracePartialId should return 8 chars long generated hex string', + () { + final hexString = W3CHeaderUtils().generateTracePartialId().hexPartialId; + expect(hexString.length, 8); + }); + + test( + 'generateW3CHeader should return {version}-{trace-id}-{parent-id}-{trace-flag} format header', + () { + const date = 1716210104248; + const partialId = 217222; + final hexString0 = partialId.toRadixString(16).padLeft(8, '0'); + + final expectedHeader = GeneratedW3CHeader( + timestampInSeconds: (date / 1000).floor(), + partialId: partialId, + w3cHeader: + '00-664b49b8${hexString0}664b49b8$hexString0-4942472d$hexString0-01', + ); + final generatedHeader = W3CHeaderUtils().generateW3CHeader(date); + expect(generatedHeader, expectedHeader); + }); + + test('generateW3CHeader should correctly floor the timestamp', () { + const date = 1716222912145; + final expectedHeader = GeneratedW3CHeader( + timestampInSeconds: (date / 1000).floor(), + partialId: 217222, + w3cHeader: "00-664b7bc000035086664b7bc000035086-4942472d00035086-01", + ); + final generatedHeader = W3CHeaderUtils().generateW3CHeader(date); + expect(generatedHeader, expectedHeader); + }); +} diff --git a/packages/instabug_flutter/yarn.lock b/packages/instabug_flutter/yarn.lock new file mode 100644 index 000000000..d86ee57b3 --- /dev/null +++ b/packages/instabug_flutter/yarn.lock @@ -0,0 +1,960 @@ +# THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY. +# yarn lockfile v1 + + +"@gitbeaker/core@^21.7.0": + version "21.7.0" + resolved "https://registry.yarnpkg.com/@gitbeaker/core/-/core-21.7.0.tgz#fcf7a12915d39f416e3f316d0a447a814179b8e5" + integrity sha512-cw72rE7tA27wc6JJe1WqeAj9v/6w0S7XJcEji+bRNjTlUfE1zgfW0Gf1mbGUi7F37SOABGCosQLfg9Qe63aIqA== + dependencies: + "@gitbeaker/requester-utils" "^21.7.0" + form-data "^3.0.0" + li "^1.3.0" + xcase "^2.0.1" + +"@gitbeaker/node@^21.3.0": + version "21.7.0" + resolved "https://registry.yarnpkg.com/@gitbeaker/node/-/node-21.7.0.tgz#2c19613f44ee497a8808c555abec614ebd2dfcad" + integrity sha512-OdM3VcTKYYqboOsnbiPcO0XimXXpYK4gTjARBZ6BWc+1LQXKmqo+OH6oUbyxOoaFu9hHECafIt3WZU3NM4sZTg== + dependencies: + "@gitbeaker/core" "^21.7.0" + "@gitbeaker/requester-utils" "^21.7.0" + form-data "^3.0.0" + got "^11.1.4" + xcase "^2.0.1" + +"@gitbeaker/requester-utils@^21.7.0": + version "21.7.0" + resolved "https://registry.yarnpkg.com/@gitbeaker/requester-utils/-/requester-utils-21.7.0.tgz#e9a9cfaf268d2a99eb7bbdc930943240a5f88878" + integrity sha512-eLTaVXlBnh8Qimj6QuMMA06mu/mLcJm3dy8nqhhn/Vm/D25sPrvpGwmbfFyvzj6QujPqtHvFfsCHtyZddL01qA== + dependencies: + form-data "^3.0.0" + query-string "^6.12.1" + xcase "^2.0.1" + +"@instabug/danger-plugin-coverage@Instabug/danger-plugin-coverage": + version "0.0.0-development" + resolved "git+ssh://git@github.com/Instabug/danger-plugin-coverage.git#a3941bd25421b0978ec636648a557b2280d0c9e6" + dependencies: + fast-xml-parser "^4.2.0" + +"@octokit/auth-token@^2.4.4": + version "2.5.0" + resolved "https://registry.yarnpkg.com/@octokit/auth-token/-/auth-token-2.5.0.tgz#27c37ea26c205f28443402477ffd261311f21e36" + integrity sha512-r5FVUJCOLl19AxiuZD2VRZ/ORjp/4IN98Of6YJoJOkY75CIBuYfmiNHGrDwXr+aLGG55igl9QrxX3hbiXlLb+g== + dependencies: + "@octokit/types" "^6.0.3" + +"@octokit/core@^3.5.1": + version "3.6.0" + resolved "https://registry.yarnpkg.com/@octokit/core/-/core-3.6.0.tgz#3376cb9f3008d9b3d110370d90e0a1fcd5fe6085" + integrity sha512-7RKRKuA4xTjMhY+eG3jthb3hlZCsOwg3rztWh75Xc+ShDWOfDDATWbeZpAHBNRpm4Tv9WgBMOy1zEJYXG6NJ7Q== + dependencies: + "@octokit/auth-token" "^2.4.4" + "@octokit/graphql" "^4.5.8" + "@octokit/request" "^5.6.3" + "@octokit/request-error" "^2.0.5" + "@octokit/types" "^6.0.3" + before-after-hook "^2.2.0" + universal-user-agent "^6.0.0" + +"@octokit/endpoint@^6.0.1": + version "6.0.12" + resolved "https://registry.yarnpkg.com/@octokit/endpoint/-/endpoint-6.0.12.tgz#3b4d47a4b0e79b1027fb8d75d4221928b2d05658" + integrity sha512-lF3puPwkQWGfkMClXb4k/eUT/nZKQfxinRWJrdZaJO85Dqwo/G0yOC434Jr2ojwafWJMYqFGFa5ms4jJUgujdA== + dependencies: + "@octokit/types" "^6.0.3" + is-plain-object "^5.0.0" + universal-user-agent "^6.0.0" + +"@octokit/graphql@^4.5.8": + version "4.8.0" + resolved "https://registry.yarnpkg.com/@octokit/graphql/-/graphql-4.8.0.tgz#664d9b11c0e12112cbf78e10f49a05959aa22cc3" + integrity sha512-0gv+qLSBLKF0z8TKaSKTsS39scVKF9dbMxJpj3U0vC7wjNWFuIpL/z76Qe2fiuCbDRcJSavkXsVtMS6/dtQQsg== + dependencies: + "@octokit/request" "^5.6.0" + "@octokit/types" "^6.0.3" + universal-user-agent "^6.0.0" + +"@octokit/openapi-types@^12.11.0": + version "12.11.0" + resolved "https://registry.yarnpkg.com/@octokit/openapi-types/-/openapi-types-12.11.0.tgz#da5638d64f2b919bca89ce6602d059f1b52d3ef0" + integrity sha512-VsXyi8peyRq9PqIz/tpqiL2w3w80OgVMwBHltTml3LmVvXiphgeqmY9mvBw9Wu7e0QWk/fqD37ux8yP5uVekyQ== + +"@octokit/plugin-paginate-rest@^2.16.8": + version "2.21.3" + resolved "https://registry.yarnpkg.com/@octokit/plugin-paginate-rest/-/plugin-paginate-rest-2.21.3.tgz#7f12532797775640dbb8224da577da7dc210c87e" + integrity sha512-aCZTEf0y2h3OLbrgKkrfFdjRL6eSOo8komneVQJnYecAxIej7Bafor2xhuDJOIFau4pk0i/P28/XgtbyPF0ZHw== + dependencies: + "@octokit/types" "^6.40.0" + +"@octokit/plugin-request-log@^1.0.4": + version "1.0.4" + resolved "https://registry.yarnpkg.com/@octokit/plugin-request-log/-/plugin-request-log-1.0.4.tgz#5e50ed7083a613816b1e4a28aeec5fb7f1462e85" + integrity sha512-mLUsMkgP7K/cnFEw07kWqXGF5LKrOkD+lhCrKvPHXWDywAwuDUeDwWBpc69XK3pNX0uKiVt8g5z96PJ6z9xCFA== + +"@octokit/plugin-rest-endpoint-methods@^5.12.0": + version "5.16.2" + resolved "https://registry.yarnpkg.com/@octokit/plugin-rest-endpoint-methods/-/plugin-rest-endpoint-methods-5.16.2.tgz#7ee8bf586df97dd6868cf68f641354e908c25342" + integrity sha512-8QFz29Fg5jDuTPXVtey05BLm7OB+M8fnvE64RNegzX7U+5NUXcOcnpTIK0YfSHBg8gYd0oxIq3IZTe9SfPZiRw== + dependencies: + "@octokit/types" "^6.39.0" + deprecation "^2.3.1" + +"@octokit/request-error@^2.0.5", "@octokit/request-error@^2.1.0": + version "2.1.0" + resolved "https://registry.yarnpkg.com/@octokit/request-error/-/request-error-2.1.0.tgz#9e150357831bfc788d13a4fd4b1913d60c74d677" + integrity sha512-1VIvgXxs9WHSjicsRwq8PlR2LR2x6DwsJAaFgzdi0JfJoGSO8mYI/cHJQ+9FbN21aa+DrgNLnwObmyeSC8Rmpg== + dependencies: + "@octokit/types" "^6.0.3" + deprecation "^2.0.0" + once "^1.4.0" + +"@octokit/request@^5.6.0", "@octokit/request@^5.6.3": + version "5.6.3" + resolved "https://registry.yarnpkg.com/@octokit/request/-/request-5.6.3.tgz#19a022515a5bba965ac06c9d1334514eb50c48b0" + integrity sha512-bFJl0I1KVc9jYTe9tdGGpAMPy32dLBXXo1dS/YwSCTL/2nd9XeHsY616RE3HPXDVk+a+dBuzyz5YdlXwcDTr2A== + dependencies: + "@octokit/endpoint" "^6.0.1" + "@octokit/request-error" "^2.1.0" + "@octokit/types" "^6.16.1" + is-plain-object "^5.0.0" + node-fetch "^2.6.7" + universal-user-agent "^6.0.0" + +"@octokit/rest@^16.43.0 || ^17.11.0 || ^18.12.0", "@octokit/rest@^18.12.0": + version "18.12.0" + resolved "https://registry.yarnpkg.com/@octokit/rest/-/rest-18.12.0.tgz#f06bc4952fc87130308d810ca9d00e79f6988881" + integrity sha512-gDPiOHlyGavxr72y0guQEhLsemgVjwRePayJ+FcKc2SJqKUbxbkvf5kAZEWA/MKvsfYlQAMVzNJE3ezQcxMJ2Q== + dependencies: + "@octokit/core" "^3.5.1" + "@octokit/plugin-paginate-rest" "^2.16.8" + "@octokit/plugin-request-log" "^1.0.4" + "@octokit/plugin-rest-endpoint-methods" "^5.12.0" + +"@octokit/types@^6.0.3", "@octokit/types@^6.16.1", "@octokit/types@^6.39.0", "@octokit/types@^6.40.0": + version "6.41.0" + resolved "https://registry.yarnpkg.com/@octokit/types/-/types-6.41.0.tgz#e58ef78d78596d2fb7df9c6259802464b5f84a04" + integrity sha512-eJ2jbzjdijiL3B4PrSQaSjuF2sPEQPVCPzBvTHJD9Nz+9dw2SGH4K4xeQJ77YfTq5bRQ+bD8wT11JbeDPmxmGg== + dependencies: + "@octokit/openapi-types" "^12.11.0" + +"@sindresorhus/is@^4.0.0": + version "4.6.0" + resolved "https://registry.yarnpkg.com/@sindresorhus/is/-/is-4.6.0.tgz#3c7c9c46e678feefe7a2e5bb609d3dbd665ffb3f" + integrity sha512-t09vSN3MdfsyCHoFcTRCH/iUtG7OJ0CsjzB8cjAmKc/va/kIgeDI/TxsigdncE/4be734m0cvIYwNaV4i2XqAw== + +"@szmarczak/http-timer@^4.0.5": + version "4.0.6" + resolved "https://registry.yarnpkg.com/@szmarczak/http-timer/-/http-timer-4.0.6.tgz#b4a914bb62e7c272d4e5989fe4440f812ab1d807" + integrity sha512-4BAffykYOgO+5nzBWYwE3W90sBgLJoUPRWWcL8wlyiM8IB8ipJz3UMJ9KXQd1RKQXpKp8Tutn80HZtWsu2u76w== + dependencies: + defer-to-connect "^2.0.0" + +"@tootallnate/once@2": + version "2.0.0" + resolved "https://registry.yarnpkg.com/@tootallnate/once/-/once-2.0.0.tgz#f544a148d3ab35801c1f633a7441fd87c2e484bf" + integrity sha512-XCuKFP5PS55gnMVu3dty8KPatLqUoy/ZYzDzAGCQ8JNFCkLXzmI7vNHCR+XpbZaMWQK/vQubr7PkYq8g470J/A== + +"@types/cacheable-request@^6.0.1": + version "6.0.3" + resolved "https://registry.yarnpkg.com/@types/cacheable-request/-/cacheable-request-6.0.3.tgz#a430b3260466ca7b5ca5bfd735693b36e7a9d183" + integrity sha512-IQ3EbTzGxIigb1I3qPZc1rWJnH0BmSKv5QYTalEwweFvyBDLSAe24zP0le/hyi7ecGfZVlIVAg4BZqb8WBwKqw== + dependencies: + "@types/http-cache-semantics" "*" + "@types/keyv" "^3.1.4" + "@types/node" "*" + "@types/responselike" "^1.0.0" + +"@types/http-cache-semantics@*": + version "4.0.1" + resolved "https://registry.yarnpkg.com/@types/http-cache-semantics/-/http-cache-semantics-4.0.1.tgz#0ea7b61496902b95890dc4c3a116b60cb8dae812" + integrity sha512-SZs7ekbP8CN0txVG2xVRH6EgKmEm31BOxA07vkFaETzZz1xh+cbt8BcI0slpymvwhx5dlFnQG2rTlPVQn+iRPQ== + +"@types/keyv@^3.1.4": + version "3.1.4" + resolved "https://registry.yarnpkg.com/@types/keyv/-/keyv-3.1.4.tgz#3ccdb1c6751b0c7e52300bcdacd5bcbf8faa75b6" + integrity sha512-BQ5aZNSCpj7D6K2ksrRCTmKRLEpnPvWDiLPfoGyhZ++8YtiK9d/3DBKPJgry359X/P1PfruyYwvnvwFjuEiEIg== + dependencies: + "@types/node" "*" + +"@types/node@*": + version "18.15.11" + resolved "https://registry.yarnpkg.com/@types/node/-/node-18.15.11.tgz#b3b790f09cb1696cffcec605de025b088fa4225f" + integrity sha512-E5Kwq2n4SbMzQOn6wnmBjuK9ouqlURrcZDVfbo9ftDDTFt3nk7ZKK4GMOzoYgnpQJKcxwQw+lGaBvvlMo0qN/Q== + +"@types/responselike@^1.0.0": + version "1.0.0" + resolved "https://registry.yarnpkg.com/@types/responselike/-/responselike-1.0.0.tgz#251f4fe7d154d2bad125abe1b429b23afd262e29" + integrity sha512-85Y2BjiufFzaMIlvJDvTTB8Fxl2xfLo4HgmHzVBz08w4wDePCTjYw66PdrolO0kzli3yam/YCgRufyo1DdQVTA== + dependencies: + "@types/node" "*" + +agent-base@6: + version "6.0.2" + resolved "https://registry.yarnpkg.com/agent-base/-/agent-base-6.0.2.tgz#49fff58577cfee3f37176feab4c22e00f86d7f77" + integrity sha512-RZNwNclF7+MS/8bDg70amg32dyeZGZxiDuQmZxKLAlQjr3jGyLx+4Kkk58UO7D2QdgFIQCovuSuZESne6RG6XQ== + dependencies: + debug "4" + +ansi-styles@^3.2.1: + version "3.2.1" + resolved "https://registry.yarnpkg.com/ansi-styles/-/ansi-styles-3.2.1.tgz#41fbb20243e50b12be0f04b8dedbf07520ce841d" + integrity sha512-VT0ZI6kZRdTh8YyJw3SMbYm/u+NqfsAxEpWO0Pf9sq8/e94WxxOpPKx9FR1FlyCtOVDNOQ+8ntlqFxiRc+r5qA== + dependencies: + color-convert "^1.9.0" + +async-retry@1.2.3: + version "1.2.3" + resolved "https://registry.yarnpkg.com/async-retry/-/async-retry-1.2.3.tgz#a6521f338358d322b1a0012b79030c6f411d1ce0" + integrity sha512-tfDb02Th6CE6pJUF2gjW5ZVjsgwlucVXOEQMvEX9JgSJMs9gAX+Nz3xRuJBKuUYjTSYORqvDBORdAQ3LU59g7Q== + dependencies: + retry "0.12.0" + +asynckit@^0.4.0: + version "0.4.0" + resolved "https://registry.yarnpkg.com/asynckit/-/asynckit-0.4.0.tgz#c79ed97f7f34cb8f2ba1bc9790bcc366474b4b79" + integrity sha512-Oei9OH4tRh0YqU3GxhX79dM/mwVgvbZJaSNaRk+bshkj0S5cfHcgYakreBjrHwatXKbz+IoIdYLxrKim2MjW0Q== + +before-after-hook@^2.2.0: + version "2.2.3" + resolved "https://registry.yarnpkg.com/before-after-hook/-/before-after-hook-2.2.3.tgz#c51e809c81a4e354084422b9b26bad88249c517c" + integrity sha512-NzUnlZexiaH/46WDhANlyR2bXRopNg4F/zuSA3OpZnllCUgRaOF2znDioDWrmbNVsuZk6l9pMquQB38cfBZwkQ== + +braces@^3.0.2: + version "3.0.2" + resolved "https://registry.yarnpkg.com/braces/-/braces-3.0.2.tgz#3454e1a462ee8d599e236df336cd9ea4f8afe107" + integrity sha512-b8um+L1RzM3WDSzvhm6gIz1yfTbBt6YTlcEKAvsmqCZZFw46z626lVj9j1yEPW33H5H+lBQpZMP1k8l+78Ha0A== + dependencies: + fill-range "^7.0.1" + +buffer-equal-constant-time@1.0.1: + version "1.0.1" + resolved "https://registry.yarnpkg.com/buffer-equal-constant-time/-/buffer-equal-constant-time-1.0.1.tgz#f8e71132f7ffe6e01a5c9697a4c6f3e48d5cc819" + integrity sha512-zRpUiDwd/xk6ADqPMATG8vc9VPrkck7T07OIx0gnjmJAnHnTVXNQG3vfvWNuiZIkwu9KrKdA1iJKfsfTVxE6NA== + +cacheable-lookup@^5.0.3: + version "5.0.4" + resolved "https://registry.yarnpkg.com/cacheable-lookup/-/cacheable-lookup-5.0.4.tgz#5a6b865b2c44357be3d5ebc2a467b032719a7005" + integrity sha512-2/kNscPhpcxrOigMZzbiWF7dz8ilhb/nIHU3EyZiXWXpeq/au8qJ8VhdftMkty3n7Gj6HIGalQG8oiBNB3AJgA== + +cacheable-request@^7.0.2: + version "7.0.2" + resolved "https://registry.yarnpkg.com/cacheable-request/-/cacheable-request-7.0.2.tgz#ea0d0b889364a25854757301ca12b2da77f91d27" + integrity sha512-pouW8/FmiPQbuGpkXQ9BAPv/Mo5xDGANgSNXzTzJ8DrKGuXOssM4wIQRjfanNRh3Yu5cfYPvcorqbhg2KIJtew== + dependencies: + clone-response "^1.0.2" + get-stream "^5.1.0" + http-cache-semantics "^4.0.0" + keyv "^4.0.0" + lowercase-keys "^2.0.0" + normalize-url "^6.0.1" + responselike "^2.0.0" + +chalk@^2.3.0: + version "2.4.2" + resolved "https://registry.yarnpkg.com/chalk/-/chalk-2.4.2.tgz#cd42541677a54333cf541a49108c1432b44c9424" + integrity sha512-Mti+f9lpJNcwF4tWV8/OrTTtF1gZi+f8FqlyAdouralcFWFQWF2+NgCHShjkCb+IFBLq9buZwE1xckQU4peSuQ== + dependencies: + ansi-styles "^3.2.1" + escape-string-regexp "^1.0.5" + supports-color "^5.3.0" + +clone-response@^1.0.2: + version "1.0.3" + resolved "https://registry.yarnpkg.com/clone-response/-/clone-response-1.0.3.tgz#af2032aa47816399cf5f0a1d0db902f517abb8c3" + integrity sha512-ROoL94jJH2dUVML2Y/5PEDNaSHgeOdSDicUyS7izcF63G6sTc/FTjLub4b8Il9S8S0beOfYt0TaA5qvFK+w0wA== + dependencies: + mimic-response "^1.0.0" + +color-convert@^1.9.0: + version "1.9.3" + resolved "https://registry.yarnpkg.com/color-convert/-/color-convert-1.9.3.tgz#bb71850690e1f136567de629d2d5471deda4c1e8" + integrity sha512-QfAUtd+vFdAtFQcC8CCyYt1fYWxSqAiK2cSD6zDB8N3cpsEBAvRxp9zOGg6G/SHHJYAT88/az/IuDGALsNVbGg== + dependencies: + color-name "1.1.3" + +color-name@1.1.3: + version "1.1.3" + resolved "https://registry.yarnpkg.com/color-name/-/color-name-1.1.3.tgz#a7d0558bd89c42f795dd42328f740831ca53bc25" + integrity sha512-72fSenhMw2HZMTVHeCA9KCmpEIbzWiQsjN+BHcBbS9vr1mtt+vJjPdksIBNUmKAW8TFUDPJK5SUU3QhE9NEXDw== + +colors@1.4.0: + version "1.4.0" + resolved "https://registry.yarnpkg.com/colors/-/colors-1.4.0.tgz#c50491479d4c1bdaed2c9ced32cf7c7dc2360f78" + integrity sha512-a+UqTh4kgZg/SlGvfbzDHpgRu7AAQOmmqRHJnxhRZICKFUT91brVhNNt58CMWU9PsBbv3PDCZUHbVxuDiH2mtA== + +combined-stream@^1.0.8: + version "1.0.8" + resolved "https://registry.yarnpkg.com/combined-stream/-/combined-stream-1.0.8.tgz#c3d45a8b34fd730631a110a8a2520682b31d5a7f" + integrity sha512-FQN4MRfuJeHf7cBbBMJFXhKSDq+2kAArBlmRBvcvFE5BB1HZKXtSFASDhdlz9zOYwxh8lDdnvmMOe/+5cdoEdg== + dependencies: + delayed-stream "~1.0.0" + +commander@^2.18.0: + version "2.20.3" + resolved "https://registry.yarnpkg.com/commander/-/commander-2.20.3.tgz#fd485e84c03eb4881c20722ba48035e8531aeb33" + integrity sha512-GpVkmM8vF2vQUkj2LvZmD35JxeJOLCwJ9cUkugyk2nuhbv3+mJvpLYYt+0+USMxE+oj+ey/lJEnhZw75x/OMcQ== + +core-js@^3.8.2: + version "3.30.0" + resolved "https://registry.yarnpkg.com/core-js/-/core-js-3.30.0.tgz#64ac6f83bc7a49fd42807327051701d4b1478dea" + integrity sha512-hQotSSARoNh1mYPi9O2YaWeiq/cEB95kOrFb4NCrO4RIFt1qqNpKsaE+vy/L3oiqvND5cThqXzUU3r9F7Efztg== + +danger@^11.2.5: + version "11.2.5" + resolved "https://registry.yarnpkg.com/danger/-/danger-11.2.5.tgz#e0f20fbbc35dedff83a67595a684425c5711606a" + integrity sha512-t3M20P0TsslkEkakha1PJHLyD+KxbHHdlhsauC/a53GQgQFO3aKz3Zg5YCHJ+javp0gVkPcUgFrgc7voW1Qp6g== + dependencies: + "@gitbeaker/node" "^21.3.0" + "@octokit/rest" "^18.12.0" + async-retry "1.2.3" + chalk "^2.3.0" + commander "^2.18.0" + core-js "^3.8.2" + debug "^4.1.1" + fast-json-patch "^3.0.0-1" + get-stdin "^6.0.0" + http-proxy-agent "^5.0.0" + https-proxy-agent "^5.0.1" + hyperlinker "^1.0.0" + json5 "^2.1.0" + jsonpointer "^5.0.0" + jsonwebtoken "^9.0.0" + lodash.find "^4.6.0" + lodash.includes "^4.3.0" + lodash.isobject "^3.0.2" + lodash.keys "^4.0.8" + lodash.mapvalues "^4.6.0" + lodash.memoize "^4.1.2" + memfs-or-file-map-to-github-branch "^1.2.1" + micromatch "^4.0.4" + node-cleanup "^2.1.2" + node-fetch "^2.6.7" + override-require "^1.1.1" + p-limit "^2.1.0" + parse-diff "^0.7.0" + parse-git-config "^2.0.3" + parse-github-url "^1.0.2" + parse-link-header "^2.0.0" + pinpoint "^1.1.0" + prettyjson "^1.2.1" + readline-sync "^1.4.9" + regenerator-runtime "^0.13.9" + require-from-string "^2.0.2" + supports-hyperlinks "^1.0.1" + +debug@4, debug@^4.1.1: + version "4.3.4" + resolved "https://registry.yarnpkg.com/debug/-/debug-4.3.4.tgz#1319f6579357f2338d3337d2cdd4914bb5dcc865" + integrity sha512-PRWFHuSU3eDtQJPvnNY7Jcket1j0t5OuOsFzPPzsekD52Zl8qUfFIPEiswXqIvHWGVHOgX+7G/vCNNhehwxfkQ== + dependencies: + ms "2.1.2" + +decode-uri-component@^0.2.0: + version "0.2.2" + resolved "https://registry.yarnpkg.com/decode-uri-component/-/decode-uri-component-0.2.2.tgz#e69dbe25d37941171dd540e024c444cd5188e1e9" + integrity sha512-FqUYQ+8o158GyGTrMFJms9qh3CqTKvAqgqsTnkLI8sKu0028orqBhxNMFkFen0zGyg6epACD32pjVk58ngIErQ== + +decompress-response@^6.0.0: + version "6.0.0" + resolved "https://registry.yarnpkg.com/decompress-response/-/decompress-response-6.0.0.tgz#ca387612ddb7e104bd16d85aab00d5ecf09c66fc" + integrity sha512-aW35yZM6Bb/4oJlZncMH2LCoZtJXTRxES17vE3hoRiowU2kWHaJKFkSBDnDR+cm9J+9QhXmREyIfv0pji9ejCQ== + dependencies: + mimic-response "^3.1.0" + +defer-to-connect@^2.0.0: + version "2.0.1" + resolved "https://registry.yarnpkg.com/defer-to-connect/-/defer-to-connect-2.0.1.tgz#8016bdb4143e4632b77a3449c6236277de520587" + integrity sha512-4tvttepXG1VaYGrRibk5EwJd1t4udunSOVMdLSAL6mId1ix438oPwPZMALY41FCijukO1L0twNcGsdzS7dHgDg== + +delayed-stream@~1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/delayed-stream/-/delayed-stream-1.0.0.tgz#df3ae199acadfb7d440aaae0b29e2272b24ec619" + integrity sha512-ZySD7Nf91aLB0RxL4KGrKHBXl7Eds1DAmEdcoVawXnLD7SDhpNgtuII2aAkg7a7QS41jxPSZ17p4VdGnMHk3MQ== + +deprecation@^2.0.0, deprecation@^2.3.1: + version "2.3.1" + resolved "https://registry.yarnpkg.com/deprecation/-/deprecation-2.3.1.tgz#6368cbdb40abf3373b525ac87e4a260c3a700919" + integrity sha512-xmHIy4F3scKVwMsQ4WnVaS8bHOx0DmVwRywosKhaILI0ywMDWPtBSku2HNxRvF7jtwDRsoEwYQSfbxj8b7RlJQ== + +ecdsa-sig-formatter@1.0.11: + version "1.0.11" + resolved "https://registry.yarnpkg.com/ecdsa-sig-formatter/-/ecdsa-sig-formatter-1.0.11.tgz#ae0f0fa2d85045ef14a817daa3ce9acd0489e5bf" + integrity sha512-nagl3RYrbNv6kQkeJIpt6NJZy8twLB/2vtz6yN9Z4vRKHN4/QZJIEbqohALSgwKdnksuY3k5Addp5lg8sVoVcQ== + dependencies: + safe-buffer "^5.0.1" + +end-of-stream@^1.1.0: + version "1.4.4" + resolved "https://registry.yarnpkg.com/end-of-stream/-/end-of-stream-1.4.4.tgz#5ae64a5f45057baf3626ec14da0ca5e4b2431eb0" + integrity sha512-+uw1inIHVPQoaVuHzRyXd21icM+cnt4CzD5rW+NC1wjOUSTOs+Te7FOv7AhN7vS9x/oIyhLP5PR1H+phQAHu5Q== + dependencies: + once "^1.4.0" + +escape-string-regexp@^1.0.5: + version "1.0.5" + resolved "https://registry.yarnpkg.com/escape-string-regexp/-/escape-string-regexp-1.0.5.tgz#1b61c0562190a8dff6ae3bb2cf0200ca130b86d4" + integrity sha512-vbRorB5FUQWvla16U8R/qgaFIya2qGzwDrNmCZuYKrbdSUMG6I1ZCGQRefkRVhuOkIGVne7BQ35DSfo1qvJqFg== + +expand-tilde@^2.0.2: + version "2.0.2" + resolved "https://registry.yarnpkg.com/expand-tilde/-/expand-tilde-2.0.2.tgz#97e801aa052df02454de46b02bf621642cdc8502" + integrity sha512-A5EmesHW6rfnZ9ysHQjPdJRni0SRar0tjtG5MNtm9n5TUvsYU8oozprtRD4AqHxcZWWlVuAmQo2nWKfN9oyjTw== + dependencies: + homedir-polyfill "^1.0.1" + +extend-shallow@^2.0.1: + version "2.0.1" + resolved "https://registry.yarnpkg.com/extend-shallow/-/extend-shallow-2.0.1.tgz#51af7d614ad9a9f610ea1bafbb989d6b1c56890f" + integrity sha512-zCnTtlxNoAiDc3gqY2aYAWFx7XWWiasuF2K8Me5WbN8otHKTUKBwjPtNpRs/rbUZm7KxWAaNj7P1a/p52GbVug== + dependencies: + is-extendable "^0.1.0" + +fast-json-patch@^3.0.0-1: + version "3.1.1" + resolved "https://registry.yarnpkg.com/fast-json-patch/-/fast-json-patch-3.1.1.tgz#85064ea1b1ebf97a3f7ad01e23f9337e72c66947" + integrity sha512-vf6IHUX2SBcA+5/+4883dsIjpBTqmfBjmYiWK1savxQmFk4JfBMLa7ynTYOs1Rolp/T1betJxHiGD3g1Mn8lUQ== + +fast-xml-parser@^4.2.0: + version "4.2.0" + resolved "https://registry.yarnpkg.com/fast-xml-parser/-/fast-xml-parser-4.2.0.tgz#6db2ba33b95b8b4af93f94fe024d4b4d02a50855" + integrity sha512-+zVQv4aVTO+o8oRUyRL7PjgeVo1J6oP8Cw2+a8UTZQcj5V0yUK5T63gTN0ldgiHDPghUjKc4OpT6SwMTwnOQug== + dependencies: + strnum "^1.0.5" + +fill-range@^7.0.1: + version "7.0.1" + resolved "https://registry.yarnpkg.com/fill-range/-/fill-range-7.0.1.tgz#1919a6a7c75fe38b2c7c77e5198535da9acdda40" + integrity sha512-qOo9F+dMUmC2Lcb4BbVvnKJxTPjCm+RRpe4gDuGrzkL7mEVl/djYSu2OdQ2Pa302N4oqkSg9ir6jaLWJ2USVpQ== + dependencies: + to-regex-range "^5.0.1" + +filter-obj@^1.1.0: + version "1.1.0" + resolved "https://registry.yarnpkg.com/filter-obj/-/filter-obj-1.1.0.tgz#9b311112bc6c6127a16e016c6c5d7f19e0805c5b" + integrity sha512-8rXg1ZnX7xzy2NGDVkBVaAy+lSlPNwad13BtgSlLuxfIslyt5Vg64U7tFcCt4WS1R0hvtnQybT/IyCkGZ3DpXQ== + +form-data@^3.0.0: + version "3.0.1" + resolved "https://registry.yarnpkg.com/form-data/-/form-data-3.0.1.tgz#ebd53791b78356a99af9a300d4282c4d5eb9755f" + integrity sha512-RHkBKtLWUVwd7SqRIvCZMEvAMoGUp0XU+seQiZejj0COz3RI3hWP4sCv3gZWWLjJTd7rGwcsF5eKZGii0r/hbg== + dependencies: + asynckit "^0.4.0" + combined-stream "^1.0.8" + mime-types "^2.1.12" + +fs-exists-sync@^0.1.0: + version "0.1.0" + resolved "https://registry.yarnpkg.com/fs-exists-sync/-/fs-exists-sync-0.1.0.tgz#982d6893af918e72d08dec9e8673ff2b5a8d6add" + integrity sha512-cR/vflFyPZtrN6b38ZyWxpWdhlXrzZEBawlpBQMq7033xVY7/kg0GDMBK5jg8lDYQckdJ5x/YC88lM3C7VMsLg== + +get-stdin@^6.0.0: + version "6.0.0" + resolved "https://registry.yarnpkg.com/get-stdin/-/get-stdin-6.0.0.tgz#9e09bf712b360ab9225e812048f71fde9c89657b" + integrity sha512-jp4tHawyV7+fkkSKyvjuLZswblUtz+SQKzSWnBbii16BuZksJlU1wuBYXY75r+duh/llF1ur6oNwi+2ZzjKZ7g== + +get-stream@^5.1.0: + version "5.2.0" + resolved "https://registry.yarnpkg.com/get-stream/-/get-stream-5.2.0.tgz#4966a1795ee5ace65e706c4b7beb71257d6e22d3" + integrity sha512-nBF+F1rAZVCu/p7rjzgA+Yb4lfYXrpl7a6VmJrU8wF9I1CKvP/QwPNZHnOlwbTkY6dvtFIzFMSyQXbLoTQPRpA== + dependencies: + pump "^3.0.0" + +git-config-path@^1.0.1: + version "1.0.1" + resolved "https://registry.yarnpkg.com/git-config-path/-/git-config-path-1.0.1.tgz#6d33f7ed63db0d0e118131503bab3aca47d54664" + integrity sha512-KcJ2dlrrP5DbBnYIZ2nlikALfRhKzNSX0stvv3ImJ+fvC4hXKoV+U+74SV0upg+jlQZbrtQzc0bu6/Zh+7aQbg== + dependencies: + extend-shallow "^2.0.1" + fs-exists-sync "^0.1.0" + homedir-polyfill "^1.0.0" + +got@^11.1.4: + version "11.8.6" + resolved "https://registry.yarnpkg.com/got/-/got-11.8.6.tgz#276e827ead8772eddbcfc97170590b841823233a" + integrity sha512-6tfZ91bOr7bOXnK7PRDCGBLa1H4U080YHNaAQ2KsMGlLEzRbk44nsZF2E1IeRc3vtJHPVbKCYgdFbaGO2ljd8g== + dependencies: + "@sindresorhus/is" "^4.0.0" + "@szmarczak/http-timer" "^4.0.5" + "@types/cacheable-request" "^6.0.1" + "@types/responselike" "^1.0.0" + cacheable-lookup "^5.0.3" + cacheable-request "^7.0.2" + decompress-response "^6.0.0" + http2-wrapper "^1.0.0-beta.5.2" + lowercase-keys "^2.0.0" + p-cancelable "^2.0.0" + responselike "^2.0.0" + +has-flag@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/has-flag/-/has-flag-2.0.0.tgz#e8207af1cc7b30d446cc70b734b5e8be18f88d51" + integrity sha512-P+1n3MnwjR/Epg9BBo1KT8qbye2g2Ou4sFumihwt6I4tsUX7jnLcX4BTOSKg/B1ZrIYMN9FcEnG4x5a7NB8Eng== + +has-flag@^3.0.0: + version "3.0.0" + resolved "https://registry.yarnpkg.com/has-flag/-/has-flag-3.0.0.tgz#b5d454dc2199ae225699f3467e5a07f3b955bafd" + integrity sha512-sKJf1+ceQBr4SMkvQnBDNDtf4TXpVhVGateu0t918bl30FnbE2m4vNLX+VWe/dpjlb+HugGYzW7uQXH98HPEYw== + +homedir-polyfill@^1.0.0, homedir-polyfill@^1.0.1: + version "1.0.3" + resolved "https://registry.yarnpkg.com/homedir-polyfill/-/homedir-polyfill-1.0.3.tgz#743298cef4e5af3e194161fbadcc2151d3a058e8" + integrity sha512-eSmmWE5bZTK2Nou4g0AI3zZ9rswp7GRKoKXS1BLUkvPviOqs4YTN1djQIqrXy9k5gEtdLPy86JjRwsNM9tnDcA== + dependencies: + parse-passwd "^1.0.0" + +http-cache-semantics@^4.0.0: + version "4.1.1" + resolved "https://registry.yarnpkg.com/http-cache-semantics/-/http-cache-semantics-4.1.1.tgz#abe02fcb2985460bf0323be664436ec3476a6d5a" + integrity sha512-er295DKPVsV82j5kw1Gjt+ADA/XYHsajl82cGNQG2eyoPkvgUhX+nDIyelzhIWbbsXP39EHcI6l5tYs2FYqYXQ== + +http-proxy-agent@^5.0.0: + version "5.0.0" + resolved "https://registry.yarnpkg.com/http-proxy-agent/-/http-proxy-agent-5.0.0.tgz#5129800203520d434f142bc78ff3c170800f2b43" + integrity sha512-n2hY8YdoRE1i7r6M0w9DIw5GgZN0G25P8zLCRQ8rjXtTU3vsNFBI/vWK/UIeE6g5MUUz6avwAPXmL6Fy9D/90w== + dependencies: + "@tootallnate/once" "2" + agent-base "6" + debug "4" + +http2-wrapper@^1.0.0-beta.5.2: + version "1.0.3" + resolved "https://registry.yarnpkg.com/http2-wrapper/-/http2-wrapper-1.0.3.tgz#b8f55e0c1f25d4ebd08b3b0c2c079f9590800b3d" + integrity sha512-V+23sDMr12Wnz7iTcDeJr3O6AIxlnvT/bmaAAAP/Xda35C90p9599p0F1eHR/N1KILWSoWVAiOMFjBBXaXSMxg== + dependencies: + quick-lru "^5.1.1" + resolve-alpn "^1.0.0" + +https-proxy-agent@^5.0.1: + version "5.0.1" + resolved "https://registry.yarnpkg.com/https-proxy-agent/-/https-proxy-agent-5.0.1.tgz#c59ef224a04fe8b754f3db0063a25ea30d0005d6" + integrity sha512-dFcAjpTQFgoLMzC2VwU+C/CbS7uRL0lWmxDITmqm7C+7F0Odmj6s9l6alZc6AELXhrnggM2CeWSXHGOdX2YtwA== + dependencies: + agent-base "6" + debug "4" + +hyperlinker@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/hyperlinker/-/hyperlinker-1.0.0.tgz#23dc9e38a206b208ee49bc2d6c8ef47027df0c0e" + integrity sha512-Ty8UblRWFEcfSuIaajM34LdPXIhbs1ajEX/BBPv24J+enSVaEVY63xQ6lTO9VRYS5LAoghIG0IDJ+p+IPzKUQQ== + +ini@^1.3.5: + version "1.3.8" + resolved "https://registry.yarnpkg.com/ini/-/ini-1.3.8.tgz#a29da425b48806f34767a4efce397269af28432c" + integrity sha512-JV/yugV2uzW5iMRSiZAyDtQd+nxtUnjeLt0acNdw98kKLrvuRVyB80tsREOE7yvGVgalhZ6RNXCmEHkUKBKxew== + +is-extendable@^0.1.0: + version "0.1.1" + resolved "https://registry.yarnpkg.com/is-extendable/-/is-extendable-0.1.1.tgz#62b110e289a471418e3ec36a617d472e301dfc89" + integrity sha512-5BMULNob1vgFX6EjQw5izWDxrecWK9AM72rugNr0TFldMOi0fj6Jk+zeKIt0xGj4cEfQIJth4w3OKWOJ4f+AFw== + +is-number@^7.0.0: + version "7.0.0" + resolved "https://registry.yarnpkg.com/is-number/-/is-number-7.0.0.tgz#7535345b896734d5f80c4d06c50955527a14f12b" + integrity sha512-41Cifkg6e8TylSpdtTpeLVMqvSBEVzTttHvERD741+pnZ8ANv0004MRL43QKPDlK9cGvNp6NZWZUBlbGXYxxng== + +is-plain-object@^5.0.0: + version "5.0.0" + resolved "https://registry.yarnpkg.com/is-plain-object/-/is-plain-object-5.0.0.tgz#4427f50ab3429e9025ea7d52e9043a9ef4159344" + integrity sha512-VRSzKkbMm5jMDoKLbltAkFQ5Qr7VDiTFGXxYFXXowVj387GeGNOCsOH6Msy00SGZ3Fp84b1Naa1psqgcCIEP5Q== + +json-buffer@3.0.1: + version "3.0.1" + resolved "https://registry.yarnpkg.com/json-buffer/-/json-buffer-3.0.1.tgz#9338802a30d3b6605fbe0613e094008ca8c05a13" + integrity sha512-4bV5BfR2mqfQTJm+V5tPPdf+ZpuhiIvTuAB5g8kcrXOZpTT/QwwVRWBywX1ozr6lEuPdbHxwaJlm9G6mI2sfSQ== + +json5@^2.1.0: + version "2.2.3" + resolved "https://registry.yarnpkg.com/json5/-/json5-2.2.3.tgz#78cd6f1a19bdc12b73db5ad0c61efd66c1e29283" + integrity sha512-XmOWe7eyHYH14cLdVPoyg+GOH3rYX++KpzrylJwSW98t3Nk+U8XOl8FWKOgwtzdb8lXGf6zYwDUzeHMWfxasyg== + +jsonpointer@^5.0.0: + version "5.0.1" + resolved "https://registry.yarnpkg.com/jsonpointer/-/jsonpointer-5.0.1.tgz#2110e0af0900fd37467b5907ecd13a7884a1b559" + integrity sha512-p/nXbhSEcu3pZRdkW1OfJhpsVtW1gd4Wa1fnQc9YLiTfAjn0312eMKimbdIQzuZl9aa9xUGaRlP9T/CJE/ditQ== + +jsonwebtoken@^9.0.0: + version "9.0.0" + resolved "https://registry.yarnpkg.com/jsonwebtoken/-/jsonwebtoken-9.0.0.tgz#d0faf9ba1cc3a56255fe49c0961a67e520c1926d" + integrity sha512-tuGfYXxkQGDPnLJ7SibiQgVgeDgfbPq2k2ICcbgqW8WxWLBAxKQM/ZCu/IT8SOSwmaYl4dpTFCW5xZv7YbbWUw== + dependencies: + jws "^3.2.2" + lodash "^4.17.21" + ms "^2.1.1" + semver "^7.3.8" + +jwa@^1.4.1: + version "1.4.1" + resolved "https://registry.yarnpkg.com/jwa/-/jwa-1.4.1.tgz#743c32985cb9e98655530d53641b66c8645b039a" + integrity sha512-qiLX/xhEEFKUAJ6FiBMbes3w9ATzyk5W7Hvzpa/SLYdxNtng+gcurvrI7TbACjIXlsJyr05/S1oUhZrc63evQA== + dependencies: + buffer-equal-constant-time "1.0.1" + ecdsa-sig-formatter "1.0.11" + safe-buffer "^5.0.1" + +jws@^3.2.2: + version "3.2.2" + resolved "https://registry.yarnpkg.com/jws/-/jws-3.2.2.tgz#001099f3639468c9414000e99995fa52fb478304" + integrity sha512-YHlZCB6lMTllWDtSPHz/ZXTsi8S00usEV6v1tjq8tOUZzw7DpSDWVXjXDre6ed1w/pd495ODpHZYSdkRTsa0HA== + dependencies: + jwa "^1.4.1" + safe-buffer "^5.0.1" + +keyv@^4.0.0: + version "4.5.2" + resolved "https://registry.yarnpkg.com/keyv/-/keyv-4.5.2.tgz#0e310ce73bf7851ec702f2eaf46ec4e3805cce56" + integrity sha512-5MHbFaKn8cNSmVW7BYnijeAVlE4cYA/SVkifVgrh7yotnfhKmjuXpDKjrABLnT0SfHWV21P8ow07OGfRrNDg8g== + dependencies: + json-buffer "3.0.1" + +li@^1.3.0: + version "1.3.0" + resolved "https://registry.yarnpkg.com/li/-/li-1.3.0.tgz#22c59bcaefaa9a8ef359cf759784e4bf106aea1b" + integrity sha512-z34TU6GlMram52Tss5mt1m//ifRIpKH5Dqm7yUVOdHI+BQCs9qGPHFaCUTIzsWX7edN30aa2WrPwR7IO10FHaw== + +lodash.find@^4.6.0: + version "4.6.0" + resolved "https://registry.yarnpkg.com/lodash.find/-/lodash.find-4.6.0.tgz#cb0704d47ab71789ffa0de8b97dd926fb88b13b1" + integrity sha512-yaRZoAV3Xq28F1iafWN1+a0rflOej93l1DQUejs3SZ41h2O9UJBoS9aueGjPDgAl4B6tPC0NuuchLKaDQQ3Isg== + +lodash.includes@^4.3.0: + version "4.3.0" + resolved "https://registry.yarnpkg.com/lodash.includes/-/lodash.includes-4.3.0.tgz#60bb98a87cb923c68ca1e51325483314849f553f" + integrity sha512-W3Bx6mdkRTGtlJISOvVD/lbqjTlPPUDTMnlXZFnVwi9NKJ6tiAk6LVdlhZMm17VZisqhKcgzpO5Wz91PCt5b0w== + +lodash.isobject@^3.0.2: + version "3.0.2" + resolved "https://registry.yarnpkg.com/lodash.isobject/-/lodash.isobject-3.0.2.tgz#3c8fb8d5b5bf4bf90ae06e14f2a530a4ed935e1d" + integrity sha512-3/Qptq2vr7WeJbB4KHUSKlq8Pl7ASXi3UG6CMbBm8WRtXi8+GHm7mKaU3urfpSEzWe2wCIChs6/sdocUsTKJiA== + +lodash.keys@^4.0.8: + version "4.2.0" + resolved "https://registry.yarnpkg.com/lodash.keys/-/lodash.keys-4.2.0.tgz#a08602ac12e4fb83f91fc1fb7a360a4d9ba35205" + integrity sha512-J79MkJcp7Df5mizHiVNpjoHXLi4HLjh9VLS/M7lQSGoQ+0oQ+lWEigREkqKyizPB1IawvQLLKY8mzEcm1tkyxQ== + +lodash.mapvalues@^4.6.0: + version "4.6.0" + resolved "https://registry.yarnpkg.com/lodash.mapvalues/-/lodash.mapvalues-4.6.0.tgz#1bafa5005de9dd6f4f26668c30ca37230cc9689c" + integrity sha512-JPFqXFeZQ7BfS00H58kClY7SPVeHertPE0lNuCyZ26/XlN8TvakYD7b9bGyNmXbT/D3BbtPAAmq90gPWqLkxlQ== + +lodash.memoize@^4.1.2: + version "4.1.2" + resolved "https://registry.yarnpkg.com/lodash.memoize/-/lodash.memoize-4.1.2.tgz#bcc6c49a42a2840ed997f323eada5ecd182e0bfe" + integrity sha512-t7j+NzmgnQzTAYXcsHYLgimltOV1MXHtlOWf6GjL9Kj8GK5FInw5JotxvbOs+IvV1/Dzo04/fCGfLVs7aXb4Ag== + +lodash@^4.17.21: + version "4.17.21" + resolved "https://registry.yarnpkg.com/lodash/-/lodash-4.17.21.tgz#679591c564c3bffaae8454cf0b3df370c3d6911c" + integrity sha512-v2kDEe57lecTulaDIuNTPy3Ry4gLGJ6Z1O3vE1krgXZNrsQ+LFTGHVxVjcXPs17LhbZVGedAJv8XZ1tvj5FvSg== + +lowercase-keys@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/lowercase-keys/-/lowercase-keys-2.0.0.tgz#2603e78b7b4b0006cbca2fbcc8a3202558ac9479" + integrity sha512-tqNXrS78oMOE73NMxK4EMLQsQowWf8jKooH9g7xPavRT706R6bkQJ6DY2Te7QukaZsulxa30wQ7bk0pm4XiHmA== + +lru-cache@^6.0.0: + version "6.0.0" + resolved "https://registry.yarnpkg.com/lru-cache/-/lru-cache-6.0.0.tgz#6d6fe6570ebd96aaf90fcad1dafa3b2566db3a94" + integrity sha512-Jo6dJ04CmSjuznwJSS3pUeWmd/H0ffTlkXXgwZi+eq1UCmqQwCh+eLsYOYCwY991i2Fah4h1BEMCx4qThGbsiA== + dependencies: + yallist "^4.0.0" + +memfs-or-file-map-to-github-branch@^1.2.1: + version "1.2.1" + resolved "https://registry.yarnpkg.com/memfs-or-file-map-to-github-branch/-/memfs-or-file-map-to-github-branch-1.2.1.tgz#fdb9a85408262316a9bd5567409bf89be7d72f96" + integrity sha512-I/hQzJ2a/pCGR8fkSQ9l5Yx+FQ4e7X6blNHyWBm2ojeFLT3GVzGkTj7xnyWpdclrr7Nq4dmx3xrvu70m3ypzAQ== + dependencies: + "@octokit/rest" "^16.43.0 || ^17.11.0 || ^18.12.0" + +micromatch@^4.0.4: + version "4.0.5" + resolved "https://registry.yarnpkg.com/micromatch/-/micromatch-4.0.5.tgz#bc8999a7cbbf77cdc89f132f6e467051b49090c6" + integrity sha512-DMy+ERcEW2q8Z2Po+WNXuw3c5YaUSFjAO5GsJqfEl7UjvtIuFKO6ZrKvcItdy98dwFI2N1tg3zNIdKaQT+aNdA== + dependencies: + braces "^3.0.2" + picomatch "^2.3.1" + +mime-db@1.52.0: + version "1.52.0" + resolved "https://registry.yarnpkg.com/mime-db/-/mime-db-1.52.0.tgz#bbabcdc02859f4987301c856e3387ce5ec43bf70" + integrity sha512-sPU4uV7dYlvtWJxwwxHD0PuihVNiE7TyAbQ5SWxDCB9mUYvOgroQOwYQQOKPJ8CIbE+1ETVlOoK1UC2nU3gYvg== + +mime-types@^2.1.12: + version "2.1.35" + resolved "https://registry.yarnpkg.com/mime-types/-/mime-types-2.1.35.tgz#381a871b62a734450660ae3deee44813f70d959a" + integrity sha512-ZDY+bPm5zTTF+YpCrAU9nK0UgICYPT0QtT1NZWFv4s++TNkcgVaT0g6+4R2uI4MjQjzysHB1zxuWL50hzaeXiw== + dependencies: + mime-db "1.52.0" + +mimic-response@^1.0.0: + version "1.0.1" + resolved "https://registry.yarnpkg.com/mimic-response/-/mimic-response-1.0.1.tgz#4923538878eef42063cb8a3e3b0798781487ab1b" + integrity sha512-j5EctnkH7amfV/q5Hgmoal1g2QHFJRraOtmx0JpIqkxhBhI/lJSl1nMpQ45hVarwNETOoWEimndZ4QK0RHxuxQ== + +mimic-response@^3.1.0: + version "3.1.0" + resolved "https://registry.yarnpkg.com/mimic-response/-/mimic-response-3.1.0.tgz#2d1d59af9c1b129815accc2c46a022a5ce1fa3c9" + integrity sha512-z0yWI+4FDrrweS8Zmt4Ej5HdJmky15+L2e6Wgn3+iK5fWzb6T3fhNFq2+MeTRb064c6Wr4N/wv0DzQTjNzHNGQ== + +minimist@^1.2.0: + version "1.2.8" + resolved "https://registry.yarnpkg.com/minimist/-/minimist-1.2.8.tgz#c1a464e7693302e082a075cee0c057741ac4772c" + integrity sha512-2yyAR8qBkN3YuheJanUpWC5U3bb5osDywNB8RzDVlDwDHbocAJveqqj1u8+SVD7jkWT4yvsHCpWqqWqAxb0zCA== + +ms@2.1.2: + version "2.1.2" + resolved "https://registry.yarnpkg.com/ms/-/ms-2.1.2.tgz#d09d1f357b443f493382a8eb3ccd183872ae6009" + integrity sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w== + +ms@^2.1.1: + version "2.1.3" + resolved "https://registry.yarnpkg.com/ms/-/ms-2.1.3.tgz#574c8138ce1d2b5861f0b44579dbadd60c6615b2" + integrity sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA== + +node-cleanup@^2.1.2: + version "2.1.2" + resolved "https://registry.yarnpkg.com/node-cleanup/-/node-cleanup-2.1.2.tgz#7ac19abd297e09a7f72a71545d951b517e4dde2c" + integrity sha512-qN8v/s2PAJwGUtr1/hYTpNKlD6Y9rc4p8KSmJXyGdYGZsDGKXrGThikLFP9OCHFeLeEpQzPwiAtdIvBLqm//Hw== + +node-fetch@^2.6.7: + version "2.6.9" + resolved "https://registry.yarnpkg.com/node-fetch/-/node-fetch-2.6.9.tgz#7c7f744b5cc6eb5fd404e0c7a9fec630a55657e6" + integrity sha512-DJm/CJkZkRjKKj4Zi4BsKVZh3ValV5IR5s7LVZnW+6YMh0W1BfNA8XSs6DLMGYlId5F3KnA70uu2qepcR08Qqg== + dependencies: + whatwg-url "^5.0.0" + +normalize-url@^6.0.1: + version "6.1.0" + resolved "https://registry.yarnpkg.com/normalize-url/-/normalize-url-6.1.0.tgz#40d0885b535deffe3f3147bec877d05fe4c5668a" + integrity sha512-DlL+XwOy3NxAQ8xuC0okPgK46iuVNAK01YN7RueYBqqFeGsBjV9XmCAzAdgt+667bCl5kPh9EqKKDwnaPG1I7A== + +once@^1.3.1, once@^1.4.0: + version "1.4.0" + resolved "https://registry.yarnpkg.com/once/-/once-1.4.0.tgz#583b1aa775961d4b113ac17d9c50baef9dd76bd1" + integrity sha512-lNaJgI+2Q5URQBkccEKHTQOPaXdUxnZZElQTZY0MFUAuaEqe1E+Nyvgdz/aIyNi6Z9MzO5dv1H8n58/GELp3+w== + dependencies: + wrappy "1" + +override-require@^1.1.1: + version "1.1.1" + resolved "https://registry.yarnpkg.com/override-require/-/override-require-1.1.1.tgz#6ae22fadeb1f850ffb0cf4c20ff7b87e5eb650df" + integrity sha512-eoJ9YWxFcXbrn2U8FKT6RV+/Kj7fiGAB1VvHzbYKt8xM5ZuKZgCGvnHzDxmreEjcBH28ejg5MiOH4iyY1mQnkg== + +p-cancelable@^2.0.0: + version "2.1.1" + resolved "https://registry.yarnpkg.com/p-cancelable/-/p-cancelable-2.1.1.tgz#aab7fbd416582fa32a3db49859c122487c5ed2cf" + integrity sha512-BZOr3nRQHOntUjTrH8+Lh54smKHoHyur8We1V8DSMVrl5A2malOOwuJRnKRDjSnkoeBh4at6BwEnb5I7Jl31wg== + +p-limit@^2.1.0: + version "2.3.0" + resolved "https://registry.yarnpkg.com/p-limit/-/p-limit-2.3.0.tgz#3dd33c647a214fdfffd835933eb086da0dc21db1" + integrity sha512-//88mFWSJx8lxCzwdAABTJL2MyWB12+eIY7MDL2SqLmAkeKU9qxRvWuSyTjm3FUmpBEMuFfckAIqEaVGUDxb6w== + dependencies: + p-try "^2.0.0" + +p-try@^2.0.0: + version "2.2.0" + resolved "https://registry.yarnpkg.com/p-try/-/p-try-2.2.0.tgz#cb2868540e313d61de58fafbe35ce9004d5540e6" + integrity sha512-R4nPAVTAU0B9D35/Gk3uJf/7XYbQcyohSKdvAxIRSNghFl4e71hVoGnBNQz9cWaXxO2I10KTC+3jMdvvoKw6dQ== + +parse-diff@^0.7.0: + version "0.7.1" + resolved "https://registry.yarnpkg.com/parse-diff/-/parse-diff-0.7.1.tgz#9b7a2451c3725baf2c87c831ba192d40ee2237d4" + integrity sha512-1j3l8IKcy4yRK2W4o9EYvJLSzpAVwz4DXqCewYyx2vEwk2gcf3DBPqc8Fj4XV3K33OYJ08A8fWwyu/ykD/HUSg== + +parse-git-config@^2.0.3: + version "2.0.3" + resolved "https://registry.yarnpkg.com/parse-git-config/-/parse-git-config-2.0.3.tgz#6fb840d4a956e28b971c97b33a5deb73a6d5b6bb" + integrity sha512-Js7ueMZOVSZ3tP8C7E3KZiHv6QQl7lnJ+OkbxoaFazzSa2KyEHqApfGbU3XboUgUnq4ZuUmskUpYKTNx01fm5A== + dependencies: + expand-tilde "^2.0.2" + git-config-path "^1.0.1" + ini "^1.3.5" + +parse-github-url@^1.0.2: + version "1.0.2" + resolved "https://registry.yarnpkg.com/parse-github-url/-/parse-github-url-1.0.2.tgz#242d3b65cbcdda14bb50439e3242acf6971db395" + integrity sha512-kgBf6avCbO3Cn6+RnzRGLkUsv4ZVqv/VfAYkRsyBcgkshNvVBkRn1FEZcW0Jb+npXQWm2vHPnnOqFteZxRRGNw== + +parse-link-header@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/parse-link-header/-/parse-link-header-2.0.0.tgz#949353e284f8aa01f2ac857a98f692b57733f6b7" + integrity sha512-xjU87V0VyHZybn2RrCX5TIFGxTVZE6zqqZWMPlIKiSKuWh/X5WZdt+w1Ki1nXB+8L/KtL+nZ4iq+sfI6MrhhMw== + dependencies: + xtend "~4.0.1" + +parse-passwd@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/parse-passwd/-/parse-passwd-1.0.0.tgz#6d5b934a456993b23d37f40a382d6f1666a8e5c6" + integrity sha512-1Y1A//QUXEZK7YKz+rD9WydcE1+EuPr6ZBgKecAB8tmoW6UFv0NREVJe1p+jRxtThkcbbKkfwIbWJe/IeE6m2Q== + +picomatch@^2.3.1: + version "2.3.1" + resolved "https://registry.yarnpkg.com/picomatch/-/picomatch-2.3.1.tgz#3ba3833733646d9d3e4995946c1365a67fb07a42" + integrity sha512-JU3teHTNjmE2VCGFzuY8EXzCDVwEqB2a8fsIvwaStHhAWJEeVd1o1QD80CU6+ZdEXXSLbSsuLwJjkCBWqRQUVA== + +pinpoint@^1.1.0: + version "1.1.0" + resolved "https://registry.yarnpkg.com/pinpoint/-/pinpoint-1.1.0.tgz#0cf7757a6977f1bf7f6a32207b709e377388e874" + integrity sha512-+04FTD9x7Cls2rihLlo57QDCcHoLBGn5Dk51SwtFBWkUWLxZaBXyNVpCw1S+atvE7GmnFjeaRZ0WLq3UYuqAdg== + +prettyjson@^1.2.1: + version "1.2.5" + resolved "https://registry.yarnpkg.com/prettyjson/-/prettyjson-1.2.5.tgz#ef3cfffcc70505c032abc59785884b4027031835" + integrity sha512-rksPWtoZb2ZpT5OVgtmy0KHVM+Dca3iVwWY9ifwhcexfjebtgjg3wmrUt9PvJ59XIYBcknQeYHD8IAnVlh9lAw== + dependencies: + colors "1.4.0" + minimist "^1.2.0" + +pump@^3.0.0: + version "3.0.0" + resolved "https://registry.yarnpkg.com/pump/-/pump-3.0.0.tgz#b4a2116815bde2f4e1ea602354e8c75565107a64" + integrity sha512-LwZy+p3SFs1Pytd/jYct4wpv49HiYCqd9Rlc5ZVdk0V+8Yzv6jR5Blk3TRmPL1ft69TxP0IMZGJ+WPFU2BFhww== + dependencies: + end-of-stream "^1.1.0" + once "^1.3.1" + +query-string@^6.12.1: + version "6.14.1" + resolved "https://registry.yarnpkg.com/query-string/-/query-string-6.14.1.tgz#7ac2dca46da7f309449ba0f86b1fd28255b0c86a" + integrity sha512-XDxAeVmpfu1/6IjyT/gXHOl+S0vQ9owggJ30hhWKdHAsNPOcasn5o9BW0eejZqL2e4vMjhAxoW3jVHcD6mbcYw== + dependencies: + decode-uri-component "^0.2.0" + filter-obj "^1.1.0" + split-on-first "^1.0.0" + strict-uri-encode "^2.0.0" + +quick-lru@^5.1.1: + version "5.1.1" + resolved "https://registry.yarnpkg.com/quick-lru/-/quick-lru-5.1.1.tgz#366493e6b3e42a3a6885e2e99d18f80fb7a8c932" + integrity sha512-WuyALRjWPDGtt/wzJiadO5AXY+8hZ80hVpe6MyivgraREW751X3SbhRvG3eLKOYN+8VEvqLcf3wdnt44Z4S4SA== + +readline-sync@^1.4.9: + version "1.4.10" + resolved "https://registry.yarnpkg.com/readline-sync/-/readline-sync-1.4.10.tgz#41df7fbb4b6312d673011594145705bf56d8873b" + integrity sha512-gNva8/6UAe8QYepIQH/jQ2qn91Qj0B9sYjMBBs3QOB8F2CXcKgLxQaJRP76sWVRQt+QU+8fAkCbCvjjMFu7Ycw== + +regenerator-runtime@^0.13.9: + version "0.13.11" + resolved "https://registry.yarnpkg.com/regenerator-runtime/-/regenerator-runtime-0.13.11.tgz#f6dca3e7ceec20590d07ada785636a90cdca17f9" + integrity sha512-kY1AZVr2Ra+t+piVaJ4gxaFaReZVH40AKNo7UCX6W+dEwBo/2oZJzqfuN1qLq1oL45o56cPaTXELwrTh8Fpggg== + +require-from-string@^2.0.2: + version "2.0.2" + resolved "https://registry.yarnpkg.com/require-from-string/-/require-from-string-2.0.2.tgz#89a7fdd938261267318eafe14f9c32e598c36909" + integrity sha512-Xf0nWe6RseziFMu+Ap9biiUbmplq6S9/p+7w7YXP/JBHhrUDDUhwa+vANyubuqfZWTveU//DYVGsDG7RKL/vEw== + +resolve-alpn@^1.0.0: + version "1.2.1" + resolved "https://registry.yarnpkg.com/resolve-alpn/-/resolve-alpn-1.2.1.tgz#b7adbdac3546aaaec20b45e7d8265927072726f9" + integrity sha512-0a1F4l73/ZFZOakJnQ3FvkJ2+gSTQWz/r2KE5OdDY0TxPm5h4GkqkWWfM47T7HsbnOtcJVEF4epCVy6u7Q3K+g== + +responselike@^2.0.0: + version "2.0.1" + resolved "https://registry.yarnpkg.com/responselike/-/responselike-2.0.1.tgz#9a0bc8fdc252f3fb1cca68b016591059ba1422bc" + integrity sha512-4gl03wn3hj1HP3yzgdI7d3lCkF95F21Pz4BPGvKHinyQzALR5CapwC8yIi0Rh58DEMQ/SguC03wFj2k0M/mHhw== + dependencies: + lowercase-keys "^2.0.0" + +retry@0.12.0: + version "0.12.0" + resolved "https://registry.yarnpkg.com/retry/-/retry-0.12.0.tgz#1b42a6266a21f07421d1b0b54b7dc167b01c013b" + integrity sha512-9LkiTwjUh6rT555DtE9rTX+BKByPfrMzEAtnlEtdEwr3Nkffwiihqe2bWADg+OQRjt9gl6ICdmB/ZFDCGAtSow== + +safe-buffer@^5.0.1: + version "5.2.1" + resolved "https://registry.yarnpkg.com/safe-buffer/-/safe-buffer-5.2.1.tgz#1eaf9fa9bdb1fdd4ec75f58f9cdb4e6b7827eec6" + integrity sha512-rp3So07KcdmmKbGvgaNxQSJr7bGVSVk5S9Eq1F+ppbRo70+YeaDxkw5Dd8NPN+GD6bjnYm2VuPuCXmpuYvmCXQ== + +semver@^7.3.8: + version "7.3.8" + resolved "https://registry.yarnpkg.com/semver/-/semver-7.3.8.tgz#07a78feafb3f7b32347d725e33de7e2a2df67798" + integrity sha512-NB1ctGL5rlHrPJtFDVIVzTyQylMLu9N9VICA6HSFJo8MCGVTMW6gfpicwKmmK/dAjTOrqu5l63JJOpDSrAis3A== + dependencies: + lru-cache "^6.0.0" + +split-on-first@^1.0.0: + version "1.1.0" + resolved "https://registry.yarnpkg.com/split-on-first/-/split-on-first-1.1.0.tgz#f610afeee3b12bce1d0c30425e76398b78249a5f" + integrity sha512-43ZssAJaMusuKWL8sKUBQXHWOpq8d6CfN/u1p4gUzfJkM05C8rxTmYrkIPTXapZpORA6LkkzcUulJ8FqA7Uudw== + +strict-uri-encode@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/strict-uri-encode/-/strict-uri-encode-2.0.0.tgz#b9c7330c7042862f6b142dc274bbcc5866ce3546" + integrity sha512-QwiXZgpRcKkhTj2Scnn++4PKtWsH0kpzZ62L2R6c/LUVYv7hVnZqcg2+sMuT6R7Jusu1vviK/MFsu6kNJfWlEQ== + +strnum@^1.0.5: + version "1.0.5" + resolved "https://registry.yarnpkg.com/strnum/-/strnum-1.0.5.tgz#5c4e829fe15ad4ff0d20c3db5ac97b73c9b072db" + integrity sha512-J8bbNyKKXl5qYcR36TIO8W3mVGVHrmmxsd5PAItGkmyzwJvybiw2IVq5nqd0i4LSNSkB/sx9VHllbfFdr9k1JA== + +supports-color@^5.0.0, supports-color@^5.3.0: + version "5.5.0" + resolved "https://registry.yarnpkg.com/supports-color/-/supports-color-5.5.0.tgz#e2e69a44ac8772f78a1ec0b35b689df6530efc8f" + integrity sha512-QjVjwdXIt408MIiAqCX4oUKsgU2EqAGzs2Ppkm4aQYbjm+ZEWEcW4SfFNTr4uMNZma0ey4f5lgLrkB0aX0QMow== + dependencies: + has-flag "^3.0.0" + +supports-hyperlinks@^1.0.1: + version "1.0.1" + resolved "https://registry.yarnpkg.com/supports-hyperlinks/-/supports-hyperlinks-1.0.1.tgz#71daedf36cc1060ac5100c351bb3da48c29c0ef7" + integrity sha512-HHi5kVSefKaJkGYXbDuKbUGRVxqnWGn3J2e39CYcNJEfWciGq2zYtOhXLTlvrOZW1QU7VX67w7fMmWafHX9Pfw== + dependencies: + has-flag "^2.0.0" + supports-color "^5.0.0" + +to-regex-range@^5.0.1: + version "5.0.1" + resolved "https://registry.yarnpkg.com/to-regex-range/-/to-regex-range-5.0.1.tgz#1648c44aae7c8d988a326018ed72f5b4dd0392e4" + integrity sha512-65P7iz6X5yEr1cwcgvQxbbIw7Uk3gOy5dIdtZ4rDveLqhrdJP+Li/Hx6tyK0NEb+2GCyneCMJiGqrADCSNk8sQ== + dependencies: + is-number "^7.0.0" + +tr46@~0.0.3: + version "0.0.3" + resolved "https://registry.yarnpkg.com/tr46/-/tr46-0.0.3.tgz#8184fd347dac9cdc185992f3a6622e14b9d9ab6a" + integrity sha512-N3WMsuqV66lT30CrXNbEjx4GEwlow3v6rr4mCcv6prnfwhS01rkgyFdjPNBYd9br7LpXV1+Emh01fHnq2Gdgrw== + +typescript@^5.0.4: + version "5.0.4" + resolved "https://registry.yarnpkg.com/typescript/-/typescript-5.0.4.tgz#b217fd20119bd61a94d4011274e0ab369058da3b" + integrity sha512-cW9T5W9xY37cc+jfEnaUvX91foxtHkza3Nw3wkoF4sSlKn0MONdkdEndig/qPBWXNkmplh3NzayQzCiHM4/hqw== + +universal-user-agent@^6.0.0: + version "6.0.0" + resolved "https://registry.yarnpkg.com/universal-user-agent/-/universal-user-agent-6.0.0.tgz#3381f8503b251c0d9cd21bc1de939ec9df5480ee" + integrity sha512-isyNax3wXoKaulPDZWHQqbmIx1k2tb9fb3GGDBRxCscfYV2Ch7WxPArBsFEG8s/safwXTT7H4QGhaIkTp9447w== + +webidl-conversions@^3.0.0: + version "3.0.1" + resolved "https://registry.yarnpkg.com/webidl-conversions/-/webidl-conversions-3.0.1.tgz#24534275e2a7bc6be7bc86611cc16ae0a5654871" + integrity sha512-2JAn3z8AR6rjK8Sm8orRC0h/bcl/DqL7tRPdGZ4I1CjdF+EaMLmYxBHyXuKL849eucPFhvBoxMsflfOb8kxaeQ== + +whatwg-url@^5.0.0: + version "5.0.0" + resolved "https://registry.yarnpkg.com/whatwg-url/-/whatwg-url-5.0.0.tgz#966454e8765462e37644d3626f6742ce8b70965d" + integrity sha512-saE57nupxk6v3HY35+jzBwYa0rKSy0XR8JSxZPwgLr7ys0IBzhGviA1/TUGJLmSVqs8pb9AnvICXEuOHLprYTw== + dependencies: + tr46 "~0.0.3" + webidl-conversions "^3.0.0" + +wrappy@1: + version "1.0.2" + resolved "https://registry.yarnpkg.com/wrappy/-/wrappy-1.0.2.tgz#b5243d8f3ec1aa35f1364605bc0d1036e30ab69f" + integrity sha512-l4Sp/DRseor9wL6EvV2+TuQn63dMkPjZ/sp9XkghTEbV9KlPS1xUsZ3u7/IQO4wxtcFB4bgpQPRcR3QCvezPcQ== + +xcase@^2.0.1: + version "2.0.1" + resolved "https://registry.yarnpkg.com/xcase/-/xcase-2.0.1.tgz#c7fa72caa0f440db78fd5673432038ac984450b9" + integrity sha512-UmFXIPU+9Eg3E9m/728Bii0lAIuoc+6nbrNUKaRPJOFp91ih44qqGlWtxMB6kXFrRD6po+86ksHM5XHCfk6iPw== + +xtend@~4.0.1: + version "4.0.2" + resolved "https://registry.yarnpkg.com/xtend/-/xtend-4.0.2.tgz#bb72779f5fa465186b1f438f674fa347fdb5db54" + integrity sha512-LKYU1iAXJXUgAXn9URjiu+MWhyUXHsvfp7mcuYm9dSUKK0/CjtrUwFAxD82/mCWbtLsGjFIad0wIsod4zrTAEQ== + +yallist@^4.0.0: + version "4.0.0" + resolved "https://registry.yarnpkg.com/yallist/-/yallist-4.0.0.tgz#9bb92790d9c0effec63be73519e11a35019a3a72" + integrity sha512-3wdGidZyq5PB084XLES5TpOSRA3wjXAlIWMhum2kRcv/41Sn2emQ0dycQW4uZXLejwKvg6EsvbdlVL+FYEct7A== diff --git a/packages/instabug_flutter_modular/.metadata b/packages/instabug_flutter_modular/.metadata new file mode 100644 index 000000000..e5c802c48 --- /dev/null +++ b/packages/instabug_flutter_modular/.metadata @@ -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: "367f9ea16bfae1ca451b9cc27c1366870b187ae2" + channel: "stable" + +project_type: package diff --git a/packages/instabug_flutter_modular/CHANGELOG.md b/packages/instabug_flutter_modular/CHANGELOG.md new file mode 100644 index 000000000..b968a85f9 --- /dev/null +++ b/packages/instabug_flutter_modular/CHANGELOG.md @@ -0,0 +1,7 @@ +# Changelog + +## [v1.0.0](https://github.com/Instabug/instabug_flutter_modular/commits/v1.0.0/) (July 7, 2024) + +### Added + +- Add support for capturing screen loading time in Flutter Modular v5 ([#477](https://github.com/Instabug/Instabug-Flutter/pull/477)). diff --git a/packages/instabug_flutter_modular/LICENSE b/packages/instabug_flutter_modular/LICENSE new file mode 100644 index 000000000..80d729766 --- /dev/null +++ b/packages/instabug_flutter_modular/LICENSE @@ -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. \ No newline at end of file diff --git a/packages/instabug_flutter_modular/README.md b/packages/instabug_flutter_modular/README.md new file mode 100644 index 000000000..6e907fc90 --- /dev/null +++ b/packages/instabug_flutter_modular/README.md @@ -0,0 +1,55 @@ +# Instabug Flutter Modular + +[![Pub](https://img.shields.io/pub/v/instabug_flutter_modular.svg)](https://pub.dev/packages/instabug_flutter_modular) +[![Twitter](https://img.shields.io/badge/twitter-@Instabug-blue.svg)](https://twitter.com/Instabug) + +An add-on for the [Instabug Flutter SDK](https://github.com/Instabug/Instabug-Flutter) that provides screen loading support for [Flutter Modular](https://pub.dev/packages/flutter_modular) v5. + +## Installation + +1. Add `instabug_flutter_modular` to your `pubspec.yaml` file. + +```yaml +dependencies: + instabug_flutter_modular: +``` + +2. Install the package by running the following command. + +```sh +flutter pub get +``` + +## Usage + +1. Wrap your `AppParentModule` inside `InstabugModule`: + + +```dart + +void main() { + //... + + runApp( + ModularApp( + module: InstabugModule(AppModule()), + child: const MyApp(), + ), + ); +} +``` + +2. Add `InstabugNavigatorObserver` to your navigation observers list: + +```dart +@override +Widget build(BuildContext context) { + return MaterialApp.router( + routeInformationParser: Modular.routeInformationParser, + routerDelegate: Modular.routerDelegate + ..setObservers([InstabugNavigatorObserver()]), + + // ... + ); +} +``` \ No newline at end of file diff --git a/packages/instabug_flutter_modular/example/.gitignore b/packages/instabug_flutter_modular/example/.gitignore new file mode 100644 index 000000000..c2b055ffd --- /dev/null +++ b/packages/instabug_flutter_modular/example/.gitignore @@ -0,0 +1,44 @@ +# Miscellaneous +*.class +*.log +*.pyc +*.swp +.DS_Store +.atom/ +.buildlog/ +.history +.svn/ +migrate_working_dir/ + +# IntelliJ related +*.iml +*.ipr +*.iws +.idea/ + +# The .vscode folder contains launch configuration and tasks you configure in +# VS Code which you may wish to be included in version control, so this line +# is commented out by default. +#.vscode/ + +# Flutter/Dart/Pub related +**/doc/api/ +**/ios/Flutter/.last_build_id +.dart_tool/ +.flutter-plugins +.flutter-plugins-dependencies +.metadata +.pub-cache/ +.pub/ +/build/ + +# Symbolication related +app.*.symbols + +# Obfuscation related +app.*.map.json + +# Android Studio will place build artifacts here +/android/app/debug +/android/app/profile +/android/app/release diff --git a/packages/instabug_flutter_modular/example/android/.gitignore b/packages/instabug_flutter_modular/example/android/.gitignore new file mode 100644 index 000000000..6f568019d --- /dev/null +++ b/packages/instabug_flutter_modular/example/android/.gitignore @@ -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 diff --git a/packages/instabug_flutter_modular/example/android/app/build.gradle b/packages/instabug_flutter_modular/example/android/app/build.gradle new file mode 100644 index 000000000..b64cbfae0 --- /dev/null +++ b/packages/instabug_flutter_modular/example/android/app/build.gradle @@ -0,0 +1,67 @@ +plugins { + id "com.android.application" + id "kotlin-android" + id "dev.flutter.flutter-gradle-plugin" +} + +def localProperties = new Properties() +def localPropertiesFile = rootProject.file('local.properties') +if (localPropertiesFile.exists()) { + localPropertiesFile.withReader('UTF-8') { reader -> + localProperties.load(reader) + } +} + +def flutterVersionCode = localProperties.getProperty('flutter.versionCode') +if (flutterVersionCode == null) { + flutterVersionCode = '1' +} + +def flutterVersionName = localProperties.getProperty('flutter.versionName') +if (flutterVersionName == null) { + flutterVersionName = '1.0' +} + +android { + namespace "com.example.flutter_modular_demo_app" + compileSdk flutter.compileSdkVersion + ndkVersion flutter.ndkVersion + + 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.flutter_modular_demo_app" + // You can update the following values to match your application needs. + // For more information, see: https://docs.flutter.dev/deployment/android#reviewing-the-gradle-build-configuration. + 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 {} diff --git a/packages/instabug_flutter_modular/example/android/app/src/debug/AndroidManifest.xml b/packages/instabug_flutter_modular/example/android/app/src/debug/AndroidManifest.xml new file mode 100644 index 000000000..399f6981d --- /dev/null +++ b/packages/instabug_flutter_modular/example/android/app/src/debug/AndroidManifest.xml @@ -0,0 +1,7 @@ + + + + diff --git a/packages/instabug_flutter_modular/example/android/app/src/main/AndroidManifest.xml b/packages/instabug_flutter_modular/example/android/app/src/main/AndroidManifest.xml new file mode 100644 index 000000000..82cb28a05 --- /dev/null +++ b/packages/instabug_flutter_modular/example/android/app/src/main/AndroidManifest.xml @@ -0,0 +1,46 @@ + + + + + + + + + + + + + + + + + + + + + diff --git a/packages/instabug_flutter_modular/example/android/app/src/main/java/io/flutter/app/FlutterMultiDexApplication.java b/packages/instabug_flutter_modular/example/android/app/src/main/java/io/flutter/app/FlutterMultiDexApplication.java new file mode 100644 index 000000000..752fc185d --- /dev/null +++ b/packages/instabug_flutter_modular/example/android/app/src/main/java/io/flutter/app/FlutterMultiDexApplication.java @@ -0,0 +1,25 @@ +// Generated file. +// +// If you wish to remove Flutter's multidex support, delete this entire file. +// +// Modifications to this file should be done in a copy under a different name +// as this file may be regenerated. + +package io.flutter.app; + +import android.app.Application; +import android.content.Context; +import androidx.annotation.CallSuper; +import androidx.multidex.MultiDex; + +/** + * Extension of {@link android.app.Application}, adding multidex support. + */ +public class FlutterMultiDexApplication extends Application { + @Override + @CallSuper + protected void attachBaseContext(Context base) { + super.attachBaseContext(base); + MultiDex.install(this); + } +} diff --git a/packages/instabug_flutter_modular/example/android/app/src/main/kotlin/com/example/flutter_modular_demo_app/MainActivity.kt b/packages/instabug_flutter_modular/example/android/app/src/main/kotlin/com/example/flutter_modular_demo_app/MainActivity.kt new file mode 100644 index 000000000..79f585c2c --- /dev/null +++ b/packages/instabug_flutter_modular/example/android/app/src/main/kotlin/com/example/flutter_modular_demo_app/MainActivity.kt @@ -0,0 +1,5 @@ +package com.example.flutter_modular_demo_app + +import io.flutter.embedding.android.FlutterActivity + +class MainActivity: FlutterActivity() diff --git a/packages/instabug_flutter_modular/example/android/app/src/main/res/drawable-v21/launch_background.xml b/packages/instabug_flutter_modular/example/android/app/src/main/res/drawable-v21/launch_background.xml new file mode 100644 index 000000000..f74085f3f --- /dev/null +++ b/packages/instabug_flutter_modular/example/android/app/src/main/res/drawable-v21/launch_background.xml @@ -0,0 +1,12 @@ + + + + + + + + diff --git a/packages/instabug_flutter_modular/example/android/app/src/main/res/drawable/launch_background.xml b/packages/instabug_flutter_modular/example/android/app/src/main/res/drawable/launch_background.xml new file mode 100644 index 000000000..304732f88 --- /dev/null +++ b/packages/instabug_flutter_modular/example/android/app/src/main/res/drawable/launch_background.xml @@ -0,0 +1,12 @@ + + + + + + + + diff --git a/packages/instabug_flutter_modular/example/android/app/src/main/res/mipmap-hdpi/ic_launcher.png b/packages/instabug_flutter_modular/example/android/app/src/main/res/mipmap-hdpi/ic_launcher.png new file mode 100644 index 000000000..db77bb4b7 Binary files /dev/null and b/packages/instabug_flutter_modular/example/android/app/src/main/res/mipmap-hdpi/ic_launcher.png differ diff --git a/packages/instabug_flutter_modular/example/android/app/src/main/res/mipmap-mdpi/ic_launcher.png b/packages/instabug_flutter_modular/example/android/app/src/main/res/mipmap-mdpi/ic_launcher.png new file mode 100644 index 000000000..17987b79b Binary files /dev/null and b/packages/instabug_flutter_modular/example/android/app/src/main/res/mipmap-mdpi/ic_launcher.png differ diff --git a/packages/instabug_flutter_modular/example/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png b/packages/instabug_flutter_modular/example/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png new file mode 100644 index 000000000..09d439148 Binary files /dev/null and b/packages/instabug_flutter_modular/example/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png differ diff --git a/packages/instabug_flutter_modular/example/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png b/packages/instabug_flutter_modular/example/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png new file mode 100644 index 000000000..d5f1c8d34 Binary files /dev/null and b/packages/instabug_flutter_modular/example/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png differ diff --git a/packages/instabug_flutter_modular/example/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png b/packages/instabug_flutter_modular/example/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png new file mode 100644 index 000000000..4d6372eeb Binary files /dev/null and b/packages/instabug_flutter_modular/example/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png differ diff --git a/packages/instabug_flutter_modular/example/android/app/src/main/res/values-night/styles.xml b/packages/instabug_flutter_modular/example/android/app/src/main/res/values-night/styles.xml new file mode 100644 index 000000000..06952be74 --- /dev/null +++ b/packages/instabug_flutter_modular/example/android/app/src/main/res/values-night/styles.xml @@ -0,0 +1,18 @@ + + + + + + + diff --git a/packages/instabug_flutter_modular/example/android/app/src/main/res/values/styles.xml b/packages/instabug_flutter_modular/example/android/app/src/main/res/values/styles.xml new file mode 100644 index 000000000..cb1ef8805 --- /dev/null +++ b/packages/instabug_flutter_modular/example/android/app/src/main/res/values/styles.xml @@ -0,0 +1,18 @@ + + + + + + + diff --git a/packages/instabug_flutter_modular/example/android/app/src/main/res/xml/network_security_config.xml b/packages/instabug_flutter_modular/example/android/app/src/main/res/xml/network_security_config.xml new file mode 100644 index 000000000..9db612408 --- /dev/null +++ b/packages/instabug_flutter_modular/example/android/app/src/main/res/xml/network_security_config.xml @@ -0,0 +1,12 @@ + + + + localhost + + + + + + + + diff --git a/packages/instabug_flutter_modular/example/android/app/src/profile/AndroidManifest.xml b/packages/instabug_flutter_modular/example/android/app/src/profile/AndroidManifest.xml new file mode 100644 index 000000000..399f6981d --- /dev/null +++ b/packages/instabug_flutter_modular/example/android/app/src/profile/AndroidManifest.xml @@ -0,0 +1,7 @@ + + + + diff --git a/packages/instabug_flutter_modular/example/android/build.gradle b/packages/instabug_flutter_modular/example/android/build.gradle new file mode 100644 index 000000000..bc157bd1a --- /dev/null +++ b/packages/instabug_flutter_modular/example/android/build.gradle @@ -0,0 +1,18 @@ +allprojects { + repositories { + google() + mavenCentral() + } +} + +rootProject.buildDir = '../build' +subprojects { + project.buildDir = "${rootProject.buildDir}/${project.name}" +} +subprojects { + project.evaluationDependsOn(':app') +} + +tasks.register("clean", Delete) { + delete rootProject.buildDir +} diff --git a/packages/instabug_flutter_modular/example/android/gradle.properties b/packages/instabug_flutter_modular/example/android/gradle.properties new file mode 100644 index 000000000..598d13fee --- /dev/null +++ b/packages/instabug_flutter_modular/example/android/gradle.properties @@ -0,0 +1,3 @@ +org.gradle.jvmargs=-Xmx4G +android.useAndroidX=true +android.enableJetifier=true diff --git a/packages/instabug_flutter_modular/example/android/gradle/wrapper/gradle-wrapper.properties b/packages/instabug_flutter_modular/example/android/gradle/wrapper/gradle-wrapper.properties new file mode 100644 index 000000000..e1ca574ef --- /dev/null +++ b/packages/instabug_flutter_modular/example/android/gradle/wrapper/gradle-wrapper.properties @@ -0,0 +1,5 @@ +distributionBase=GRADLE_USER_HOME +distributionPath=wrapper/dists +zipStoreBase=GRADLE_USER_HOME +zipStorePath=wrapper/dists +distributionUrl=https\://services.gradle.org/distributions/gradle-7.6.3-all.zip diff --git a/packages/instabug_flutter_modular/example/android/settings.gradle b/packages/instabug_flutter_modular/example/android/settings.gradle new file mode 100644 index 000000000..1d6d19b7f --- /dev/null +++ b/packages/instabug_flutter_modular/example/android/settings.gradle @@ -0,0 +1,26 @@ +pluginManagement { + def flutterSdkPath = { + def properties = new Properties() + file("local.properties").withInputStream { properties.load(it) } + def flutterSdkPath = properties.getProperty("flutter.sdk") + assert flutterSdkPath != null, "flutter.sdk not set in local.properties" + return flutterSdkPath + } + settings.ext.flutterSdkPath = flutterSdkPath() + + includeBuild("${settings.ext.flutterSdkPath}/packages/flutter_tools/gradle") + + repositories { + google() + mavenCentral() + gradlePluginPortal() + } +} + +plugins { + id "dev.flutter.flutter-plugin-loader" version "1.0.0" + id "com.android.application" version "7.3.0" apply false + id "org.jetbrains.kotlin.android" version "1.7.10" apply false +} + +include ":app" diff --git a/packages/instabug_flutter_modular/example/ios/.gitignore b/packages/instabug_flutter_modular/example/ios/.gitignore new file mode 100644 index 000000000..7a7f9873a --- /dev/null +++ b/packages/instabug_flutter_modular/example/ios/.gitignore @@ -0,0 +1,34 @@ +**/dgph +*.mode1v3 +*.mode2v3 +*.moved-aside +*.pbxuser +*.perspectivev3 +**/*sync/ +.sconsign.dblite +.tags* +**/.vagrant/ +**/DerivedData/ +Icon? +**/Pods/ +**/.symlinks/ +profile +xcuserdata +**/.generated/ +Flutter/App.framework +Flutter/Flutter.framework +Flutter/Flutter.podspec +Flutter/Generated.xcconfig +Flutter/ephemeral/ +Flutter/app.flx +Flutter/app.zip +Flutter/flutter_assets/ +Flutter/flutter_export_environment.sh +ServiceDefinitions.json +Runner/GeneratedPluginRegistrant.* + +# Exceptions to above rules. +!default.mode1v3 +!default.mode2v3 +!default.pbxuser +!default.perspectivev3 diff --git a/packages/instabug_flutter_modular/example/ios/Flutter/AppFrameworkInfo.plist b/packages/instabug_flutter_modular/example/ios/Flutter/AppFrameworkInfo.plist new file mode 100644 index 000000000..7c5696400 --- /dev/null +++ b/packages/instabug_flutter_modular/example/ios/Flutter/AppFrameworkInfo.plist @@ -0,0 +1,26 @@ + + + + + CFBundleDevelopmentRegion + en + CFBundleExecutable + App + CFBundleIdentifier + io.flutter.flutter.app + CFBundleInfoDictionaryVersion + 6.0 + CFBundleName + App + CFBundlePackageType + FMWK + CFBundleShortVersionString + 1.0 + CFBundleSignature + ???? + CFBundleVersion + 1.0 + MinimumOSVersion + 12.0 + + diff --git a/packages/instabug_flutter_modular/example/ios/Flutter/Debug.xcconfig b/packages/instabug_flutter_modular/example/ios/Flutter/Debug.xcconfig new file mode 100644 index 000000000..ec97fc6f3 --- /dev/null +++ b/packages/instabug_flutter_modular/example/ios/Flutter/Debug.xcconfig @@ -0,0 +1,2 @@ +#include? "Pods/Target Support Files/Pods-Runner/Pods-Runner.debug.xcconfig" +#include "Generated.xcconfig" diff --git a/packages/instabug_flutter_modular/example/ios/Flutter/Release.xcconfig b/packages/instabug_flutter_modular/example/ios/Flutter/Release.xcconfig new file mode 100644 index 000000000..c4855bfe2 --- /dev/null +++ b/packages/instabug_flutter_modular/example/ios/Flutter/Release.xcconfig @@ -0,0 +1,2 @@ +#include? "Pods/Target Support Files/Pods-Runner/Pods-Runner.release.xcconfig" +#include "Generated.xcconfig" diff --git a/packages/instabug_flutter_modular/example/ios/Podfile b/packages/instabug_flutter_modular/example/ios/Podfile new file mode 100644 index 000000000..d97f17e22 --- /dev/null +++ b/packages/instabug_flutter_modular/example/ios/Podfile @@ -0,0 +1,44 @@ +# Uncomment this line to define a global platform for your project +# platform :ios, '12.0' + +# CocoaPods analytics sends network stats synchronously affecting flutter build latency. +ENV['COCOAPODS_DISABLE_STATS'] = 'true' + +project 'Runner', { + 'Debug' => :debug, + 'Profile' => :release, + 'Release' => :release, +} + +def flutter_root + generated_xcode_build_settings_path = File.expand_path(File.join('..', 'Flutter', 'Generated.xcconfig'), __FILE__) + unless File.exist?(generated_xcode_build_settings_path) + raise "#{generated_xcode_build_settings_path} must exist. If you're running pod install manually, make sure flutter pub get is executed first" + end + + File.foreach(generated_xcode_build_settings_path) do |line| + matches = line.match(/FLUTTER_ROOT\=(.*)/) + return matches[1].strip if matches + end + raise "FLUTTER_ROOT not found in #{generated_xcode_build_settings_path}. Try deleting Generated.xcconfig, then run flutter pub get" +end + +require File.expand_path(File.join('packages', 'flutter_tools', 'bin', 'podhelper'), flutter_root) + +flutter_ios_podfile_setup + +target 'Runner' do + use_frameworks! + use_modular_headers! + + flutter_install_all_ios_pods File.dirname(File.realpath(__FILE__)) + target 'RunnerTests' do + inherit! :search_paths + end +end + +post_install do |installer| + installer.pods_project.targets.each do |target| + flutter_additional_ios_build_settings(target) + end +end diff --git a/example/ios/Podfile.lock b/packages/instabug_flutter_modular/example/ios/Podfile.lock similarity index 53% rename from example/ios/Podfile.lock rename to packages/instabug_flutter_modular/example/ios/Podfile.lock index b0ee46890..391410c41 100644 --- a/example/ios/Podfile.lock +++ b/packages/instabug_flutter_modular/example/ios/Podfile.lock @@ -1,20 +1,17 @@ PODS: - Flutter (1.0.0) - - Instabug (13.4.2) - - instabug_flutter (13.4.0): + - Instabug (14.0.0) + - instabug_flutter (14.0.0): - Flutter - - Instabug (= 13.4.2) - - OCMock (3.6) + - Instabug (= 14.0.0) DEPENDENCIES: - Flutter (from `Flutter`) - instabug_flutter (from `.symlinks/plugins/instabug_flutter/ios`) - - OCMock (= 3.6) SPEC REPOS: trunk: - Instabug - - OCMock EXTERNAL SOURCES: Flutter: @@ -24,10 +21,9 @@ EXTERNAL SOURCES: SPEC CHECKSUMS: Flutter: e0871f40cf51350855a761d2e70bf5af5b9b5de7 - Instabug: 7a71890217b97b1e32dbca96661845396b66da2f - instabug_flutter: a2df87e3d4d9e410785e0b1ffef4bc64d1f4b787 - OCMock: 5ea90566be239f179ba766fd9fbae5885040b992 + Instabug: a0beffc01658773e2fac549845782f8937707dc4 + instabug_flutter: ff8ab5ff34a476b1d2d887478ec190cda962b973 -PODFILE CHECKSUM: 8f7552fd115ace1988c3db54a69e4a123c448f84 +PODFILE CHECKSUM: 819463e6a0290f5a72f145ba7cde16e8b6ef0796 COCOAPODS: 1.14.3 diff --git a/packages/instabug_flutter_modular/example/ios/Runner.xcodeproj/project.pbxproj b/packages/instabug_flutter_modular/example/ios/Runner.xcodeproj/project.pbxproj new file mode 100644 index 000000000..99206dfba --- /dev/null +++ b/packages/instabug_flutter_modular/example/ios/Runner.xcodeproj/project.pbxproj @@ -0,0 +1,728 @@ +// !$*UTF8*$! +{ + archiveVersion = 1; + classes = { + }; + objectVersion = 54; + objects = { + +/* Begin PBXBuildFile section */ + 1498D2341E8E89220040F4C2 /* GeneratedPluginRegistrant.m in Sources */ = {isa = PBXBuildFile; fileRef = 1498D2331E8E89220040F4C2 /* GeneratedPluginRegistrant.m */; }; + 327E711B528735FED991BFC4 /* Pods_Runner.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 2943C6CA26DB2D8358EBC2D7 /* Pods_Runner.framework */; }; + 331C808B294A63AB00263BE5 /* RunnerTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 331C807B294A618700263BE5 /* RunnerTests.swift */; }; + 3B3967161E833CAA004F5970 /* AppFrameworkInfo.plist in Resources */ = {isa = PBXBuildFile; fileRef = 3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */; }; + 6D2169967115A81725A63418 /* Pods_RunnerTests.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 9C96F9B3DD34FEEAF2EB522D /* Pods_RunnerTests.framework */; }; + 74858FAF1ED2DC5600515810 /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 74858FAE1ED2DC5600515810 /* AppDelegate.swift */; }; + 97C146FC1CF9000F007C117D /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FA1CF9000F007C117D /* Main.storyboard */; }; + 97C146FE1CF9000F007C117D /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FD1CF9000F007C117D /* Assets.xcassets */; }; + 97C147011CF9000F007C117D /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FF1CF9000F007C117D /* LaunchScreen.storyboard */; }; +/* End PBXBuildFile section */ + +/* Begin PBXContainerItemProxy section */ + 331C8085294A63A400263BE5 /* PBXContainerItemProxy */ = { + isa = PBXContainerItemProxy; + containerPortal = 97C146E61CF9000F007C117D /* Project object */; + proxyType = 1; + remoteGlobalIDString = 97C146ED1CF9000F007C117D; + remoteInfo = Runner; + }; +/* End PBXContainerItemProxy section */ + +/* Begin PBXCopyFilesBuildPhase section */ + 9705A1C41CF9048500538489 /* Embed Frameworks */ = { + isa = PBXCopyFilesBuildPhase; + buildActionMask = 2147483647; + dstPath = ""; + dstSubfolderSpec = 10; + files = ( + ); + name = "Embed Frameworks"; + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXCopyFilesBuildPhase section */ + +/* Begin PBXFileReference section */ + 1498D2321E8E86230040F4C2 /* GeneratedPluginRegistrant.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = GeneratedPluginRegistrant.h; sourceTree = ""; }; + 1498D2331E8E89220040F4C2 /* GeneratedPluginRegistrant.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = GeneratedPluginRegistrant.m; sourceTree = ""; }; + 22D0234AF76181345ADA0C95 /* Pods-Runner.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Runner.debug.xcconfig"; path = "Target Support Files/Pods-Runner/Pods-Runner.debug.xcconfig"; sourceTree = ""; }; + 2943C6CA26DB2D8358EBC2D7 /* Pods_Runner.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_Runner.framework; sourceTree = BUILT_PRODUCTS_DIR; }; + 331C807B294A618700263BE5 /* RunnerTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = RunnerTests.swift; sourceTree = ""; }; + 331C8081294A63A400263BE5 /* RunnerTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = RunnerTests.xctest; sourceTree = BUILT_PRODUCTS_DIR; }; + 3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; name = AppFrameworkInfo.plist; path = Flutter/AppFrameworkInfo.plist; sourceTree = ""; }; + 42617FCCD3CC7E9232CA19EF /* Pods-RunnerTests.profile.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-RunnerTests.profile.xcconfig"; path = "Target Support Files/Pods-RunnerTests/Pods-RunnerTests.profile.xcconfig"; sourceTree = ""; }; + 4B1FAE53C830CB656B3306A8 /* Pods-RunnerTests.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-RunnerTests.debug.xcconfig"; path = "Target Support Files/Pods-RunnerTests/Pods-RunnerTests.debug.xcconfig"; sourceTree = ""; }; + 7046D924EA334C9701656E63 /* Pods-Runner.profile.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Runner.profile.xcconfig"; path = "Target Support Files/Pods-Runner/Pods-Runner.profile.xcconfig"; sourceTree = ""; }; + 74858FAD1ED2DC5600515810 /* Runner-Bridging-Header.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "Runner-Bridging-Header.h"; sourceTree = ""; }; + 74858FAE1ED2DC5600515810 /* AppDelegate.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = ""; }; + 7AFA3C8E1D35360C0083082E /* Release.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; name = Release.xcconfig; path = Flutter/Release.xcconfig; sourceTree = ""; }; + 849846FA37D5C84AC76BC5B8 /* Pods-RunnerTests.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-RunnerTests.release.xcconfig"; path = "Target Support Files/Pods-RunnerTests/Pods-RunnerTests.release.xcconfig"; sourceTree = ""; }; + 9740EEB21CF90195004384FC /* Debug.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; name = Debug.xcconfig; path = Flutter/Debug.xcconfig; sourceTree = ""; }; + 9740EEB31CF90195004384FC /* Generated.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; name = Generated.xcconfig; path = Flutter/Generated.xcconfig; sourceTree = ""; }; + 97C146EE1CF9000F007C117D /* Runner.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = Runner.app; sourceTree = BUILT_PRODUCTS_DIR; }; + 97C146FB1CF9000F007C117D /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = ""; }; + 97C146FD1CF9000F007C117D /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = ""; }; + 97C147001CF9000F007C117D /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = ""; }; + 97C147021CF9000F007C117D /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; + 9C96F9B3DD34FEEAF2EB522D /* Pods_RunnerTests.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_RunnerTests.framework; sourceTree = BUILT_PRODUCTS_DIR; }; + 9D23D5A15863072900ABD324 /* Pods-Runner.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Runner.release.xcconfig"; path = "Target Support Files/Pods-Runner/Pods-Runner.release.xcconfig"; sourceTree = ""; }; +/* End PBXFileReference section */ + +/* Begin PBXFrameworksBuildPhase section */ + 8B88E0EF1C0B1FCD941F5841 /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( + 6D2169967115A81725A63418 /* Pods_RunnerTests.framework in Frameworks */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; + 97C146EB1CF9000F007C117D /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( + 327E711B528735FED991BFC4 /* Pods_Runner.framework in Frameworks */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXFrameworksBuildPhase section */ + +/* Begin PBXGroup section */ + 25EC9C0EE1DF0FD1150948F4 /* Pods */ = { + isa = PBXGroup; + children = ( + 22D0234AF76181345ADA0C95 /* Pods-Runner.debug.xcconfig */, + 9D23D5A15863072900ABD324 /* Pods-Runner.release.xcconfig */, + 7046D924EA334C9701656E63 /* Pods-Runner.profile.xcconfig */, + 4B1FAE53C830CB656B3306A8 /* Pods-RunnerTests.debug.xcconfig */, + 849846FA37D5C84AC76BC5B8 /* Pods-RunnerTests.release.xcconfig */, + 42617FCCD3CC7E9232CA19EF /* Pods-RunnerTests.profile.xcconfig */, + ); + name = Pods; + path = Pods; + sourceTree = ""; + }; + 331C8082294A63A400263BE5 /* RunnerTests */ = { + isa = PBXGroup; + children = ( + 331C807B294A618700263BE5 /* RunnerTests.swift */, + ); + path = RunnerTests; + sourceTree = ""; + }; + 94671C5E18FAC8DD353CE05B /* Frameworks */ = { + isa = PBXGroup; + children = ( + 2943C6CA26DB2D8358EBC2D7 /* Pods_Runner.framework */, + 9C96F9B3DD34FEEAF2EB522D /* Pods_RunnerTests.framework */, + ); + name = Frameworks; + sourceTree = ""; + }; + 9740EEB11CF90186004384FC /* Flutter */ = { + isa = PBXGroup; + children = ( + 3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */, + 9740EEB21CF90195004384FC /* Debug.xcconfig */, + 7AFA3C8E1D35360C0083082E /* Release.xcconfig */, + 9740EEB31CF90195004384FC /* Generated.xcconfig */, + ); + name = Flutter; + sourceTree = ""; + }; + 97C146E51CF9000F007C117D = { + isa = PBXGroup; + children = ( + 9740EEB11CF90186004384FC /* Flutter */, + 97C146F01CF9000F007C117D /* Runner */, + 97C146EF1CF9000F007C117D /* Products */, + 331C8082294A63A400263BE5 /* RunnerTests */, + 25EC9C0EE1DF0FD1150948F4 /* Pods */, + 94671C5E18FAC8DD353CE05B /* Frameworks */, + ); + sourceTree = ""; + }; + 97C146EF1CF9000F007C117D /* Products */ = { + isa = PBXGroup; + children = ( + 97C146EE1CF9000F007C117D /* Runner.app */, + 331C8081294A63A400263BE5 /* RunnerTests.xctest */, + ); + name = Products; + sourceTree = ""; + }; + 97C146F01CF9000F007C117D /* Runner */ = { + isa = PBXGroup; + children = ( + 97C146FA1CF9000F007C117D /* Main.storyboard */, + 97C146FD1CF9000F007C117D /* Assets.xcassets */, + 97C146FF1CF9000F007C117D /* LaunchScreen.storyboard */, + 97C147021CF9000F007C117D /* Info.plist */, + 1498D2321E8E86230040F4C2 /* GeneratedPluginRegistrant.h */, + 1498D2331E8E89220040F4C2 /* GeneratedPluginRegistrant.m */, + 74858FAE1ED2DC5600515810 /* AppDelegate.swift */, + 74858FAD1ED2DC5600515810 /* Runner-Bridging-Header.h */, + ); + path = Runner; + sourceTree = ""; + }; +/* End PBXGroup section */ + +/* Begin PBXNativeTarget section */ + 331C8080294A63A400263BE5 /* RunnerTests */ = { + isa = PBXNativeTarget; + buildConfigurationList = 331C8087294A63A400263BE5 /* Build configuration list for PBXNativeTarget "RunnerTests" */; + buildPhases = ( + 354470C9D30A896FFCE8DEA0 /* [CP] Check Pods Manifest.lock */, + 331C807D294A63A400263BE5 /* Sources */, + 331C807F294A63A400263BE5 /* Resources */, + 8B88E0EF1C0B1FCD941F5841 /* Frameworks */, + ); + buildRules = ( + ); + dependencies = ( + 331C8086294A63A400263BE5 /* PBXTargetDependency */, + ); + name = RunnerTests; + productName = RunnerTests; + productReference = 331C8081294A63A400263BE5 /* RunnerTests.xctest */; + productType = "com.apple.product-type.bundle.unit-test"; + }; + 97C146ED1CF9000F007C117D /* Runner */ = { + isa = PBXNativeTarget; + buildConfigurationList = 97C147051CF9000F007C117D /* Build configuration list for PBXNativeTarget "Runner" */; + buildPhases = ( + 48A7DA0DEA99D4A15D3FE66A /* [CP] Check Pods Manifest.lock */, + 9740EEB61CF901F6004384FC /* Run Script */, + 97C146EA1CF9000F007C117D /* Sources */, + 97C146EB1CF9000F007C117D /* Frameworks */, + 97C146EC1CF9000F007C117D /* Resources */, + 9705A1C41CF9048500538489 /* Embed Frameworks */, + 3B06AD1E1E4923F5004D2608 /* Thin Binary */, + FB8A21F1FDFF0427C21277F5 /* [CP] Embed Pods Frameworks */, + ); + buildRules = ( + ); + dependencies = ( + ); + name = Runner; + productName = Runner; + productReference = 97C146EE1CF9000F007C117D /* Runner.app */; + productType = "com.apple.product-type.application"; + }; +/* End PBXNativeTarget section */ + +/* Begin PBXProject section */ + 97C146E61CF9000F007C117D /* Project object */ = { + isa = PBXProject; + attributes = { + BuildIndependentTargetsInParallel = YES; + LastUpgradeCheck = 1510; + ORGANIZATIONNAME = ""; + TargetAttributes = { + 331C8080294A63A400263BE5 = { + CreatedOnToolsVersion = 14.0; + TestTargetID = 97C146ED1CF9000F007C117D; + }; + 97C146ED1CF9000F007C117D = { + CreatedOnToolsVersion = 7.3.1; + LastSwiftMigration = 1100; + }; + }; + }; + buildConfigurationList = 97C146E91CF9000F007C117D /* Build configuration list for PBXProject "Runner" */; + compatibilityVersion = "Xcode 9.3"; + developmentRegion = en; + hasScannedForEncodings = 0; + knownRegions = ( + en, + Base, + ); + mainGroup = 97C146E51CF9000F007C117D; + productRefGroup = 97C146EF1CF9000F007C117D /* Products */; + projectDirPath = ""; + projectRoot = ""; + targets = ( + 97C146ED1CF9000F007C117D /* Runner */, + 331C8080294A63A400263BE5 /* RunnerTests */, + ); + }; +/* End PBXProject section */ + +/* Begin PBXResourcesBuildPhase section */ + 331C807F294A63A400263BE5 /* Resources */ = { + isa = PBXResourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + runOnlyForDeploymentPostprocessing = 0; + }; + 97C146EC1CF9000F007C117D /* Resources */ = { + isa = PBXResourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + 97C147011CF9000F007C117D /* LaunchScreen.storyboard in Resources */, + 3B3967161E833CAA004F5970 /* AppFrameworkInfo.plist in Resources */, + 97C146FE1CF9000F007C117D /* Assets.xcassets in Resources */, + 97C146FC1CF9000F007C117D /* Main.storyboard in Resources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXResourcesBuildPhase section */ + +/* Begin PBXShellScriptBuildPhase section */ + 354470C9D30A896FFCE8DEA0 /* [CP] Check Pods Manifest.lock */ = { + isa = PBXShellScriptBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + inputFileListPaths = ( + ); + inputPaths = ( + "${PODS_PODFILE_DIR_PATH}/Podfile.lock", + "${PODS_ROOT}/Manifest.lock", + ); + name = "[CP] Check Pods Manifest.lock"; + outputFileListPaths = ( + ); + outputPaths = ( + "$(DERIVED_FILE_DIR)/Pods-RunnerTests-checkManifestLockResult.txt", + ); + runOnlyForDeploymentPostprocessing = 0; + shellPath = /bin/sh; + shellScript = "diff \"${PODS_PODFILE_DIR_PATH}/Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n# This output is used by Xcode 'outputs' to avoid re-running this script phase.\necho \"SUCCESS\" > \"${SCRIPT_OUTPUT_FILE_0}\"\n"; + showEnvVarsInLog = 0; + }; + 3B06AD1E1E4923F5004D2608 /* Thin Binary */ = { + isa = PBXShellScriptBuildPhase; + alwaysOutOfDate = 1; + buildActionMask = 2147483647; + files = ( + ); + inputPaths = ( + "${TARGET_BUILD_DIR}/${INFOPLIST_PATH}", + ); + name = "Thin Binary"; + outputPaths = ( + ); + runOnlyForDeploymentPostprocessing = 0; + shellPath = /bin/sh; + shellScript = "/bin/sh \"$FLUTTER_ROOT/packages/flutter_tools/bin/xcode_backend.sh\" embed_and_thin"; + }; + 48A7DA0DEA99D4A15D3FE66A /* [CP] Check Pods Manifest.lock */ = { + isa = PBXShellScriptBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + inputFileListPaths = ( + ); + inputPaths = ( + "${PODS_PODFILE_DIR_PATH}/Podfile.lock", + "${PODS_ROOT}/Manifest.lock", + ); + name = "[CP] Check Pods Manifest.lock"; + outputFileListPaths = ( + ); + outputPaths = ( + "$(DERIVED_FILE_DIR)/Pods-Runner-checkManifestLockResult.txt", + ); + runOnlyForDeploymentPostprocessing = 0; + shellPath = /bin/sh; + shellScript = "diff \"${PODS_PODFILE_DIR_PATH}/Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n# This output is used by Xcode 'outputs' to avoid re-running this script phase.\necho \"SUCCESS\" > \"${SCRIPT_OUTPUT_FILE_0}\"\n"; + showEnvVarsInLog = 0; + }; + 9740EEB61CF901F6004384FC /* Run Script */ = { + isa = PBXShellScriptBuildPhase; + alwaysOutOfDate = 1; + buildActionMask = 2147483647; + files = ( + ); + inputPaths = ( + ); + name = "Run Script"; + outputPaths = ( + ); + runOnlyForDeploymentPostprocessing = 0; + shellPath = /bin/sh; + shellScript = "/bin/sh \"$FLUTTER_ROOT/packages/flutter_tools/bin/xcode_backend.sh\" build"; + }; + FB8A21F1FDFF0427C21277F5 /* [CP] Embed Pods Frameworks */ = { + isa = PBXShellScriptBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + inputFileListPaths = ( + "${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-frameworks-${CONFIGURATION}-input-files.xcfilelist", + ); + name = "[CP] Embed Pods Frameworks"; + outputFileListPaths = ( + "${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-frameworks-${CONFIGURATION}-output-files.xcfilelist", + ); + runOnlyForDeploymentPostprocessing = 0; + shellPath = /bin/sh; + shellScript = "\"${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-frameworks.sh\"\n"; + showEnvVarsInLog = 0; + }; +/* End PBXShellScriptBuildPhase section */ + +/* Begin PBXSourcesBuildPhase section */ + 331C807D294A63A400263BE5 /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + 331C808B294A63AB00263BE5 /* RunnerTests.swift in Sources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; + 97C146EA1CF9000F007C117D /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + 74858FAF1ED2DC5600515810 /* AppDelegate.swift in Sources */, + 1498D2341E8E89220040F4C2 /* GeneratedPluginRegistrant.m in Sources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXSourcesBuildPhase section */ + +/* Begin PBXTargetDependency section */ + 331C8086294A63A400263BE5 /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + target = 97C146ED1CF9000F007C117D /* Runner */; + targetProxy = 331C8085294A63A400263BE5 /* PBXContainerItemProxy */; + }; +/* End PBXTargetDependency section */ + +/* Begin PBXVariantGroup section */ + 97C146FA1CF9000F007C117D /* Main.storyboard */ = { + isa = PBXVariantGroup; + children = ( + 97C146FB1CF9000F007C117D /* Base */, + ); + name = Main.storyboard; + sourceTree = ""; + }; + 97C146FF1CF9000F007C117D /* LaunchScreen.storyboard */ = { + isa = PBXVariantGroup; + children = ( + 97C147001CF9000F007C117D /* Base */, + ); + name = LaunchScreen.storyboard; + sourceTree = ""; + }; +/* End PBXVariantGroup section */ + +/* Begin XCBuildConfiguration section */ + 249021D3217E4FDB00AE95B9 /* Profile */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + ASSETCATALOG_COMPILER_GENERATE_SWIFT_ASSET_SYMBOL_EXTENSIONS = YES; + CLANG_ANALYZER_NONNULL = YES; + CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; + CLANG_CXX_LIBRARY = "libc++"; + CLANG_ENABLE_MODULES = YES; + CLANG_ENABLE_OBJC_ARC = YES; + CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; + CLANG_WARN_BOOL_CONVERSION = YES; + CLANG_WARN_COMMA = YES; + CLANG_WARN_CONSTANT_CONVERSION = YES; + CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; + CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; + CLANG_WARN_EMPTY_BODY = YES; + CLANG_WARN_ENUM_CONVERSION = YES; + CLANG_WARN_INFINITE_RECURSION = YES; + CLANG_WARN_INT_CONVERSION = YES; + CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; + CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; + CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; + CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; + CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; + CLANG_WARN_STRICT_PROTOTYPES = YES; + CLANG_WARN_SUSPICIOUS_MOVE = YES; + CLANG_WARN_UNREACHABLE_CODE = YES; + CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; + "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; + COPY_PHASE_STRIP = NO; + DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; + ENABLE_NS_ASSERTIONS = NO; + ENABLE_STRICT_OBJC_MSGSEND = YES; + ENABLE_USER_SCRIPT_SANDBOXING = NO; + GCC_C_LANGUAGE_STANDARD = gnu99; + GCC_NO_COMMON_BLOCKS = YES; + GCC_WARN_64_TO_32_BIT_CONVERSION = YES; + GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; + GCC_WARN_UNDECLARED_SELECTOR = YES; + GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; + GCC_WARN_UNUSED_FUNCTION = YES; + GCC_WARN_UNUSED_VARIABLE = YES; + IPHONEOS_DEPLOYMENT_TARGET = 12.0; + MTL_ENABLE_DEBUG_INFO = NO; + SDKROOT = iphoneos; + SUPPORTED_PLATFORMS = iphoneos; + TARGETED_DEVICE_FAMILY = "1,2"; + VALIDATE_PRODUCT = YES; + }; + name = Profile; + }; + 249021D4217E4FDB00AE95B9 /* Profile */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = 7AFA3C8E1D35360C0083082E /* Release.xcconfig */; + buildSettings = { + ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; + CLANG_ENABLE_MODULES = YES; + CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)"; + ENABLE_BITCODE = NO; + INFOPLIST_FILE = Runner/Info.plist; + LD_RUNPATH_SEARCH_PATHS = ( + "$(inherited)", + "@executable_path/Frameworks", + ); + PRODUCT_BUNDLE_IDENTIFIER = com.example.flutterModularDemoApp; + PRODUCT_NAME = "$(TARGET_NAME)"; + SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h"; + SWIFT_VERSION = 5.0; + VERSIONING_SYSTEM = "apple-generic"; + }; + name = Profile; + }; + 331C8088294A63A400263BE5 /* Debug */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = 4B1FAE53C830CB656B3306A8 /* Pods-RunnerTests.debug.xcconfig */; + buildSettings = { + BUNDLE_LOADER = "$(TEST_HOST)"; + CODE_SIGN_STYLE = Automatic; + CURRENT_PROJECT_VERSION = 1; + GENERATE_INFOPLIST_FILE = YES; + MARKETING_VERSION = 1.0; + PRODUCT_BUNDLE_IDENTIFIER = com.example.flutterModularDemoApp.RunnerTests; + PRODUCT_NAME = "$(TARGET_NAME)"; + SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG; + SWIFT_OPTIMIZATION_LEVEL = "-Onone"; + SWIFT_VERSION = 5.0; + TEST_HOST = "$(BUILT_PRODUCTS_DIR)/Runner.app/$(BUNDLE_EXECUTABLE_FOLDER_PATH)/Runner"; + }; + name = Debug; + }; + 331C8089294A63A400263BE5 /* Release */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = 849846FA37D5C84AC76BC5B8 /* Pods-RunnerTests.release.xcconfig */; + buildSettings = { + BUNDLE_LOADER = "$(TEST_HOST)"; + CODE_SIGN_STYLE = Automatic; + CURRENT_PROJECT_VERSION = 1; + GENERATE_INFOPLIST_FILE = YES; + MARKETING_VERSION = 1.0; + PRODUCT_BUNDLE_IDENTIFIER = com.example.flutterModularDemoApp.RunnerTests; + PRODUCT_NAME = "$(TARGET_NAME)"; + SWIFT_VERSION = 5.0; + TEST_HOST = "$(BUILT_PRODUCTS_DIR)/Runner.app/$(BUNDLE_EXECUTABLE_FOLDER_PATH)/Runner"; + }; + name = Release; + }; + 331C808A294A63A400263BE5 /* Profile */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = 42617FCCD3CC7E9232CA19EF /* Pods-RunnerTests.profile.xcconfig */; + buildSettings = { + BUNDLE_LOADER = "$(TEST_HOST)"; + CODE_SIGN_STYLE = Automatic; + CURRENT_PROJECT_VERSION = 1; + GENERATE_INFOPLIST_FILE = YES; + MARKETING_VERSION = 1.0; + PRODUCT_BUNDLE_IDENTIFIER = com.example.flutterModularDemoApp.RunnerTests; + PRODUCT_NAME = "$(TARGET_NAME)"; + SWIFT_VERSION = 5.0; + TEST_HOST = "$(BUILT_PRODUCTS_DIR)/Runner.app/$(BUNDLE_EXECUTABLE_FOLDER_PATH)/Runner"; + }; + name = Profile; + }; + 97C147031CF9000F007C117D /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + ASSETCATALOG_COMPILER_GENERATE_SWIFT_ASSET_SYMBOL_EXTENSIONS = YES; + CLANG_ANALYZER_NONNULL = YES; + CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; + CLANG_CXX_LIBRARY = "libc++"; + CLANG_ENABLE_MODULES = YES; + CLANG_ENABLE_OBJC_ARC = YES; + CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; + CLANG_WARN_BOOL_CONVERSION = YES; + CLANG_WARN_COMMA = YES; + CLANG_WARN_CONSTANT_CONVERSION = YES; + CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; + CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; + CLANG_WARN_EMPTY_BODY = YES; + CLANG_WARN_ENUM_CONVERSION = YES; + CLANG_WARN_INFINITE_RECURSION = YES; + CLANG_WARN_INT_CONVERSION = YES; + CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; + CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; + CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; + CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; + CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; + CLANG_WARN_STRICT_PROTOTYPES = YES; + CLANG_WARN_SUSPICIOUS_MOVE = YES; + CLANG_WARN_UNREACHABLE_CODE = YES; + CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; + "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; + COPY_PHASE_STRIP = NO; + DEBUG_INFORMATION_FORMAT = dwarf; + ENABLE_STRICT_OBJC_MSGSEND = YES; + ENABLE_TESTABILITY = YES; + ENABLE_USER_SCRIPT_SANDBOXING = NO; + GCC_C_LANGUAGE_STANDARD = gnu99; + GCC_DYNAMIC_NO_PIC = NO; + GCC_NO_COMMON_BLOCKS = YES; + GCC_OPTIMIZATION_LEVEL = 0; + GCC_PREPROCESSOR_DEFINITIONS = ( + "DEBUG=1", + "$(inherited)", + ); + GCC_WARN_64_TO_32_BIT_CONVERSION = YES; + GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; + GCC_WARN_UNDECLARED_SELECTOR = YES; + GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; + GCC_WARN_UNUSED_FUNCTION = YES; + GCC_WARN_UNUSED_VARIABLE = YES; + IPHONEOS_DEPLOYMENT_TARGET = 12.0; + MTL_ENABLE_DEBUG_INFO = YES; + ONLY_ACTIVE_ARCH = YES; + SDKROOT = iphoneos; + TARGETED_DEVICE_FAMILY = "1,2"; + }; + name = Debug; + }; + 97C147041CF9000F007C117D /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + ASSETCATALOG_COMPILER_GENERATE_SWIFT_ASSET_SYMBOL_EXTENSIONS = YES; + CLANG_ANALYZER_NONNULL = YES; + CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; + CLANG_CXX_LIBRARY = "libc++"; + CLANG_ENABLE_MODULES = YES; + CLANG_ENABLE_OBJC_ARC = YES; + CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; + CLANG_WARN_BOOL_CONVERSION = YES; + CLANG_WARN_COMMA = YES; + CLANG_WARN_CONSTANT_CONVERSION = YES; + CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; + CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; + CLANG_WARN_EMPTY_BODY = YES; + CLANG_WARN_ENUM_CONVERSION = YES; + CLANG_WARN_INFINITE_RECURSION = YES; + CLANG_WARN_INT_CONVERSION = YES; + CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; + CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; + CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; + CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; + CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; + CLANG_WARN_STRICT_PROTOTYPES = YES; + CLANG_WARN_SUSPICIOUS_MOVE = YES; + CLANG_WARN_UNREACHABLE_CODE = YES; + CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; + "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; + COPY_PHASE_STRIP = NO; + DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; + ENABLE_NS_ASSERTIONS = NO; + ENABLE_STRICT_OBJC_MSGSEND = YES; + ENABLE_USER_SCRIPT_SANDBOXING = NO; + GCC_C_LANGUAGE_STANDARD = gnu99; + GCC_NO_COMMON_BLOCKS = YES; + GCC_WARN_64_TO_32_BIT_CONVERSION = YES; + GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; + GCC_WARN_UNDECLARED_SELECTOR = YES; + GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; + GCC_WARN_UNUSED_FUNCTION = YES; + GCC_WARN_UNUSED_VARIABLE = YES; + IPHONEOS_DEPLOYMENT_TARGET = 12.0; + MTL_ENABLE_DEBUG_INFO = NO; + SDKROOT = iphoneos; + SUPPORTED_PLATFORMS = iphoneos; + SWIFT_COMPILATION_MODE = wholemodule; + SWIFT_OPTIMIZATION_LEVEL = "-O"; + TARGETED_DEVICE_FAMILY = "1,2"; + VALIDATE_PRODUCT = YES; + }; + name = Release; + }; + 97C147061CF9000F007C117D /* Debug */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = 9740EEB21CF90195004384FC /* Debug.xcconfig */; + buildSettings = { + ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; + CLANG_ENABLE_MODULES = YES; + CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)"; + ENABLE_BITCODE = NO; + INFOPLIST_FILE = Runner/Info.plist; + LD_RUNPATH_SEARCH_PATHS = ( + "$(inherited)", + "@executable_path/Frameworks", + ); + PRODUCT_BUNDLE_IDENTIFIER = com.example.flutterModularDemoApp; + PRODUCT_NAME = "$(TARGET_NAME)"; + SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h"; + SWIFT_OPTIMIZATION_LEVEL = "-Onone"; + SWIFT_VERSION = 5.0; + VERSIONING_SYSTEM = "apple-generic"; + }; + name = Debug; + }; + 97C147071CF9000F007C117D /* Release */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = 7AFA3C8E1D35360C0083082E /* Release.xcconfig */; + buildSettings = { + ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; + CLANG_ENABLE_MODULES = YES; + CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)"; + ENABLE_BITCODE = NO; + INFOPLIST_FILE = Runner/Info.plist; + LD_RUNPATH_SEARCH_PATHS = ( + "$(inherited)", + "@executable_path/Frameworks", + ); + PRODUCT_BUNDLE_IDENTIFIER = com.example.flutterModularDemoApp; + PRODUCT_NAME = "$(TARGET_NAME)"; + SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h"; + SWIFT_VERSION = 5.0; + VERSIONING_SYSTEM = "apple-generic"; + }; + name = Release; + }; +/* End XCBuildConfiguration section */ + +/* Begin XCConfigurationList section */ + 331C8087294A63A400263BE5 /* Build configuration list for PBXNativeTarget "RunnerTests" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 331C8088294A63A400263BE5 /* Debug */, + 331C8089294A63A400263BE5 /* Release */, + 331C808A294A63A400263BE5 /* Profile */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; + 97C146E91CF9000F007C117D /* Build configuration list for PBXProject "Runner" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 97C147031CF9000F007C117D /* Debug */, + 97C147041CF9000F007C117D /* Release */, + 249021D3217E4FDB00AE95B9 /* Profile */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; + 97C147051CF9000F007C117D /* Build configuration list for PBXNativeTarget "Runner" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 97C147061CF9000F007C117D /* Debug */, + 97C147071CF9000F007C117D /* Release */, + 249021D4217E4FDB00AE95B9 /* Profile */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; +/* End XCConfigurationList section */ + }; + rootObject = 97C146E61CF9000F007C117D /* Project object */; +} diff --git a/packages/instabug_flutter_modular/example/ios/Runner.xcodeproj/project.xcworkspace/contents.xcworkspacedata b/packages/instabug_flutter_modular/example/ios/Runner.xcodeproj/project.xcworkspace/contents.xcworkspacedata new file mode 100644 index 000000000..919434a62 --- /dev/null +++ b/packages/instabug_flutter_modular/example/ios/Runner.xcodeproj/project.xcworkspace/contents.xcworkspacedata @@ -0,0 +1,7 @@ + + + + + diff --git a/packages/instabug_flutter_modular/example/ios/Runner.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist b/packages/instabug_flutter_modular/example/ios/Runner.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist new file mode 100644 index 000000000..18d981003 --- /dev/null +++ b/packages/instabug_flutter_modular/example/ios/Runner.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist @@ -0,0 +1,8 @@ + + + + + IDEDidComputeMac32BitWarning + + + diff --git a/packages/instabug_flutter_modular/example/ios/Runner.xcodeproj/project.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings b/packages/instabug_flutter_modular/example/ios/Runner.xcodeproj/project.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings new file mode 100644 index 000000000..f9b0d7c5e --- /dev/null +++ b/packages/instabug_flutter_modular/example/ios/Runner.xcodeproj/project.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings @@ -0,0 +1,8 @@ + + + + + PreviewsEnabled + + + diff --git a/packages/instabug_flutter_modular/example/ios/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme b/packages/instabug_flutter_modular/example/ios/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme new file mode 100644 index 000000000..8e3ca5dfe --- /dev/null +++ b/packages/instabug_flutter_modular/example/ios/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme @@ -0,0 +1,98 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/packages/instabug_flutter_modular/example/ios/Runner.xcworkspace/contents.xcworkspacedata b/packages/instabug_flutter_modular/example/ios/Runner.xcworkspace/contents.xcworkspacedata new file mode 100644 index 000000000..21a3cc14c --- /dev/null +++ b/packages/instabug_flutter_modular/example/ios/Runner.xcworkspace/contents.xcworkspacedata @@ -0,0 +1,10 @@ + + + + + + + diff --git a/packages/instabug_flutter_modular/example/ios/Runner.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist b/packages/instabug_flutter_modular/example/ios/Runner.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist new file mode 100644 index 000000000..18d981003 --- /dev/null +++ b/packages/instabug_flutter_modular/example/ios/Runner.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist @@ -0,0 +1,8 @@ + + + + + IDEDidComputeMac32BitWarning + + + diff --git a/packages/instabug_flutter_modular/example/ios/Runner.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings b/packages/instabug_flutter_modular/example/ios/Runner.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings new file mode 100644 index 000000000..f9b0d7c5e --- /dev/null +++ b/packages/instabug_flutter_modular/example/ios/Runner.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings @@ -0,0 +1,8 @@ + + + + + PreviewsEnabled + + + diff --git a/packages/instabug_flutter_modular/example/ios/Runner/AppDelegate.swift b/packages/instabug_flutter_modular/example/ios/Runner/AppDelegate.swift new file mode 100644 index 000000000..70693e4a8 --- /dev/null +++ b/packages/instabug_flutter_modular/example/ios/Runner/AppDelegate.swift @@ -0,0 +1,13 @@ +import UIKit +import Flutter + +@UIApplicationMain +@objc class AppDelegate: FlutterAppDelegate { + override func application( + _ application: UIApplication, + didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]? + ) -> Bool { + GeneratedPluginRegistrant.register(with: self) + return super.application(application, didFinishLaunchingWithOptions: launchOptions) + } +} diff --git a/packages/instabug_flutter_modular/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Contents.json b/packages/instabug_flutter_modular/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Contents.json new file mode 100644 index 000000000..d36b1fab2 --- /dev/null +++ b/packages/instabug_flutter_modular/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Contents.json @@ -0,0 +1,122 @@ +{ + "images" : [ + { + "size" : "20x20", + "idiom" : "iphone", + "filename" : "Icon-App-20x20@2x.png", + "scale" : "2x" + }, + { + "size" : "20x20", + "idiom" : "iphone", + "filename" : "Icon-App-20x20@3x.png", + "scale" : "3x" + }, + { + "size" : "29x29", + "idiom" : "iphone", + "filename" : "Icon-App-29x29@1x.png", + "scale" : "1x" + }, + { + "size" : "29x29", + "idiom" : "iphone", + "filename" : "Icon-App-29x29@2x.png", + "scale" : "2x" + }, + { + "size" : "29x29", + "idiom" : "iphone", + "filename" : "Icon-App-29x29@3x.png", + "scale" : "3x" + }, + { + "size" : "40x40", + "idiom" : "iphone", + "filename" : "Icon-App-40x40@2x.png", + "scale" : "2x" + }, + { + "size" : "40x40", + "idiom" : "iphone", + "filename" : "Icon-App-40x40@3x.png", + "scale" : "3x" + }, + { + "size" : "60x60", + "idiom" : "iphone", + "filename" : "Icon-App-60x60@2x.png", + "scale" : "2x" + }, + { + "size" : "60x60", + "idiom" : "iphone", + "filename" : "Icon-App-60x60@3x.png", + "scale" : "3x" + }, + { + "size" : "20x20", + "idiom" : "ipad", + "filename" : "Icon-App-20x20@1x.png", + "scale" : "1x" + }, + { + "size" : "20x20", + "idiom" : "ipad", + "filename" : "Icon-App-20x20@2x.png", + "scale" : "2x" + }, + { + "size" : "29x29", + "idiom" : "ipad", + "filename" : "Icon-App-29x29@1x.png", + "scale" : "1x" + }, + { + "size" : "29x29", + "idiom" : "ipad", + "filename" : "Icon-App-29x29@2x.png", + "scale" : "2x" + }, + { + "size" : "40x40", + "idiom" : "ipad", + "filename" : "Icon-App-40x40@1x.png", + "scale" : "1x" + }, + { + "size" : "40x40", + "idiom" : "ipad", + "filename" : "Icon-App-40x40@2x.png", + "scale" : "2x" + }, + { + "size" : "76x76", + "idiom" : "ipad", + "filename" : "Icon-App-76x76@1x.png", + "scale" : "1x" + }, + { + "size" : "76x76", + "idiom" : "ipad", + "filename" : "Icon-App-76x76@2x.png", + "scale" : "2x" + }, + { + "size" : "83.5x83.5", + "idiom" : "ipad", + "filename" : "Icon-App-83.5x83.5@2x.png", + "scale" : "2x" + }, + { + "size" : "1024x1024", + "idiom" : "ios-marketing", + "filename" : "Icon-App-1024x1024@1x.png", + "scale" : "1x" + } + ], + "info" : { + "version" : 1, + "author" : "xcode" + } +} diff --git a/packages/instabug_flutter_modular/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-1024x1024@1x.png b/packages/instabug_flutter_modular/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-1024x1024@1x.png new file mode 100644 index 000000000..dc9ada472 Binary files /dev/null and b/packages/instabug_flutter_modular/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-1024x1024@1x.png differ diff --git a/packages/instabug_flutter_modular/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@1x.png b/packages/instabug_flutter_modular/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@1x.png new file mode 100644 index 000000000..7353c41ec Binary files /dev/null and b/packages/instabug_flutter_modular/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@1x.png differ diff --git a/packages/instabug_flutter_modular/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@2x.png b/packages/instabug_flutter_modular/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@2x.png new file mode 100644 index 000000000..797d452e4 Binary files /dev/null and b/packages/instabug_flutter_modular/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@2x.png differ diff --git a/packages/instabug_flutter_modular/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@3x.png b/packages/instabug_flutter_modular/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@3x.png new file mode 100644 index 000000000..6ed2d933e Binary files /dev/null and b/packages/instabug_flutter_modular/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@3x.png differ diff --git a/packages/instabug_flutter_modular/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@1x.png b/packages/instabug_flutter_modular/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@1x.png new file mode 100644 index 000000000..4cd7b0099 Binary files /dev/null and b/packages/instabug_flutter_modular/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@1x.png differ diff --git a/packages/instabug_flutter_modular/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@2x.png b/packages/instabug_flutter_modular/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@2x.png new file mode 100644 index 000000000..fe730945a Binary files /dev/null and b/packages/instabug_flutter_modular/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@2x.png differ diff --git a/packages/instabug_flutter_modular/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@3x.png b/packages/instabug_flutter_modular/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@3x.png new file mode 100644 index 000000000..321773cd8 Binary files /dev/null and b/packages/instabug_flutter_modular/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@3x.png differ diff --git a/packages/instabug_flutter_modular/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@1x.png b/packages/instabug_flutter_modular/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@1x.png new file mode 100644 index 000000000..797d452e4 Binary files /dev/null and b/packages/instabug_flutter_modular/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@1x.png differ diff --git a/packages/instabug_flutter_modular/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@2x.png b/packages/instabug_flutter_modular/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@2x.png new file mode 100644 index 000000000..502f463a9 Binary files /dev/null and b/packages/instabug_flutter_modular/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@2x.png differ diff --git a/packages/instabug_flutter_modular/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@3x.png b/packages/instabug_flutter_modular/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@3x.png new file mode 100644 index 000000000..0ec303439 Binary files /dev/null and b/packages/instabug_flutter_modular/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@3x.png differ diff --git a/packages/instabug_flutter_modular/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@2x.png b/packages/instabug_flutter_modular/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@2x.png new file mode 100644 index 000000000..0ec303439 Binary files /dev/null and b/packages/instabug_flutter_modular/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@2x.png differ diff --git a/packages/instabug_flutter_modular/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@3x.png b/packages/instabug_flutter_modular/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@3x.png new file mode 100644 index 000000000..e9f5fea27 Binary files /dev/null and b/packages/instabug_flutter_modular/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@3x.png differ diff --git a/packages/instabug_flutter_modular/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@1x.png b/packages/instabug_flutter_modular/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@1x.png new file mode 100644 index 000000000..84ac32ae7 Binary files /dev/null and b/packages/instabug_flutter_modular/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@1x.png differ diff --git a/packages/instabug_flutter_modular/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@2x.png b/packages/instabug_flutter_modular/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@2x.png new file mode 100644 index 000000000..8953cba09 Binary files /dev/null and b/packages/instabug_flutter_modular/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@2x.png differ diff --git a/packages/instabug_flutter_modular/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-83.5x83.5@2x.png b/packages/instabug_flutter_modular/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-83.5x83.5@2x.png new file mode 100644 index 000000000..0467bf12a Binary files /dev/null and b/packages/instabug_flutter_modular/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-83.5x83.5@2x.png differ diff --git a/packages/instabug_flutter_modular/example/ios/Runner/Assets.xcassets/LaunchImage.imageset/Contents.json b/packages/instabug_flutter_modular/example/ios/Runner/Assets.xcassets/LaunchImage.imageset/Contents.json new file mode 100644 index 000000000..0bedcf2fd --- /dev/null +++ b/packages/instabug_flutter_modular/example/ios/Runner/Assets.xcassets/LaunchImage.imageset/Contents.json @@ -0,0 +1,23 @@ +{ + "images" : [ + { + "idiom" : "universal", + "filename" : "LaunchImage.png", + "scale" : "1x" + }, + { + "idiom" : "universal", + "filename" : "LaunchImage@2x.png", + "scale" : "2x" + }, + { + "idiom" : "universal", + "filename" : "LaunchImage@3x.png", + "scale" : "3x" + } + ], + "info" : { + "version" : 1, + "author" : "xcode" + } +} diff --git a/packages/instabug_flutter_modular/example/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage.png b/packages/instabug_flutter_modular/example/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage.png new file mode 100644 index 000000000..9da19eaca Binary files /dev/null and b/packages/instabug_flutter_modular/example/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage.png differ diff --git a/packages/instabug_flutter_modular/example/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@2x.png b/packages/instabug_flutter_modular/example/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@2x.png new file mode 100644 index 000000000..9da19eaca Binary files /dev/null and b/packages/instabug_flutter_modular/example/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@2x.png differ diff --git a/packages/instabug_flutter_modular/example/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@3x.png b/packages/instabug_flutter_modular/example/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@3x.png new file mode 100644 index 000000000..9da19eaca Binary files /dev/null and b/packages/instabug_flutter_modular/example/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@3x.png differ diff --git a/packages/instabug_flutter_modular/example/ios/Runner/Assets.xcassets/LaunchImage.imageset/README.md b/packages/instabug_flutter_modular/example/ios/Runner/Assets.xcassets/LaunchImage.imageset/README.md new file mode 100644 index 000000000..89c2725b7 --- /dev/null +++ b/packages/instabug_flutter_modular/example/ios/Runner/Assets.xcassets/LaunchImage.imageset/README.md @@ -0,0 +1,5 @@ +# Launch Screen Assets + +You can customize the launch screen with your own desired assets by replacing the image files in this directory. + +You can also do it by opening your Flutter project's Xcode project with `open ios/Runner.xcworkspace`, selecting `Runner/Assets.xcassets` in the Project Navigator and dropping in the desired images. \ No newline at end of file diff --git a/packages/instabug_flutter_modular/example/ios/Runner/Base.lproj/LaunchScreen.storyboard b/packages/instabug_flutter_modular/example/ios/Runner/Base.lproj/LaunchScreen.storyboard new file mode 100644 index 000000000..f2e259c7c --- /dev/null +++ b/packages/instabug_flutter_modular/example/ios/Runner/Base.lproj/LaunchScreen.storyboard @@ -0,0 +1,37 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/packages/instabug_flutter_modular/example/ios/Runner/Base.lproj/Main.storyboard b/packages/instabug_flutter_modular/example/ios/Runner/Base.lproj/Main.storyboard new file mode 100644 index 000000000..f3c28516f --- /dev/null +++ b/packages/instabug_flutter_modular/example/ios/Runner/Base.lproj/Main.storyboard @@ -0,0 +1,26 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/packages/instabug_flutter_modular/example/ios/Runner/Info.plist b/packages/instabug_flutter_modular/example/ios/Runner/Info.plist new file mode 100644 index 000000000..929983c33 --- /dev/null +++ b/packages/instabug_flutter_modular/example/ios/Runner/Info.plist @@ -0,0 +1,49 @@ + + + + + CFBundleDevelopmentRegion + $(DEVELOPMENT_LANGUAGE) + CFBundleDisplayName + Flutter Modular Demo App + CFBundleExecutable + $(EXECUTABLE_NAME) + CFBundleIdentifier + $(PRODUCT_BUNDLE_IDENTIFIER) + CFBundleInfoDictionaryVersion + 6.0 + CFBundleName + flutter_modular_demo_app + CFBundlePackageType + APPL + CFBundleShortVersionString + $(FLUTTER_BUILD_NAME) + CFBundleSignature + ???? + CFBundleVersion + $(FLUTTER_BUILD_NUMBER) + LSRequiresIPhoneOS + + UILaunchStoryboardName + LaunchScreen + UIMainStoryboardFile + Main + UISupportedInterfaceOrientations + + UIInterfaceOrientationPortrait + UIInterfaceOrientationLandscapeLeft + UIInterfaceOrientationLandscapeRight + + UISupportedInterfaceOrientations~ipad + + UIInterfaceOrientationPortrait + UIInterfaceOrientationPortraitUpsideDown + UIInterfaceOrientationLandscapeLeft + UIInterfaceOrientationLandscapeRight + + CADisableMinimumFrameDurationOnPhone + + UIApplicationSupportsIndirectInputEvents + + + diff --git a/packages/instabug_flutter_modular/example/ios/Runner/Runner-Bridging-Header.h b/packages/instabug_flutter_modular/example/ios/Runner/Runner-Bridging-Header.h new file mode 100644 index 000000000..308a2a560 --- /dev/null +++ b/packages/instabug_flutter_modular/example/ios/Runner/Runner-Bridging-Header.h @@ -0,0 +1 @@ +#import "GeneratedPluginRegistrant.h" diff --git a/packages/instabug_flutter_modular/example/ios/RunnerTests/RunnerTests.swift b/packages/instabug_flutter_modular/example/ios/RunnerTests/RunnerTests.swift new file mode 100644 index 000000000..86a7c3b1b --- /dev/null +++ b/packages/instabug_flutter_modular/example/ios/RunnerTests/RunnerTests.swift @@ -0,0 +1,12 @@ +import Flutter +import UIKit +import XCTest + +class RunnerTests: XCTestCase { + + func testExample() { + // If you add code to the Runner application, consider adding tests here. + // See https://developer.apple.com/documentation/xctest for more information about using XCTest. + } + +} diff --git a/packages/instabug_flutter_modular/example/lib/main.dart b/packages/instabug_flutter_modular/example/lib/main.dart new file mode 100644 index 000000000..d2c1c6100 --- /dev/null +++ b/packages/instabug_flutter_modular/example/lib/main.dart @@ -0,0 +1,54 @@ +import 'dart:async'; + +import 'package:flutter/material.dart'; +import 'package:flutter_modular/flutter_modular.dart'; +import 'package:flutter_modular_demo_app/modules.dart'; +import 'package:instabug_flutter/instabug_flutter.dart'; +import 'package:instabug_flutter_modular/instabug_flutter_modular.dart'; + +void main() { + runZonedGuarded( + () { + WidgetsFlutterBinding.ensureInitialized(); + + Instabug.init( + token: '6b41bc30dd42aac50794ef3ec8f74a74', + invocationEvents: [InvocationEvent.floatingButton], + debugLogsLevel: LogLevel.verbose, + ); + + FlutterError.onError = (FlutterErrorDetails details) { + Zone.current.handleUncaughtError(details.exception, details.stack!); + }; + runApp( + ModularApp( + module: InstabugModule(AppModule()), + child: const MyApp(), + ), + ); + }, + CrashReporting.reportCrash, + ); +} + +class MyApp extends StatefulWidget { + const MyApp({super.key}); + + @override + State createState() => _MyAppState(); +} + +class _MyAppState extends State { + @override + Widget build(BuildContext context) { + return MaterialApp.router( + routeInformationParser: Modular.routeInformationParser, + routerDelegate: Modular.routerDelegate + ..setObservers([InstabugNavigatorObserver()]), + title: 'Flutter Modular Demo', + theme: ThemeData( + primarySwatch: Colors.blue, + ), + ); + } +} diff --git a/packages/instabug_flutter_modular/example/lib/modules.dart b/packages/instabug_flutter_modular/example/lib/modules.dart new file mode 100644 index 000000000..f01d3d5f3 --- /dev/null +++ b/packages/instabug_flutter_modular/example/lib/modules.dart @@ -0,0 +1,9 @@ +import 'package:flutter/material.dart'; +import 'package:flutter_modular/flutter_modular.dart'; +import 'package:flutter_modular_demo_app/screens.dart'; + +part 'modules/app_module.dart'; + +part 'modules/second_module.dart'; + +part 'modules/third_module.dart'; diff --git a/packages/instabug_flutter_modular/example/lib/modules/app_module.dart b/packages/instabug_flutter_modular/example/lib/modules/app_module.dart new file mode 100644 index 000000000..f68cf08b5 --- /dev/null +++ b/packages/instabug_flutter_modular/example/lib/modules/app_module.dart @@ -0,0 +1,20 @@ +part of '../modules.dart'; + +class AppModule extends Module { + @override + final List binds = [Bind.singleton((i) => Counter())]; + + @override + final List routes = [ + ChildRoute('/', child: (_, args) => const HomePage()), + ChildRoute('/simplePage', child: (_, args) => const SimplePage()), + ChildRoute('/complexPage', child: (_, args) => const ComplexPage()), + ChildRoute('/bindsPage', child: (_, args) => const ThirdModuleHomePage()), + WildcardRoute( + child: (p0, p1) => const NotFoundPage(), + ), + RedirectRoute('/redirect', to: '/simplePage?name=redirected'), + ModuleRoute('/secondModule', module: SecondModule()), + ModuleRoute('/thirdModule', module: ThirdModule()), + ]; +} diff --git a/packages/instabug_flutter_modular/example/lib/modules/second_module.dart b/packages/instabug_flutter_modular/example/lib/modules/second_module.dart new file mode 100644 index 000000000..b178f36be --- /dev/null +++ b/packages/instabug_flutter_modular/example/lib/modules/second_module.dart @@ -0,0 +1,31 @@ +part of '../modules.dart'; + +class SecondModule extends Module { + @override + final List binds = []; + + @override + List get routes => [ + ChildRoute( + '/', + child: (context, args) => const SecondModuleHomePage(), + children: [ + ChildRoute( + '/page1', + child: (context, args) => + const InternalPage(title: 'page 1', color: Colors.red), + ), + ChildRoute( + '/page2', + child: (context, args) => + const InternalPage(title: 'page 2', color: Colors.amber), + ), + ChildRoute( + '/page3', + child: (context, args) => + const InternalPage(title: 'page 3', color: Colors.green), + ), + ], + ), + ]; +} diff --git a/packages/instabug_flutter_modular/example/lib/modules/third_module.dart b/packages/instabug_flutter_modular/example/lib/modules/third_module.dart new file mode 100644 index 000000000..e14d83be0 --- /dev/null +++ b/packages/instabug_flutter_modular/example/lib/modules/third_module.dart @@ -0,0 +1,21 @@ +part of '../modules.dart'; + +class ThirdModule extends Module { + @override + final List binds = []; + + @override + final List routes = [ + ChildRoute('/', child: (_, args) => const ThirdModuleHomePage()), + ]; +} + +class Counter { + int _number = 0; + + int get number => _number; + + void increment() => _number++; + + void decrement() => _number--; +} diff --git a/packages/instabug_flutter_modular/example/lib/screens.dart b/packages/instabug_flutter_modular/example/lib/screens.dart new file mode 100644 index 000000000..a067eb93b --- /dev/null +++ b/packages/instabug_flutter_modular/example/lib/screens.dart @@ -0,0 +1,17 @@ +import 'package:flutter/material.dart'; +import 'package:flutter_modular/flutter_modular.dart'; +import 'package:flutter_modular_demo_app/modules.dart'; +import 'package:flutter_modular_demo_app/widgets.dart'; +import 'package:instabug_flutter/instabug_flutter.dart'; + +part 'screens/home_page.dart'; + +part 'screens/second_module_home_page.dart'; + +part 'screens/simple_page.dart'; + +part 'screens/third_module_home_page.dart'; + +part 'screens/not_found_page.dart'; + +part 'screens/complex_page.dart'; diff --git a/packages/instabug_flutter_modular/example/lib/screens/complex_page.dart b/packages/instabug_flutter_modular/example/lib/screens/complex_page.dart new file mode 100644 index 000000000..cac14c0d9 --- /dev/null +++ b/packages/instabug_flutter_modular/example/lib/screens/complex_page.dart @@ -0,0 +1,95 @@ +part of '../screens.dart'; + +class ComplexPage extends StatelessWidget { + const ComplexPage({super.key}); + + @override + Widget build(BuildContext context) { + int numberOfWidgets = 100; + return Scaffold( + floatingActionButton: FloatingActionButton( + onPressed: () {}, + child: const Icon(Icons.add), + ), + appBar: AppBar( + title: const Text("Complex Page"), + ), + body: SafeArea( + child: Column( + mainAxisAlignment: MainAxisAlignment.center, + crossAxisAlignment: CrossAxisAlignment.center, + children: [ + const Padding( + padding: EdgeInsets.all(16.0), + child: Row( + mainAxisAlignment: MainAxisAlignment.start, + crossAxisAlignment: CrossAxisAlignment.center, + children: [ + CustomCard( + width: 40, + height: 40, + ), + SizedBox(width: 8), + Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + CustomCard( + height: 10, + width: 150, + ), + SizedBox(height: 8), + CustomCard( + height: 10, + width: 200, + ), + ], + ), + ], + ), + ), + SizedBox( + height: 80, + child: ListView.separated( + itemBuilder: (_, __) => const CustomCard( + width: 80, + ), + separatorBuilder: (_, __) => const SizedBox(width: 8), + itemCount: numberOfWidgets, + scrollDirection: Axis.horizontal, + ), + ), + const SizedBox(height: 16), + Expanded( + child: ListView.separated( + padding: const EdgeInsets.all(16), + itemBuilder: (_, __) => const CustomCard( + height: 100, + ), + separatorBuilder: (_, __) => const SizedBox(height: 8), + itemCount: numberOfWidgets, + ), + ), + ], + ), + ), + ); + } +} + +class CustomCard extends StatelessWidget { + const CustomCard({super.key, this.width, this.height}); + + final double? width, height; + + @override + Widget build(BuildContext context) { + return Container( + width: width, + height: height, + decoration: BoxDecoration( + borderRadius: BorderRadius.circular(8), + color: Colors.black12, + ), + ); + } +} diff --git a/packages/instabug_flutter_modular/example/lib/screens/home_page.dart b/packages/instabug_flutter_modular/example/lib/screens/home_page.dart new file mode 100644 index 000000000..d6a29c195 --- /dev/null +++ b/packages/instabug_flutter_modular/example/lib/screens/home_page.dart @@ -0,0 +1,109 @@ +part of '../screens.dart'; +//ignore_for_file:invalid_use_of_internal_member + +class HomePage extends StatefulWidget { + const HomePage({super.key}); + + @override + State createState() => _HomePageState(); +} + +class _HomePageState extends State { + bool _instabug = true, _apm = true, _screenLoading = true, _uiTrace = true; + + @override + void didChangeDependencies() async { + super.didChangeDependencies(); + _instabug = await Instabug.isEnabled(); + _apm = await APM.isEnabled(); + _screenLoading = await APM.isScreenLoadingEnabled(); + } + + @override + Widget build(BuildContext context) { + return Scaffold( + appBar: AppBar(title: const Text('Home Page')), + body: SingleChildScrollView( + padding: const EdgeInsets.all(16.0), + child: Column( + mainAxisAlignment: MainAxisAlignment.center, + crossAxisAlignment: CrossAxisAlignment.stretch, + children: [ + CustomSwitchListTile( + value: _instabug, + onChanged: (value) { + Instabug.setEnabled(value); + setState(() => _instabug = value); + }, + title: "Instabug", + ), + CustomSwitchListTile( + value: _apm, + onChanged: (value) { + APM.setEnabled(value); + setState(() => _apm = value); + }, + title: "APM", + ), + CustomSwitchListTile( + value: _screenLoading, + onChanged: (value) { + APM.setScreenLoadingEnabled(value); + setState(() => _screenLoading = value); + }, + title: "Screen Loading", + ), + CustomSwitchListTile( + value: _uiTrace, + onChanged: (value) { + APM.setAutoUITraceEnabled(value); + setState(() => _uiTrace = value); + }, + title: "UI Trace", + ), + CustomButton( + onPressed: () => Modular.to.navigate('/simplePage'), + title: 'Navigate To Simple Page', + ), + CustomButton( + onPressed: () => Modular.to.pushNamed('/complexPage'), + title: 'Navigate To Complex Page', + ), + CustomButton( + onPressed: () => Modular.to.pushNamed('/simplePage'), + title: 'Navigate To Second Page (using push)', + ), + CustomButton( + onPressed: () => + Modular.to.navigate('/simplePage?name=Inastabug'), + title: 'Navigate To Second Page (with params)', + ), + CustomButton( + onPressed: () => Modular.to.navigate('/redirect'), + title: 'Navigate Using RedirectRoute', + ), + CustomButton( + onPressed: () => Modular.to.navigate('/bindsPage'), + title: 'Navigate To Binds Page', + ), + const SizedBox( + height: 32, + ), + CustomButton( + onPressed: () => Modular.to.navigate('/secondModule/'), + title: 'Navigate To Second Module (Nested Routes)', + ), + CustomButton( + onPressed: () => Modular.to.navigate('/thirdModule/'), + title: 'Navigate To Third Module (Binds)', + ), + CustomButton( + onPressed: () => Modular.to.navigate('/asde'), + title: 'Navigation History', + ), + ], + ), + ), + ); + } +} diff --git a/packages/instabug_flutter_modular/example/lib/screens/not_found_page.dart b/packages/instabug_flutter_modular/example/lib/screens/not_found_page.dart new file mode 100644 index 000000000..a17ee9176 --- /dev/null +++ b/packages/instabug_flutter_modular/example/lib/screens/not_found_page.dart @@ -0,0 +1,18 @@ +part of '../screens.dart'; + +class NotFoundPage extends StatelessWidget { + const NotFoundPage({super.key}); + + @override + Widget build(BuildContext context) { + return Scaffold( + appBar: AppBar(title: const Text('Not Found Page')), + body: Center( + child: CustomButton( + onPressed: () => Modular.to.navigate('/'), + title: 'Back To Home', + ), + ), + ); + } +} diff --git a/packages/instabug_flutter_modular/example/lib/screens/second_module_home_page.dart b/packages/instabug_flutter_modular/example/lib/screens/second_module_home_page.dart new file mode 100644 index 000000000..7fe3c9454 --- /dev/null +++ b/packages/instabug_flutter_modular/example/lib/screens/second_module_home_page.dart @@ -0,0 +1,66 @@ +part of '../screens.dart'; + +class SecondModuleHomePage extends StatelessWidget { + const SecondModuleHomePage({super.key}); + + @override + Widget build(BuildContext context) { + final leading = SizedBox( + width: MediaQuery.of(context).size.width * 0.3, + child: NavigationListener( + builder: (context, child) => Column( + children: [ + ListTile( + title: const Text('Page 1'), + onTap: () => Modular.to.navigate('/secondModule/page1'), + selected: Modular.to.path.endsWith('/secondModule/page1'), + ), + ListTile( + title: const Text('Page 2'), + onTap: () => Modular.to.navigate('/secondModule/page2'), + selected: Modular.to.path.endsWith('/secondModule/page2'), + ), + ListTile( + title: const Text('Page 3'), + onTap: () => Modular.to.navigate('/secondModule/page3'), + selected: Modular.to.path.endsWith('/secondModule/page3'), + ), + const Spacer(), + ListTile( + title: const Text('Back To Home'), + onTap: () => Modular.to.navigate('/'), + ), + ], + ), + ), + ); + + return Scaffold( + appBar: AppBar(title: const Text('Second Module (Nested Routes)')), + body: SafeArea( + child: Row( + children: [ + leading, + Container(width: 1, color: Colors.black26), + const Expanded(child: RouterOutlet()), + ], + ), + ), + ); + } +} + +class InternalPage extends StatelessWidget { + final String title; + final Color color; + + const InternalPage({super.key, required this.title, required this.color}); + + @override + Widget build(BuildContext context) { + return Material( + color: color, + child: Center(child: Text(title)), + ); + } +} diff --git a/packages/instabug_flutter_modular/example/lib/screens/simple_page.dart b/packages/instabug_flutter_modular/example/lib/screens/simple_page.dart new file mode 100644 index 000000000..5d57e5510 --- /dev/null +++ b/packages/instabug_flutter_modular/example/lib/screens/simple_page.dart @@ -0,0 +1,58 @@ +part of '../screens.dart'; + +class SimplePage extends StatelessWidget { + const SimplePage({super.key}); + + @override + Widget build(BuildContext context) { + final canPop = Modular.to.canPop(); + const int extendedMicroseconds = 50000; + + return Scaffold( + appBar: AppBar(title: const Text('Second Page')), + body: Padding( + padding: const EdgeInsets.all(16.0), + child: Column( + mainAxisAlignment: MainAxisAlignment.center, + crossAxisAlignment: CrossAxisAlignment.stretch, + children: [ + if (Modular.args.queryParams.containsKey("name")) ...[ + Text( + "Parameters: ${Modular.args.queryParams["name"]}", + textAlign: TextAlign.center, + ), + const SizedBox(height: 16), + ], + CustomButton( + onPressed: () => + _extendScreenLoading(context, extendedMicroseconds), + title: 'Extend SCL for $extendedMicroseconds μs', + ), + CustomButton( + onPressed: () { + if (canPop) { + Modular.to.pop(); + } else { + Modular.to.navigate('/'); + } + }, + title: 'Back to Home ${canPop ? "(pop)" : ""}', + ), + ], + ), + ), + ); + } + + void _extendScreenLoading(BuildContext context, int microseconds) { + ScaffoldMessenger.of(context) + .showSnackBar( + SnackBar( + content: Text("extend Screen for $microseconds microseconds"), + duration: Duration(microseconds: microseconds), + ), + ) + .closed + .then((value) => APM.endScreenLoading()); + } +} diff --git a/packages/instabug_flutter_modular/example/lib/screens/third_module_home_page.dart b/packages/instabug_flutter_modular/example/lib/screens/third_module_home_page.dart new file mode 100644 index 000000000..1f060b1a0 --- /dev/null +++ b/packages/instabug_flutter_modular/example/lib/screens/third_module_home_page.dart @@ -0,0 +1,50 @@ +part of '../screens.dart'; + +class ThirdModuleHomePage extends StatefulWidget { + const ThirdModuleHomePage({super.key}); + + @override + State createState() => _ThirdModuleHomePageState(); +} + +class _ThirdModuleHomePageState extends State { + final counter = Modular.get(); + + @override + Widget build(BuildContext context) { + return Scaffold( + appBar: AppBar(title: const Text('Third Module (Binds)')), + body: Padding( + padding: const EdgeInsets.all(16.0), + child: Column( + mainAxisAlignment: MainAxisAlignment.center, + crossAxisAlignment: CrossAxisAlignment.stretch, + children: [ + Row( + mainAxisAlignment: MainAxisAlignment.center, + children: [ + IconButton( + onPressed: () => setState(() => counter.increment()), + icon: const Icon(Icons.add_circle_outline_rounded)), + Padding( + padding: const EdgeInsets.symmetric(horizontal: 16.0), + child: Text( + "Counter: ${counter.number}", + textAlign: TextAlign.center, + ), + ), + IconButton( + onPressed: () => setState(() => counter.decrement()), + icon: const Icon(Icons.remove_circle_outline_rounded)), + ], + ), + CustomButton( + onPressed: () => Modular.to.navigate('/'), + title: 'Back To Home', + ), + ], + ), + ), + ); + } +} diff --git a/packages/instabug_flutter_modular/example/lib/widgets.dart b/packages/instabug_flutter_modular/example/lib/widgets.dart new file mode 100644 index 000000000..37b85cc1f --- /dev/null +++ b/packages/instabug_flutter_modular/example/lib/widgets.dart @@ -0,0 +1,38 @@ +import 'package:flutter/material.dart'; + +class CustomSwitchListTile extends StatelessWidget { + const CustomSwitchListTile( + {super.key, required this.value, this.onChanged, required this.title}); + + final bool value; + final void Function(bool)? onChanged; + + final String title; + + @override + Widget build(BuildContext context) { + return SwitchListTile( + value: value, + onChanged: onChanged, + title: Text(title), + ); + } +} + +class CustomButton extends StatelessWidget { + const CustomButton({super.key, required this.onPressed, required this.title}); + + final VoidCallback onPressed; + final String title; + + @override + Widget build(BuildContext context) { + return ElevatedButton( + onPressed: onPressed, + child: Text( + title, + textAlign: TextAlign.center, + ), + ); + } +} diff --git a/packages/instabug_flutter_modular/example/pubspec.lock b/packages/instabug_flutter_modular/example/pubspec.lock new file mode 100644 index 000000000..f53be570f --- /dev/null +++ b/packages/instabug_flutter_modular/example/pubspec.lock @@ -0,0 +1,259 @@ +# Generated by pub +# See https://dart.dev/tools/pub/glossary#lockfile +packages: + async: + dependency: transitive + description: + name: async + sha256: "947bfcf187f74dbc5e146c9eb9c0f10c9f8b30743e341481c1e2ed3ecc18c20c" + url: "https://pub.dev" + source: hosted + version: "2.11.0" + boolean_selector: + dependency: transitive + description: + name: boolean_selector + sha256: "6cfb5af12253eaf2b368f07bacc5a80d1301a071c73360d746b7f2e32d762c66" + url: "https://pub.dev" + source: hosted + version: "2.1.1" + characters: + dependency: transitive + description: + name: characters + sha256: "04a925763edad70e8443c99234dc3328f442e811f1d8fd1a72f1c8ad0f69a605" + url: "https://pub.dev" + source: hosted + version: "1.3.0" + clock: + dependency: transitive + description: + name: clock + sha256: cb6d7f03e1de671e34607e909a7213e31d7752be4fb66a86d29fe1eb14bfb5cf + url: "https://pub.dev" + source: hosted + version: "1.1.1" + collection: + dependency: transitive + description: + name: collection + sha256: a1ace0a119f20aabc852d165077c036cd864315bd99b7eaa10a60100341941bf + url: "https://pub.dev" + source: hosted + version: "1.19.0" + cupertino_icons: + dependency: "direct main" + description: + name: cupertino_icons + sha256: ba631d1c7f7bef6b729a622b7b752645a2d076dba9976925b8f25725a30e1ee6 + url: "https://pub.dev" + source: hosted + version: "1.0.8" + fake_async: + dependency: transitive + description: + name: fake_async + sha256: "511392330127add0b769b75a987850d136345d9227c6b94c96a04cf4a391bf78" + url: "https://pub.dev" + source: hosted + version: "1.3.1" + flutter: + dependency: "direct main" + description: flutter + source: sdk + version: "0.0.0" + flutter_lints: + dependency: "direct dev" + description: + name: flutter_lints + sha256: "9e8c3858111da373efc5aa341de011d9bd23e2c5c5e0c62bccf32438e192d7b1" + url: "https://pub.dev" + source: hosted + version: "3.0.2" + flutter_modular: + dependency: transitive + description: + name: flutter_modular + sha256: "061f0bcc8f8c438d4c82f4ff70a9e61f109961c92b4e1eaf1bbfab75f577fe0e" + url: "https://pub.dev" + source: hosted + version: "5.0.3" + flutter_modular_annotations: + dependency: transitive + description: + name: flutter_modular_annotations + sha256: "65971655bdd30816a6a66651c801f4ceba6c8ba265f0866cc51ad038332c9a71" + url: "https://pub.dev" + source: hosted + version: "0.0.2" + flutter_test: + dependency: "direct dev" + description: flutter + source: sdk + version: "0.0.0" + instabug_flutter: + dependency: "direct main" + description: + path: "../../instabug_flutter" + relative: true + source: path + version: "15.0.2" + instabug_flutter_modular: + dependency: "direct main" + description: + path: ".." + relative: true + source: path + version: "1.0.0" + leak_tracker: + dependency: transitive + description: + name: leak_tracker + sha256: "7bb2830ebd849694d1ec25bf1f44582d6ac531a57a365a803a6034ff751d2d06" + url: "https://pub.dev" + source: hosted + version: "10.0.7" + leak_tracker_flutter_testing: + dependency: transitive + description: + name: leak_tracker_flutter_testing + sha256: "9491a714cca3667b60b5c420da8217e6de0d1ba7a5ec322fab01758f6998f379" + url: "https://pub.dev" + source: hosted + version: "3.0.8" + leak_tracker_testing: + dependency: transitive + description: + name: leak_tracker_testing + sha256: "6ba465d5d76e67ddf503e1161d1f4a6bc42306f9d66ca1e8f079a47290fb06d3" + url: "https://pub.dev" + source: hosted + version: "3.0.1" + lints: + dependency: transitive + description: + name: lints + sha256: cbf8d4b858bb0134ef3ef87841abdf8d63bfc255c266b7bf6b39daa1085c4290 + url: "https://pub.dev" + source: hosted + version: "3.0.0" + matcher: + dependency: transitive + description: + name: matcher + sha256: d2323aa2060500f906aa31a895b4030b6da3ebdcc5619d14ce1aada65cd161cb + url: "https://pub.dev" + source: hosted + version: "0.12.16+1" + material_color_utilities: + dependency: transitive + description: + name: material_color_utilities + sha256: f7142bb1154231d7ea5f96bc7bde4bda2a0945d2806bb11670e30b850d56bdec + url: "https://pub.dev" + source: hosted + version: "0.11.1" + meta: + dependency: transitive + description: + name: meta + sha256: bdb68674043280c3428e9ec998512fb681678676b3c54e773629ffe74419f8c7 + url: "https://pub.dev" + source: hosted + version: "1.15.0" + modular_core: + dependency: transitive + description: + name: modular_core + sha256: "84cfe65d2ab15b0265a5bdb07a7a0408b06f8d92fee6fb94a3c85e97cbc2d6af" + url: "https://pub.dev" + source: hosted + version: "2.0.3+1" + modular_interfaces: + dependency: transitive + description: + name: modular_interfaces + sha256: "89db18038048d63de80871189ddc52363814e8181615459e5d88ed0a921acc1f" + url: "https://pub.dev" + source: hosted + version: "2.0.2" + path: + dependency: transitive + description: + name: path + sha256: "087ce49c3f0dc39180befefc60fdb4acd8f8620e5682fe2476afd0b3688bb4af" + url: "https://pub.dev" + source: hosted + version: "1.9.0" + sky_engine: + dependency: transitive + description: flutter + source: sdk + version: "0.0.0" + source_span: + dependency: transitive + description: + name: source_span + sha256: "53e943d4206a5e30df338fd4c6e7a077e02254531b138a15aec3bd143c1a8b3c" + url: "https://pub.dev" + source: hosted + version: "1.10.0" + stack_trace: + dependency: transitive + description: + name: stack_trace + sha256: "9f47fd3630d76be3ab26f0ee06d213679aa425996925ff3feffdec504931c377" + url: "https://pub.dev" + source: hosted + version: "1.12.0" + stream_channel: + dependency: transitive + description: + name: stream_channel + sha256: ba2aa5d8cc609d96bbb2899c28934f9e1af5cddbd60a827822ea467161eb54e7 + url: "https://pub.dev" + source: hosted + version: "2.1.2" + string_scanner: + dependency: transitive + description: + name: string_scanner + sha256: "688af5ed3402a4bde5b3a6c15fd768dbf2621a614950b17f04626c431ab3c4c3" + url: "https://pub.dev" + source: hosted + version: "1.3.0" + term_glyph: + dependency: transitive + description: + name: term_glyph + sha256: a29248a84fbb7c79282b40b8c72a1209db169a2e0542bce341da992fe1bc7e84 + url: "https://pub.dev" + source: hosted + version: "1.2.1" + test_api: + dependency: transitive + description: + name: test_api + sha256: "664d3a9a64782fcdeb83ce9c6b39e78fd2971d4e37827b9b06c3aa1edc5e760c" + url: "https://pub.dev" + source: hosted + version: "0.7.3" + vector_math: + dependency: transitive + description: + name: vector_math + sha256: "80b3257d1492ce4d091729e3a67a60407d227c27241d6927be0130c98e741803" + url: "https://pub.dev" + source: hosted + version: "2.1.4" + vm_service: + dependency: transitive + description: + name: vm_service + sha256: f6be3ed8bd01289b34d679c2b62226f63c0e69f9fd2e50a6b3c1c729a961041b + url: "https://pub.dev" + source: hosted + version: "14.3.0" +sdks: + dart: ">=3.4.0 <4.0.0" + flutter: ">=3.18.0-18.0.pre.54" diff --git a/packages/instabug_flutter_modular/example/pubspec.yaml b/packages/instabug_flutter_modular/example/pubspec.yaml new file mode 100644 index 000000000..90d6065c0 --- /dev/null +++ b/packages/instabug_flutter_modular/example/pubspec.yaml @@ -0,0 +1,93 @@ +name: flutter_modular_demo_app +description: "Flutter Modular Demo App" +# The following line prevents the package from being accidentally published to +# pub.dev using `flutter pub publish`. This is preferred for private packages. +publish_to: 'none' # Remove this line if you wish to publish to pub.dev + +# The following defines the version and build number for your application. +# A version number is three numbers separated by dots, like 1.2.43 +# followed by an optional build number separated by a +. +# Both the version and the builder number may be overridden in flutter +# build by specifying --build-name and --build-number, respectively. +# In Android, build-name is used as versionName while build-number used as versionCode. +# Read more about Android versioning at https://developer.android.com/studio/publish/versioning +# In iOS, build-name is used as CFBundleShortVersionString while build-number is used as CFBundleVersion. +# Read more about iOS versioning at +# https://developer.apple.com/library/archive/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html +# In Windows, build-name is used as the major, minor, and patch parts +# of the product and file versions while build-number is used as the build suffix. +version: 1.0.0+1 + +environment: + sdk: '>=3.3.0 <4.0.0' + +# Dependencies specify other packages that your package needs in order to work. +# To automatically upgrade your package dependencies to the latest versions +# consider running `flutter pub upgrade --major-versions`. Alternatively, +# dependencies can be manually updated by changing the version numbers below to +# the latest version available on pub.dev. To see which dependencies have newer +# versions available, run `flutter pub outdated`. +dependencies: + flutter: + sdk: flutter + + + # The following adds the Cupertino Icons font to your application. + # Use with the CupertinoIcons class for iOS style icons. + cupertino_icons: ^1.0.6 + instabug_flutter: ^13.2.0 + instabug_flutter_modular: + path: ../ + +dev_dependencies: + flutter_test: + sdk: flutter + + # The "flutter_lints" package below contains a set of recommended lints to + # encourage good coding practices. The lint set provided by the package is + # activated in the `analysis_options.yaml` file located at the root of your + # package. See that file for information about deactivating specific lint + # rules and activating additional ones. + flutter_lints: ^3.0.0 + +# For information on the generic Dart part of this file, see the +# following page: https://dart.dev/tools/pub/pubspec + +# The following section is specific to Flutter packages. +flutter: + + # The following line ensures that the Material Icons font is + # included with your application, so that you can use the icons in + # the material Icons class. + uses-material-design: true + + # To add assets to your application, add an assets section, like this: + # assets: + # - images/a_dot_burr.jpeg + # - images/a_dot_ham.jpeg + + # An image asset can refer to one or more resolution-specific "variants", see + # https://flutter.dev/assets-and-images/#resolution-aware + + # For details regarding adding assets from package dependencies, see + # https://flutter.dev/assets-and-images/#from-packages + + # To add custom fonts to your application, add a fonts section here, + # in this "flutter" section. Each entry in this list should have a + # "family" key with the font family name, and a "fonts" key with a + # list giving the asset and other descriptors for the font. For + # example: + # fonts: + # - family: Schyler + # fonts: + # - asset: fonts/Schyler-Regular.ttf + # - asset: fonts/Schyler-Italic.ttf + # style: italic + # - family: Trajan Pro + # fonts: + # - asset: fonts/TrajanPro.ttf + # - asset: fonts/TrajanPro_Bold.ttf + # weight: 700 + # + # For details regarding fonts from package dependencies, + # see https://flutter.dev/custom-fonts/#from-packages diff --git a/packages/instabug_flutter_modular/example/pubspec_overrides.yaml b/packages/instabug_flutter_modular/example/pubspec_overrides.yaml new file mode 100644 index 000000000..82c9b8e03 --- /dev/null +++ b/packages/instabug_flutter_modular/example/pubspec_overrides.yaml @@ -0,0 +1,6 @@ +# melos_managed_dependency_overrides: instabug_flutter,instabug_flutter_modular +dependency_overrides: + instabug_flutter: + path: ../../instabug_flutter + instabug_flutter_modular: + path: .. diff --git a/packages/instabug_flutter_modular/lib/instabug_flutter_modular.dart b/packages/instabug_flutter_modular/lib/instabug_flutter_modular.dart new file mode 100644 index 000000000..807259b68 --- /dev/null +++ b/packages/instabug_flutter_modular/lib/instabug_flutter_modular.dart @@ -0,0 +1 @@ +export 'src/instabug_module.dart'; diff --git a/packages/instabug_flutter_modular/lib/src/instabug_modular_manager.dart b/packages/instabug_flutter_modular/lib/src/instabug_modular_manager.dart new file mode 100644 index 000000000..d1f8c8ea7 --- /dev/null +++ b/packages/instabug_flutter_modular/lib/src/instabug_modular_manager.dart @@ -0,0 +1,76 @@ +import 'package:flutter_modular/flutter_modular.dart'; +import 'package:instabug_flutter/instabug_flutter.dart'; +import 'package:instabug_flutter_modular/src/instabug_module.dart'; +import 'package:meta/meta.dart'; + +class InstabugModularManager { + InstabugModularManager._(); + + static InstabugModularManager _instance = InstabugModularManager._(); + static InstabugModularManager get instance => _instance; + + /// Shorthand for [instance] + static InstabugModularManager get I => instance; + + @visibleForTesting + // ignore: use_setters_to_change_properties + static void setInstance(InstabugModularManager instance) { + _instance = instance; + } + + List wrapRoutes( + List routes, { + String parent = '/', + bool wrapModules = true, + }) { + return routes + .map( + (route) => wrapRoute( + route, + parent: parent, + wrapModules: wrapModules, + ), + ) + .toList(); + } + + ModularRoute wrapRoute( + ModularRoute route, { + String parent = '/', + bool wrapModules = true, + }) { + final fullPath = (parent + route.name).replaceFirst('//', '/'); + + if (route is ModuleRoute && route.context is Module && wrapModules) { + final module = InstabugModule( + route.context! as Module, + path: fullPath, + ); + + return route.addModule( + route.name, + module: module, + ); + } else if (route is ParallelRoute && route is! ModuleRoute) { + ModularChild? child; + + if (route.child != null) { + child = (context, args) => InstabugCaptureScreenLoading( + screenName: fullPath, + child: route.child!(context, args), + ); + } + + return route.copyWith( + child: child, + children: wrapRoutes( + route.children, + parent: fullPath, + wrapModules: wrapModules, + ), + ); + } + + return route; + } +} diff --git a/packages/instabug_flutter_modular/lib/src/instabug_module.dart b/packages/instabug_flutter_modular/lib/src/instabug_module.dart new file mode 100644 index 000000000..dc56fb171 --- /dev/null +++ b/packages/instabug_flutter_modular/lib/src/instabug_module.dart @@ -0,0 +1,28 @@ +import 'package:flutter_modular/flutter_modular.dart'; +import 'package:instabug_flutter_modular/src/instabug_modular_manager.dart'; + +class InstabugModule extends Module { + final Module module; + final String path; + final List _routes; + + InstabugModule(this.module, {this.path = '/'}) + : _routes = InstabugModularManager.I.wrapRoutes( + module.routes, + parent: path, + ); + + @override + List get imports => module.imports; + + @override + List get binds => module.binds; + + @override + List get routes => _routes; + + // Override the runtime type to return the module's runtime type as Flutter + // Modular maps context bindings by their runtime type. + @override + Type get runtimeType => module.runtimeType; +} diff --git a/packages/instabug_flutter_modular/pubspec.lock b/packages/instabug_flutter_modular/pubspec.lock new file mode 100644 index 000000000..0934f0bda --- /dev/null +++ b/packages/instabug_flutter_modular/pubspec.lock @@ -0,0 +1,753 @@ +# Generated by pub +# See https://dart.dev/tools/pub/glossary#lockfile +packages: + _fe_analyzer_shared: + dependency: transitive + description: + name: _fe_analyzer_shared + sha256: "16e298750b6d0af7ce8a3ba7c18c69c3785d11b15ec83f6dcd0ad2a0009b3cab" + url: "https://pub.dev" + source: hosted + version: "76.0.0" + _macros: + dependency: transitive + description: dart + source: sdk + version: "0.3.3" + analyzer: + dependency: transitive + description: + name: analyzer + sha256: "1f14db053a8c23e260789e9b0980fa27f2680dd640932cae5e1137cce0e46e1e" + url: "https://pub.dev" + source: hosted + version: "6.11.0" + args: + dependency: transitive + description: + name: args + sha256: bf9f5caeea8d8fe6721a9c358dd8a5c1947b27f1cfaa18b39c301273594919e6 + url: "https://pub.dev" + source: hosted + version: "2.6.0" + async: + dependency: transitive + description: + name: async + sha256: "947bfcf187f74dbc5e146c9eb9c0f10c9f8b30743e341481c1e2ed3ecc18c20c" + url: "https://pub.dev" + source: hosted + version: "2.11.0" + boolean_selector: + dependency: transitive + description: + name: boolean_selector + sha256: "6cfb5af12253eaf2b368f07bacc5a80d1301a071c73360d746b7f2e32d762c66" + url: "https://pub.dev" + source: hosted + version: "2.1.1" + build: + dependency: transitive + description: + name: build + sha256: "80184af8b6cb3e5c1c4ec6d8544d27711700bc3e6d2efad04238c7b5290889f0" + url: "https://pub.dev" + source: hosted + version: "2.4.1" + build_config: + dependency: transitive + description: + name: build_config + sha256: bf80fcfb46a29945b423bd9aad884590fb1dc69b330a4d4700cac476af1708d1 + url: "https://pub.dev" + source: hosted + version: "1.1.1" + build_daemon: + dependency: transitive + description: + name: build_daemon + sha256: "79b2aef6ac2ed00046867ed354c88778c9c0f029df8a20fe10b5436826721ef9" + url: "https://pub.dev" + source: hosted + version: "4.0.2" + build_resolvers: + dependency: transitive + description: + name: build_resolvers + sha256: "339086358431fa15d7eca8b6a36e5d783728cf025e559b834f4609a1fcfb7b0a" + url: "https://pub.dev" + source: hosted + version: "2.4.2" + build_runner: + dependency: "direct dev" + description: + name: build_runner + sha256: "028819cfb90051c6b5440c7e574d1896f8037e3c96cf17aaeb054c9311cfbf4d" + url: "https://pub.dev" + source: hosted + version: "2.4.13" + build_runner_core: + dependency: transitive + description: + name: build_runner_core + sha256: f8126682b87a7282a339b871298cc12009cb67109cfa1614d6436fb0289193e0 + url: "https://pub.dev" + source: hosted + version: "7.3.2" + built_collection: + dependency: transitive + description: + name: built_collection + sha256: "376e3dd27b51ea877c28d525560790aee2e6fbb5f20e2f85d5081027d94e2100" + url: "https://pub.dev" + source: hosted + version: "5.1.1" + built_value: + dependency: transitive + description: + name: built_value + sha256: c7913a9737ee4007efedaffc968c049fd0f3d0e49109e778edc10de9426005cb + url: "https://pub.dev" + source: hosted + version: "8.9.2" + characters: + dependency: transitive + description: + name: characters + sha256: "04a925763edad70e8443c99234dc3328f442e811f1d8fd1a72f1c8ad0f69a605" + url: "https://pub.dev" + source: hosted + version: "1.3.0" + checked_yaml: + dependency: transitive + description: + name: checked_yaml + sha256: feb6bed21949061731a7a75fc5d2aa727cf160b91af9a3e464c5e3a32e28b5ff + url: "https://pub.dev" + source: hosted + version: "2.0.3" + cli_util: + dependency: transitive + description: + name: cli_util + sha256: ff6785f7e9e3c38ac98b2fb035701789de90154024a75b6cb926445e83197d1c + url: "https://pub.dev" + source: hosted + version: "0.4.2" + clock: + dependency: transitive + description: + name: clock + sha256: cb6d7f03e1de671e34607e909a7213e31d7752be4fb66a86d29fe1eb14bfb5cf + url: "https://pub.dev" + source: hosted + version: "1.1.1" + code_builder: + dependency: transitive + description: + name: code_builder + sha256: "0ec10bf4a89e4c613960bf1e8b42c64127021740fb21640c29c909826a5eea3e" + url: "https://pub.dev" + source: hosted + version: "4.10.1" + collection: + dependency: transitive + description: + name: collection + sha256: a1ace0a119f20aabc852d165077c036cd864315bd99b7eaa10a60100341941bf + url: "https://pub.dev" + source: hosted + version: "1.19.0" + convert: + dependency: transitive + description: + name: convert + sha256: b30acd5944035672bc15c6b7a8b47d773e41e2f17de064350988c5d02adb1c68 + url: "https://pub.dev" + source: hosted + version: "3.1.2" + coverage: + dependency: transitive + description: + name: coverage + sha256: "4b03e11f6d5b8f6e5bb5e9f7889a56fe6c5cbe942da5378ea4d4d7f73ef9dfe5" + url: "https://pub.dev" + source: hosted + version: "1.11.0" + crypto: + dependency: transitive + description: + name: crypto + sha256: "1e445881f28f22d6140f181e07737b22f1e099a5e1ff94b0af2f9e4a463f4855" + url: "https://pub.dev" + source: hosted + version: "3.0.6" + csslib: + dependency: transitive + description: + name: csslib + sha256: "09bad715f418841f976c77db72d5398dc1253c21fb9c0c7f0b0b985860b2d58e" + url: "https://pub.dev" + source: hosted + version: "1.0.2" + dart_style: + dependency: transitive + description: + name: dart_style + sha256: "7856d364b589d1f08986e140938578ed36ed948581fbc3bc9aef1805039ac5ab" + url: "https://pub.dev" + source: hosted + version: "2.3.7" + fake_async: + dependency: transitive + description: + name: fake_async + sha256: "511392330127add0b769b75a987850d136345d9227c6b94c96a04cf4a391bf78" + url: "https://pub.dev" + source: hosted + version: "1.3.1" + file: + dependency: transitive + description: + name: file + sha256: a3b4f84adafef897088c160faf7dfffb7696046cb13ae90b508c2cbc95d3b8d4 + url: "https://pub.dev" + source: hosted + version: "7.0.1" + fixnum: + dependency: transitive + description: + name: fixnum + sha256: b6dc7065e46c974bc7c5f143080a6764ec7a4be6da1285ececdc37be96de53be + url: "https://pub.dev" + source: hosted + version: "1.1.1" + flutter: + dependency: "direct main" + description: flutter + source: sdk + version: "0.0.0" + flutter_lints: + dependency: "direct dev" + description: + name: flutter_lints + sha256: a25a15ebbdfc33ab1cd26c63a6ee519df92338a9c10f122adda92938253bef04 + url: "https://pub.dev" + source: hosted + version: "2.0.3" + flutter_modular: + dependency: "direct main" + description: + name: flutter_modular + sha256: "061f0bcc8f8c438d4c82f4ff70a9e61f109961c92b4e1eaf1bbfab75f577fe0e" + url: "https://pub.dev" + source: hosted + version: "5.0.3" + flutter_modular_annotations: + dependency: transitive + description: + name: flutter_modular_annotations + sha256: "65971655bdd30816a6a66651c801f4ceba6c8ba265f0866cc51ad038332c9a71" + url: "https://pub.dev" + source: hosted + version: "0.0.2" + flutter_test: + dependency: "direct dev" + description: flutter + source: sdk + version: "0.0.0" + frontend_server_client: + dependency: transitive + description: + name: frontend_server_client + sha256: f64a0333a82f30b0cca061bc3d143813a486dc086b574bfb233b7c1372427694 + url: "https://pub.dev" + source: hosted + version: "4.0.0" + glob: + dependency: transitive + description: + name: glob + sha256: "0e7014b3b7d4dac1ca4d6114f82bf1782ee86745b9b42a92c9289c23d8a0ab63" + url: "https://pub.dev" + source: hosted + version: "2.1.2" + graphs: + dependency: transitive + description: + name: graphs + sha256: "741bbf84165310a68ff28fe9e727332eef1407342fca52759cb21ad8177bb8d0" + url: "https://pub.dev" + source: hosted + version: "2.3.2" + html: + dependency: transitive + description: + name: html + sha256: "1fc58edeaec4307368c60d59b7e15b9d658b57d7f3125098b6294153c75337ec" + url: "https://pub.dev" + source: hosted + version: "0.15.5" + http: + dependency: transitive + description: + name: http + sha256: b9c29a161230ee03d3ccf545097fccd9b87a5264228c5d348202e0f0c28f9010 + url: "https://pub.dev" + source: hosted + version: "1.2.2" + http_multi_server: + dependency: transitive + description: + name: http_multi_server + sha256: "97486f20f9c2f7be8f514851703d0119c3596d14ea63227af6f7a481ef2b2f8b" + url: "https://pub.dev" + source: hosted + version: "3.2.1" + http_parser: + dependency: transitive + description: + name: http_parser + sha256: "2aa08ce0341cc9b354a498388e30986515406668dbcc4f7c950c3e715496693b" + url: "https://pub.dev" + source: hosted + version: "4.0.2" + instabug_flutter: + dependency: "direct main" + description: + path: "../instabug_flutter" + relative: true + source: path + version: "15.0.2" + io: + dependency: transitive + description: + name: io + sha256: "2ec25704aba361659e10e3e5f5d672068d332fc8ac516421d483a11e5cbd061e" + url: "https://pub.dev" + source: hosted + version: "1.0.4" + js: + dependency: transitive + description: + name: js + sha256: c1b2e9b5ea78c45e1a0788d29606ba27dc5f71f019f32ca5140f61ef071838cf + url: "https://pub.dev" + source: hosted + version: "0.7.1" + json_annotation: + dependency: transitive + description: + name: json_annotation + sha256: "1ce844379ca14835a50d2f019a3099f419082cfdd231cd86a142af94dd5c6bb1" + url: "https://pub.dev" + source: hosted + version: "4.9.0" + leak_tracker: + dependency: transitive + description: + name: leak_tracker + sha256: "7bb2830ebd849694d1ec25bf1f44582d6ac531a57a365a803a6034ff751d2d06" + url: "https://pub.dev" + source: hosted + version: "10.0.7" + leak_tracker_flutter_testing: + dependency: transitive + description: + name: leak_tracker_flutter_testing + sha256: "9491a714cca3667b60b5c420da8217e6de0d1ba7a5ec322fab01758f6998f379" + url: "https://pub.dev" + source: hosted + version: "3.0.8" + leak_tracker_testing: + dependency: transitive + description: + name: leak_tracker_testing + sha256: "6ba465d5d76e67ddf503e1161d1f4a6bc42306f9d66ca1e8f079a47290fb06d3" + url: "https://pub.dev" + source: hosted + version: "3.0.1" + lints: + dependency: transitive + description: + name: lints + sha256: "0a217c6c989d21039f1498c3ed9f3ed71b354e69873f13a8dfc3c9fe76f1b452" + url: "https://pub.dev" + source: hosted + version: "2.1.1" + logging: + dependency: transitive + description: + name: logging + sha256: c8245ada5f1717ed44271ed1c26b8ce85ca3228fd2ffdb75468ab01979309d61 + url: "https://pub.dev" + source: hosted + version: "1.3.0" + macros: + dependency: transitive + description: + name: macros + sha256: "1d9e801cd66f7ea3663c45fc708450db1fa57f988142c64289142c9b7ee80656" + url: "https://pub.dev" + source: hosted + version: "0.1.3-main.0" + markdown: + dependency: transitive + description: + name: markdown + sha256: ef2a1298144e3f985cc736b22e0ccdaf188b5b3970648f2d9dc13efd1d9df051 + url: "https://pub.dev" + source: hosted + version: "7.2.2" + matcher: + dependency: transitive + description: + name: matcher + sha256: d2323aa2060500f906aa31a895b4030b6da3ebdcc5619d14ce1aada65cd161cb + url: "https://pub.dev" + source: hosted + version: "0.12.16+1" + material_color_utilities: + dependency: transitive + description: + name: material_color_utilities + sha256: f7142bb1154231d7ea5f96bc7bde4bda2a0945d2806bb11670e30b850d56bdec + url: "https://pub.dev" + source: hosted + version: "0.11.1" + meta: + dependency: "direct main" + description: + name: meta + sha256: bdb68674043280c3428e9ec998512fb681678676b3c54e773629ffe74419f8c7 + url: "https://pub.dev" + source: hosted + version: "1.15.0" + mime: + dependency: transitive + description: + name: mime + sha256: "41a20518f0cb1256669420fdba0cd90d21561e560ac240f26ef8322e45bb7ed6" + url: "https://pub.dev" + source: hosted + version: "2.0.0" + mockito: + dependency: "direct dev" + description: + name: mockito + sha256: "6841eed20a7befac0ce07df8116c8b8233ed1f4486a7647c7fc5a02ae6163917" + url: "https://pub.dev" + source: hosted + version: "5.4.4" + modular_core: + dependency: "direct dev" + description: + name: modular_core + sha256: "84cfe65d2ab15b0265a5bdb07a7a0408b06f8d92fee6fb94a3c85e97cbc2d6af" + url: "https://pub.dev" + source: hosted + version: "2.0.3+1" + modular_interfaces: + dependency: transitive + description: + name: modular_interfaces + sha256: "89db18038048d63de80871189ddc52363814e8181615459e5d88ed0a921acc1f" + url: "https://pub.dev" + source: hosted + version: "2.0.2" + node_preamble: + dependency: transitive + description: + name: node_preamble + sha256: "6e7eac89047ab8a8d26cf16127b5ed26de65209847630400f9aefd7cd5c730db" + url: "https://pub.dev" + source: hosted + version: "2.0.2" + package_config: + dependency: transitive + description: + name: package_config + sha256: "1c5b77ccc91e4823a5af61ee74e6b972db1ef98c2ff5a18d3161c982a55448bd" + url: "https://pub.dev" + source: hosted + version: "2.1.0" + pana: + dependency: "direct dev" + description: + name: pana + sha256: "6f4372d5d2af5fe3fc6491c18f575601743bceb8433c7f179a6fffd162ee55f1" + url: "https://pub.dev" + source: hosted + version: "0.21.39" + path: + dependency: transitive + description: + name: path + sha256: "087ce49c3f0dc39180befefc60fdb4acd8f8620e5682fe2476afd0b3688bb4af" + url: "https://pub.dev" + source: hosted + version: "1.9.0" + pool: + dependency: transitive + description: + name: pool + sha256: "20fe868b6314b322ea036ba325e6fc0711a22948856475e2c2b6306e8ab39c2a" + url: "https://pub.dev" + source: hosted + version: "1.5.1" + pub_semver: + dependency: transitive + description: + name: pub_semver + sha256: "40d3ab1bbd474c4c2328c91e3a7df8c6dd629b79ece4c4bd04bee496a224fb0c" + url: "https://pub.dev" + source: hosted + version: "2.1.4" + pubspec_parse: + dependency: transitive + description: + name: pubspec_parse + sha256: c799b721d79eb6ee6fa56f00c04b472dcd44a30d258fac2174a6ec57302678f8 + url: "https://pub.dev" + source: hosted + version: "1.3.0" + retry: + dependency: transitive + description: + name: retry + sha256: "822e118d5b3aafed083109c72d5f484c6dc66707885e07c0fbcb8b986bba7efc" + url: "https://pub.dev" + source: hosted + version: "3.1.2" + safe_url_check: + dependency: transitive + description: + name: safe_url_check + sha256: "49a3e060a7869cbafc8f4845ca1ecbbaaa53179980a32f4fdfeab1607e90f41d" + url: "https://pub.dev" + source: hosted + version: "1.1.2" + shelf: + dependency: transitive + description: + name: shelf + sha256: ad29c505aee705f41a4d8963641f91ac4cee3c8fad5947e033390a7bd8180fa4 + url: "https://pub.dev" + source: hosted + version: "1.4.1" + shelf_packages_handler: + dependency: transitive + description: + name: shelf_packages_handler + sha256: "89f967eca29607c933ba9571d838be31d67f53f6e4ee15147d5dc2934fee1b1e" + url: "https://pub.dev" + source: hosted + version: "3.0.2" + shelf_static: + dependency: transitive + description: + name: shelf_static + sha256: c87c3875f91262785dade62d135760c2c69cb217ac759485334c5857ad89f6e3 + url: "https://pub.dev" + source: hosted + version: "1.1.3" + shelf_web_socket: + dependency: transitive + description: + name: shelf_web_socket + sha256: cc36c297b52866d203dbf9332263c94becc2fe0ceaa9681d07b6ef9807023b67 + url: "https://pub.dev" + source: hosted + version: "2.0.1" + sky_engine: + dependency: transitive + description: flutter + source: sdk + version: "0.0.0" + source_gen: + dependency: transitive + description: + name: source_gen + sha256: "14658ba5f669685cd3d63701d01b31ea748310f7ab854e471962670abcf57832" + url: "https://pub.dev" + source: hosted + version: "1.5.0" + source_map_stack_trace: + dependency: transitive + description: + name: source_map_stack_trace + sha256: c0713a43e323c3302c2abe2a1cc89aa057a387101ebd280371d6a6c9fa68516b + url: "https://pub.dev" + source: hosted + version: "2.1.2" + source_maps: + dependency: transitive + description: + name: source_maps + sha256: "708b3f6b97248e5781f493b765c3337db11c5d2c81c3094f10904bfa8004c703" + url: "https://pub.dev" + source: hosted + version: "0.10.12" + source_span: + dependency: transitive + description: + name: source_span + sha256: "53e943d4206a5e30df338fd4c6e7a077e02254531b138a15aec3bd143c1a8b3c" + url: "https://pub.dev" + source: hosted + version: "1.10.0" + stack_trace: + dependency: transitive + description: + name: stack_trace + sha256: "9f47fd3630d76be3ab26f0ee06d213679aa425996925ff3feffdec504931c377" + url: "https://pub.dev" + source: hosted + version: "1.12.0" + stream_channel: + dependency: transitive + description: + name: stream_channel + sha256: ba2aa5d8cc609d96bbb2899c28934f9e1af5cddbd60a827822ea467161eb54e7 + url: "https://pub.dev" + source: hosted + version: "2.1.2" + stream_transform: + dependency: transitive + description: + name: stream_transform + sha256: "14a00e794c7c11aa145a170587321aedce29769c08d7f58b1d141da75e3b1c6f" + url: "https://pub.dev" + source: hosted + version: "2.1.0" + string_scanner: + dependency: transitive + description: + name: string_scanner + sha256: "688af5ed3402a4bde5b3a6c15fd768dbf2621a614950b17f04626c431ab3c4c3" + url: "https://pub.dev" + source: hosted + version: "1.3.0" + tar: + dependency: transitive + description: + name: tar + sha256: "22f67e2d77b51050436620b2a5de521c58ca6f0b75af1d9ab3c8cae2eae58fcd" + url: "https://pub.dev" + source: hosted + version: "1.0.5" + term_glyph: + dependency: transitive + description: + name: term_glyph + sha256: a29248a84fbb7c79282b40b8c72a1209db169a2e0542bce341da992fe1bc7e84 + url: "https://pub.dev" + source: hosted + version: "1.2.1" + test: + dependency: transitive + description: + name: test + sha256: "713a8789d62f3233c46b4a90b174737b2c04cb6ae4500f2aa8b1be8f03f5e67f" + url: "https://pub.dev" + source: hosted + version: "1.25.8" + test_api: + dependency: transitive + description: + name: test_api + sha256: "664d3a9a64782fcdeb83ce9c6b39e78fd2971d4e37827b9b06c3aa1edc5e760c" + url: "https://pub.dev" + source: hosted + version: "0.7.3" + test_core: + dependency: transitive + description: + name: test_core + sha256: "12391302411737c176b0b5d6491f466b0dd56d4763e347b6714efbaa74d7953d" + url: "https://pub.dev" + source: hosted + version: "0.6.5" + timing: + dependency: transitive + description: + name: timing + sha256: "70a3b636575d4163c477e6de42f247a23b315ae20e86442bebe32d3cabf61c32" + url: "https://pub.dev" + source: hosted + version: "1.0.1" + typed_data: + dependency: transitive + description: + name: typed_data + sha256: f9049c039ebfeb4cf7a7104a675823cd72dba8297f264b6637062516699fa006 + url: "https://pub.dev" + source: hosted + version: "1.4.0" + vector_math: + dependency: transitive + description: + name: vector_math + sha256: "80b3257d1492ce4d091729e3a67a60407d227c27241d6927be0130c98e741803" + url: "https://pub.dev" + source: hosted + version: "2.1.4" + vm_service: + dependency: transitive + description: + name: vm_service + sha256: f6be3ed8bd01289b34d679c2b62226f63c0e69f9fd2e50a6b3c1c729a961041b + url: "https://pub.dev" + source: hosted + version: "14.3.0" + watcher: + dependency: transitive + description: + name: watcher + sha256: "3d2ad6751b3c16cf07c7fca317a1413b3f26530319181b37e3b9039b84fc01d8" + url: "https://pub.dev" + source: hosted + version: "1.1.0" + web: + dependency: transitive + description: + name: web + sha256: cd3543bd5798f6ad290ea73d210f423502e71900302dde696f8bff84bf89a1cb + url: "https://pub.dev" + source: hosted + version: "1.1.0" + web_socket: + dependency: transitive + description: + name: web_socket + sha256: "3c12d96c0c9a4eec095246debcea7b86c0324f22df69893d538fcc6f1b8cce83" + url: "https://pub.dev" + source: hosted + version: "0.1.6" + web_socket_channel: + dependency: transitive + description: + name: web_socket_channel + sha256: "9f187088ed104edd8662ca07af4b124465893caf063ba29758f97af57e61da8f" + url: "https://pub.dev" + source: hosted + version: "3.0.1" + webkit_inspection_protocol: + dependency: transitive + description: + name: webkit_inspection_protocol + sha256: "87d3f2333bb240704cd3f1c6b5b7acd8a10e7f0bc28c28dcf14e782014f4a572" + url: "https://pub.dev" + source: hosted + version: "1.2.1" + yaml: + dependency: transitive + description: + name: yaml + sha256: "75769501ea3489fca56601ff33454fe45507ea3bfb014161abc3b43ae25989d5" + url: "https://pub.dev" + source: hosted + version: "3.1.2" +sdks: + dart: ">=3.5.0 <4.0.0" + flutter: ">=3.18.0-18.0.pre.54" diff --git a/packages/instabug_flutter_modular/pubspec.yaml b/packages/instabug_flutter_modular/pubspec.yaml new file mode 100644 index 000000000..4015404b9 --- /dev/null +++ b/packages/instabug_flutter_modular/pubspec.yaml @@ -0,0 +1,27 @@ +name: instabug_flutter_modular +description: An add-on for the Instabug Flutter SDK that provides screen loading support for Flutter Modular v5. +version: 1.0.0 +homepage: https://www.instabug.com +repository: https://github.com/Instabug/Instabug-Flutter/tree/refactor/monorepo/packages/instabug_flutter_modular + +environment: + sdk: '>=3.1.2 <4.0.0' + flutter: ">=1.17.0" + +dependencies: + flutter: + sdk: flutter + flutter_modular: '>=5.0.0 <6.0.0' + instabug_flutter: '>=13.2.0 <14.0.0' + meta: ^1.3.0 + +dev_dependencies: + build_runner: ^2.0.3 + flutter_lints: ^2.0.0 + flutter_test: + sdk: flutter + # mockito v5.2.0 is needed for running Flutter 2 tests on CI + mockito: '>=5.2.0 <=5.4.4' + # A specific version isn't specified as we want to use the version used in flutter_modular + modular_core: + pana: ^0.21.0 diff --git a/packages/instabug_flutter_modular/pubspec_overrides.yaml b/packages/instabug_flutter_modular/pubspec_overrides.yaml new file mode 100644 index 000000000..1f0beaf62 --- /dev/null +++ b/packages/instabug_flutter_modular/pubspec_overrides.yaml @@ -0,0 +1,4 @@ +# melos_managed_dependency_overrides: instabug_flutter +dependency_overrides: + instabug_flutter: + path: ../instabug_flutter diff --git a/packages/instabug_flutter_modular/release.sh b/packages/instabug_flutter_modular/release.sh new file mode 100755 index 000000000..b30831736 --- /dev/null +++ b/packages/instabug_flutter_modular/release.sh @@ -0,0 +1,13 @@ +#!/bin/sh +VERSION=$(egrep -o "version: ([0-9]-*.*)+[0-9]" pubspec.yaml | cut -d ":" -f 2) +if [ ! "${VERSION}" ] || [ -z "${VERSION}" ];then + echo "Instabug: err: Version Number not found." + exit 1 +else + mkdir -p $HOME/.config/dart + cat < $HOME/.config/dart/pub-credentials.json + ${PUB_CREDENTIALS} + +EOF + flutter packages pub publish -f +fi \ No newline at end of file diff --git a/packages/instabug_flutter_modular/test/src/instabug_modular_manager_test.dart b/packages/instabug_flutter_modular/test/src/instabug_modular_manager_test.dart new file mode 100644 index 000000000..85b4aa011 --- /dev/null +++ b/packages/instabug_flutter_modular/test/src/instabug_modular_manager_test.dart @@ -0,0 +1,201 @@ +// ignore_for_file: avoid_dynamic_calls + +import 'package:flutter/widgets.dart'; +import 'package:flutter_modular/flutter_modular.dart'; +import 'package:flutter_test/flutter_test.dart'; +import 'package:instabug_flutter/instabug_flutter.dart'; +import 'package:instabug_flutter_modular/instabug_flutter_modular.dart'; +import 'package:instabug_flutter_modular/src/instabug_modular_manager.dart'; +import 'package:mockito/annotations.dart'; +import 'package:modular_core/modular_core.dart'; + +import 'instabug_modular_manager_test.mocks.dart'; + +@GenerateNiceMocks([ + MockSpec(), + MockSpec(), + MockSpec(), + MockSpec(), + MockSpec(), + MockSpec(), +]) +void main() { + late MockInstabugModule mockInstabugModule; + late MockModule mockModule; + late MockWidget mockWidget; + late MockBuildContext mockContext; + late MockModularArguments mockArgs; + + setUp(() { + mockInstabugModule = MockInstabugModule(); + mockModule = MockModule(); + mockWidget = MockWidget(); + mockContext = MockBuildContext(); + mockArgs = MockModularArguments(); + }); + + test('[wrapRoutes] with simple list', () { + // Arrange + final routes = [ + ChildRoute('/home', child: (_, __) => mockWidget), + ModuleRoute('/profile', module: mockModule), + ]; + + // Act + final wrappedRoutes = InstabugModularManager.instance.wrapRoutes(routes); + + // Assert + expect(wrappedRoutes.length, 2); + expect(wrappedRoutes[0].name, '/home'); + expect(wrappedRoutes[1].name, '/profile'); + }); + + test('[wrapRoutes] with nested route', () { + // Arrange + final routes = [ + ChildRoute( + '/users', + child: (_, __) => mockWidget, + children: [ + ModuleRoute('/list', module: mockModule), + ModuleRoute('/details', module: mockModule), + ], + ), + ]; + + // Act + final wrappedRoutes = InstabugModularManager.instance.wrapRoutes(routes); + + // Assert + expect(wrappedRoutes.length, 1); + expect(wrappedRoutes[0].name, '/users'); + expect(wrappedRoutes[0].children.length, 2); + expect(wrappedRoutes[0].children[0].name, '/list'); + expect(wrappedRoutes[0].children[1].name, '/details'); + }); + + test('[wrapRoute] with [ModuleRoute] should wrap with [InstabugModule]', () { + // Arrange + final route = ModuleRoute('/home', module: mockInstabugModule); + + // Act + final wrappedRoute = + InstabugModularManager.instance.wrapRoute(route) as dynamic; + + // Assert + expect(wrappedRoute.name, '/home'); + expect(wrappedRoute.context.module, isA()); + }); + + test( + '[wrapRoute] with [ParallelRoute] should wrap child with [InstabugCaptureScreenLoading]', + () { + // Arrange + final route = ChildRoute( + '/profile', + child: (context, args) => mockWidget, + ); + + // Act + final wrappedRoute = + InstabugModularManager.instance.wrapRoute(route) as dynamic; + + final widget = wrappedRoute.child(mockContext, mockArgs); + + // Assert + expect(wrappedRoute.name, '/profile'); + expect(widget, isA()); + }); + + test( + '[wrapRoutes] should wrap child property with [InstabugCaptureScreenLoading] and preserve the rest of its properties', + () { + // Arrange + final customTransition = MockCustomTransition(); + const duration = Duration.zero; + final guards = []; + const transition = TransitionType.downToUp; + + final homeRoute = ChildRoute( + '/home', + child: (context, args) => mockWidget, + customTransition: customTransition, + duration: duration, + guards: guards, + transition: transition, + ); + + final profileRoute = ChildRoute( + '/profile', + child: (context, args) => mockWidget, + customTransition: customTransition, + duration: duration, + guards: guards, + transition: transition, + ); + final routes = [homeRoute, profileRoute]; + + // Act + final wrappedRoutes = + InstabugModularManager.instance.wrapRoutes(routes) as List; + + for (final element in wrappedRoutes) { + final widget = element.child(mockContext, mockArgs); + + // Assert + expect(widget, isA()); + expect(element.customTransition, customTransition); + expect(element.duration, duration); + expect(element.transition, transition); + } + }); + + test('[wrapRoutes] with nested route', () { + // Arrange + final routes = [ + ChildRoute( + '/users', + child: (_, __) => mockWidget, + children: [ + ModuleRoute('/list', module: mockModule), + ModuleRoute('/details', module: mockModule), + ], + ), + ]; + + // Act + final wrappedRoutes = InstabugModularManager.instance.wrapRoutes(routes); + + // Assert + expect(wrappedRoutes.length, 1); + expect(wrappedRoutes[0].name, '/users'); + expect(wrappedRoutes[0].children.length, 2); + expect(wrappedRoutes[0].children[0].name, '/list'); + expect(wrappedRoutes[0].children[1].name, '/details'); + }); + + test('[wrapRoute] with custom parent path should add it to the path', () { + // Arrange + final route = ModuleRoute('/home', module: mockModule); + + // Act + final wrappedRoute = InstabugModularManager.instance + .wrapRoute(route, parent: '/users') as dynamic; + + // Assert + expect(wrappedRoute.context.path, '/users/home'); + }); + + test('[wrapRoute] with wrapModules set to false', () { + // Arrange + final route = ModuleRoute('/home', module: mockModule); + + // Act + final wrappedRoute = InstabugModularManager.instance + .wrapRoute(route, wrapModules: false) as dynamic; + + // Assert + expect(wrappedRoute.name, '/home'); + expect(wrappedRoute.context.module, isA()); + }); +} diff --git a/packages/instabug_http_client/CHANGELOG.md b/packages/instabug_http_client/CHANGELOG.md new file mode 100644 index 000000000..8abeafe73 --- /dev/null +++ b/packages/instabug_http_client/CHANGELOG.md @@ -0,0 +1,49 @@ +# Changelog + +## [2.6.0] (2025-07-17) + +### Added +- supports Instabug SDK above 3.0.0 ([#24](https://github.com/Instabug/Instabug-Dart-http-Adapter/pull/24)). + +## [2.5.1] - 22/04/2025 + +### Added + +- supports Dart versions above 3.0.0 ([#23](https://github.com/Instabug/Instabug-Dart-http-Adapter/pull/23)). + +## [2.5.0] - 18/11/2024 + +### Added + +- Add support for tracing network requests from Instabug to services like Datadog and New Relic ([#21](https://github.com/Instabug/Instabug-Dart-http-Adapter/pull/21)). + +## [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. diff --git a/packages/instabug_http_client/LICENSE b/packages/instabug_http_client/LICENSE new file mode 100644 index 000000000..80d729766 --- /dev/null +++ b/packages/instabug_http_client/LICENSE @@ -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. \ No newline at end of file diff --git a/packages/instabug_http_client/README.md b/packages/instabug_http_client/README.md new file mode 100644 index 000000000..c367d4e8b --- /dev/null +++ b/packages/instabug_http_client/README.md @@ -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)); +``` diff --git a/packages/instabug_http_client/example/.metadata b/packages/instabug_http_client/example/.metadata new file mode 100644 index 000000000..5a023280a --- /dev/null +++ b/packages/instabug_http_client/example/.metadata @@ -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 diff --git a/packages/instabug_http_client/example/README.md b/packages/instabug_http_client/example/README.md new file mode 100644 index 000000000..a13562602 --- /dev/null +++ b/packages/instabug_http_client/example/README.md @@ -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. diff --git a/example/analysis_options.yaml b/packages/instabug_http_client/example/analysis_options.yaml similarity index 93% rename from example/analysis_options.yaml rename to packages/instabug_http_client/example/analysis_options.yaml index 0d2902135..61b6c4de1 100644 --- a/example/analysis_options.yaml +++ b/packages/instabug_http_client/example/analysis_options.yaml @@ -13,7 +13,8 @@ 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.dev/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 diff --git a/packages/instabug_http_client/example/android/.gitignore b/packages/instabug_http_client/example/android/.gitignore new file mode 100644 index 000000000..6f568019d --- /dev/null +++ b/packages/instabug_http_client/example/android/.gitignore @@ -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 diff --git a/packages/instabug_http_client/example/android/app/build.gradle b/packages/instabug_http_client/example/android/app/build.gradle new file mode 100644 index 000000000..5fe3c929f --- /dev/null +++ b/packages/instabug_http_client/example/android/app/build.gradle @@ -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" +} diff --git a/packages/instabug_http_client/example/android/app/src/debug/AndroidManifest.xml b/packages/instabug_http_client/example/android/app/src/debug/AndroidManifest.xml new file mode 100644 index 000000000..c208884f3 --- /dev/null +++ b/packages/instabug_http_client/example/android/app/src/debug/AndroidManifest.xml @@ -0,0 +1,7 @@ + + + + diff --git a/packages/instabug_http_client/example/android/app/src/main/AndroidManifest.xml b/packages/instabug_http_client/example/android/app/src/main/AndroidManifest.xml new file mode 100644 index 000000000..da82b5dba --- /dev/null +++ b/packages/instabug_http_client/example/android/app/src/main/AndroidManifest.xml @@ -0,0 +1,36 @@ + + + + + + + + + + + + + + diff --git a/packages/instabug_http_client/example/android/app/src/main/java/io/flutter/app/FlutterMultiDexApplication.java b/packages/instabug_http_client/example/android/app/src/main/java/io/flutter/app/FlutterMultiDexApplication.java new file mode 100644 index 000000000..9213f130f --- /dev/null +++ b/packages/instabug_http_client/example/android/app/src/main/java/io/flutter/app/FlutterMultiDexApplication.java @@ -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); + } +} diff --git a/packages/instabug_http_client/example/android/app/src/main/kotlin/com/example/example/MainActivity.kt b/packages/instabug_http_client/example/android/app/src/main/kotlin/com/example/example/MainActivity.kt new file mode 100644 index 000000000..e793a000d --- /dev/null +++ b/packages/instabug_http_client/example/android/app/src/main/kotlin/com/example/example/MainActivity.kt @@ -0,0 +1,6 @@ +package com.example.example + +import io.flutter.embedding.android.FlutterActivity + +class MainActivity: FlutterActivity() { +} diff --git a/packages/instabug_http_client/example/android/app/src/main/res/drawable-v21/launch_background.xml b/packages/instabug_http_client/example/android/app/src/main/res/drawable-v21/launch_background.xml new file mode 100644 index 000000000..f74085f3f --- /dev/null +++ b/packages/instabug_http_client/example/android/app/src/main/res/drawable-v21/launch_background.xml @@ -0,0 +1,12 @@ + + + + + + + + diff --git a/packages/instabug_http_client/example/android/app/src/main/res/drawable/launch_background.xml b/packages/instabug_http_client/example/android/app/src/main/res/drawable/launch_background.xml new file mode 100644 index 000000000..304732f88 --- /dev/null +++ b/packages/instabug_http_client/example/android/app/src/main/res/drawable/launch_background.xml @@ -0,0 +1,12 @@ + + + + + + + + diff --git a/packages/instabug_http_client/example/android/app/src/main/res/mipmap-hdpi/ic_launcher.png b/packages/instabug_http_client/example/android/app/src/main/res/mipmap-hdpi/ic_launcher.png new file mode 100644 index 000000000..db77bb4b7 Binary files /dev/null and b/packages/instabug_http_client/example/android/app/src/main/res/mipmap-hdpi/ic_launcher.png differ diff --git a/packages/instabug_http_client/example/android/app/src/main/res/mipmap-mdpi/ic_launcher.png b/packages/instabug_http_client/example/android/app/src/main/res/mipmap-mdpi/ic_launcher.png new file mode 100644 index 000000000..17987b79b Binary files /dev/null and b/packages/instabug_http_client/example/android/app/src/main/res/mipmap-mdpi/ic_launcher.png differ diff --git a/packages/instabug_http_client/example/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png b/packages/instabug_http_client/example/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png new file mode 100644 index 000000000..09d439148 Binary files /dev/null and b/packages/instabug_http_client/example/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png differ diff --git a/packages/instabug_http_client/example/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png b/packages/instabug_http_client/example/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png new file mode 100644 index 000000000..d5f1c8d34 Binary files /dev/null and b/packages/instabug_http_client/example/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png differ diff --git a/packages/instabug_http_client/example/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png b/packages/instabug_http_client/example/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png new file mode 100644 index 000000000..4d6372eeb Binary files /dev/null and b/packages/instabug_http_client/example/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png differ diff --git a/packages/instabug_http_client/example/android/app/src/main/res/values-night/styles.xml b/packages/instabug_http_client/example/android/app/src/main/res/values-night/styles.xml new file mode 100644 index 000000000..3db14bb53 --- /dev/null +++ b/packages/instabug_http_client/example/android/app/src/main/res/values-night/styles.xml @@ -0,0 +1,18 @@ + + + + + + + diff --git a/packages/instabug_http_client/example/android/app/src/main/res/values/styles.xml b/packages/instabug_http_client/example/android/app/src/main/res/values/styles.xml new file mode 100644 index 000000000..d460d1e92 --- /dev/null +++ b/packages/instabug_http_client/example/android/app/src/main/res/values/styles.xml @@ -0,0 +1,18 @@ + + + + + + + diff --git a/packages/instabug_http_client/example/android/app/src/main/res/xml/network_security_config.xml b/packages/instabug_http_client/example/android/app/src/main/res/xml/network_security_config.xml new file mode 100644 index 000000000..be9989192 --- /dev/null +++ b/packages/instabug_http_client/example/android/app/src/main/res/xml/network_security_config.xml @@ -0,0 +1,13 @@ + + + + localhost + api.instabug.com + + + + + + + + diff --git a/packages/instabug_http_client/example/android/app/src/profile/AndroidManifest.xml b/packages/instabug_http_client/example/android/app/src/profile/AndroidManifest.xml new file mode 100644 index 000000000..c208884f3 --- /dev/null +++ b/packages/instabug_http_client/example/android/app/src/profile/AndroidManifest.xml @@ -0,0 +1,7 @@ + + + + diff --git a/packages/instabug_http_client/example/android/build.gradle b/packages/instabug_http_client/example/android/build.gradle new file mode 100644 index 000000000..4256f9173 --- /dev/null +++ b/packages/instabug_http_client/example/android/build.gradle @@ -0,0 +1,31 @@ +buildscript { + ext.kotlin_version = '1.6.10' + repositories { + google() + mavenCentral() + } + + dependencies { + classpath 'com.android.tools.build:gradle:4.1.0' + classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version" + } +} + +allprojects { + repositories { + google() + mavenCentral() + } +} + +rootProject.buildDir = '../build' +subprojects { + project.buildDir = "${rootProject.buildDir}/${project.name}" +} +subprojects { + project.evaluationDependsOn(':app') +} + +task clean(type: Delete) { + delete rootProject.buildDir +} diff --git a/packages/instabug_http_client/example/android/gradle.properties b/packages/instabug_http_client/example/android/gradle.properties new file mode 100644 index 000000000..94adc3a3f --- /dev/null +++ b/packages/instabug_http_client/example/android/gradle.properties @@ -0,0 +1,3 @@ +org.gradle.jvmargs=-Xmx1536M +android.useAndroidX=true +android.enableJetifier=true diff --git a/packages/instabug_http_client/example/android/gradle/wrapper/gradle-wrapper.properties b/packages/instabug_http_client/example/android/gradle/wrapper/gradle-wrapper.properties new file mode 100644 index 000000000..bc6a58afd --- /dev/null +++ b/packages/instabug_http_client/example/android/gradle/wrapper/gradle-wrapper.properties @@ -0,0 +1,6 @@ +#Fri Jun 23 08:50:38 CEST 2017 +distributionBase=GRADLE_USER_HOME +distributionPath=wrapper/dists +zipStoreBase=GRADLE_USER_HOME +zipStorePath=wrapper/dists +distributionUrl=https\://services.gradle.org/distributions/gradle-6.7-all.zip diff --git a/packages/instabug_http_client/example/android/settings.gradle b/packages/instabug_http_client/example/android/settings.gradle new file mode 100644 index 000000000..44e62bcf0 --- /dev/null +++ b/packages/instabug_http_client/example/android/settings.gradle @@ -0,0 +1,11 @@ +include ':app' + +def localPropertiesFile = new File(rootProject.projectDir, "local.properties") +def properties = new Properties() + +assert localPropertiesFile.exists() +localPropertiesFile.withReader("UTF-8") { reader -> properties.load(reader) } + +def flutterSdkPath = properties.getProperty("flutter.sdk") +assert flutterSdkPath != null, "flutter.sdk not set in local.properties" +apply from: "$flutterSdkPath/packages/flutter_tools/gradle/app_plugin_loader.gradle" diff --git a/packages/instabug_http_client/example/ios/.gitignore b/packages/instabug_http_client/example/ios/.gitignore new file mode 100644 index 000000000..7a7f9873a --- /dev/null +++ b/packages/instabug_http_client/example/ios/.gitignore @@ -0,0 +1,34 @@ +**/dgph +*.mode1v3 +*.mode2v3 +*.moved-aside +*.pbxuser +*.perspectivev3 +**/*sync/ +.sconsign.dblite +.tags* +**/.vagrant/ +**/DerivedData/ +Icon? +**/Pods/ +**/.symlinks/ +profile +xcuserdata +**/.generated/ +Flutter/App.framework +Flutter/Flutter.framework +Flutter/Flutter.podspec +Flutter/Generated.xcconfig +Flutter/ephemeral/ +Flutter/app.flx +Flutter/app.zip +Flutter/flutter_assets/ +Flutter/flutter_export_environment.sh +ServiceDefinitions.json +Runner/GeneratedPluginRegistrant.* + +# Exceptions to above rules. +!default.mode1v3 +!default.mode2v3 +!default.pbxuser +!default.perspectivev3 diff --git a/packages/instabug_http_client/example/ios/Flutter/AppFrameworkInfo.plist b/packages/instabug_http_client/example/ios/Flutter/AppFrameworkInfo.plist new file mode 100644 index 000000000..8d4492f97 --- /dev/null +++ b/packages/instabug_http_client/example/ios/Flutter/AppFrameworkInfo.plist @@ -0,0 +1,26 @@ + + + + + CFBundleDevelopmentRegion + en + CFBundleExecutable + App + CFBundleIdentifier + io.flutter.flutter.app + CFBundleInfoDictionaryVersion + 6.0 + CFBundleName + App + CFBundlePackageType + FMWK + CFBundleShortVersionString + 1.0 + CFBundleSignature + ???? + CFBundleVersion + 1.0 + MinimumOSVersion + 9.0 + + diff --git a/packages/instabug_http_client/example/ios/Flutter/Debug.xcconfig b/packages/instabug_http_client/example/ios/Flutter/Debug.xcconfig new file mode 100644 index 000000000..ec97fc6f3 --- /dev/null +++ b/packages/instabug_http_client/example/ios/Flutter/Debug.xcconfig @@ -0,0 +1,2 @@ +#include? "Pods/Target Support Files/Pods-Runner/Pods-Runner.debug.xcconfig" +#include "Generated.xcconfig" diff --git a/packages/instabug_http_client/example/ios/Flutter/Release.xcconfig b/packages/instabug_http_client/example/ios/Flutter/Release.xcconfig new file mode 100644 index 000000000..c4855bfe2 --- /dev/null +++ b/packages/instabug_http_client/example/ios/Flutter/Release.xcconfig @@ -0,0 +1,2 @@ +#include? "Pods/Target Support Files/Pods-Runner/Pods-Runner.release.xcconfig" +#include "Generated.xcconfig" diff --git a/packages/instabug_http_client/example/ios/Podfile b/packages/instabug_http_client/example/ios/Podfile new file mode 100644 index 000000000..9411102b1 --- /dev/null +++ b/packages/instabug_http_client/example/ios/Podfile @@ -0,0 +1,41 @@ +# Uncomment this line to define a global platform for your project +platform :ios, '10.0' + +# CocoaPods analytics sends network stats synchronously affecting flutter build latency. +ENV['COCOAPODS_DISABLE_STATS'] = 'true' + +project 'Runner', { + 'Debug' => :debug, + 'Profile' => :release, + 'Release' => :release, +} + +def flutter_root + generated_xcode_build_settings_path = File.expand_path(File.join('..', 'Flutter', 'Generated.xcconfig'), __FILE__) + unless File.exist?(generated_xcode_build_settings_path) + raise "#{generated_xcode_build_settings_path} must exist. If you're running pod install manually, make sure flutter pub get is executed first" + end + + File.foreach(generated_xcode_build_settings_path) do |line| + matches = line.match(/FLUTTER_ROOT\=(.*)/) + return matches[1].strip if matches + end + raise "FLUTTER_ROOT not found in #{generated_xcode_build_settings_path}. Try deleting Generated.xcconfig, then run flutter pub get" +end + +require File.expand_path(File.join('packages', 'flutter_tools', 'bin', 'podhelper'), flutter_root) + +flutter_ios_podfile_setup + +target 'Runner' do + use_frameworks! + use_modular_headers! + + flutter_install_all_ios_pods File.dirname(File.realpath(__FILE__)) +end + +post_install do |installer| + installer.pods_project.targets.each do |target| + flutter_additional_ios_build_settings(target) + end +end diff --git a/packages/instabug_http_client/example/ios/Runner.xcodeproj/project.pbxproj b/packages/instabug_http_client/example/ios/Runner.xcodeproj/project.pbxproj new file mode 100644 index 000000000..1ddefc8fe --- /dev/null +++ b/packages/instabug_http_client/example/ios/Runner.xcodeproj/project.pbxproj @@ -0,0 +1,552 @@ +// !$*UTF8*$! +{ + archiveVersion = 1; + classes = { + }; + objectVersion = 50; + objects = { + +/* Begin PBXBuildFile section */ + 1498D2341E8E89220040F4C2 /* GeneratedPluginRegistrant.m in Sources */ = {isa = PBXBuildFile; fileRef = 1498D2331E8E89220040F4C2 /* GeneratedPluginRegistrant.m */; }; + 3B3967161E833CAA004F5970 /* AppFrameworkInfo.plist in Resources */ = {isa = PBXBuildFile; fileRef = 3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */; }; + 74858FAF1ED2DC5600515810 /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 74858FAE1ED2DC5600515810 /* AppDelegate.swift */; }; + 97C146FC1CF9000F007C117D /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FA1CF9000F007C117D /* Main.storyboard */; }; + 97C146FE1CF9000F007C117D /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FD1CF9000F007C117D /* Assets.xcassets */; }; + 97C147011CF9000F007C117D /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FF1CF9000F007C117D /* LaunchScreen.storyboard */; }; + AD44C4DB39F7C3968B8C56EB /* Pods_Runner.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 18B300F826F2074CB5E450C4 /* Pods_Runner.framework */; }; +/* End PBXBuildFile section */ + +/* Begin PBXCopyFilesBuildPhase section */ + 9705A1C41CF9048500538489 /* Embed Frameworks */ = { + isa = PBXCopyFilesBuildPhase; + buildActionMask = 2147483647; + dstPath = ""; + dstSubfolderSpec = 10; + files = ( + ); + name = "Embed Frameworks"; + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXCopyFilesBuildPhase section */ + +/* Begin PBXFileReference section */ + 1498D2321E8E86230040F4C2 /* GeneratedPluginRegistrant.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = GeneratedPluginRegistrant.h; sourceTree = ""; }; + 1498D2331E8E89220040F4C2 /* GeneratedPluginRegistrant.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = GeneratedPluginRegistrant.m; sourceTree = ""; }; + 18B300F826F2074CB5E450C4 /* Pods_Runner.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_Runner.framework; sourceTree = BUILT_PRODUCTS_DIR; }; + 3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; name = AppFrameworkInfo.plist; path = Flutter/AppFrameworkInfo.plist; sourceTree = ""; }; + 3E0436312822B722E186D653 /* Pods-Runner.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Runner.release.xcconfig"; path = "Target Support Files/Pods-Runner/Pods-Runner.release.xcconfig"; sourceTree = ""; }; + 74858FAD1ED2DC5600515810 /* Runner-Bridging-Header.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "Runner-Bridging-Header.h"; sourceTree = ""; }; + 74858FAE1ED2DC5600515810 /* AppDelegate.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = ""; }; + 7AFA3C8E1D35360C0083082E /* Release.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; name = Release.xcconfig; path = Flutter/Release.xcconfig; sourceTree = ""; }; + 90FF03378459C589A4D9DA6E /* Pods-Runner.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Runner.debug.xcconfig"; path = "Target Support Files/Pods-Runner/Pods-Runner.debug.xcconfig"; sourceTree = ""; }; + 9740EEB21CF90195004384FC /* Debug.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; name = Debug.xcconfig; path = Flutter/Debug.xcconfig; sourceTree = ""; }; + 9740EEB31CF90195004384FC /* Generated.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; name = Generated.xcconfig; path = Flutter/Generated.xcconfig; sourceTree = ""; }; + 97C146EE1CF9000F007C117D /* Runner.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = Runner.app; sourceTree = BUILT_PRODUCTS_DIR; }; + 97C146FB1CF9000F007C117D /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = ""; }; + 97C146FD1CF9000F007C117D /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = ""; }; + 97C147001CF9000F007C117D /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = ""; }; + 97C147021CF9000F007C117D /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; + DE25EB3DE5B281AB8980A728 /* Pods-Runner.profile.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Runner.profile.xcconfig"; path = "Target Support Files/Pods-Runner/Pods-Runner.profile.xcconfig"; sourceTree = ""; }; +/* End PBXFileReference section */ + +/* Begin PBXFrameworksBuildPhase section */ + 97C146EB1CF9000F007C117D /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( + AD44C4DB39F7C3968B8C56EB /* Pods_Runner.framework in Frameworks */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXFrameworksBuildPhase section */ + +/* Begin PBXGroup section */ + 3456E8E25F114A239880D241 /* Frameworks */ = { + isa = PBXGroup; + children = ( + 18B300F826F2074CB5E450C4 /* Pods_Runner.framework */, + ); + name = Frameworks; + sourceTree = ""; + }; + 4955E253C000584F8EA1A042 /* Pods */ = { + isa = PBXGroup; + children = ( + 90FF03378459C589A4D9DA6E /* Pods-Runner.debug.xcconfig */, + 3E0436312822B722E186D653 /* Pods-Runner.release.xcconfig */, + DE25EB3DE5B281AB8980A728 /* Pods-Runner.profile.xcconfig */, + ); + name = Pods; + path = Pods; + sourceTree = ""; + }; + 9740EEB11CF90186004384FC /* Flutter */ = { + isa = PBXGroup; + children = ( + 3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */, + 9740EEB21CF90195004384FC /* Debug.xcconfig */, + 7AFA3C8E1D35360C0083082E /* Release.xcconfig */, + 9740EEB31CF90195004384FC /* Generated.xcconfig */, + ); + name = Flutter; + sourceTree = ""; + }; + 97C146E51CF9000F007C117D = { + isa = PBXGroup; + children = ( + 9740EEB11CF90186004384FC /* Flutter */, + 97C146F01CF9000F007C117D /* Runner */, + 97C146EF1CF9000F007C117D /* Products */, + 4955E253C000584F8EA1A042 /* Pods */, + 3456E8E25F114A239880D241 /* Frameworks */, + ); + sourceTree = ""; + }; + 97C146EF1CF9000F007C117D /* Products */ = { + isa = PBXGroup; + children = ( + 97C146EE1CF9000F007C117D /* Runner.app */, + ); + name = Products; + sourceTree = ""; + }; + 97C146F01CF9000F007C117D /* Runner */ = { + isa = PBXGroup; + children = ( + 97C146FA1CF9000F007C117D /* Main.storyboard */, + 97C146FD1CF9000F007C117D /* Assets.xcassets */, + 97C146FF1CF9000F007C117D /* LaunchScreen.storyboard */, + 97C147021CF9000F007C117D /* Info.plist */, + 1498D2321E8E86230040F4C2 /* GeneratedPluginRegistrant.h */, + 1498D2331E8E89220040F4C2 /* GeneratedPluginRegistrant.m */, + 74858FAE1ED2DC5600515810 /* AppDelegate.swift */, + 74858FAD1ED2DC5600515810 /* Runner-Bridging-Header.h */, + ); + path = Runner; + sourceTree = ""; + }; +/* End PBXGroup section */ + +/* Begin PBXNativeTarget section */ + 97C146ED1CF9000F007C117D /* Runner */ = { + isa = PBXNativeTarget; + buildConfigurationList = 97C147051CF9000F007C117D /* Build configuration list for PBXNativeTarget "Runner" */; + buildPhases = ( + F412A5213E8CA6290AF8A003 /* [CP] Check Pods Manifest.lock */, + 9740EEB61CF901F6004384FC /* Run Script */, + 97C146EA1CF9000F007C117D /* Sources */, + 97C146EB1CF9000F007C117D /* Frameworks */, + 97C146EC1CF9000F007C117D /* Resources */, + 9705A1C41CF9048500538489 /* Embed Frameworks */, + 3B06AD1E1E4923F5004D2608 /* Thin Binary */, + 9BDEDB79123E51897883C720 /* [CP] Embed Pods Frameworks */, + ); + buildRules = ( + ); + dependencies = ( + ); + name = Runner; + productName = Runner; + productReference = 97C146EE1CF9000F007C117D /* Runner.app */; + productType = "com.apple.product-type.application"; + }; +/* End PBXNativeTarget section */ + +/* Begin PBXProject section */ + 97C146E61CF9000F007C117D /* Project object */ = { + isa = PBXProject; + attributes = { + LastUpgradeCheck = 1300; + ORGANIZATIONNAME = ""; + TargetAttributes = { + 97C146ED1CF9000F007C117D = { + CreatedOnToolsVersion = 7.3.1; + LastSwiftMigration = 1100; + }; + }; + }; + buildConfigurationList = 97C146E91CF9000F007C117D /* Build configuration list for PBXProject "Runner" */; + compatibilityVersion = "Xcode 9.3"; + developmentRegion = en; + hasScannedForEncodings = 0; + knownRegions = ( + en, + Base, + ); + mainGroup = 97C146E51CF9000F007C117D; + productRefGroup = 97C146EF1CF9000F007C117D /* Products */; + projectDirPath = ""; + projectRoot = ""; + targets = ( + 97C146ED1CF9000F007C117D /* Runner */, + ); + }; +/* End PBXProject section */ + +/* Begin PBXResourcesBuildPhase section */ + 97C146EC1CF9000F007C117D /* Resources */ = { + isa = PBXResourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + 97C147011CF9000F007C117D /* LaunchScreen.storyboard in Resources */, + 3B3967161E833CAA004F5970 /* AppFrameworkInfo.plist in Resources */, + 97C146FE1CF9000F007C117D /* Assets.xcassets in Resources */, + 97C146FC1CF9000F007C117D /* Main.storyboard in Resources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXResourcesBuildPhase section */ + +/* Begin PBXShellScriptBuildPhase section */ + 3B06AD1E1E4923F5004D2608 /* Thin Binary */ = { + isa = PBXShellScriptBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + inputPaths = ( + ); + name = "Thin Binary"; + outputPaths = ( + ); + runOnlyForDeploymentPostprocessing = 0; + shellPath = /bin/sh; + shellScript = "/bin/sh \"$FLUTTER_ROOT/packages/flutter_tools/bin/xcode_backend.sh\" embed_and_thin"; + }; + 9740EEB61CF901F6004384FC /* Run Script */ = { + isa = PBXShellScriptBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + inputPaths = ( + ); + name = "Run Script"; + outputPaths = ( + ); + runOnlyForDeploymentPostprocessing = 0; + shellPath = /bin/sh; + shellScript = "/bin/sh \"$FLUTTER_ROOT/packages/flutter_tools/bin/xcode_backend.sh\" build"; + }; + 9BDEDB79123E51897883C720 /* [CP] Embed Pods Frameworks */ = { + isa = PBXShellScriptBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + inputFileListPaths = ( + "${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-frameworks-${CONFIGURATION}-input-files.xcfilelist", + ); + name = "[CP] Embed Pods Frameworks"; + outputFileListPaths = ( + "${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-frameworks-${CONFIGURATION}-output-files.xcfilelist", + ); + runOnlyForDeploymentPostprocessing = 0; + shellPath = /bin/sh; + shellScript = "\"${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-frameworks.sh\"\n"; + showEnvVarsInLog = 0; + }; + F412A5213E8CA6290AF8A003 /* [CP] Check Pods Manifest.lock */ = { + isa = PBXShellScriptBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + inputFileListPaths = ( + ); + inputPaths = ( + "${PODS_PODFILE_DIR_PATH}/Podfile.lock", + "${PODS_ROOT}/Manifest.lock", + ); + name = "[CP] Check Pods Manifest.lock"; + outputFileListPaths = ( + ); + outputPaths = ( + "$(DERIVED_FILE_DIR)/Pods-Runner-checkManifestLockResult.txt", + ); + runOnlyForDeploymentPostprocessing = 0; + shellPath = /bin/sh; + shellScript = "diff \"${PODS_PODFILE_DIR_PATH}/Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n# This output is used by Xcode 'outputs' to avoid re-running this script phase.\necho \"SUCCESS\" > \"${SCRIPT_OUTPUT_FILE_0}\"\n"; + showEnvVarsInLog = 0; + }; +/* End PBXShellScriptBuildPhase section */ + +/* Begin PBXSourcesBuildPhase section */ + 97C146EA1CF9000F007C117D /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + 74858FAF1ED2DC5600515810 /* AppDelegate.swift in Sources */, + 1498D2341E8E89220040F4C2 /* GeneratedPluginRegistrant.m in Sources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXSourcesBuildPhase section */ + +/* Begin PBXVariantGroup section */ + 97C146FA1CF9000F007C117D /* Main.storyboard */ = { + isa = PBXVariantGroup; + children = ( + 97C146FB1CF9000F007C117D /* Base */, + ); + name = Main.storyboard; + sourceTree = ""; + }; + 97C146FF1CF9000F007C117D /* LaunchScreen.storyboard */ = { + isa = PBXVariantGroup; + children = ( + 97C147001CF9000F007C117D /* Base */, + ); + name = LaunchScreen.storyboard; + sourceTree = ""; + }; +/* End PBXVariantGroup section */ + +/* Begin XCBuildConfiguration section */ + 249021D3217E4FDB00AE95B9 /* Profile */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + CLANG_ANALYZER_NONNULL = YES; + CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; + CLANG_CXX_LIBRARY = "libc++"; + CLANG_ENABLE_MODULES = YES; + CLANG_ENABLE_OBJC_ARC = YES; + CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; + CLANG_WARN_BOOL_CONVERSION = YES; + CLANG_WARN_COMMA = YES; + CLANG_WARN_CONSTANT_CONVERSION = YES; + CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; + CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; + CLANG_WARN_EMPTY_BODY = YES; + CLANG_WARN_ENUM_CONVERSION = YES; + CLANG_WARN_INFINITE_RECURSION = YES; + CLANG_WARN_INT_CONVERSION = YES; + CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; + CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; + CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; + CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; + CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; + CLANG_WARN_STRICT_PROTOTYPES = YES; + CLANG_WARN_SUSPICIOUS_MOVE = YES; + CLANG_WARN_UNREACHABLE_CODE = YES; + CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; + "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; + COPY_PHASE_STRIP = NO; + DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; + ENABLE_NS_ASSERTIONS = NO; + ENABLE_STRICT_OBJC_MSGSEND = YES; + GCC_C_LANGUAGE_STANDARD = gnu99; + GCC_NO_COMMON_BLOCKS = YES; + GCC_WARN_64_TO_32_BIT_CONVERSION = YES; + GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; + GCC_WARN_UNDECLARED_SELECTOR = YES; + GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; + GCC_WARN_UNUSED_FUNCTION = YES; + GCC_WARN_UNUSED_VARIABLE = YES; + IPHONEOS_DEPLOYMENT_TARGET = 9.0; + MTL_ENABLE_DEBUG_INFO = NO; + SDKROOT = iphoneos; + SUPPORTED_PLATFORMS = iphoneos; + TARGETED_DEVICE_FAMILY = "1,2"; + VALIDATE_PRODUCT = YES; + }; + name = Profile; + }; + 249021D4217E4FDB00AE95B9 /* Profile */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = 7AFA3C8E1D35360C0083082E /* Release.xcconfig */; + buildSettings = { + ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; + CLANG_ENABLE_MODULES = YES; + CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)"; + DEVELOPMENT_TEAM = XNK224R4SF; + ENABLE_BITCODE = NO; + INFOPLIST_FILE = Runner/Info.plist; + LD_RUNPATH_SEARCH_PATHS = ( + "$(inherited)", + "@executable_path/Frameworks", + ); + PRODUCT_BUNDLE_IDENTIFIER = com.example.example; + PRODUCT_NAME = "$(TARGET_NAME)"; + SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h"; + SWIFT_VERSION = 5.0; + VERSIONING_SYSTEM = "apple-generic"; + }; + name = Profile; + }; + 97C147031CF9000F007C117D /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + CLANG_ANALYZER_NONNULL = YES; + CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; + CLANG_CXX_LIBRARY = "libc++"; + CLANG_ENABLE_MODULES = YES; + CLANG_ENABLE_OBJC_ARC = YES; + CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; + CLANG_WARN_BOOL_CONVERSION = YES; + CLANG_WARN_COMMA = YES; + CLANG_WARN_CONSTANT_CONVERSION = YES; + CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; + CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; + CLANG_WARN_EMPTY_BODY = YES; + CLANG_WARN_ENUM_CONVERSION = YES; + CLANG_WARN_INFINITE_RECURSION = YES; + CLANG_WARN_INT_CONVERSION = YES; + CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; + CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; + CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; + CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; + CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; + CLANG_WARN_STRICT_PROTOTYPES = YES; + CLANG_WARN_SUSPICIOUS_MOVE = YES; + CLANG_WARN_UNREACHABLE_CODE = YES; + CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; + "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; + COPY_PHASE_STRIP = NO; + DEBUG_INFORMATION_FORMAT = dwarf; + ENABLE_STRICT_OBJC_MSGSEND = YES; + ENABLE_TESTABILITY = YES; + GCC_C_LANGUAGE_STANDARD = gnu99; + GCC_DYNAMIC_NO_PIC = NO; + GCC_NO_COMMON_BLOCKS = YES; + GCC_OPTIMIZATION_LEVEL = 0; + GCC_PREPROCESSOR_DEFINITIONS = ( + "DEBUG=1", + "$(inherited)", + ); + GCC_WARN_64_TO_32_BIT_CONVERSION = YES; + GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; + GCC_WARN_UNDECLARED_SELECTOR = YES; + GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; + GCC_WARN_UNUSED_FUNCTION = YES; + GCC_WARN_UNUSED_VARIABLE = YES; + IPHONEOS_DEPLOYMENT_TARGET = 9.0; + MTL_ENABLE_DEBUG_INFO = YES; + ONLY_ACTIVE_ARCH = YES; + SDKROOT = iphoneos; + TARGETED_DEVICE_FAMILY = "1,2"; + }; + name = Debug; + }; + 97C147041CF9000F007C117D /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + CLANG_ANALYZER_NONNULL = YES; + CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; + CLANG_CXX_LIBRARY = "libc++"; + CLANG_ENABLE_MODULES = YES; + CLANG_ENABLE_OBJC_ARC = YES; + CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; + CLANG_WARN_BOOL_CONVERSION = YES; + CLANG_WARN_COMMA = YES; + CLANG_WARN_CONSTANT_CONVERSION = YES; + CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; + CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; + CLANG_WARN_EMPTY_BODY = YES; + CLANG_WARN_ENUM_CONVERSION = YES; + CLANG_WARN_INFINITE_RECURSION = YES; + CLANG_WARN_INT_CONVERSION = YES; + CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; + CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; + CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; + CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; + CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; + CLANG_WARN_STRICT_PROTOTYPES = YES; + CLANG_WARN_SUSPICIOUS_MOVE = YES; + CLANG_WARN_UNREACHABLE_CODE = YES; + CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; + "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; + COPY_PHASE_STRIP = NO; + DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; + ENABLE_NS_ASSERTIONS = NO; + ENABLE_STRICT_OBJC_MSGSEND = YES; + GCC_C_LANGUAGE_STANDARD = gnu99; + GCC_NO_COMMON_BLOCKS = YES; + GCC_WARN_64_TO_32_BIT_CONVERSION = YES; + GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; + GCC_WARN_UNDECLARED_SELECTOR = YES; + GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; + GCC_WARN_UNUSED_FUNCTION = YES; + GCC_WARN_UNUSED_VARIABLE = YES; + IPHONEOS_DEPLOYMENT_TARGET = 9.0; + MTL_ENABLE_DEBUG_INFO = NO; + SDKROOT = iphoneos; + SUPPORTED_PLATFORMS = iphoneos; + SWIFT_COMPILATION_MODE = wholemodule; + SWIFT_OPTIMIZATION_LEVEL = "-O"; + TARGETED_DEVICE_FAMILY = "1,2"; + VALIDATE_PRODUCT = YES; + }; + name = Release; + }; + 97C147061CF9000F007C117D /* Debug */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = 9740EEB21CF90195004384FC /* Debug.xcconfig */; + buildSettings = { + ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; + CLANG_ENABLE_MODULES = YES; + CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)"; + DEVELOPMENT_TEAM = XNK224R4SF; + ENABLE_BITCODE = NO; + INFOPLIST_FILE = Runner/Info.plist; + LD_RUNPATH_SEARCH_PATHS = ( + "$(inherited)", + "@executable_path/Frameworks", + ); + PRODUCT_BUNDLE_IDENTIFIER = com.example.example; + PRODUCT_NAME = "$(TARGET_NAME)"; + SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h"; + SWIFT_OPTIMIZATION_LEVEL = "-Onone"; + SWIFT_VERSION = 5.0; + VERSIONING_SYSTEM = "apple-generic"; + }; + name = Debug; + }; + 97C147071CF9000F007C117D /* Release */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = 7AFA3C8E1D35360C0083082E /* Release.xcconfig */; + buildSettings = { + ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; + CLANG_ENABLE_MODULES = YES; + CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)"; + DEVELOPMENT_TEAM = XNK224R4SF; + ENABLE_BITCODE = NO; + INFOPLIST_FILE = Runner/Info.plist; + LD_RUNPATH_SEARCH_PATHS = ( + "$(inherited)", + "@executable_path/Frameworks", + ); + PRODUCT_BUNDLE_IDENTIFIER = com.example.example; + PRODUCT_NAME = "$(TARGET_NAME)"; + SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h"; + SWIFT_VERSION = 5.0; + VERSIONING_SYSTEM = "apple-generic"; + }; + name = Release; + }; +/* End XCBuildConfiguration section */ + +/* Begin XCConfigurationList section */ + 97C146E91CF9000F007C117D /* Build configuration list for PBXProject "Runner" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 97C147031CF9000F007C117D /* Debug */, + 97C147041CF9000F007C117D /* Release */, + 249021D3217E4FDB00AE95B9 /* Profile */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; + 97C147051CF9000F007C117D /* Build configuration list for PBXNativeTarget "Runner" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 97C147061CF9000F007C117D /* Debug */, + 97C147071CF9000F007C117D /* Release */, + 249021D4217E4FDB00AE95B9 /* Profile */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; +/* End XCConfigurationList section */ + }; + rootObject = 97C146E61CF9000F007C117D /* Project object */; +} diff --git a/packages/instabug_http_client/example/ios/Runner.xcodeproj/project.xcworkspace/contents.xcworkspacedata b/packages/instabug_http_client/example/ios/Runner.xcodeproj/project.xcworkspace/contents.xcworkspacedata new file mode 100644 index 000000000..919434a62 --- /dev/null +++ b/packages/instabug_http_client/example/ios/Runner.xcodeproj/project.xcworkspace/contents.xcworkspacedata @@ -0,0 +1,7 @@ + + + + + diff --git a/packages/instabug_http_client/example/ios/Runner.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist b/packages/instabug_http_client/example/ios/Runner.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist new file mode 100644 index 000000000..18d981003 --- /dev/null +++ b/packages/instabug_http_client/example/ios/Runner.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist @@ -0,0 +1,8 @@ + + + + + IDEDidComputeMac32BitWarning + + + diff --git a/packages/instabug_http_client/example/ios/Runner.xcodeproj/project.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings b/packages/instabug_http_client/example/ios/Runner.xcodeproj/project.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings new file mode 100644 index 000000000..f9b0d7c5e --- /dev/null +++ b/packages/instabug_http_client/example/ios/Runner.xcodeproj/project.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings @@ -0,0 +1,8 @@ + + + + + PreviewsEnabled + + + diff --git a/packages/instabug_http_client/example/ios/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme b/packages/instabug_http_client/example/ios/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme new file mode 100644 index 000000000..c87d15a33 --- /dev/null +++ b/packages/instabug_http_client/example/ios/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme @@ -0,0 +1,87 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/packages/instabug_http_client/example/ios/Runner.xcworkspace/contents.xcworkspacedata b/packages/instabug_http_client/example/ios/Runner.xcworkspace/contents.xcworkspacedata new file mode 100644 index 000000000..21a3cc14c --- /dev/null +++ b/packages/instabug_http_client/example/ios/Runner.xcworkspace/contents.xcworkspacedata @@ -0,0 +1,10 @@ + + + + + + + diff --git a/packages/instabug_http_client/example/ios/Runner.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist b/packages/instabug_http_client/example/ios/Runner.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist new file mode 100644 index 000000000..18d981003 --- /dev/null +++ b/packages/instabug_http_client/example/ios/Runner.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist @@ -0,0 +1,8 @@ + + + + + IDEDidComputeMac32BitWarning + + + diff --git a/packages/instabug_http_client/example/ios/Runner.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings b/packages/instabug_http_client/example/ios/Runner.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings new file mode 100644 index 000000000..f9b0d7c5e --- /dev/null +++ b/packages/instabug_http_client/example/ios/Runner.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings @@ -0,0 +1,8 @@ + + + + + PreviewsEnabled + + + diff --git a/packages/instabug_http_client/example/ios/Runner/AppDelegate.swift b/packages/instabug_http_client/example/ios/Runner/AppDelegate.swift new file mode 100644 index 000000000..70693e4a8 --- /dev/null +++ b/packages/instabug_http_client/example/ios/Runner/AppDelegate.swift @@ -0,0 +1,13 @@ +import UIKit +import Flutter + +@UIApplicationMain +@objc class AppDelegate: FlutterAppDelegate { + override func application( + _ application: UIApplication, + didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]? + ) -> Bool { + GeneratedPluginRegistrant.register(with: self) + return super.application(application, didFinishLaunchingWithOptions: launchOptions) + } +} diff --git a/packages/instabug_http_client/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Contents.json b/packages/instabug_http_client/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Contents.json new file mode 100644 index 000000000..d36b1fab2 --- /dev/null +++ b/packages/instabug_http_client/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Contents.json @@ -0,0 +1,122 @@ +{ + "images" : [ + { + "size" : "20x20", + "idiom" : "iphone", + "filename" : "Icon-App-20x20@2x.png", + "scale" : "2x" + }, + { + "size" : "20x20", + "idiom" : "iphone", + "filename" : "Icon-App-20x20@3x.png", + "scale" : "3x" + }, + { + "size" : "29x29", + "idiom" : "iphone", + "filename" : "Icon-App-29x29@1x.png", + "scale" : "1x" + }, + { + "size" : "29x29", + "idiom" : "iphone", + "filename" : "Icon-App-29x29@2x.png", + "scale" : "2x" + }, + { + "size" : "29x29", + "idiom" : "iphone", + "filename" : "Icon-App-29x29@3x.png", + "scale" : "3x" + }, + { + "size" : "40x40", + "idiom" : "iphone", + "filename" : "Icon-App-40x40@2x.png", + "scale" : "2x" + }, + { + "size" : "40x40", + "idiom" : "iphone", + "filename" : "Icon-App-40x40@3x.png", + "scale" : "3x" + }, + { + "size" : "60x60", + "idiom" : "iphone", + "filename" : "Icon-App-60x60@2x.png", + "scale" : "2x" + }, + { + "size" : "60x60", + "idiom" : "iphone", + "filename" : "Icon-App-60x60@3x.png", + "scale" : "3x" + }, + { + "size" : "20x20", + "idiom" : "ipad", + "filename" : "Icon-App-20x20@1x.png", + "scale" : "1x" + }, + { + "size" : "20x20", + "idiom" : "ipad", + "filename" : "Icon-App-20x20@2x.png", + "scale" : "2x" + }, + { + "size" : "29x29", + "idiom" : "ipad", + "filename" : "Icon-App-29x29@1x.png", + "scale" : "1x" + }, + { + "size" : "29x29", + "idiom" : "ipad", + "filename" : "Icon-App-29x29@2x.png", + "scale" : "2x" + }, + { + "size" : "40x40", + "idiom" : "ipad", + "filename" : "Icon-App-40x40@1x.png", + "scale" : "1x" + }, + { + "size" : "40x40", + "idiom" : "ipad", + "filename" : "Icon-App-40x40@2x.png", + "scale" : "2x" + }, + { + "size" : "76x76", + "idiom" : "ipad", + "filename" : "Icon-App-76x76@1x.png", + "scale" : "1x" + }, + { + "size" : "76x76", + "idiom" : "ipad", + "filename" : "Icon-App-76x76@2x.png", + "scale" : "2x" + }, + { + "size" : "83.5x83.5", + "idiom" : "ipad", + "filename" : "Icon-App-83.5x83.5@2x.png", + "scale" : "2x" + }, + { + "size" : "1024x1024", + "idiom" : "ios-marketing", + "filename" : "Icon-App-1024x1024@1x.png", + "scale" : "1x" + } + ], + "info" : { + "version" : 1, + "author" : "xcode" + } +} diff --git a/packages/instabug_http_client/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-1024x1024@1x.png b/packages/instabug_http_client/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-1024x1024@1x.png new file mode 100644 index 000000000..dc9ada472 Binary files /dev/null and b/packages/instabug_http_client/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-1024x1024@1x.png differ diff --git a/packages/instabug_http_client/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@1x.png b/packages/instabug_http_client/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@1x.png new file mode 100644 index 000000000..28c6bf030 Binary files /dev/null and b/packages/instabug_http_client/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@1x.png differ diff --git a/packages/instabug_http_client/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@2x.png b/packages/instabug_http_client/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@2x.png new file mode 100644 index 000000000..2ccbfd967 Binary files /dev/null and b/packages/instabug_http_client/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@2x.png differ diff --git a/packages/instabug_http_client/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@3x.png b/packages/instabug_http_client/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@3x.png new file mode 100644 index 000000000..f091b6b0b Binary files /dev/null and b/packages/instabug_http_client/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@3x.png differ diff --git a/packages/instabug_http_client/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@1x.png b/packages/instabug_http_client/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@1x.png new file mode 100644 index 000000000..4cde12118 Binary files /dev/null and b/packages/instabug_http_client/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@1x.png differ diff --git a/packages/instabug_http_client/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@2x.png b/packages/instabug_http_client/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@2x.png new file mode 100644 index 000000000..d0ef06e7e Binary files /dev/null and b/packages/instabug_http_client/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@2x.png differ diff --git a/packages/instabug_http_client/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@3x.png b/packages/instabug_http_client/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@3x.png new file mode 100644 index 000000000..dcdc2306c Binary files /dev/null and b/packages/instabug_http_client/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@3x.png differ diff --git a/packages/instabug_http_client/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@1x.png b/packages/instabug_http_client/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@1x.png new file mode 100644 index 000000000..2ccbfd967 Binary files /dev/null and b/packages/instabug_http_client/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@1x.png differ diff --git a/packages/instabug_http_client/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@2x.png b/packages/instabug_http_client/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@2x.png new file mode 100644 index 000000000..c8f9ed8f5 Binary files /dev/null and b/packages/instabug_http_client/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@2x.png differ diff --git a/packages/instabug_http_client/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@3x.png b/packages/instabug_http_client/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@3x.png new file mode 100644 index 000000000..a6d6b8609 Binary files /dev/null and b/packages/instabug_http_client/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@3x.png differ diff --git a/packages/instabug_http_client/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@2x.png b/packages/instabug_http_client/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@2x.png new file mode 100644 index 000000000..a6d6b8609 Binary files /dev/null and b/packages/instabug_http_client/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@2x.png differ diff --git a/packages/instabug_http_client/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@3x.png b/packages/instabug_http_client/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@3x.png new file mode 100644 index 000000000..75b2d164a Binary files /dev/null and b/packages/instabug_http_client/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@3x.png differ diff --git a/packages/instabug_http_client/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@1x.png b/packages/instabug_http_client/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@1x.png new file mode 100644 index 000000000..c4df70d39 Binary files /dev/null and b/packages/instabug_http_client/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@1x.png differ diff --git a/packages/instabug_http_client/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@2x.png b/packages/instabug_http_client/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@2x.png new file mode 100644 index 000000000..6a84f41e1 Binary files /dev/null and b/packages/instabug_http_client/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@2x.png differ diff --git a/packages/instabug_http_client/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-83.5x83.5@2x.png b/packages/instabug_http_client/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-83.5x83.5@2x.png new file mode 100644 index 000000000..d0e1f5853 Binary files /dev/null and b/packages/instabug_http_client/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-83.5x83.5@2x.png differ diff --git a/packages/instabug_http_client/example/ios/Runner/Assets.xcassets/LaunchImage.imageset/Contents.json b/packages/instabug_http_client/example/ios/Runner/Assets.xcassets/LaunchImage.imageset/Contents.json new file mode 100644 index 000000000..0bedcf2fd --- /dev/null +++ b/packages/instabug_http_client/example/ios/Runner/Assets.xcassets/LaunchImage.imageset/Contents.json @@ -0,0 +1,23 @@ +{ + "images" : [ + { + "idiom" : "universal", + "filename" : "LaunchImage.png", + "scale" : "1x" + }, + { + "idiom" : "universal", + "filename" : "LaunchImage@2x.png", + "scale" : "2x" + }, + { + "idiom" : "universal", + "filename" : "LaunchImage@3x.png", + "scale" : "3x" + } + ], + "info" : { + "version" : 1, + "author" : "xcode" + } +} diff --git a/packages/instabug_http_client/example/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage.png b/packages/instabug_http_client/example/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage.png new file mode 100644 index 000000000..9da19eaca Binary files /dev/null and b/packages/instabug_http_client/example/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage.png differ diff --git a/packages/instabug_http_client/example/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@2x.png b/packages/instabug_http_client/example/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@2x.png new file mode 100644 index 000000000..9da19eaca Binary files /dev/null and b/packages/instabug_http_client/example/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@2x.png differ diff --git a/packages/instabug_http_client/example/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@3x.png b/packages/instabug_http_client/example/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@3x.png new file mode 100644 index 000000000..9da19eaca Binary files /dev/null and b/packages/instabug_http_client/example/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@3x.png differ diff --git a/packages/instabug_http_client/example/ios/Runner/Assets.xcassets/LaunchImage.imageset/README.md b/packages/instabug_http_client/example/ios/Runner/Assets.xcassets/LaunchImage.imageset/README.md new file mode 100644 index 000000000..89c2725b7 --- /dev/null +++ b/packages/instabug_http_client/example/ios/Runner/Assets.xcassets/LaunchImage.imageset/README.md @@ -0,0 +1,5 @@ +# Launch Screen Assets + +You can customize the launch screen with your own desired assets by replacing the image files in this directory. + +You can also do it by opening your Flutter project's Xcode project with `open ios/Runner.xcworkspace`, selecting `Runner/Assets.xcassets` in the Project Navigator and dropping in the desired images. \ No newline at end of file diff --git a/packages/instabug_http_client/example/ios/Runner/Base.lproj/LaunchScreen.storyboard b/packages/instabug_http_client/example/ios/Runner/Base.lproj/LaunchScreen.storyboard new file mode 100644 index 000000000..f2e259c7c --- /dev/null +++ b/packages/instabug_http_client/example/ios/Runner/Base.lproj/LaunchScreen.storyboard @@ -0,0 +1,37 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/packages/instabug_http_client/example/ios/Runner/Base.lproj/Main.storyboard b/packages/instabug_http_client/example/ios/Runner/Base.lproj/Main.storyboard new file mode 100644 index 000000000..f3c28516f --- /dev/null +++ b/packages/instabug_http_client/example/ios/Runner/Base.lproj/Main.storyboard @@ -0,0 +1,26 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/packages/instabug_http_client/example/ios/Runner/Info.plist b/packages/instabug_http_client/example/ios/Runner/Info.plist new file mode 100644 index 000000000..5baf7a1cc --- /dev/null +++ b/packages/instabug_http_client/example/ios/Runner/Info.plist @@ -0,0 +1,47 @@ + + + + + CFBundleDevelopmentRegion + $(DEVELOPMENT_LANGUAGE) + CFBundleDisplayName + Example + CFBundleExecutable + $(EXECUTABLE_NAME) + CFBundleIdentifier + $(PRODUCT_BUNDLE_IDENTIFIER) + CFBundleInfoDictionaryVersion + 6.0 + CFBundleName + example + CFBundlePackageType + APPL + CFBundleShortVersionString + $(FLUTTER_BUILD_NAME) + CFBundleSignature + ???? + CFBundleVersion + $(FLUTTER_BUILD_NUMBER) + LSRequiresIPhoneOS + + UILaunchStoryboardName + LaunchScreen + UIMainStoryboardFile + Main + UISupportedInterfaceOrientations + + UIInterfaceOrientationPortrait + UIInterfaceOrientationLandscapeLeft + UIInterfaceOrientationLandscapeRight + + UISupportedInterfaceOrientations~ipad + + UIInterfaceOrientationPortrait + UIInterfaceOrientationPortraitUpsideDown + UIInterfaceOrientationLandscapeLeft + UIInterfaceOrientationLandscapeRight + + UIViewControllerBasedStatusBarAppearance + + + diff --git a/packages/instabug_http_client/example/ios/Runner/Runner-Bridging-Header.h b/packages/instabug_http_client/example/ios/Runner/Runner-Bridging-Header.h new file mode 100644 index 000000000..308a2a560 --- /dev/null +++ b/packages/instabug_http_client/example/ios/Runner/Runner-Bridging-Header.h @@ -0,0 +1 @@ +#import "GeneratedPluginRegistrant.h" diff --git a/packages/instabug_http_client/example/lib/main.dart b/packages/instabug_http_client/example/lib/main.dart new file mode 100644 index 000000000..da0018df8 --- /dev/null +++ b/packages/instabug_http_client/example/lib/main.dart @@ -0,0 +1,73 @@ +import 'package:flutter/material.dart'; +import 'package:instabug_http_client/instabug_http_client.dart'; +import 'package:instabug_flutter/instabug_flutter.dart'; + +Future main() async { + runApp(const MyApp()); + Instabug.init( + token: 'ed6f659591566da19b67857e1b9d40ab', + invocationEvents: [InvocationEvent.floatingButton]); + final client = InstabugHttpClient(); + await client.get(Uri.parse('https://google.com')); +} + +class MyApp extends StatelessWidget { + const MyApp({Key? key}) : super(key: key); + + @override + Widget build(BuildContext context) { + return MaterialApp( + title: 'Flutter Demo', + theme: ThemeData( + primarySwatch: Colors.blue, + ), + home: const MyHomePage(title: 'Flutter Demo Home Page'), + ); + } +} + +class MyHomePage extends StatefulWidget { + const MyHomePage({Key? key, required this.title}) : super(key: key); + final String title; + + @override + State createState() => _MyHomePageState(); +} + +class _MyHomePageState extends State { + int _counter = 0; + + void _incrementCounter() { + setState(() { + _counter++; + }); + } + + @override + Widget build(BuildContext context) { + return Scaffold( + appBar: AppBar( + title: Text(widget.title), + ), + body: Center( + child: Column( + mainAxisAlignment: MainAxisAlignment.center, + children: [ + const Text( + 'You have pushed the button this many times:', + ), + Text( + '$_counter', + style: Theme.of(context).textTheme.headlineMedium, + ), + ], + ), + ), + floatingActionButton: FloatingActionButton( + onPressed: _incrementCounter, + tooltip: 'Increment', + child: const Icon(Icons.add), + ), + ); + } +} diff --git a/packages/instabug_http_client/example/pubspec.lock b/packages/instabug_http_client/example/pubspec.lock new file mode 100644 index 000000000..f7c6dbb92 --- /dev/null +++ b/packages/instabug_http_client/example/pubspec.lock @@ -0,0 +1,251 @@ +# Generated by pub +# See https://dart.dev/tools/pub/glossary#lockfile +packages: + async: + dependency: transitive + description: + name: async + sha256: "947bfcf187f74dbc5e146c9eb9c0f10c9f8b30743e341481c1e2ed3ecc18c20c" + url: "https://pub.dev" + source: hosted + version: "2.11.0" + boolean_selector: + dependency: transitive + description: + name: boolean_selector + sha256: "6cfb5af12253eaf2b368f07bacc5a80d1301a071c73360d746b7f2e32d762c66" + url: "https://pub.dev" + source: hosted + version: "2.1.1" + characters: + dependency: transitive + description: + name: characters + sha256: "04a925763edad70e8443c99234dc3328f442e811f1d8fd1a72f1c8ad0f69a605" + url: "https://pub.dev" + source: hosted + version: "1.3.0" + clock: + dependency: transitive + description: + name: clock + sha256: cb6d7f03e1de671e34607e909a7213e31d7752be4fb66a86d29fe1eb14bfb5cf + url: "https://pub.dev" + source: hosted + version: "1.1.1" + collection: + dependency: transitive + description: + name: collection + sha256: a1ace0a119f20aabc852d165077c036cd864315bd99b7eaa10a60100341941bf + url: "https://pub.dev" + source: hosted + version: "1.19.0" + cupertino_icons: + dependency: "direct main" + description: + name: cupertino_icons + sha256: ba631d1c7f7bef6b729a622b7b752645a2d076dba9976925b8f25725a30e1ee6 + url: "https://pub.dev" + source: hosted + version: "1.0.8" + fake_async: + dependency: transitive + description: + name: fake_async + sha256: "511392330127add0b769b75a987850d136345d9227c6b94c96a04cf4a391bf78" + url: "https://pub.dev" + source: hosted + version: "1.3.1" + flutter: + dependency: "direct main" + description: flutter + source: sdk + version: "0.0.0" + flutter_lints: + dependency: "direct dev" + description: + name: flutter_lints + sha256: b543301ad291598523947dc534aaddc5aaad597b709d2426d3a0e0d44c5cb493 + url: "https://pub.dev" + source: hosted + version: "1.0.4" + flutter_test: + dependency: "direct dev" + description: flutter + source: sdk + version: "0.0.0" + http: + dependency: transitive + description: + name: http + sha256: "5895291c13fa8a3bd82e76d5627f69e0d85ca6a30dcac95c4ea19a5d555879c2" + url: "https://pub.dev" + source: hosted + version: "0.13.6" + http_parser: + dependency: transitive + description: + name: http_parser + sha256: "2aa08ce0341cc9b354a498388e30986515406668dbcc4f7c950c3e715496693b" + url: "https://pub.dev" + source: hosted + version: "4.0.2" + instabug_flutter: + dependency: "direct overridden" + description: + path: "../../instabug_flutter" + relative: true + source: path + version: "15.0.2" + instabug_http_client: + dependency: "direct main" + description: + path: ".." + relative: true + source: path + version: "2.6.0" + leak_tracker: + dependency: transitive + description: + name: leak_tracker + sha256: "7bb2830ebd849694d1ec25bf1f44582d6ac531a57a365a803a6034ff751d2d06" + url: "https://pub.dev" + source: hosted + version: "10.0.7" + leak_tracker_flutter_testing: + dependency: transitive + description: + name: leak_tracker_flutter_testing + sha256: "9491a714cca3667b60b5c420da8217e6de0d1ba7a5ec322fab01758f6998f379" + url: "https://pub.dev" + source: hosted + version: "3.0.8" + leak_tracker_testing: + dependency: transitive + description: + name: leak_tracker_testing + sha256: "6ba465d5d76e67ddf503e1161d1f4a6bc42306f9d66ca1e8f079a47290fb06d3" + url: "https://pub.dev" + source: hosted + version: "3.0.1" + lints: + dependency: transitive + description: + name: lints + sha256: a2c3d198cb5ea2e179926622d433331d8b58374ab8f29cdda6e863bd62fd369c + url: "https://pub.dev" + source: hosted + version: "1.0.1" + matcher: + dependency: transitive + description: + name: matcher + sha256: d2323aa2060500f906aa31a895b4030b6da3ebdcc5619d14ce1aada65cd161cb + url: "https://pub.dev" + source: hosted + version: "0.12.16+1" + material_color_utilities: + dependency: transitive + description: + name: material_color_utilities + sha256: f7142bb1154231d7ea5f96bc7bde4bda2a0945d2806bb11670e30b850d56bdec + url: "https://pub.dev" + source: hosted + version: "0.11.1" + meta: + dependency: transitive + description: + name: meta + sha256: bdb68674043280c3428e9ec998512fb681678676b3c54e773629ffe74419f8c7 + url: "https://pub.dev" + source: hosted + version: "1.15.0" + path: + dependency: transitive + description: + name: path + sha256: "087ce49c3f0dc39180befefc60fdb4acd8f8620e5682fe2476afd0b3688bb4af" + url: "https://pub.dev" + source: hosted + version: "1.9.0" + sky_engine: + dependency: transitive + description: flutter + source: sdk + version: "0.0.0" + source_span: + dependency: transitive + description: + name: source_span + sha256: "53e943d4206a5e30df338fd4c6e7a077e02254531b138a15aec3bd143c1a8b3c" + url: "https://pub.dev" + source: hosted + version: "1.10.0" + stack_trace: + dependency: transitive + description: + name: stack_trace + sha256: "9f47fd3630d76be3ab26f0ee06d213679aa425996925ff3feffdec504931c377" + url: "https://pub.dev" + source: hosted + version: "1.12.0" + stream_channel: + dependency: transitive + description: + name: stream_channel + sha256: ba2aa5d8cc609d96bbb2899c28934f9e1af5cddbd60a827822ea467161eb54e7 + url: "https://pub.dev" + source: hosted + version: "2.1.2" + string_scanner: + dependency: transitive + description: + name: string_scanner + sha256: "688af5ed3402a4bde5b3a6c15fd768dbf2621a614950b17f04626c431ab3c4c3" + url: "https://pub.dev" + source: hosted + version: "1.3.0" + term_glyph: + dependency: transitive + description: + name: term_glyph + sha256: a29248a84fbb7c79282b40b8c72a1209db169a2e0542bce341da992fe1bc7e84 + url: "https://pub.dev" + source: hosted + version: "1.2.1" + test_api: + dependency: transitive + description: + name: test_api + sha256: "664d3a9a64782fcdeb83ce9c6b39e78fd2971d4e37827b9b06c3aa1edc5e760c" + url: "https://pub.dev" + source: hosted + version: "0.7.3" + typed_data: + dependency: transitive + description: + name: typed_data + sha256: f9049c039ebfeb4cf7a7104a675823cd72dba8297f264b6637062516699fa006 + url: "https://pub.dev" + source: hosted + version: "1.4.0" + vector_math: + dependency: transitive + description: + name: vector_math + sha256: "80b3257d1492ce4d091729e3a67a60407d227c27241d6927be0130c98e741803" + url: "https://pub.dev" + source: hosted + version: "2.1.4" + vm_service: + dependency: transitive + description: + name: vm_service + sha256: f6be3ed8bd01289b34d679c2b62226f63c0e69f9fd2e50a6b3c1c729a961041b + url: "https://pub.dev" + source: hosted + version: "14.3.0" +sdks: + dart: ">=3.5.0 <4.0.0" + flutter: ">=3.18.0-18.0.pre.54" diff --git a/packages/instabug_http_client/example/pubspec.yaml b/packages/instabug_http_client/example/pubspec.yaml new file mode 100644 index 000000000..9add5fe45 --- /dev/null +++ b/packages/instabug_http_client/example/pubspec.yaml @@ -0,0 +1,24 @@ +name: http_client_example +description: Demonstrates how to use the instabug_http_client package. + +publish_to: "none" + +version: 1.0.0+1 + +environment: + sdk: ">=2.12.0 <3.0.0" + +dependencies: + flutter: + sdk: flutter + cupertino_icons: ^1.0.2 + instabug_http_client: + path: ../ + +dev_dependencies: + flutter_test: + sdk: flutter + flutter_lints: ^1.0.0 + +flutter: + uses-material-design: true diff --git a/packages/instabug_http_client/example/pubspec_overrides.yaml b/packages/instabug_http_client/example/pubspec_overrides.yaml new file mode 100644 index 000000000..3daf4fd14 --- /dev/null +++ b/packages/instabug_http_client/example/pubspec_overrides.yaml @@ -0,0 +1,6 @@ +# melos_managed_dependency_overrides: instabug_flutter,instabug_http_client +dependency_overrides: + instabug_flutter: + path: ../../instabug_flutter + instabug_http_client: + path: .. diff --git a/packages/instabug_http_client/lib/instabug_http_client.dart b/packages/instabug_http_client/lib/instabug_http_client.dart new file mode 100644 index 000000000..6ce4915e8 --- /dev/null +++ b/packages/instabug_http_client/lib/instabug_http_client.dart @@ -0,0 +1,154 @@ +// ignore_for_file: invalid_use_of_internal_member + +library instabug_http_client; + +import 'dart:convert'; + +// to maintain supported versions prior to Flutter 3.3 +// ignore: unnecessary_import +import 'dart:typed_data'; + +import 'package:http/http.dart' as http; +import 'package:instabug_flutter/instabug_flutter.dart'; +import 'package:instabug_http_client/instabug_http_logger.dart'; +import 'package:meta/meta.dart'; + +class InstabugHttpClient extends InstabugHttpLogger implements http.Client { + InstabugHttpClient() : client = http.Client() { + logger = this; + } + + final NetworkLogger _networklogger = NetworkLogger(); + @visibleForTesting + http.Client client; + + @visibleForTesting + late InstabugHttpLogger logger; + + @override + void close() => client.close(); + + @override + Future delete(Uri url, + {Map? headers, Object? body, Encoding? encoding}) async { + final DateTime startTime = DateTime.now(); + final Map requestHeader = headers ?? {}; + final W3CHeader? w3cHeader = await getW3cHeader(requestHeader, startTime); + return client + .delete(url, body: body, headers: requestHeader, encoding: encoding) + .then((http.Response response) { + logger.onLogger(response, startTime: startTime, w3CHeader: w3cHeader); + return response; + }); + } + + Future getW3cHeader( + Map requestHeader, DateTime startTime) async { + final W3CHeader? w3cHeader = await _networklogger.getW3CHeader( + requestHeader, startTime.millisecondsSinceEpoch); + if (w3cHeader?.isW3cHeaderFound == false && + w3cHeader?.w3CGeneratedHeader != null) { + requestHeader['traceparent'] = w3cHeader!.w3CGeneratedHeader!; + } + return w3cHeader; + } + + @override + Future get(Uri url, {Map? headers}) async { + final DateTime startTime = DateTime.now(); + final Map requestHeader = headers ?? {}; + final W3CHeader? w3cHeader = await getW3cHeader(requestHeader, startTime); + return client + .get(url, headers: requestHeader) + .then((http.Response response) { + logger.onLogger(response, startTime: startTime, w3CHeader: w3cHeader); + return response; + }); + } + + @override + Future head(Uri url, {Map? headers}) async { + final DateTime startTime = DateTime.now(); + final Map requestHeader = headers ?? {}; + final W3CHeader? w3cHeader = await getW3cHeader(requestHeader, startTime); + return client + .head(url, headers: requestHeader) + .then((http.Response response) { + logger.onLogger(response, startTime: startTime, w3CHeader: w3cHeader); + return response; + }); + } + + @override + Future patch(Uri url, + {Map? headers, Object? body, Encoding? encoding}) async { + final DateTime startTime = DateTime.now(); + final Map requestHeader = headers ?? {}; + final W3CHeader? w3cHeader = await getW3cHeader(requestHeader, startTime); + return client + .patch(url, headers: requestHeader, body: body, encoding: encoding) + .then((http.Response response) { + logger.onLogger(response, startTime: startTime, w3CHeader: w3cHeader); + return response; + }); + } + + @override + Future post(Uri url, + {Map? headers, Object? body, Encoding? encoding}) async { + final DateTime startTime = DateTime.now(); + final Map requestHeader = headers ?? {}; + final W3CHeader? w3cHeader = await getW3cHeader(requestHeader, startTime); + return client + .post(url, headers: requestHeader, body: body, encoding: encoding) + .then((http.Response response) { + logger.onLogger(response, startTime: startTime, w3CHeader: w3cHeader); + return response; + }); + } + + @override + Future put(Uri url, + {Map? headers, Object? body, Encoding? encoding}) async { + final DateTime startTime = DateTime.now(); + final Map requestHeader = headers ?? {}; + final W3CHeader? w3cHeader = await getW3cHeader(requestHeader, startTime); + return client + .put(url, headers: requestHeader, body: body, encoding: encoding) + .then((http.Response response) { + logger.onLogger(response, startTime: startTime, w3CHeader: w3cHeader); + return response; + }); + } + + @override + Future read(Uri url, {Map? headers}) => + client.read(url, headers: headers); + + @override + Future readBytes(Uri url, {Map? headers}) => + client.readBytes(url, headers: headers); + + @override + Future send(http.BaseRequest request) async { + final DateTime startTime = DateTime.now(); + final Map requestHeader = request.headers; + final W3CHeader? w3cHeader = await getW3cHeader(requestHeader, startTime); + return client.send(request).then((http.StreamedResponse streamedResponse) => + http.Response.fromStream(streamedResponse) + .then((http.Response response) { + logger.onLogger(response, startTime: startTime, w3CHeader: w3cHeader); + // Need to return new StreamedResponse, as body only can be listened once + return http.StreamedResponse( + Stream>.value(response.bodyBytes), + response.statusCode, + contentLength: response.contentLength, + request: response.request, + headers: response.headers, + isRedirect: response.isRedirect, + persistentConnection: response.persistentConnection, + reasonPhrase: response.reasonPhrase, + ); + })); + } +} diff --git a/packages/instabug_http_client/lib/instabug_http_logger.dart b/packages/instabug_http_client/lib/instabug_http_logger.dart new file mode 100644 index 000000000..46a465b14 --- /dev/null +++ b/packages/instabug_http_client/lib/instabug_http_logger.dart @@ -0,0 +1,70 @@ +import 'dart:convert'; + +import 'package:http/http.dart' as http; +import 'package:instabug_flutter/instabug_flutter.dart'; + +class InstabugHttpLogger { + void onLogger(http.Response response, + {DateTime? startTime, W3CHeader? w3CHeader}) { + final NetworkLogger networkLogger = NetworkLogger(); + + final Map requestHeaders = {}; + response.request?.headers.forEach((String header, dynamic value) { + requestHeaders[header] = value; + }); + + final http.BaseRequest? request = response.request; + + if (request == null) { + return; + } + final String requestBody = request is http.MultipartRequest + ? json.encode(request.fields) + : request is http.Request + ? request.body + : ''; + + final NetworkData requestData = NetworkData( + startTime: startTime!, + method: request.method, + url: request.url.toString(), + requestHeaders: requestHeaders, + requestBody: requestBody, + w3cHeader: w3CHeader); + + final DateTime endTime = DateTime.now(); + + final Map responseHeaders = {}; + response.headers.forEach((String header, dynamic value) { + responseHeaders[header] = value; + }); + int requestBodySize = 0; + if (requestHeaders.containsKey('content-length')) { + requestBodySize = int.parse(responseHeaders['content-length'] ?? '0'); + } else { + requestBodySize = requestBody.length; + } + + int responseBodySize = 0; + if (responseHeaders.containsKey('content-length')) { + responseBodySize = int.parse(responseHeaders['content-length'] ?? '0'); + } else { + responseBodySize = response.body.length; + } + + networkLogger.networkLog(requestData.copyWith( + status: response.statusCode, + duration: endTime.difference(requestData.startTime).inMicroseconds, + responseContentType: response.headers.containsKey('content-type') + ? response.headers['content-type'] + : '', + responseHeaders: responseHeaders, + responseBody: response.body, + requestBodySize: requestBodySize, + responseBodySize: responseBodySize, + requestContentType: request.headers.containsKey('content-type') + ? request.headers['content-type'] + : '', + )); + } +} diff --git a/packages/instabug_http_client/pubspec.lock b/packages/instabug_http_client/pubspec.lock new file mode 100644 index 000000000..bfa7d56c6 --- /dev/null +++ b/packages/instabug_http_client/pubspec.lock @@ -0,0 +1,620 @@ +# Generated by pub +# See https://dart.dev/tools/pub/glossary#lockfile +packages: + _fe_analyzer_shared: + dependency: transitive + description: + name: _fe_analyzer_shared + sha256: ae92f5d747aee634b87f89d9946000c2de774be1d6ac3e58268224348cd0101a + url: "https://pub.dev" + source: hosted + version: "61.0.0" + analyzer: + dependency: transitive + description: + name: analyzer + sha256: ea3d8652bda62982addfd92fdc2d0214e5f82e43325104990d4f4c4a2a313562 + url: "https://pub.dev" + source: hosted + version: "5.13.0" + args: + dependency: transitive + description: + name: args + sha256: bf9f5caeea8d8fe6721a9c358dd8a5c1947b27f1cfaa18b39c301273594919e6 + url: "https://pub.dev" + source: hosted + version: "2.6.0" + async: + dependency: transitive + description: + name: async + sha256: "947bfcf187f74dbc5e146c9eb9c0f10c9f8b30743e341481c1e2ed3ecc18c20c" + url: "https://pub.dev" + source: hosted + version: "2.11.0" + boolean_selector: + dependency: transitive + description: + name: boolean_selector + sha256: "6cfb5af12253eaf2b368f07bacc5a80d1301a071c73360d746b7f2e32d762c66" + url: "https://pub.dev" + source: hosted + version: "2.1.1" + build: + dependency: transitive + description: + name: build + sha256: "80184af8b6cb3e5c1c4ec6d8544d27711700bc3e6d2efad04238c7b5290889f0" + url: "https://pub.dev" + source: hosted + version: "2.4.1" + build_config: + dependency: transitive + description: + name: build_config + sha256: bf80fcfb46a29945b423bd9aad884590fb1dc69b330a4d4700cac476af1708d1 + url: "https://pub.dev" + source: hosted + version: "1.1.1" + build_daemon: + dependency: transitive + description: + name: build_daemon + sha256: "79b2aef6ac2ed00046867ed354c88778c9c0f029df8a20fe10b5436826721ef9" + url: "https://pub.dev" + source: hosted + version: "4.0.2" + build_resolvers: + dependency: transitive + description: + name: build_resolvers + sha256: "339086358431fa15d7eca8b6a36e5d783728cf025e559b834f4609a1fcfb7b0a" + url: "https://pub.dev" + source: hosted + version: "2.4.2" + build_runner: + dependency: "direct dev" + description: + name: build_runner + sha256: "028819cfb90051c6b5440c7e574d1896f8037e3c96cf17aaeb054c9311cfbf4d" + url: "https://pub.dev" + source: hosted + version: "2.4.13" + build_runner_core: + dependency: transitive + description: + name: build_runner_core + sha256: f8126682b87a7282a339b871298cc12009cb67109cfa1614d6436fb0289193e0 + url: "https://pub.dev" + source: hosted + version: "7.3.2" + built_collection: + dependency: transitive + description: + name: built_collection + sha256: "376e3dd27b51ea877c28d525560790aee2e6fbb5f20e2f85d5081027d94e2100" + url: "https://pub.dev" + source: hosted + version: "5.1.1" + built_value: + dependency: transitive + description: + name: built_value + sha256: c7913a9737ee4007efedaffc968c049fd0f3d0e49109e778edc10de9426005cb + url: "https://pub.dev" + source: hosted + version: "8.9.2" + characters: + dependency: transitive + description: + name: characters + sha256: "04a925763edad70e8443c99234dc3328f442e811f1d8fd1a72f1c8ad0f69a605" + url: "https://pub.dev" + source: hosted + version: "1.3.0" + checked_yaml: + dependency: transitive + description: + name: checked_yaml + sha256: feb6bed21949061731a7a75fc5d2aa727cf160b91af9a3e464c5e3a32e28b5ff + url: "https://pub.dev" + source: hosted + version: "2.0.3" + cli_util: + dependency: transitive + description: + name: cli_util + sha256: ff6785f7e9e3c38ac98b2fb035701789de90154024a75b6cb926445e83197d1c + url: "https://pub.dev" + source: hosted + version: "0.4.2" + clock: + dependency: transitive + description: + name: clock + sha256: cb6d7f03e1de671e34607e909a7213e31d7752be4fb66a86d29fe1eb14bfb5cf + url: "https://pub.dev" + source: hosted + version: "1.1.1" + code_builder: + dependency: transitive + description: + name: code_builder + sha256: "0ec10bf4a89e4c613960bf1e8b42c64127021740fb21640c29c909826a5eea3e" + url: "https://pub.dev" + source: hosted + version: "4.10.1" + collection: + dependency: transitive + description: + name: collection + sha256: a1ace0a119f20aabc852d165077c036cd864315bd99b7eaa10a60100341941bf + url: "https://pub.dev" + source: hosted + version: "1.19.0" + convert: + dependency: transitive + description: + name: convert + sha256: b30acd5944035672bc15c6b7a8b47d773e41e2f17de064350988c5d02adb1c68 + url: "https://pub.dev" + source: hosted + version: "3.1.2" + crypto: + dependency: transitive + description: + name: crypto + sha256: "1e445881f28f22d6140f181e07737b22f1e099a5e1ff94b0af2f9e4a463f4855" + url: "https://pub.dev" + source: hosted + version: "3.0.6" + csslib: + dependency: transitive + description: + name: csslib + sha256: "09bad715f418841f976c77db72d5398dc1253c21fb9c0c7f0b0b985860b2d58e" + url: "https://pub.dev" + source: hosted + version: "1.0.2" + dart_style: + dependency: transitive + description: + name: dart_style + sha256: "1efa911ca7086affd35f463ca2fc1799584fb6aa89883cf0af8e3664d6a02d55" + url: "https://pub.dev" + source: hosted + version: "2.3.2" + fake_async: + dependency: transitive + description: + name: fake_async + sha256: "511392330127add0b769b75a987850d136345d9227c6b94c96a04cf4a391bf78" + url: "https://pub.dev" + source: hosted + version: "1.3.1" + file: + dependency: transitive + description: + name: file + sha256: a3b4f84adafef897088c160faf7dfffb7696046cb13ae90b508c2cbc95d3b8d4 + url: "https://pub.dev" + source: hosted + version: "7.0.1" + fixnum: + dependency: transitive + description: + name: fixnum + sha256: b6dc7065e46c974bc7c5f143080a6764ec7a4be6da1285ececdc37be96de53be + url: "https://pub.dev" + source: hosted + version: "1.1.1" + flutter: + dependency: "direct main" + description: flutter + source: sdk + version: "0.0.0" + flutter_test: + dependency: "direct dev" + description: flutter + source: sdk + version: "0.0.0" + frontend_server_client: + dependency: transitive + description: + name: frontend_server_client + sha256: f64a0333a82f30b0cca061bc3d143813a486dc086b574bfb233b7c1372427694 + url: "https://pub.dev" + source: hosted + version: "4.0.0" + glob: + dependency: transitive + description: + name: glob + sha256: "0e7014b3b7d4dac1ca4d6114f82bf1782ee86745b9b42a92c9289c23d8a0ab63" + url: "https://pub.dev" + source: hosted + version: "2.1.2" + graphs: + dependency: transitive + description: + name: graphs + sha256: "741bbf84165310a68ff28fe9e727332eef1407342fca52759cb21ad8177bb8d0" + url: "https://pub.dev" + source: hosted + version: "2.3.2" + html: + dependency: transitive + description: + name: html + sha256: "6d1264f2dffa1b1101c25a91dff0dc2daee4c18e87cd8538729773c073dbf602" + url: "https://pub.dev" + source: hosted + version: "0.15.6" + http: + dependency: "direct main" + description: + name: http + sha256: "5895291c13fa8a3bd82e76d5627f69e0d85ca6a30dcac95c4ea19a5d555879c2" + url: "https://pub.dev" + source: hosted + version: "0.13.6" + http_multi_server: + dependency: transitive + description: + name: http_multi_server + sha256: "97486f20f9c2f7be8f514851703d0119c3596d14ea63227af6f7a481ef2b2f8b" + url: "https://pub.dev" + source: hosted + version: "3.2.1" + http_parser: + dependency: transitive + description: + name: http_parser + sha256: "2aa08ce0341cc9b354a498388e30986515406668dbcc4f7c950c3e715496693b" + url: "https://pub.dev" + source: hosted + version: "4.0.2" + instabug_flutter: + dependency: "direct main" + description: + path: "../instabug_flutter" + relative: true + source: path + version: "15.0.2" + io: + dependency: transitive + description: + name: io + sha256: "2ec25704aba361659e10e3e5f5d672068d332fc8ac516421d483a11e5cbd061e" + url: "https://pub.dev" + source: hosted + version: "1.0.4" + js: + dependency: transitive + description: + name: js + sha256: c1b2e9b5ea78c45e1a0788d29606ba27dc5f71f019f32ca5140f61ef071838cf + url: "https://pub.dev" + source: hosted + version: "0.7.1" + json_annotation: + dependency: transitive + description: + name: json_annotation + sha256: "1ce844379ca14835a50d2f019a3099f419082cfdd231cd86a142af94dd5c6bb1" + url: "https://pub.dev" + source: hosted + version: "4.9.0" + leak_tracker: + dependency: transitive + description: + name: leak_tracker + sha256: "7bb2830ebd849694d1ec25bf1f44582d6ac531a57a365a803a6034ff751d2d06" + url: "https://pub.dev" + source: hosted + version: "10.0.7" + leak_tracker_flutter_testing: + dependency: transitive + description: + name: leak_tracker_flutter_testing + sha256: "9491a714cca3667b60b5c420da8217e6de0d1ba7a5ec322fab01758f6998f379" + url: "https://pub.dev" + source: hosted + version: "3.0.8" + leak_tracker_testing: + dependency: transitive + description: + name: leak_tracker_testing + sha256: "6ba465d5d76e67ddf503e1161d1f4a6bc42306f9d66ca1e8f079a47290fb06d3" + url: "https://pub.dev" + source: hosted + version: "3.0.1" + logging: + dependency: transitive + description: + name: logging + sha256: c8245ada5f1717ed44271ed1c26b8ce85ca3228fd2ffdb75468ab01979309d61 + url: "https://pub.dev" + source: hosted + version: "1.3.0" + markdown: + dependency: transitive + description: + name: markdown + sha256: "935e23e1ff3bc02d390bad4d4be001208ee92cc217cb5b5a6c19bc14aaa318c1" + url: "https://pub.dev" + source: hosted + version: "7.3.0" + matcher: + dependency: transitive + description: + name: matcher + sha256: d2323aa2060500f906aa31a895b4030b6da3ebdcc5619d14ce1aada65cd161cb + url: "https://pub.dev" + source: hosted + version: "0.12.16+1" + material_color_utilities: + dependency: transitive + description: + name: material_color_utilities + sha256: f7142bb1154231d7ea5f96bc7bde4bda2a0945d2806bb11670e30b850d56bdec + url: "https://pub.dev" + source: hosted + version: "0.11.1" + meta: + dependency: "direct main" + description: + name: meta + sha256: bdb68674043280c3428e9ec998512fb681678676b3c54e773629ffe74419f8c7 + url: "https://pub.dev" + source: hosted + version: "1.15.0" + mime: + dependency: transitive + description: + name: mime + sha256: "41a20518f0cb1256669420fdba0cd90d21561e560ac240f26ef8322e45bb7ed6" + url: "https://pub.dev" + source: hosted + version: "2.0.0" + mockito: + dependency: "direct dev" + description: + name: mockito + sha256: "6841eed20a7befac0ce07df8116c8b8233ed1f4486a7647c7fc5a02ae6163917" + url: "https://pub.dev" + source: hosted + version: "5.4.4" + package_config: + dependency: transitive + description: + name: package_config + sha256: "1c5b77ccc91e4823a5af61ee74e6b972db1ef98c2ff5a18d3161c982a55448bd" + url: "https://pub.dev" + source: hosted + version: "2.1.0" + pana: + dependency: "direct dev" + description: + name: pana + sha256: "098eecfb7f80aecfff2395f9de1f19e31e7dc9a190708b75a1e708e6c2993c36" + url: "https://pub.dev" + source: hosted + version: "0.21.32" + path: + dependency: transitive + description: + name: path + sha256: "087ce49c3f0dc39180befefc60fdb4acd8f8620e5682fe2476afd0b3688bb4af" + url: "https://pub.dev" + source: hosted + version: "1.9.0" + pool: + dependency: transitive + description: + name: pool + sha256: "20fe868b6314b322ea036ba325e6fc0711a22948856475e2c2b6306e8ab39c2a" + url: "https://pub.dev" + source: hosted + version: "1.5.1" + pub_semver: + dependency: transitive + description: + name: pub_semver + sha256: "40d3ab1bbd474c4c2328c91e3a7df8c6dd629b79ece4c4bd04bee496a224fb0c" + url: "https://pub.dev" + source: hosted + version: "2.1.4" + pubspec_parse: + dependency: transitive + description: + name: pubspec_parse + sha256: c799b721d79eb6ee6fa56f00c04b472dcd44a30d258fac2174a6ec57302678f8 + url: "https://pub.dev" + source: hosted + version: "1.3.0" + retry: + dependency: transitive + description: + name: retry + sha256: "822e118d5b3aafed083109c72d5f484c6dc66707885e07c0fbcb8b986bba7efc" + url: "https://pub.dev" + source: hosted + version: "3.1.2" + safe_url_check: + dependency: transitive + description: + name: safe_url_check + sha256: "49a3e060a7869cbafc8f4845ca1ecbbaaa53179980a32f4fdfeab1607e90f41d" + url: "https://pub.dev" + source: hosted + version: "1.1.2" + shelf: + dependency: transitive + description: + name: shelf + sha256: ad29c505aee705f41a4d8963641f91ac4cee3c8fad5947e033390a7bd8180fa4 + url: "https://pub.dev" + source: hosted + version: "1.4.1" + shelf_web_socket: + dependency: transitive + description: + name: shelf_web_socket + sha256: "073c147238594ecd0d193f3456a5fe91c4b0abbcc68bf5cd95b36c4e194ac611" + url: "https://pub.dev" + source: hosted + version: "2.0.0" + sky_engine: + dependency: transitive + description: flutter + source: sdk + version: "0.0.0" + source_gen: + dependency: transitive + description: + name: source_gen + sha256: "14658ba5f669685cd3d63701d01b31ea748310f7ab854e471962670abcf57832" + url: "https://pub.dev" + source: hosted + version: "1.5.0" + source_span: + dependency: transitive + description: + name: source_span + sha256: "53e943d4206a5e30df338fd4c6e7a077e02254531b138a15aec3bd143c1a8b3c" + url: "https://pub.dev" + source: hosted + version: "1.10.0" + stack_trace: + dependency: transitive + description: + name: stack_trace + sha256: "9f47fd3630d76be3ab26f0ee06d213679aa425996925ff3feffdec504931c377" + url: "https://pub.dev" + source: hosted + version: "1.12.0" + stream_channel: + dependency: transitive + description: + name: stream_channel + sha256: ba2aa5d8cc609d96bbb2899c28934f9e1af5cddbd60a827822ea467161eb54e7 + url: "https://pub.dev" + source: hosted + version: "2.1.2" + stream_transform: + dependency: transitive + description: + name: stream_transform + sha256: "14a00e794c7c11aa145a170587321aedce29769c08d7f58b1d141da75e3b1c6f" + url: "https://pub.dev" + source: hosted + version: "2.1.0" + string_scanner: + dependency: transitive + description: + name: string_scanner + sha256: "688af5ed3402a4bde5b3a6c15fd768dbf2621a614950b17f04626c431ab3c4c3" + url: "https://pub.dev" + source: hosted + version: "1.3.0" + tar: + dependency: transitive + description: + name: tar + sha256: "85ffd53e277f2bac8afa2885e6b195e26937e9c402424c3d88d92fd920b56de9" + url: "https://pub.dev" + source: hosted + version: "0.5.6" + term_glyph: + dependency: transitive + description: + name: term_glyph + sha256: a29248a84fbb7c79282b40b8c72a1209db169a2e0542bce341da992fe1bc7e84 + url: "https://pub.dev" + source: hosted + version: "1.2.1" + test_api: + dependency: transitive + description: + name: test_api + sha256: "664d3a9a64782fcdeb83ce9c6b39e78fd2971d4e37827b9b06c3aa1edc5e760c" + url: "https://pub.dev" + source: hosted + version: "0.7.3" + timing: + dependency: transitive + description: + name: timing + sha256: "70a3b636575d4163c477e6de42f247a23b315ae20e86442bebe32d3cabf61c32" + url: "https://pub.dev" + source: hosted + version: "1.0.1" + typed_data: + dependency: transitive + description: + name: typed_data + sha256: f9049c039ebfeb4cf7a7104a675823cd72dba8297f264b6637062516699fa006 + url: "https://pub.dev" + source: hosted + version: "1.4.0" + vector_math: + dependency: transitive + description: + name: vector_math + sha256: "80b3257d1492ce4d091729e3a67a60407d227c27241d6927be0130c98e741803" + url: "https://pub.dev" + source: hosted + version: "2.1.4" + vm_service: + dependency: transitive + description: + name: vm_service + sha256: f6be3ed8bd01289b34d679c2b62226f63c0e69f9fd2e50a6b3c1c729a961041b + url: "https://pub.dev" + source: hosted + version: "14.3.0" + watcher: + dependency: transitive + description: + name: watcher + sha256: "3d2ad6751b3c16cf07c7fca317a1413b3f26530319181b37e3b9039b84fc01d8" + url: "https://pub.dev" + source: hosted + version: "1.1.0" + web: + dependency: transitive + description: + name: web + sha256: cd3543bd5798f6ad290ea73d210f423502e71900302dde696f8bff84bf89a1cb + url: "https://pub.dev" + source: hosted + version: "1.1.0" + web_socket: + dependency: transitive + description: + name: web_socket + sha256: "3c12d96c0c9a4eec095246debcea7b86c0324f22df69893d538fcc6f1b8cce83" + url: "https://pub.dev" + source: hosted + version: "0.1.6" + web_socket_channel: + dependency: transitive + description: + name: web_socket_channel + sha256: "9f187088ed104edd8662ca07af4b124465893caf063ba29758f97af57e61da8f" + url: "https://pub.dev" + source: hosted + version: "3.0.1" + yaml: + dependency: transitive + description: + name: yaml + sha256: "75769501ea3489fca56601ff33454fe45507ea3bfb014161abc3b43ae25989d5" + url: "https://pub.dev" + source: hosted + version: "3.1.2" +sdks: + dart: ">=3.5.0 <4.0.0" + flutter: ">=3.18.0-18.0.pre.54" diff --git a/packages/instabug_http_client/pubspec.yaml b/packages/instabug_http_client/pubspec.yaml new file mode 100644 index 000000000..af206431b --- /dev/null +++ b/packages/instabug_http_client/pubspec.yaml @@ -0,0 +1,29 @@ +name: instabug_http_client +description: + This package is an add on to instabug_flutter. It intercepts any requests performed + with http Package and sends them to the report that will be sent to the dashboard. +version: 2.6.0 +homepage: https://github.com/Instabug/Instabug-Flutter#readme +documentation: https://docs.instabug.com/docs/flutter-overview +repository: https://github.com/Instabug/Instabug-Flutter/tree/refactor/monorepo/packages/instabug_http_client + +environment: + sdk: '>=2.12.0 <4.0.0' + +dependencies: + flutter: + sdk: flutter + http: ">=0.13.0 <2.0.0" + instabug_flutter: ">=14.0.0 <15.0.0" + meta: ^1.3.0 + +dev_dependencies: + build_runner: ^2.1.1 + flutter_test: + sdk: flutter + mockito: ^5.0.10 + pana: ^0.21.0 +# For information on the generic Dart part of this file, see the +# following page: https://www.dartlang.org/tools/pub/pubspec + +# The following section is specific to Flutter. diff --git a/packages/instabug_http_client/pubspec_overrides.yaml b/packages/instabug_http_client/pubspec_overrides.yaml new file mode 100644 index 000000000..1f0beaf62 --- /dev/null +++ b/packages/instabug_http_client/pubspec_overrides.yaml @@ -0,0 +1,4 @@ +# melos_managed_dependency_overrides: instabug_flutter +dependency_overrides: + instabug_flutter: + path: ../instabug_flutter diff --git a/packages/instabug_http_client/release.sh b/packages/instabug_http_client/release.sh new file mode 100644 index 000000000..39212c393 --- /dev/null +++ b/packages/instabug_http_client/release.sh @@ -0,0 +1,13 @@ +#!/bin/sh +VERSION=$(egrep -o "version: ([0-9]-*.*)+[0-9]" pubspec.yaml | cut -d ":" -f 2) +if [ ! "${VERSION}" ] || [ -z "${VERSION}" ];then + echo "Instabug: err: Version Number not found." + exit 1 +else + mkdir -p .pub-cache + cat < $HOME/.pub-cache/credentials.json + ${PUB_CREDENTIALS} + +EOF + flutter packages pub publish -f +fi \ No newline at end of file diff --git a/packages/instabug_http_client/test/instabug_http_client_test.dart b/packages/instabug_http_client/test/instabug_http_client_test.dart new file mode 100644 index 000000000..9d77b1525 --- /dev/null +++ b/packages/instabug_http_client/test/instabug_http_client_test.dart @@ -0,0 +1,198 @@ +import 'dart:convert'; +import 'dart:io'; +// to maintain supported versions prior to Flutter 3.3 +// ignore: unnecessary_import +import 'dart:typed_data'; + +import 'package:flutter_test/flutter_test.dart'; +import 'package:http/http.dart' as http; +import 'package:http/testing.dart'; +import 'package:instabug_flutter/instabug_flutter.dart'; +import 'package:instabug_flutter/src/generated/instabug.api.g.dart'; +import 'package:instabug_http_client/instabug_http_client.dart'; +import 'package:instabug_http_client/instabug_http_logger.dart'; +import 'package:mockito/annotations.dart'; +import 'package:mockito/mockito.dart'; + +import 'instabug_http_client_test.mocks.dart'; + +@GenerateMocks([ + InstabugHttpLogger, + InstabugHttpClient, + InstabugHostApi, +]) +Future main() async { + TestWidgetsFlutterBinding.ensureInitialized(); + final MockInstabugHostApi mHost = MockInstabugHostApi(); + + setUpAll(() { + Instabug.$setHostApi(mHost); + NetworkLogger.$setHostApi(mHost); + when(mHost.isW3CFeatureFlagsEnabled()) + .thenAnswer((_) => Future>.value({ + 'isW3cCaughtHeaderEnabled': true, + 'isW3cExternalGeneratedHeaderEnabled': false, + 'isW3cExternalTraceIDEnabled': true, + })); + }); + + const Map fakeResponse = { + 'id': '123', + 'activationCode': '111111', + }; + late Uri url; + final http.Response mockedResponse = + http.Response(json.encode(fakeResponse), 200); + + late InstabugHttpClient instabugHttpClient; + + setUp(() { + url = Uri.parse('http://www.instabug.com'); + instabugHttpClient = InstabugHttpClient(); + instabugHttpClient.client = MockInstabugHttpClient(); + instabugHttpClient.logger = MockInstabugHttpLogger(); + }); + + test('expect instabug http client GET to return response', () async { + when( + instabugHttpClient.client.get(url, headers: anyNamed('headers'))) + .thenAnswer((_) async => mockedResponse); + final http.Response result = await instabugHttpClient.get(url); + expect(result, isInstanceOf()); + expect(result, mockedResponse); + verify(instabugHttpClient.logger + .onLogger(mockedResponse, startTime: anyNamed('startTime'))) + .called(1); + }); + + test('expect instabug http client HEAD to return response', () async { + when( + instabugHttpClient.client.head(url, headers: anyNamed('headers'))) + .thenAnswer((_) async => mockedResponse); + final http.Response result = await instabugHttpClient.head(url); + expect(result, isInstanceOf()); + expect(result, mockedResponse); + verify(instabugHttpClient.logger + .onLogger(mockedResponse, startTime: anyNamed('startTime'))) + .called(1); + }); + + test('expect instabug http client DELETE to return response', () async { + when( + instabugHttpClient.client.delete(url, headers: anyNamed('headers'))) + .thenAnswer((_) async => mockedResponse); + final http.Response result = await instabugHttpClient.delete(url); + expect(result, isInstanceOf()); + expect(result, mockedResponse); + verify(instabugHttpClient.logger + .onLogger(mockedResponse, startTime: anyNamed('startTime'))) + .called(1); + }); + + test('expect instabug http client PATCH to return response', () async { + when( + instabugHttpClient.client.patch(url, headers: anyNamed('headers'))) + .thenAnswer((_) async => mockedResponse); + final http.Response result = await instabugHttpClient.patch(url); + expect(result, isInstanceOf()); + expect(result, mockedResponse); + verify(instabugHttpClient.logger + .onLogger(mockedResponse, startTime: anyNamed('startTime'))) + .called(1); + }); + + test('expect instabug http client POST to return response', () async { + when( + instabugHttpClient.client.post(url, headers: anyNamed('headers'))) + .thenAnswer((_) async => mockedResponse); + final http.Response result = await instabugHttpClient.post(url); + expect(result, isInstanceOf()); + expect(result, mockedResponse); + verify(instabugHttpClient.logger + .onLogger(mockedResponse, startTime: anyNamed('startTime'))) + .called(1); + }); + + test('expect instabug http client PUT to return response', () async { + when( + instabugHttpClient.client.put(url, headers: anyNamed('headers'))) + .thenAnswer((_) async => mockedResponse); + final http.Response result = await instabugHttpClient.put(url); + expect(result, isInstanceOf()); + expect(result.body, mockedResponse.body); + verify(instabugHttpClient.logger + .onLogger(mockedResponse, startTime: anyNamed('startTime'))) + .called(1); + }); + + test('expect instabug http client READ to return response', () async { + const String response = 'Some response string'; + when( + instabugHttpClient.client.read(url, headers: anyNamed('headers'))) + .thenAnswer((_) async => response); + + final String result = await instabugHttpClient.read(url); + expect(result, isInstanceOf()); + expect(result, response); + }); + + test('expect instabug http client READBYTES to return response', () async { + final Uint8List response = Uint8List(3); + instabugHttpClient.client = + MockClient((_) async => http.Response.bytes(response, 200)); + + final Uint8List result = await instabugHttpClient.readBytes(url); + expect(result, isInstanceOf()); + expect(result, response); + }); + + test('expect instabug http client SEND to return response', () async { + final http.StreamedResponse response = http.StreamedResponse( + const Stream>.empty(), 200, + contentLength: 0); + final http.StreamedRequest request = http.StreamedRequest('POST', url) + ..headers[HttpHeaders.contentTypeHeader] = + 'application/json; charset=utf-8' + ..headers[HttpHeaders.userAgentHeader] = 'Dart'; + when(instabugHttpClient.client.send(request)) + .thenAnswer((_) async => response); + final Future responseFuture = + instabugHttpClient.send(request); + request + ..sink.add('{"hello": "world"}'.codeUnits) + ..sink.close(); + + final http.StreamedResponse result = await responseFuture; + expect(result, isInstanceOf()); + expect(result.headers, response.headers); + expect(result.statusCode, response.statusCode); + expect(result.contentLength, response.contentLength); + expect(result.isRedirect, response.isRedirect); + expect(result.persistentConnection, response.persistentConnection); + expect(result.reasonPhrase, response.reasonPhrase); + expect(result.request, response.request); + expect(await result.stream.bytesToString(), + await response.stream.bytesToString()); + final MockInstabugHttpLogger logger = + instabugHttpClient.logger as MockInstabugHttpLogger; + verify(logger.onLogger(any, startTime: anyNamed('startTime'))).called(1); + }); + + test('expect instabug http client CLOSE to be called', () async { + instabugHttpClient.close(); + + verify(instabugHttpClient.client.close()); + }); + + test('stress test for GET method', () async { + when( + instabugHttpClient.client.get(url, headers: anyNamed('headers'))) + .thenAnswer((_) async => mockedResponse); + for (int i = 0; i < 10000; i++) { + await instabugHttpClient.get(url); + } + verify(instabugHttpClient.logger + .onLogger(mockedResponse, startTime: anyNamed('startTime'))) + .called(10000); + }); +} diff --git a/pubspec.yaml b/pubspec.yaml index ba6dd0be2..e31787f54 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -1,39 +1,11 @@ -name: instabug_flutter -version: 13.4.0 -description: >- - Instabug empowers mobile teams to monitor, prioritize, and debug - performance and stability issues throughout the app development lifecycle. -homepage: https://www.instabug.com/platforms/flutter -repository: https://github.com/Instabug/Instabug-Flutter -documentation: https://docs.instabug.com/docs/flutter-overview - -dependencies: - flutter: - sdk: flutter - meta: ^1.3.0 - stack_trace: ^1.10.0 +name: instabug_flutter_mono +publish_to: none +environment: + sdk: '>=2.19.4 <4.0.0' + flutter: ">=2.10.0" dev_dependencies: - build_runner: ^2.0.3 - fake_async: '>=1.2.0 <1.4.0' - flutter_test: - sdk: flutter - lint: ^1.0.0 - # mockito v5.2.0 is needed for running Flutter 2 tests on CI - mockito: '>=5.2.0 <5.5.0' - pana: ^0.21.0 - # pigeon v3.0.0 is needed for running Flutter 2 tests on CI - pigeon: '>=3.0.0 <=10.1.5' + lint: 2.0.0 + melos: ^6.2.0 -flutter: - plugin: - platforms: - android: - package: com.instabug.flutter - pluginClass: InstabugFlutterPlugin - ios: - pluginClass: InstabugFlutterPlugin -environment: - sdk: ">=2.14.0 <4.0.0" - flutter: ">=1.17.0" diff --git a/scripts/init.sh b/scripts/init.sh new file mode 100644 index 000000000..1191ca84f --- /dev/null +++ b/scripts/init.sh @@ -0,0 +1,47 @@ +#!/bin/bash + +if [ -d "android" ]; then + rm -rf "android" + echo "Folder android and its contents removed" +fi + +if [ -d "ios" ]; then + rm -rf "ios" + echo "Folder ios and its contents removed" +fi + + +if [ -d "build" ]; then + rm -rf "build" + echo "Folder build and its contents removed" +fi + +if [ -d "lib" ]; then + rm -rf "lib" + echo "Folder lib and its contents removed" +fi + +if [ -d "test" ]; then + rm -rf "test" + echo "Folder test and its contents removed" +fi + +if [ -d "example" ]; then + rm -rf "example" + echo "Folder example and its contents removed" +fi + +if command -v melos &> /dev/null +then + echo "Melos found" +else + echo "Melos not found" + dart pub global activate melos && echo 'export PATH="$PATH:$HOME/.pub-cache/bin"' >> $BASH_ENV +fi + + +melos bootstrap +melos dart_bootstrap +melos pigeon --no-select +melos generate --no-select +melos pods --no-select diff --git a/scripts/move_coverage_files.sh b/scripts/move_coverage_files.sh new file mode 100644 index 000000000..5deea44e2 --- /dev/null +++ b/scripts/move_coverage_files.sh @@ -0,0 +1,13 @@ +#!/bin/bash + +# Set source and target directories +TARGET_DIR="../../../coverage" + + + # Create the target directory if it doesn't exist + mkdir -p "$TARGET_DIR" + + mv "lcov.info" "$TARGET_DIR/lcov-${MELOS_PACKAGE_NAME}.info" + + echo "All files moved successfully." + diff --git a/test/network_logger_test.dart b/test/network_logger_test.dart deleted file mode 100644 index e5a04e236..000000000 --- a/test/network_logger_test.dart +++ /dev/null @@ -1,146 +0,0 @@ -import 'dart:async'; - -import 'package:flutter/widgets.dart'; -import 'package:flutter_test/flutter_test.dart'; -import 'package:instabug_flutter/instabug_flutter.dart'; -import 'package:instabug_flutter/src/generated/apm.api.g.dart'; -import 'package:instabug_flutter/src/generated/instabug.api.g.dart'; -import 'package:instabug_flutter/src/utils/ibg_build_info.dart'; -import 'package:instabug_flutter/src/utils/network_manager.dart'; -import 'package:mockito/annotations.dart'; -import 'package:mockito/mockito.dart'; - -import 'network_logger_test.mocks.dart'; - -@GenerateMocks([ - ApmHostApi, - InstabugHostApi, - IBGBuildInfo, - NetworkManager, -]) -void main() { - TestWidgetsFlutterBinding.ensureInitialized(); - WidgetsFlutterBinding.ensureInitialized(); - - final mApmHost = MockApmHostApi(); - final mInstabugHost = MockInstabugHostApi(); - final mBuildInfo = MockIBGBuildInfo(); - final mManager = MockNetworkManager(); - - final logger = NetworkLogger(); - final data = NetworkData( - url: "https://httpbin.org/get", - method: "GET", - startTime: DateTime.now(), - ); - - setUpAll(() { - APM.$setHostApi(mApmHost); - NetworkLogger.$setHostApi(mInstabugHost); - NetworkLogger.$setManager(mManager); - IBGBuildInfo.setInstance(mBuildInfo); - }); - - setUp(() { - reset(mApmHost); - reset(mInstabugHost); - reset(mBuildInfo); - reset(mManager); - }); - - test('[networkLog] should call 1 host method on iOS', () async { - when(mBuildInfo.isAndroid).thenReturn(false); - when(mManager.obfuscateLog(data)).thenReturn(data); - when(mManager.omitLog(data)).thenReturn(false); - - await logger.networkLog(data); - - verify( - mInstabugHost.networkLog(data.toJson()), - ).called(1); - - verifyNever( - mApmHost.networkLogAndroid(data.toJson()), - ); - }); - - test('[networkLog] should call 2 host methods on Android', () async { - when(mBuildInfo.isAndroid).thenReturn(true); - when(mManager.obfuscateLog(data)).thenReturn(data); - when(mManager.omitLog(data)).thenReturn(false); - - await logger.networkLog(data); - - verify( - mInstabugHost.networkLog(data.toJson()), - ).called(1); - - verify( - mApmHost.networkLogAndroid(data.toJson()), - ).called(1); - }); - - test('[networkLog] should obfuscate network data before logging', () async { - final obfuscated = data.copyWith(requestBody: 'obfuscated'); - - when(mBuildInfo.isAndroid).thenReturn(true); - when(mManager.obfuscateLog(data)).thenReturn(obfuscated); - when(mManager.omitLog(data)).thenReturn(false); - - await logger.networkLog(data); - - verify( - mManager.obfuscateLog(data), - ).called(1); - - verify( - mInstabugHost.networkLog(obfuscated.toJson()), - ).called(1); - - verify( - mApmHost.networkLogAndroid(obfuscated.toJson()), - ).called(1); - }); - - test('[networkLog] should not log data if it should be omitted', () async { - const omit = true; - - when(mBuildInfo.isAndroid).thenReturn(true); - when(mManager.obfuscateLog(data)).thenReturn(data); - when(mManager.omitLog(data)).thenReturn(omit); - - await logger.networkLog(data); - - verify( - mManager.omitLog(data), - ).called(1); - - verifyNever( - mInstabugHost.networkLog(data.toJson()), - ); - - verifyNever( - mApmHost.networkLogAndroid(data.toJson()), - ); - }); - - test('[obfuscateLog] should set obfuscation callback on manager', () async { - FutureOr callback(NetworkData data) => data; - - NetworkLogger.obfuscateLog(callback); - - verify( - mManager.setObfuscateLogCallback(callback), - ).called(1); - }); - - test('[omitLog] should set omission callback on manager', () async { - FutureOr callback(NetworkData data) => true; - - NetworkLogger.omitLog(callback); - - verify( - mManager.setOmitLogCallback(callback), - ).called(1); - }); -} diff --git a/test/trace_test.dart b/test/trace_test.dart deleted file mode 100644 index 2415420be..000000000 --- a/test/trace_test.dart +++ /dev/null @@ -1,46 +0,0 @@ -import 'package:flutter/widgets.dart'; -import 'package:flutter_test/flutter_test.dart'; -import 'package:instabug_flutter/instabug_flutter.dart'; -import 'package:instabug_flutter/src/generated/apm.api.g.dart'; -import 'package:mockito/annotations.dart'; -import 'package:mockito/mockito.dart'; - -import 'trace_test.mocks.dart'; - -@GenerateMocks([ - ApmHostApi, -]) -void main() { - TestWidgetsFlutterBinding.ensureInitialized(); - WidgetsFlutterBinding.ensureInitialized(); - - final mHost = MockApmHostApi(); - final trace = Trace( - id: "trace", - name: "Execution Trace", - ); - - setUpAll(() { - APM.$setHostApi(mHost); - }); - - test('[end] should call host method', () async { - // ignore: deprecated_member_use_from_same_package - trace.end(); - - verify( - mHost.endExecutionTrace(trace.id), - ).called(1); - }); - - test('[setAttribute] should call host method', () async { - const key = "attr-key"; - const attribute = "Trace Attribute"; - // ignore: deprecated_member_use_from_same_package - trace.setAttribute(key, attribute); - - verify( - mHost.setExecutionTraceAttribute(trace.id, key, attribute), - ).called(1); - }); -}