forked from cwtch.im/cwtch-ui
Merge pull request 'save profile.autostart on create' (#598) from saveAutostart into trunk
Reviewed-on: cwtch.im/cwtch-ui#598 Reviewed-by: Sarah Jamie Lewis <sarah@openprivacy.ca>
This commit is contained in:
commit
c8bdc56507
|
@ -1 +1 @@
|
|||
2022-12-07-17-51-v1.10.1
|
||||
2022-12-11-12-38-v1.10.1-2-g1e4221c
|
|
@ -1 +1 @@
|
|||
2022-12-07-22-53-v1.10.1
|
||||
2022-12-11-17-40-v1.10.1-2-g1e4221c
|
|
@ -358,7 +358,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") ?: ""
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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 {
|
||||
|
|
Loading…
Reference in New Issue