Skip to content

Commit

Permalink
Fix code formatting
Browse files Browse the repository at this point in the history
  • Loading branch information
Dimdron committed Sep 20, 2021
1 parent f3941ae commit acddc17
Show file tree
Hide file tree
Showing 5 changed files with 44 additions and 33 deletions.
10 changes: 7 additions & 3 deletions lib/src/appspector_plugin.dart
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,8 @@ class AppSpectorPlugin {

AppSpectorPlugin._privateConstructor();

AppSpectorPlugin._withConfig(Config config, Function(String)? sessionUrlListener) {
AppSpectorPlugin._withConfig(
Config config, Function(String)? sessionUrlListener) {
HttpOverrides.global = AppSpectorHttpOverrides();
_requestReceiver.observeChannel();
_channel.setMethodCallHandler(_handlePluginCalls);
Expand Down Expand Up @@ -112,7 +113,9 @@ class AppSpectorPlugin {
final sharedInstance = shared();
final isStarted = await sharedInstance.isStarted();
if (!isStarted) {
return new AppSpectorPlugin._withConfig(config, sharedInstance._sessionUrlListener)._init(config);
return new AppSpectorPlugin._withConfig(
config, sharedInstance._sessionUrlListener)
._init(config);
}
}

Expand All @@ -131,7 +134,8 @@ class AppSpectorPlugin {
Future<void> start() => _channel.invokeMethod("start");

/// Returns true if sdk is started
Future<bool> isStarted() => _channel.invokeMethod("isStarted").then((value) => value ?? false);
Future<bool> isStarted() =>
_channel.invokeMethod("isStarted").then((value) => value ?? false);

/// Set metadata value
Future<void> setMetadataValue(String key, String value) =>
Expand Down
20 changes: 8 additions & 12 deletions lib/src/http/client.dart
Original file line number Diff line number Diff line change
Expand Up @@ -63,22 +63,18 @@ class AppSpectorHttpClient implements HttpClient {
}

@override
set authenticate(
Future<bool> Function(Uri url, String scheme, String? realm)? f) {
_httpClient.authenticate = f;
set authenticate(value) {
_httpClient.authenticate = value;
}

@override
set authenticateProxy(
Future<bool> Function(String host, int port, String scheme, String? realm)?
f) {
_httpClient.authenticateProxy = f;
set authenticateProxy(value) {
_httpClient.authenticateProxy = value;
}

@override
set badCertificateCallback(
bool Function(X509Certificate cert, String host, int port)? callback) {
_httpClient.badCertificateCallback = callback;
set badCertificateCallback(value) {
_httpClient.badCertificateCallback = value;
}

@override
Expand Down Expand Up @@ -136,8 +132,8 @@ class AppSpectorHttpClient implements HttpClient {
@override
Future<HttpClientRequest> open(
String method, String host, int port, String path) {
final tracker = HttpEventTracker.fromHost(
method, _uidGenerator(), host, port, path);
final tracker =
HttpEventTracker.fromHost(method, _uidGenerator(), host, port, path);
return _httpClient.open(method, host, port, path).then((request) {
return HttpRequestWrapper(request, tracker);
}).catchError((e) {
Expand Down
11 changes: 6 additions & 5 deletions lib/src/http/request_wrapper.dart
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,10 @@ class HttpRequestWrapper extends HttpClientRequest {
final HttpEventTracker _httpEventTracker;

@override
Encoding get encoding => _httpClientRequest.encoding;
Encoding get encoding => _httpClientRequest.encoding;

@override
set encoding(Encoding value) => _httpClientRequest.encoding = value;
set encoding(Encoding value) => _httpClientRequest.encoding = value;

@override
int get contentLength => _httpClientRequest.contentLength;
Expand All @@ -37,7 +37,8 @@ class HttpRequestWrapper extends HttpClientRequest {
bool get persistentConnection => _httpClientRequest.persistentConnection;

@override
set persistentConnection(bool value) => _httpClientRequest.persistentConnection = value;
set persistentConnection(bool value) =>
_httpClientRequest.persistentConnection = value;

@override
int get maxRedirects => _httpClientRequest.maxRedirects;
Expand Down Expand Up @@ -82,8 +83,8 @@ class HttpRequestWrapper extends HttpClientRequest {
final HttpClientResponse response = await _httpClientRequest.close();
return new HttpResponseWrapper(
response,
response
.transform(StreamTransformer.fromHandlers(handleData: (List<int> data, EventSink<List<int>> sink) {
response.transform(StreamTransformer.fromHandlers(
handleData: (List<int> data, EventSink<List<int>> sink) {
sink.add(data);
body.addAll(data);
}, handleError: (error, stackTrace, sink) {
Expand Down
2 changes: 0 additions & 2 deletions lib/src/log/logger.dart
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import 'package:appspector/src/event_sender.dart';

class Logger {

static void v(String tag, String message,
[Object? error, StackTrace? stackTrace]) {
log(LogLevel.VERBOSE, tag, message, error, stackTrace);
Expand Down Expand Up @@ -42,7 +41,6 @@ class Logger {
}
EventSender.sendEvent(new _LogEvent(level, tag, message));
}

}

class _LogEvent extends Event {
Expand Down
34 changes: 23 additions & 11 deletions lib/src/monitors.dart
Original file line number Diff line number Diff line change
Expand Up @@ -4,17 +4,18 @@ enum SupportedPlatform { android, ios }
class Monitor {
/// Monitor identifier
final String id;

/// List of platforms which support this monitor
final List<SupportedPlatform> platforms;

const Monitor._androidMonitor(this.id) :
platforms = const [SupportedPlatform.android];
const Monitor._androidMonitor(this.id)
: platforms = const [SupportedPlatform.android];

const Monitor._iosMonitor(this.id) :
platforms = const [SupportedPlatform.ios];
const Monitor._iosMonitor(this.id)
: platforms = const [SupportedPlatform.ios];

const Monitor._commonMonitor(this.id) :
platforms = const [SupportedPlatform.android, SupportedPlatform.ios];
const Monitor._commonMonitor(this.id)
: platforms = const [SupportedPlatform.android, SupportedPlatform.ios];
}

/// Identifiers for supported monitors
Expand All @@ -29,15 +30,26 @@ class Monitors {
static const location = const Monitor._commonMonitor("location");
static const performance = const Monitor._commonMonitor("performance");
static const sqLite = const Monitor._commonMonitor("sqlite");
static const sharedPreferences = const Monitor._androidMonitor("shared-preferences");
static const sharedPreferences =
const Monitor._androidMonitor("shared-preferences");
static const analytics = const Monitor._iosMonitor("analytics");
static const notification = const Monitor._iosMonitor("notification-center");
static const userDefaults = const Monitor._iosMonitor("user-defaults");
static const coreData = const Monitor._iosMonitor("ios-core-data");

static List<Monitor> all() => [
http, logs, screenshot, environment, location, performance, sqLite, fileSystem,
analytics, notification, userDefaults, coreData,
sharedPreferences
];
http,
logs,
screenshot,
environment,
location,
performance,
sqLite,
fileSystem,
analytics,
notification,
userDefaults,
coreData,
sharedPreferences
];
}

0 comments on commit acddc17

Please sign in to comment.