-
Notifications
You must be signed in to change notification settings - Fork 41
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
19 changed files
with
1,666 additions
and
591 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
53 changes: 53 additions & 0 deletions
53
lib/app/mobile/controller/settings/mobile_sync_password_settings_controller.dart
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
import 'package:flutter/material.dart'; | ||
import 'package:oktoast/oktoast.dart'; | ||
import 'package:rich_clipboard/rich_clipboard.dart'; | ||
import 'package:wenznote/commons/mvc/controller.dart'; | ||
import 'package:wenznote/service/crypt/crypt_service.dart'; | ||
import 'package:wenznote/service/service_manager.dart'; | ||
|
||
class MobileSyncPasswordSettingsController extends ServiceManagerController { | ||
var pwdInput1Controller = TextEditingController(); | ||
var pwdInput2Controller = TextEditingController(); | ||
|
||
@override | ||
void onInitState(BuildContext context) { | ||
super.onInitState(context); | ||
|
||
fetchData(); | ||
} | ||
|
||
Future<void> fetchData() async {} | ||
|
||
@override | ||
void onDidUpdateWidget(BuildContext context, MvcController oldController) { | ||
super.onDidUpdateWidget(context, oldController); | ||
if (oldController is MobileSyncPasswordSettingsController) {} | ||
} | ||
|
||
bool get hasPwd => serviceManager.cryptService.hasPassword(); | ||
|
||
int? get pwdVersion => | ||
serviceManager.cryptService.getCurrentPassword()?.version; | ||
|
||
String? get pwd => serviceManager.cryptService.getCurrentPassword()?.password; | ||
|
||
String? get pwdSha256 => | ||
serviceManager.cryptService.getCurrentPassword()?.sha256; | ||
|
||
void copyPwd() { | ||
RichClipboard.setData(RichClipboardData( text: pwd??"")); | ||
showToast("复制成功!"); | ||
} | ||
|
||
String generateRandomPwd() { | ||
return serviceManager.cryptService.generateRandomPassword(); | ||
} | ||
|
||
String generatePwd(String password) { | ||
return serviceManager.cryptService.generatePassword(password); | ||
} | ||
|
||
Future<bool> changePwd(String pwd) async{ | ||
return serviceManager.cryptService.changeServerPassword(pwd); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.