mirror of
https://github.com/GitJournal/GitJournal.git
synced 2025-06-28 01:45:55 +08:00
Use a proper logger - Fimber
It's time to start using a proper logger so we can control the number of log messages, also - it helps to have a central configuration point for the logs, specially since I would like to hook them up to Crashlytics in the future.
This commit is contained in:
@ -1,6 +1,7 @@
|
||||
import 'dart:async';
|
||||
import 'dart:io';
|
||||
|
||||
import 'package:fimber/fimber.dart';
|
||||
import 'package:flutter/foundation.dart';
|
||||
import 'package:flutter/services.dart';
|
||||
|
||||
@ -34,9 +35,9 @@ class GitRepo {
|
||||
'cloneUrl': cloneUrl,
|
||||
'folderName': folderName,
|
||||
});
|
||||
print("Done");
|
||||
Fimber.d("Done");
|
||||
} on PlatformException catch (e) {
|
||||
print("gitClone Failed: '${e.message}'.");
|
||||
Fimber.d("gitClone Failed: '${e.message}'.");
|
||||
throw createGitException(e.message);
|
||||
}
|
||||
}
|
||||
@ -47,7 +48,7 @@ class GitRepo {
|
||||
'folderName': folderName,
|
||||
});
|
||||
} on PlatformException catch (e) {
|
||||
print("gitInit Failed: '${e.message}'.");
|
||||
Fimber.d("gitInit Failed: '${e.message}'.");
|
||||
throw createGitException(e.message);
|
||||
}
|
||||
}
|
||||
@ -59,9 +60,9 @@ class GitRepo {
|
||||
'authorName': authorName,
|
||||
'authorEmail': authorEmail,
|
||||
});
|
||||
print("Done");
|
||||
Fimber.d("Done");
|
||||
} on PlatformException catch (e) {
|
||||
print("gitPull Failed: '${e.message}'.");
|
||||
Fimber.d("gitPull Failed: '${e.message}'.");
|
||||
throw createGitException(e.message);
|
||||
}
|
||||
}
|
||||
@ -73,7 +74,7 @@ class GitRepo {
|
||||
'filePattern': filePattern,
|
||||
});
|
||||
} on PlatformException catch (e) {
|
||||
print("gitAdd Failed: '${e.message}'.");
|
||||
Fimber.d("gitAdd Failed: '${e.message}'.");
|
||||
}
|
||||
}
|
||||
|
||||
@ -84,7 +85,7 @@ class GitRepo {
|
||||
'filePattern': filePattern,
|
||||
});
|
||||
} on PlatformException catch (e) {
|
||||
print("gitRm Failed: '${e.message}'.");
|
||||
Fimber.d("gitRm Failed: '${e.message}'.");
|
||||
}
|
||||
}
|
||||
|
||||
@ -94,7 +95,7 @@ class GitRepo {
|
||||
'folderName': folderName,
|
||||
});
|
||||
} on PlatformException catch (e) {
|
||||
print("gitPush Failed: '${e.message}'.");
|
||||
Fimber.d("gitPush Failed: '${e.message}'.");
|
||||
throw createGitException(e.message);
|
||||
}
|
||||
}
|
||||
@ -106,7 +107,7 @@ class GitRepo {
|
||||
'folderName': folderName,
|
||||
});
|
||||
} on PlatformException catch (e) {
|
||||
print("gitResetLast Failed: '${e.message}'.");
|
||||
Fimber.d("gitResetLast Failed: '${e.message}'.");
|
||||
throw createGitException(e.message);
|
||||
}
|
||||
}
|
||||
@ -123,29 +124,29 @@ class GitRepo {
|
||||
'when': when,
|
||||
});
|
||||
} on PlatformException catch (e) {
|
||||
print("gitCommit Failed: '${e.message}'.");
|
||||
Fimber.d("gitCommit Failed: '${e.message}'.");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Future<String> generateSSHKeys({@required String comment}) async {
|
||||
print("generateSSHKeyss: " + comment);
|
||||
Fimber.d("generateSSHKeyss: " + comment);
|
||||
try {
|
||||
String publicKey = await _platform.invokeMethod('generateSSHKeys', {
|
||||
'comment': comment,
|
||||
});
|
||||
print("Public Key " + publicKey);
|
||||
Fimber.d("Public Key " + publicKey);
|
||||
return publicKey;
|
||||
} on PlatformException catch (e) {
|
||||
print("Failed to generateSSHKeys: '${e.message}'.");
|
||||
Fimber.d("Failed to generateSSHKeys: '${e.message}'.");
|
||||
}
|
||||
|
||||
try {
|
||||
String publicKey = await _platform.invokeMethod('getSSHPublicKey');
|
||||
print("Public Key " + publicKey);
|
||||
Fimber.d("Public Key " + publicKey);
|
||||
return publicKey;
|
||||
} on PlatformException catch (e) {
|
||||
print("Failed to getSSHPublicKey: '${e.message}'.");
|
||||
Fimber.d("Failed to getSSHPublicKey: '${e.message}'.");
|
||||
}
|
||||
|
||||
return "";
|
||||
@ -155,14 +156,14 @@ Future<void> setSshKeys({
|
||||
@required String publicKey,
|
||||
@required String privateKey,
|
||||
}) async {
|
||||
print("setSshKeys");
|
||||
Fimber.d("setSshKeys");
|
||||
try {
|
||||
await _platform.invokeMethod('setSshKeys', {
|
||||
'publicKey': publicKey,
|
||||
'privateKey': privateKey,
|
||||
});
|
||||
} on PlatformException catch (e) {
|
||||
print("Failed to setSSHKeys: '${e.message}'.");
|
||||
Fimber.d("Failed to setSSHKeys: '${e.message}'.");
|
||||
rethrow;
|
||||
}
|
||||
}
|
||||
|
@ -1,6 +1,7 @@
|
||||
import 'dart:async';
|
||||
import 'dart:io';
|
||||
|
||||
import 'package:fimber/fimber.dart';
|
||||
import 'package:flutter/foundation.dart';
|
||||
import 'package:journal/apis/git.dart';
|
||||
import 'package:journal/settings.dart';
|
||||
@ -15,11 +16,11 @@ Future migrateGitRepo({
|
||||
@required String toGitBaseFolder,
|
||||
@required String toGitBaseSubFolder,
|
||||
}) async {
|
||||
print(
|
||||
Fimber.d(
|
||||
"migrateGitRepo $fromGitBasePath $toGitBaseFolder / $toGitBaseSubFolder");
|
||||
var fromBasePath = p.join(gitBasePath, fromGitBasePath);
|
||||
var toGitRepoPath = p.join(gitBasePath, toGitBaseFolder, toGitBaseSubFolder);
|
||||
print("toGitRemotePath $toGitRepoPath");
|
||||
Fimber.d("toGitRemotePath $toGitRepoPath");
|
||||
|
||||
final dir = Directory(fromBasePath);
|
||||
var lister = dir.list(recursive: false);
|
||||
@ -31,7 +32,7 @@ Future migrateGitRepo({
|
||||
var fileName = p.basename(file.path);
|
||||
var toPath = p.join(toGitRepoPath, fileName);
|
||||
|
||||
print("Migrating " + file.path + " --> " + toPath);
|
||||
Fimber.d("Migrating " + file.path + " --> " + toPath);
|
||||
|
||||
await file.copy(toPath);
|
||||
|
||||
@ -43,5 +44,5 @@ Future migrateGitRepo({
|
||||
await gitRepo.add(fileName);
|
||||
await gitRepo.commit(message: "Added Journal Entry");
|
||||
}
|
||||
print("migrateGitRepo: Done");
|
||||
Fimber.d("migrateGitRepo: Done");
|
||||
}
|
||||
|
@ -2,6 +2,7 @@ import 'dart:async';
|
||||
import 'dart:convert';
|
||||
import 'dart:io';
|
||||
|
||||
import 'package:fimber/fimber.dart';
|
||||
import 'package:flutter/services.dart';
|
||||
import 'package:http/http.dart' as http;
|
||||
import 'package:url_launcher/url_launcher.dart';
|
||||
@ -19,23 +20,23 @@ class GitHub implements GitHost {
|
||||
void init(OAuthCallback callback) {
|
||||
Future _handleMessages(MethodCall call) async {
|
||||
if (call.method != "onURL") {
|
||||
print("GitHub Unknown Call: " + call.method);
|
||||
Fimber.d("GitHub Unknown Call: " + call.method);
|
||||
return;
|
||||
}
|
||||
|
||||
print("GitHub: Called onUrl with " + call.arguments.toString());
|
||||
Fimber.d("GitHub: Called onUrl with " + call.arguments.toString());
|
||||
|
||||
String url = call.arguments["URL"];
|
||||
var uri = Uri.parse(url);
|
||||
var authCode = uri.queryParameters['code'];
|
||||
if (authCode == null) {
|
||||
print("GitHub: Missing auth code. Now what?");
|
||||
Fimber.d("GitHub: Missing auth code. Now what?");
|
||||
callback(GitHostException.OAuthFailed);
|
||||
}
|
||||
|
||||
_accessCode = await _getAccessCode(authCode);
|
||||
if (_accessCode == null || _accessCode.isEmpty) {
|
||||
print("GitHub: AccessCode is invalid: " + _accessCode);
|
||||
Fimber.d("GitHub: AccessCode is invalid: " + _accessCode);
|
||||
callback(GitHostException.OAuthFailed);
|
||||
}
|
||||
|
||||
@ -43,7 +44,7 @@ class GitHub implements GitHost {
|
||||
}
|
||||
|
||||
_platform.setMethodCallHandler(_handleMessages);
|
||||
print("GitHub: Installed Handler");
|
||||
Fimber.d("GitHub: Installed Handler");
|
||||
}
|
||||
|
||||
Future<String> _getAccessCode(String authCode) async {
|
||||
@ -52,13 +53,13 @@ class GitHub implements GitHost {
|
||||
|
||||
var response = await http.post(url);
|
||||
if (response.statusCode != 200) {
|
||||
print("Github getAccessCode: Invalid response " +
|
||||
Fimber.d("Github getAccessCode: Invalid response " +
|
||||
response.statusCode.toString() +
|
||||
": " +
|
||||
response.body);
|
||||
throw GitHostException.OAuthFailed;
|
||||
}
|
||||
print("GithubResponse: " + response.body);
|
||||
Fimber.d("GithubResponse: " + response.body);
|
||||
|
||||
var map = Uri.splitQueryString(response.body);
|
||||
return map["access_token"];
|
||||
@ -85,7 +86,7 @@ class GitHub implements GitHost {
|
||||
|
||||
var response = await http.get(url);
|
||||
if (response.statusCode != 200) {
|
||||
print("Github listRepos: Invalid response " +
|
||||
Fimber.d("Github listRepos: Invalid response " +
|
||||
response.statusCode.toString() +
|
||||
": " +
|
||||
response.body);
|
||||
@ -123,7 +124,7 @@ class GitHub implements GitHost {
|
||||
var response =
|
||||
await http.post(url, headers: headers, body: json.encode(data));
|
||||
if (response.statusCode != 201) {
|
||||
print("Github createRepo: Invalid response " +
|
||||
Fimber.d("Github createRepo: Invalid response " +
|
||||
response.statusCode.toString() +
|
||||
": " +
|
||||
response.body);
|
||||
@ -137,7 +138,7 @@ class GitHub implements GitHost {
|
||||
throw GitHostException.CreateRepoFailed;
|
||||
}
|
||||
|
||||
print("GitHub createRepo: " + response.body);
|
||||
Fimber.d("GitHub createRepo: " + response.body);
|
||||
Map<String, dynamic> map = json.decode(response.body);
|
||||
return _repoFromJson(map);
|
||||
}
|
||||
@ -155,7 +156,7 @@ class GitHub implements GitHost {
|
||||
|
||||
var response = await http.get(url);
|
||||
if (response.statusCode != 200) {
|
||||
print("Github getRepo: Invalid response " +
|
||||
Fimber.d("Github getRepo: Invalid response " +
|
||||
response.statusCode.toString() +
|
||||
": " +
|
||||
response.body);
|
||||
@ -163,7 +164,7 @@ class GitHub implements GitHost {
|
||||
throw GitHostException.GetRepoFailed;
|
||||
}
|
||||
|
||||
print("GitHub getRepo: " + response.body);
|
||||
Fimber.d("GitHub getRepo: " + response.body);
|
||||
Map<String, dynamic> map = json.decode(response.body);
|
||||
return _repoFromJson(map);
|
||||
}
|
||||
@ -190,14 +191,14 @@ class GitHub implements GitHost {
|
||||
var response =
|
||||
await http.post(url, headers: headers, body: json.encode(data));
|
||||
if (response.statusCode != 201) {
|
||||
print("Github addDeployKey: Invalid response " +
|
||||
Fimber.d("Github addDeployKey: Invalid response " +
|
||||
response.statusCode.toString() +
|
||||
": " +
|
||||
response.body);
|
||||
throw GitHostException.DeployKeyFailed;
|
||||
}
|
||||
|
||||
print("GitHub addDeployKey: " + response.body);
|
||||
Fimber.d("GitHub addDeployKey: " + response.body);
|
||||
return json.decode(response.body);
|
||||
}
|
||||
|
||||
@ -218,7 +219,7 @@ class GitHub implements GitHost {
|
||||
|
||||
var response = await http.get(url);
|
||||
if (response.statusCode != 200) {
|
||||
print("Github getUserInfo: Invalid response " +
|
||||
Fimber.d("Github getUserInfo: Invalid response " +
|
||||
response.statusCode.toString() +
|
||||
": " +
|
||||
response.body);
|
||||
@ -227,7 +228,7 @@ class GitHub implements GitHost {
|
||||
|
||||
Map<String, dynamic> map = jsonDecode(response.body);
|
||||
if (map == null || map.isEmpty) {
|
||||
print("Github getUserInfo: jsonDecode Failed " +
|
||||
Fimber.d("Github getUserInfo: jsonDecode Failed " +
|
||||
response.statusCode.toString() +
|
||||
": " +
|
||||
response.body);
|
||||
|
@ -3,6 +3,7 @@ import 'dart:convert';
|
||||
import 'dart:io';
|
||||
import 'dart:math';
|
||||
|
||||
import 'package:fimber/fimber.dart';
|
||||
import 'package:flutter/services.dart';
|
||||
import 'package:http/http.dart' as http;
|
||||
import 'package:url_launcher/url_launcher.dart';
|
||||
@ -21,11 +22,11 @@ class GitLab implements GitHost {
|
||||
void init(OAuthCallback callback) {
|
||||
Future _handleMessages(MethodCall call) async {
|
||||
if (call.method != "onURL") {
|
||||
print("GitLab Unknown Call: " + call.method);
|
||||
Fimber.d("GitLab Unknown Call: " + call.method);
|
||||
return;
|
||||
}
|
||||
|
||||
print("GitLab: Called onUrl with " + call.arguments.toString());
|
||||
Fimber.d("GitLab: Called onUrl with " + call.arguments.toString());
|
||||
|
||||
String url = call.arguments["URL"];
|
||||
var queryParamters = url.substring(url.indexOf('#') + 1);
|
||||
@ -33,9 +34,9 @@ class GitLab implements GitHost {
|
||||
|
||||
var state = map['state'];
|
||||
if (state != _stateOAuth) {
|
||||
print("GitLab: OAuth State incorrect");
|
||||
print("Required State: " + _stateOAuth);
|
||||
print("Actual State: " + state);
|
||||
Fimber.d("GitLab: OAuth State incorrect");
|
||||
Fimber.d("Required State: " + _stateOAuth);
|
||||
Fimber.d("Actual State: " + state);
|
||||
callback(GitHostException.OAuthFailed);
|
||||
return;
|
||||
}
|
||||
@ -50,7 +51,7 @@ class GitLab implements GitHost {
|
||||
}
|
||||
|
||||
_platform.setMethodCallHandler(_handleMessages);
|
||||
print("GitLab: Installed Handler");
|
||||
Fimber.d("GitLab: Installed Handler");
|
||||
}
|
||||
|
||||
@override
|
||||
@ -74,7 +75,7 @@ class GitLab implements GitHost {
|
||||
|
||||
var response = await http.get(url);
|
||||
if (response.statusCode != 200) {
|
||||
print("GitLab listRepos: Invalid response " +
|
||||
Fimber.d("GitLab listRepos: Invalid response " +
|
||||
response.statusCode.toString() +
|
||||
": " +
|
||||
response.body);
|
||||
@ -112,7 +113,7 @@ class GitLab implements GitHost {
|
||||
var response =
|
||||
await http.post(url, headers: headers, body: json.encode(data));
|
||||
if (response.statusCode != 201) {
|
||||
print("GitLab createRepo: Invalid response " +
|
||||
Fimber.d("GitLab createRepo: Invalid response " +
|
||||
response.statusCode.toString() +
|
||||
": " +
|
||||
response.body);
|
||||
@ -126,7 +127,7 @@ class GitLab implements GitHost {
|
||||
throw GitHostException.CreateRepoFailed;
|
||||
}
|
||||
|
||||
print("GitLab createRepo: " + response.body);
|
||||
Fimber.d("GitLab createRepo: " + response.body);
|
||||
Map<String, dynamic> map = json.decode(response.body);
|
||||
return _repoFromJson(map);
|
||||
}
|
||||
@ -144,7 +145,7 @@ class GitLab implements GitHost {
|
||||
|
||||
var response = await http.get(url);
|
||||
if (response.statusCode != 200) {
|
||||
print("GitLab getRepo: Invalid response " +
|
||||
Fimber.d("GitLab getRepo: Invalid response " +
|
||||
response.statusCode.toString() +
|
||||
": " +
|
||||
response.body);
|
||||
@ -152,7 +153,7 @@ class GitLab implements GitHost {
|
||||
throw GitHostException.GetRepoFailed;
|
||||
}
|
||||
|
||||
print("GitLab getRepo: " + response.body);
|
||||
Fimber.d("GitLab getRepo: " + response.body);
|
||||
Map<String, dynamic> map = json.decode(response.body);
|
||||
return _repoFromJson(map);
|
||||
}
|
||||
@ -180,14 +181,14 @@ class GitLab implements GitHost {
|
||||
var response =
|
||||
await http.post(url, headers: headers, body: json.encode(data));
|
||||
if (response.statusCode != 201) {
|
||||
print("GitLab addDeployKey: Invalid response " +
|
||||
Fimber.d("GitLab addDeployKey: Invalid response " +
|
||||
response.statusCode.toString() +
|
||||
": " +
|
||||
response.body);
|
||||
throw GitHostException.DeployKeyFailed;
|
||||
}
|
||||
|
||||
print("GitLab addDeployKey: " + response.body);
|
||||
Fimber.d("GitLab addDeployKey: " + response.body);
|
||||
return json.decode(response.body);
|
||||
}
|
||||
|
||||
@ -208,7 +209,7 @@ class GitLab implements GitHost {
|
||||
|
||||
var response = await http.get(url);
|
||||
if (response.statusCode != 200) {
|
||||
print("GitLab getUserInfo: Invalid response " +
|
||||
Fimber.d("GitLab getUserInfo: Invalid response " +
|
||||
response.statusCode.toString() +
|
||||
": " +
|
||||
response.body);
|
||||
@ -217,7 +218,7 @@ class GitLab implements GitHost {
|
||||
|
||||
Map<String, dynamic> map = jsonDecode(response.body);
|
||||
if (map == null || map.isEmpty) {
|
||||
print("GitLab getUserInfo: jsonDecode Failed " +
|
||||
Fimber.d("GitLab getUserInfo: jsonDecode Failed " +
|
||||
response.statusCode.toString() +
|
||||
": " +
|
||||
response.body);
|
||||
|
25
lib/app.dart
25
lib/app.dart
@ -1,6 +1,7 @@
|
||||
import 'dart:io';
|
||||
|
||||
import 'package:device_info/device_info.dart';
|
||||
import 'package:fimber/fimber.dart';
|
||||
import 'package:firebase_analytics/firebase_analytics.dart';
|
||||
import 'package:firebase_analytics/observer.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
@ -17,6 +18,8 @@ import 'screens/onboarding_screens.dart';
|
||||
|
||||
class JournalApp extends StatelessWidget {
|
||||
static Future main() async {
|
||||
Fimber.plantTree(DebugTree.elapsed(useColors: true));
|
||||
|
||||
var pref = await SharedPreferences.getInstance();
|
||||
JournalApp.preferences = pref;
|
||||
|
||||
@ -29,14 +32,14 @@ class JournalApp extends StatelessWidget {
|
||||
var remoteGitRepoSubFolder = pref.getString("remoteGitRepoSubFolder") ?? "";
|
||||
var onBoardingCompleted = pref.getBool("onBoardingCompleted") ?? false;
|
||||
|
||||
print(" ---- Settings ---- ");
|
||||
print("localGitRepoConfigured: $localGitRepoConfigured");
|
||||
print("remoteGitRepoConfigured: $remoteGitRepoConfigured");
|
||||
print("localGitRepoPath: $localGitRepoPath");
|
||||
print("remoteGitRepoFolderName: $remoteGitRepoFolderName");
|
||||
print("remoteGitRepoSubFolder: $remoteGitRepoSubFolder");
|
||||
print("onBoardingCompleted: $onBoardingCompleted");
|
||||
print(" ------------------ ");
|
||||
Fimber.d(" ---- Settings ---- ");
|
||||
Fimber.d("localGitRepoConfigured: $localGitRepoConfigured");
|
||||
Fimber.d("remoteGitRepoConfigured: $remoteGitRepoConfigured");
|
||||
Fimber.d("localGitRepoPath: $localGitRepoPath");
|
||||
Fimber.d("remoteGitRepoFolderName: $remoteGitRepoFolderName");
|
||||
Fimber.d("remoteGitRepoSubFolder: $remoteGitRepoSubFolder");
|
||||
Fimber.d("onBoardingCompleted: $onBoardingCompleted");
|
||||
Fimber.d(" ------------------ ");
|
||||
|
||||
_enableAnalyticsIfPossible();
|
||||
|
||||
@ -84,18 +87,18 @@ class JournalApp extends StatelessWidget {
|
||||
isPhysicalDevice = info.isPhysicalDevice;
|
||||
}
|
||||
} catch (e) {
|
||||
print(e);
|
||||
Fimber.d(e);
|
||||
}
|
||||
|
||||
if (isPhysicalDevice == false) {
|
||||
print("Not running in a physcial device");
|
||||
Fimber.d("Not running in a physcial device");
|
||||
JournalApp.isInDebugMode = true;
|
||||
}
|
||||
|
||||
bool should = (JournalApp.isInDebugMode == false);
|
||||
should = should && (await shouldEnableAnalytics());
|
||||
|
||||
print("Analytics Collection: $should");
|
||||
Fimber.d("Analytics Collection: $should");
|
||||
JournalApp.analytics.setAnalyticsCollectionEnabled(should);
|
||||
}
|
||||
|
||||
|
@ -1,3 +1,4 @@
|
||||
import 'package:fimber/fimber.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:function_types/function_types.dart';
|
||||
import 'package:journal/apis/git.dart';
|
||||
@ -36,7 +37,7 @@ class GitHostSetupAutoConfigureState extends State<GitHostSetupAutoConfigure> {
|
||||
}
|
||||
|
||||
void _startAutoConfigure() {
|
||||
print("Starting autoconfigure");
|
||||
Fimber.d("Starting autoconfigure");
|
||||
setState(() {
|
||||
_configuringStarted = true;
|
||||
});
|
||||
@ -47,7 +48,7 @@ class GitHostSetupAutoConfigureState extends State<GitHostSetupAutoConfigure> {
|
||||
if (error != null) {
|
||||
throw error;
|
||||
}
|
||||
print("GitHost Initalized: " + widget.gitHostType.toString());
|
||||
Fimber.d("GitHost Initalized: " + widget.gitHostType.toString());
|
||||
|
||||
GitHostRepo repo;
|
||||
try {
|
||||
@ -87,7 +88,7 @@ class GitHostSetupAutoConfigureState extends State<GitHostSetupAutoConfigure> {
|
||||
}
|
||||
Settings.instance.save();
|
||||
} on GitHostException catch (e) {
|
||||
print("GitHostSetupAutoConfigure: " + e.toString());
|
||||
Fimber.d("GitHostSetupAutoConfigure: " + e.toString());
|
||||
setState(() {
|
||||
errorMessage = widget.gitHostType.toString() + ": " + e.toString();
|
||||
});
|
||||
@ -97,7 +98,7 @@ class GitHostSetupAutoConfigureState extends State<GitHostSetupAutoConfigure> {
|
||||
});
|
||||
gitHost.launchOAuthScreen();
|
||||
} on GitHostException catch (e) {
|
||||
print("GitHostSetupAutoConfigure: " + e.toString());
|
||||
Fimber.d("GitHostSetupAutoConfigure: " + e.toString());
|
||||
setState(() {
|
||||
errorMessage = widget.gitHostType.toString() + ": " + e.toString();
|
||||
});
|
||||
|
@ -1,3 +1,4 @@
|
||||
import 'package:fimber/fimber.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:function_types/function_types.dart';
|
||||
import 'package:journal/analytics.dart';
|
||||
@ -46,7 +47,7 @@ class GitHostSetupButton extends StatelessWidget {
|
||||
}
|
||||
|
||||
void _onPressedWithAnalytics() {
|
||||
print("githostsetup_button_click " + text);
|
||||
Fimber.d("githostsetup_button_click " + text);
|
||||
getAnalytics().logEvent(
|
||||
name: "githostsetup_button_click",
|
||||
parameters: <String, dynamic>{
|
||||
|
@ -1,6 +1,7 @@
|
||||
import 'dart:io';
|
||||
|
||||
import 'package:dots_indicator/dots_indicator.dart';
|
||||
import 'package:fimber/fimber.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter/services.dart';
|
||||
import 'package:function_types/function_types.dart';
|
||||
@ -50,7 +51,7 @@ class GitHostSetupScreenState extends State<GitHostSetupScreen> {
|
||||
int _currentPageIndex = 0;
|
||||
|
||||
Widget _buildPage(BuildContext context, int pos) {
|
||||
print("_buildPage " + pos.toString());
|
||||
Fimber.d("_buildPage " + pos.toString());
|
||||
assert(_pageCount >= 1);
|
||||
|
||||
if (pos == 0) {
|
||||
@ -223,15 +224,15 @@ class GitHostSetupScreenState extends State<GitHostSetupScreen> {
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
print("build _pageCount " + _pageCount.toString());
|
||||
print("build _currentPageIndex " + _currentPageIndex.toString());
|
||||
Fimber.d("build _pageCount " + _pageCount.toString());
|
||||
Fimber.d("build _currentPageIndex " + _currentPageIndex.toString());
|
||||
|
||||
var pageView = PageView.builder(
|
||||
controller: pageController,
|
||||
itemBuilder: _buildPage,
|
||||
itemCount: _pageCount,
|
||||
onPageChanged: (int pageNum) {
|
||||
print("PageView onPageChanged: " + pageNum.toString());
|
||||
Fimber.d("PageView onPageChanged: " + pageNum.toString());
|
||||
/*
|
||||
String pageName = "";
|
||||
switch (pageNum) {
|
||||
@ -350,8 +351,8 @@ class GitHostSetupScreenState extends State<GitHostSetupScreen> {
|
||||
await launch(gitLabUrl);
|
||||
}
|
||||
} catch (err, stack) {
|
||||
print('_launchDeployKeyPage: ' + err.toString());
|
||||
print(stack.toString());
|
||||
Fimber.d('_launchDeployKeyPage: ' + err.toString());
|
||||
Fimber.d(stack.toString());
|
||||
}
|
||||
}
|
||||
|
||||
@ -366,8 +367,8 @@ class GitHostSetupScreenState extends State<GitHostSetupScreen> {
|
||||
}
|
||||
} catch (err, stack) {
|
||||
// FIXME: Error handling?
|
||||
print("_launchCreateRepoPage: " + err.toString());
|
||||
print(stack);
|
||||
Fimber.d("_launchCreateRepoPage: " + err.toString());
|
||||
Fimber.d(stack.toString());
|
||||
}
|
||||
}
|
||||
|
||||
@ -400,7 +401,7 @@ class GitHostSetupScreenState extends State<GitHostSetupScreen> {
|
||||
|
||||
List<String> subFolders = await _getSubFoldersWithMdFiles(basePath);
|
||||
if (subFolders.isEmpty) {
|
||||
print("Found no subfolders with md files");
|
||||
Fimber.d("Found no subfolders with md files");
|
||||
_finish();
|
||||
return;
|
||||
}
|
||||
@ -417,7 +418,7 @@ class GitHostSetupScreenState extends State<GitHostSetupScreen> {
|
||||
var dotGitDir = Directory(p.join(baseDir.path, ".git"));
|
||||
bool exists = await dotGitDir.exists();
|
||||
if (exists) {
|
||||
print("Removing " + baseDir.path);
|
||||
Fimber.d("Removing " + baseDir.path);
|
||||
await baseDir.delete(recursive: true);
|
||||
await baseDir.create();
|
||||
}
|
||||
|
@ -1,3 +1,4 @@
|
||||
import 'package:fimber/fimber.dart';
|
||||
import 'package:flutter/foundation.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_markdown/flutter_markdown.dart';
|
||||
@ -94,7 +95,7 @@ class NoteBrowsingScreenState extends State<NoteBrowsingScreen> {
|
||||
stateContainer.removeNote(note);
|
||||
Navigator.pop(context);
|
||||
|
||||
print("Shwoing an undo snackbar");
|
||||
Fimber.d("Shwoing an undo snackbar");
|
||||
var snackbar = buildUndoDeleteSnackbar(context, note, noteIndex);
|
||||
_scaffoldKey.currentState
|
||||
..removeCurrentSnackBar()
|
||||
|
@ -1,6 +1,7 @@
|
||||
import 'dart:async';
|
||||
import 'dart:io';
|
||||
|
||||
import 'package:fimber/fimber.dart';
|
||||
import 'package:flutter/foundation.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:journal/analytics.dart';
|
||||
@ -101,7 +102,7 @@ class StateContainerState extends State<StateContainer> {
|
||||
}
|
||||
|
||||
void _loadNotesFromDisk() {
|
||||
print("Loading Notes From Disk");
|
||||
Fimber.d("Loading Notes From Disk");
|
||||
appState.isLoadingFromDisk = true;
|
||||
noteRepo.listNotes().then((loadedNotes) {
|
||||
setState(() {
|
||||
@ -118,8 +119,8 @@ class StateContainerState extends State<StateContainer> {
|
||||
});
|
||||
}).catchError((err, stack) {
|
||||
setState(() {
|
||||
print("Load Notes From Disk Error: " + err.toString());
|
||||
print(stack.toString());
|
||||
Fimber.d("Load Notes From Disk Error: " + err.toString());
|
||||
Fimber.d(stack.toString());
|
||||
appState.isLoadingFromDisk = false;
|
||||
|
||||
getAnalytics().logEvent(
|
||||
@ -134,7 +135,7 @@ class StateContainerState extends State<StateContainer> {
|
||||
|
||||
Future syncNotes() async {
|
||||
if (!appState.remoteGitRepoConfigured) {
|
||||
print("Not syncing because RemoteRepo not configured");
|
||||
Fimber.d("Not syncing because RemoteRepo not configured");
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -150,8 +151,8 @@ class StateContainerState extends State<StateContainer> {
|
||||
});
|
||||
} catch (err, stack) {
|
||||
setState(() {
|
||||
print("Load Notes From Disk Error: " + err.toString());
|
||||
print(stack.toString());
|
||||
Fimber.d("Load Notes From Disk Error: " + err.toString());
|
||||
Fimber.d(stack.toString());
|
||||
appState.isLoadingFromDisk = false;
|
||||
});
|
||||
}
|
||||
@ -161,16 +162,16 @@ class StateContainerState extends State<StateContainer> {
|
||||
|
||||
void _syncNotes() {
|
||||
if (!appState.remoteGitRepoConfigured) {
|
||||
print("Not syncing because RemoteRepo not configured");
|
||||
Fimber.d("Not syncing because RemoteRepo not configured");
|
||||
return;
|
||||
}
|
||||
|
||||
print("Starting to syncNotes");
|
||||
Fimber.d("Starting to syncNotes");
|
||||
noteRepo.sync().then((loaded) {
|
||||
print("NotesRepo Synced: " + loaded.toString());
|
||||
Fimber.d("NotesRepo Synced: " + loaded.toString());
|
||||
_loadNotesFromDisk();
|
||||
}).catchError((err) {
|
||||
print("NotesRepo Sync: " + err.toString());
|
||||
Fimber.d("NotesRepo Sync: " + err.toString());
|
||||
});
|
||||
}
|
||||
|
||||
@ -213,7 +214,7 @@ class StateContainerState extends State<StateContainer> {
|
||||
}
|
||||
|
||||
void insertNote(int index, Note note) {
|
||||
print("State Container insertNote");
|
||||
Fimber.d("State Container insertNote");
|
||||
setState(() {
|
||||
if (note.filePath == null || note.filePath.isEmpty) {
|
||||
note.filePath = toIso8601WithTimezone(note.created) + '.md';
|
||||
@ -227,7 +228,7 @@ class StateContainerState extends State<StateContainer> {
|
||||
}
|
||||
|
||||
void updateNote(Note note) {
|
||||
print("State Container updateNote");
|
||||
Fimber.d("State Container updateNote");
|
||||
setState(() {
|
||||
// Update that specific note
|
||||
for (var i = 0; i < appState.notes.length; i++) {
|
||||
|
@ -1,6 +1,7 @@
|
||||
import 'dart:async';
|
||||
import 'dart:io';
|
||||
|
||||
import 'package:fimber/fimber.dart';
|
||||
import 'package:flutter/foundation.dart';
|
||||
import 'package:journal/note.dart';
|
||||
import 'package:journal/storage/notes_repository.dart';
|
||||
@ -21,7 +22,7 @@ class FileStorage implements NoteRepository {
|
||||
}) {
|
||||
assert(baseDirectory != null);
|
||||
assert(baseDirectory.isNotEmpty);
|
||||
print("FileStorage Directory: " + baseDirectory);
|
||||
Fimber.d("FileStorage Directory: " + baseDirectory);
|
||||
}
|
||||
|
||||
@override
|
||||
@ -61,7 +62,7 @@ class FileStorage implements NoteRepository {
|
||||
@override
|
||||
Future<NoteRepoResult> addNote(Note note) async {
|
||||
var filePath = p.join(baseDirectory, note.filePath);
|
||||
print("FileStorage: Adding note in " + filePath);
|
||||
Fimber.d("FileStorage: Adding note in " + filePath);
|
||||
|
||||
var file = File(filePath);
|
||||
if (file == null) {
|
||||
|
@ -1,5 +1,6 @@
|
||||
import 'dart:async';
|
||||
|
||||
import 'package:fimber/fimber.dart';
|
||||
import 'package:flutter/foundation.dart';
|
||||
import 'package:journal/apis/git.dart';
|
||||
import 'package:journal/note.dart';
|
||||
@ -90,13 +91,13 @@ class GitNoteRepository implements NoteRepository {
|
||||
try {
|
||||
await _gitRepo.pull();
|
||||
} on GitException catch (ex) {
|
||||
print(ex);
|
||||
Fimber.d(ex.toString());
|
||||
}
|
||||
|
||||
try {
|
||||
await _gitRepo.push();
|
||||
} on GitException catch (ex) {
|
||||
print(ex);
|
||||
Fimber.d(ex.toString());
|
||||
rethrow;
|
||||
}
|
||||
|
||||
|
@ -1,5 +1,6 @@
|
||||
import 'dart:convert';
|
||||
|
||||
import 'package:fimber/fimber.dart';
|
||||
import 'package:journal/note.dart';
|
||||
import 'package:yaml/yaml.dart';
|
||||
|
||||
@ -37,7 +38,7 @@ class MarkdownYAMLSerializer implements NoteSerializer {
|
||||
});
|
||||
}
|
||||
} catch (err) {
|
||||
print(
|
||||
Fimber.d(
|
||||
'MarkdownYAMLSerializer::decode("$yamlText") -> ${err.toString()}');
|
||||
}
|
||||
map['body'] = parts[2].trimLeft();
|
||||
|
@ -1,3 +1,4 @@
|
||||
import 'package:fimber/fimber.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter/services.dart';
|
||||
import 'package:package_info/package_info.dart';
|
||||
@ -26,7 +27,7 @@ Future<bool> shouldEnableAnalytics() async {
|
||||
final bool result = await _platform.invokeMethod('shouldEnableAnalytics');
|
||||
return result;
|
||||
} on MissingPluginException catch (e) {
|
||||
print("shouldEnableAnalytics: $e");
|
||||
Fimber.d("shouldEnableAnalytics: $e");
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@ -49,7 +50,7 @@ SnackBar buildUndoDeleteSnackbar(
|
||||
action: SnackBarAction(
|
||||
label: "Undo",
|
||||
onPressed: () {
|
||||
print("Undoing delete");
|
||||
Fimber.d("Undoing delete");
|
||||
var stateContainer = StateContainer.of(context);
|
||||
stateContainer.undoRemoveNote(deletedNote, deletedNoteIndex);
|
||||
},
|
||||
|
@ -106,6 +106,13 @@ packages:
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "5.0.7"
|
||||
fimber:
|
||||
dependency: "direct main"
|
||||
description:
|
||||
name: fimber
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "0.3.0"
|
||||
firebase_analytics:
|
||||
dependency: "direct main"
|
||||
description:
|
||||
|
@ -24,6 +24,7 @@ dependencies:
|
||||
flutter_email_sender: ^2.0.2
|
||||
function_types: ^0.0.2
|
||||
auto_size_text: ^2.0.1
|
||||
fimber: ^0.3.0
|
||||
|
||||
dev_dependencies:
|
||||
flutter_launcher_icons: "^0.7.2"
|
||||
|
Reference in New Issue
Block a user