Skip to content

Commit

Permalink
Merge pull request #11 from xelis-project/dev
Browse files Browse the repository at this point in the history
Prepare for release of version 0.0.7
  • Loading branch information
Ez3kiel-dev authored Dec 31, 2024
2 parents e094290 + bec65b5 commit 0ae672e
Show file tree
Hide file tree
Showing 110 changed files with 5,204 additions and 2,083 deletions.
12 changes: 6 additions & 6 deletions .github/workflows/build_android.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,20 +25,20 @@ jobs:
run: |
cargo install 'flutter_rust_bridge_codegen'
- name: Install dependencies
run: flutter pub get

- name: Generate bridge code
run: flutter_rust_bridge_codegen generate

- name: Generate Dart code
run: dart run build_runner build

- name: Install dependencies
run: flutter pub get
run: dart run build_runner build -d

- name: Build Android apk
run: flutter build apk --split-per-abi

- name: Archive artifacts
uses: actions/upload-artifact@v4
with:
name: android-build
path: build/app/outputs/apk/release/*.apk
name: android-build
path: build/app/outputs/apk/release/*.apk
12 changes: 6 additions & 6 deletions .github/workflows/build_linux.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,20 +31,20 @@ jobs:
run: |
cargo install 'flutter_rust_bridge_codegen'
- name: Install dependencies
run: flutter pub get

- name: Generate bridge code
run: flutter_rust_bridge_codegen generate

- name: Generate Dart code
run: dart run build_runner build

- name: Install dependencies
run: flutter pub get
run: dart run build_runner build -d

- name: Build Linux app
run: flutter build linux

- name: Archive artifacts
uses: actions/upload-artifact@v4
with:
name: genesix-linux
path: build/linux/x64/release/bundle
name: genesix-linux
path: build/linux/x64/release/bundle
12 changes: 6 additions & 6 deletions .github/workflows/build_macos.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,14 +25,14 @@ jobs:
run: |
cargo install 'flutter_rust_bridge_codegen'
- name: Install dependencies
run: flutter pub get

- name: Generate bridge code
run: flutter_rust_bridge_codegen generate

- name: Generate Dart code
run: dart run build_runner build

- name: Install dependencies
run: flutter pub get
run: dart run build_runner build -d

- name: Build MacOS app
run: flutter build macos
Expand All @@ -43,5 +43,5 @@ jobs:
- name: Archive artifacts
uses: actions/upload-artifact@v4
with:
name: genesix-macos
path: build/macos/Build/Products/Release/genesix.app
name: genesix-macos
path: build/macos/Build/Products/Release/genesix.app
8 changes: 4 additions & 4 deletions .github/workflows/build_windows.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,14 +25,14 @@ jobs:
run: |
cargo install 'flutter_rust_bridge_codegen'
- name: Install dependencies
run: flutter pub get

- name: Generate bridge code
run: flutter_rust_bridge_codegen generate

- name: Generate Dart code
run: dart run build_runner build

- name: Install dependencies
run: flutter pub get
run: dart run build_runner build -d

- name: Build Windows app
run: flutter build windows
Expand Down
12 changes: 9 additions & 3 deletions .github/workflows/dart_actions.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,14 +31,20 @@ jobs:
run: |
cargo install 'flutter_rust_bridge_codegen'
- name: Install dependencies
run: flutter pub get

- name: Generate bridge code
run: flutter_rust_bridge_codegen generate

- name: Generate Dart code
run: dart run build_runner build
run: dart run build_runner build -d

- name: Install dependencies
run: flutter pub get
- name: Generate Dart code
run: dart run build_runner build -d

- name: Generate bridge code
run: flutter_rust_bridge_codegen generate

- name: Check Dart code formatting
run: dart format --output=none --set-exit-if-changed .
Expand Down
2 changes: 1 addition & 1 deletion android/app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ if (flutterVersionName == null) {
android {
namespace "io.xelis.app.genesix"
compileSdkVersion flutter.compileSdkVersion
ndkVersion flutter.ndkVersion
ndkVersion "27.0.12077973"

compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
Expand Down
1 change: 1 addition & 0 deletions android/settings.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ pluginManagement {
plugins {
id "dev.flutter.flutter-plugin-loader" version "1.0.0"
id "com.android.application" version '8.7.0' apply false
id "org.jetbrains.kotlin.android" version "1.9.0" apply false
}

include ":app"
9 changes: 6 additions & 3 deletions justfile
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
update: install_rust_bridge_codegen rust_update gen_rust_bridge flutter_get lint
update: flutter_get install_rust_bridge_codegen rust_update gen_rust_bridge flutter_generate lint

init: install_rust_bridge_codegen gen_rust_bridge flutter_get
init: flutter_get install_rust_bridge_codegen gen_rust_bridge flutter_generate

gen: gen_rust_bridge flutter_get
gen: flutter_get gen_rust_bridge flutter_generate

watch_rust:
flutter_rust_bridge_codegen generate --watch
Expand All @@ -16,6 +16,9 @@ gen_rust_bridge:
flutter_get:
flutter pub get

flutter_generate:
dart run build_runner build -d

lint:
cd rust && cargo fmt
dart format .
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,11 @@
import 'dart:io';

import 'package:flutter/foundation.dart';
import 'package:flutter_rust_bridge/flutter_rust_bridge.dart';
import 'package:genesix/features/logger/logger.dart';
import 'package:genesix/features/settings/application/app_localizations_provider.dart';
import 'package:genesix/rust_bridge/api/table_generation.dart';
import 'package:genesix/shared/providers/snackbar_messenger_provider.dart';
import 'package:riverpod_annotation/riverpod_annotation.dart';
import 'package:genesix/features/authentication/application/wallets_state_provider.dart';
import 'package:genesix/features/router/route_utils.dart';
Expand All @@ -27,7 +31,9 @@ class Authentication extends _$Authentication {
String name,
String password, [
String? seed,
String? privateKey,
]) async {
final loc = ref.read(appLocalizationsProvider);
final precomputedTablesPath = await _getPrecomputedTablesPath();
final settings = ref.read(settingsProvider);
final walletPath = await getWalletPath(settings.network, name);
Expand All @@ -47,14 +53,34 @@ class Authentication extends _$Authentication {

// remove prefix for rust call because it's already appended
final dbName = walletPath.replaceFirst(localStorageDBPrefix, "");
if (seed != null) {
walletRepository = await NativeWalletRepository.recover(
dbName, password, settings.network,
seed: seed, precomputeTablesPath: precomputedTablesPath);
} else {
walletRepository = await NativeWalletRepository.create(
dbName, password, settings.network,
precomputeTablesPath: precomputedTablesPath);

try {
if (seed != null) {
walletRepository = await NativeWalletRepository.recoverFromSeed(
dbName, password, settings.network,
seed: seed, precomputeTablesPath: precomputedTablesPath);
} else if (privateKey != null) {
walletRepository = await NativeWalletRepository.recoverFromPrivateKey(
dbName, password, settings.network,
privateKey: privateKey);
} else {
walletRepository = await NativeWalletRepository.create(
dbName, password, settings.network,
precomputeTablesPath: precomputedTablesPath);
}
} on AnyhowException catch (e) {
talker.critical('Creating wallet failed: $e');
final xelisMessage = (e).message.split("\n")[0];
ref
.read(snackBarMessengerProvider.notifier)
.showError('${loc.error_when_creating_wallet}:\n$xelisMessage');
rethrow;
} catch (e) {
talker.critical('Creating wallet failed: $e');
ref
.read(snackBarMessengerProvider.notifier)
.showError(loc.error_when_creating_wallet);
rethrow;
}

ref
Expand Down Expand Up @@ -84,6 +110,7 @@ class Authentication extends _$Authentication {
}

Future<void> openWallet(String name, String password) async {
final loc = ref.read(appLocalizationsProvider);
final settings = ref.read(settingsProvider);
final precomputedTablesPath = await _getPrecomputedTablesPath();

Expand All @@ -104,7 +131,18 @@ class Authentication extends _$Authentication {
walletRepository = await NativeWalletRepository.open(
dbName, password, settings.network,
precomputeTablesPath: precomputedTablesPath);
} on AnyhowException catch (e) {
talker.critical('Opening wallet failed: $e');
final xelisMessage = (e).message.split("\n")[0];
ref
.read(snackBarMessengerProvider.notifier)
.showError('${loc.error_when_opening_wallet}:\n$xelisMessage');
rethrow;
} catch (e) {
talker.critical('Opening wallet failed: $e');
ref
.read(snackBarMessengerProvider.notifier)
.showError(loc.error_when_opening_wallet);
rethrow;
}

Expand All @@ -126,6 +164,7 @@ class Authentication extends _$Authentication {
// only used for desktop wallet import
Future<void> openImportedWallet(
String sourcePath, String walletName, String password) async {
final loc = ref.read(appLocalizationsProvider);
final precomputedTablesPath = await _getPrecomputedTablesPath();
final network = ref.read(settingsProvider).network;

Expand All @@ -137,7 +176,18 @@ class Authentication extends _$Authentication {
walletRepository = await NativeWalletRepository.open(
targetPath, password, network,
precomputeTablesPath: precomputedTablesPath);
} on AnyhowException catch (e) {
talker.critical('Opening wallet failed: $e');
final xelisMessage = (e).message.split("\n")[0];
ref
.read(snackBarMessengerProvider.notifier)
.showError('${loc.error_when_opening_wallet}:\n$xelisMessage');
rethrow;
} catch (e) {
talker.critical('Opening wallet failed: $e');
ref
.read(snackBarMessengerProvider.notifier)
.showError(loc.error_when_opening_wallet);
rethrow;
}

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
enum CreateWalletType {
newWallet,
fromPrivateKey,
fromSeed,
}
Original file line number Diff line number Diff line change
Expand Up @@ -39,19 +39,31 @@ class _AddWalletModalBottomSheetMenuState
)),
onTap: () {
context.pop();
context.push(AppScreen.createWallet.toPath);
context.push(AppScreen.createNewWallet.toPath);
},
),
ListTile(
title: Center(
child: Text(
loc.recover_from_mnemonic_phrase,
loc.recover_from_recovery_phrase,
style: context.titleLarge,
textAlign: TextAlign.center,
)),
onTap: () {
context.pop();
context.push(AppScreen.recoverWallet.toPath);
context.push(AppScreen.recoverWalletFromSeed1.toPath);
},
),
ListTile(
title: Center(
child: Text(
loc.recover_from_private_key,
style: context.titleLarge,
textAlign: TextAlign.center,
)),
onTap: () {
context.pop();
context.push(AppScreen.recoverWalletFromPrivateKey.toPath);
},
),
if (isDesktopDevice)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import 'package:flutter/material.dart';
import 'package:flutter_riverpod/flutter_riverpod.dart';
import 'package:genesix/shared/theme/extensions.dart';

import 'package:genesix/features/settings/application/app_localizations_provider.dart';
import 'package:genesix/shared/theme/constants.dart';
import 'package:genesix/shared/widgets/components/generic_dialog.dart';

class SeedContentDialog extends ConsumerWidget {
const SeedContentDialog(this.seed, {super.key});
Expand All @@ -13,8 +13,7 @@ class SeedContentDialog extends ConsumerWidget {
@override
Widget build(BuildContext context, WidgetRef ref) {
final loc = ref.watch(appLocalizationsProvider);
return AlertDialog(
scrollable: true,
return GenericDialog(
content: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import 'package:genesix/features/settings/application/app_localizations_provider
import 'package:genesix/shared/providers/progress_report_provider.dart';
import 'package:genesix/shared/theme/constants.dart';
import 'package:genesix/shared/theme/extensions.dart';
import 'package:genesix/shared/widgets/components/generic_dialog.dart';

class TableGenerationProgressDialog extends ConsumerWidget {
const TableGenerationProgressDialog({super.key});
Expand All @@ -29,10 +30,7 @@ class TableGenerationProgressDialog extends ConsumerWidget {
displayStep = 'Loading';
}

return AlertDialog(
scrollable: true,
elevation: 10,
contentPadding: const EdgeInsets.all(Spaces.medium),
return GenericDialog(
content: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Expand Down
Loading

0 comments on commit 0ae672e

Please sign in to comment.