Handle AVNVersion message and display version on Tor screen
continuous-integration/drone/pr Build is passing
Details
continuous-integration/drone/pr Build is passing
Details
This commit is contained in:
parent
8b8b20e7b6
commit
d3a6ec85cf
|
@ -112,7 +112,6 @@ class FlwtchWorker(context: Context, parameters: WorkerParameters) :
|
||||||
val pass = (a.get("pass") as? String) ?: ""
|
val pass = (a.get("pass") as? String) ?: ""
|
||||||
Cwtch.loadProfiles(pass)
|
Cwtch.loadProfiles(pass)
|
||||||
}
|
}
|
||||||
"GetProfiles" -> Result.success(Data.Builder().putString("result", Cwtch.getProfiles()).build())
|
|
||||||
"NumMessages" -> {
|
"NumMessages" -> {
|
||||||
val profile = (a.get("profile") as? String) ?: ""
|
val profile = (a.get("profile") as? String) ?: ""
|
||||||
val handle = (a.get("contact") as? String) ?: ""
|
val handle = (a.get("contact") as? String) ?: ""
|
||||||
|
|
|
@ -31,9 +31,6 @@ abstract class Cwtch {
|
||||||
// ignore: non_constant_identifier_names
|
// ignore: non_constant_identifier_names
|
||||||
void DebugResetContact(String profileOnion, String contactHandle);
|
void DebugResetContact(String profileOnion, String contactHandle);
|
||||||
|
|
||||||
// ignore: non_constant_identifier_names
|
|
||||||
Future<dynamic> GetProfiles();
|
|
||||||
|
|
||||||
// ignore: non_constant_identifier_names
|
// ignore: non_constant_identifier_names
|
||||||
Future<dynamic> NumMessages(String profile, String handle);
|
Future<dynamic> NumMessages(String profile, String handle);
|
||||||
// ignore: non_constant_identifier_names
|
// ignore: non_constant_identifier_names
|
||||||
|
|
|
@ -192,6 +192,10 @@ class CwtchNotifier {
|
||||||
print("acn status: $data");
|
print("acn status: $data");
|
||||||
torStatus.handleUpdate(int.parse(data["Progress"]), data["Status"]);
|
torStatus.handleUpdate(int.parse(data["Progress"]), data["Status"]);
|
||||||
break;
|
break;
|
||||||
|
case "ACNVersion":
|
||||||
|
print("acn version: $data");
|
||||||
|
torStatus.updateVersion(data["Data"]);
|
||||||
|
break;
|
||||||
case "UpdateServerInfo":
|
case "UpdateServerInfo":
|
||||||
profileCN.getProfile(data["ProfileOnion"])?.replaceServers(data["ServerList"]);
|
profileCN.getProfile(data["ProfileOnion"])?.replaceServers(data["ServerList"]);
|
||||||
break;
|
break;
|
||||||
|
|
|
@ -194,17 +194,6 @@ class CwtchFfi implements Cwtch {
|
||||||
LoadProfiles(ut8pass, ut8pass.length);
|
LoadProfiles(ut8pass, ut8pass.length);
|
||||||
}
|
}
|
||||||
|
|
||||||
// ignore: non_constant_identifier_names
|
|
||||||
Future<String> GetProfiles() async {
|
|
||||||
var getProfilesC = library.lookup<NativeFunction<get_json_blob_void_function>>("c_GetProfiles");
|
|
||||||
// ignore: non_constant_identifier_names
|
|
||||||
final GetProfiles = getProfilesC.asFunction<GetJsonBlobVoidFn>();
|
|
||||||
|
|
||||||
Pointer<Utf8> jsonProfilesBytes = GetProfiles();
|
|
||||||
String jsonProfiles = jsonProfilesBytes.toDartString();
|
|
||||||
return jsonProfiles;
|
|
||||||
}
|
|
||||||
|
|
||||||
// ignore: non_constant_identifier_names
|
// ignore: non_constant_identifier_names
|
||||||
Future<int> NumMessages(String profile, String handle) async {
|
Future<int> NumMessages(String profile, String handle) async {
|
||||||
var numMessagesC = library.lookup<NativeFunction<get_int_from_str_str_function>>("c_NumMessages");
|
var numMessagesC = library.lookup<NativeFunction<get_int_from_str_str_function>>("c_NumMessages");
|
||||||
|
|
|
@ -86,11 +86,6 @@ class CwtchGomobile implements Cwtch {
|
||||||
cwtchPlatform.invokeMethod("DeleteProfile", {"onion": onion, "pass": pass});
|
cwtchPlatform.invokeMethod("DeleteProfile", {"onion": onion, "pass": pass});
|
||||||
}
|
}
|
||||||
|
|
||||||
Future<dynamic> GetProfiles() {
|
|
||||||
print("gomobile.dart: GetProfiles()");
|
|
||||||
return cwtchPlatform.invokeMethod("GetProfiles");
|
|
||||||
}
|
|
||||||
|
|
||||||
// ignore: non_constant_identifier_names
|
// ignore: non_constant_identifier_names
|
||||||
Future<dynamic> NumMessages(String profile, String handle) {
|
Future<dynamic> NumMessages(String profile, String handle) {
|
||||||
return cwtchPlatform.invokeMethod("NumMessages", {"profile": profile, "contact": handle});
|
return cwtchPlatform.invokeMethod("NumMessages", {"profile": profile, "contact": handle});
|
||||||
|
|
|
@ -55,13 +55,11 @@ class FlwtchState extends State<Flwtch> {
|
||||||
|
|
||||||
@override
|
@override
|
||||||
initState() {
|
initState() {
|
||||||
print("Init state");
|
|
||||||
super.initState();
|
super.initState();
|
||||||
|
|
||||||
profs = ProfileListState();
|
profs = ProfileListState();
|
||||||
notificationClickChannel.setMethodCallHandler(_externalNotificationClicked);
|
notificationClickChannel.setMethodCallHandler(_externalNotificationClicked);
|
||||||
shutdownMethodChannel.setMethodCallHandler(shutdown);
|
shutdownMethodChannel.setMethodCallHandler(shutdown);
|
||||||
print("initState set cwtch...");
|
|
||||||
if (Platform.isAndroid) {
|
if (Platform.isAndroid) {
|
||||||
var cwtchNotifier = new CwtchNotifier(profs, globalSettings, globalErrorHandler, globalTorStatus, NullNotificationsManager(), globalAppState);
|
var cwtchNotifier = new CwtchNotifier(profs, globalSettings, globalErrorHandler, globalTorStatus, NullNotificationsManager(), globalAppState);
|
||||||
cwtch = CwtchGomobile(cwtchNotifier);
|
cwtch = CwtchGomobile(cwtchNotifier);
|
||||||
|
@ -72,9 +70,7 @@ class FlwtchState extends State<Flwtch> {
|
||||||
var cwtchNotifier = new CwtchNotifier(profs, globalSettings, globalErrorHandler, globalTorStatus, NullNotificationsManager(), globalAppState);
|
var cwtchNotifier = new CwtchNotifier(profs, globalSettings, globalErrorHandler, globalTorStatus, NullNotificationsManager(), globalAppState);
|
||||||
cwtch = CwtchFfi(cwtchNotifier);
|
cwtch = CwtchFfi(cwtchNotifier);
|
||||||
}
|
}
|
||||||
print("initState cwtch.Start()...");
|
|
||||||
cwtch.Start();
|
cwtch.Start();
|
||||||
print("initState done!");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
ChangeNotifierProvider<TorStatus> getTorStatusProvider() => ChangeNotifierProvider.value(value: globalTorStatus);
|
ChangeNotifierProvider<TorStatus> getTorStatusProvider() => ChangeNotifierProvider.value(value: globalTorStatus);
|
||||||
|
@ -86,7 +82,6 @@ class FlwtchState extends State<Flwtch> {
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
//appStatus = AppModel(cwtch: cwtch);
|
|
||||||
globalSettings.initPackageInfo();
|
globalSettings.initPackageInfo();
|
||||||
return MultiProvider(
|
return MultiProvider(
|
||||||
providers: [
|
providers: [
|
||||||
|
|
|
@ -4,8 +4,9 @@ class TorStatus extends ChangeNotifier {
|
||||||
int progress;
|
int progress;
|
||||||
String status;
|
String status;
|
||||||
bool connected;
|
bool connected;
|
||||||
|
String version;
|
||||||
|
|
||||||
TorStatus({this.connected = false, this.progress = 0, this.status = ""});
|
TorStatus({this.connected = false, this.progress = 0, this.status = "", this.version = ""});
|
||||||
|
|
||||||
/// Called by the event bus.
|
/// Called by the event bus.
|
||||||
handleUpdate(int new_progress, String new_status) {
|
handleUpdate(int new_progress, String new_status) {
|
||||||
|
@ -20,4 +21,9 @@ class TorStatus extends ChangeNotifier {
|
||||||
|
|
||||||
notifyListeners();
|
notifyListeners();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
updateVersion(String new_version) {
|
||||||
|
version = new_version;
|
||||||
|
notifyListeners();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -51,7 +51,11 @@ class _TorStatusView extends State<TorStatusView> {
|
||||||
Provider.of<FlwtchState>(context, listen: false).cwtch.ResetTor();
|
Provider.of<FlwtchState>(context, listen: false).cwtch.ResetTor();
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
)
|
),
|
||||||
|
ListTile(
|
||||||
|
title: Text(AppLocalizations.of(context)!.torVersion),
|
||||||
|
subtitle: Text(torStatus.version),
|
||||||
|
),
|
||||||
]))));
|
]))));
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
13
pubspec.yaml
13
pubspec.yaml
|
@ -15,7 +15,7 @@ publish_to: 'none' # Remove this line if you wish to publish to pub.dev
|
||||||
# In iOS, build-name is used as CFBundleShortVersionString while build-number used as CFBundleVersion.
|
# In iOS, build-name is used as CFBundleShortVersionString while build-number used as CFBundleVersion.
|
||||||
# Read more about iOS versioning at
|
# Read more about iOS versioning at
|
||||||
# https://developer.apple.com/library/archive/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html
|
# https://developer.apple.com/library/archive/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html
|
||||||
version: 1.0.0+11
|
version: 1.0.0+12
|
||||||
|
|
||||||
environment:
|
environment:
|
||||||
sdk: ">=2.12.0 <3.0.0"
|
sdk: ">=2.12.0 <3.0.0"
|
||||||
|
@ -51,16 +51,13 @@ dependencies:
|
||||||
path: plugins/window_size
|
path: plugins/window_size
|
||||||
ref: e48abe7c3e9ebfe0b81622167c5201d4e783bb81
|
ref: e48abe7c3e9ebfe0b81622167c5201d4e783bb81
|
||||||
|
|
||||||
|
# Uncomment to update lokalise translations (see README for list of deps to comment out bc incompatibilities)
|
||||||
#dev_dependencies:
|
#dev_dependencies:
|
||||||
# flutter_lokalise: any
|
# flutter_lokalise: any
|
||||||
|
|
||||||
# alternatively: flutter pub run intl_translation:generate_from_arb --output-dir=lib/l10n --no-use-deferred-loading lib/intl/app_localizations.dart lib/l10n/intl_*.arb --api-token X --project-id Y
|
|
||||||
#flutter_lokalise:
|
#flutter_lokalise:
|
||||||
# project_id: ""
|
# project_id: "737094205fceda35c50aa2.60364948"
|
||||||
# api_token: ""
|
# api_token: "0407300fe4aa1edf1c1818e56234589e74c83c59" # Read only api Token from Dan
|
||||||
# include_tags:
|
|
||||||
# - tag1
|
|
||||||
# - tag2
|
|
||||||
|
|
||||||
flutter_intl:
|
flutter_intl:
|
||||||
enabled: true
|
enabled: true
|
||||||
|
|
Loading…
Reference in New Issue