Skip to content
Merged

6.5.4 #1777

Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 12 additions & 12 deletions ios/Runner.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -488,11 +488,11 @@
buildSettings = {
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
CLANG_ENABLE_MODULES = YES;
CURRENT_PROJECT_VERSION = 138;
CURRENT_PROJECT_VERSION = 139;
DEVELOPMENT_TEAM = BX99T32YGS;
ENABLE_BITCODE = NO;
FLUTTER_BUILD_NAME = 6.5.3;
FLUTTER_BUILD_NUMBER = 138;
FLUTTER_BUILD_NAME = 6.5.4;
FLUTTER_BUILD_NUMBER = 139;
INFOPLIST_FILE = Runner/Info.plist;
INFOPLIST_KEY_CFBundleDisplayName = BULL;
INFOPLIST_KEY_LSApplicationCategoryType = "public.app-category.finance";
Expand All @@ -501,7 +501,7 @@
"$(inherited)",
"@executable_path/Frameworks",
);
MARKETING_VERSION = 6.5.3;
MARKETING_VERSION = 6.5.4;
PRODUCT_BUNDLE_IDENTIFIER = com.bullbitcoin.app;
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h";
Expand Down Expand Up @@ -679,11 +679,11 @@
buildSettings = {
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
CLANG_ENABLE_MODULES = YES;
CURRENT_PROJECT_VERSION = 138;
CURRENT_PROJECT_VERSION = 139;
DEVELOPMENT_TEAM = BX99T32YGS;
ENABLE_BITCODE = NO;
FLUTTER_BUILD_NAME = 6.5.3;
FLUTTER_BUILD_NUMBER = 138;
FLUTTER_BUILD_NAME = 6.5.4;
FLUTTER_BUILD_NUMBER = 139;
INFOPLIST_FILE = Runner/Info.plist;
INFOPLIST_KEY_CFBundleDisplayName = BULL;
INFOPLIST_KEY_LSApplicationCategoryType = "public.app-category.finance";
Expand All @@ -692,7 +692,7 @@
"$(inherited)",
"@executable_path/Frameworks",
);
MARKETING_VERSION = 6.5.3;
MARKETING_VERSION = 6.5.4;
PRODUCT_BUNDLE_IDENTIFIER = com.bullbitcoin.app;
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h";
Expand All @@ -708,11 +708,11 @@
buildSettings = {
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
CLANG_ENABLE_MODULES = YES;
CURRENT_PROJECT_VERSION = 138;
CURRENT_PROJECT_VERSION = 139;
DEVELOPMENT_TEAM = BX99T32YGS;
ENABLE_BITCODE = NO;
FLUTTER_BUILD_NAME = 6.5.3;
FLUTTER_BUILD_NUMBER = 138;
FLUTTER_BUILD_NAME = 6.5.4;
FLUTTER_BUILD_NUMBER = 139;
INFOPLIST_FILE = Runner/Info.plist;
INFOPLIST_KEY_CFBundleDisplayName = BULL;
INFOPLIST_KEY_LSApplicationCategoryType = "public.app-category.finance";
Expand All @@ -721,7 +721,7 @@
"$(inherited)",
"@executable_path/Frameworks",
);
MARKETING_VERSION = 6.5.3;
MARKETING_VERSION = 6.5.4;
PRODUCT_BUNDLE_IDENTIFIER = com.bullbitcoin.app;
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h";
Expand Down
2 changes: 1 addition & 1 deletion lib/core/core_locator.dart
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,8 @@ class CoreLocator {
await MempoolLocator.registerDatasources(locator);
PayjoinLocator.registerDatasources(locator);
await RecoverbullLocator.registerDatasources(locator);
SeedLocator.registerDatasources(locator);
await StorageLocator.registerDatasources(locator);
SeedLocator.registerDatasources(locator);
await SwapsLocator.registerDatasources(locator);
await WalletLocator.registerDatasources(locator);
await SettingsLocator.registerDatasources(locator);
Expand Down
65 changes: 56 additions & 9 deletions lib/core/seed/data/datasources/seed_datasource.dart
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import 'package:bb_mobile/core/errors/bull_exception.dart';
import 'package:bb_mobile/core/seed/data/models/seed_model.dart';
import 'package:bb_mobile/core/storage/data/datasources/key_value_storage/key_value_storage_datasource.dart';
import 'package:bb_mobile/core/utils/constants.dart';
import 'package:bb_mobile/core/utils/logger.dart';
import 'package:flutter/foundation.dart';

class SeedDatasource {
Expand All @@ -20,18 +21,64 @@ class SeedDatasource {
}

Future<SeedModel> get(String fingerprint) async {
const maxRetries = 5;
const initialDelay = Duration(milliseconds: 300);
final key = composeSeedStorageKey(fingerprint);
final value = await _secureStorage.getValue(key);
if (value == null) {
throw SeedNotFoundException(
'Seed not found for fingerprint: $fingerprint',
);
}

final json = jsonDecode(value) as Map<String, dynamic>;
final seed = SeedModel.fromJson(json);
for (int attempt = 0; attempt < maxRetries; attempt++) {
try {
final value = await _secureStorage.getValue(key);
if (value != null) {
final json = jsonDecode(value) as Map<String, dynamic>;
final seed = SeedModel.fromJson(json);
if (attempt > 0) {
log.fine(
'Seed found for fingerprint $fingerprint on attempt ${attempt + 1}',
);
}
return seed;
}

if (attempt < maxRetries - 1) {
final delay = Duration(
milliseconds: initialDelay.inMilliseconds * (1 << attempt),
);
log.fine(
'Seed read returned null for fingerprint $fingerprint on attempt ${attempt + 1}, retrying in ${delay.inMilliseconds}ms',
);
await Future.delayed(delay);
continue;
}

throw SeedNotFoundException(
'Seed not found for fingerprint: $fingerprint',
);
} catch (e) {
if (e is SeedNotFoundException) {
rethrow;
}

if (attempt < maxRetries - 1) {
final delay = Duration(
milliseconds: initialDelay.inMilliseconds * (1 << attempt),
);
log.fine(
'Exception reading seed for fingerprint $fingerprint on attempt ${attempt + 1}: $e, retrying in ${delay.inMilliseconds}ms',
);
await Future.delayed(delay);
continue;
}

log.severe(
'Failed to read seed for fingerprint $fingerprint after $maxRetries attempts: $e',
);
throw SeedNotFoundException(
'Seed not found for fingerprint: $fingerprint',
);
}
}

return seed;
throw SeedNotFoundException('Seed not found for fingerprint: $fingerprint');
}

Future<bool> exists(String fingerprint) {
Expand Down
2 changes: 1 addition & 1 deletion pubspec.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name: bb_mobile
description: Bull Bitcoin Mobile Wallet
publish_to: "none"
version: 6.5.3+138
version: 6.5.4+139

environment:
sdk: ">=3.10.0 <4.0.0"
Expand Down
Loading