diff --git a/packages/instabug_dio_interceptor/example/ios/Podfile.lock b/packages/instabug_dio_interceptor/example/ios/Podfile.lock new file mode 100644 index 000000000..8a17c66b4 --- /dev/null +++ b/packages/instabug_dio_interceptor/example/ios/Podfile.lock @@ -0,0 +1,29 @@ +PODS: + - Flutter (1.0.0) + - Instabug (14.0.0) + - instabug_flutter (14.0.0): + - Flutter + - Instabug (= 14.0.0) + +DEPENDENCIES: + - Flutter (from `Flutter`) + - instabug_flutter (from `.symlinks/plugins/instabug_flutter/ios`) + +SPEC REPOS: + trunk: + - Instabug + +EXTERNAL SOURCES: + Flutter: + :path: Flutter + instabug_flutter: + :path: ".symlinks/plugins/instabug_flutter/ios" + +SPEC CHECKSUMS: + Flutter: e0871f40cf51350855a761d2e70bf5af5b9b5de7 + Instabug: a0beffc01658773e2fac549845782f8937707dc4 + instabug_flutter: ff8ab5ff34a476b1d2d887478ec190cda962b973 + +PODFILE CHECKSUM: eb179eda02c4d9ce45db6b1912a419962f739320 + +COCOAPODS: 1.14.3 diff --git a/packages/instabug_dio_interceptor/lib/instabug_dio_interceptor.dart b/packages/instabug_dio_interceptor/lib/instabug_dio_interceptor.dart index 8de42f9cf..72b8af3ae 100644 --- a/packages/instabug_dio_interceptor/lib/instabug_dio_interceptor.dart +++ b/packages/instabug_dio_interceptor/lib/instabug_dio_interceptor.dart @@ -7,29 +7,36 @@ class InstabugDioInterceptor extends Interceptor { @override Future onRequest( - RequestOptions options, RequestInterceptorHandler handler,) async { + RequestOptions options, + RequestInterceptorHandler handler, + ) async { final headers = options.headers; final startTime = DateTime.now(); // ignore: invalid_use_of_internal_member final w3Header = await _networklogger.getW3CHeader( - headers, startTime.millisecondsSinceEpoch,); + headers, + startTime.millisecondsSinceEpoch, + ); if (w3Header?.isW3cHeaderFound == false && w3Header?.w3CGeneratedHeader != null) { headers['traceparent'] = w3Header?.w3CGeneratedHeader; } options.headers = headers; final data = NetworkData( - startTime: startTime, - url: options.uri.toString(), - w3cHeader: w3Header, - method: options.method,); + 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,) { + Response response, + ResponseInterceptorHandler handler, + ) { final data = _map(response); _networklogger.networkLog(data); handler.next(response); @@ -77,7 +84,8 @@ class InstabugDioInterceptor extends Interceptor { var responseBodySize = 0; if (responseHeaders.containsKey('content-length')) { // ignore: avoid_dynamic_calls - responseBodySize = int.parse((responseHeaders['content-length'][0]) ?? '0'); + responseBodySize = + int.parse((responseHeaders['content-length'][0]) ?? '0'); } else if (response.data != null) { responseBodySize = response.data.toString().length; } diff --git a/packages/instabug_dio_interceptor/pubspec.yaml b/packages/instabug_dio_interceptor/pubspec.yaml index 98e9d4dbd..f84a8a78e 100644 --- a/packages/instabug_dio_interceptor/pubspec.yaml +++ b/packages/instabug_dio_interceptor/pubspec.yaml @@ -4,6 +4,7 @@ description: with Dio Package and sends them to the report that will be sent to the dashboard. version: 2.3.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 <3.0.0' @@ -12,7 +13,7 @@ dependencies: dio: '>=4.0.0 <6.0.0' flutter: sdk: flutter - instabug_flutter: '>=11.0.0 <14.0.0' + instabug_flutter: '>=14.0.0 <15.0.0' dev_dependencies: build_runner: ^2.0.3 diff --git a/packages/instabug_dio_interceptor/test/instabug_dio_interceptor_test.dart b/packages/instabug_dio_interceptor/test/instabug_dio_interceptor_test.dart index 8e39562a6..2940dcc83 100644 --- a/packages/instabug_dio_interceptor/test/instabug_dio_interceptor_test.dart +++ b/packages/instabug_dio_interceptor/test/instabug_dio_interceptor_test.dart @@ -17,14 +17,18 @@ class MyInterceptor extends InstabugDioInterceptor { @override Future onRequest( - RequestOptions options, RequestInterceptorHandler handler,) async { + RequestOptions options, + RequestInterceptorHandler handler, + ) async { requestCount++; super.onRequest(options, handler); } @override void onResponse( - Response response, ResponseInterceptorHandler handler,) { + Response response, + ResponseInterceptorHandler handler, + ) { resposneCount++; super.onResponse(response, handler); } @@ -53,11 +57,13 @@ void main() { setUpAll(() { Instabug.$setHostApi(mHost); NetworkLogger.$setHostApi(mHost); - when(mHost.isW3CFeatureFlagsEnabled()).thenAnswer((_)=>Future>.value({ - 'isW3cCaughtHeaderEnabled': true, - 'isW3cExternalGeneratedHeaderEnabled': true, - 'isW3cExternalTraceIDEnabled': true, - }),); + when(mHost.isW3CFeatureFlagsEnabled()).thenAnswer( + (_) => Future>.value({ + 'isW3cCaughtHeaderEnabled': true, + 'isW3cExternalGeneratedHeaderEnabled': true, + 'isW3cExternalTraceIDEnabled': true, + }), + ); }); setUp(() { diff --git a/packages/instabug_dio_interceptor/test/mock_adapter.dart b/packages/instabug_dio_interceptor/test/mock_adapter.dart index 51975a689..934acfb0a 100644 --- a/packages/instabug_dio_interceptor/test/mock_adapter.dart +++ b/packages/instabug_dio_interceptor/test/mock_adapter.dart @@ -11,8 +11,11 @@ class MockAdapter implements HttpClientAdapter { final IOHttpClientAdapter _adapter = IOHttpClientAdapter(); @override - Future fetch(RequestOptions options, - Stream? requestStream, Future? cancelFuture,) async { + Future fetch( + RequestOptions options, + Stream? requestStream, + Future? cancelFuture, + ) async { final uri = options.uri; if (uri.host == mockHost) { diff --git a/packages/instabug_flutter/CHANGELOG.md b/packages/instabug_flutter/CHANGELOG.md index 119f6e213..6ffa8a57d 100644 --- a/packages/instabug_flutter/CHANGELOG.md +++ b/packages/instabug_flutter/CHANGELOG.md @@ -1,6 +1,18 @@ # Changelog +## [Unreleased](https://github.com/Instabug/Instabug-Flutter/compare/v14.1.0...dev) -## [14.0.0](https://github.com/Instabug/Instabug-Flutter/compare/v13.4.0...v14.0.0) (November 11, 2024) +### 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) (December 22, 2024) + +### 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 diff --git a/packages/instabug_flutter/android/build.gradle b/packages/instabug_flutter/android/build.gradle index 52b303694..e3b5d0bca 100644 --- a/packages/instabug_flutter/android/build.gradle +++ b/packages/instabug_flutter/android/build.gradle @@ -1,5 +1,5 @@ group 'com.instabug.flutter' -version '14.0.0' +version '14.1.0' buildscript { repositories { @@ -44,8 +44,7 @@ android { } dependencies { - api 'com.instabug.library:instabug:13.4.1.6295791-SNAPSHOT' - + api 'com.instabug.library:instabug:14.1.0' testImplementation 'junit:junit:4.13.2' testImplementation "org.mockito:mockito-inline:3.12.1" testImplementation "io.mockk:mockk:1.13.13" diff --git a/packages/instabug_flutter/android/src/main/java/com/instabug/flutter/modules/InstabugApi.java b/packages/instabug_flutter/android/src/main/java/com/instabug/flutter/modules/InstabugApi.java index 3c04ca90e..45ee1d9cc 100644 --- a/packages/instabug_flutter/android/src/main/java/com/instabug/flutter/modules/InstabugApi.java +++ b/packages/instabug_flutter/android/src/main/java/com/instabug/flutter/modules/InstabugApi.java @@ -13,6 +13,7 @@ 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; @@ -337,7 +338,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) { diff --git a/packages/instabug_flutter/android/src/test/java/com/instabug/flutter/InstabugApiTest.java b/packages/instabug_flutter/android/src/test/java/com/instabug/flutter/InstabugApiTest.java index afdc25d23..a9c8ba464 100644 --- a/packages/instabug_flutter/android/src/test/java/com/instabug/flutter/InstabugApiTest.java +++ b/packages/instabug_flutter/android/src/test/java/com/instabug/flutter/InstabugApiTest.java @@ -463,7 +463,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(); diff --git a/packages/instabug_flutter/example/ios/InstabugTests/InstabugApiTests.m b/packages/instabug_flutter/example/ios/InstabugTests/InstabugApiTests.m index 6c9544d71..7c0cc63dc 100644 --- a/packages/instabug_flutter/example/ios/InstabugTests/InstabugApiTests.m +++ b/packages/instabug_flutter/example/ios/InstabugTests/InstabugApiTests.m @@ -325,7 +325,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]); } diff --git a/packages/instabug_flutter/example/ios/Podfile b/packages/instabug_flutter/example/ios/Podfile index 0b5121016..be56c059e 100644 --- a/packages/instabug_flutter/example/ios/Podfile +++ b/packages/instabug_flutter/example/ios/Podfile @@ -29,7 +29,6 @@ flutter_ios_podfile_setup target 'Runner' do use_frameworks! use_modular_headers! - pod 'Instabug', :podspec => 'https://ios-releases.instabug.com/custom/feature-flutter-private-views-base/14.0.0/Instabug.podspec' 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 index 0d7116a93..5dd77dc53 100644 --- a/packages/instabug_flutter/example/ios/Podfile.lock +++ b/packages/instabug_flutter/example/ios/Podfile.lock @@ -1,9 +1,9 @@ PODS: - Flutter (1.0.0) - - Instabug (14.0.0) + - Instabug (14.1.0) - instabug_flutter (14.0.0): - Flutter - - Instabug (= 14.0.0) + - Instabug (= 14.1.0) - instabug_private_views (0.0.1): - Flutter - instabug_flutter @@ -14,7 +14,6 @@ PODS: DEPENDENCIES: - Flutter (from `Flutter`) - - Instabug (from `https://ios-releases.instabug.com/custom/feature-flutter-private-views-base/14.0.0/Instabug.podspec`) - instabug_flutter (from `.symlinks/plugins/instabug_flutter/ios`) - instabug_private_views (from `.symlinks/plugins/instabug_private_views/ios`) - OCMock (= 3.6) @@ -22,13 +21,12 @@ DEPENDENCIES: SPEC REPOS: trunk: + - Instabug - OCMock EXTERNAL SOURCES: Flutter: :path: Flutter - Instabug: - :podspec: https://ios-releases.instabug.com/custom/feature-flutter-private-views-base/14.0.0/Instabug.podspec instabug_flutter: :path: ".symlinks/plugins/instabug_flutter/ios" instabug_private_views: @@ -38,12 +36,12 @@ EXTERNAL SOURCES: SPEC CHECKSUMS: Flutter: e0871f40cf51350855a761d2e70bf5af5b9b5de7 - Instabug: 9d2b06afbadfbd4630bc0116dc27d84360ed70b0 - instabug_flutter: ff8ab5ff34a476b1d2d887478ec190cda962b973 + Instabug: 8cbca8974168c815658133e2813f5ac3a36f8e20 + instabug_flutter: a24751dfaedd29475da2af062d3e19d697438f72 instabug_private_views: df53ff3f1cc842cb686d43e077099d3b36426a7f OCMock: 5ea90566be239f179ba766fd9fbae5885040b992 video_player_avfoundation: 7c6c11d8470e1675df7397027218274b6d2360b3 -PODFILE CHECKSUM: 32bd1b5b0a93d31b74cc581a86b5fa93c1cc923f +PODFILE CHECKSUM: bb7a3c60be3b970b608fa878e26d5fadfbeb1157 COCOAPODS: 1.14.3 diff --git a/packages/instabug_flutter/example/lib/main.dart b/packages/instabug_flutter/example/lib/main.dart index d52a685cc..abc04e020 100644 --- a/packages/instabug_flutter/example/lib/main.dart +++ b/packages/instabug_flutter/example/lib/main.dart @@ -9,15 +9,14 @@ 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'; -import 'package:instabug_private_views/instabug_private_view.dart'; -import 'src/native/instabug_flutter_example_method_channel.dart'; -import 'src/widget/instabug_button.dart'; -import 'src/widget/instabug_clipboard_input.dart'; -import 'src/widget/instabug_text_field.dart'; +import 'package:instabug_flutter_example/src/native/instabug_flutter_example_method_channel.dart'; +import 'package:instabug_flutter_example/src/widget/instabug_button.dart'; +import 'package:instabug_flutter_example/src/widget/instabug_clipboard_input.dart'; +import 'package:instabug_flutter_example/src/widget/instabug_text_field.dart'; import 'package:instabug_flutter/src/utils/screen_loading/screen_loading_manager.dart'; -import 'src/widget/section_title.dart'; +import 'package:instabug_flutter_example/src/widget/section_title.dart'; part 'src/screens/crashes_page.dart'; @@ -58,7 +57,6 @@ void main() { Zone.current.handleUncaughtError(details.exception, details.stack!); }; - enableInstabugMaskingPrivateViews(); runApp(const MyApp()); }, diff --git a/packages/instabug_flutter/example/lib/src/components/non_fatal_crashes_content.dart b/packages/instabug_flutter/example/lib/src/components/non_fatal_crashes_content.dart index c3d331187..99a85e558 100644 --- a/packages/instabug_flutter/example/lib/src/components/non_fatal_crashes_content.dart +++ b/packages/instabug_flutter/example/lib/src/components/non_fatal_crashes_content.dart @@ -161,7 +161,7 @@ class _NonFatalCrashesContentState extends State { ], ), ), - SizedBox( + const SizedBox( height: 8, ), InstabugButton( @@ -190,7 +190,7 @@ class _NonFatalCrashesContentState extends State { fingerprint: crashfingerPrintController.text, level: crashType); ScaffoldMessenger.of(context) - .showSnackBar(SnackBar(content: Text("Crash sent"))); + .showSnackBar(const SnackBar(content: Text("Crash sent"))); crashNameController.text = ''; crashfingerPrintController.text = ''; crashUserAttributeValueController.text = ''; 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 index 2e4940399..56a58dacf 100644 --- a/packages/instabug_flutter/example/lib/src/screens/private_view_page.dart +++ b/packages/instabug_flutter/example/lib/src/screens/private_view_page.dart @@ -1,6 +1,4 @@ import 'package:flutter/material.dart'; -import 'package:instabug_flutter/instabug_flutter.dart'; -import 'package:instabug_private_views/instabug_private_view.dart'; import 'package:video_player/video_player.dart'; class PrivateViewPage extends StatefulWidget { @@ -32,123 +30,16 @@ class _PrivateViewPageState extends State { @override Widget build(BuildContext context) { - return MaterialApp( - debugShowCheckedModeBanner: false, - home: Scaffold( + return Scaffold( appBar: AppBar(title: const Text("Private Views page")), - body: SingleChildScrollView( + body: const SingleChildScrollView( child: Padding( - padding: const EdgeInsets.all(8.0), + padding: EdgeInsets.all(8.0), child: Column( crossAxisAlignment: CrossAxisAlignment.center, - children: [ - const SizedBox(height: 16), - InstabugPrivateView( - child: const Text( - 'Private TextView', - style: TextStyle(fontSize: 18), - textAlign: TextAlign.center, - ), - ), - 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), - InstabugPrivateView( - child: Image.asset( - 'assets/img.png', - // Add this image to your assets folder - height: 100, - ), - ), - const SizedBox(height: 33), - InstabugPrivateView( - child: const 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), - Column( - children: [ - InstabugPrivateView( - child: const Text( - 'Private TextView in column', - style: TextStyle(fontSize: 18), - textAlign: TextAlign.center, - ), - ), - SizedBox( - height: 10, - ), - const Text( - 'TextView in column', - style: TextStyle(fontSize: 18), - textAlign: TextAlign.center, - ), - ], - ), - const SizedBox(height: 24), - InstabugPrivateView( - child: 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, - ), - ), - ), - ) - ], - ), - ) - ], + children: [], ), ), - ), - ), - ); + )); } } diff --git a/packages/instabug_flutter/example/pubspec.lock b/packages/instabug_flutter/example/pubspec.lock index ffb81dbe5..44060645d 100644 --- a/packages/instabug_flutter/example/pubspec.lock +++ b/packages/instabug_flutter/example/pubspec.lock @@ -137,7 +137,7 @@ packages: source: path version: "2.4.0" instabug_private_views: - dependency: "direct main" + dependency: "direct overridden" description: path: "../../instabug_private_views" relative: true diff --git a/packages/instabug_flutter/example/pubspec.yaml b/packages/instabug_flutter/example/pubspec.yaml index 25fa60592..ec7be1ada 100644 --- a/packages/instabug_flutter/example/pubspec.yaml +++ b/packages/instabug_flutter/example/pubspec.yaml @@ -25,11 +25,9 @@ dependencies: sdk: flutter http: ^0.13.0 instabug_flutter: - path: '../../Instabug-Flutter' + path: '../' instabug_http_client: ^2.4.0 video_player: - instabug_private_views: - path: '../../instabug_private_views' dev_dependencies: flutter_driver: sdk: flutter diff --git a/packages/instabug_flutter/ios/Classes/Modules/InstabugApi.m b/packages/instabug_flutter/ios/Classes/Modules/InstabugApi.m index 58f2725e1..84dc9cf3f 100644 --- a/packages/instabug_flutter/ios/Classes/Modules/InstabugApi.m +++ b/packages/instabug_flutter/ios/Classes/Modules/InstabugApi.m @@ -164,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) { diff --git a/packages/instabug_flutter/ios/instabug_flutter.podspec b/packages/instabug_flutter/ios/instabug_flutter.podspec index e48169fb9..f339d7fe0 100644 --- a/packages/instabug_flutter/ios/instabug_flutter.podspec +++ b/packages/instabug_flutter/ios/instabug_flutter.podspec @@ -17,8 +17,6 @@ Pod::Spec.new do |s| s.pod_target_xcconfig = { 'OTHER_LDFLAGS' => '-framework "Flutter" -framework "Instabug"'} s.dependency 'Flutter' - s.dependency 'Instabug', '14.0.0' - - + s.dependency 'Instabug', '14.1.0' end diff --git a/packages/instabug_flutter/lib/src/modules/instabug.dart b/packages/instabug_flutter/lib/src/modules/instabug.dart index 766067df6..6bba8ed1f 100644 --- a/packages/instabug_flutter/lib/src/modules/instabug.dart +++ b/packages/instabug_flutter/lib/src/modules/instabug.dart @@ -449,9 +449,9 @@ class Instabug { } return _host.setReproStepsConfig( - bugMode.toString(), - crashMode.toString(), - sessionReplayMode.toString(), + bugMode?.toString(), + crashMode?.toString(), + sessionReplayMode?.toString(), ); } diff --git a/packages/instabug_flutter_modular/example/lib/modules/second_module.dart b/packages/instabug_flutter_modular/example/lib/modules/second_module.dart index 8a5c6b3c4..b178f36be 100644 --- a/packages/instabug_flutter_modular/example/lib/modules/second_module.dart +++ b/packages/instabug_flutter_modular/example/lib/modules/second_module.dart @@ -10,15 +10,21 @@ class SecondModule extends Module { '/', 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)), + 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/pubspec.yaml b/packages/instabug_flutter_modular/pubspec.yaml index e75afbebc..4015404b9 100644 --- a/packages/instabug_flutter_modular/pubspec.yaml +++ b/packages/instabug_flutter_modular/pubspec.yaml @@ -2,6 +2,7 @@ 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' diff --git a/packages/instabug_http_client/example/ios/Podfile b/packages/instabug_http_client/example/ios/Podfile index 9411102b1..0c985a221 100644 --- a/packages/instabug_http_client/example/ios/Podfile +++ b/packages/instabug_http_client/example/ios/Podfile @@ -1,5 +1,5 @@ # Uncomment this line to define a global platform for your project -platform :ios, '10.0' +platform :ios, '13.4' # CocoaPods analytics sends network stats synchronously affecting flutter build latency. ENV['COCOAPODS_DISABLE_STATS'] = 'true' diff --git a/packages/instabug_http_client/example/ios/Podfile.lock b/packages/instabug_http_client/example/ios/Podfile.lock index 579d9c628..8a17c66b4 100644 --- a/packages/instabug_http_client/example/ios/Podfile.lock +++ b/packages/instabug_http_client/example/ios/Podfile.lock @@ -1,9 +1,9 @@ PODS: - Flutter (1.0.0) - - Instabug (11.0.2) - - instabug_flutter (0.0.1): + - Instabug (14.0.0) + - instabug_flutter (14.0.0): - Flutter - - Instabug (= 11.0.2) + - Instabug (= 14.0.0) DEPENDENCIES: - Flutter (from `Flutter`) @@ -20,10 +20,10 @@ EXTERNAL SOURCES: :path: ".symlinks/plugins/instabug_flutter/ios" SPEC CHECKSUMS: - Flutter: 50d75fe2f02b26cc09d224853bb45737f8b3214a - Instabug: d6c7a65211ad958f7ca871790774c1e00ca4f6df - instabug_flutter: 6fb6eb4620a10587ba5a67ddf0781d78fe984569 + Flutter: e0871f40cf51350855a761d2e70bf5af5b9b5de7 + Instabug: a0beffc01658773e2fac549845782f8937707dc4 + instabug_flutter: ff8ab5ff34a476b1d2d887478ec190cda962b973 -PODFILE CHECKSUM: fe0e1ee7f3d1f7d00b11b474b62dd62134535aea +PODFILE CHECKSUM: eb179eda02c4d9ce45db6b1912a419962f739320 -COCOAPODS: 1.11.2 +COCOAPODS: 1.14.3 diff --git a/packages/instabug_http_client/example/lib/main.dart b/packages/instabug_http_client/example/lib/main.dart index ca5de74f9..da0018df8 100644 --- a/packages/instabug_http_client/example/lib/main.dart +++ b/packages/instabug_http_client/example/lib/main.dart @@ -5,7 +5,8 @@ import 'package:instabug_flutter/instabug_flutter.dart'; Future main() async { runApp(const MyApp()); Instabug.init( - token: 'ed6f659591566da19b67857e1b9d40ab', invocationEvents: [InvocationEvent.floatingButton]); + token: 'ed6f659591566da19b67857e1b9d40ab', + invocationEvents: [InvocationEvent.floatingButton]); final client = InstabugHttpClient(); await client.get(Uri.parse('https://google.com')); } diff --git a/packages/instabug_http_client/lib/instabug_http_client.dart b/packages/instabug_http_client/lib/instabug_http_client.dart index 6f978f850..624d72cc1 100644 --- a/packages/instabug_http_client/lib/instabug_http_client.dart +++ b/packages/instabug_http_client/lib/instabug_http_client.dart @@ -29,8 +29,12 @@ class InstabugHttpClient extends InstabugHttpLogger implements http.Client { void close() => client.close(); @override - Future delete(Uri url, - {Map? headers, Object? body, Encoding? encoding,}) async { + Future delete( + Uri url, { + Map? headers, + Object? body, + Encoding? encoding, + }) async { final startTime = DateTime.now(); final requestHeader = headers ?? {}; final w3cHeader = await getW3cHeader(requestHeader, startTime); @@ -42,9 +46,12 @@ class InstabugHttpClient extends InstabugHttpLogger implements http.Client { }); } - Future getW3cHeader(Map requestHeader, DateTime startTime) async { - final w3cHeader = await _networklogger.getW3CHeader( - requestHeader, startTime.millisecondsSinceEpoch,); + Future getW3cHeader( + Map requestHeader, DateTime startTime) async { + final w3cHeader = await _networklogger.getW3CHeader( + requestHeader, + startTime.millisecondsSinceEpoch, + ); if (w3cHeader?.isW3cHeaderFound == false && w3cHeader?.w3CGeneratedHeader != null) { requestHeader['traceparent'] = w3cHeader!.w3CGeneratedHeader!; @@ -79,8 +86,12 @@ class InstabugHttpClient extends InstabugHttpLogger implements http.Client { } @override - Future patch(Uri url, - {Map? headers, Object? body, Encoding? encoding,}) async { + Future patch( + Uri url, { + Map? headers, + Object? body, + Encoding? encoding, + }) async { final startTime = DateTime.now(); final requestHeader = headers ?? {}; final w3cHeader = await getW3cHeader(requestHeader, startTime); @@ -93,8 +104,12 @@ class InstabugHttpClient extends InstabugHttpLogger implements http.Client { } @override - Future post(Uri url, - {Map? headers, Object? body, Encoding? encoding,}) async { + Future post( + Uri url, { + Map? headers, + Object? body, + Encoding? encoding, + }) async { final startTime = DateTime.now(); final requestHeader = headers ?? {}; final w3cHeader = await getW3cHeader(requestHeader, startTime); @@ -107,8 +122,12 @@ class InstabugHttpClient extends InstabugHttpLogger implements http.Client { } @override - Future put(Uri url, - {Map? headers, Object? body, Encoding? encoding,}) async { + Future put( + Uri url, { + Map? headers, + Object? body, + Encoding? encoding, + }) async { final startTime = DateTime.now(); final requestHeader = headers ?? {}; final w3cHeader = await getW3cHeader(requestHeader, startTime); @@ -133,21 +152,24 @@ class InstabugHttpClient extends InstabugHttpLogger implements http.Client { final startTime = DateTime.now(); final requestHeader = request.headers; final 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, - ); - }),); + 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 index b2b324ed8..a0b9fa6e7 100644 --- a/packages/instabug_http_client/lib/instabug_http_logger.dart +++ b/packages/instabug_http_client/lib/instabug_http_logger.dart @@ -4,7 +4,8 @@ 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}) { + void onLogger(http.Response response, + {DateTime? startTime, W3CHeader? w3CHeader}) { final networkLogger = NetworkLogger(); final requestHeaders = {}; @@ -52,19 +53,21 @@ class InstabugHttpLogger { 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'] - : '', - ),); + 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.yaml b/packages/instabug_http_client/pubspec.yaml index 5d30a1e1d..5ced6ee3a 100644 --- a/packages/instabug_http_client/pubspec.yaml +++ b/packages/instabug_http_client/pubspec.yaml @@ -4,8 +4,8 @@ description: with http Package and sends them to the report that will be sent to the dashboard. version: 2.4.0 homepage: https://www.instabug.com/platforms/flutter -repository: https://github.com/Instabug/Instabug-Flutter 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 <3.0.0" @@ -14,7 +14,7 @@ dependencies: flutter: sdk: flutter http: ">=0.13.0 <2.0.0" - instabug_flutter: ">=11.0.0 <14.0.0" + instabug_flutter: ">=14.0.0 <15.0.0" meta: ^1.3.0 dev_dependencies: diff --git a/packages/instabug_http_client/test/instabug_http_client_test.dart b/packages/instabug_http_client/test/instabug_http_client_test.dart index ae6d74a53..abcd12b25 100644 --- a/packages/instabug_http_client/test/instabug_http_client_test.dart +++ b/packages/instabug_http_client/test/instabug_http_client_test.dart @@ -28,11 +28,13 @@ Future main() async { setUpAll(() { Instabug.$setHostApi(mHost); NetworkLogger.$setHostApi(mHost); - when(mHost.isW3CFeatureFlagsEnabled()).thenAnswer((_)=> Future>.value({ - 'isW3cCaughtHeaderEnabled': true, - 'isW3cExternalGeneratedHeaderEnabled': false, - 'isW3cExternalTraceIDEnabled': true, - }),); + when(mHost.isW3CFeatureFlagsEnabled()).thenAnswer( + (_) => Future>.value({ + 'isW3cCaughtHeaderEnabled': true, + 'isW3cExternalGeneratedHeaderEnabled': false, + 'isW3cExternalTraceIDEnabled': true, + }), + ); }); const fakeResponse = { @@ -40,8 +42,7 @@ Future main() async { 'activationCode': '111111', }; late Uri url; - final mockedResponse = - http.Response(json.encode(fakeResponse), 200); + final mockedResponse = http.Response(json.encode(fakeResponse), 200); late InstabugHttpClient instabugHttpClient; @@ -53,74 +54,87 @@ Future main() async { }); test('expect instabug http client GET to return response', () async { - when(instabugHttpClient.client.get(url,headers: anyNamed('headers'))) + when( + instabugHttpClient.client.get(url, headers: anyNamed('headers'))) .thenAnswer((_) async => mockedResponse); final result = await instabugHttpClient.get(url); expect(result, isInstanceOf()); expect(result, mockedResponse); - verify(instabugHttpClient.logger - .onLogger(mockedResponse, startTime: anyNamed('startTime')),) - .called(1); + 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'))) + when( + instabugHttpClient.client.head(url, headers: anyNamed('headers'))) .thenAnswer((_) async => mockedResponse); final result = await instabugHttpClient.head(url); expect(result, isInstanceOf()); expect(result, mockedResponse); - verify(instabugHttpClient.logger - .onLogger(mockedResponse, startTime: anyNamed('startTime')),) - .called(1); + 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'))) + when( + instabugHttpClient.client.delete(url, headers: anyNamed('headers'))) .thenAnswer((_) async => mockedResponse); final result = await instabugHttpClient.delete(url); expect(result, isInstanceOf()); expect(result, mockedResponse); - verify(instabugHttpClient.logger - .onLogger(mockedResponse, startTime: anyNamed('startTime')),) - .called(1); + 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'))) + when( + instabugHttpClient.client.patch(url, headers: anyNamed('headers'))) .thenAnswer((_) async => mockedResponse); final result = await instabugHttpClient.patch(url); expect(result, isInstanceOf()); expect(result, mockedResponse); - verify(instabugHttpClient.logger - .onLogger(mockedResponse, startTime: anyNamed('startTime')),) - .called(1); + 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'))) + when( + instabugHttpClient.client.post(url, headers: anyNamed('headers'))) .thenAnswer((_) async => mockedResponse); final result = await instabugHttpClient.post(url); expect(result, isInstanceOf()); expect(result, mockedResponse); - verify(instabugHttpClient.logger - .onLogger(mockedResponse, startTime: anyNamed('startTime')),) - .called(1); + 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'))) + when( + instabugHttpClient.client.put(url, headers: anyNamed('headers'))) .thenAnswer((_) async => mockedResponse); final result = await instabugHttpClient.put(url); expect(result, isInstanceOf()); expect(result.body, mockedResponse.body); - verify(instabugHttpClient.logger - .onLogger(mockedResponse, startTime: anyNamed('startTime')),) - .called(1); + verify( + instabugHttpClient.logger + .onLogger(mockedResponse, startTime: anyNamed('startTime')), + ).called(1); }); test('expect instabug http client READ to return response', () async { const response = 'Some response string'; - when(instabugHttpClient.client.read(url,headers: anyNamed('headers'))) + when( + instabugHttpClient.client.read(url, headers: anyNamed('headers'))) .thenAnswer((_) async => response); final result = await instabugHttpClient.read(url); @@ -140,16 +154,17 @@ Future main() async { test('expect instabug http client SEND to return response', () async { final response = http.StreamedResponse( - const Stream>.empty(), 200, - contentLength: 0,); + const Stream>.empty(), + 200, + contentLength: 0, + ); final 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 responseFuture = - instabugHttpClient.send(request); + final responseFuture = instabugHttpClient.send(request); request ..sink.add('{"hello": "world"}'.codeUnits) ..sink.close(); @@ -163,10 +178,11 @@ Future main() async { 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 logger = - instabugHttpClient.logger as MockInstabugHttpLogger; + expect( + await result.stream.bytesToString(), + await response.stream.bytesToString(), + ); + final logger = instabugHttpClient.logger as MockInstabugHttpLogger; verify(logger.onLogger(any, startTime: anyNamed('startTime'))).called(1); }); @@ -177,13 +193,15 @@ Future main() async { }); test('stress test for GET method', () async { - when(instabugHttpClient.client.get(url,headers: anyNamed('headers'))) + when( + instabugHttpClient.client.get(url, headers: anyNamed('headers'))) .thenAnswer((_) async => mockedResponse); for (var i = 0; i < 10000; i++) { await instabugHttpClient.get(url); } - verify(instabugHttpClient.logger - .onLogger(mockedResponse, startTime: anyNamed('startTime')),) - .called(10000); + verify( + instabugHttpClient.logger + .onLogger(mockedResponse, startTime: anyNamed('startTime')), + ).called(10000); }); } diff --git a/packages/instabug_private_views/example-hybrid-ios-app/my_flutter/lib/main.dart b/packages/instabug_private_views/example-hybrid-ios-app/my_flutter/lib/main.dart index 7bb901132..45f87f0bf 100644 --- a/packages/instabug_private_views/example-hybrid-ios-app/my_flutter/lib/main.dart +++ b/packages/instabug_private_views/example-hybrid-ios-app/my_flutter/lib/main.dart @@ -40,11 +40,11 @@ class MyApp extends StatelessWidget { ); } - const MyApp({super.key}); + const MyApp({Key? key}) : super(key: key); } class MyHomePage extends StatefulWidget { - const MyHomePage({super.key, required this.title}); + const MyHomePage({Key? key, required this.title}) : super(key: key); final String title; diff --git a/packages/instabug_private_views/example/lib/private_view_page.dart b/packages/instabug_private_views/example/lib/private_view_page.dart index 6178f1b24..be01f1ba3 100644 --- a/packages/instabug_private_views/example/lib/private_view_page.dart +++ b/packages/instabug_private_views/example/lib/private_view_page.dart @@ -89,6 +89,26 @@ class _PrivateViewPageState extends State { border: OutlineInputBorder(), ), ), + const SizedBox(height: 16), + Column( + children: [ + InstabugPrivateView( + child: const Text( + 'Private TextView in column', + style: TextStyle(fontSize: 18), + textAlign: TextAlign.center, + ), + ), + SizedBox( + height: 10, + ), + const Text( + 'TextView in column', + style: TextStyle(fontSize: 18), + textAlign: TextAlign.center, + ), + ], + ), const SizedBox(height: 24), InstabugPrivateView( child: Container( diff --git a/packages/instabug_private_views/lib/src/instabug_private_view.dart b/packages/instabug_private_views/lib/src/instabug_private_view.dart index b2672b17d..3d16ee1b1 100644 --- a/packages/instabug_private_views/lib/src/instabug_private_view.dart +++ b/packages/instabug_private_views/lib/src/instabug_private_view.dart @@ -22,6 +22,7 @@ class _InstabugPrivateViewState extends State { _addPrivateView(); super.initState(); } + @override void dispose() { _removePrivateView();