Skip to content

Commit 8fe0817

Browse files
authored
refactor: move native code to its own directory (#1638)
1 parent 7c822cd commit 8fe0817

21 files changed

+87
-72
lines changed

flutter/analysis_options.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
include: package:flutter_lints/flutter.yaml
22

33
analyzer:
4+
exclude:
5+
- test/*.mocks.dart
46
language:
57
strict-casts: true
68
strict-inference: true

flutter/ffi-cocoa.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
name: SentryCocoa
22
description: Sentry Cocoa SDK FFI binding.
33
language: objc
4-
output: lib/src/sentry_cocoa.dart
4+
output: lib/src/native/cocoa/binding.dart
55
headers:
66
entry-points:
77
- ./cocoa_bindings_temp/Sentry.framework/Versions/A/PrivateHeaders/PrivateSentrySDKOnly.h

flutter/lib/src/event_processor/native_app_start_event_processor.dart

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,7 @@ import 'dart:async';
22

33
import 'package:sentry/sentry.dart';
44

5-
import '../sentry_native.dart';
6-
import '../sentry_native_channel.dart';
5+
import '../native/sentry_native.dart';
76

87
/// EventProcessor that enriches [SentryTransaction] objects with app start
98
/// measurement.

flutter/lib/src/integrations/native_app_start_integration.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import 'package:flutter/scheduler.dart';
22
import 'package:sentry/sentry.dart';
33

44
import '../sentry_flutter_options.dart';
5-
import '../sentry_native.dart';
5+
import '../native/sentry_native.dart';
66
import '../event_processor/native_app_start_event_processor.dart';
77

88
/// Integration which handles communication with native frameworks in order to

flutter/lib/src/sentry_native.dart renamed to flutter/lib/src/native/sentry_native.dart

Lines changed: 31 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import 'dart:async';
22

33
import 'package:meta/meta.dart';
44

5-
import '../sentry_flutter.dart';
5+
import '../../sentry_flutter.dart';
66
import 'sentry_native_channel.dart';
77

88
/// [SentryNative] holds state that it fetches from to the native SDKs. Always
@@ -98,3 +98,33 @@ class SentryNative {
9898
_didFetchAppStart = false;
9999
}
100100
}
101+
102+
class NativeAppStart {
103+
NativeAppStart(this.appStartTime, this.isColdStart);
104+
105+
double appStartTime;
106+
bool isColdStart;
107+
108+
factory NativeAppStart.fromJson(Map<String, dynamic> json) {
109+
return NativeAppStart(
110+
json['appStartTime'] as double,
111+
json['isColdStart'] as bool,
112+
);
113+
}
114+
}
115+
116+
class NativeFrames {
117+
NativeFrames(this.totalFrames, this.slowFrames, this.frozenFrames);
118+
119+
int totalFrames;
120+
int slowFrames;
121+
int frozenFrames;
122+
123+
factory NativeFrames.fromJson(Map<String, dynamic> json) {
124+
return NativeFrames(
125+
json['totalFrames'] as int,
126+
json['slowFrames'] as int,
127+
json['frozenFrames'] as int,
128+
);
129+
}
130+
}

flutter/lib/src/sentry_native_channel.dart renamed to flutter/lib/src/native/sentry_native_channel.dart

Lines changed: 3 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,11 @@ import 'dart:async';
33
import 'package:flutter/services.dart';
44
import 'package:meta/meta.dart';
55

6-
import '../sentry_flutter.dart';
6+
import '../../sentry_flutter.dart';
7+
import 'sentry_native.dart';
78
import 'method_channel_helper.dart';
89

9-
/// Provide typed methods to access native layer.
10+
/// Provide typed methods to access native layer via MethodChannel.
1011
@internal
1112
class SentryNativeChannel {
1213
SentryNativeChannel(this._channel, this._options);
@@ -149,33 +150,3 @@ class SentryNativeChannel {
149150
);
150151
}
151152
}
152-
153-
class NativeAppStart {
154-
NativeAppStart(this.appStartTime, this.isColdStart);
155-
156-
double appStartTime;
157-
bool isColdStart;
158-
159-
factory NativeAppStart.fromJson(Map<String, dynamic> json) {
160-
return NativeAppStart(
161-
json['appStartTime'] as double,
162-
json['isColdStart'] as bool,
163-
);
164-
}
165-
}
166-
167-
class NativeFrames {
168-
NativeFrames(this.totalFrames, this.slowFrames, this.frozenFrames);
169-
170-
int totalFrames;
171-
int slowFrames;
172-
int frozenFrames;
173-
174-
factory NativeFrames.fromJson(Map<String, dynamic> json) {
175-
return NativeFrames(
176-
json['totalFrames'] as int,
177-
json['slowFrames'] as int,
178-
json['frozenFrames'] as int,
179-
);
180-
}
181-
}

flutter/lib/src/navigation/sentry_navigator_observer.dart

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
11
import 'package:flutter/widgets.dart';
22

33
import '../../sentry_flutter.dart';
4-
import '../sentry_native.dart';
5-
import '../sentry_native_channel.dart';
4+
import '../native/sentry_native.dart';
65

76
/// This key must be used so that the web interface displays the events nicely
87
/// See https://develop.sentry.dev/sdk/event-payloads/breadcrumbs/

0 commit comments

Comments
 (0)