Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Tx History: Fix naming of Community Issued Income #1296

Merged
merged 6 commits into from
Jun 19, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions app/lib/config/prod_community.dart
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,8 @@ enum Community {
final String notificationSound;
final ColorScheme colorScheme;
final String cid;

String get name => switch (this) { Community.leu => 'LEU', Community.gbd => 'GBD' };
Eldar2021 marked this conversation as resolved.
Show resolved Hide resolved
}

class Cids {
Expand Down
5 changes: 4 additions & 1 deletion app/lib/l10n/arb/app_de.arb
Original file line number Diff line number Diff line change
Expand Up @@ -172,6 +172,7 @@
"importInvalidRawSeed": "Ungültigen raw seed eingegeben",
"importMustNotBeEmpty": "Eingabe darf nicht leer sein",
"importPrivateKeyUnsupported": "Konto importieren mit privatem Schlüssel wird noch nicht unterstützt",
"incomeIssuance": "Gemeinschaftseinkommen",
"insufficientBalance": "Ungenügender Saldo",
"insufficientFundsErrorBody": "Du hast nicht genügend Geld auf diesem Konto. Schaue auf der Webseite deiner lokalen Gemeinschaft, wie du welches bekommen kannst.",
"insufficientFundsErrorTitle": "Zu wenig Guthaben",
Expand Down Expand Up @@ -354,6 +355,7 @@
"txReady": "Transaktion bereit.",
"txTooLowPriorityErrorBody": "Technischer Transaktionsfehler. Das kann passieren, wenn du zweimal innerhalb sehr kurzer Zeit eine Transaktion abschickst. Bitte warte einige Sekunden.",
"txTooLowPriorityErrorTitle": "Transaktions Prioritätsfehler",
"unknown": "Unbekannt",
"unknownAccount": "Unbekanntes Konto",
"unknownError": "Es ist ein Fehler aufgetreten. Bitte überprüfe deine Internetverbindung und versuche es erneut.",
"unlock": "Du musst deinen PIN eingeben um einen neuen Account hinzuzufügen",
Expand Down Expand Up @@ -403,5 +405,6 @@
"youAreRegisteredAs": "Du hast dich für die nächste Versammlung als {participantType} registriert.",
"youAreAssignedToAGatheringWithNParticipants": "Du bist einer Versammlung mit {participantsCount} Leuten zugewiesen.",
"successfullySentNAttestations": "Du hast erfolgreich Bezeugungen für {participantsCount} andere Leute eingereicht.",
"tokenSend": "{symbol} senden"
"tokenSend": "{symbol} senden",
"communityWithName": "{name} Gemeinschaft"
}
11 changes: 11 additions & 0 deletions app/lib/l10n/arb/app_en.arb
Original file line number Diff line number Diff line change
Expand Up @@ -172,6 +172,7 @@
"importInvalidRawSeed": "Invalid raw seed supplied",
"importMustNotBeEmpty": "Input must not be empty",
"importPrivateKeyUnsupported": "Private key account import is not yet supported.",
"incomeIssuance": "Community income",
"insufficientBalance": "Insufficient balance",
"insufficientFundsErrorBody": "You do not have sufficient funds on this account. See on the website of your local community how to get some.",
"insufficientFundsErrorTitle": "Insufficient Funds",
Expand Down Expand Up @@ -354,6 +355,7 @@
"txReady": "Transaction is ready.",
"txTooLowPriorityErrorBody": "Technical transaction priority error. This can happen if you tap twice on a submit button very quickly. Please wait for a few seconds.",
"txTooLowPriorityErrorTitle": "Transaction priority error",
"unknown": "Unknown",
"unknownAccount": "Unknown account",
"unknownError": "An error occurred. Please check your internet connection and try again.",
"unlock": "You need to enter your PIN to add a new account",
Expand Down Expand Up @@ -539,5 +541,14 @@
"example": "#"
}
}
},
"communityWithName": "{name} Community",
"@communityWithName": {
"placeholders": {
"name": {
"type": "String",
"example": "LEU"
}
}
}
}
5 changes: 4 additions & 1 deletion app/lib/l10n/arb/app_fr.arb
Original file line number Diff line number Diff line change
Expand Up @@ -172,6 +172,7 @@
"importInvalidRawSeed": "Raw seed invalide entré",
"importMustNotBeEmpty": "L'entrée ne peut pas être vide",
"importPrivateKeyUnsupported": "Le compte d'importation avec clé privée n'est pas encore pris en charge",
"incomeIssuance": "Revenu communautaire",
"insufficientBalance": "Solde insuffisant",
"insufficientFundsErrorBody": "Tu n'as pas assez d'argent sur ce compte. Regarde sur le site web de ta communauté locale pour savoir comment en obtenir.",
"insufficientFundsErrorTitle": "Trop peu de crédit",
Expand Down Expand Up @@ -354,6 +355,7 @@
"txReady": "La transaction est prête.",
"txTooLowPriorityErrorBody": "Erreur technique de transaction. Cela peut arriver si tu envoies deux fois une transaction dans un laps de temps très court. Veuillez patienter quelques secondes'.",
"txTooLowPriorityErrorTitle": "Erreur de priorité de transaction",
"unknown": "Inconnu",
"unknownAccount": "Compte inconnu",
"unknownError": "Une erreur est survenue. Vérifie ta connexion Internet et réessaye.",
"unlock": "Tu dois saisir ton code NIP pour ajouter un nouveau compte.",
Expand Down Expand Up @@ -403,5 +405,6 @@
"youAreRegisteredAs": "Tu t'es inscrit comme {participantType} a la prochain rencontre.",
"youAreAssignedToAGatheringWithNParticipants": "Tu es assigné à une rencontre avec des personnes de {participantsCount}.",
"successfullySentNAttestations": "Tu as soumis avec succès des attestations pour {participantsCount} autres personnes.",
"tokenSend": "Envoyer {symbol}"
"tokenSend": "Envoyer {symbol}",
"communityWithName": "Communauté {name}"
}
5 changes: 4 additions & 1 deletion app/lib/l10n/arb/app_ru.arb
Original file line number Diff line number Diff line change
Expand Up @@ -172,6 +172,7 @@
"importInvalidRawSeed": "Предоставлен недопустимый raw seed",
"importMustNotBeEmpty": "Входные данные не должны быть пустыми",
"importPrivateKeyUnsupported": "Импорт аккаунта с помощью секретного ключа пока не поддерживается",
"incomeIssuance": "Доход сообщества",
"insufficientBalance": "Недостаточный баланс",
"insufficientFundsErrorBody": "У вас недостаточно средств на этом аккаунте. Посмотрите на веб-сайте вашего местного сообщества, как их получить.",
"insufficientFundsErrorTitle": "Недостаточно средств",
Expand Down Expand Up @@ -354,6 +355,7 @@
"txReady": "Транзакция готова.",
"txTooLowPriorityErrorBody": "Техническая ошибка приоритета транзакции. Это может произойти, если вы быстро дважды нажмете на кнопку отправки. Пожалуйста, подождите несколько секунд.",
"txTooLowPriorityErrorTitle": "Техническая ошибка приоритета транзакции",
"unknown": "Неизвестный",
"unknownAccount": "Неизвестный аккаунт",
"unknownError": "Извините, произошла ошибка. Пожалуйста, проверьте свое интернет-соединение и попробуйте еще раз.",
"unlock": "Вам необходимо ввести свой PIN-код, чтобы добавить новую учетную запись",
Expand Down Expand Up @@ -403,5 +405,6 @@
"youAreRegisteredAs": "На следующую встречу вы зарегистрированы в качестве {participantType}.",
"youAreAssignedToAGatheringWithNParticipants": "Вы записаны на встречу вместе с {participantsCount} участниками.",
"successfullySentNAttestations": "Вы успешно отправили аттестации {participantsCount} других людей.",
"tokenSend": "Отправить {symbol}"
"tokenSend": "Отправить {symbol}",
"communityWithName": "Сообщество {name}"
}
5 changes: 5 additions & 0 deletions app/lib/models/transfer/transfer_history.dart
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,11 @@ class Transaction {
}
return null;
}

/// If the value of [counterParty] is 'ISSUANCE', the income has been distributed by the community.
/// If the income is provided by the community, the [name] should be displayed as
/// `{CommunityName} Community` and the [address] as `income issuance`.
bool get isIssuance => counterParty == 'ISSUANCE';
Eldar2021 marked this conversation as resolved.
Show resolved Hide resolved
}

/// An enumeration of the transaction types.
Expand Down
11 changes: 8 additions & 3 deletions app/lib/modules/transfer/widgets/transaction_card.dart
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ import 'package:provider/provider.dart';

import 'package:encointer_wallet/common/components/address_icon.dart';
import 'package:encointer_wallet/theme/custom/extension/theme_extension.dart';
import 'package:encointer_wallet/config/prod_community.dart';
import 'package:encointer_wallet/l10n/l10.dart';
import 'package:encointer_wallet/theme/theme.dart';
import 'package:encointer_wallet/models/index.dart';
import 'package:encointer_wallet/utils/format.dart';
Expand All @@ -17,6 +19,7 @@ class TransactionCard extends StatelessWidget {
@override
Widget build(BuildContext context) {
final appStore = context.watch<AppStore>();
final l10n = context.l10n;
return Card(
margin: const EdgeInsets.only(top: 10),
shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(20)),
Expand All @@ -30,7 +33,7 @@ class TransactionCard extends StatelessWidget {
children: [
Icon(
transaction.type == TransactionType.incoming ? Iconsax.receive_square_2 : Iconsax.send_sqaure_2,
color: context.colorScheme.primary,
color: transaction.type == TransactionType.incoming ? Colors.green : const Color(0xffD76D89),
size: 25,
),
const SizedBox(width: 5),
Expand All @@ -48,11 +51,13 @@ class TransactionCard extends StatelessWidget {
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(
transaction.getNameFromContacts(appStore.settings.contactList) ?? 'No Name',
transaction.isIssuance
? l10n.communityWithName(Community.fromCid(appStore.encointer.community?.cid.toFmtString()).name)
: transaction.getNameFromContacts(appStore.settings.contactList) ?? l10n.unknown,
style: context.textTheme.titleMedium!.copyWith(fontWeight: FontWeight.bold),
),
const SizedBox(height: 4),
Text(Fmt.address(transaction.counterParty) ?? ''),
Text(transaction.isIssuance ? l10n.incomeIssuance : Fmt.address(transaction.counterParty) ?? ''),
],
),
Column(
Expand Down