Skip to content

Commit

Permalink
Update block explorer list
Browse files Browse the repository at this point in the history
  • Loading branch information
bbedward committed Oct 8, 2024
1 parent 1e046ea commit 8b99a0e
Show file tree
Hide file tree
Showing 6 changed files with 61 additions and 29 deletions.
Binary file removed ios/AppStore_com.avengemedia.natrium.mobileprovision
Binary file not shown.
2 changes: 1 addition & 1 deletion lib/appstate_container.dart
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ class StateContainerState extends State<StateContainer> {
AvailableCurrency curCurrency = AvailableCurrency(AvailableCurrencyEnum.USD);
LanguageSetting curLanguage = LanguageSetting(AvailableLanguage.DEFAULT);
AvailableBlockExplorer curBlockExplorer =
AvailableBlockExplorer(AvailableBlockExplorerEnum.NANOCRAWLER);
AvailableBlockExplorer(AvailableBlockExplorerEnum.SPYNANO);
BaseTheme curTheme = NatriumTheme();
// Currently selected account
Account selectedAccount =
Expand Down
14 changes: 2 additions & 12 deletions lib/localization.dart
Original file line number Diff line number Diff line change
Expand Up @@ -1226,22 +1226,12 @@ class AppLocalization {

/// -- NON-TRANSLATABLE ITEMS
String getBlockExplorerUrl(String hash, AvailableBlockExplorer explorer) {
if (explorer.explorer == AvailableBlockExplorerEnum.NANOLOOKER) {
return 'https://nanolooker.com/block/$hash';
} else if (explorer.explorer == AvailableBlockExplorerEnum.NANOCAFE) {
return 'https://nanocafe.cc/$hash';
}
return 'https://nanocrawler.cc/explorer/block/$hash';
return explorer.getBlockUrl(hash);
}

String getAccountExplorerUrl(
String account, AvailableBlockExplorer explorer) {
if (explorer.explorer == AvailableBlockExplorerEnum.NANOLOOKER) {
return 'https://nanolooker.com/account/$account';
} else if (explorer.explorer == AvailableBlockExplorerEnum.NANOCAFE) {
return 'https://nanocafe.cc/$account';
}
return 'https://nanocrawler.cc/explorer/account/$account';
return explorer.getAccountUrl(account);
}

String get eulaUrl {
Expand Down
60 changes: 52 additions & 8 deletions lib/model/available_block_explorer.dart
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,13 @@ import 'package:flutter/material.dart';
import 'dart:ui';
import 'package:natrium_wallet_flutter/model/setting_item.dart';

enum AvailableBlockExplorerEnum { NANOCRAWLER, NANOLOOKER, NANOCAFE }
enum AvailableBlockExplorerEnum {
SPYNANO,
NANOEXPLORER,
BLOCKLATTICE,
NANOCOMMUNITYY,
NANOBROWSE
}

/// Represent the available authentication methods our app supports
class AvailableBlockExplorer extends SettingSelectionItem {
Expand All @@ -12,14 +18,52 @@ class AvailableBlockExplorer extends SettingSelectionItem {

String getDisplayName(BuildContext context) {
switch (explorer) {
case AvailableBlockExplorerEnum.NANOCRAWLER:
return "nanocrawler.cc";
case AvailableBlockExplorerEnum.NANOLOOKER:
return "nanolooker.com";
case AvailableBlockExplorerEnum.NANOCAFE:
return "nanocafe.cc";
case AvailableBlockExplorerEnum.SPYNANO:
return "spynano.org";
case AvailableBlockExplorerEnum.NANOEXPLORER:
return "nanexplorer.com";
case AvailableBlockExplorerEnum.BLOCKLATTICE:
return "blocklattice.io";
case AvailableBlockExplorerEnum.NANOCOMMUNITYY:
return "nano.community";
case AvailableBlockExplorerEnum.NANOBROWSE:
return "nanobrowse.com";
default:
return "spynano.org";
}
}

String getBlockUrl(String hash) {
switch (explorer) {
case AvailableBlockExplorerEnum.SPYNANO:
return "https://spynano.org/hash/$hash";
case AvailableBlockExplorerEnum.NANOEXPLORER:
return "https://nanexplorer.com/nano/block/$hash";
case AvailableBlockExplorerEnum.BLOCKLATTICE:
return "https://blocklattice.io/block/$hash";
case AvailableBlockExplorerEnum.NANOCOMMUNITYY:
return "https://nano.community/$hash";
case AvailableBlockExplorerEnum.NANOBROWSE:
return "https://nanobrowse.com/block/$hash";
default:
return "https://spynano.org/hash/$hash";
}
}

String getAccountUrl(String account) {
switch (explorer) {
case AvailableBlockExplorerEnum.SPYNANO:
return "https://spynano.org/account/$account";
case AvailableBlockExplorerEnum.NANOEXPLORER:
return "https://nanexplorer.com/nano/account/$account";
case AvailableBlockExplorerEnum.BLOCKLATTICE:
return "https://blocklattice.io/account/$account";
case AvailableBlockExplorerEnum.NANOCOMMUNITYY:
return "https://nano.community/$account";
case AvailableBlockExplorerEnum.NANOBROWSE:
return "https://nanobrowse.com/account/$account";
default:
return "nanocrawler.cc";
return "https://spynano.org/account/$account";
}
}

Expand Down
12 changes: 5 additions & 7 deletions lib/util/sharedprefsutil.dart
Original file line number Diff line number Diff line change
Expand Up @@ -79,10 +79,7 @@ class SharedPrefsUtil {
} else {
expiryVal = expiry;
}
Map<String, dynamic> msg = {
'data':value,
'expiry':expiryVal
};
Map<String, dynamic> msg = {'data': value, 'expiry': expiryVal};
String serialized = json.encode(msg);
await set(key, serialized);
}
Expand Down Expand Up @@ -226,8 +223,9 @@ class SharedPrefsUtil {
}

Future<AvailableBlockExplorer> getBlockExplorer() async {
return AvailableBlockExplorer(AvailableBlockExplorerEnum.values[await get(cur_explorer,
defaultValue: AvailableBlockExplorerEnum.NANOCRAWLER.index)]);
return AvailableBlockExplorer(AvailableBlockExplorerEnum.values[await get(
cur_explorer,
defaultValue: AvailableBlockExplorerEnum.SPYNANO.index)]);
}

Future<ThemeSetting> getTheme() async {
Expand Down Expand Up @@ -380,7 +378,7 @@ class SharedPrefsUtil {

Future<bool> shouldShowAlert(AlertResponseItem alert) async {
int exists = await getWithExpiry("alert_${alert.id}");
return exists == null ? true: false;
return exists == null ? true : false;
}

// For logging out
Expand Down
2 changes: 1 addition & 1 deletion pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ description: Natrium - Fast, Robust & Secure NANO Wallet.
# followed by an optional build number separated by a +.
# Both the version and the builder number may be overridden in flutter
# build by specifying --build-name and --build-number, respectively.
version: 2.5.1+85
version: 2.5.2+86

environment:
sdk: ">=2.11.99 <3.0.0"
Expand Down

0 comments on commit 8b99a0e

Please sign in to comment.