Skip to content
Snippets Groups Projects
Commit 0cd231ce authored by vjrj's avatar vjrj
Browse files

Use pubkey abreviation similar to Cesium

parent c28975a1
No related branches found
No related tags found
No related merge requests found
......@@ -23,6 +23,7 @@ import '../data/models/node_list_cubit.dart';
import '../g1/api.dart';
import '../g1/currency.dart';
import '../shared_prefs_helper.dart';
import 'notification_controller.dart';
import 'widgets/first_screen/circular_icon.dart';
void showTooltip(BuildContext context, String title, String message) {
......@@ -106,8 +107,9 @@ String humanizeContact(String publicAddress, Contact contact,
String humanizePubKey(String address) => '\u{1F511} ${simplifyPubKey(address)}';
String simplifyPubKey(String address) =>
address.length <= 8 ? 'WRONG ADDRESS' : address.substring(0, 8);
String simplifyPubKey(String address) => address.length <= 8
? 'WRONG ADDRESS'
: '${address.substring(0, 4)}${address.substring(address.length - 4)}';
Color tileColor(int index, BuildContext context, [bool inverse = false]) {
final ColorScheme colorScheme = Theme.of(context).colorScheme;
......@@ -264,8 +266,15 @@ Future<void> fetchTransactionsFromBackground([bool init = false]) async {
}
try {
initGetItAll();
await NotificationController.initializeLocalNotifications();
} catch (e) {
// We should try to do this better
if (inDevelopment) {
NotificationController.notify(
title: 'Background process failed',
desc: e.toString(),
id: DateTime.now().toIso8601String());
}
}
}
final GetIt getIt = GetIt.instance;
......@@ -276,6 +285,12 @@ Future<void> fetchTransactionsFromBackground([bool init = false]) async {
for (final CesiumCard card in SharedPreferencesHelper().cards) {
transCubit.fetchTransactions(nodeListCubit, appCubit, pubKey: card.pubKey);
}
if (inDevelopment) {
NotificationController.notify(
title: 'Background process ended correctly',
desc: '',
id: DateTime.now().toIso8601String());
}
}
Future<void> fetchTransactions(BuildContext context) async {
......@@ -601,8 +616,8 @@ bool isDark(BuildContext context) =>
bool get isIOS => !kIsWeb && Platform.isIOS;
const String userNameSuffix = ' ❥';
const String g1nkgoUserNameSuffix = ' ❥';
const String protectedUserNameSuffix = ' 🔒';
const double cardAspectRatio = 1.58;
Future<void> hydratedInit() async {
......
......@@ -3,6 +3,7 @@ import 'package:flutter/material.dart';
import 'package:flutter_dotenv/flutter_dotenv.dart';
import 'package:flutter_svg/svg.dart';
import '../../../g1/g1_helper.dart';
import '../../../shared_prefs_helper.dart';
import '../../tutorial_keys.dart';
import '../../ui_helpers.dart';
......@@ -112,7 +113,7 @@ class CreditCard extends StatelessWidget {
key: creditCardPubKey,
fit: BoxFit.scaleDown,
child: Text(
'${pubKey.substring(0, 4)} ${pubKey.substring(4, 8)}',
simplifyPubKey(extractPublicKey(pubKey)),
style: cardTextStyle(context),
))),
GestureDetector(
......
......@@ -4,6 +4,7 @@ import 'package:flutter/material.dart';
import '../../../data/models/cesium_card.dart';
import '../../../data/models/credit_card_theme_selector.dart';
import '../../../data/models/credit_card_themes.dart';
import '../../../g1/g1_helper.dart';
import '../../../shared_prefs_helper.dart';
import '../../logger.dart';
import '../../ui_helpers.dart';
......@@ -153,7 +154,8 @@ class CreditCardMini extends StatelessWidget {
FittedBox(
fit: BoxFit.scaleDown,
child: Text(
'${card.pubKey.substring(0, 4)} ${card.pubKey.substring(4, 8)}',
simplifyPubKey(
extractPublicKey(card.pubKey)),
style:
cardTextStyle(context, fontSize: 16),
)),
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment