Merge pull request 'fix warnings' (#25) from fixwarnings into trunk

Reviewed-on: #25
This commit is contained in:
Sarah Jamie Lewis 2021-03-24 13:38:21 -07:00
commit 8856a3e54b
11 changed files with 62 additions and 15 deletions

View File

@ -1,18 +1,32 @@
abstract class Cwtch {
// ignore: non_constant_identifier_names
Future<void> Start();
// ignore: non_constant_identifier_names
void SelectProfile(String onion);
// ignore: non_constant_identifier_names
void CreateProfile(String nick, String pass);
// ignore: non_constant_identifier_names
void LoadProfiles(String pass);
// ignore: non_constant_identifier_names
void SendProfileEvent(String onion, String jsonEvent);
// ignore: non_constant_identifier_names
void SendAppEvent(String jsonEvent);
// ignore: non_constant_identifier_names
Future<String> ACNEvents();
// ignore: non_constant_identifier_names
Future<String> ContactEvents();
// ignore: non_constant_identifier_names
Future<String> GetProfiles();
// ignore: non_constant_identifier_names
Future<int> NumMessages(String profile, String handle);
// ignore: non_constant_identifier_names
Future<String> GetMessage(String profile, String handle, int index);
// ignore: non_constant_identifier_names
Future<String> GetMessages(String profile, String handle, int start, int end);
void dispose();
}

View File

@ -1,8 +1,5 @@
import 'dart:convert';
import 'package:provider/provider.dart';
import 'package:provider/provider.dart';
import '../model.dart';
import '../settings.dart';

View File

@ -2,14 +2,12 @@ import 'dart:convert';
import 'dart:ffi';
import 'dart:io';
import 'dart:isolate';
import 'package:flutter/rendering.dart';
import 'package:flutter_app/cwtch/cwtchNotifier.dart';
import 'package:path/path.dart' as path;
import 'package:ffi/ffi.dart';
import 'package:flutter_app/cwtch/cwtch.dart';
import '../model.dart';
/////////////////////
/// Cwtch API ///
@ -61,6 +59,7 @@ class CwtchFfi implements Cwtch {
cwtchNotifier = _cwtchNotifier;
}
// ignore: non_constant_identifier_names
Future<void> Start() async {
String home = "";
Map<String, String> envVars = Platform.environment;
@ -92,7 +91,7 @@ class CwtchFfi implements Cwtch {
@override
void dispose() {
if (cwtchIsolate != null) {
cwtchIsolate.kill();
cwtchIsolate.kill(priority: Isolate.immediate);
}
}
@ -108,6 +107,7 @@ class CwtchFfi implements Cwtch {
static Stream<String> pollAppbusEvents() async* {
var library = DynamicLibrary.open("libCwtch.so");
var getAppbusEventC = library.lookup<NativeFunction<acn_events_function>>("c_GetAppBusEvent");
// ignore: non_constant_identifier_names
final GetAppbusEvent = getAppbusEventC.asFunction<ACNEventsFn>();
while (true) {
@ -145,6 +145,7 @@ class CwtchFfi implements Cwtch {
LoadProfiles(ut8pass, ut8pass.length);
}
// ignore: non_constant_identifier_names
Future<String> ACNEvents() async {
var acnEventsC = library.lookup<NativeFunction<acn_events_function>>("c_ACNEvents");
// ignore: non_constant_identifier_names
@ -155,6 +156,7 @@ class CwtchFfi implements Cwtch {
return event;
}
// ignore: non_constant_identifier_names
Future<String> ContactEvents() async {
var acnEventsC = library.lookup<NativeFunction<acn_events_function>>("c_ContactEvents");
// ignore: non_constant_identifier_names
@ -165,6 +167,7 @@ class CwtchFfi implements Cwtch {
return event;
}
// 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
@ -175,6 +178,7 @@ class CwtchFfi implements Cwtch {
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");
// ignore: non_constant_identifier_names
@ -185,6 +189,7 @@ class CwtchFfi implements Cwtch {
return num;
}
// ignore: non_constant_identifier_names
Future<String> GetMessage(String profile, String handle, int index) async {
var getMessageC = library.lookup<NativeFunction<get_json_blob_from_str_str_int_function>>("c_GetMessage");
// ignore: non_constant_identifier_names
@ -196,6 +201,7 @@ class CwtchFfi implements Cwtch {
return jsonMessage;
}
// ignore: non_constant_identifier_names
Future<String> GetMessages(String profile, String handle, int start, int end) async {
var getMessagesC = library.lookup<NativeFunction<get_json_blob_from_str_str_int_int_function>>("c_GetMessages");
// ignore: non_constant_identifier_names
@ -208,6 +214,7 @@ class CwtchFfi implements Cwtch {
}
@override
// ignore: non_constant_identifier_names
void SendProfileEvent(String onion, String json) {
var sendAppBusEvent = library.lookup<NativeFunction<string_string_to_void_function>>("c_SendProfileEvent");
// ignore: non_constant_identifier_names
@ -218,6 +225,7 @@ class CwtchFfi implements Cwtch {
}
@override
// ignore: non_constant_identifier_names
void SendAppEvent(String json) {
var sendAppBusEvent = library.lookup<NativeFunction<string_to_void_function>>("c_SendAppEvent");
// ignore: non_constant_identifier_names

View File

@ -2,7 +2,6 @@ import 'dart:convert';
import 'dart:io';
import 'package:flutter/services.dart';
import 'package:flutter_app/model.dart';
import 'package:path_provider/path_provider.dart';
import 'dart:async';
import 'package:path/path.dart' as path;
@ -42,6 +41,7 @@ class CwtchGomobile implements Cwtch {
appbusEventChannel.setMethodCallHandler(this._handleAppbusEvent);
}
// ignore: non_constant_identifier_names
Future<void> Start() async {
print("gomobile.dart: Start()...");
var cwtchDir = path.join((await androidHomeDirectory).path, ".cwtch/dev/");
@ -57,51 +57,65 @@ class CwtchGomobile implements Cwtch {
cwtchNotifier.handleMessage(call.method, obj);
}
// ignore: non_constant_identifier_names
void SelectProfile(String onion) {
cwtchPlatform.invokeMethod("SelectProfile", {"profile": onion});
}
// ignore: non_constant_identifier_names
void CreateProfile(String nick, String pass) {
cwtchPlatform.invokeMethod("CreateProfile", {"nick": nick, "pass": pass});
}
// ignore: non_constant_identifier_names
void LoadProfiles(String pass) {
cwtchPlatform.invokeMethod("LoadProfiles", {"pass": pass});
}
// ignore: non_constant_identifier_names
Future<String> ACNEvents() {
return cwtchPlatform.invokeMethod("ACNEvents");
}
// ignore: non_constant_identifier_names
Future<String> ContactEvents() {
return cwtchPlatform.invokeMethod("ContactEvents");
}
// ignore: non_constant_identifier_names
Future<String> GetProfiles() {
print("gomobile.dart: GetProfiles()");
return cwtchPlatform.invokeMethod("GetProfiles");
}
// ignore: non_constant_identifier_names
Future<int> NumMessages(String profile, String handle) {
return cwtchPlatform.invokeMethod("NumMessages", {"profile": profile, "contact": handle});
}
// ignore: non_constant_identifier_names
Future<String> GetMessage(String profile, String handle, int index) {
print("gomobile.dart GetMessage " + index.toString());
return cwtchPlatform.invokeMethod("GetMessage", {"profile": profile, "contact": handle, "index": index});
}
// ignore: non_constant_identifier_names
Future<String> GetMessages(String profile, String handle, int start, int end) {
return cwtchPlatform.invokeMethod("GetMessage", {"profile": profile, "contact": handle, "start": start, "end": end});
}
@override
// ignore: non_constant_identifier_names
void SendProfileEvent(String onion, String jsonEvent) {
cwtchPlatform.invokeMethod("SendProfileEvent", {"onion": onion, "jsonEvent": jsonEvent});
}
@override
// ignore: non_constant_identifier_names
void SendAppEvent(String jsonEvent) {
cwtchPlatform.invokeMethod("SendAppEvent", {"jsonEvent": jsonEvent});
}
@override
void dispose() => {};
}

View File

@ -69,7 +69,7 @@ class FlwtchState extends State<Flwtch> {
@override
Widget build(BuildContext context) {
appStatus = AppModel(cwtch: cwtch);
//appStatus = AppModel(cwtch: cwtch);
return MultiProvider(
providers: [getFlwtchStateProvider(), getProfileListProvider(), getSettingsProvider()],
@ -127,4 +127,10 @@ class FlwtchState extends State<Flwtch> {
},
);
}
@override
void dispose() {
cwtch.dispose();
super.dispose();
}
}

View File

@ -217,6 +217,12 @@ class ContactInfoState extends ChangeNotifier {
notifyListeners();
}
get isGroup => this._isGroup;
set isGroup(bool newVal) {
this._isGroup = newVal;
notifyListeners();
}
get isBlocked => this._isBlocked;
set isBlocked(bool newVal) {
this._isBlocked = newVal;

View File

@ -1,5 +1,4 @@
import 'dart:convert';
import 'dart:io';
import 'package:package_info_plus/package_info_plus.dart';
import 'package:flutter/material.dart';
import 'package:flutter_app/opaque.dart';

View File

@ -57,7 +57,7 @@ class _MessageViewState extends State<MessageView> {
}
void _sendMessage() {
ChatMessage cm = new ChatMessage(o: 1, d: ctrlrCompose.value.text);
//ChatMessage cm = new ChatMessage(o: 1, d: ctrlrCompose.value.text);
//todo: merge: Provider.of<FlwtchState>(context).cwtch.SendMessage(widget.profile.onion, widget.conversationHandle, jsonEncode(cm));
ctrlrCompose.clear();
}
@ -81,8 +81,8 @@ class _MessageViewState extends State<MessageView> {
onPressed: _sendMessage,
),
Row(children: <Widget>[
SizedBox(width: 45, child: ElevatedButton(child: Icon(Icons.emoji_emotions_outlined, color: Opaque.current().mainTextColor()))),
SizedBox(width: 45, child: ElevatedButton(child: Icon(Icons.attach_file, color: Opaque.current().mainTextColor()))),
SizedBox(width: 45, child: ElevatedButton(child: Icon(Icons.emoji_emotions_outlined, color: Opaque.current().mainTextColor()), onPressed: placeHolder,)),
SizedBox(width: 45, child: ElevatedButton(child: Icon(Icons.attach_file, color: Opaque.current().mainTextColor()), onPressed: placeHolder,)),
])
]),
),
@ -90,4 +90,6 @@ class _MessageViewState extends State<MessageView> {
),
);
}
void placeHolder() => {};
}

View File

@ -1,12 +1,9 @@
import 'dart:convert';
import 'dart:io';
import 'package:flutter/services.dart';
import 'package:flutter_app/model.dart';
import 'package:flutter_app/widgets/buttontextfield.dart';
import 'package:flutter_app/widgets/cwtchlabel.dart';
import 'package:package_info_plus/package_info_plus.dart';
import 'package:flutter/material.dart';
import 'package:flutter_app/opaque.dart';
import 'package:flutter_app/settings.dart';
import 'package:provider/provider.dart';
import 'package:flutter_gen/gen_l10n/app_localizations.dart';

View File

@ -2,6 +2,8 @@
// Generated file. Do not edit.
//
// clang-format off
#include "generated_plugin_registrant.h"

View File

@ -2,6 +2,8 @@
// Generated file. Do not edit.
//
// clang-format off
#ifndef GENERATED_PLUGIN_REGISTRANT_
#define GENERATED_PLUGIN_REGISTRANT_