diff --git a/.github/workflows/syrius_builder.yml b/.github/workflows/syrius_builder.yml index 7ccf766f..6f554f42 100644 --- a/.github/workflows/syrius_builder.yml +++ b/.github/workflows/syrius_builder.yml @@ -103,6 +103,26 @@ jobs: needs: [build-macos, build-windows, build-linux] runs-on: ubuntu-latest steps: + - name: Checkout + uses: actions/checkout@v3 + - name: Set variables + run: | + SYRIUS="v$(cat pubspec.yaml | grep version | sed 's/version://' | xargs)" + echo "Syrius Version: $SYRIUS" + echo "SYRIUS_VERSION=$SYRIUS" >> $GITHUB_ENV + GOZENON=$(curl -s https://raw.githubusercontent.com/zenon-network/go-zenon/master/metadata/version.go | grep Version | awk -F '"' '{print $2}') + echo "Go-Zenon Version: $GOZENON" + BODY=$(cat <> ${GITHUB_ENV} + echo "${BODY}" >> ${GITHUB_ENV} + echo "EOFMARKER" >> ${GITHUB_ENV} - name: Prepare releases directory run: mkdir releases - name: Download macOS artifacts @@ -129,7 +149,8 @@ jobs: with: repo_token: ${{ secrets.GITHUB_TOKEN }} file: releases/* - tag: v0.0.6-alpha + release_name: ${{ env.SYRIUS_VERSION }} + tag: ${{ env.SYRIUS_VERSION }}-alphanet file_glob: true overwrite: true - body: "" + body: ${{ env.BODY }} diff --git a/LICENSE b/LICENSE index b3ec6657..5241c29c 100644 --- a/LICENSE +++ b/LICENSE @@ -1,6 +1,6 @@ The MIT License (MIT) -Copyright (c) 2021 The Zenon developers +Copyright (c) 2023 The Zenon developers Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal diff --git a/README.md b/README.md index 6b55241c..363679e9 100644 --- a/README.md +++ b/README.md @@ -29,6 +29,8 @@ Currently supported ``: `windows`, `macos`, `linux` git clone https://github.com/zenon-network/syrius.git flutter pub get flutter build +flutter build --release +flutter run --release ``` ## Contributing diff --git a/lib/blocs/swap/get_assets_bloc.dart b/lib/blocs/swap/get_assets_bloc.dart deleted file mode 100644 index 2504ea58..00000000 --- a/lib/blocs/swap/get_assets_bloc.dart +++ /dev/null @@ -1,47 +0,0 @@ -import 'dart:async'; - -import 'package:zenon_syrius_wallet_flutter/blocs/base_bloc.dart'; -import 'package:zenon_syrius_wallet_flutter/main.dart'; -import 'package:zenon_syrius_wallet_flutter/utils/address_utils.dart'; -import 'package:zenon_syrius_wallet_flutter/utils/global.dart'; -import 'package:zenon_syrius_wallet_flutter/utils/pair.dart'; -import 'package:znn_sdk_dart/znn_sdk_dart.dart'; -import 'package:znn_swap_utility/znn_swap_utility.dart'; - -class GetAssetsBloc - extends BaseBloc, List>?> { - Future getAssetAndSwapFileEntries( - List swapFileEntries, - ) async { - try { - addEvent(null); - List swapAssetEntries = []; - Iterable keyIds = swapFileEntries.map((e) => e.keyIdHashHex); - Map keyIdAssetsMap = - await zenon!.embedded.swap.getAssets(); - for (var key in keyIds) { - if (keyIdAssetsMap.containsKey(key)) { - keyIdAssetsMap[key]!.keyIdHash = Hash.parse(key); - swapAssetEntries.add(keyIdAssetsMap[key]!); - } - } - var filteredSwapFileEntries = swapFileEntries - .where((swapFileEntry) => swapAssetEntries - .map((e) => e.keyIdHash.toString()) - .toList() - .contains(swapFileEntry.keyIdHashHex)) - .toList(); - if (swapAssetEntries.length > kDefaultAddressList.length) { - int numOfAddressesNeeded = - swapAssetEntries.length - kDefaultAddressList.length; - await Future.forEach( - List.generate(numOfAddressesNeeded, (index) => null), - (element) async => await AddressUtils.generateNewAddress(), - ); - } - addEvent(Pair(swapAssetEntries, filteredSwapFileEntries)); - } catch (e) { - addError(e); - } - } -} diff --git a/lib/blocs/swap/read_wallet_bloc.dart b/lib/blocs/swap/read_wallet_bloc.dart deleted file mode 100644 index 6aa2307c..00000000 --- a/lib/blocs/swap/read_wallet_bloc.dart +++ /dev/null @@ -1,72 +0,0 @@ -import 'dart:async'; -import 'dart:io'; - -import 'package:path/path.dart' as path; -import 'package:zenon_syrius_wallet_flutter/blocs/base_bloc.dart'; -import 'package:zenon_syrius_wallet_flutter/utils/constants.dart'; -import 'package:zenon_syrius_wallet_flutter/utils/file_utils.dart'; -import 'package:znn_sdk_dart/znn_sdk_dart.dart'; -import 'package:znn_swap_utility/znn_swap_utility.dart' as znn_swap; - -class ReadWalletBloc extends BaseBloc?> { - Future readWallet(String walletDatPath, String walletPass) async { - try { - addEvent(null); - List swapFileEntries = - await znn_swap.readSwapFile( - await _getSwpFilePath(walletDatPath, walletPass), - ); - await swapFileEntries[0].canDecryptWithAsync(walletPass); - addEvent(swapFileEntries); - } catch (e) { - addError(e); - } - } - - Future _getSwpFilePath( - String walletDatPath, String walletPass) async { - String swapWalletDirectoryPath = path.join( - znnDefaultDirectory.path, - kSwapWalletTempDirectory, - ); - if (await Directory(swapWalletDirectoryPath).exists()) { - await FileUtils.deleteDirectory(swapWalletDirectoryPath); - } - String walletSwpFilePath = path.join( - swapWalletDirectoryPath, - kNameWalletFile, - ); - String walletSwapFilePathWithExtension = path.setExtension( - walletSwpFilePath, - '.swp', - ); - if (!(await File(walletSwapFilePathWithExtension).exists())) { - await _makeDatFileCopy(walletDatPath, swapWalletDirectoryPath); - String response = - await znn_swap.exportSwapFile(swapWalletDirectoryPath, walletPass); - if (response.isNotEmpty) { - throw response; - } - } - return walletSwapFilePathWithExtension; - } - - Future _makeDatFileCopy( - String walletDatPath, - String swapWalletDirectoryPath, - ) async { - String walletDatCopyName = kNameWalletFile; - String walletDatCopyPath = path.join( - swapWalletDirectoryPath, - walletDatCopyName, - ); - String walletDatPathWithExtension = path.setExtension( - walletDatCopyPath, - '.dat', - ); - if (!(await File(walletDatPathWithExtension).exists())) { - await File(walletDatPathWithExtension).create(recursive: true); - await File(walletDatPath).copy(walletDatPathWithExtension); - } - } -} diff --git a/lib/blocs/swap/transfer_balance_bloc.dart b/lib/blocs/swap/transfer_balance_bloc.dart deleted file mode 100644 index 423375cf..00000000 --- a/lib/blocs/swap/transfer_balance_bloc.dart +++ /dev/null @@ -1,47 +0,0 @@ -import 'dart:async'; - -import 'package:zenon_syrius_wallet_flutter/blocs/base_bloc.dart'; -import 'package:zenon_syrius_wallet_flutter/main.dart'; -import 'package:zenon_syrius_wallet_flutter/utils/account_block_utils.dart'; -import 'package:znn_sdk_dart/znn_sdk_dart.dart'; -import 'package:znn_swap_utility/znn_swap_utility.dart'; - -class TransferBalanceBloc extends BaseBloc { - Future transferBalanceToNewAddresses( - SwapFileEntry swapFileEntry, - Future futureBlockSigningKeyPair, - String passphrase, - ) async { - try { - addEvent(null); - KeyPair? blockSigningKeyPair = await futureBlockSigningKeyPair; - Address? alphaNetAddress = await blockSigningKeyPair!.address; - String signature = await swapFileEntry.signAssetsAsync( - passphrase, - alphaNetAddress!.toString(), - ); - AccountBlockTemplate transactionParams = - zenon!.embedded.swap.retrieveAssets( - swapFileEntry.pubKeyB64, - signature, - ); - AccountBlockUtils.createAccountBlock( - transactionParams, - 'transfer balance to new address', - blockSigningKey: blockSigningKeyPair, - waitForRequiredPlasma: true, - ).then( - (value) => addEvent(swapFileEntry), - onError: (error) { - addError(error); - }, - ).onError( - (error, stackTrace) { - addError(error.toString()); - }, - ); - } catch (e) { - addError(e); - } - } -} diff --git a/lib/main.dart b/lib/main.dart index bde6cc51..aa440442 100644 --- a/lib/main.dart +++ b/lib/main.dart @@ -109,13 +109,17 @@ main() async { } Future _setupTrayManager() async { - await trayManager.setTitle('s y r i u s'); + if (!Platform.isWindows) { + await trayManager.setTitle('s y r i u s'); + } await trayManager.setIcon( Platform.isWindows ? 'assets/images/tray_app_icon.ico' : 'assets/images/tray_app_icon.png', ); - await trayManager.setToolTip('s y r i u s'); + if (Platform.isMacOS) { + await trayManager.setToolTip('s y r i u s'); + } List items = [ MenuItem( key: 'show_wallet', diff --git a/lib/screens/swap/swap_import_screen.dart b/lib/screens/swap/swap_import_screen.dart deleted file mode 100644 index b5e13451..00000000 --- a/lib/screens/swap/swap_import_screen.dart +++ /dev/null @@ -1,93 +0,0 @@ -import 'package:flutter/material.dart'; -import 'package:zenon_syrius_wallet_flutter/screens/swap/swap_password_screen.dart'; -import 'package:zenon_syrius_wallet_flutter/utils/constants.dart'; -import 'package:zenon_syrius_wallet_flutter/utils/navigation_utils.dart'; -import 'package:zenon_syrius_wallet_flutter/widgets/reusable_widgets/buttons/onboarding_button.dart'; -import 'package:zenon_syrius_wallet_flutter/widgets/reusable_widgets/progress_bars.dart'; -import 'package:zenon_syrius_wallet_flutter/widgets/reusable_widgets/select_file_widget.dart'; - -class SwapImportScreen extends StatefulWidget { - const SwapImportScreen({Key? key}) : super(key: key); - - @override - _SwapImportScreenState createState() => _SwapImportScreenState(); -} - -class _SwapImportScreenState extends State { - String? _path; - - @override - Widget build(BuildContext context) { - return Scaffold( - body: Container( - padding: const EdgeInsets.symmetric( - vertical: 30.0, - ), - child: Column( - mainAxisAlignment: MainAxisAlignment.spaceBetween, - children: [ - const ProgressBar( - currentLevel: 2, - numLevels: 4, - ), - Text( - 'Swap wallet', - style: Theme.of(context).textTheme.headline1, - ), - Text( - 'Click browse to select your legacy \'wallet.dat\' file', - style: Theme.of(context).textTheme.headline4, - ), - _getUploadWalletFileContainer(), - Row( - mainAxisAlignment: MainAxisAlignment.center, - children: [ - _getPassiveButton(), - kSpacingBetweenActionButtons, - _getActionButton() - ], - ), - ], - ), - ), - ); - } - - Widget _getUploadWalletFileContainer() { - return Container( - margin: const EdgeInsets.symmetric( - horizontal: 20.0, - ), - child: SelectFileWidget( - fileExtension: 'dat', - onPathFoundCallback: (String path) { - setState(() { - _path = path; - }); - }), - ); - } - - Widget _getActionButton() { - return OnboardingButton( - onPressed: _path != null - ? () { - NavigationUtils.push( - context, - SwapPasswordScreen(_path!), - ); - } - : null, - text: 'Continue', - ); - } - - Widget _getPassiveButton() { - return OnboardingButton( - onPressed: () { - Navigator.pop(context); - }, - text: 'Go back', - ); - } -} diff --git a/lib/screens/swap/swap_info_screen.dart b/lib/screens/swap/swap_info_screen.dart deleted file mode 100644 index ce174478..00000000 --- a/lib/screens/swap/swap_info_screen.dart +++ /dev/null @@ -1,82 +0,0 @@ -import 'package:flutter/material.dart'; -import 'package:flutter_svg/svg.dart'; -import 'package:flutter_vector_icons/flutter_vector_icons.dart'; -import 'package:zenon_syrius_wallet_flutter/screens/swap/swap_import_screen.dart'; -import 'package:zenon_syrius_wallet_flutter/utils/app_colors.dart'; -import 'package:zenon_syrius_wallet_flutter/utils/navigation_utils.dart'; -import 'package:zenon_syrius_wallet_flutter/widgets/reusable_widgets/buttons/elevated_button.dart'; -import 'package:zenon_syrius_wallet_flutter/widgets/reusable_widgets/buttons/onboarding_button.dart'; -import 'package:zenon_syrius_wallet_flutter/widgets/reusable_widgets/progress_bars.dart'; - -class SwapInfoScreen extends StatelessWidget { - const SwapInfoScreen({Key? key}) : super(key: key); - - @override - Widget build(BuildContext context) { - return Scaffold( - body: Container( - padding: const EdgeInsets.symmetric( - vertical: 30.0, - ), - child: Column( - mainAxisAlignment: MainAxisAlignment.spaceBetween, - children: [ - const ProgressBar( - currentLevel: 1, - numLevels: 4, - ), - Text( - 'Swap wallet', - style: Theme.of(context).textTheme.headline1, - ), - SizedBox( - width: 500.0, - child: Text( - 'This procedure will swap your funds from the legacy network ' - 'to Alphanet - Network of Momentum Phase 0. Please make sure you ' - 'have wallet backups before proceeding', - style: Theme.of(context).textTheme.headline4, - textAlign: TextAlign.center, - ), - ), - const Icon( - MaterialCommunityIcons.swap_horizontal, - color: AppColors.znnColor, - size: 200.0, - ), - Row( - mainAxisAlignment: MainAxisAlignment.center, - children: [ - OnboardingButton( - text: 'Go back', - onPressed: () { - Navigator.pop(context); - }, - ), - const SizedBox( - width: 70.0, - ), - SizedBox( - width: 360.0, - child: SyriusElevatedButton( - onPressed: () { - NavigationUtils.push( - context, - const SwapImportScreen(), - ); - }, - text: 'Start Swap', - initialFillColor: AppColors.znnColor, - icon: SvgPicture.asset( - 'assets/svg/ic_swap_icon.svg', - ), - ), - ), - ], - ), - ], - ), - ), - ); - } -} diff --git a/lib/screens/swap/swap_password_screen.dart b/lib/screens/swap/swap_password_screen.dart deleted file mode 100644 index 3a9a0d6f..00000000 --- a/lib/screens/swap/swap_password_screen.dart +++ /dev/null @@ -1,166 +0,0 @@ -import 'package:flutter/material.dart'; -import 'package:stacked/stacked.dart'; -import 'package:zenon_syrius_wallet_flutter/blocs/swap/get_assets_bloc.dart'; -import 'package:zenon_syrius_wallet_flutter/blocs/swap/read_wallet_bloc.dart'; -import 'package:zenon_syrius_wallet_flutter/screens/swap/swap_transfer_balance_screen.dart'; -import 'package:zenon_syrius_wallet_flutter/utils/navigation_utils.dart'; -import 'package:zenon_syrius_wallet_flutter/widgets/reusable_widgets/buttons/loading_button.dart'; -import 'package:zenon_syrius_wallet_flutter/widgets/reusable_widgets/buttons/onboarding_button.dart'; -import 'package:zenon_syrius_wallet_flutter/widgets/reusable_widgets/input_field/password_input_field.dart'; -import 'package:zenon_syrius_wallet_flutter/widgets/reusable_widgets/progress_bars.dart'; - -class SwapPasswordScreen extends StatefulWidget { - final String path; - - const SwapPasswordScreen(this.path, {Key? key}) : super(key: key); - - @override - _SwapPasswordScreenState createState() => _SwapPasswordScreenState(); -} - -class _SwapPasswordScreenState extends State { - final TextEditingController _passwordController = TextEditingController(); - - final GlobalKey _loadingButtonKey = GlobalKey(); - - String? _errorText; - - late LoadingButton _loadingButton; - - @override - Widget build(BuildContext context) { - return Scaffold( - body: Container( - margin: const EdgeInsets.symmetric( - vertical: 30.0, - ), - child: Column( - mainAxisAlignment: MainAxisAlignment.spaceBetween, - children: [ - const ProgressBar( - currentLevel: 3, - numLevels: 4, - ), - Text( - 'Swap wallet', - style: Theme.of(context).textTheme.headline1, - ), - Text( - 'Please input the password for the \'.dat\' wallet file in ' - 'order to continue', - style: Theme.of(context).textTheme.headline4, - ), - Material( - color: Colors.transparent, - child: PasswordInputField( - onSubmitted: (value) { - if (_passwordController.text.isNotEmpty) { - _loadingButton.onPressed!(); - } else { - setState(() { - _errorText = 'Please insert a password'; - }); - } - }, - errorText: _errorText, - controller: _passwordController, - onChanged: (value) { - setState(() {}); - }, - hintText: 'Wallet password', - ), - ), - Row( - mainAxisAlignment: MainAxisAlignment.center, - children: [ - getPassiveButton(), - const SizedBox( - width: 70.0, - ), - _getReadWalletViewModel(), - ], - ), - ], - ), - ), - ); - } - - Widget getPassiveButton() { - return OnboardingButton( - onPressed: () { - Navigator.pop(context); - }, - text: 'Go back', - ); - } - - LoadingButton _getLoadingButton(ReadWalletBloc readWalletViewModel) { - return LoadingButton.onboarding( - key: _loadingButtonKey, - onPressed: _passwordController.text.isNotEmpty - ? () { - _loadingButtonKey.currentState!.animateForward(); - readWalletViewModel.readWallet( - widget.path, _passwordController.text); - } - : null, - text: 'Decrypt', - ); - } - - Widget _getReadWalletViewModel() { - return ViewModelBuilder.reactive( - onModelReady: (model) { - model.stream.listen( - (swapFileEntries) async { - if (swapFileEntries != null) { - var assetsModel = GetAssetsBloc(); - assetsModel.stream.listen( - (swapAssetsAndEntries) async { - if (swapAssetsAndEntries != null) { - _loadingButtonKey.currentState!.animateReverse(); - setState(() { - _errorText = null; - }); - NavigationUtils.push( - context, - SwapTransferBalanceScreen( - swapAssetsAndEntries, - _passwordController.text, - ), - ); - } - }, - onError: (error) { - _loadingButtonKey.currentState!.animateReverse(); - setState(() { - _errorText = error.toString(); - }); - }, - ); - await assetsModel.getAssetAndSwapFileEntries(swapFileEntries); - } - }, - onError: (error) { - _loadingButtonKey.currentState!.animateReverse(); - setState(() { - _errorText = error.toString(); - }); - }, - ); - }, - builder: (_, model, __) { - _loadingButton = _getLoadingButton(model); - return _loadingButton; - }, - viewModelBuilder: () => ReadWalletBloc(), - ); - } - - @override - void dispose() { - _passwordController.dispose(); - super.dispose(); - } -} diff --git a/lib/screens/swap/swap_transfer_balance_screen.dart b/lib/screens/swap/swap_transfer_balance_screen.dart deleted file mode 100644 index 382577b7..00000000 --- a/lib/screens/swap/swap_transfer_balance_screen.dart +++ /dev/null @@ -1,640 +0,0 @@ -import 'dart:io'; - -import 'package:flutter/material.dart'; -import 'package:flutter_vector_icons/flutter_vector_icons.dart'; -import 'package:path/path.dart' as path; -import 'package:zenon_syrius_wallet_flutter/blocs/notifications_bloc.dart'; -import 'package:zenon_syrius_wallet_flutter/blocs/swap/transfer_balance_bloc.dart'; -import 'package:zenon_syrius_wallet_flutter/main.dart'; -import 'package:zenon_syrius_wallet_flutter/model/database/notification_type.dart'; -import 'package:zenon_syrius_wallet_flutter/model/database/wallet_notification.dart'; -import 'package:zenon_syrius_wallet_flutter/utils/app_colors.dart'; -import 'package:zenon_syrius_wallet_flutter/utils/app_theme.dart'; -import 'package:zenon_syrius_wallet_flutter/utils/constants.dart'; -import 'package:zenon_syrius_wallet_flutter/utils/extensions.dart'; -import 'package:zenon_syrius_wallet_flutter/utils/file_utils.dart'; -import 'package:zenon_syrius_wallet_flutter/utils/global.dart'; -import 'package:zenon_syrius_wallet_flutter/utils/input_validators.dart'; -import 'package:zenon_syrius_wallet_flutter/utils/notification_utils.dart'; -import 'package:zenon_syrius_wallet_flutter/utils/pair.dart'; -import 'package:zenon_syrius_wallet_flutter/utils/zts_utils.dart'; -import 'package:zenon_syrius_wallet_flutter/widgets/main_app_container.dart'; -import 'package:zenon_syrius_wallet_flutter/widgets/reusable_widgets/buttons/onboarding_button.dart'; -import 'package:zenon_syrius_wallet_flutter/widgets/reusable_widgets/dropdown/addresses_dropdown.dart'; -import 'package:zenon_syrius_wallet_flutter/widgets/reusable_widgets/icons/copy_to_clipboard_icon.dart'; -import 'package:zenon_syrius_wallet_flutter/widgets/reusable_widgets/input_field/input_field.dart'; -import 'package:zenon_syrius_wallet_flutter/widgets/reusable_widgets/loading_widget.dart'; -import 'package:zenon_syrius_wallet_flutter/widgets/reusable_widgets/progress_bars.dart'; -import 'package:znn_sdk_dart/znn_sdk_dart.dart'; -import 'package:znn_swap_utility/znn_swap_utility.dart'; - -class SwapTransferBalanceScreen extends StatefulWidget { - final Pair, List> _swapAssetsAndEntries; - final String _passphrase; - - const SwapTransferBalanceScreen( - this._swapAssetsAndEntries, - this._passphrase, { - Key? key, - }) : super(key: key); - - @override - _SwapTransferBalanceScreenState createState() => - _SwapTransferBalanceScreenState(); -} - -class _SwapTransferBalanceScreenState extends State { - final List _currentAddressControllers = []; - final List _newAddressControllers = []; - final List _currentAddressNode = []; - final List _newAddressNode = []; - final List _swappedFileEntries = []; - - List? _newKeyPairs; - List? _assetsAfterSwap; - TransferBalanceBloc? _currentlyActiveModel; - - late List _assetsBeforeSwap; - late List _transferBalanceBlocs = []; - late List _selectedNewAddresses; - late List _newAddressErrorTexts; - - bool? _shouldPerformCleanup; - - @override - void initState() { - super.initState(); - _assetsBeforeSwap = widget._swapAssetsAndEntries.first; - if (_transferBalanceBlocs.isEmpty) { - _transferBalanceBlocs = List.generate( - widget._swapAssetsAndEntries.first.length, - (index) => TransferBalanceBloc(), - ); - } - _initNewAddresses(); - _initNewAddressErrorTexts(); - _initSelectedNewAddresses(); - _shouldPerformCleanup = - Directory(zenonDefaultLegacyDirectoryPath).existsSync(); - } - - @override - Widget build(BuildContext context) { - return Scaffold( - body: Container( - margin: const EdgeInsets.symmetric( - vertical: 30.0, - ), - child: Column( - children: [ - const ProgressBar( - currentLevel: 4, - numLevels: 4, - ), - const SizedBox( - height: 30.0, - ), - Text( - 'Swap Wallet', - style: Theme.of(context).textTheme.headline1, - ), - const SizedBox( - height: 30.0, - ), - Expanded( - child: _swapListWidget( - widget._swapAssetsAndEntries.second - .map( - (e) => e.address, - ) - .toList(), - ), - ), - kVerticalSpacing, - Visibility( - visible: Directory(zenonDefaultLegacyDirectoryPath).existsSync(), - child: _getPerformCleanupCheckBox(), - ), - kVerticalSpacing, - Row( - mainAxisAlignment: MainAxisAlignment.center, - children: [ - _getGoBackButton(), - const SizedBox( - width: 70.0, - ), - _getGoBackToSettingsButton(), - ], - ), - ], - ), - ), - ); - } - - Widget _getGoBackButton() { - return OnboardingButton( - text: 'Go back', - onPressed: _currentlyActiveModel == null - ? () { - Navigator.pop(context); - } - : null, - ); - } - - Widget _swapListWidget(List oldAddresses) { - return Container( - margin: const EdgeInsets.symmetric( - horizontal: 200.0, - ), - decoration: BoxDecoration( - color: Theme.of(context).colorScheme.secondaryContainer, - borderRadius: const BorderRadius.all( - Radius.circular( - 20.0, - ), - ), - ), - child: Column( - children: [ - const SizedBox( - height: 30.0, - ), - Row( - mainAxisAlignment: MainAxisAlignment.spaceEvenly, - children: [ - Text( - 'Legacy addresses', - style: Theme.of(context).textTheme.bodyText1, - ), - Text( - 'Alphanet addresses', - style: Theme.of(context).textTheme.bodyText1, - ), - ], - ), - Expanded( - child: Container( - margin: const EdgeInsets.only(top: 20.0), - child: Form( - child: ListView.builder( - shrinkWrap: true, - itemCount: oldAddresses.length, - itemBuilder: (context, index) { - _addInitialization(); - return _swapCellWidget( - index, - ); - }, - ), - ), - ), - ) - ], - ), - ); - } - - void _addInitialization() { - _currentAddressControllers.add(TextEditingController()); - _newAddressControllers.add(TextEditingController()); - _currentAddressNode.add(FocusNode()); - _newAddressNode.add(FocusNode()); - } - - Widget _swapCellWidget(int entryIndex) { - String oldAddress = widget._swapAssetsAndEntries.second[entryIndex].address; - - bool isCellEnabled = !_swappedFileEntries - .contains(widget._swapAssetsAndEntries.second[entryIndex]) && - (_assetsBeforeSwap[entryIndex].qsr > 0 || - _assetsBeforeSwap[entryIndex].znn > 0); - - return Container( - margin: const EdgeInsets.only(bottom: 10.0), - child: Column( - children: [ - Row( - children: [ - Expanded( - flex: 1, - child: _getNumber(entryIndex + 1), - ), - Expanded( - flex: 4, - child: Row( - children: [ - _oldAddressInputField( - entryIndex, - oldAddress, - isCellEnabled, - ), - ], - ), - ), - Expanded( - flex: 4, - child: Row( - children: [ - _getNewAddressDropdown(entryIndex, isCellEnabled), - _getNewAddressBalanceInfo(entryIndex), - ], - ), - ), - Expanded( - flex: 1, - child: _getTransferBalanceWidget( - _transferBalanceBlocs[entryIndex], - entryIndex, - ), - ), - ], - ), - const SizedBox( - height: 10.0, - ), - Row( - children: [ - Expanded( - flex: 1, - child: Container(), - ), - Expanded( - flex: 4, - child: isCellEnabled - ? _getOldAddressBalance(entryIndex) - : const Text('Swapped'), - ), - Expanded( - flex: 4, - child: _newAddressErrorTexts[entryIndex] != null - ? Text( - _newAddressErrorTexts[entryIndex] ?? '', - style: kTextFormFieldErrorStyle, - ) - : _getNewAddressBalanceInfo(entryIndex), - ), - Expanded( - flex: 1, - child: Container(), - ), - ], - ), - ], - ), - ); - } - - Expanded _getNewAddressDropdown(index, bool isEnabled) { - return Expanded( - child: Row( - children: [ - Expanded( - child: AddressesDropdown( - _selectedNewAddresses[index], - isEnabled - ? (newAddress) { - setState(() { - _selectedNewAddresses[index] = newAddress!; - }); - } - : null, - ), - ), - CopyToClipboardIcon( - _selectedNewAddresses[index], - ), - ], - ), - ); - } - - Widget _getNumber(number) { - return Container( - height: 35.0, - width: 35.0, - decoration: BoxDecoration( - shape: BoxShape.circle, - color: Theme.of(context).colorScheme.secondary, - ), - alignment: Alignment.center, - child: Text( - number.toString(), - style: Theme.of(context).textTheme.headline6, - ), - ); - } - - Widget _oldAddressInputField(index, String oldAddress, bool isCellEnabled) { - TextEditingController controller = TextEditingController(text: oldAddress); - - return Expanded( - child: Row( - children: [ - Expanded( - child: InputField( - enabled: false, - hintText: 'Pillar reward address', - controller: controller, - thisNode: _currentAddressNode[index], - nextNode: _newAddressNode[index], - validator: (value) => InputValidators.notEmpty( - 'Pillar reward address', - value, - ), - inputtedTextStyle: - Theme.of(context).textTheme.bodyText1!.copyWith( - color: isCellEnabled - ? AppColors.znnColor - : AppColors.lightSecondary, - ), - ), - ), - CopyToClipboardIcon(oldAddress), - ], - ), - ); - } - - Widget _getOldAddressBalance(index) { - return _assetsAfterSwap == null - ? Text( - '${_assetsBeforeSwap[index].znn.addDecimals( - znnDecimals, - )} ${kZnnCoin.symbol}, ' - '${_assetsBeforeSwap[index].qsr.addDecimals( - qsrDecimals, - )} ${kQsrCoin.symbol}', - style: const TextStyle( - color: AppColors.znnColor, - ), - ) - : Container(); - } - - Widget _getNewAddressBalanceInfo(index) { - return _assetsAfterSwap != null - ? Text( - '${_assetsBeforeSwap[index].znn - _assetsAfterSwap![index].znn} ${kZnnCoin.symbol}, ' - '${_assetsBeforeSwap[index].qsr - _assetsAfterSwap![index].qsr} ${kQsrCoin.symbol}', - style: const TextStyle( - color: AppColors.znnColor, - ), - ) - : Container(); - } - - Widget _getTransferBalanceWidget(TransferBalanceBloc model, int index) { - model.stream.listen( - (swapAssetEntryAfterSwap) { - if (swapAssetEntryAfterSwap != null) { - setState(() { - _newAddressErrorTexts[index] = null; - if (_currentlyActiveModel == model) { - _currentlyActiveModel = null; - } - }); - } - }, - onError: (error) { - setState(() { - _newAddressErrorTexts[index] = error.toString(); - _currentlyActiveModel = null; - }); - }, - ); - - return Row( - children: [ - StreamBuilder( - stream: model.stream, - builder: (_, snapshot) { - if (snapshot.hasError) { - return _getTransferBalanceIcon(model, index); - } - if (snapshot.connectionState == ConnectionState.active) { - if (snapshot.hasData) { - _swappedFileEntries.add(snapshot.data!); - return const Padding( - padding: EdgeInsets.all(8.0), - child: Icon( - Icons.check, - color: AppColors.znnColor, - ), - ); - } else { - return const Padding( - padding: EdgeInsets.all(8.0), - child: SyriusLoadingWidget( - size: 15.0, - ), - ); - } - } - return _getTransferBalanceIcon(model, index); - }, - ), - ], - ); - } - - Widget _getTransferBalanceIcon(TransferBalanceBloc model, int index) { - return RawMaterialButton( - child: Icon( - MaterialCommunityIcons.swap_horizontal, - color: _ifBalanceIsAvailable(index) && _currentlyActiveModel == null - ? AppColors.znnColor - : Theme.of(context).disabledColor, - ), - constraints: const BoxConstraints.tightForFinite(), - padding: const EdgeInsets.all(8), - shape: const CircleBorder(), - onPressed: _ifBalanceIsAvailable(index) && _currentlyActiveModel == null - ? () async { - setState(() { - _currentlyActiveModel = model; - }); - model.transferBalanceToNewAddresses( - widget._swapAssetsAndEntries.second[index], - _getKeyPairForNewAddress(index), - widget._passphrase, - ); - } - : null, - ); - } - - void _initNewAddressErrorTexts() { - _newAddressErrorTexts = List.generate( - _newKeyPairs!.length, - (index) => null, - ); - } - - Widget _getGoBackToSettingsButton() { - return OnboardingButton( - onPressed: _currentlyActiveModel == null ? _onFinishButtonPressed : null, - text: 'Finish', - ); - } - - void _onFinishButtonPressed() { - Navigator.popUntil( - context, - ModalRoute.withName(MainAppContainer.route), - ); - if (_shouldPerformCleanup ?? false) { - _removeLegacyData().then( - (value) => sl.get().addNotification( - WalletNotification( - title: 'Successful cleanup', - timestamp: DateTime.now().millisecondsSinceEpoch, - details: 'Successfully removed legacy data', - type: NotificationType.delete, - ), - ), onError: (error) { - NotificationUtils.sendNotificationError( - error, 'Couldn\'t remove legacy data'); - }); - } - } - - bool _ifBalanceIsAvailable(int oldAddressIndex) => - _assetsBeforeSwap[oldAddressIndex].znn > 0 || - _assetsBeforeSwap[oldAddressIndex].qsr > 0; - - Future _getKeyPairForNewAddress(int index) async => - (await kKeyStore!.findAddress( - Address.parse( - _selectedNewAddresses[index], - ), - kDefaultAddressList.length, - ))! - .keyPair; - - void _initSelectedNewAddresses() => _selectedNewAddresses = List.generate( - widget._swapAssetsAndEntries.first.length, - (index) => kDefaultAddressList[index]!, - ); - - void _initNewAddresses() { - _newKeyPairs = List.generate( - widget._swapAssetsAndEntries.second.length, - (index) => kKeyStore!.getKeyPair(index), - ); - } - - Widget _getPerformCleanupCheckBox() { - return Visibility( - visible: _ifThereIsNothingToSwap(), - child: Row( - mainAxisAlignment: MainAxisAlignment.center, - children: [ - Checkbox( - checkColor: Theme.of(context).scaffoldBackgroundColor, - activeColor: AppColors.znnColor, - value: _shouldPerformCleanup, - onChanged: (value) { - setState(() { - _shouldPerformCleanup = value; - }); - }, - ), - Text( - 'In order to avoid incompatibilities, remove legacy data', - style: Theme.of(context).textTheme.bodyText2, - ) - ], - ), - ); - } - - bool _ifThereIsNothingToSwap() { - for (int i = 0; i < _assetsBeforeSwap.length; i++) { - if (_assetsBeforeSwap[i].znn > 0 || _assetsBeforeSwap[i].qsr > 0) { - if (!_swappedFileEntries - .contains(widget._swapAssetsAndEntries.second[i])) { - return false; - } - } - } - return true; - } - - @override - void dispose() { - for (var controller in _currentAddressControllers) { - controller.dispose(); - } - for (var controller in _newAddressControllers) { - controller.dispose(); - } - for (var focusNode in _currentAddressNode) { - focusNode.dispose(); - } - for (var focusNode in _newAddressNode) { - focusNode.dispose(); - } - for (var bloc in _transferBalanceBlocs) { - bloc.dispose(); - } - _currentlyActiveModel?.dispose(); - _cleanupAfterSwapFinished(); - super.dispose(); - } - - void _cleanupAfterSwapFinished() async { - try { - String swapWalletTempDirectoryPath = path.join( - znnDefaultDirectory.path, - kSwapWalletTempDirectory, - ); - await FileUtils.deleteDirectory( - swapWalletTempDirectoryPath, - ); - } catch (e) { - NotificationUtils.sendNotificationError( - e, - 'Error while cleaning up files after swap', - ); - } - } - - Future _removeLegacyData() async { - List files = Directory(zenonDefaultLegacyDirectoryPath) - .listSync(recursive: true, followLinks: true); - for (FileSystemEntity file in files) { - String fileName = File(file.absolute.path).uri.pathSegments.last; - if (file.existsSync() && - !fileName.contains('wallet') && - !fileName.contains('backups')) { - file.deleteSync(recursive: true); - } - } - } - - String _getDefaultZenonLegacyDirectoryLocation() { - if (Platform.isWindows) { - return Platform.environment['AppData']!; - } else if (Platform.isMacOS) { - return path.join( - Platform.environment['HOME']!, 'Library', 'Application Support'); - } else { - return Platform.environment['HOME']!; - } - } - - String get zenonDefaultLegacyDirectoryPath => path.join( - _getDefaultZenonLegacyDirectoryLocation(), - _getZenonLegacyDirectoryName(), - ); - - String _getZenonLegacyDirectoryName() { - if (Platform.isLinux) { - return '.Zenon'; - } else { - return 'Zenon'; - } - } -} diff --git a/lib/utils/constants.dart b/lib/utils/constants.dart index 54e0f996..6d2b7111 100644 --- a/lib/utils/constants.dart +++ b/lib/utils/constants.dart @@ -135,24 +135,29 @@ const int kWalletNotificationHiveTypeId = 100; const int kNotificationTypeEnumHiveTypeId = 101; // Community links -const String kWebsite = 'zenon.network'; -const String kCommunityWebsite = 'zenon.community'; -const String kOrgCommunityWebsite = 'zenon.org'; -const String kTwitter = 'twitter.com/Zenon_Network'; -const String kTelegram = 't.me/joinchat/MLyPehLIbJj1nw1XOOOltg'; -const String kGithub = 'github.com/zenon-network'; -const String kExplorer = 'explorer.zenon.network'; -const String kScraper = 'zenonscraper.com'; -const String kWiki = 'github.com/zenon-network/znn-wiki'; -const String kCommunityWiki = 'zenon.wiki'; -const String kTools = 'zenon.tools'; -const String kZnnController = 'github.com/zenon-network/znn_controller_dart'; +const String kWebsite = 'https://zenon.network'; +const String kOrgCommunityWebsite = 'https://zenon.org'; +const String kOrgCommunityForum = 'https://forum.zenon.org'; +const String kHubCommunityWebsite = 'https://zenonhub.org'; +const String kTwitter = 'https://twitter.com/Zenon_Network'; +const String kTelegram = 'https://t.me/zenonnetwork'; +const String kGithub = 'https://github.com/zenon-network'; +const String kExplorer = 'https://explorer.zenon.network'; +const String kScraper = 'https://zenonscraper.com'; +const String kHubExplorer = 'https://www.zenonhub.org/explorer'; +const String kWiki = 'https://wiki.zenon.network'; +const String kCommunityWiki = 'https://docs.zenon.wiki'; +const String kOrgCommunityWiki = 'https://docs.zenon.org'; +const String kTools = 'https://zenon.tools'; +const String kWhitepaper = + 'https://github.com/zenon-network/zenon.network/releases/download/whitepaper/whitepaper.pdf'; +const String kZnnController = 'https://github.com/zenon-network/znn_controller_dart'; const String kBitcoinTalk = - 'bitcointalk.org/index.php?topic=5279643.msg55303681#msg55303681'; -const String kDiscord = 'discord.gg/VE2ENBGPNa'; -const String kMedium = 'medium.com/@zenon.network'; -const String kReddit = 'reddit.com/r/Zenon_Network'; -const String kYoutube = 'youtube.com/channel/UCDb8ZtqBt6l5l4HugCnJwhQ'; + 'https://bitcointalk.org/index.php?topic=5279643.msg55303681#msg55303681'; +const String kDiscord = 'https://discord.gg/zenonnetwork'; +const String kMedium = 'https://medium.com/@zenon.network'; +const String kReddit = 'https://reddit.com/r/Zenon_Network'; +const String kYoutube = 'https://youtube.com/channel/UCDb8ZtqBt6l5l4HugCnJwhQ'; // Bridge links const String kJoinLiquidityProgramUrl = diff --git a/lib/widgets/modular_widgets/help_widgets/about_card.dart b/lib/widgets/modular_widgets/help_widgets/about_card.dart index f034343d..77a69be5 100644 --- a/lib/widgets/modular_widgets/help_widgets/about_card.dart +++ b/lib/widgets/modular_widgets/help_widgets/about_card.dart @@ -44,7 +44,7 @@ class AboutCardState extends State { _getGenericTextExpandedChild(kWalletVersion), ), CustomExpandablePanel( - 'Zenon Node chain and network identifiers', + 'Zenon Node chain identifier', _getGenericTextExpandedChild( generalStats.frontierMomentum.chainIdentifier.toString()), ), diff --git a/lib/widgets/modular_widgets/help_widgets/community_card.dart b/lib/widgets/modular_widgets/help_widgets/community_card.dart index 4849b558..235bff17 100644 --- a/lib/widgets/modular_widgets/help_widgets/community_card.dart +++ b/lib/widgets/modular_widgets/help_widgets/community_card.dart @@ -26,10 +26,18 @@ class CommunityCard extends StatelessWidget { 'Websites', _getWebsitesExpandableChild(context), ), + CustomExpandablePanel( + 'Explorers', + _getExplorersExpandableChild(context), + ), CustomExpandablePanel( 'Social Media', _getSocialMediaExpandableChild(context), ), + CustomExpandablePanel( + 'Documentation', + _getDocumentationExpandableChild(context), + ), ], ); } @@ -39,51 +47,59 @@ class CommunityCard extends StatelessWidget { shrinkWrap: true, children: [ _getListViewChild( - iconData: MaterialCommunityIcons.web, + iconData: MaterialCommunityIcons.home, title: 'Zenon Network', url: kWebsite, context: context, ), _getListViewChild( - iconData: Icons.explore, - title: 'Zenon Explorer', - url: kExplorer, + iconData: MaterialCommunityIcons.forum, + title: 'ZenonORG Community Forum', + url: kOrgCommunityForum, context: context, ), _getListViewChild( - iconData: MaterialCommunityIcons.cube, - title: 'Zenonscraper', - url: kScraper, + iconData: MaterialCommunityIcons.tools, + title: 'Zenon Tools', + url: kTools, context: context, ), _getListViewChild( - iconData: MaterialCommunityIcons.book_multiple, - title: 'Zenon Wiki', - url: kWiki, + iconData: MaterialCommunityIcons.web, + title: 'ZenonORG Community', + url: kOrgCommunityWebsite, context: context, ), _getListViewChild( - iconData: MaterialCommunityIcons.book, - title: 'Zenon Community Wiki', - url: kCommunityWiki, + iconData: MaterialCommunityIcons.lan, + title: 'Zenon Hub', + url: kHubCommunityWebsite, context: context, ), + ], + ); + } + + Widget _getExplorersExpandableChild(BuildContext context) { + return ListView( + shrinkWrap: true, + children: [ _getListViewChild( - iconData: MaterialCommunityIcons.tools, - title: 'Zenon Tools', - url: kTools, + iconData: Icons.explore, + title: 'Zenon Explorer', + url: kExplorer, context: context, ), _getListViewChild( - iconData: MaterialCommunityIcons.human_greeting, - title: 'Zenon Community', - url: kCommunityWebsite, + iconData: MaterialCommunityIcons.wan, + title: 'Zenon Hub Explorer', + url: kHubExplorer, context: context, ), _getListViewChild( - iconData: MaterialCommunityIcons.web_box, - title: 'ZenonORG Community', - url: kOrgCommunityWebsite, + iconData: MaterialCommunityIcons.magnify_scan, + title: 'Zenonscraper', + url: kScraper, context: context, ), ], @@ -95,15 +111,15 @@ class CommunityCard extends StatelessWidget { shrinkWrap: true, children: [ _getListViewChild( - iconData: SimpleLineIcons.social_twitter, + iconData: MaterialCommunityIcons.twitter, title: 'Zenon Twitter', url: kTwitter, context: context, ), _getListViewChild( - iconData: Icons.article, - title: 'Zenon Medium', - url: kMedium, + iconData: MaterialCommunityIcons.discord, + title: 'Zenon Discord', + url: kDiscord, context: context, ), _getListViewChild( @@ -113,7 +129,13 @@ class CommunityCard extends StatelessWidget { context: context, ), _getListViewChild( - iconData: SimpleLineIcons.social_github, + iconData: Icons.article, + title: 'Zenon Medium', + url: kMedium, + context: context, + ), + _getListViewChild( + iconData: MaterialCommunityIcons.github, title: 'Zenon Github', url: kGithub, context: context, @@ -124,12 +146,7 @@ class CommunityCard extends StatelessWidget { url: kBitcoinTalk, context: context, ), - _getListViewChild( - iconData: MaterialCommunityIcons.discord, - title: 'Zenon Discord', - url: kDiscord, - context: context, - ), + _getListViewChild( iconData: MaterialCommunityIcons.reddit, title: 'Zenon Reddit', @@ -146,6 +163,38 @@ class CommunityCard extends StatelessWidget { ); } + Widget _getDocumentationExpandableChild(BuildContext context) { + return ListView( + shrinkWrap: true, + children: [ + _getListViewChild( + iconData: MaterialCommunityIcons.book_open_page_variant, + title: 'Zenon Wiki', + url: kWiki, + context: context, + ), + _getListViewChild( + iconData: MaterialCommunityIcons.book, + title: 'Zenon Community Wiki', + url: kCommunityWiki, + context: context, + ), + _getListViewChild( + iconData: MaterialCommunityIcons.book_multiple, + title: 'ZenonORG Community Wiki', + url: kOrgCommunityWiki, + context: context, + ), + _getListViewChild( + iconData: MaterialCommunityIcons.file_document, + title: 'Zenon Whitepaper', + url: kWhitepaper, + context: context, + ), + ], + ); + } + Widget _getListViewChild({ required IconData iconData, required String title, diff --git a/lib/widgets/modular_widgets/settings_widgets/addresses.dart b/lib/widgets/modular_widgets/settings_widgets/addresses.dart index 947535e4..16bc0b81 100644 --- a/lib/widgets/modular_widgets/settings_widgets/addresses.dart +++ b/lib/widgets/modular_widgets/settings_widgets/addresses.dart @@ -38,6 +38,7 @@ class AddressesState extends State { late ScrollController _scrollController; bool _shouldScrollToTheEnd = false; + int numberOfAddressesToAdd = 1; @override void initState() { @@ -78,56 +79,69 @@ class AddressesState extends State { } Widget _getAddAddressWidget() { - int numAddrToAdd = 1; - return InkWell( - onTap: () { - setState(() { - _futureGenerateNewAddress = AddressUtils.generateNewAddress( - numAddr: numAddrToAdd, - callback: () { - setState(() { - _shouldScrollToTheEnd = true; - }); - }); - }); - }, - child: Padding( - padding: const EdgeInsets.all(8.0), - child: Row( - mainAxisAlignment: MainAxisAlignment.spaceEvenly, - children: [ - Expanded( - flex: 1, - child: Container( - padding: const EdgeInsets.only(left: 20, right: 20), - child: NumberSelector.plain( - borderColor: AppColors.znnColor, - iconColor: AppColors.znnColor, - dividerColor: AppColors.znnColor, - step: 1, - current: 1, - min: 1, - max: 10, - onUpdate: (val) { - numAddrToAdd = val; - }, - ), + return Padding( + padding: const EdgeInsets.all(8.0), + child: Row( + mainAxisAlignment: MainAxisAlignment.spaceEvenly, + children: [ + Expanded( + flex: 1, + child: Container( + padding: const EdgeInsets.only(left: 20, right: 20), + child: NumberSelector.plain( + borderColor: AppColors.znnColor, + iconColor: AppColors.znnColor, + dividerColor: AppColors.znnColor, + step: 1, + current: 1, + min: 1, + max: 10, + onUpdate: (val) { + _onAddAddressPressedCallback(val); + }, ), ), - const Icon( - Icons.add_circle, - color: AppColors.znnColor, - size: 20.0, - ), - Container( - padding: const EdgeInsets.only(left: 10, right: 80), - child: Text( - 'Add addresses', - style: Theme.of(context).textTheme.bodyText1, - ), + ), + InkWell( + onTap: () { + setState(() { + _futureGenerateNewAddress = AddressUtils.generateNewAddress( + numAddr: numberOfAddressesToAdd, + callback: () { + setState(() { + _shouldScrollToTheEnd = true; + }); + } + ); + }); + }, + child: Container( + constraints: const BoxConstraints( + minWidth: 150.0, minHeight: 50.0), + alignment: Alignment.center, + child: Row( + children: [ + const Icon( + Icons.add_circle, + color: AppColors.znnColor, + size: 20.0, + ), + const SizedBox(width: 10.0), + Text( + (numberOfAddressesToAdd == 1) ? + 'Add $numberOfAddressesToAdd address ' : + 'Add $numberOfAddressesToAdd addresses', + style: Theme + .of(context) + .textTheme + .bodyText1, + ), + ], + ) ), - ], - ), + ), + const SizedBox(width: 10.0), + ], ), ); } @@ -165,7 +179,7 @@ class AddressesState extends State { if (_shouldScrollToTheEnd) { Timer( - const Duration(seconds: 1), + const Duration(milliseconds: 1), () { if (mounted && _scrollController.hasClients) { _scrollController @@ -228,9 +242,16 @@ class AddressesState extends State { ); } + void _onAddAddressPressedCallback(int value) { + setState(() { + numberOfAddressesToAdd = value; + }); + } + void _onAddressPressedCallback(String? value) { setState(() { _futureChangeDefaultAddress = _changeDefaultAddress(value); + numberOfAddressesToAdd = 1; }); } diff --git a/linux/flutter/generated_plugin_registrant.cc b/linux/flutter/generated_plugin_registrant.cc new file mode 100644 index 00000000..d5a08dfd --- /dev/null +++ b/linux/flutter/generated_plugin_registrant.cc @@ -0,0 +1,39 @@ +// +// Generated file. Do not edit. +// + +// clang-format off + +#include "generated_plugin_registrant.h" + +#include +#include +#include +#include +#include +#include +#include + +void fl_register_plugins(FlPluginRegistry* registry) { + g_autoptr(FlPluginRegistrar) desktop_drop_registrar = + fl_plugin_registry_get_registrar_for_plugin(registry, "DesktopDropPlugin"); + desktop_drop_plugin_register_with_registrar(desktop_drop_registrar); + g_autoptr(FlPluginRegistrar) file_selector_linux_registrar = + fl_plugin_registry_get_registrar_for_plugin(registry, "FileSelectorPlugin"); + file_selector_plugin_register_with_registrar(file_selector_linux_registrar); + g_autoptr(FlPluginRegistrar) local_notifier_registrar = + fl_plugin_registry_get_registrar_for_plugin(registry, "LocalNotifierPlugin"); + local_notifier_plugin_register_with_registrar(local_notifier_registrar); + g_autoptr(FlPluginRegistrar) screen_retriever_registrar = + fl_plugin_registry_get_registrar_for_plugin(registry, "ScreenRetrieverPlugin"); + screen_retriever_plugin_register_with_registrar(screen_retriever_registrar); + g_autoptr(FlPluginRegistrar) tray_manager_registrar = + fl_plugin_registry_get_registrar_for_plugin(registry, "TrayManagerPlugin"); + tray_manager_plugin_register_with_registrar(tray_manager_registrar); + g_autoptr(FlPluginRegistrar) url_launcher_linux_registrar = + fl_plugin_registry_get_registrar_for_plugin(registry, "UrlLauncherPlugin"); + url_launcher_plugin_register_with_registrar(url_launcher_linux_registrar); + g_autoptr(FlPluginRegistrar) window_manager_registrar = + fl_plugin_registry_get_registrar_for_plugin(registry, "WindowManagerPlugin"); + window_manager_plugin_register_with_registrar(window_manager_registrar); +} diff --git a/linux/flutter/generated_plugin_registrant.h b/linux/flutter/generated_plugin_registrant.h new file mode 100644 index 00000000..e0f0a47b --- /dev/null +++ b/linux/flutter/generated_plugin_registrant.h @@ -0,0 +1,15 @@ +// +// Generated file. Do not edit. +// + +// clang-format off + +#ifndef GENERATED_PLUGIN_REGISTRANT_ +#define GENERATED_PLUGIN_REGISTRANT_ + +#include + +// Registers Flutter plugins. +void fl_register_plugins(FlPluginRegistry* registry); + +#endif // GENERATED_PLUGIN_REGISTRANT_ diff --git a/linux/flutter/generated_plugins.cmake b/linux/flutter/generated_plugins.cmake new file mode 100644 index 00000000..5ff4a42c --- /dev/null +++ b/linux/flutter/generated_plugins.cmake @@ -0,0 +1,30 @@ +# +# Generated file, do not edit. +# + +list(APPEND FLUTTER_PLUGIN_LIST + desktop_drop + file_selector_linux + local_notifier + screen_retriever + tray_manager + url_launcher_linux + window_manager +) + +list(APPEND FLUTTER_FFI_PLUGIN_LIST +) + +set(PLUGIN_BUNDLED_LIBRARIES) + +foreach(plugin ${FLUTTER_PLUGIN_LIST}) + add_subdirectory(flutter/ephemeral/.plugin_symlinks/${plugin}/linux plugins/${plugin}) + target_link_libraries(${BINARY_NAME} PRIVATE ${plugin}_plugin) + list(APPEND PLUGIN_BUNDLED_LIBRARIES $) + list(APPEND PLUGIN_BUNDLED_LIBRARIES ${${plugin}_bundled_libraries}) +endforeach(plugin) + +foreach(ffi_plugin ${FLUTTER_FFI_PLUGIN_LIST}) + add_subdirectory(flutter/ephemeral/.plugin_symlinks/${ffi_plugin}/linux plugins/${ffi_plugin}) + list(APPEND PLUGIN_BUNDLED_LIBRARIES ${${ffi_plugin}_bundled_libraries}) +endforeach(ffi_plugin) diff --git a/linux/my_application.cc b/linux/my_application.cc index 878dedff..6e89d935 100644 --- a/linux/my_application.cc +++ b/linux/my_application.cc @@ -47,7 +47,7 @@ static void my_application_activate(GApplication* application) { gtk_window_set_title(window, "syrius"); } - gtk_window_set_icon_from_file(GTK_WINDOW(window), "linux/resources/app_icon.png", NULL); + // gtk_window_set_icon_from_file(GTK_WINDOW(window), "linux/resources/app_icon.png", NULL); gtk_window_set_default_size(window, 1280, 720); gtk_widget_show(GTK_WIDGET(window)); diff --git a/macos/Runner/Configs/AppInfo.xcconfig b/macos/Runner/Configs/AppInfo.xcconfig index 4c810a75..4c5a529c 100644 --- a/macos/Runner/Configs/AppInfo.xcconfig +++ b/macos/Runner/Configs/AppInfo.xcconfig @@ -11,4 +11,4 @@ PRODUCT_NAME = s y r i u s PRODUCT_BUNDLE_IDENTIFIER = network.zenon.syrius // The copyright displayed in application information -PRODUCT_COPYRIGHT = Copyright © 2022 Zenon Network. All rights reserved. +PRODUCT_COPYRIGHT = Copyright © 2023 Zenon Network. All rights reserved. diff --git a/pubspec.lock b/pubspec.lock index fe393a79..4f7d8ff0 100644 --- a/pubspec.lock +++ b/pubspec.lock @@ -8,13 +8,6 @@ packages: url: "https://pub.dartlang.org" source: hosted version: "50.0.0" - aes_crypt_null_safe: - dependency: transitive - description: - name: aes_crypt_null_safe - url: "https://pub.dartlang.org" - source: hosted - version: "2.0.2" analyzer: dependency: transitive description: @@ -224,7 +217,7 @@ packages: name: dbus url: "https://pub.dartlang.org" source: hosted - version: "0.7.4" + version: "0.7.8" desktop_drop: dependency: "direct main" description: @@ -238,42 +231,42 @@ packages: name: device_info_plus url: "https://pub.dartlang.org" source: hosted - version: "4.0.0" + version: "4.1.3" device_info_plus_linux: dependency: transitive description: name: device_info_plus_linux url: "https://pub.dartlang.org" source: hosted - version: "2.1.1" + version: "3.0.0" device_info_plus_macos: dependency: transitive description: name: device_info_plus_macos url: "https://pub.dartlang.org" source: hosted - version: "2.2.3" + version: "3.0.0" device_info_plus_platform_interface: dependency: transitive description: name: device_info_plus_platform_interface url: "https://pub.dartlang.org" source: hosted - version: "2.6.1" + version: "3.0.0" device_info_plus_web: dependency: transitive description: name: device_info_plus_web url: "https://pub.dartlang.org" source: hosted - version: "2.1.0" + version: "3.0.0" device_info_plus_windows: dependency: transitive description: name: device_info_plus_windows url: "https://pub.dartlang.org" source: hosted - version: "2.1.1" + version: "4.1.0" dotted_border: dependency: "direct main" description: @@ -308,7 +301,7 @@ packages: name: ffi url: "https://pub.dartlang.org" source: hosted - version: "1.2.1" + version: "2.0.1" file: dependency: transitive description: @@ -504,7 +497,7 @@ packages: name: intl url: "https://pub.dartlang.org" source: hosted - version: "0.17.0" + version: "0.18.0" io: dependency: transitive description: @@ -645,6 +638,13 @@ packages: url: "https://pub.dartlang.org" source: hosted version: "1.0.5" + open_filex: + dependency: "direct main" + description: + name: open_filex + url: "https://pub.dartlang.org" + source: hosted + version: "4.3.2" overlay_support: dependency: "direct main" description: @@ -665,7 +665,7 @@ packages: name: package_info_plus url: "https://pub.dartlang.org" source: hosted - version: "1.4.2" + version: "1.4.3+1" package_info_plus_linux: dependency: transitive description: @@ -700,7 +700,7 @@ packages: name: package_info_plus_windows url: "https://pub.dartlang.org" source: hosted - version: "1.0.5" + version: "2.1.0" page_transition: dependency: "direct main" description: @@ -777,7 +777,7 @@ packages: name: path_provider_windows url: "https://pub.dartlang.org" source: hosted - version: "2.0.7" + version: "2.1.3" petitparser: dependency: transitive description: @@ -972,13 +972,6 @@ packages: url: "https://pub.dartlang.org" source: hosted version: "1.9.0" - sprintf: - dependency: transitive - description: - name: sprintf - url: "https://pub.dartlang.org" - source: hosted - version: "6.0.2" stack_trace: dependency: transitive description: @@ -1195,14 +1188,14 @@ packages: name: win32 url: "https://pub.dartlang.org" source: hosted - version: "2.6.1" + version: "2.7.0" window_manager: dependency: "direct main" description: name: window_manager url: "https://pub.dartlang.org" source: hosted - version: "0.2.9" + version: "0.3.0" xdg_directories: dependency: transitive description: @@ -1228,20 +1221,11 @@ packages: dependency: "direct main" description: path: "." - ref: "5e1d826f9cad841498a314cf50e985539c29d634" - resolved-ref: "5e1d826f9cad841498a314cf50e985539c29d634" + ref: master + resolved-ref: "78210a4c3e5eafe6648c7234f6b5d524b310368a" url: "https://github.com/alienc0der/znn_sdk_dart.git" source: git version: "0.0.4" - znn_swap_utility: - dependency: "direct main" - description: - path: "." - ref: "417d3a42bb0ce1f9fab5dd4d6e8481112afbbbfc" - resolved-ref: "417d3a42bb0ce1f9fab5dd4d6e8481112afbbbfc" - url: "https://github.com/zenon-network/znn_swap_utility.git" - source: git - version: "0.0.1" sdks: dart: ">=2.18.0 <3.0.0" flutter: ">=3.3.0" diff --git a/pubspec.yaml b/pubspec.yaml index 172febb7..c535fe47 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -60,7 +60,7 @@ dependencies: znn_sdk_dart: git: url: https://github.com/alienc0der/znn_sdk_dart.git - ref: 5e1d826f9cad841498a314cf50e985539c29d634 + ref: master json_rpc_2: ^3.0.2 path: ^1.8.2 ffi: ^2.0.1 diff --git a/windows/CMakeLists.txt b/windows/CMakeLists.txt index e796255a..752d25d2 100644 --- a/windows/CMakeLists.txt +++ b/windows/CMakeLists.txt @@ -2,6 +2,7 @@ cmake_minimum_required(VERSION 3.15) project(syrius LANGUAGES CXX) set(BINARY_NAME "syrius") +set(APPLICATION_ID "network.zenon.syrius") cmake_policy(SET CMP0063 NEW) diff --git a/windows/flutter/generated_plugin_registrant.cc b/windows/flutter/generated_plugin_registrant.cc index a484df4d..0a12ed49 100644 --- a/windows/flutter/generated_plugin_registrant.cc +++ b/windows/flutter/generated_plugin_registrant.cc @@ -8,7 +8,10 @@ #include #include -#include +#include +#include +#include +#include #include #include @@ -17,8 +20,14 @@ void RegisterPlugins(flutter::PluginRegistry* registry) { registry->GetRegistrarForPlugin("DesktopDropPlugin")); FileSelectorPluginRegisterWithRegistrar( registry->GetRegistrarForPlugin("FileSelectorPlugin")); + LocalNotifierPluginRegisterWithRegistrar( + registry->GetRegistrarForPlugin("LocalNotifierPlugin")); NetworkInfoPlusWindowsPluginRegisterWithRegistrar( registry->GetRegistrarForPlugin("NetworkInfoPlusWindowsPlugin")); + ScreenRetrieverPluginRegisterWithRegistrar( + registry->GetRegistrarForPlugin("ScreenRetrieverPlugin")); + TrayManagerPluginRegisterWithRegistrar( + registry->GetRegistrarForPlugin("TrayManagerPlugin")); UrlLauncherWindowsRegisterWithRegistrar( registry->GetRegistrarForPlugin("UrlLauncherWindows")); WindowManagerPluginRegisterWithRegistrar( diff --git a/windows/flutter/generated_plugins.cmake b/windows/flutter/generated_plugins.cmake index ed7b64dd..ecf4ed83 100644 --- a/windows/flutter/generated_plugins.cmake +++ b/windows/flutter/generated_plugins.cmake @@ -5,7 +5,10 @@ list(APPEND FLUTTER_PLUGIN_LIST desktop_drop file_selector_windows - network_info_plus_windows + local_notifier + network_info_plus + screen_retriever + tray_manager url_launcher_windows window_manager ) diff --git a/windows/runner/Runner.rc b/windows/runner/Runner.rc index 90579259..19a2e0d8 100644 --- a/windows/runner/Runner.rc +++ b/windows/runner/Runner.rc @@ -93,7 +93,7 @@ BEGIN VALUE "FileDescription", "s y r i u s (v0.0.6-alphanet)" "\0" VALUE "FileVersion", VERSION_AS_STRING "\0" VALUE "InternalName", "syrius" "\0" - VALUE "LegalCopyright", "(C) 2022 Zenon Network" "\0" + VALUE "LegalCopyright", "(C) 2023 Zenon Network" "\0" VALUE "OriginalFilename", "syrius.exe" "\0" VALUE "ProductName", "syrius" "\0" VALUE "ProductVersion", VERSION_AS_STRING "\0"