mirror of
https://github.com/cypherstack/stack_wallet.git
synced 2024-11-17 17:57:40 +00:00
Merge pull request #321 from cypherstack/ui-fixes
Desktop exchange toggle color fix
This commit is contained in:
commit
c14da77d93
7 changed files with 71 additions and 17 deletions
|
@ -1 +1 @@
|
|||
Subproject commit c1b403ccf6f4fffc9f7c233038c3df40f997c2b3
|
||||
Subproject commit af88796d5e4988c03422320c3842af5cf6c049ef
|
|
@ -344,12 +344,12 @@ class _MaterialAppWithThemeState extends ConsumerState<MaterialAppWithTheme>
|
|||
case "oceanBreeze":
|
||||
colorTheme = OceanBreezeColors();
|
||||
break;
|
||||
case "light":
|
||||
colorTheme = LightColors();
|
||||
break;
|
||||
case "fruitSorbet":
|
||||
default:
|
||||
colorTheme = FruitSorbetColors();
|
||||
break;
|
||||
case "light":
|
||||
default:
|
||||
colorTheme = LightColors();
|
||||
}
|
||||
loadingCompleter = Completer();
|
||||
WidgetsBinding.instance.addObserver(this);
|
||||
|
|
|
@ -46,10 +46,15 @@ class _WalletTableState extends ConsumerState<WalletSummaryTable> {
|
|||
|
||||
VoidCallback? expandOverride;
|
||||
if (providers.length == 1) {
|
||||
expandOverride = () {
|
||||
Navigator.of(context).pushNamed(
|
||||
expandOverride = () async {
|
||||
final manager = ref.read(providers.first);
|
||||
if (manager.coin == Coin.monero ||
|
||||
manager.coin == Coin.wownero) {
|
||||
await manager.initializeExisting();
|
||||
}
|
||||
await Navigator.of(context).pushNamed(
|
||||
DesktopWalletView.routeName,
|
||||
arguments: ref.read(providers.first).walletId,
|
||||
arguments: manager.walletId,
|
||||
);
|
||||
};
|
||||
}
|
||||
|
|
|
@ -4,9 +4,12 @@ import 'package:stackwallet/hive/db.dart';
|
|||
import 'package:stackwallet/utilities/logger.dart';
|
||||
|
||||
const String _kKeyBlobKey = "swbKeyBlobKeyStringID";
|
||||
const String _kKeyBlobVersionKey = "swbKeyBlobVersionKeyStringID";
|
||||
|
||||
const int kLatestBlobVersion = 2;
|
||||
|
||||
String _getMessageFromException(Object exception) {
|
||||
if (exception is IncorrectPassphrase) {
|
||||
if (exception is IncorrectPassphraseOrVersion) {
|
||||
return exception.errMsg();
|
||||
}
|
||||
if (exception is BadDecryption) {
|
||||
|
@ -18,6 +21,9 @@ String _getMessageFromException(Object exception) {
|
|||
if (exception is EncodingError) {
|
||||
return exception.errMsg();
|
||||
}
|
||||
if (exception is VersionError) {
|
||||
return exception.errMsg();
|
||||
}
|
||||
|
||||
return exception.toString();
|
||||
}
|
||||
|
@ -41,7 +47,10 @@ class DPS {
|
|||
}
|
||||
|
||||
try {
|
||||
_handler = await StorageCryptoHandler.fromNewPassphrase(passphrase);
|
||||
_handler = await StorageCryptoHandler.fromNewPassphrase(
|
||||
passphrase,
|
||||
kLatestBlobVersion,
|
||||
);
|
||||
|
||||
final box = await Hive.openBox<String>(DB.boxNameDesktopData);
|
||||
await DB.instance.put<String>(
|
||||
|
@ -49,6 +58,7 @@ class DPS {
|
|||
key: _kKeyBlobKey,
|
||||
value: await _handler!.getKeyBlob(),
|
||||
);
|
||||
await _updateStoredKeyBlobVersion(kLatestBlobVersion);
|
||||
await box.close();
|
||||
} catch (e, s) {
|
||||
Logging.instance.log(
|
||||
|
@ -78,7 +88,24 @@ class DPS {
|
|||
}
|
||||
|
||||
try {
|
||||
_handler = await StorageCryptoHandler.fromExisting(passphrase, keyBlob);
|
||||
final blobVersion = await _getStoredKeyBlobVersion();
|
||||
_handler = await StorageCryptoHandler.fromExisting(
|
||||
passphrase,
|
||||
keyBlob,
|
||||
blobVersion,
|
||||
);
|
||||
if (blobVersion < kLatestBlobVersion) {
|
||||
// update blob
|
||||
await _handler!.resetPassphrase(passphrase, kLatestBlobVersion);
|
||||
final box = await Hive.openBox<String>(DB.boxNameDesktopData);
|
||||
await DB.instance.put<String>(
|
||||
boxName: DB.boxNameDesktopData,
|
||||
key: _kKeyBlobKey,
|
||||
value: await _handler!.getKeyBlob(),
|
||||
);
|
||||
await _updateStoredKeyBlobVersion(kLatestBlobVersion);
|
||||
await box.close();
|
||||
}
|
||||
} catch (e, s) {
|
||||
Logging.instance.log(
|
||||
"${_getMessageFromException(e)}\n$s",
|
||||
|
@ -102,7 +129,8 @@ class DPS {
|
|||
}
|
||||
|
||||
try {
|
||||
await StorageCryptoHandler.fromExisting(passphrase, keyBlob);
|
||||
final blobVersion = await _getStoredKeyBlobVersion();
|
||||
await StorageCryptoHandler.fromExisting(passphrase, keyBlob, blobVersion);
|
||||
// existing passphrase matches key blob
|
||||
return true;
|
||||
} catch (e, s) {
|
||||
|
@ -135,8 +163,10 @@ class DPS {
|
|||
return false;
|
||||
}
|
||||
|
||||
final blobVersion = await _getStoredKeyBlobVersion();
|
||||
|
||||
try {
|
||||
await _handler!.resetPassphrase(passphraseNew);
|
||||
await _handler!.resetPassphrase(passphraseNew, blobVersion);
|
||||
|
||||
final box = await Hive.openBox<String>(DB.boxNameDesktopData);
|
||||
await DB.instance.put<String>(
|
||||
|
@ -144,6 +174,7 @@ class DPS {
|
|||
key: _kKeyBlobKey,
|
||||
value: await _handler!.getKeyBlob(),
|
||||
);
|
||||
await _updateStoredKeyBlobVersion(blobVersion);
|
||||
await box.close();
|
||||
|
||||
// successfully updated passphrase
|
||||
|
@ -164,4 +195,22 @@ class DPS {
|
|||
);
|
||||
return keyBlob != null;
|
||||
}
|
||||
|
||||
Future<int> _getStoredKeyBlobVersion() async {
|
||||
final box = await Hive.openBox<String>(DB.boxNameDesktopData);
|
||||
final keyBlobVersionString = DB.instance.get<String>(
|
||||
boxName: DB.boxNameDesktopData,
|
||||
key: _kKeyBlobVersionKey,
|
||||
);
|
||||
await box.close();
|
||||
return int.tryParse(keyBlobVersionString ?? "1") ?? 1;
|
||||
}
|
||||
|
||||
Future<void> _updateStoredKeyBlobVersion(int version) async {
|
||||
await DB.instance.put<String>(
|
||||
boxName: DB.boxNameDesktopData,
|
||||
key: _kKeyBlobVersionKey,
|
||||
value: version.toString(),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -327,7 +327,7 @@ class FruitSorbetColors extends StackColorTheme {
|
|||
@override
|
||||
Color get rateTypeToggleDesktopColorOn => const Color(0xFFFFD8CE);
|
||||
@override
|
||||
Color get rateTypeToggleDesktopColorOff => buttonBackSecondary;
|
||||
Color get rateTypeToggleDesktopColorOff => popupBG;
|
||||
|
||||
@override
|
||||
BoxShadow get standardBoxShadow => BoxShadow(
|
||||
|
|
|
@ -1408,8 +1408,8 @@ packages:
|
|||
dependency: "direct main"
|
||||
description:
|
||||
path: "."
|
||||
ref: "6ada1204a4e0cf84d932b568e6150550478db69b"
|
||||
resolved-ref: "6ada1204a4e0cf84d932b568e6150550478db69b"
|
||||
ref: "93e2687bcc10fc7258c7dab038c363fc9ff8ba5d"
|
||||
resolved-ref: "93e2687bcc10fc7258c7dab038c363fc9ff8ba5d"
|
||||
url: "https://github.com/cypherstack/stack_wallet_backup.git"
|
||||
source: git
|
||||
version: "0.0.1"
|
||||
|
|
|
@ -54,7 +54,7 @@ dependencies:
|
|||
stack_wallet_backup:
|
||||
git:
|
||||
url: https://github.com/cypherstack/stack_wallet_backup.git
|
||||
ref: 6ada1204a4e0cf84d932b568e6150550478db69b
|
||||
ref: e4b08d2b8965a5ae49bd57f598fa9011dd0c25e9
|
||||
|
||||
bip47:
|
||||
git:
|
||||
|
|
Loading…
Reference in a new issue