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) ?: ""
|
||||
Cwtch.loadProfiles(pass)
|
||||
}
|
||||
"GetProfiles" -> Result.success(Data.Builder().putString("result", Cwtch.getProfiles()).build())
|
||||
"NumMessages" -> {
|
||||
val profile = (a.get("profile") as? String) ?: ""
|
||||
val handle = (a.get("contact") as? String) ?: ""
|
||||
|
|
|
@ -31,9 +31,6 @@ abstract class Cwtch {
|
|||
// ignore: non_constant_identifier_names
|
||||
void DebugResetContact(String profileOnion, String contactHandle);
|
||||
|
||||
// ignore: non_constant_identifier_names
|
||||
Future<dynamic> GetProfiles();
|
||||
|
||||
// ignore: non_constant_identifier_names
|
||||
Future<dynamic> NumMessages(String profile, String handle);
|
||||
// ignore: non_constant_identifier_names
|
||||
|
|
|
@ -192,6 +192,10 @@ class CwtchNotifier {
|
|||
print("acn status: $data");
|
||||
torStatus.handleUpdate(int.parse(data["Progress"]), data["Status"]);
|
||||
break;
|
||||
case "ACNVersion":
|
||||
print("acn version: $data");
|
||||
torStatus.updateVersion(data["Data"]);
|
||||
break;
|
||||
case "UpdateServerInfo":
|
||||
profileCN.getProfile(data["ProfileOnion"])?.replaceServers(data["ServerList"]);
|
||||
break;
|
||||
|
|
|
@ -194,17 +194,6 @@ class CwtchFfi implements Cwtch {
|
|||
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
|
||||
Future<int> NumMessages(String profile, String handle) async {
|
||||
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});
|
||||
}
|
||||
|
||||
Future<dynamic> GetProfiles() {
|
||||
print("gomobile.dart: GetProfiles()");
|
||||
return cwtchPlatform.invokeMethod("GetProfiles");
|
||||
}
|
||||
|
||||
// ignore: non_constant_identifier_names
|
||||
Future<dynamic> NumMessages(String profile, String handle) {
|
||||
return cwtchPlatform.invokeMethod("NumMessages", {"profile": profile, "contact": handle});
|
||||
|
|
|
@ -55,13 +55,11 @@ class FlwtchState extends State<Flwtch> {
|
|||
|
||||
@override
|
||||
initState() {
|
||||
print("Init state");
|
||||
super.initState();
|
||||
|
||||
profs = ProfileListState();
|
||||
notificationClickChannel.setMethodCallHandler(_externalNotificationClicked);
|
||||
shutdownMethodChannel.setMethodCallHandler(shutdown);
|
||||
print("initState set cwtch...");
|
||||
if (Platform.isAndroid) {
|
||||
var cwtchNotifier = new CwtchNotifier(profs, globalSettings, globalErrorHandler, globalTorStatus, NullNotificationsManager(), globalAppState);
|
||||
cwtch = CwtchGomobile(cwtchNotifier);
|
||||
|
@ -72,9 +70,7 @@ class FlwtchState extends State<Flwtch> {
|
|||
var cwtchNotifier = new CwtchNotifier(profs, globalSettings, globalErrorHandler, globalTorStatus, NullNotificationsManager(), globalAppState);
|
||||
cwtch = CwtchFfi(cwtchNotifier);
|
||||
}
|
||||
print("initState cwtch.Start()...");
|
||||
cwtch.Start();
|
||||
print("initState done!");
|
||||
}
|
||||
|
||||
ChangeNotifierProvider<TorStatus> getTorStatusProvider() => ChangeNotifierProvider.value(value: globalTorStatus);
|
||||
|
@ -86,7 +82,6 @@ class FlwtchState extends State<Flwtch> {
|
|||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
//appStatus = AppModel(cwtch: cwtch);
|
||||
globalSettings.initPackageInfo();
|
||||
return MultiProvider(
|
||||
providers: [
|
||||
|
|
|
@ -4,8 +4,9 @@ class TorStatus extends ChangeNotifier {
|
|||
int progress;
|
||||
String status;
|
||||
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.
|
||||
handleUpdate(int new_progress, String new_status) {
|
||||
|
@ -20,4 +21,9 @@ class TorStatus extends ChangeNotifier {
|
|||
|
||||
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();
|
||||
},
|
||||
),
|
||||
)
|
||||
),
|
||||
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.
|
||||
# Read more about iOS versioning at
|
||||
# https://developer.apple.com/library/archive/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html
|
||||
version: 1.0.0+11
|
||||
version: 1.0.0+12
|
||||
|
||||
environment:
|
||||
sdk: ">=2.12.0 <3.0.0"
|
||||
|
@ -51,16 +51,13 @@ dependencies:
|
|||
path: plugins/window_size
|
||||
ref: e48abe7c3e9ebfe0b81622167c5201d4e783bb81
|
||||
|
||||
# Uncomment to update lokalise translations (see README for list of deps to comment out bc incompatibilities)
|
||||
#dev_dependencies:
|
||||
# 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:
|
||||
# project_id: ""
|
||||
# api_token: ""
|
||||
# include_tags:
|
||||
# - tag1
|
||||
# - tag2
|
||||
# project_id: "737094205fceda35c50aa2.60364948"
|
||||
# api_token: "0407300fe4aa1edf1c1818e56234589e74c83c59" # Read only api Token from Dan
|
||||
|
||||
|
||||
flutter_intl:
|
||||
enabled: true
|
||||
|
|
Loading…
Reference in New Issue