Skip to content

refactor: 14.1.0 changes #545

New issue

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

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

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Jan 13, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 29 additions & 0 deletions packages/instabug_dio_interceptor/example/ios/Podfile.lock
Original file line number Diff line number Diff line change
@@ -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
Original file line number Diff line number Diff line change
Expand Up @@ -7,29 +7,36 @@ class InstabugDioInterceptor extends Interceptor {

@override
Future<void> 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<dynamic> response, ResponseInterceptorHandler handler,) {
Response<dynamic> response,
ResponseInterceptorHandler handler,
) {
final data = _map(response);
_networklogger.networkLog(data);
handler.next(response);
Expand Down Expand Up @@ -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;
}
Expand Down
3 changes: 2 additions & 1 deletion packages/instabug_dio_interceptor/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand All @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,14 +17,18 @@ class MyInterceptor extends InstabugDioInterceptor {

@override
Future<void> onRequest(
RequestOptions options, RequestInterceptorHandler handler,) async {
RequestOptions options,
RequestInterceptorHandler handler,
) async {
requestCount++;
super.onRequest(options, handler);
}

@override
void onResponse(
Response<dynamic> response, ResponseInterceptorHandler handler,) {
Response<dynamic> response,
ResponseInterceptorHandler handler,
) {
resposneCount++;
super.onResponse(response, handler);
}
Expand Down Expand Up @@ -53,11 +57,13 @@ void main() {
setUpAll(() {
Instabug.$setHostApi(mHost);
NetworkLogger.$setHostApi(mHost);
when(mHost.isW3CFeatureFlagsEnabled()).thenAnswer((_)=>Future<Map<String,bool>>.value(<String, bool>{
'isW3cCaughtHeaderEnabled': true,
'isW3cExternalGeneratedHeaderEnabled': true,
'isW3cExternalTraceIDEnabled': true,
}),);
when(mHost.isW3CFeatureFlagsEnabled()).thenAnswer(
(_) => Future<Map<String, bool>>.value(<String, bool>{
'isW3cCaughtHeaderEnabled': true,
'isW3cExternalGeneratedHeaderEnabled': true,
'isW3cExternalTraceIDEnabled': true,
}),
);
});

setUp(() {
Expand Down
7 changes: 5 additions & 2 deletions packages/instabug_dio_interceptor/test/mock_adapter.dart
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,11 @@ class MockAdapter implements HttpClientAdapter {
final IOHttpClientAdapter _adapter = IOHttpClientAdapter();

@override
Future<ResponseBody> fetch(RequestOptions options,
Stream<Uint8List>? requestStream, Future<dynamic>? cancelFuture,) async {
Future<ResponseBody> fetch(
RequestOptions options,
Stream<Uint8List>? requestStream,
Future<dynamic>? cancelFuture,
) async {
final uri = options.uri;

if (uri.host == mockHost) {
Expand Down
14 changes: 13 additions & 1 deletion packages/instabug_flutter/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -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

Expand Down
5 changes: 2 additions & 3 deletions packages/instabug_flutter/android/build.gradle
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
group 'com.instabug.flutter'
version '14.0.0'
version '14.1.0'

buildscript {
repositories {
Expand Down Expand Up @@ -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"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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]);
}

Expand Down
1 change: 0 additions & 1 deletion packages/instabug_flutter/example/ios/Podfile
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
14 changes: 6 additions & 8 deletions packages/instabug_flutter/example/ios/Podfile.lock
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -14,21 +14,19 @@ 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)
- video_player_avfoundation (from `.symlinks/plugins/video_player_avfoundation/darwin`)

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:
Expand All @@ -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
12 changes: 5 additions & 7 deletions packages/instabug_flutter/example/lib/main.dart
Original file line number Diff line number Diff line change
Expand Up @@ -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';

Expand Down Expand Up @@ -58,7 +57,6 @@ void main() {
Zone.current.handleUncaughtError(details.exception, details.stack!);
};

enableInstabugMaskingPrivateViews();

runApp(const MyApp());
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,7 @@ class _NonFatalCrashesContentState extends State<NonFatalCrashesContent> {
],
),
),
SizedBox(
const SizedBox(
height: 8,
),
InstabugButton(
Expand Down Expand Up @@ -190,7 +190,7 @@ class _NonFatalCrashesContentState extends State<NonFatalCrashesContent> {
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 = '';
Expand Down
Loading