Skip to content

Commit

Permalink
Merge branch 'main' into build-docs
Browse files Browse the repository at this point in the history
  • Loading branch information
sethforprivacy authored Feb 13, 2025
2 parents 76e7b2e + f98dd7d commit 507b4b2
Show file tree
Hide file tree
Showing 75 changed files with 1,216 additions and 731 deletions.
13 changes: 9 additions & 4 deletions cw_monero/lib/api/wallet_manager.dart
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ void restoreWalletFromSeedSync(
required String passphrase,
required String seed,
int nettype = 0,
int restoreHeight = 0}) async {
int restoreHeight = 0}) {
txhistory = null;
final newWptr = monero.WalletManager_recoveryWallet(
wmPtr,
Expand All @@ -116,6 +116,11 @@ void restoreWalletFromSeedSync(

if (status != 0) {
final error = monero.Wallet_errorString(newWptr);
if (error.contains('word list failed verification')) {
throw WalletRestoreFromSeedException(
message: "Seed verification failed, please make sure you entered the correct seed with the correct words order",
);
}
throw WalletRestoreFromSeedException(message: error);
}
wptr = newWptr;
Expand Down Expand Up @@ -404,7 +409,7 @@ void _restoreFromSeed(Map<String, dynamic> args) {
final seed = args['seed'] as String;
final restoreHeight = args['restoreHeight'] as int;

restoreWalletFromSeedSync(
return restoreWalletFromSeedSync(
path: path, password: password, passphrase: passphrase, seed: seed, restoreHeight: restoreHeight);
}

Expand Down Expand Up @@ -472,13 +477,13 @@ Future<void> createWallet(
'nettype': nettype
});

Future<void> restoreFromSeed(
void restoreFromSeed(
{required String path,
required String password,
required String passphrase,
required String seed,
int nettype = 0,
int restoreHeight = 0}) async =>
int restoreHeight = 0}) =>
_restoreFromSeed({
'path': path,
'password': password,
Expand Down
15 changes: 11 additions & 4 deletions cw_monero/lib/monero_wallet_service.dart
Original file line number Diff line number Diff line change
Expand Up @@ -292,14 +292,21 @@ class MoneroWalletService extends WalletService<
Future<MoneroWallet> restoreFromSeed(
MoneroRestoreWalletFromSeedCredentials credentials,
{bool? isTestnet}) async {
// Restore from Polyseed
if (Polyseed.isValidSeed(credentials.mnemonic)) {
return restoreFromPolyseed(credentials);
if (credentials.mnemonic.split(" ").length == 16) {
// Restore from Polyseed
try {
if (Polyseed.isValidSeed(credentials.mnemonic)) {
return restoreFromPolyseed(credentials);
}
} catch (e) {
printV("Polyseed restore failed: $e");
rethrow;
}
}

try {
final path = await pathForWallet(name: credentials.name, type: getType());
await monero_wallet_manager.restoreFromSeed(
monero_wallet_manager.restoreFromSeed(
path: path,
password: credentials.password!,
passphrase: credentials.passphrase,
Expand Down
4 changes: 2 additions & 2 deletions cw_monero/pubspec.lock
Original file line number Diff line number Diff line change
Expand Up @@ -511,8 +511,8 @@ packages:
dependency: "direct main"
description:
path: "impls/monero.dart"
ref: "127c54599c612d7d3d226e4c016d5812e7a0966d"
resolved-ref: "127c54599c612d7d3d226e4c016d5812e7a0966d"
ref: "9d9b1f2f2373fc9a99c6556a93eea63fe343cf58"
resolved-ref: "9d9b1f2f2373fc9a99c6556a93eea63fe343cf58"
url: "https://github.com/mrcyjanek/monero_c"
source: git
version: "0.0.0"
Expand Down
2 changes: 1 addition & 1 deletion cw_monero/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ dependencies:
monero:
git:
url: https://github.com/mrcyjanek/monero_c
ref: 127c54599c612d7d3d226e4c016d5812e7a0966d
ref: 9d9b1f2f2373fc9a99c6556a93eea63fe343cf58
path: impls/monero.dart
mutex: ^3.1.0
ledger_flutter_plus: ^1.4.1
Expand Down
4 changes: 2 additions & 2 deletions cw_wownero/pubspec.lock
Original file line number Diff line number Diff line change
Expand Up @@ -471,8 +471,8 @@ packages:
dependency: "direct main"
description:
path: "impls/monero.dart"
ref: "127c54599c612d7d3d226e4c016d5812e7a0966d"
resolved-ref: "127c54599c612d7d3d226e4c016d5812e7a0966d"
ref: "9d9b1f2f2373fc9a99c6556a93eea63fe343cf58"
resolved-ref: "9d9b1f2f2373fc9a99c6556a93eea63fe343cf58"
url: "https://github.com/mrcyjanek/monero_c"
source: git
version: "0.0.0"
Expand Down
2 changes: 1 addition & 1 deletion cw_wownero/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ dependencies:
monero:
git:
url: https://github.com/mrcyjanek/monero_c
ref: 127c54599c612d7d3d226e4c016d5812e7a0966d # monero_c hash
ref: 9d9b1f2f2373fc9a99c6556a93eea63fe343cf58 # monero_c hash
path: impls/monero.dart
mutex: ^3.1.0

Expand Down
4 changes: 2 additions & 2 deletions cw_zano/pubspec.lock
Original file line number Diff line number Diff line change
Expand Up @@ -476,8 +476,8 @@ packages:
dependency: "direct main"
description:
path: "impls/monero.dart"
ref: "127c54599c612d7d3d226e4c016d5812e7a0966d"
resolved-ref: "127c54599c612d7d3d226e4c016d5812e7a0966d"
ref: "9d9b1f2f2373fc9a99c6556a93eea63fe343cf58"
resolved-ref: "9d9b1f2f2373fc9a99c6556a93eea63fe343cf58"
url: "https://github.com/mrcyjanek/monero_c"
source: git
version: "0.0.0"
Expand Down
2 changes: 1 addition & 1 deletion cw_zano/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ dependencies:
monero:
git:
url: https://github.com/mrcyjanek/monero_c
ref: 127c54599c612d7d3d226e4c016d5812e7a0966d # monero_c hash
ref: 9d9b1f2f2373fc9a99c6556a93eea63fe343cf58 # monero_c hash
path: impls/monero.dart
dev_dependencies:
flutter_test:
Expand Down
2 changes: 2 additions & 0 deletions lib/buy/moonpay/moonpay_provider.dart
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,8 @@ class MoonPayProvider extends BuyProvider {
return 'light';
case ThemeType.dark:
return 'dark';
case ThemeType.oled:
return 'dark';
}
}

Expand Down
4 changes: 3 additions & 1 deletion lib/entities/fiat_currency.dart
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,9 @@ class FiatCurrency extends EnumerableItem<String> with Serializable<String> impl
static List<FiatCurrency> get all => _all.values.toList();

static List<FiatCurrency> get currenciesAvailableToBuyWith =>
[aud, bgn, brl, cad, chf, clp, cop, czk, dkk, egp, eur, gbp, gtq, hkd, hrk, huf, idr, ils, inr, isk, jpy, krw, mad, mxn, myr, ngn, nok, nzd, php, pkr, pln, ron, sek, sgd, thb, twd, usd, vnd, zar, tur];
[amd, aud, bgn, brl, cad, chf, clp, cop, czk, dkk, egp, eur, gbp, gtq, hkd, hrk, huf, idr, ils, inr, isk, jpy, krw, mad, mxn, myr, ngn, nok, nzd, php, pkr, pln, ron, sek, sgd, thb, twd, usd, vnd, zar, tur,];

static const amd = FiatCurrency(symbol: 'AMD', countryCode: "arm", fullName: "Armenian Dram");
static const ars = FiatCurrency(symbol: 'ARS', countryCode: "arg", fullName: "Argentine Peso");
static const aud = FiatCurrency(symbol: 'AUD', countryCode: "aus", fullName: "Australian Dollar");
static const bdt = FiatCurrency(symbol: 'BDT', countryCode: "bgd", fullName: "Bangladeshi Taka");
Expand Down Expand Up @@ -63,6 +64,7 @@ class FiatCurrency extends EnumerableItem<String> with Serializable<String> impl
static const tur = FiatCurrency(symbol: 'TRY', countryCode: "tur", fullName: "Turkish Lira");

static final _all = {
FiatCurrency.amd.raw: FiatCurrency.amd,
FiatCurrency.ars.raw: FiatCurrency.ars,
FiatCurrency.aud.raw: FiatCurrency.aud,
FiatCurrency.bdt.raw: FiatCurrency.bdt,
Expand Down
14 changes: 7 additions & 7 deletions lib/entities/main_actions.dart
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ class MainActions {
static List<MainActions> all = [
showWalletsAction,
receiveAction,
exchangeAction,
swapAction,
sendAction,
tradeAction,
];
Expand All @@ -44,13 +44,13 @@ class MainActions {
},
);

static MainActions exchangeAction = MainActions._(
name: (context) => S.of(context).exchange,
static MainActions swapAction = MainActions._(
name: (context) => S.of(context).swap,
image: 'assets/images/transfer.png',
isEnabled: (viewModel) => viewModel.isEnabledExchangeAction,
canShow: (viewModel) => viewModel.hasExchangeAction,
isEnabled: (viewModel) => viewModel.isEnabledSwapAction,
canShow: (viewModel) => viewModel.hasSwapAction,
onTap: (BuildContext context, DashboardViewModel viewModel) async {
if (viewModel.isEnabledExchangeAction) {
if (viewModel.isEnabledSwapAction) {
await Navigator.of(context).pushNamed(Routes.exchange);
}
},
Expand All @@ -66,7 +66,7 @@ class MainActions {


static MainActions tradeAction = MainActions._(
name: (context) => '${S.of(context).buy}/${S.of(context).sell}',
name: (context) => S.of(context).exchange,
image: 'assets/images/buy_sell.png',
isEnabled: (viewModel) => viewModel.isEnabledTradeAction,
canShow: (viewModel) => viewModel.hasTradeAction,
Expand Down
2 changes: 1 addition & 1 deletion lib/main.dart
Original file line number Diff line number Diff line change
Expand Up @@ -284,7 +284,7 @@ class AppState extends State<App> with SingleTickerProviderStateMixin {
final statusBarColor = Colors.transparent;
final authenticationStore = getIt.get<AuthenticationStore>();
final initialRoute = authenticationStore.state == AuthenticationState.uninitialized
? Routes.disclaimer
? Routes.welcome
: Routes.login;
final currentTheme = settingsStore.currentTheme;
final statusBarBrightness =
Expand Down
45 changes: 27 additions & 18 deletions lib/src/screens/backup/backup_page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -26,12 +26,6 @@ class BackupPage extends BasePage {
@override
String get title => S.current.backup;

@override
Widget trailing(BuildContext context) => TrailButton(
caption: S.of(context).change_password,
onPressed: () => Navigator.of(context).pushNamed(Routes.editBackupPassword),
textColor: Palette.blueCraiola);

@override
Widget body(BuildContext context) {
return Stack(
Expand All @@ -53,7 +47,9 @@ class BackupPage extends BasePage {
builder: (_) => GestureDetector(
onTap: () {
ClipboardUtil.setSensitiveDataToClipboard(
ClipboardData(text: backupViewModelBase.backupPassword));
ClipboardData(
text: backupViewModelBase
.backupPassword));
showBar<void>(
context,
S.of(context).transaction_details_copied(
Expand All @@ -74,15 +70,25 @@ class BackupPage extends BasePage {
))
]))),
Positioned(
child: Observer(
builder: (_) => LoadingPrimaryButton(
isLoading: backupViewModelBase.state is IsExecutingState,
onPressed: () => onExportBackup(context),
text: S.of(context).export_backup,
color: Theme.of(context).primaryColor,
child: Column(children: [
PrimaryButton(
onPressed: () =>
Navigator.of(context).pushNamed(Routes.editBackupPassword),
text: S.of(context).change_password,
color: Theme.of(context).cardColor,
textColor: Colors.white,
),
),
SizedBox(height: 10),
Observer(
builder: (_) => LoadingPrimaryButton(
isLoading: backupViewModelBase.state is IsExecutingState,
onPressed: () => onExportBackup(context),
text: S.of(context).export_backup,
color: Theme.of(context).primaryColor,
textColor: Colors.white,
),
),
]),
bottom: 24,
left: 24,
right: 24,
Expand Down Expand Up @@ -130,7 +136,8 @@ class BackupPage extends BasePage {
rightButtonText: S.of(context).save_to_downloads,
leftButtonText: S.of(context).share,
actionRightButton: () async {
await backupViewModelBase.saveToDownload(backup.name, backup.content);
await backupViewModelBase.saveToDownload(
backup.name, backup.content);
Navigator.of(dialogContext).pop();
},
actionLeftButton: () async {
Expand All @@ -142,13 +149,15 @@ class BackupPage extends BasePage {

Future<void> share(BackupExportFile backup, BuildContext context) async {
final path = await backupViewModelBase.saveBackupFileLocally(backup);
await ShareUtil.shareFile(filePath: path, fileName: backup.name, context: context);
await ShareUtil.shareFile(
filePath: path, fileName: backup.name, context: context);
await backupViewModelBase.removeBackupFileLocally(backup);
}

Future<void> _saveFile(BackupExportFile backup) async {
String? outputFile = await FilePicker.platform
.saveFile(dialogTitle: 'Save Your File to desired location', fileName: backup.name);
String? outputFile = await FilePicker.platform.saveFile(
dialogTitle: 'Save Your File to desired location',
fileName: backup.name);

try {
File returnedFile = File(outputFile!);
Expand Down
37 changes: 28 additions & 9 deletions lib/src/screens/contact/contact_list_page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -110,10 +110,12 @@ class _ContactPageBodyState extends State<ContactPageBody> with SingleTickerProv
@override
Widget build(BuildContext context) {
return Padding(
padding: const EdgeInsets.only(left: 24),
padding: const EdgeInsets.only(),
child: Column(
children: [
Align(
Padding(
padding: const EdgeInsets.only(left: 24, right: 24, bottom: 8),
child: Align(
alignment: Alignment.centerLeft,
child: TabBar(
controller: _tabController,
Expand All @@ -135,7 +137,7 @@ class _ContactPageBodyState extends State<ContactPageBody> with SingleTickerProv
indicatorColor: Theme.of(context).appBarTheme.titleTextStyle!.color,
indicatorPadding: EdgeInsets.zero,
labelPadding: EdgeInsets.only(right: 24),
tabAlignment: TabAlignment.center,
tabAlignment: TabAlignment.start,
dividerColor: Colors.transparent,
padding: EdgeInsets.zero,
tabs: [
Expand All @@ -144,6 +146,7 @@ class _ContactPageBodyState extends State<ContactPageBody> with SingleTickerProv
],
),
),
),
Expanded(
child: TabBarView(
controller: _tabController,
Expand Down Expand Up @@ -173,7 +176,7 @@ class _ContactPageBodyState extends State<ContactPageBody> with SingleTickerProv
itemCount: groupedContacts.length * 2,
itemBuilder: (context, index) {
if (index.isOdd) {
return StandardListSeparator();
return StandardListSeparator(height: 0);
} else {
final groupIndex = index ~/ 2;
final groupName = groupedContacts.keys.elementAt(groupIndex);
Expand All @@ -188,7 +191,9 @@ class _ContactPageBodyState extends State<ContactPageBody> with SingleTickerProv
orElse: () => groupContacts[0],
);

return ExpansionTile(
return Padding(
padding: const EdgeInsets.only(left: 16, right: 16, top: 4, bottom: 4),
child: ExpansionTile(
title: Text(
groupName,
style: TextStyle(
Expand All @@ -198,11 +203,16 @@ class _ContactPageBodyState extends State<ContactPageBody> with SingleTickerProv
),
),
leading: _buildCurrencyIcon(activeContact),
tilePadding: EdgeInsets.zero,
tilePadding: const EdgeInsets.only(left: 16, right: 16),
childrenPadding: const EdgeInsets.only(left: 16),
expandedCrossAxisAlignment: CrossAxisAlignment.start,
expandedAlignment: Alignment.topLeft,
backgroundColor: Theme.of(context).cardColor,
collapsedBackgroundColor: Theme.of(context).cardColor,
collapsedShape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(10)),
shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(10)),
children: groupContacts.map((contact) => generateRaw(context, contact)).toList(),
),
);
}
}
Expand Down Expand Up @@ -234,7 +244,12 @@ class _ContactPageBodyState extends State<ContactPageBody> with SingleTickerProv
},
behavior: HitTestBehavior.opaque,
child: Container(
padding: const EdgeInsets.only(top: 16, bottom: 16, right: 24),
decoration: BoxDecoration(
borderRadius: BorderRadius.all(Radius.circular(10)),
color: Theme.of(context).cardColor,
),
margin: const EdgeInsets.only(top: 4, bottom: 4, left: 16, right: 16),
padding: const EdgeInsets.only(top: 16, bottom: 16, right: 16, left: 16),
child: Row(
mainAxisSize: MainAxisSize.min,
mainAxisAlignment: MainAxisAlignment.start,
Expand Down Expand Up @@ -375,7 +390,12 @@ class _ContactListBodyState extends State<ContactListBody> {
children: [
Container(
key: Key('${contact.name}'),
padding: const EdgeInsets.only(top: 16, bottom: 16, right: 24),
decoration: BoxDecoration(
borderRadius: BorderRadius.all(Radius.circular(8)),
color: Theme.of(context).cardColor,
),
margin: const EdgeInsets.only(top: 4, bottom: 4, left: 16, right: 16),
padding: const EdgeInsets.only(top: 16, bottom: 16, right: 16, left: 16),
child: Row(
mainAxisSize: MainAxisSize.min,
mainAxisAlignment: MainAxisAlignment.start,
Expand All @@ -396,7 +416,6 @@ class _ContactListBodyState extends State<ContactListBody> {
],
),
),
StandardListSeparator()
],
);
}
Expand Down
Loading

0 comments on commit 507b4b2

Please sign in to comment.