-
Notifications
You must be signed in to change notification settings - Fork 24
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
Firebase Crashlytics #1911
Firebase Crashlytics #1911
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -8,20 +8,12 @@ | |
"client": [ | ||
{ | ||
"client_info": { | ||
"mobilesdk_app_id": "1:366914936426:android:7d2393ccb8b3bdda1a3413", | ||
"mobilesdk_app_id": "1:366914936426:android:978896cb9d8996661a3413", | ||
"android_client_info": { | ||
"package_name": "com.joinseeds.seedswallet" | ||
"package_name": "com.joinseeds.parq" | ||
} | ||
}, | ||
"oauth_client": [ | ||
{ | ||
"client_id": "366914936426-kn6vumn468dl6vc1rdp9ircp6v9ehufg.apps.googleusercontent.com", | ||
"client_type": 1, | ||
"android_info": { | ||
"package_name": "com.joinseeds.seedswallet", | ||
"certificate_hash": "ada86e0a7e0067084ed872e08681b2104aaf5270" | ||
} | ||
}, | ||
{ | ||
"client_id": "366914936426-92ud91kd7hqj98to79aospg00m3f3to7.apps.googleusercontent.com", | ||
"client_type": 3 | ||
|
@@ -53,18 +45,18 @@ | |
}, | ||
{ | ||
"client_info": { | ||
"mobilesdk_app_id": "1:366914936426:android:389b18d13a862a531a3413", | ||
"mobilesdk_app_id": "1:366914936426:android:7d2393ccb8b3bdda1a3413", | ||
"android_client_info": { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Whatever the package name is, don't change it?! |
||
"package_name": "com.joinseeds.wallet" | ||
"package_name": "com.joinseeds.seedswallet" | ||
} | ||
}, | ||
"oauth_client": [ | ||
{ | ||
"client_id": "366914936426-k4i8n24qb9eu1ug0cqs0rcfvc3pq1fh3.apps.googleusercontent.com", | ||
"client_id": "366914936426-kn6vumn468dl6vc1rdp9ircp6v9ehufg.apps.googleusercontent.com", | ||
"client_type": 1, | ||
"android_info": { | ||
"package_name": "com.joinseeds.wallet", | ||
"certificate_hash": "1d4a3d87c78e5d83f8b7c7fb5240f10fe072132f" | ||
"package_name": "com.joinseeds.seedswallet", | ||
"certificate_hash": "ada86e0a7e0067084ed872e08681b2104aaf5270" | ||
} | ||
}, | ||
{ | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
{ | ||
"file_generated_by": "FlutterFire CLI", | ||
"purpose": "FirebaseAppID & ProjectID for this Firebase app in this directory", | ||
"GOOGLE_APP_ID": "1:366914936426:ios:75e7ba91678551811a3413", | ||
"FIREBASE_PROJECT_ID": "seeds-77371", | ||
"GCM_SENDER_ID": "366914936426" | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,7 @@ | ||
import 'dart:async'; | ||
import 'package:async/async.dart'; | ||
import 'package:firebase_crashlytics/firebase_crashlytics.dart'; | ||
import 'package:flutter/foundation.dart'; | ||
import 'package:seeds/crypto/eosdart/eosdart.dart'; | ||
import 'package:seeds/datasource/local/settings_storage.dart'; | ||
import 'package:seeds/datasource/remote/api/http_repo/seeds_scopes.dart'; | ||
|
@@ -71,7 +73,10 @@ abstract class EosRepository { | |
} | ||
|
||
ErrorResult mapEosError(dynamic error) { | ||
print('mapEosError: $error'); | ||
if (kDebugMode) { | ||
print('mapEosError: $error'); | ||
} | ||
FirebaseCrashlytics.instance.log('mapEosError: $error'); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. β€οΈ There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. If this removes EOS errors completely from the device log, then I don't agree with this change. If crashlytics prints the errors to console as well, then OK. EOS errors must be in the device logs, anyway. |
||
return ErrorResult(error); | ||
} | ||
} | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,21 +1,40 @@ | ||
import 'dart:async'; | ||
|
||
import 'package:async/async.dart'; | ||
import 'package:firebase_crashlytics/firebase_crashlytics.dart'; | ||
import 'package:flutter/foundation.dart'; | ||
import 'package:http/http.dart'; | ||
import 'package:http/http.dart' as http; | ||
import 'package:seeds/datasource/remote/api/http_repo/seeds_scopes.dart'; | ||
import 'package:seeds/datasource/remote/api/http_repo/seeds_tables.dart'; | ||
import 'package:seeds/datasource/remote/firebase/firebase_remote_config.dart'; | ||
import 'package:seeds/datasource/remote/util/response_extension.dart'; | ||
|
||
class _HttpClient extends http.BaseClient { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I am not sure we should fire every request into crashalytics There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Flutterfire docs says for log method:
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 64 kB is quite a lot text I don't think be a problem also I did not notice any bottle neck in the app. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Please let's not go overboard with Crashlytics. It's useful but we do not want to depend on it (what if crashlytics is down, do these still work?) We also don't want to send all http requests through crashlytics. Only ones that have unexpected crashes. We also need to filter out expected crashes - example, network error because user's internet was down. |
||
final http.Client _httpClient = http.Client(); | ||
Map<String, String> headers = {'Content-type': 'application/json'}; | ||
|
||
// Intercept each call to log request info to Crashlytics. | ||
@override | ||
Future<http.StreamedResponse> send(http.BaseRequest request) { | ||
if (kDebugMode) { | ||
print('${request.method} ${request.url} ${request.contentLength}'); | ||
} | ||
FirebaseCrashlytics.instance.log('${request.method} ${request.url} ${(request as Request).body}'); | ||
request.headers.addAll(headers); | ||
return _httpClient.send(request); | ||
} | ||
} | ||
|
||
abstract class HttpRepository { | ||
String baseURL = remoteConfigurations.defaultEndPointUrl; | ||
String v2historyURL = remoteConfigurations.defaultV2EndPointUrl; | ||
String hyphaURL = remoteConfigurations.hyphaEndPoint; | ||
String mapsApiKey = 'AIzaSyB3Ghs8i_Lw55vmSyh5mxLA9cGcWuc1A54'; | ||
String fxApiKey = "thesecretapikey989"; | ||
Map<String, String> headers = {'Content-type': 'application/json'}; | ||
_HttpClient http = _HttpClient(); | ||
|
||
FutureOr<Result<T>> mapHttpResponse<T>(http.Response response, Function modelMapper) { | ||
FutureOr<Result<T>> mapHttpResponse<T>(Response response, Function modelMapper) { | ||
switch (response.statusCode) { | ||
case 200: | ||
{ | ||
|
@@ -24,13 +43,19 @@ abstract class HttpRepository { | |
return ValueResult(modelMapper(body)); | ||
} | ||
default: | ||
print("network error: ${response.reasonPhrase}"); | ||
if (kDebugMode) { | ||
print('http error: ${response.reasonPhrase}'); | ||
} | ||
FirebaseCrashlytics.instance.log('http error: ${response.statusCode}, ${response.reasonPhrase}'); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Same comment here - still going to device log? |
||
return ErrorResult(NetworkError(response.statusCode)); | ||
} | ||
} | ||
|
||
ErrorResult mapHttpError(dynamic error) { | ||
print('mapHttpError: $error'); | ||
if (kDebugMode) { | ||
print('mapHttpError: $error'); | ||
} | ||
FirebaseCrashlytics.instance.log('mapHttpError: $error'); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. and here |
||
return ErrorResult(error); | ||
} | ||
|
||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i dont think this change is supposed to be here
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
intresting these changes were performed by the FlutterFire ClI tool I only pick the seeds project in available options to config the Crashlytics.
Should I keep that name @n13 ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why do we have 2 android projects?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please don't change that.
This is correct
package_name": "com.joinseeds.seedswallet
Why we have multiple firebase projects - Igor did this, we can delete them.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@RaulUrtecho is there's strange merge errors, I'd tend to just start over.