forked from cwtch.im/cwtch-ui
merge trunk
This commit is contained in:
commit
76c6a5f069
30
.drone.yml
30
.drone.yml
|
@ -24,7 +24,7 @@ steps:
|
||||||
- git checkout $DRONE_COMMIT
|
- git checkout $DRONE_COMMIT
|
||||||
|
|
||||||
- name: fetch
|
- name: fetch
|
||||||
image: cirrusci/flutter:dev
|
image: cirrusci/flutter:2.5.0-6.0.pre
|
||||||
volumes:
|
volumes:
|
||||||
- name: deps
|
- name: deps
|
||||||
path: /root/.pub-cache
|
path: /root/.pub-cache
|
||||||
|
@ -47,7 +47,7 @@ steps:
|
||||||
# #Todo: fix all the lint errors and add `-set_exit_status` above to enforce linting
|
# #Todo: fix all the lint errors and add `-set_exit_status` above to enforce linting
|
||||||
|
|
||||||
- name: build-linux
|
- name: build-linux
|
||||||
image: openpriv/flutter-desktop:linux-dev
|
image: openpriv/flutter-desktop:linux-fdev2.5rc
|
||||||
volumes:
|
volumes:
|
||||||
- name: deps
|
- name: deps
|
||||||
path: /root/.pub-cache
|
path: /root/.pub-cache
|
||||||
|
@ -61,7 +61,7 @@ steps:
|
||||||
- rm -r cwtch
|
- rm -r cwtch
|
||||||
|
|
||||||
- name: test-build-android
|
- name: test-build-android
|
||||||
image: cirrusci/flutter:dev
|
image: cirrusci/flutter:2.5.0-6.0.pre
|
||||||
when:
|
when:
|
||||||
event: pull_request
|
event: pull_request
|
||||||
volumes:
|
volumes:
|
||||||
|
@ -71,7 +71,7 @@ steps:
|
||||||
- flutter build apk --debug
|
- flutter build apk --debug
|
||||||
|
|
||||||
- name: build-android
|
- name: build-android
|
||||||
image: cirrusci/flutter:dev
|
image: cirrusci/flutter:2.5.0-6.0.pre
|
||||||
when:
|
when:
|
||||||
event: push
|
event: push
|
||||||
environment:
|
environment:
|
||||||
|
@ -95,7 +95,7 @@ steps:
|
||||||
#- cp build/app/outputs/flutter-apk/app-debug.apk deploy/android
|
#- cp build/app/outputs/flutter-apk/app-debug.apk deploy/android
|
||||||
|
|
||||||
- name: widget-tests
|
- name: widget-tests
|
||||||
image: cirrusci/flutter:dev
|
image: cirrusci/flutter:2.5.0-6.0.pre
|
||||||
volumes:
|
volumes:
|
||||||
- name: deps
|
- name: deps
|
||||||
path: /root/.pub-cache
|
path: /root/.pub-cache
|
||||||
|
@ -126,7 +126,7 @@ steps:
|
||||||
- mv ./../sha256s.txt .
|
- mv ./../sha256s.txt .
|
||||||
- cd ..
|
- cd ..
|
||||||
# TODO: do deployment once files actaully compile
|
# TODO: do deployment once files actaully compile
|
||||||
- scp -r -o StrictHostKeyChecking=no -i ~/id_rsa $DIR buildfiles@openprivacy.ca:/home/buildfiles/buildfiles/
|
- scp -r -o StrictHostKeyChecking=no -i ~/id_rsa $DIR buildfiles@build.openprivacy.ca:/home/buildfiles/buildfiles/
|
||||||
|
|
||||||
- name: notify-email
|
- name: notify-email
|
||||||
image: drillster/drone-email
|
image: drillster/drone-email
|
||||||
|
@ -175,7 +175,7 @@ clone:
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- name: clone
|
- name: clone
|
||||||
image: openpriv/flutter-desktop:windows-sdk30-fdev2.3rc
|
image: openpriv/flutter-desktop:windows-sdk30-fdev2.5rc
|
||||||
environment:
|
environment:
|
||||||
buildbot_key_b64:
|
buildbot_key_b64:
|
||||||
from_secret: buildbot_key_b64
|
from_secret: buildbot_key_b64
|
||||||
|
@ -193,16 +193,16 @@ steps:
|
||||||
- git checkout $Env:DRONE_COMMIT
|
- git checkout $Env:DRONE_COMMIT
|
||||||
|
|
||||||
- name: fetch
|
- name: fetch
|
||||||
image: openpriv/flutter-desktop:windows-sdk30-fdev2.3rc
|
image: openpriv/flutter-desktop:windows-sdk30-fdev2.5rc
|
||||||
commands:
|
commands:
|
||||||
- powershell -command "Invoke-WebRequest -Uri https://dist.torproject.org/torbrowser/10.5a17/tor-win64-0.4.6.5.zip -OutFile tor.zip"
|
- powershell -command "Invoke-WebRequest -Uri https://git.openprivacy.ca/openprivacy/buildfiles/raw/branch/master/tor/tor-win64-0.4.6.5.zip -OutFile tor.zip"
|
||||||
- powershell -command "if ((Get-FileHash tor.zip -Algorithm sha512).Hash -ne '7917561a7a063440a1ddfa9cb544ab9ffd09de84cea3dd66e3cc9cd349dd9f85b74a522ec390d7a974bc19b424c4d53af60e57bbc47e763d13cab6a203c4592f' ) { Write-Error 'tor.zip sha512sum mismatch' }"
|
- powershell -command "if ((Get-FileHash tor.zip -Algorithm sha512).Hash -ne '7917561a7a063440a1ddfa9cb544ab9ffd09de84cea3dd66e3cc9cd349dd9f85b74a522ec390d7a974bc19b424c4d53af60e57bbc47e763d13cab6a203c4592f' ) { Write-Error 'tor.zip sha512sum mismatch' }"
|
||||||
- git describe --tags --abbrev=1 > VERSION
|
- git describe --tags --abbrev=1 > VERSION
|
||||||
- powershell -command "Get-Date -Format 'yyyy-MM-dd-HH-mm'" > BUILDDATE
|
- powershell -command "Get-Date -Format 'yyyy-MM-dd-HH-mm'" > BUILDDATE
|
||||||
- .\fetch-libcwtch-go.ps1
|
- .\fetch-libcwtch-go.ps1
|
||||||
|
|
||||||
- name: build-windows
|
- name: build-windows
|
||||||
image: openpriv/flutter-desktop:windows-sdk30-fdev2.3rc
|
image: openpriv/flutter-desktop:windows-sdk30-fdev2.5rc
|
||||||
commands:
|
commands:
|
||||||
- flutter pub get
|
- flutter pub get
|
||||||
- $Env:version += type .\VERSION
|
- $Env:version += type .\VERSION
|
||||||
|
@ -213,9 +213,9 @@ steps:
|
||||||
# flutter hasn't worked out it's packaging of required dll's so we have to resort to this manual nonsense
|
# flutter hasn't worked out it's packaging of required dll's so we have to resort to this manual nonsense
|
||||||
# https://github.com/google/flutter-desktop-embedding/issues/587
|
# https://github.com/google/flutter-desktop-embedding/issues/587
|
||||||
# https://github.com/flutter/flutter/issues/53167
|
# https://github.com/flutter/flutter/issues/53167
|
||||||
- copy C:\BuildTools\VC\Redist\MSVC\14.29.30036\x64\Microsoft.VC142.CRT\vcruntime140.dll $Env:releasedir
|
- copy C:\BuildTools\VC\Redist\MSVC\14.29.30133\x64\Microsoft.VC142.CRT\vcruntime140.dll $Env:releasedir
|
||||||
- copy C:\BuildTools\VC\Redist\MSVC\14.29.30036\x64\Microsoft.VC142.CRT\vcruntime140_1.dll $Env:releasedir
|
- copy C:\BuildTools\VC\Redist\MSVC\14.29.30133\x64\Microsoft.VC142.CRT\vcruntime140_1.dll $Env:releasedir
|
||||||
- copy C:\BuildTools\VC\Redist\MSVC\14.29.30036\x64\Microsoft.VC142.CRT\msvcp140.dll $Env:releasedir
|
- copy C:\BuildTools\VC\Redist\MSVC\14.29.30133\x64\Microsoft.VC142.CRT\msvcp140.dll $Env:releasedir
|
||||||
- copy README.md $Env:releasedir\
|
- copy README.md $Env:releasedir\
|
||||||
- copy windows\*.bat $Env:releasedir\
|
- copy windows\*.bat $Env:releasedir\
|
||||||
- powershell -command "Expand-Archive -Path tor.zip -DestinationPath $Env:releasedir\Tor"
|
- powershell -command "Expand-Archive -Path tor.zip -DestinationPath $Env:releasedir\Tor"
|
||||||
|
@ -258,7 +258,7 @@ steps:
|
||||||
- move *.sha512 deploy\$Env:builddir
|
- move *.sha512 deploy\$Env:builddir
|
||||||
|
|
||||||
- name: deploy-windows
|
- name: deploy-windows
|
||||||
image: openpriv/flutter-desktop:windows-sdk30-fdev2.3rc
|
image: openpriv/flutter-desktop:windows-sdk30-fdev2.5rc
|
||||||
when:
|
when:
|
||||||
event: push
|
event: push
|
||||||
status: [ success ]
|
status: [ success ]
|
||||||
|
@ -268,7 +268,7 @@ steps:
|
||||||
commands:
|
commands:
|
||||||
- echo $Env:BUILDFILES_KEY > id_rsab64
|
- echo $Env:BUILDFILES_KEY > id_rsab64
|
||||||
- certutil -decode id_rsab64 id_rsa
|
- certutil -decode id_rsab64 id_rsa
|
||||||
- scp -r -o StrictHostKeyChecking=no -i id_rsa deploy\\* buildfiles@openprivacy.ca:/home/buildfiles/buildfiles/
|
- scp -r -o StrictHostKeyChecking=no -i id_rsa deploy\\* buildfiles@build.openprivacy.ca:/home/buildfiles/buildfiles/
|
||||||
|
|
||||||
trigger:
|
trigger:
|
||||||
repo: cwtch.im/cwtch-ui
|
repo: cwtch.im/cwtch-ui
|
||||||
|
|
|
@ -1 +1 @@
|
||||||
v1.1.0-2021-07-15-19-15
|
v1.1.1-16-g7376218-2021-08-25-16-54
|
||||||
|
|
|
@ -4,7 +4,6 @@ import 'dart:io';
|
||||||
import 'dart:isolate';
|
import 'dart:isolate';
|
||||||
import 'dart:io' show Platform;
|
import 'dart:io' show Platform;
|
||||||
import 'package:cwtch/cwtch/cwtchNotifier.dart';
|
import 'package:cwtch/cwtch/cwtchNotifier.dart';
|
||||||
import 'package:flutter/src/services/text_input.dart';
|
|
||||||
import 'package:path/path.dart' as path;
|
import 'package:path/path.dart' as path;
|
||||||
|
|
||||||
import 'package:ffi/ffi.dart';
|
import 'package:ffi/ffi.dart';
|
||||||
|
@ -22,6 +21,9 @@ typedef StartCwtchFn = int Function(Pointer<Utf8> dir, int len, Pointer<Utf8> to
|
||||||
typedef void_from_void_funtion = Void Function();
|
typedef void_from_void_funtion = Void Function();
|
||||||
typedef VoidFromVoidFunction = void Function();
|
typedef VoidFromVoidFunction = void Function();
|
||||||
|
|
||||||
|
typedef free_function = Void Function(Pointer<Utf8>);
|
||||||
|
typedef FreeFn = void Function(Pointer<Utf8>);
|
||||||
|
|
||||||
typedef void_from_string_string_function = Void Function(Pointer<Utf8>, Int32, Pointer<Utf8>, Int32);
|
typedef void_from_string_string_function = Void Function(Pointer<Utf8>, Int32, Pointer<Utf8>, Int32);
|
||||||
typedef VoidFromStringStringFn = void Function(Pointer<Utf8>, int, Pointer<Utf8>, int);
|
typedef VoidFromStringStringFn = void Function(Pointer<Utf8>, int, Pointer<Utf8>, int);
|
||||||
|
|
||||||
|
@ -34,25 +36,15 @@ typedef VoidFromStringStringStringStringFn = void Function(Pointer<Utf8>, int, P
|
||||||
typedef void_from_string_string_int_int_function = Void Function(Pointer<Utf8>, Int32, Pointer<Utf8>, Int32, Int64, Int64);
|
typedef void_from_string_string_int_int_function = Void Function(Pointer<Utf8>, Int32, Pointer<Utf8>, Int32, Int64, Int64);
|
||||||
typedef VoidFromStringStringIntIntFn = void Function(Pointer<Utf8>, int, Pointer<Utf8>, int, int, int);
|
typedef VoidFromStringStringIntIntFn = void Function(Pointer<Utf8>, int, Pointer<Utf8>, int, int, int);
|
||||||
|
|
||||||
typedef access_cwtch_eventbus_function = Void Function();
|
|
||||||
typedef NextEventFn = void Function();
|
|
||||||
|
|
||||||
typedef string_to_void_function = Void Function(Pointer<Utf8> str, Int32 length);
|
typedef string_to_void_function = Void Function(Pointer<Utf8> str, Int32 length);
|
||||||
typedef StringFn = void Function(Pointer<Utf8> dir, int);
|
typedef StringFn = void Function(Pointer<Utf8> dir, int);
|
||||||
|
|
||||||
typedef string_string_to_void_function = Void Function(Pointer<Utf8> str, Int32 length, Pointer<Utf8> str2, Int32 length2);
|
typedef string_string_to_void_function = Void Function(Pointer<Utf8> str, Int32 length, Pointer<Utf8> str2, Int32 length2);
|
||||||
typedef StringStringFn = void Function(Pointer<Utf8>, int, Pointer<Utf8>, int);
|
typedef StringStringFn = void Function(Pointer<Utf8>, int, Pointer<Utf8>, int);
|
||||||
|
|
||||||
typedef get_json_blob_void_function = Pointer<Utf8> Function();
|
|
||||||
typedef GetJsonBlobVoidFn = Pointer<Utf8> Function();
|
|
||||||
|
|
||||||
typedef get_json_blob_string_function = Pointer<Utf8> Function(Pointer<Utf8> str, Int32 length);
|
typedef get_json_blob_string_function = Pointer<Utf8> Function(Pointer<Utf8> str, Int32 length);
|
||||||
typedef GetJsonBlobStringFn = Pointer<Utf8> Function(Pointer<Utf8> str, int len);
|
typedef GetJsonBlobStringFn = Pointer<Utf8> Function(Pointer<Utf8> str, int len);
|
||||||
|
|
||||||
//func NumMessages(profile_ptr *C.char, profile_len C.int, handle_ptr *C.char, handle_len C.int) (n C.int) {
|
|
||||||
typedef get_int_from_str_str_function = Int32 Function(Pointer<Utf8>, Int32, Pointer<Utf8>, Int32);
|
|
||||||
typedef GetIntFromStrStrFn = int Function(Pointer<Utf8>, int, Pointer<Utf8>, int);
|
|
||||||
|
|
||||||
//func GetMessage(profile_ptr *C.char, profile_len C.int, handle_ptr *C.char, handle_len C.int, message_index C.int) *C.char {
|
//func GetMessage(profile_ptr *C.char, profile_len C.int, handle_ptr *C.char, handle_len C.int, message_index C.int) *C.char {
|
||||||
typedef get_json_blob_from_str_str_int_function = Pointer<Utf8> Function(Pointer<Utf8>, Int32, Pointer<Utf8>, Int32, Int32);
|
typedef get_json_blob_from_str_str_int_function = Pointer<Utf8> Function(Pointer<Utf8>, Int32, Pointer<Utf8>, Int32, Int32);
|
||||||
typedef GetJsonBlobFromStrStrIntFn = Pointer<Utf8> Function(Pointer<Utf8>, int, Pointer<Utf8>, int, int);
|
typedef GetJsonBlobFromStrStrIntFn = Pointer<Utf8> Function(Pointer<Utf8>, int, Pointer<Utf8>, int, int);
|
||||||
|
@ -138,9 +130,7 @@ class CwtchFfi implements Cwtch {
|
||||||
// Called on object being disposed to (presumably on app close) to close the isolate that's listening to libcwtch-go events
|
// Called on object being disposed to (presumably on app close) to close the isolate that's listening to libcwtch-go events
|
||||||
@override
|
@override
|
||||||
void dispose() {
|
void dispose() {
|
||||||
if (cwtchIsolate != null) {
|
cwtchIsolate.kill(priority: Isolate.immediate);
|
||||||
cwtchIsolate.kill(priority: Isolate.immediate);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Entry point for an isolate to listen to a stream of events pulled from libcwtch-go and return them on the sendPort
|
// Entry point for an isolate to listen to a stream of events pulled from libcwtch-go and return them on the sendPort
|
||||||
|
@ -165,9 +155,21 @@ class CwtchFfi implements Cwtch {
|
||||||
// ignore: non_constant_identifier_names
|
// ignore: non_constant_identifier_names
|
||||||
final GetAppbusEvent = getAppbusEventC.asFunction<AppbusEventsFn>();
|
final GetAppbusEvent = getAppbusEventC.asFunction<AppbusEventsFn>();
|
||||||
|
|
||||||
while (true) {
|
// Embedded Version of _UnsafeFreePointerAnyUseOfThisFunctionMustBeDoubleApproved
|
||||||
|
var free = library.lookup<NativeFunction<free_function>>("c_FreePointer");
|
||||||
|
final Free = free.asFunction<FreeFn>();
|
||||||
|
|
||||||
|
// ignore: non_constant_identifier_names
|
||||||
|
final GetAppBusEvent = () {
|
||||||
|
// ignore: non_constant_identifier_names
|
||||||
Pointer<Utf8> result = GetAppbusEvent();
|
Pointer<Utf8> result = GetAppbusEvent();
|
||||||
String event = result.toDartString();
|
String event = result.toDartString();
|
||||||
|
Free(result);
|
||||||
|
return event;
|
||||||
|
};
|
||||||
|
|
||||||
|
while (true) {
|
||||||
|
final event = GetAppBusEvent();
|
||||||
|
|
||||||
if (event.startsWith("{\"EventType\":\"Shutdown\"")) {
|
if (event.startsWith("{\"EventType\":\"Shutdown\"")) {
|
||||||
print("Shutting down isolate thread: $event");
|
print("Shutting down isolate thread: $event");
|
||||||
|
@ -184,6 +186,7 @@ class CwtchFfi implements Cwtch {
|
||||||
final SelectProfile = selectProfileC.asFunction<GetJsonBlobStringFn>();
|
final SelectProfile = selectProfileC.asFunction<GetJsonBlobStringFn>();
|
||||||
final ut8Onion = onion.toNativeUtf8();
|
final ut8Onion = onion.toNativeUtf8();
|
||||||
SelectProfile(ut8Onion, ut8Onion.length);
|
SelectProfile(ut8Onion, ut8Onion.length);
|
||||||
|
malloc.free(ut8Onion);
|
||||||
}
|
}
|
||||||
|
|
||||||
// ignore: non_constant_identifier_names
|
// ignore: non_constant_identifier_names
|
||||||
|
@ -194,6 +197,8 @@ class CwtchFfi implements Cwtch {
|
||||||
final utf8nick = nick.toNativeUtf8();
|
final utf8nick = nick.toNativeUtf8();
|
||||||
final ut8pass = pass.toNativeUtf8();
|
final ut8pass = pass.toNativeUtf8();
|
||||||
CreateProfile(utf8nick, utf8nick.length, ut8pass, ut8pass.length);
|
CreateProfile(utf8nick, utf8nick.length, ut8pass, ut8pass.length);
|
||||||
|
malloc.free(utf8nick);
|
||||||
|
malloc.free(ut8pass);
|
||||||
}
|
}
|
||||||
|
|
||||||
// ignore: non_constant_identifier_names
|
// ignore: non_constant_identifier_names
|
||||||
|
@ -203,6 +208,7 @@ class CwtchFfi implements Cwtch {
|
||||||
final LoadProfiles = loadProfileC.asFunction<StringFn>();
|
final LoadProfiles = loadProfileC.asFunction<StringFn>();
|
||||||
final ut8pass = pass.toNativeUtf8();
|
final ut8pass = pass.toNativeUtf8();
|
||||||
LoadProfiles(ut8pass, ut8pass.length);
|
LoadProfiles(ut8pass, ut8pass.length);
|
||||||
|
malloc.free(ut8pass);
|
||||||
}
|
}
|
||||||
|
|
||||||
// ignore: non_constant_identifier_names
|
// ignore: non_constant_identifier_names
|
||||||
|
@ -214,6 +220,9 @@ class CwtchFfi implements Cwtch {
|
||||||
final utf8handle = handle.toNativeUtf8();
|
final utf8handle = handle.toNativeUtf8();
|
||||||
Pointer<Utf8> jsonMessageBytes = GetMessage(utf8profile, utf8profile.length, utf8handle, utf8handle.length, index);
|
Pointer<Utf8> jsonMessageBytes = GetMessage(utf8profile, utf8profile.length, utf8handle, utf8handle.length, index);
|
||||||
String jsonMessage = jsonMessageBytes.toDartString();
|
String jsonMessage = jsonMessageBytes.toDartString();
|
||||||
|
_UnsafeFreePointerAnyUseOfThisFunctionMustBeDoubleApproved(jsonMessageBytes);
|
||||||
|
malloc.free(utf8profile);
|
||||||
|
malloc.free(utf8handle);
|
||||||
return jsonMessage;
|
return jsonMessage;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -226,6 +235,8 @@ class CwtchFfi implements Cwtch {
|
||||||
final utf8onion = onion.toNativeUtf8();
|
final utf8onion = onion.toNativeUtf8();
|
||||||
final utf8json = json.toNativeUtf8();
|
final utf8json = json.toNativeUtf8();
|
||||||
SendAppBusEvent(utf8onion, utf8onion.length, utf8json, utf8json.length);
|
SendAppBusEvent(utf8onion, utf8onion.length, utf8json, utf8json.length);
|
||||||
|
malloc.free(utf8onion);
|
||||||
|
malloc.free(utf8json);
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
|
@ -236,6 +247,7 @@ class CwtchFfi implements Cwtch {
|
||||||
final SendAppBusEvent = sendAppBusEvent.asFunction<StringFn>();
|
final SendAppBusEvent = sendAppBusEvent.asFunction<StringFn>();
|
||||||
final utf8json = json.toNativeUtf8();
|
final utf8json = json.toNativeUtf8();
|
||||||
SendAppBusEvent(utf8json, utf8json.length);
|
SendAppBusEvent(utf8json, utf8json.length);
|
||||||
|
malloc.free(utf8json);
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
|
@ -247,6 +259,8 @@ class CwtchFfi implements Cwtch {
|
||||||
final u1 = profileOnion.toNativeUtf8();
|
final u1 = profileOnion.toNativeUtf8();
|
||||||
final u2 = contactHandle.toNativeUtf8();
|
final u2 = contactHandle.toNativeUtf8();
|
||||||
AcceptContact(u1, u1.length, u2, u2.length);
|
AcceptContact(u1, u1.length, u2, u2.length);
|
||||||
|
malloc.free(u1);
|
||||||
|
malloc.free(u2);
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
|
@ -258,6 +272,8 @@ class CwtchFfi implements Cwtch {
|
||||||
final u1 = profileOnion.toNativeUtf8();
|
final u1 = profileOnion.toNativeUtf8();
|
||||||
final u2 = contactHandle.toNativeUtf8();
|
final u2 = contactHandle.toNativeUtf8();
|
||||||
BlockContact(u1, u1.length, u2, u2.length);
|
BlockContact(u1, u1.length, u2, u2.length);
|
||||||
|
malloc.free(u1);
|
||||||
|
malloc.free(u2);
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
|
@ -270,6 +286,9 @@ class CwtchFfi implements Cwtch {
|
||||||
final u2 = contactHandle.toNativeUtf8();
|
final u2 = contactHandle.toNativeUtf8();
|
||||||
final u3 = message.toNativeUtf8();
|
final u3 = message.toNativeUtf8();
|
||||||
SendMessage(u1, u1.length, u2, u2.length, u3, u3.length);
|
SendMessage(u1, u1.length, u2, u2.length, u3, u3.length);
|
||||||
|
malloc.free(u1);
|
||||||
|
malloc.free(u2);
|
||||||
|
malloc.free(u3);
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
|
@ -282,6 +301,9 @@ class CwtchFfi implements Cwtch {
|
||||||
final u2 = contactHandle.toNativeUtf8();
|
final u2 = contactHandle.toNativeUtf8();
|
||||||
final u3 = target.toNativeUtf8();
|
final u3 = target.toNativeUtf8();
|
||||||
SendInvitation(u1, u1.length, u2, u2.length, u3, u3.length);
|
SendInvitation(u1, u1.length, u2, u2.length, u3, u3.length);
|
||||||
|
malloc.free(u1);
|
||||||
|
malloc.free(u2);
|
||||||
|
malloc.free(u3);
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
|
@ -302,6 +324,8 @@ class CwtchFfi implements Cwtch {
|
||||||
final u1 = profileOnion.toNativeUtf8();
|
final u1 = profileOnion.toNativeUtf8();
|
||||||
final u2 = bundle.toNativeUtf8();
|
final u2 = bundle.toNativeUtf8();
|
||||||
ImportBundle(u1, u1.length, u2, u2.length);
|
ImportBundle(u1, u1.length, u2, u2.length);
|
||||||
|
malloc.free(u1);
|
||||||
|
malloc.free(u2);
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
|
@ -315,6 +339,10 @@ class CwtchFfi implements Cwtch {
|
||||||
final u3 = key.toNativeUtf8();
|
final u3 = key.toNativeUtf8();
|
||||||
final u4 = value.toNativeUtf8();
|
final u4 = value.toNativeUtf8();
|
||||||
SetGroupAttribute(u1, u1.length, u2, u2.length, u3, u3.length, u4, u4.length);
|
SetGroupAttribute(u1, u1.length, u2, u2.length, u3, u3.length, u4, u4.length);
|
||||||
|
malloc.free(u1);
|
||||||
|
malloc.free(u2);
|
||||||
|
malloc.free(u3);
|
||||||
|
malloc.free(u4);
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
|
@ -326,9 +354,12 @@ class CwtchFfi implements Cwtch {
|
||||||
final u1 = profileOnion.toNativeUtf8();
|
final u1 = profileOnion.toNativeUtf8();
|
||||||
final u2 = groupHandle.toNativeUtf8();
|
final u2 = groupHandle.toNativeUtf8();
|
||||||
RejectInvite(u1, u1.length, u2, u2.length);
|
RejectInvite(u1, u1.length, u2, u2.length);
|
||||||
|
malloc.free(u1);
|
||||||
|
malloc.free(u2);
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
|
// ignore: non_constant_identifier_names
|
||||||
void CreateGroup(String profileOnion, String server, String groupName) {
|
void CreateGroup(String profileOnion, String server, String groupName) {
|
||||||
var createGroup = library.lookup<NativeFunction<void_from_string_string_string_function>>("c_CreateGroup");
|
var createGroup = library.lookup<NativeFunction<void_from_string_string_string_function>>("c_CreateGroup");
|
||||||
// ignore: non_constant_identifier_names
|
// ignore: non_constant_identifier_names
|
||||||
|
@ -337,6 +368,10 @@ class CwtchFfi implements Cwtch {
|
||||||
final u2 = server.toNativeUtf8();
|
final u2 = server.toNativeUtf8();
|
||||||
final u3 = groupName.toNativeUtf8();
|
final u3 = groupName.toNativeUtf8();
|
||||||
CreateGroup(u1, u1.length, u2, u2.length, u3, u3.length);
|
CreateGroup(u1, u1.length, u2, u2.length, u3, u3.length);
|
||||||
|
|
||||||
|
malloc.free(u1);
|
||||||
|
malloc.free(u2);
|
||||||
|
malloc.free(u3);
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
|
@ -348,6 +383,8 @@ class CwtchFfi implements Cwtch {
|
||||||
final u1 = profileOnion.toNativeUtf8();
|
final u1 = profileOnion.toNativeUtf8();
|
||||||
final u2 = handle.toNativeUtf8();
|
final u2 = handle.toNativeUtf8();
|
||||||
LeaveConversation(u1, u1.length, u2, u2.length);
|
LeaveConversation(u1, u1.length, u2, u2.length);
|
||||||
|
malloc.free(u1);
|
||||||
|
malloc.free(u2);
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
|
@ -359,9 +396,12 @@ class CwtchFfi implements Cwtch {
|
||||||
final u1 = profileOnion.toNativeUtf8();
|
final u1 = profileOnion.toNativeUtf8();
|
||||||
final u2 = groupHandle.toNativeUtf8();
|
final u2 = groupHandle.toNativeUtf8();
|
||||||
LeaveGroup(u1, u1.length, u2, u2.length);
|
LeaveGroup(u1, u1.length, u2, u2.length);
|
||||||
|
malloc.free(u1);
|
||||||
|
malloc.free(u2);
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
|
// ignore: non_constant_identifier_names
|
||||||
void UpdateMessageFlags(String profile, String handle, int index, int flags) {
|
void UpdateMessageFlags(String profile, String handle, int index, int flags) {
|
||||||
var updateMessageFlagsC = library.lookup<NativeFunction<void_from_string_string_int_int_function>>("c_UpdateMessageFlags");
|
var updateMessageFlagsC = library.lookup<NativeFunction<void_from_string_string_int_int_function>>("c_UpdateMessageFlags");
|
||||||
// ignore: non_constant_identifier_names
|
// ignore: non_constant_identifier_names
|
||||||
|
@ -369,6 +409,8 @@ class CwtchFfi implements Cwtch {
|
||||||
final utf8profile = profile.toNativeUtf8();
|
final utf8profile = profile.toNativeUtf8();
|
||||||
final utf8handle = handle.toNativeUtf8();
|
final utf8handle = handle.toNativeUtf8();
|
||||||
updateMessageFlags(utf8profile, utf8profile.length, utf8handle, utf8handle.length, index, flags);
|
updateMessageFlags(utf8profile, utf8profile.length, utf8handle, utf8handle.length, index, flags);
|
||||||
|
malloc.free(utf8profile);
|
||||||
|
malloc.free(utf8handle);
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
|
@ -380,14 +422,18 @@ class CwtchFfi implements Cwtch {
|
||||||
final u1 = onion.toNativeUtf8();
|
final u1 = onion.toNativeUtf8();
|
||||||
final u2 = currentPassword.toNativeUtf8();
|
final u2 = currentPassword.toNativeUtf8();
|
||||||
DeleteProfile(u1, u1.length, u2, u2.length);
|
DeleteProfile(u1, u1.length, u2, u2.length);
|
||||||
|
malloc.free(u1);
|
||||||
|
malloc.free(u2);
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
|
// ignore: non_constant_identifier_names
|
||||||
Future<void> Shutdown() async {
|
Future<void> Shutdown() async {
|
||||||
var shutdown = library.lookup<NativeFunction<void_from_void_funtion>>("c_ShutdownCwtch");
|
var shutdown = library.lookup<NativeFunction<void_from_void_funtion>>("c_ShutdownCwtch");
|
||||||
// ignore: non_constant_identifier_names
|
// ignore: non_constant_identifier_names
|
||||||
|
|
||||||
// Shutdown Cwtch + Tor...
|
// Shutdown Cwtch + Tor...
|
||||||
|
// ignore: non_constant_identifier_names
|
||||||
final Shutdown = shutdown.asFunction<VoidFromVoidFunction>();
|
final Shutdown = shutdown.asFunction<VoidFromVoidFunction>();
|
||||||
Shutdown();
|
Shutdown();
|
||||||
|
|
||||||
|
@ -400,6 +446,7 @@ class CwtchFfi implements Cwtch {
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
|
// ignore: non_constant_identifier_names
|
||||||
Future GetMessageByContentHash(String profile, String handle, String contentHash) async {
|
Future GetMessageByContentHash(String profile, String handle, String contentHash) async {
|
||||||
var getMessagesByContentHashC = library.lookup<NativeFunction<get_json_blob_from_str_str_str_function>>("c_GetMessagesByContentHash");
|
var getMessagesByContentHashC = library.lookup<NativeFunction<get_json_blob_from_str_str_str_function>>("c_GetMessagesByContentHash");
|
||||||
// ignore: non_constant_identifier_names
|
// ignore: non_constant_identifier_names
|
||||||
|
@ -409,6 +456,20 @@ class CwtchFfi implements Cwtch {
|
||||||
final utf8contentHash = contentHash.toNativeUtf8();
|
final utf8contentHash = contentHash.toNativeUtf8();
|
||||||
Pointer<Utf8> jsonMessageBytes = GetMessagesByContentHash(utf8profile, utf8profile.length, utf8handle, utf8handle.length, utf8contentHash, utf8contentHash.length);
|
Pointer<Utf8> jsonMessageBytes = GetMessagesByContentHash(utf8profile, utf8profile.length, utf8handle, utf8handle.length, utf8contentHash, utf8contentHash.length);
|
||||||
String jsonMessage = jsonMessageBytes.toDartString();
|
String jsonMessage = jsonMessageBytes.toDartString();
|
||||||
|
|
||||||
|
_UnsafeFreePointerAnyUseOfThisFunctionMustBeDoubleApproved(jsonMessageBytes);
|
||||||
|
malloc.free(utf8profile);
|
||||||
|
malloc.free(utf8handle);
|
||||||
|
malloc.free(utf8contentHash);
|
||||||
return jsonMessage;
|
return jsonMessage;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// ignore: non_constant_identifier_names
|
||||||
|
// Incredibly dangerous function which invokes a free in libCwtch, should only be used
|
||||||
|
// as documented in `MEMORY.md` in libCwtch repo.
|
||||||
|
void _UnsafeFreePointerAnyUseOfThisFunctionMustBeDoubleApproved(Pointer<Utf8> ptr) {
|
||||||
|
var free = library.lookup<NativeFunction<free_function>>("c_FreePointer");
|
||||||
|
final Free = free.asFunction<FreeFn>();
|
||||||
|
Free(ptr);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -217,6 +217,7 @@ class _MessageViewState extends State<MessageView> {
|
||||||
autofocus: !Platform.isAndroid,
|
autofocus: !Platform.isAndroid,
|
||||||
textInputAction: TextInputAction.newline,
|
textInputAction: TextInputAction.newline,
|
||||||
keyboardType: TextInputType.multiline,
|
keyboardType: TextInputType.multiline,
|
||||||
|
enableIMEPersonalizedLearning: false,
|
||||||
minLines: 1,
|
minLines: 1,
|
||||||
maxLines: null,
|
maxLines: null,
|
||||||
onFieldSubmitted: _sendMessage,
|
onFieldSubmitted: _sendMessage,
|
||||||
|
|
|
@ -37,6 +37,7 @@ class _CwtchButtonTextFieldState extends State<CwtchButtonTextField> {
|
||||||
readOnly: widget.readonly,
|
readOnly: widget.readonly,
|
||||||
showCursor: !widget.readonly,
|
showCursor: !widget.readonly,
|
||||||
focusNode: _focusNode,
|
focusNode: _focusNode,
|
||||||
|
enableIMEPersonalizedLearning: false,
|
||||||
decoration: InputDecoration(
|
decoration: InputDecoration(
|
||||||
suffixIcon: IconButton(
|
suffixIcon: IconButton(
|
||||||
onPressed: widget.onPressed,
|
onPressed: widget.onPressed,
|
||||||
|
|
|
@ -1,3 +1,5 @@
|
||||||
|
import 'dart:io';
|
||||||
|
|
||||||
import 'package:cwtch/views/contactsview.dart';
|
import 'package:cwtch/views/contactsview.dart';
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:flutter/painting.dart';
|
import 'package:flutter/painting.dart';
|
||||||
|
@ -127,9 +129,9 @@ class _ContactRowState extends State<ContactRow> {
|
||||||
}
|
}
|
||||||
// If the last message was over a day ago, just state the date
|
// If the last message was over a day ago, just state the date
|
||||||
if (DateTime.now().difference(date).inDays > 1) {
|
if (DateTime.now().difference(date).inDays > 1) {
|
||||||
return DateFormat.yMd().format(date.toLocal());
|
return DateFormat.yMd(Platform.localeName).format(date.toLocal());
|
||||||
}
|
}
|
||||||
// Otherwise just state the time.
|
// Otherwise just state the time.
|
||||||
return DateFormat.Hm().format(date.toLocal());
|
return DateFormat.Hm(Platform.localeName).format(date.toLocal());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
import 'dart:convert';
|
import 'dart:convert';
|
||||||
|
import 'dart:io';
|
||||||
|
|
||||||
import 'package:cwtch/cwtch_icons_icons.dart';
|
import 'package:cwtch/cwtch_icons_icons.dart';
|
||||||
import 'package:cwtch/models/message.dart';
|
import 'package:cwtch/models/message.dart';
|
||||||
|
@ -39,7 +40,7 @@ class InvitationBubbleState extends State<InvitationBubble> {
|
||||||
var borderRadiousEh = 15.0;
|
var borderRadiousEh = 15.0;
|
||||||
var showGroupInvite = Provider.of<Settings>(context).isExperimentEnabled(TapirGroupsExperiment);
|
var showGroupInvite = Provider.of<Settings>(context).isExperimentEnabled(TapirGroupsExperiment);
|
||||||
rejected = Provider.of<MessageMetadata>(context).flags & 0x01 == 0x01;
|
rejected = Provider.of<MessageMetadata>(context).flags & 0x01 == 0x01;
|
||||||
var prettyDate = DateFormat.yMd().add_jm().format(Provider.of<MessageMetadata>(context).timestamp);
|
var prettyDate = DateFormat.yMd(Platform.localeName).add_jm().format(Provider.of<MessageMetadata>(context).timestamp);
|
||||||
|
|
||||||
// If the sender is not us, then we want to give them a nickname...
|
// If the sender is not us, then we want to give them a nickname...
|
||||||
var senderDisplayStr = "";
|
var senderDisplayStr = "";
|
||||||
|
|
|
@ -1,3 +1,5 @@
|
||||||
|
import 'dart:io';
|
||||||
|
|
||||||
import 'package:cwtch/models/message.dart';
|
import 'package:cwtch/models/message.dart';
|
||||||
import 'package:cwtch/widgets/malformedbubble.dart';
|
import 'package:cwtch/widgets/malformedbubble.dart';
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
|
@ -28,7 +30,7 @@ class MessageBubbleState extends State<MessageBubble> {
|
||||||
// var myKey = Provider.of<MessageState>(context).profileOnion + "::" + Provider.of<MessageState>(context).contactHandle + "::" + Provider.of<MessageState>(context).messageIndex.toString();
|
// var myKey = Provider.of<MessageState>(context).profileOnion + "::" + Provider.of<MessageState>(context).contactHandle + "::" + Provider.of<MessageState>(context).messageIndex.toString();
|
||||||
|
|
||||||
DateTime messageDate = Provider.of<MessageMetadata>(context).timestamp;
|
DateTime messageDate = Provider.of<MessageMetadata>(context).timestamp;
|
||||||
prettyDate = DateFormat.yMd().add_jm().format(messageDate.toLocal());
|
prettyDate = DateFormat.yMd(Platform.localeName).add_jm().format(messageDate.toLocal());
|
||||||
|
|
||||||
// If the sender is not us, then we want to give them a nickname...
|
// If the sender is not us, then we want to give them a nickname...
|
||||||
var senderDisplayStr = "";
|
var senderDisplayStr = "";
|
||||||
|
|
|
@ -37,6 +37,7 @@ class _CwtchTextFieldState extends State<CwtchPasswordField> {
|
||||||
controller: widget.controller,
|
controller: widget.controller,
|
||||||
validator: widget.validator,
|
validator: widget.validator,
|
||||||
obscureText: obscureText,
|
obscureText: obscureText,
|
||||||
|
enableIMEPersonalizedLearning: false,
|
||||||
autofillHints: widget.autoFillHints,
|
autofillHints: widget.autoFillHints,
|
||||||
autovalidateMode: AutovalidateMode.always,
|
autovalidateMode: AutovalidateMode.always,
|
||||||
onFieldSubmitted: widget.action,
|
onFieldSubmitted: widget.action,
|
||||||
|
|
|
@ -39,6 +39,7 @@ class _CwtchTextFieldState extends State<CwtchTextField> {
|
||||||
validator: widget.validator,
|
validator: widget.validator,
|
||||||
onChanged: widget.onChanged,
|
onChanged: widget.onChanged,
|
||||||
autofocus: widget.autofocus,
|
autofocus: widget.autofocus,
|
||||||
|
enableIMEPersonalizedLearning: false,
|
||||||
focusNode: _focusNode,
|
focusNode: _focusNode,
|
||||||
decoration: InputDecoration(
|
decoration: InputDecoration(
|
||||||
labelText: widget.labelText,
|
labelText: widget.labelText,
|
||||||
|
|
13
pubspec.lock
13
pubspec.lock
|
@ -21,7 +21,7 @@ packages:
|
||||||
name: async
|
name: async
|
||||||
url: "https://pub.dartlang.org"
|
url: "https://pub.dartlang.org"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "2.7.0"
|
version: "2.8.1"
|
||||||
boolean_selector:
|
boolean_selector:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
|
@ -181,7 +181,7 @@ packages:
|
||||||
name: meta
|
name: meta
|
||||||
url: "https://pub.dartlang.org"
|
url: "https://pub.dartlang.org"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "1.4.0"
|
version: "1.7.0"
|
||||||
msix:
|
msix:
|
||||||
dependency: "direct dev"
|
dependency: "direct dev"
|
||||||
description:
|
description:
|
||||||
|
@ -329,6 +329,13 @@ packages:
|
||||||
url: "https://pub.dartlang.org"
|
url: "https://pub.dartlang.org"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "5.0.0"
|
version: "5.0.0"
|
||||||
|
scrollable_positioned_list:
|
||||||
|
dependency: "direct main"
|
||||||
|
description:
|
||||||
|
name: scrollable_positioned_list
|
||||||
|
url: "https://pub.dartlang.org"
|
||||||
|
source: hosted
|
||||||
|
version: "0.2.0-nullsafety.0"
|
||||||
sky_engine:
|
sky_engine:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description: flutter
|
description: flutter
|
||||||
|
@ -375,7 +382,7 @@ packages:
|
||||||
name: test_api
|
name: test_api
|
||||||
url: "https://pub.dartlang.org"
|
url: "https://pub.dartlang.org"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "0.4.1"
|
version: "0.4.2"
|
||||||
typed_data:
|
typed_data:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
|
|
Loading…
Reference in New Issue