bump v0.0.8+0 dataVersion 4

This commit is contained in:
poka 2022-06-05 21:28:16 +02:00
parent c82700a45f
commit 5c49be4f12
8 changed files with 28 additions and 9 deletions

View File

@ -8,7 +8,7 @@ import 'package:logger/logger.dart';
import 'package:shared_preferences/shared_preferences.dart'; import 'package:shared_preferences/shared_preferences.dart';
// Version of box data // Version of box data
const int dataVersion = 3; const int dataVersion = 4;
// Files paths // Files paths
Directory? appPath; Directory? appPath;

View File

@ -19,14 +19,14 @@ class ChestData extends HiveObject {
File? imageFile; File? imageFile;
@HiveField(4) @HiveField(4)
bool? isCesium; int? memberWallet;
ChestData({ ChestData({
this.name, this.name,
this.defaultWallet, this.defaultWallet,
this.imageName, this.imageName,
this.imageFile, this.imageFile,
this.isCesium, this.memberWallet,
}); });
@override @override

View File

@ -21,7 +21,7 @@ class ChestDataAdapter extends TypeAdapter<ChestData> {
defaultWallet: fields[1] as int?, defaultWallet: fields[1] as int?,
imageName: fields[2] as String?, imageName: fields[2] as String?,
imageFile: fields[3] as File?, imageFile: fields[3] as File?,
isCesium: fields[4] as bool?, memberWallet: fields[4] as int?,
); );
} }
@ -38,7 +38,7 @@ class ChestDataAdapter extends TypeAdapter<ChestData> {
..writeByte(3) ..writeByte(3)
..write(obj.imageFile) ..write(obj.imageFile)
..writeByte(4) ..writeByte(4)
..write(obj.isCesium); ..write(obj.memberWallet);
} }
@override @override

View File

@ -71,7 +71,6 @@ class GenerateWalletsProvider with ChangeNotifier {
name: chestName, name: chestName,
defaultWallet: 0, defaultWallet: 0,
imageName: '${chestNumber % 8}.png', imageName: '${chestNumber % 8}.png',
isCesium: false,
); );
await chestBox.add(thisChest); await chestBox.add(thisChest);
int? chestKey = chestBox.keys.last; int? chestKey = chestBox.keys.last;

View File

@ -13,7 +13,7 @@ class MyWalletsProvider with ChangeNotifier {
int? pinLenght; int? pinLenght;
bool isNewDerivationLoading = false; bool isNewDerivationLoading = false;
int? getCurrentChest() { int getCurrentChest() {
if (configBox.get('currentChest') == null) { if (configBox.get('currentChest') == null) {
configBox.put('currentChest', 0); configBox.put('currentChest', 0);
} }

View File

@ -564,7 +564,27 @@ class SubstrateSdk with ChangeNotifier {
return await idtyStatus(address) == 'Validated'; return await idtyStatus(address) == 'Validated';
} }
Future<String> getMemberAddress() async {
// TODO: Continue digging memberAddress detection
String memberAddress = '';
walletBox.toMap().forEach((key, value) async {
final bool _isMember = await isMember(value.address!);
log.d(_isMember);
if (_isMember) {
final currentChestNumber = configBox.get('currentChest');
ChestData _newChestData = chestBox.get(currentChestNumber)!;
_newChestData.memberWallet = value.number;
await chestBox.put(currentChestNumber, _newChestData);
memberAddress = value.address!;
return;
}
});
log.d(memberAddress);
return memberAddress;
}
Future<Map<String, int>> certState(String from, String to) async { Future<Map<String, int>> certState(String from, String to) async {
// String from = await getMemberAddress();
if (from != to && await isMember(from)) { if (from != to && await isMember(from)) {
Map<String, int> _result = {}; Map<String, int> _result = {};
final _certData = await getCertData(from, to); final _certData = await getCertData(from, to);

View File

@ -33,7 +33,7 @@ class WalletOptions extends StatelessWidget {
log.d(_walletOptions.address.text); log.d(_walletOptions.address.text);
final int _currentChest = _myWalletProvider.getCurrentChest()!; final int _currentChest = _myWalletProvider.getCurrentChest();
// final currentWallet = _myWalletProvider.getDefaultWallet(); // final currentWallet = _myWalletProvider.getDefaultWallet();
// log.d(_walletOptions.getAddress(_currentChest, 3)); // log.d(_walletOptions.getAddress(_currentChest, 3));

View File

@ -5,7 +5,7 @@ description: Pay with G1.
# pub.dev using `pub publish`. This is preferred for private packages. # pub.dev using `pub publish`. This is preferred for private packages.
publish_to: 'none' # Remove this line if you wish to publish to pub.dev publish_to: 'none' # Remove this line if you wish to publish to pub.dev
version: 0.0.7+12 version: 0.0.8+0
environment: environment:
sdk: '>=2.12.0 <3.0.0' sdk: '>=2.12.0 <3.0.0'