Browse Source

refactor account provider

pull/19/head
Sun 3 years ago
parent
commit
b4320b4e24
  1. 12
      lib/account.dart
  2. 2
      lib/apps/chat/add.dart
  3. 2
      lib/apps/chat/detail.dart
  4. 2
      lib/apps/dao/tmp/add.dart
  5. 4
      lib/apps/dao/tmp/detail.dart
  6. 3
      lib/apps/device/page.dart
  7. 2
      lib/apps/group/detail.dart
  8. 6
      lib/apps/wallet/page.dart
  9. 4
      lib/pages/account_generate.dart
  10. 4
      lib/pages/account_quick.dart
  11. 4
      lib/pages/account_restore.dart
  12. 93
      lib/pages/home.dart
  13. 2
      lib/pages/setting/profile.dart
  14. 112
      lib/provider.dart
  15. 5
      lib/rpc.dart
  16. 26
      lib/security.dart
  17. 113
      lib/utils/logined_cache.dart
  18. 2
      lib/widgets/transfer.dart

12
lib/account.dart

@ -127,16 +127,13 @@ class Account { @@ -127,16 +127,13 @@ class Account {
String pid = '';
String name = '';
Uint8List? avatar;
bool online = false;
bool hasNew = false;
String pin = '';
Account(String pid, String name, [String avatar = "", bool online = false]) {
Account(String pid, String name, [String avatar = "", String pin = ""]) {
this.pid = pid;
this.name = name;
this.updateAvatar(avatar);
this.online = online;
this.hasNew = false;
this.pin = pin;
}
String encodeAvatar() {
@ -155,14 +152,11 @@ class Account { @@ -155,14 +152,11 @@ class Account {
}
}
Avatar showAvatar({double width = 45.0, bool online = false, bool needOnline = true}) {
Avatar showAvatar({double width = 45.0}) {
return Avatar(
width: width,
name: this.name,
avatar: this.avatar,
online: needOnline,
onlineColor: this.online ? const Color(0xFF0EE50A) : const Color(0xFFEDEDED),
hasNew: this.hasNew,
);
}
}

2
lib/apps/chat/add.dart

@ -209,7 +209,7 @@ class _ChatAddState extends State<ChatAdd> { @@ -209,7 +209,7 @@ class _ChatAddState extends State<ChatAdd> {
this._coreScreen = _coreShow(color, lang);
}
final account = context.read<AccountProvider>().activedAccount;
final account = context.read<AccountProvider>().account;
final requestKeys = this._requests.keys.toList().reversed.toList();
return Scaffold(

2
lib/apps/chat/detail.dart

@ -107,7 +107,7 @@ class _ChatDetailState extends State<ChatDetail> { @@ -107,7 +107,7 @@ class _ChatDetailState extends State<ChatDetail> {
final accountProvider = context.watch<AccountProvider>();
final session = accountProvider.activedSession;
final meName = accountProvider.activedAccount.name;
final meName = accountProvider.account.name;
this._friend.online = session.isActive();
final recentMessageKeys = this._messages.keys.toList().reversed.toList();

2
lib/apps/dao/tmp/add.dart

@ -261,7 +261,7 @@ class _GroupAddPageState extends State<GroupAddPage> { @@ -261,7 +261,7 @@ class _GroupAddPageState extends State<GroupAddPage> {
rpc.send('group-chat-request-list', [false]);
new Future.delayed(Duration.zero, () {
_myName = context.read<AccountProvider>().activedAccount.name;
_myName = context.read<AccountProvider>().account.name;
setState(() {});
});
}

4
lib/apps/dao/tmp/detail.dart

@ -175,7 +175,7 @@ class _GroupChatDetailState extends State<GroupChatDetail> { @@ -175,7 +175,7 @@ class _GroupChatDetailState extends State<GroupChatDetail> {
final accountProvider = context.watch<AccountProvider>();
final session = accountProvider.activedSession;
//final meName = accountProvider.activedAccount.name;
//final meName = accountProvider.account.name;
final isOnline = session.isActive();
return Scaffold(
@ -631,7 +631,7 @@ class _MemberWidget extends StatelessWidget { @@ -631,7 +631,7 @@ class _MemberWidget extends StatelessWidget {
//final isLight = color.brightness == Brightness.light;
//final isDesktop = isDisplayDesktop(context);
final accountProvider = context.read<AccountProvider>();
final myId = accountProvider.activedAccountId;
final myId = accountProvider.id;
final isOnline = accountProvider.activedSession.isActive();
final provider = context.watch<GroupChatProvider>();

3
lib/apps/device/page.dart

@ -196,8 +196,7 @@ class _DevicesPageState extends State<DevicesPage> { @@ -196,8 +196,7 @@ class _DevicesPageState extends State<DevicesPage> {
_inputAddress(lang);
} else if (value == 1) {
// show qrcode.
final account = Provider.of<AccountProvider>(
context, listen: false).activedAccount;
final account = Provider.of<AccountProvider>(context, listen: false).account;
showShadowDialog(
context,
Icons.security_rounded,

2
lib/apps/group/detail.dart

@ -169,7 +169,7 @@ class _GroupChatDetailState extends State<GroupChatDetail> { @@ -169,7 +169,7 @@ class _GroupChatDetailState extends State<GroupChatDetail> {
final accountProvider = context.watch<AccountProvider>();
final session = accountProvider.activedSession;
final meName = accountProvider.activedAccount.name;
final meName = accountProvider.account.name;
final isOnline = session.isActive();
final recentMessageKeys = this._messages.keys.toList().reversed.toList();

6
lib/apps/wallet/page.dart

@ -200,7 +200,7 @@ class _WalletDetailState extends State<WalletDetail> with SingleTickerProviderSt @@ -200,7 +200,7 @@ class _WalletDetailState extends State<WalletDetail> with SingleTickerProviderSt
child: ElevatedButton(
style: ElevatedButton.styleFrom(onPrimary: color.surface),
onPressed: () {
final pin = context.read<AccountProvider>().activedAccount.pin;
final pin = context.read<AccountProvider>().pin;
rpc.send('wallet-generate', [ChainToken.ETH.toInt(), pin]);
},
child: Padding(
@ -659,7 +659,7 @@ class _ImportAccount extends StatelessWidget { @@ -659,7 +659,7 @@ class _ImportAccount extends StatelessWidget {
if (secret.length < 32) {
return;
}
final pin = context.read<AccountProvider>().activedAccount.pin;
final pin = context.read<AccountProvider>().pin;
rpc.send('wallet-import', [chain.toInt(), secret, pin]);
Navigator.pop(context);
}),
@ -1090,7 +1090,7 @@ class _TransferTokenState extends State<_TransferToken> { @@ -1090,7 +1090,7 @@ class _TransferTokenState extends State<_TransferToken> {
return;
}
final amount = restoreBalance(a, widget.token.decimal);
final pid = context.read<AccountProvider>().activedAccount.pid;
final pid = context.read<AccountProvider>().id;
showShadowDialog(
context,
Icons.security_rounded,

4
lib/pages/account_generate.dart

@ -105,9 +105,9 @@ class _AccountGeneratePageState extends State<AccountGeneratePage> { @@ -105,9 +105,9 @@ class _AccountGeneratePageState extends State<AccountGeneratePage> {
if (login.isOk) {
// save this User
final account = Account(pid, name, avatar);
final account = Account(pid, name, avatar, lock);
Provider.of<AccountProvider>(context, listen: false).addAccount(account, lock);
Provider.of<AccountProvider>(context, listen: false).init(account);
Provider.of<DeviceProvider>(context, listen: false).updateActived();
Navigator.push(context, MaterialPageRoute(builder: (_) => AccountDomainScreen(

4
lib/pages/account_quick.dart

@ -149,9 +149,9 @@ class _AccountQuickPageState extends State<AccountQuickPage> { @@ -149,9 +149,9 @@ class _AccountQuickPageState extends State<AccountQuickPage> {
if (login.isOk) {
// save this User
final account = Account(pid, name, avatar);
final account = Account(pid, name, avatar, lock);
Provider.of<AccountProvider>(context, listen: false).addAccount(account, lock);
Provider.of<AccountProvider>(context, listen: false).init(account);
Provider.of<DeviceProvider>(context, listen: false).updateActived();
Navigator.push(context, MaterialPageRoute(builder: (_) => AccountDomainScreen(

4
lib/pages/account_restore.dart

@ -314,9 +314,9 @@ class _AccountRestorePageState extends State<AccountRestorePage> { @@ -314,9 +314,9 @@ class _AccountRestorePageState extends State<AccountRestorePage> {
if (res.isOk) {
// save this User
final account = Account(res.params[0], this._name, lock);
final account = Account(res.params[0], this._name, "", lock);
Provider.of<AccountProvider>(context, listen: false).addAccount(account, lock);
Provider.of<AccountProvider>(context, listen: false).init(account);
Provider.of<DeviceProvider>(context, listen: false).updateActived();
Navigator.of(context).pushNamedAndRemoveUntil("/", (Route<dynamic> route) => false);

93
lib/pages/home.dart

@ -171,7 +171,7 @@ class _HomeListState extends State<HomeList> { @@ -171,7 +171,7 @@ class _HomeListState extends State<HomeList> {
UserInfo(
app: 'add-friend',
id: provider.id,
name: provider.activedAccount.name));
name: provider.account.name));
}
},
itemBuilder: (context) {
@ -302,59 +302,6 @@ class _HomeListState extends State<HomeList> { @@ -302,59 +302,6 @@ class _HomeListState extends State<HomeList> {
class DrawerWidget extends StatelessWidget {
const DrawerWidget({Key? key}) : super(key: key);
Widget _listAccount(context, Account account, Color color, lang) {
return InkWell(
onTap: account.online
? () {
Navigator.of(context).pop();
Provider.of<AccountProvider>(context, listen: false)
.updateActivedAccount(account.pid, account.pin);
Provider.of<DeviceProvider>(context, listen: false)
.updateActived();
}
: null,
child: Padding(
padding:
const EdgeInsets.symmetric(vertical: 5.0, horizontal: 10.0),
child: Row(children: [
account.showAvatar(online: account.online),
const SizedBox(width: 10.0),
Expanded(
child: Text(account.name,
maxLines: 1, overflow: TextOverflow.ellipsis),
),
const SizedBox(width: 10.0),
Transform.scale(
scale: 0.7,
child: CupertinoSwitch(
activeColor: color,
value: account.online,
onChanged: (value) {
if (value) {
showShadowDialog(
context,
Icons.security_rounded,
lang.verifyPin,
PinWords(
pid: account.pid,
callback: (key) async {
Navigator.of(context).pop();
Provider.of<AccountProvider>(context,
listen: false)
.onlineAccount(account.pid, key);
}),
0.0,
);
} else {
Provider.of<AccountProvider>(context, listen: false)
.offlineAccount(account.pid);
}
},
),
),
])));
}
_showPage(Widget widget, bool isDesktop, context) {
if (isDesktop) {
Provider.of<AccountProvider>(context, listen: false)
@ -371,16 +318,7 @@ class DrawerWidget extends StatelessWidget { @@ -371,16 +318,7 @@ class DrawerWidget extends StatelessWidget {
final isLight = color.brightness == Brightness.light;
final isDesktop = isDisplayDesktop(context);
final provider = context.watch<AccountProvider>();
final me = provider.activedAccount;
final accounts = provider.accounts;
List<Widget> accountsWidget = [];
accounts.forEach((pid, account) {
if (pid != me.pid) {
accountsWidget.add(_listAccount(context, account, color.primary, lang));
}
});
final me = context.watch<AccountProvider>().account;
return Drawer(
child: BackdropFilter(
@ -399,26 +337,17 @@ class DrawerWidget extends StatelessWidget { @@ -399,26 +337,17 @@ class DrawerWidget extends StatelessWidget {
padding: EdgeInsets.zero,
children: <Widget>[
Padding(
padding: const EdgeInsets.symmetric(vertical: 20.0),
padding: const EdgeInsets.only(top: 20.0),
child: Center(
child: me.showAvatar(width: 100.0, needOnline: false)),
child: me.showAvatar(width: 100.0)),
),
Theme(
data: Theme.of(context)
.copyWith(dividerColor: Colors.transparent),
child: ExpansionTile(
title: Container(
padding: const EdgeInsets.only(left: 25.0),
alignment: Alignment.center,
child: Text(
"${me.name}",
style: TextStyle(
fontWeight: FontWeight.bold, fontSize: 16.0),
)),
children: accountsWidget,
),
),
const SizedBox(height: 5.0),
Padding(
padding: const EdgeInsets.symmetric(vertical: 20.0),
child: Center(
child: Text(
"${me.name}",
style: TextStyle(fontWeight: FontWeight.bold, fontSize: 16.0),
))),
const Divider(height: 1.0, color: Color(0x40ADB0BB)),
ListTile(
leading: Icon(Icons.person, color: color.primary),

2
lib/pages/setting/profile.dart

@ -43,7 +43,7 @@ class _ProfileDetailState extends State<ProfileDetail> { @@ -43,7 +43,7 @@ class _ProfileDetailState extends State<ProfileDetail> {
Widget build(BuildContext context) {
final color = Theme.of(context).colorScheme;
final lang = AppLocalizations.of(context);
final account = context.watch<AccountProvider>().activedAccount;
final account = context.watch<AccountProvider>().account;
final noImage = account.avatar == null;
return Scaffold(

112
lib/provider.dart

@ -14,16 +14,14 @@ const DEFAULT_ONLINE_INIT = 8; @@ -14,16 +14,14 @@ const DEFAULT_ONLINE_INIT = 8;
const DEFAULT_ONLINE_DELAY = 5;
class AccountProvider extends ChangeNotifier {
Map<String, Account> accounts = {}; // account's pid and account.
String activedAccountId = ''; // actived account pid.
Account get activedAccount => this.accounts[activedAccountId]!;
Account account = Account('', '');
/// current user's did.
String get id => this.activedAccount.pid;
String get id => this.account.pid;
String get pin => this.account.pin;
bool systemAppFriendAddNew = false;
/// home sessions. sorded by last_time.
Map<int, Session> sessions = {};
List<int> topKeys = [];
@ -44,9 +42,6 @@ class AccountProvider extends ChangeNotifier { @@ -44,9 +42,6 @@ class AccountProvider extends ChangeNotifier {
}
AccountProvider() {
// rpc notice when account not actived.
rpc.addNotice(_accountNotice);
// rpc
rpc.addListener('account-update', _accountUpdate);
rpc.addListener('account-login', _accountLogin);
@ -63,111 +58,45 @@ class AccountProvider extends ChangeNotifier { @@ -63,111 +58,45 @@ class AccountProvider extends ChangeNotifier {
rpc.addListener('notice-menu', _noticeMenu, true);
}
/// when security load accounts from cache.
autoAccounts(String pid, String pin, Map<String, Account> accounts) {
Global.changePid(pid);
this.accounts = accounts;
this.activedAccountId = pid;
this.activedAccount.online = true;
this.activedAccount.pin = pin;
rpc.send('session-list', []);
initLogined(pid, this.accounts.values.toList());
this.coreShowWidget = DefaultCoreShow();
}
/// when security add account.
addAccount(Account account, String pin) {
init(Account account) {
Global.changePid(account.pid);
this.accounts[account.pid] = account;
this.activedAccountId = account.pid;
this.activedAccount.online = true;
this.activedAccount.pin = pin;
rpc.send('session-list', []);
updateLogined(account);
}
updateActivedAccount(String pid, String pin) {
Global.changePid(pid);
this.clearActivedAccount();
this.activedAccountId = pid;
this.activedAccount.online = true;
this.activedAccount.pin = pin;
this.activedAccount.hasNew = false;
this.account = account;
this.coreShowWidget = DefaultCoreShow();
// load sessions.
this.actived = 0;
this.sessions.clear();
this.orderKeys.clear();
rpc.send('session-list', []);
if (!this.activedAccount.online) {
this.activedAccount.online = true;
}
mainLogined(pid);
initLogined(account);
notifyListeners();
}
logout() {
this.actived = 0;
this.accounts.clear();
this.clearActivedAccount();
this.sessions.clear();
this.orderKeys.clear();
this.topKeys.clear();
rpc.send('account-logout', []);
this.account = Account('', '');
clearLogined();
}
onlineAccount(String pid, String pin) {
this.accounts[pid]!.online = true;
this.accounts[pid]!.pin = pin;
rpc.send('account-login', [pid, pin]);
notifyListeners();
}
offlineAccount(String pid) {
this.accounts[pid]!.online = false;
this.accounts[pid]!.pin = '';
if (pid == this.activedAccountId) {
this.clearActivedAccount();
}
rpc.send('account-offline', [pid]);
notifyListeners();
}
clearActivedAccount() {
this.topKeys.clear();
}
accountUpdate(String name, [Uint8List? avatar]) {
this.activedAccount.name = name;
this.account.name = name;
if (avatar != null && avatar.length > 0) {
this.activedAccount.avatar = avatar;
rpc.send('account-update', [name, this.activedAccount.encodeAvatar()]);
this.account.avatar = avatar;
rpc.send('account-update', [name, this.account.encodeAvatar()]);
} else {
rpc.send('account-update', [name, '']);
}
updateLogined(this.activedAccount);
initLogined(this.account);
notifyListeners();
}
accountPin(String pin) {
this.activedAccount.pin = pin;
this.account.pin = pin;
notifyListeners();
}
@ -233,13 +162,6 @@ class AccountProvider extends ChangeNotifier { @@ -233,13 +162,6 @@ class AccountProvider extends ChangeNotifier {
// nothing.
}
_accountNotice(String pid) {
if (this.accounts.containsKey(pid)) {
this.accounts[pid]!.hasNew = true;
notifyListeners();
}
}
_noticeMenu(List params) {
final st = SessionTypeExtension.fromInt(params[0]);
if (st == SessionType.Chat) {
@ -250,11 +172,13 @@ class AccountProvider extends ChangeNotifier { @@ -250,11 +172,13 @@ class AccountProvider extends ChangeNotifier {
_accountUpdate(List params) {
final pid = params[0];
this.accounts[pid]!.name = params[1];
if (params[2].length > 1) {
this.accounts[pid]!.updateAvatar(params[2]);
if (pid == this.account.pid) {
this.account.name = params[1];
if (params[2].length > 1) {
this.account.updateAvatar(params[2]);
}
notifyListeners();
}
notifyListeners();
}
_sessionList(List params) {

5
lib/rpc.dart

@ -59,7 +59,6 @@ class WebSocketsNotifications { @@ -59,7 +59,6 @@ class WebSocketsNotifications {
bool _closed = true;
Map<String, List> _listeners = new Map<String, List>();
Function? _notice;
bool isLinked() {
return !_closed;
@ -116,10 +115,6 @@ class WebSocketsNotifications { @@ -116,10 +115,6 @@ class WebSocketsNotifications {
}
}
addNotice(Function noticeCallback) {
_notice = noticeCallback;
}
addListener(String method, Function callback, [bool notice = false]) {
_listeners[method] = [callback, notice];
}

26
lib/security.dart

@ -165,8 +165,8 @@ class _SecurityPageState extends State<SecurityPage> { @@ -165,8 +165,8 @@ class _SecurityPageState extends State<SecurityPage> {
);
}
_handleLogined(String mainId, String mainPin, Map<String, Account> accounts) {
Provider.of<AccountProvider>(context, listen: false).autoAccounts(mainId, mainPin, accounts);
_handleLogined(Account account) {
Provider.of<AccountProvider>(context, listen: false).init(account);
Provider.of<DeviceProvider>(context, listen: false).updateActived();
Navigator.of(context).pushNamedAndRemoveUntil("/", (Route<dynamic> route) => false);
}
@ -178,17 +178,12 @@ class _SecurityPageState extends State<SecurityPage> { @@ -178,17 +178,12 @@ class _SecurityPageState extends State<SecurityPage> {
}
// check if has logined.
final loginedAccounts = await getLogined();
if (loginedAccounts.length != 0) {
final loginedAccount = await getLogined();
if (loginedAccount != null) {
print("INFO: START LOGINED USE CACHE");
final mainAccount = loginedAccounts[0];
Map<String, Account> accounts = {};
loginedAccounts.forEach((account) {
accounts[account.pid] = account;
});
final res = await httpPost('account-login', [mainAccount.pid, ""]);
final res = await httpPost('account-login', [loginedAccount.pid, ""]);
if (res.isOk) {
_handleLogined(mainAccount.pid, "", accounts);
_handleLogined(loginedAccount);
return;
} else {
showShadowDialog(
@ -196,10 +191,11 @@ class _SecurityPageState extends State<SecurityPage> { @@ -196,10 +191,11 @@ class _SecurityPageState extends State<SecurityPage> {
Icons.security_rounded,
"PIN",
PinWords(
pid: mainAccount.pid,
pid: loginedAccount.pid,
callback: (key) async {
Navigator.of(context).pop();
_handleLogined(mainAccount.pid, key, accounts);
loginedAccount.pin = key;
_handleLogined(loginedAccount);
return;
}),
0.0
@ -233,7 +229,9 @@ class _SecurityPageState extends State<SecurityPage> { @@ -233,7 +229,9 @@ class _SecurityPageState extends State<SecurityPage> {
setState(() { this._loading = true; });
final res = await httpPost('account-login', [this._selectedUserId, lock]);
if (res.isOk) {
_handleLogined(this._selectedUserId, lock, this._accounts);
Account account = this._accounts[this._selectedUserId]!;
account.pin = lock;
_handleLogined(account);
} else {
setState(() { this._loading = false; });
toast(context, res.error);

113
lib/utils/logined_cache.dart

@ -2,120 +2,37 @@ import 'package:shared_preferences/shared_preferences.dart'; @@ -2,120 +2,37 @@ import 'package:shared_preferences/shared_preferences.dart';
import 'package:esse/account.dart';
const LOGINED_CACHE_NAME = 'logined';
const LOGINED_CACHE_NAME = 'logined_account';
/// get all auto-logined account. first one is main.
Future<List<Account>> getLogined() async {
List<Account> accounts = [];
Future<Account?> getLogined() async {
SharedPreferences prefs = await SharedPreferences.getInstance();
final ids = prefs.getStringList(LOGINED_CACHE_NAME);
if (ids != null) {
ids.forEach((id) {
final fields = prefs.getStringList(id);
if (fields != null && fields.length == 5) {
accounts.add(Account(
fields[0], // pid
fields[1], // name
fields[2], // avatar
false,
));
} else {
prefs.remove(id);
}
});
final fields = prefs.getStringList(LOGINED_CACHE_NAME);
if (fields != null && fields.length == 4) {
return Account(
fields[0], // pid
fields[1], // name
fields[2], // avatar
fields[3], // pin
);
} else {
prefs.remove(LOGINED_CACHE_NAME);
}
return accounts;
}
initLogined(String pid, List<Account> accounts) async {
SharedPreferences prefs = await SharedPreferences.getInstance();
final ids = prefs.getStringList(LOGINED_CACHE_NAME);
if (ids != null) {
ids.forEach((id) {
prefs.remove(id);
});
}
List<String> newIds = [pid];
accounts.forEach((account) {
final List<String> fields = [
account.pid,
account.name,
account.encodeAvatar(),
];
if (account.pid != pid) {
newIds.add(account.pid);
}
prefs.setStringList(account.pid, fields);
});
prefs.setStringList(LOGINED_CACHE_NAME, newIds);
}
/// update auto-logined account.
updateLogined(Account account) async {
initLogined(Account account) async {
SharedPreferences prefs = await SharedPreferences.getInstance();
List<String>? ids = prefs.getStringList(LOGINED_CACHE_NAME);
if (ids == null) {
ids = [];
}
if (!ids.contains(account.pid)) {
ids.add(account.pid);
prefs.setStringList(LOGINED_CACHE_NAME, ids);
}
final List<String> fields = [
account.pid,
account.name,
account.encodeAvatar(),
account.pin,
];
prefs.setStringList(account.pid, fields);
}
/// change main logined account.
mainLogined(String pid) async {
SharedPreferences prefs = await SharedPreferences.getInstance();
List<String>? ids = prefs.getStringList(LOGINED_CACHE_NAME);
if (ids == null) {
ids = [];
}
ids.remove(pid);
ids.insert(0, pid);
prefs.setStringList(LOGINED_CACHE_NAME, ids);
}
/// remove auto-login accounts.
removeLogined(String pid) async {
SharedPreferences prefs = await SharedPreferences.getInstance();
prefs.remove(pid);
List<String>? ids = prefs.getStringList(LOGINED_CACHE_NAME);
if (ids == null) {
ids = [];
}
if (ids.contains(pid)) {
ids.remove(pid);
prefs.setStringList(LOGINED_CACHE_NAME, ids);
}
prefs.setStringList(LOGINED_CACHE_NAME, fields);
}
/// when logout clear all
clearLogined() async {
SharedPreferences prefs = await SharedPreferences.getInstance();
List<String>? ids = prefs.getStringList(LOGINED_CACHE_NAME);
if (ids == null) {
ids = [];
}
ids.forEach((id) {
prefs.remove(id);
});
prefs.remove(LOGINED_CACHE_NAME);
}

2
lib/widgets/transfer.dart

@ -353,7 +353,7 @@ class _TransferState extends State<Transfer> { @@ -353,7 +353,7 @@ class _TransferState extends State<Transfer> {
return;
}
final amount = restoreBalance(a, this._selectedToken.decimal);
final pid = context.read<AccountProvider>().activedAccount.pid;
final pid = context.read<AccountProvider>().id;
showShadowDialog(
context,
Icons.security_rounded,

Loading…
Cancel
Save