logging prune
continuous-integration/drone/pr Build is passing
Details
continuous-integration/drone/pr Build is passing
Details
This commit is contained in:
parent
1b25dda075
commit
3697aad54b
|
@ -3,4 +3,10 @@ const dev_version = "development";
|
||||||
class EnvironmentConfig {
|
class EnvironmentConfig {
|
||||||
static const BUILD_VER = String.fromEnvironment('BUILD_VER', defaultValue: dev_version);
|
static const BUILD_VER = String.fromEnvironment('BUILD_VER', defaultValue: dev_version);
|
||||||
static const BUILD_DATE = String.fromEnvironment('BUILD_DATE', defaultValue: "now");
|
static const BUILD_DATE = String.fromEnvironment('BUILD_DATE', defaultValue: "now");
|
||||||
|
|
||||||
|
static void debugLog(String log) {
|
||||||
|
if (EnvironmentConfig.BUILD_VER == dev_version) {
|
||||||
|
print(log);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,6 +5,7 @@ import 'package:provider/provider.dart';
|
||||||
|
|
||||||
import 'package:cwtch/torstatus.dart';
|
import 'package:cwtch/torstatus.dart';
|
||||||
|
|
||||||
|
import '../config.dart';
|
||||||
import '../errorHandler.dart';
|
import '../errorHandler.dart';
|
||||||
import '../model.dart';
|
import '../model.dart';
|
||||||
import '../settings.dart';
|
import '../settings.dart';
|
||||||
|
@ -150,7 +151,7 @@ class CwtchNotifier {
|
||||||
profileCN.getProfile(data["Identity"])?.contactList.getContact(contactHandle)!.totalMessages = int.parse(data["Data"]);
|
profileCN.getProfile(data["Identity"])?.contactList.getContact(contactHandle)!.totalMessages = int.parse(data["Data"]);
|
||||||
break;
|
break;
|
||||||
case "IndexedFailure":
|
case "IndexedFailure":
|
||||||
print("IndexedFailure");
|
EnvironmentConfig.debugLog("IndexedFailure");
|
||||||
var idx = data["Index"];
|
var idx = data["Index"];
|
||||||
var key = profileCN.getProfile(data["ProfileOnion"])?.contactList.getContact(data["RemotePeer"])!.getMessageKey(idx);
|
var key = profileCN.getProfile(data["ProfileOnion"])?.contactList.getContact(data["RemotePeer"])!.getMessageKey(idx);
|
||||||
try {
|
try {
|
||||||
|
@ -162,7 +163,7 @@ class CwtchNotifier {
|
||||||
break;
|
break;
|
||||||
case "SendMessageToGroupError":
|
case "SendMessageToGroupError":
|
||||||
// from me (already displayed - do not update counter)
|
// from me (already displayed - do not update counter)
|
||||||
print("SendMessageToGroupError");
|
EnvironmentConfig.debugLog("SendMessageToGroupError");
|
||||||
var idx = data["Signature"];
|
var idx = data["Signature"];
|
||||||
var key = profileCN.getProfile(data["ProfileOnion"])?.contactList.getContact(data["GroupID"])!.getMessageKey(idx);
|
var key = profileCN.getProfile(data["ProfileOnion"])?.contactList.getContact(data["GroupID"])!.getMessageKey(idx);
|
||||||
if (key == null) break;
|
if (key == null) break;
|
||||||
|
@ -175,7 +176,7 @@ class CwtchNotifier {
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case "AppError":
|
case "AppError":
|
||||||
print("New App Error: $data");
|
EnvironmentConfig.debugLog("New App Error: $data");
|
||||||
// special case for delete error (todo: standardize cwtch errors)
|
// special case for delete error (todo: standardize cwtch errors)
|
||||||
if (data["Error"] == "Password did not match") {
|
if (data["Error"] == "Password did not match") {
|
||||||
error.handleUpdate("deleteprofile.error");
|
error.handleUpdate("deleteprofile.error");
|
||||||
|
@ -190,7 +191,7 @@ class CwtchNotifier {
|
||||||
if (data["Key"] == "public.name") {
|
if (data["Key"] == "public.name") {
|
||||||
profileCN.getProfile(data["ProfileOnion"])?.nickname = data["Data"];
|
profileCN.getProfile(data["ProfileOnion"])?.nickname = data["Data"];
|
||||||
} else {
|
} else {
|
||||||
print("unhandled set attribute event: ${data['Key']}");
|
EnvironmentConfig.debugLog("unhandled set attribute event: ${data['Key']}");
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case "NetworkError":
|
case "NetworkError":
|
||||||
|
@ -198,18 +199,18 @@ class CwtchNotifier {
|
||||||
profileCN.getProfile(data["ProfileOnion"])?.isOnline = isOnline;
|
profileCN.getProfile(data["ProfileOnion"])?.isOnline = isOnline;
|
||||||
break;
|
break;
|
||||||
case "ACNStatus":
|
case "ACNStatus":
|
||||||
print("acn status: $data");
|
EnvironmentConfig.debugLog("acn status: $data");
|
||||||
torStatus.handleUpdate(int.parse(data["Progress"]), data["Status"]);
|
torStatus.handleUpdate(int.parse(data["Progress"]), data["Status"]);
|
||||||
break;
|
break;
|
||||||
case "ACNVersion":
|
case "ACNVersion":
|
||||||
print("acn version: $data");
|
EnvironmentConfig.debugLog("acn version: $data");
|
||||||
torStatus.updateVersion(data["Data"]);
|
torStatus.updateVersion(data["Data"]);
|
||||||
break;
|
break;
|
||||||
case "UpdateServerInfo":
|
case "UpdateServerInfo":
|
||||||
profileCN.getProfile(data["ProfileOnion"])?.replaceServers(data["ServerList"]);
|
profileCN.getProfile(data["ProfileOnion"])?.replaceServers(data["ServerList"]);
|
||||||
break;
|
break;
|
||||||
case "NewGroup":
|
case "NewGroup":
|
||||||
print("new group");
|
EnvironmentConfig.debugLog("new group");
|
||||||
String invite = data["GroupInvite"].toString();
|
String invite = data["GroupInvite"].toString();
|
||||||
if (invite.startsWith("torv3")) {
|
if (invite.startsWith("torv3")) {
|
||||||
String inviteJson = new String.fromCharCodes(base64Decode(invite.substring(5)));
|
String inviteJson = new String.fromCharCodes(base64Decode(invite.substring(5)));
|
||||||
|
@ -236,7 +237,7 @@ class CwtchNotifier {
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case "AcceptGroupInvite":
|
case "AcceptGroupInvite":
|
||||||
print("accept group invite");
|
EnvironmentConfig.debugLog("accept group invite");
|
||||||
|
|
||||||
profileCN.getProfile(data["ProfileOnion"])?.contactList.getContact(data["GroupID"])!.isInvitation = false;
|
profileCN.getProfile(data["ProfileOnion"])?.contactList.getContact(data["GroupID"])!.isInvitation = false;
|
||||||
profileCN.getProfile(data["ProfileOnion"])?.contactList.updateLastMessageTime(data["GroupID"], DateTime.now());
|
profileCN.getProfile(data["ProfileOnion"])?.contactList.updateLastMessageTime(data["GroupID"], DateTime.now());
|
||||||
|
@ -257,7 +258,7 @@ class CwtchNotifier {
|
||||||
profileCN.getProfile(data["ProfileOnion"])?.contactList.getContact(data["GroupID"])!.nickname = data["Data"];
|
profileCN.getProfile(data["ProfileOnion"])?.contactList.getContact(data["GroupID"])!.nickname = data["Data"];
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
print("unhandled set group attribute event: ${data['Key']}");
|
EnvironmentConfig.debugLog("unhandled set group attribute event: ${data['Key']}");
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case "NewRetValMessageFromPeer":
|
case "NewRetValMessageFromPeer":
|
||||||
|
@ -267,11 +268,11 @@ class CwtchNotifier {
|
||||||
profileCN.getProfile(data["ProfileOnion"])?.contactList.getContact(data["RemotePeer"])!.nickname = data["Data"];
|
profileCN.getProfile(data["ProfileOnion"])?.contactList.getContact(data["RemotePeer"])!.nickname = data["Data"];
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
print("unhandled peer attribute event: ${data['Path']}");
|
EnvironmentConfig.debugLog("unhandled peer attribute event: ${data['Path']}");
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
print("unhandled event: $type");
|
EnvironmentConfig.debugLog("unhandled event: $type");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -227,7 +227,6 @@ class ProfileInfoState extends ChangeNotifier {
|
||||||
// Parse out the server list json into our server info state struct...
|
// Parse out the server list json into our server info state struct...
|
||||||
void replaceServers(String serversJson) {
|
void replaceServers(String serversJson) {
|
||||||
if (serversJson != "" && serversJson != "null") {
|
if (serversJson != "" && serversJson != "null") {
|
||||||
print("got serversJson");
|
|
||||||
List<dynamic> servers = jsonDecode(serversJson);
|
List<dynamic> servers = jsonDecode(serversJson);
|
||||||
this._servers.replace(servers.map((server) {
|
this._servers.replace(servers.map((server) {
|
||||||
// TODO Keys...
|
// TODO Keys...
|
||||||
|
|
Loading…
Reference in New Issue