Skip to content

Commit

Permalink
Merged in release/14.1.2 (pull request #13)
Browse files Browse the repository at this point in the history
Release/14.1.2
  • Loading branch information
Mislav Stanić committed May 25, 2021
2 parents 2530e1e + b3f30cc commit 811d43e
Show file tree
Hide file tree
Showing 14 changed files with 83 additions and 77 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
# 14.1.2

Null safety support

# 14.1.1

Fix platform metadata for iOS apps
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ Flutter plugin for [Shake](https://www.shakebugs.com).
Add Shake to your `pubspec.yaml` file.
```yaml
dependencies:
shake_flutter: ^14.1.1
shake_flutter: ^14.1.2
```
Install package by running command in terminal.
Expand Down
1 change: 1 addition & 0 deletions ios/Classes/ShakePlugin.m
Original file line number Diff line number Diff line change
Expand Up @@ -302,6 +302,7 @@ - (void)isEnableEmailField:(FlutterMethodCall*) call result:(FlutterResult)resul

- (void)setEmailField:(FlutterMethodCall*) call result:(FlutterResult) result {
NSString* email = call.arguments[@"email"];
if (email == (id)[NSNull null]) email = nil;
SHKShake.configuration.emailField = email;
result(nil);
}
Expand Down
10 changes: 7 additions & 3 deletions lib/helpers/network_tracker.dart
Original file line number Diff line number Diff line change
@@ -1,15 +1,19 @@
import 'package:shake_flutter/helpers/data_tracker.dart';
import 'package:shake_flutter/models/network_request.dart';
import 'package:shake_flutter/utils/extensions.dart';

typedef NetworkRequest NetworkRequestFilter(NetworkRequest networkRequest);

class NetworkTracker extends DataTracker {
NetworkRequestFilter filter;
NetworkRequestFilter? filter;

NetworkRequest filterNetworkRequest(NetworkRequest networkRequest) {
if (filter != null) {
NetworkRequest filteredRequest = filter(networkRequest);
return filteredRequest;
networkRequest = filter!(networkRequest);
}

if (!networkRequest.url.isHttpUrl()) {
networkRequest.url = 'https://not_a_valid_url';
}

return networkRequest;
Expand Down
5 changes: 2 additions & 3 deletions lib/helpers/notifications_tracker.dart
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,12 @@ typedef NotificationEvent NotificationEventFilter(
NotificationEvent notificationEvent);

class NotificationsTracker extends DataTracker {
NotificationEventFilter filter;
NotificationEventFilter? filter;

NotificationEvent filterNotificationEvent(
NotificationEvent notificationEvent) {
if (filter != null) {
NotificationEvent filteredEvent = filter(notificationEvent);
return filteredEvent;
notificationEvent = filter!(notificationEvent);
}

return notificationEvent;
Expand Down
4 changes: 2 additions & 2 deletions lib/models/network_request.dart
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ class NetworkRequest {
Map<String, String> requestHeaders = <String, String>{};
Map<String, String> responseHeaders = <String, String>{};
int duration = 0;
DateTime startTime;
DateTime endTime;
DateTime? startTime;
DateTime? endTime;
DateTime date = DateTime.now();

Map<String, dynamic> toMap() {
Expand Down
6 changes: 3 additions & 3 deletions lib/models/notification_event.dart
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,9 @@ class NotificationEvent {

static NotificationEvent fromMap(Map data) {
NotificationEvent notificationEvent = NotificationEvent();
notificationEvent.id = data['id'];
notificationEvent.description = data['description'];
notificationEvent.title = data["title"];
notificationEvent.id = data['id'] ?? '';
notificationEvent.description = data['description'] ?? '';
notificationEvent.title = data["title"] ?? '';

return notificationEvent;
}
Expand Down
6 changes: 3 additions & 3 deletions lib/models/shake_file.dart
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,11 @@ import 'package:path/path.dart';
///
/// Use [ShakeFile.create] to create new file.
class ShakeFile {
String path;
String name;
String? path;
String? name;

/// Creates new file.
ShakeFile.create(String path, [String name]) {
ShakeFile.create(String path, [String? name]) {
this.path = path;
if (name != null) {
this.name = name + extension(path);
Expand Down
24 changes: 12 additions & 12 deletions lib/network/shake_http_client.dart
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ import 'package:shake_flutter/network/shake_http_logger.dart';

/// Shake wrapper for dart:io HttpClient.
class ShakeHttpClient implements HttpClient {
HttpClient client;
ShakeHttpLogger logger;
late HttpClient client;
late ShakeHttpLogger logger;

ShakeHttpClient() {
client = HttpClient();
Expand All @@ -16,31 +16,31 @@ class ShakeHttpClient implements HttpClient {
set autoUncompress(bool au) => client.autoUncompress = au;

@override
set connectionTimeout(Duration ct) => client.connectionTimeout = ct;
set connectionTimeout(Duration? ct) => client.connectionTimeout = ct;

@override
set idleTimeout(Duration it) => client.idleTimeout = it;

@override
set maxConnectionsPerHost(int mcph) => client.maxConnectionsPerHost = mcph;
set maxConnectionsPerHost(int? mcph) => client.maxConnectionsPerHost = mcph;

@override
set userAgent(String ua) => client.userAgent = ua;
set userAgent(String? ua) => client.userAgent = ua;

@override
bool get autoUncompress => client.autoUncompress;

@override
Duration get connectionTimeout => client.connectionTimeout;
Duration? get connectionTimeout => client.connectionTimeout;

@override
Duration get idleTimeout => client.idleTimeout;

@override
int get maxConnectionsPerHost => client.maxConnectionsPerHost;
int? get maxConnectionsPerHost => client.maxConnectionsPerHost;

@override
String get userAgent => client.userAgent;
String? get userAgent => client.userAgent;

@override
void addCredentials(
Expand All @@ -56,20 +56,20 @@ class ShakeHttpClient implements HttpClient {

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

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

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

Expand Down Expand Up @@ -101,7 +101,7 @@ class ShakeHttpClient implements HttpClient {
}

@override
set findProxy(String Function(Uri url) f) {
set findProxy(String Function(Uri url)? f) {
client.findProxy = f;
}

Expand Down
10 changes: 5 additions & 5 deletions lib/network/shake_http_logger.dart
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ class ShakeHttpLogger {

void onRequest(
HttpClientRequest request, {
String requestBody,
String? requestBody,
}) {
final NetworkRequest networkRequest = NetworkRequest();
networkRequest.startTime = DateTime.now();
Expand All @@ -27,9 +27,9 @@ class ShakeHttpLogger {
void onResponse(
HttpClientRequest request,
HttpClientResponse response, {
String responseBody,
String? responseBody,
}) async {
final NetworkRequest networkRequest = _getRequestData(request.hashCode);
final NetworkRequest? networkRequest = _getRequestData(request.hashCode);
if (networkRequest == null) {
return null;
}
Expand All @@ -44,7 +44,7 @@ class ShakeHttpLogger {
Shake.insertNetworkRequest(networkRequest);
}

String _removeBinaryData(String text) {
String _removeBinaryData(String? text) {
if (text == null) return "";

if (text.isBinary()) {
Expand All @@ -54,7 +54,7 @@ class ShakeHttpLogger {
return text;
}

NetworkRequest _getRequestData(int requestHashCode) {
NetworkRequest? _getRequestData(int requestHashCode) {
if (_requests[requestHashCode] != null) {
return _requests.remove(requestHashCode);
}
Expand Down
Loading

0 comments on commit 811d43e

Please sign in to comment.