Skip to content

Commit

Permalink
Merge pull request #197 from Topl/dev
Browse files Browse the repository at this point in the history
0.4 upstream dev to main
  • Loading branch information
ultimaterex authored Dec 14, 2022
2 parents c10eef5 + 8ec9add commit 121cff4
Show file tree
Hide file tree
Showing 123 changed files with 11,577 additions and 575 deletions.
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,6 @@ android_keys.zip
/build/

# Web related
lib/generated_plugin_registrant.dart

# Symbolication related
app.*.symbols
Expand Down
69 changes: 69 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
all: lint format

# Adding a help file: https://gist.github.com/prwhite/8168133#gistcomment-1313022
help: ## This help dialog.
@IFS=$$'\n' ; \
help_lines=(`fgrep -h "##" $(MAKEFILE_LIST) | fgrep -v fgrep | sed -e 's/\\$$//'`); \
for help_line in $${help_lines[@]}; do \
IFS=$$'#' ; \
help_split=($$help_line) ; \
help_command=`echo $${help_split[0]} | sed -e 's/^ *//' -e 's/ *$$//'` ; \
help_info=`echo $${help_split[2]} | sed -e 's/^ *//' -e 's/ *$$//'` ; \
printf "%-30s %s\n" $$help_command $$help_info ; \
done

build_web:
@flutter clean
@npm install
@npm run build
@flutter pub get
@flutter build web --web-renderer html --csp --release

run_unit: ## Runs unit tests
@echo "╠ Running the tests"
@flutter test || (echo "Error while running tests"; exit 1)

clean: ## Cleans the environment
@echo "╠ Cleaning the project..."
@rm -rf pubspec.lock
@flutter clean
@flutter pub get
fix_warnings: ## fix any warnings
@echo "╠ Attempting to fix warnings..."
@dart fix --dry-run
@dart fix --apply
watch: ## Watches the files for changes
@echo "╠ Watching the project..."
@flutter pub run build_runner watch --delete-conflicting-outputs


gen: ## Generates the assets
@echo "╠ Generating the assets..."
@flutter pub get
@fluttergen
@flutter packages pub run build_runner build --delete-conflicting-outputs

format: ## Formats the code
@echo "╠ Formatting the code"
@dart format lib .
@flutter pub run import_sorter:main
@flutter format lib

lint: ## Lints the code
@echo "╠ Verifying code..."
@dart analyze . || (echo "Error in project"; exit 1)

upgrade: clean ## Upgrades dependencies
@echo "╠ Upgrading dependencies..."
@flutter pub upgrade

commit: format lint run_unit
@echo "╠ Committing..."
git add .
git commit

analyze:
flutter run dart_code_metrics:metrics analyze lib

ditto:
echo "hello world"
2 changes: 1 addition & 1 deletion android/app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle"


android {
compileSdkVersion 31
compileSdkVersion 32

compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
Expand Down
Binary file added assets/icons/clock_border.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/icons/connect_dapp.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/icons/poly_icon_circle.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified assets/icons/undefined_icon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
15 changes: 15 additions & 0 deletions generate-protos.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
source_path=$1

mkdir -p ./lib/genus/generated

protoc --dart_out=grpc:./lib/genus/generated \
-I $source_path \
$source_path/types.proto \
$source_path/filters.proto \
$source_path/transactions_query.proto \
$source_path/blocks_query.proto \
$source_path/transactions_subscription.proto \
$source_path/blocks_subscription.proto \
$source_path/services_types.proto


2 changes: 1 addition & 1 deletion ios/Flutter/AppFrameworkInfo.plist
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,6 @@
<key>CFBundleVersion</key>
<string>1.0</string>
<key>MinimumOSVersion</key>
<string>9.0</string>
<string>11.0</string>
</dict>
</plist>
2 changes: 1 addition & 1 deletion ios/Podfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# Uncomment this line to define a global platform for your project
# platform :ios, '9.0'
# platform :ios, '11.0'

# CocoaPods analytics sends network stats synchronously affecting flutter build latency.
ENV['COCOAPODS_DISABLE_STATS'] = 'true'
Expand Down
22 changes: 11 additions & 11 deletions ios/Podfile.lock
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
PODS:
- "app_settings (3.0.0+1)":
- Flutter
- DKImagePickerController/Core (4.3.3):
- DKImagePickerController/Core (4.3.4):
- DKImagePickerController/ImageDataManager
- DKImagePickerController/Resource
- DKImagePickerController/ImageDataManager (4.3.3)
- DKImagePickerController/PhotoGallery (4.3.3):
- DKImagePickerController/ImageDataManager (4.3.4)
- DKImagePickerController/PhotoGallery (4.3.4):
- DKImagePickerController/Core
- DKPhotoGallery
- DKImagePickerController/Resource (4.3.3)
- DKImagePickerController/Resource (4.3.4)
- DKPhotoGallery (0.0.17):
- DKPhotoGallery/Core (= 0.0.17)
- DKPhotoGallery/Model (= 0.0.17)
Expand Down Expand Up @@ -46,9 +46,9 @@ PODS:
- Flutter
- path_provider_ios (0.0.1):
- Flutter
- SDWebImage (5.12.5):
- SDWebImage/Core (= 5.12.5)
- SDWebImage/Core (5.12.5)
- SDWebImage (5.13.4):
- SDWebImage/Core (= 5.13.4)
- SDWebImage/Core (5.13.4)
- SwiftyGif (5.4.3)
- url_launcher_ios (0.0.1):
- Flutter
Expand Down Expand Up @@ -93,19 +93,19 @@ EXTERNAL SOURCES:

SPEC CHECKSUMS:
app_settings: d103828c9f5d515c4df9ee754dabd443f7cedcf3
DKImagePickerController: 72fd378f244cef3d27288e0aebf217a4467e4012
DKImagePickerController: b512c28220a2b8ac7419f21c491fc8534b7601ac
DKPhotoGallery: fdfad5125a9fdda9cc57df834d49df790dbb4179
file_picker: 817ab1d8cd2da9d2da412a417162deee3500fc95
Flutter: 50d75fe2f02b26cc09d224853bb45737f8b3214a
Flutter: f04841e97a9d0b0a8025694d0796dd46242b2854
flutter_keyboard_visibility: 0339d06371254c3eb25eeb90ba8d17dca8f9c069
flutter_native_splash: 52501b97d1c0a5f898d687f1646226c1f93c56ef
flutter_secure_storage: 7953c38a04c3fdbb00571bcd87d8e3b5ceb9daec
local_auth_ios: 0d333dde7780f669e66f19d2ff6005f3ea84008d
path_provider_ios: 14f3d2fd28c4fdb42f44e0f751d12861c43cee02
SDWebImage: 0905f1b7760fc8ac4198cae0036600d67478751e
SDWebImage: e5cc87bf736e60f49592f307bdf9e157189298a3
SwiftyGif: 6c3eafd0ce693cad58bb63d2b2fb9bacb8552780
url_launcher_ios: 839c58cdb4279282219f5e248c3321761ff3c4de

PODFILE CHECKSUM: aafe91acc616949ddb318b77800a7f51bffa2a4c
PODFILE CHECKSUM: ef19549a9bc3046e7bb7d2fab4d021637c0c58a3

COCOAPODS: 1.11.3
6 changes: 6 additions & 0 deletions lib/constants/assets.dart
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,10 @@ class RibnAssets {
static const plusGrey = 'packages/ribn_toolkit/assets/icons/plus_grey.png';
static const walletBlue = 'packages/ribn_toolkit/assets/icons/wallet_blue.png';
static const walletGrey = 'packages/ribn_toolkit/assets/icons/wallet_grey.png';
static const clockBlue = 'packages/ribn_toolkit/assets/icons/clock_blue.png';
static const clockGrey = 'packages/ribn_toolkit/assets/icons/clock_grey.png';
static const copyIcon = 'packages/ribn_toolkit/assets/icons/copy_icon.png';
static const circlePlus = 'packages/ribn_toolkit/assets/icons/circle_plus.png';
static const copyIconAlternate = 'assets/icons/copy_icon_alternate.png';
static const fingerPrintAssets = 'assets/icons/finger_print_assets.png';
static const redDangerTriangle = 'assets/icons/red_danger_triangle.png';
Expand Down Expand Up @@ -112,5 +115,8 @@ class RibnAssets {
static const andriodBiometricsOutline = 'assets/icons/android_biometrics_outline.png';
static const addPlusPng = 'assets/icons/add_plus.png';
static const documentPng = 'assets/icons/document.png';
static const polyIconCircle = 'assets/icons/poly_icon_circle.png';
static const clockWithBorder = 'assets/icons/clock_border.png';
static const walletWithBorder = 'assets/icons/wallet_with_border.png';
static const connectDApp = 'assets/icons/connect_dapp.png';
}
3 changes: 2 additions & 1 deletion lib/constants/network_utils.dart
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ class NetworkUtils {
static const String toplNet = 'toplnet';
static const String valhalla = 'valhalla';
static const String private = 'private';
static const String privateIP = '35.226.176.100';
static int toplNetId = constants.networkRegistry[toplNet]!;
static int valhallaId = constants.networkRegistry[valhalla]!;
static int privateId = constants.networkRegistry[private]!;
Expand All @@ -24,6 +25,6 @@ class NetworkUtils {
static Map<int, String> networkUrls = {
valhallaId: 'https://vertx.topl.services/valhalla/$projectId',
toplNetId: 'https://vertx.topl.services/mainnet/$projectId',
privateId: 'http://localhost:9085'
privateId: 'http://$privateIP:9085'
};
}
5 changes: 5 additions & 0 deletions lib/constants/routes.dart
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,8 @@ class Routes {
static const polyTransferInput = '/poly-transfer-input';
static const txReview = '/tx-review';
static const txConfirmation = '/tx-confirmation';
static const txHistory = '/tx-history';
static const txHistoryDetails = '/tx-history-details';
static const mintInput = '/mint-input';
static const settings = '/settings';
static const assetDetails = '/asset-details';
Expand All @@ -44,4 +46,7 @@ class Routes {
static const externalSigning = '/ext-signing';
static const enable = '/enable';
static const error = '/error';
static const connectDApp = '/connect-dapp';
static const reviewAndSignDApp = '/review-and-sign';
static const loadingDApp = '/loading-dapp';
}
6 changes: 4 additions & 2 deletions lib/constants/rules.dart
Original file line number Diff line number Diff line change
Expand Up @@ -23,12 +23,14 @@ class Rules {
static const int assetCodeVersion = constants.supportedAssetCodeVersion;
static const int internalIdx = 1;
static Map<int, String> txHistoryUrls = {
NetworkUtils.valhallaId: 'https://annulus-api.topl.services/staging/valhalla/',
NetworkUtils.toplNetId: 'https://annulus-api.topl.services/staging/toplnet/',
NetworkUtils.valhallaId: 'https://annulus-api.topl.services/staging/valhalla',
NetworkUtils.toplNetId: 'https://annulus-api.topl.services/staging/toplnet',
NetworkUtils.privateId: 'https://annulus-api.topl.services/staging/valhalla',
};
static Map<int, String> txDetailsRedirectUrls = {
NetworkUtils.valhallaId: 'https://staging.valhalla.annulus.topl.services/#/transaction/',
NetworkUtils.toplNetId: 'https://staging.toplnet.annulus.topl.services/#/transaction/',
NetworkUtils.privateId: 'https://staging.valhalla.annulus.topl.services/#/transaction/',
};
static String txHistoryUrl(String addr, int networkId) => '${txHistoryUrls[networkId]!}/v1/address/history/$addr';
static String txDetailsUrl(String txId, int networkId) => '${txDetailsRedirectUrls[networkId]!}$txId';
Expand Down
23 changes: 20 additions & 3 deletions lib/constants/strings.dart
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ class Strings {
static const String assets = 'Assets';
static const String send = 'Send';
static const String receive = 'Receive';
static const String transactionHistory = 'Transaction History';
static const String transactionHistory = 'Activity details';
static const String generateNewAddress = 'GENERATE NEW ADDRESS';
static const String noAddresses = 'You have no addresses';
static const String settings = 'Settings';
Expand Down Expand Up @@ -143,13 +143,20 @@ Write down the each word in the exact order it is presented.''';
'''Export Topl Main Key and save it somewhere secure.\nYou can reimport this to restore your wallet.''';
static const String exportWallet = 'Export Wallet';
static const String dangerZone = 'Danger Zone';
static const String actionNotReversible = 'Careful, this action is not reversible!';
static const String deleteWallet = 'Delete Wallet';
static const String actionNotReversible = 'Careful, these actions are not reversible!';
static const String removeWallet = 'Remove wallet from your device';
static const String disconnectDApps = 'Disconnect DApps from Ribn';
static const String delete = 'Delete';
static const String disconnect = 'Disconnect';
static const String deleteRibnWallet = 'Delete Ribn Wallet';
static const String disconnectRibnWalletDApps = 'Disconnect all DApps from Ribn wallet?';
static const String deleteRibnWalletDesc =
'Enter your wallet password to delete this wallet.\n\nThis action is not reversible. Your Ribn wallet will be deleted from this device.';
static const String disconnectRibnWalletDAppsDesc =
'By disconnecting, Ribn wallet will remove authorization to the following DApps:';
static const String noIChangedMyMind = 'NO, I CHANGED MY MIND!';
static const String yesIWantToDelete = 'YES, I WANT TO DELETE.';
static const String yesIWantToDisconnect = 'YES, I WANT TO DISCONNECT.';
static const String enterWalletPassword = 'Enter Wallet Password';
static const String unlock = 'Unlock';
static const String next = 'Next';
Expand Down Expand Up @@ -270,7 +277,17 @@ Write down the each word in the exact order it is presented.''';
static const String enableBiometricsDescription =
'''Would you like to turn on biometrics for faster access to Ribn Wallet?\n
Ribn Wallet does not control the functionality of biometrics and does not have access to your biometrics information.''';
static const String recentActivity = 'Recent Activity';
static const String transactionDetails = 'Activity details';
static const String noActivityToReview = 'You currently have no wallet activity to review.';
static const String noAssetsInWallet = 'You currently have no assets in your wallet';
static const String emptyStateBody =
'Here’s how you can get started:\n • Mint a new asset to a wallet address\n • Share your address to receive assets';
static const String connect = 'Connect';
static const String connectDApp = ' allowing this site to see my Ribn address, and suggest transactions to approve.';
static const String connecting = 'Connecting...';
static const String executeTransaction = 'You are about to execute the following transaction on';



}
32 changes: 29 additions & 3 deletions lib/containers/settings_container.dart
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,12 @@ import 'dart:async';
import 'package:flutter/material.dart';
import 'package:flutter_redux/flutter_redux.dart';
import 'package:redux/redux.dart';

import 'package:ribn/actions/misc_actions.dart';
import 'package:ribn/models/app_state.dart';
import 'package:ribn/platform/platform.dart';
import 'package:ribn/presentation/settings/sections/delete_wallet_confirmation_dialog.dart';
import 'package:ribn/presentation/settings/sections/disconnect_wallet_confirmation_dialog.dart';


/// Intended to wrap the [SettingsPage] and provide it with the the [SettingsViewModel].
class SettingsContainer extends StatelessWidget {
Expand All @@ -31,18 +33,25 @@ class SettingsViewModel {
/// Handler for when user selects 'delete wallet'
final Future<void> Function(BuildContext context) onDeletePressed;

/// Handler for when user selects 'disconnect wallet'
final Future<void> Function(BuildContext context) onDisconnectPressed;

/// The current app version.
final String appVersion;

/// True if biometrics authentication is enabled
final bool isBiometricsEnabled;

bool canDisconnect = false;

SettingsViewModel({
required this.exportToplMainKey,
required this.onDeletePressed,
required this.onDisconnectPressed,
required this.appVersion,
required this.isBiometricsEnabled,
});

static SettingsViewModel fromStore(Store<AppState> store) {
return SettingsViewModel(
exportToplMainKey: () => store.dispatch(
Expand All @@ -55,7 +64,10 @@ class SettingsViewModel {
await showDialog(
context: context,
builder: (context) => DeleteWalletConfirmationDialog(
onConfirmDeletePressed: (String password, VoidCallback onIncorrectPasswordEntered) async {
onConfirmDeletePressed: (
String password,
VoidCallback onIncorrectPasswordEntered,
) async {
final Completer<bool> actionCompleter = Completer();
store.dispatch(
DeleteWalletAction(
Expand All @@ -71,6 +83,17 @@ class SettingsViewModel {
),
);
},
onDisconnectPressed: (BuildContext context) async {
final dApps = await PlatformUtils.instance
.convertToFuture(PlatformUtils.instance.getDAppList());
await PlatformUtils.instance.consoleLog(dApps);
// final bool disconnectResult =
await showDialog(
context: context,
builder: (context) =>
DisconnectWalletConfirmationDialog(dApps: dApps),
);
},
appVersion: store.state.appVersion,
isBiometricsEnabled: store.state.userDetailsState.isBiometricsEnabled,
);
Expand All @@ -88,6 +111,9 @@ class SettingsViewModel {

@override
int get hashCode {
return exportToplMainKey.hashCode ^ onDeletePressed.hashCode ^ appVersion.hashCode ^ isBiometricsEnabled.hashCode;
return exportToplMainKey.hashCode ^
onDeletePressed.hashCode ^
appVersion.hashCode ^
isBiometricsEnabled.hashCode;
}
}
Loading

0 comments on commit 121cff4

Please sign in to comment.