Merge branch 'noDisable' into fixDeactivate
continuous-integration/drone/pr Build is running Details

This commit is contained in:
Dan Ballard 2022-12-14 16:16:01 -08:00
commit c2f46a0117
10 changed files with 23 additions and 21 deletions

View File

@ -47,7 +47,7 @@ steps:
# #Todo: fix all the lint errors and add `-set_exit_status` above to enforce linting
- name: build-linux
image: openpriv/flutter-desktop:linux-fstable-3.3.8
image: openpriv/flutter-desktop:linux-fstable-3.3.9
volumes:
- name: deps
path: /root/.pub-cache

View File

@ -1 +1 @@
2022-12-07-17-51-v1.10.1
2022-12-12-22-59-v1.10.1-3-g3d0a3a5

View File

@ -1 +1 @@
2022-12-07-22-53-v1.10.1
2022-12-12-22-59-v1.10.1-3-g3d0a3a5

View File

@ -68,7 +68,7 @@ class MainActivity: FlutterActivity() {
private val PROFILE_EXPORT_REQUEST_CODE = 236
private val REQUEST_DOZE_WHITELISTING_CODE:Int = 9
private var dlToProfile = ""
private var dlToHandle = ""
private var dlToHandle = 0
private var dlToFileKey = ""
private var exportFromPath = ""
@ -128,9 +128,10 @@ class MainActivity: FlutterActivity() {
if (requestCode == FILEPICKER_REQUEST_CODE) {
val filePath = intent!!.getData().toString();
val manifestPath = StringBuilder().append(this.applicationContext.cacheDir).append("/").append(this.dlToFileKey).toString();
Log.d("MainActivity:FILEPICKER_REQUEST_CODE", "DownloadableFileCreated");
handleCwtch(MethodCall("DownloadFile", mapOf(
"ProfileOnion" to this.dlToProfile,
"handle" to this.dlToHandle,
"conversation" to this.dlToHandle.toInt(),
"filepath" to filePath,
"manifestpath" to manifestPath,
"filekey" to this.dlToFileKey
@ -228,7 +229,7 @@ class MainActivity: FlutterActivity() {
var method = call.method
// todo change usage patern to match that in FlwtchWorker
// Unsafe for anything using int args, causes access time attempt to cast to string which will fail
val argmap: Map<String, String> = call.arguments as Map<String, String>
val argmap: Map<String, String> = call.arguments as Map<String,String>
// the frontend calls Start every time it fires up, but we don't want to *actually* call Cwtch.Start()
// in case the ForegroundService is still running. in both cases, however, we *do* want to re-register
@ -255,7 +256,7 @@ class MainActivity: FlutterActivity() {
}
"CreateDownloadableFile" -> {
this.dlToProfile = argmap["ProfileOnion"] ?: ""
this.dlToHandle = argmap["handle"] ?: ""
this.dlToHandle = call.argument("conversation")!!
val suggestedName = argmap["filename"] ?: "filename.ext"
this.dlToFileKey = argmap["filekey"] ?: ""
val intent = Intent(Intent.ACTION_CREATE_DOCUMENT).apply {
@ -358,7 +359,8 @@ class MainActivity: FlutterActivity() {
"CreateProfile" -> {
val nick: String = call.argument("nick") ?: ""
val pass: String = call.argument("pass") ?: ""
Cwtch.createProfile(nick, pass)
val autostart: Boolean = call.argument("autostart") ?: true
Cwtch.createProfile(nick, pass, autostart)
}
"LoadProfiles" -> {
val pass: String = call.argument("pass") ?: ""
@ -426,6 +428,7 @@ class MainActivity: FlutterActivity() {
}
"DownloadFile" -> {
Log.d("MainActivity.kt", "Cwtch Download File Called...")
val profile: String = call.argument("ProfileOnion") ?: ""
val conversation: Int = call.argument("conversation") ?: 0
val filepath: String = call.argument("filepath") ?: ""

View File

@ -11,7 +11,7 @@ abstract class Cwtch {
Future<void> ReconnectCwtchForeground();
// ignore: non_constant_identifier_names
void CreateProfile(String nick, String pass);
void CreateProfile(String nick, String pass, bool autostart);
// ignore: non_constant_identifier_names
void ActivatePeerEngine(String profile);

View File

@ -290,13 +290,13 @@ class CwtchFfi implements Cwtch {
}
// ignore: non_constant_identifier_names
void CreateProfile(String nick, String pass) {
var createProfileC = library.lookup<NativeFunction<void_from_string_string_function>>("c_CreateProfile");
void CreateProfile(String nick, String pass, bool autostart) {
var createProfileC = library.lookup<NativeFunction<void_from_string_string_byte_function>>("c_CreateProfile");
// ignore: non_constant_identifier_names
final CreateProfile = createProfileC.asFunction<VoidFromStringStringFn>();
final CreateProfile = createProfileC.asFunction<VoidFromStringStringByteFn>();
final utf8nick = nick.toNativeUtf8();
final ut8pass = pass.toNativeUtf8();
CreateProfile(utf8nick, utf8nick.length, ut8pass, ut8pass.length);
CreateProfile(utf8nick, utf8nick.length, ut8pass, ut8pass.length, autostart ? 1 : 0);
malloc.free(utf8nick);
malloc.free(ut8pass);
}

View File

@ -71,8 +71,8 @@ class CwtchGomobile implements Cwtch {
}
// ignore: non_constant_identifier_names
void CreateProfile(String nick, String pass) {
cwtchPlatform.invokeMethod("CreateProfile", {"nick": nick, "pass": pass});
void CreateProfile(String nick, String pass, bool autostart) {
cwtchPlatform.invokeMethod("CreateProfile", {"nick": nick, "pass": pass, "autostart": autostart});
}
// ignore: non_constant_identifier_names

View File

@ -172,7 +172,7 @@ class _AddEditProfileViewState extends State<AddEditProfileView> {
// Enabled
Visibility(
visible: Provider.of<ProfileInfoState>(context).onion.isNotEmpty,
visible: Provider.of<ProfileInfoState>(context).onion.isNotEmpty && !Provider.of<ProfileInfoState>(context).enabled,
child: SwitchListTile(
title: Text(AppLocalizations.of(context)!.profileEnabled, style: TextStyle(color: Provider.of<Settings>(context).current().mainTextColor)),
subtitle: Text(AppLocalizations.of(context)!.profileEnabledDescription),
@ -398,12 +398,11 @@ class _AddEditProfileViewState extends State<AddEditProfileView> {
// match (and are provided if the user has requested an encrypted profile).
if (_formKey.currentState!.validate()) {
if (Provider.of<ProfileInfoState>(context, listen: false).onion.isEmpty) {
// TODO: save autostart in create flow
if (usePassword == true) {
Provider.of<FlwtchState>(context, listen: false).cwtch.CreateProfile(ctrlrNick.value.text, ctrlrPass.value.text);
Provider.of<FlwtchState>(context, listen: false).cwtch.CreateProfile(ctrlrNick.value.text, ctrlrPass.value.text, Provider.of<ProfileInfoState>(context, listen: false).autostart);
Navigator.of(context).pop();
} else {
Provider.of<FlwtchState>(context, listen: false).cwtch.CreateProfile(ctrlrNick.value.text, DefaultPassword);
Provider.of<FlwtchState>(context, listen: false).cwtch.CreateProfile(ctrlrNick.value.text, DefaultPassword, Provider.of<ProfileInfoState>(context, listen: false).autostart);
Navigator.of(context).pop();
}
} else {

View File

@ -251,7 +251,7 @@ class FileBubbleState extends State<FileBubble> {
if (Platform.isAndroid) {
Provider.of<ProfileInfoState>(context, listen: false).downloadInit(widget.fileKey(), (widget.fileSize / 4096).ceil());
Provider.of<FlwtchState>(context, listen: false).cwtch.SetMessageAttribute(profileOnion, conversation, 0, idx, "file-downloaded", "true");
ContactInfoState? contact = Provider.of<ProfileInfoState>(context).contactList.findContact(Provider.of<MessageMetadata>(context).senderHandle);
ContactInfoState? contact = Provider.of<ProfileInfoState>(context, listen: false).contactList.findContact(Provider.of<MessageMetadata>(context, listen: false).senderHandle);
if (contact != null) {
Provider.of<FlwtchState>(context, listen: false).cwtch.CreateDownloadableFile(profileOnion, contact.identifier, widget.nameSuggestion, widget.fileKey());
}

View File

@ -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.9.0+35
version: 1.10.0+36
environment:
sdk: ">=2.15.0 <3.0.0"