Skip to content

Commit

Permalink
Merge branch 'dev' into zhtlc-resync-no-cancel
Browse files Browse the repository at this point in the history
  • Loading branch information
naezith committed Oct 9, 2023
2 parents 306f6f1 + 9dcd0d1 commit 1647324
Show file tree
Hide file tree
Showing 31 changed files with 53,129 additions and 31,479 deletions.
7,266 changes: 4,594 additions & 2,672 deletions lib/l10n/intl_de.arb

Large diffs are not rendered by default.

7,168 changes: 4,520 additions & 2,648 deletions lib/l10n/intl_es.arb

Large diffs are not rendered by default.

7,266 changes: 4,594 additions & 2,672 deletions lib/l10n/intl_fr.arb

Large diffs are not rendered by default.

7,266 changes: 4,594 additions & 2,672 deletions lib/l10n/intl_hu.arb

Large diffs are not rendered by default.

7,266 changes: 4,594 additions & 2,672 deletions lib/l10n/intl_ja.arb

Large diffs are not rendered by default.

7,266 changes: 4,594 additions & 2,672 deletions lib/l10n/intl_ko.arb

Large diffs are not rendered by default.

7,264 changes: 4,593 additions & 2,671 deletions lib/l10n/intl_messages.arb

Large diffs are not rendered by default.

7,222 changes: 4,570 additions & 2,652 deletions lib/l10n/intl_ru.arb

Large diffs are not rendered by default.

7,230 changes: 4,574 additions & 2,656 deletions lib/l10n/intl_tr.arb

Large diffs are not rendered by default.

7,209 changes: 4,562 additions & 2,647 deletions lib/l10n/intl_uk.arb

Large diffs are not rendered by default.

7,248 changes: 4,585 additions & 2,663 deletions lib/l10n/intl_zh.arb

Large diffs are not rendered by default.

6 changes: 4 additions & 2 deletions lib/l10n/messages_all.dart
Original file line number Diff line number Diff line change
Expand Up @@ -75,8 +75,10 @@ MessageLookupByLibrary _findExact(String localeName) {
/// User programs should call this before using [localeName] for messages.
Future<bool> initializeMessages(String localeName) async {
final availableLocale = Intl.verifiedLocale(
localeName, (locale) => _deferredLibraries[locale] != null,
onFailure: (_) => null);
localeName,
(locale) => _deferredLibraries[locale] != null,
onFailure: (_) => null,
);
if (availableLocale == null) {
return Future.value(false);
}
Expand Down
426 changes: 236 additions & 190 deletions lib/l10n/messages_de.dart

Large diffs are not rendered by default.

400 changes: 216 additions & 184 deletions lib/l10n/messages_es.dart

Large diffs are not rendered by default.

426 changes: 236 additions & 190 deletions lib/l10n/messages_fr.dart

Large diffs are not rendered by default.

425 changes: 235 additions & 190 deletions lib/l10n/messages_hu.dart

Large diffs are not rendered by default.

422 changes: 232 additions & 190 deletions lib/l10n/messages_ja.dart

Large diffs are not rendered by default.

420 changes: 230 additions & 190 deletions lib/l10n/messages_ko.dart

Large diffs are not rendered by default.

425 changes: 234 additions & 191 deletions lib/l10n/messages_messages.dart

Large diffs are not rendered by default.

421 changes: 232 additions & 189 deletions lib/l10n/messages_ru.dart

Large diffs are not rendered by default.

420 changes: 232 additions & 188 deletions lib/l10n/messages_tr.dart

Large diffs are not rendered by default.

417 changes: 230 additions & 187 deletions lib/l10n/messages_uk.dart

Large diffs are not rendered by default.

420 changes: 229 additions & 191 deletions lib/l10n/messages_zh.dart

Large diffs are not rendered by default.

82 changes: 81 additions & 1 deletion lib/localizations.dart
Original file line number Diff line number Diff line change
Expand Up @@ -1266,6 +1266,13 @@ class AppLocalizations {
name: 'weFailedToActivate',
args: [coinAbbr],
);

String failedToCancelActivation(String coinAbbr) => Intl.message(
'Failed to cancel activation of $coinAbbr',
name: 'failedToCancelActivation',
args: [coinAbbr],
);

String isUnavailable(String coinAbbr) => Intl.message(
'$coinAbbr is unavailable :(',
name: 'isUnavailable',
Expand Down Expand Up @@ -1320,6 +1327,11 @@ class AppLocalizations {
Intl.message('Min sell amount is', name: 'multiMinSellAmt');
String get multiInvalidAmt =>
Intl.message('Invalid amount', name: 'multiInvalidAmt');
String invalidCoinAddress(String coin) => Intl.message(
'Invalid $coin address',
args: [coin],
name: 'invalidCoinAddress',
);
String multiActivateGas(String coin) =>
Intl.message('Activate $coin and top-up balance first',
name: 'multiActivateGas', args: <Object>[coin]);
Expand Down Expand Up @@ -1887,11 +1899,79 @@ class AppLocalizations {

// Rebranding
String get rebrandingAnnouncement => Intl.message(
"It's a new era! We have officially changed our name from 'AtomicDEX' to 'Komodo Wallet'",
"It's a new era! We have officially rebranded from 'AtomicDEX' to 'Komodo Wallet'",
name: 'rebrandingAnnouncement');

String get officialPressRelease =>
Intl.message('Official press release', name: 'officialPressRelease');

// --- Asyncronous coin activations (requires syncing)
String shouldScanPastTransaction(String coin) => Intl.message(
'Scan for past $coin transactions?',
name: 'shouldScanPastTransaction',
args: [coin],
);

String get activationCancelled =>
Intl.message('Coin activation cancelled', name: 'activationCancelled');

String coinActivationSuccessfull(String coin) => Intl.message(
'Successfully activated $coin',
name: 'coinActivationSuccessfull',
args: [coin],
);

String coinActivationCancelled(String coin) => Intl.message(
'$coin activation cancelled',
name: 'coinActivationCancelled',
args: [coin],
);

String get pleaseAcceptAllCoinActivationRequests => Intl.message(
'Please accept all special coin activation requests or deselect the coins.',
name: 'pleaseAcceptAllCoinActivationRequests',
);

String get cancelActivation =>
Intl.message('Cancel Activation', name: 'cancelActivation');
String get cancelActivationQuestion => Intl.message(
'Are you sure you want to cancel activation?',
name: 'cancelActivationQuestion',
);
String get cofirmCancelActivation => Intl.message(
'Are you sure you want to cancel activation?',
name: 'cofirmCancelActivation',
);

String syncTransactionsQuestion(String name) => Intl.message(
'Which $name transactions would you like to sync?',
name: 'syncTransactionsQuestion',
args: [name],
);
String get syncNewTransactions =>
Intl.message('Sync new transactions', name: 'syncNewTransactions');
String get syncFromDate =>
Intl.message('Sync from specified date', name: 'syncFromDate');
String get syncFromSaplingActivation => Intl.message(
'Sync from sapling activation',
name: 'syncFromSaplingActivation',
);
String get selectDate => Intl.message('Select a Date', name: 'selectDate');
String get startDate => Intl.message('Start Date', name: 'startDate');
String get futureTransactions => Intl.message(
'We will sync future transactions made after activation associated with your public key. This is the quickest option and takes up the least amount of storage.',
name: 'futureTransactions',
);
String get allPastTransactions => Intl.message(
'Your wallet will show any past transactions. This will take significant storage and time as all blocks will be downloaded and scanned.',
name: 'allPastTransactions',
);
String get pastTransactionsFromDate => Intl.message(
'Your wallet will show your past transactions made after the specified date.',
name: 'pastTransactionsFromDate',
);
// ---

}

class AppLocalizationsDelegate extends LocalizationsDelegate<AppLocalizations> {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -241,7 +241,6 @@ class ZCoinActivationApi {

if (shouldEmitStatus) {
lastEmittedStatus = taskStatus;
// yield taskStatus;
yield taskStatus;
}

Expand Down
31 changes: 19 additions & 12 deletions lib/packages/z_coin_activation/bloc/z_coin_activation_bloc.dart
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ import 'package:komodo_dex/packages/z_coin_activation/bloc/z_coin_activation_sta
import 'package:komodo_dex/packages/z_coin_activation/bloc/z_coin_notifications.dart';
import 'package:komodo_dex/packages/z_coin_activation/models/z_coin_activation_prefs.dart';
import 'package:komodo_dex/packages/z_coin_activation/models/z_coin_status.dart';
import 'package:komodo_dex/utils/log.dart';

// TODO: Localize messages
class ZCoinActivationBloc
extends Bloc<ZCoinActivationEvent, ZCoinActivationState>
with ActivationEta {
Expand Down Expand Up @@ -67,7 +67,7 @@ class ZCoinActivationBloc
onData: (coinStatus) {
if (coinStatus.isFailed) {
return ZCoinActivationFailure(
'Failed to activate ZHTLC coins, please try again later',
ZCoinActivationFailureReason.failedAfterStart,
);
}

Expand Down Expand Up @@ -102,7 +102,7 @@ class ZCoinActivationBloc
);
}
if (coinStatus.isActivated) {
return ZCoinActivationSuccess('Completed ZHTLC activation');
return ZCoinActivationSuccess();
}
return ZCoinActivationInProgess(
progress: shouldShowNewProgress ? overallProgress : lastProgress,
Expand All @@ -112,8 +112,13 @@ class ZCoinActivationBloc
);
},
onError: (e, s) {
debugPrint('Failed to activate coins: $e');
return ZCoinActivationFailure('Failed to activate coins');
Log(
'ZCoinActivationBloc:_handleActivationRequested',
'Failed to activate coins: $e',
);
return ZCoinActivationFailure(
ZCoinActivationFailureReason.failedAfterStart,
);
},
);

Expand All @@ -124,12 +129,14 @@ class ZCoinActivationBloc
// And this emit might remove another important notification
// emit(ZCoinActivationSuccess('ZHTLC coins activation process ended'));
} else {
emit(ZCoinActivationFailure('Failed to activate coins'));
emit(
ZCoinActivationFailure(ZCoinActivationFailureReason.failedAfterStart),
);
}
} catch (e) {
debugPrint('Failed to start activation: $e');
emit(
ZCoinActivationFailure('Failed to start activation'),
ZCoinActivationFailure(ZCoinActivationFailureReason.startFailed),
);
} finally {
await _clearNotification();
Expand All @@ -146,7 +153,7 @@ class ZCoinActivationBloc
} catch (e) {
debugPrint('Failed to set requested coins: $e');
emit(
ZCoinActivationFailure('Failed to set requested coins'),
ZCoinActivationFailure(ZCoinActivationFailureReason.startFailed),
);
}
}
Expand All @@ -169,7 +176,7 @@ class ZCoinActivationBloc
ZCoinActivationState newState;
if (isAllCoinsEnabled) {
newState = isActivationInProgress
? ZCoinActivationSuccess('Activation in progress...')
? ZCoinActivationSuccess()
: ZCoinActivationKnownState(isAllCoinsEnabled);
} else if (isActivationInProgress) {
newState = state as ZCoinActivationInProgess;
Expand All @@ -187,7 +194,7 @@ class ZCoinActivationBloc
} catch (e) {
debugPrint('Failed to get activation status: $e');
emit(
ZCoinActivationFailure('Failed to get activation status'),
ZCoinActivationFailure(ZCoinActivationFailureReason.failedAfterStart),
);
}
}
Expand All @@ -198,11 +205,11 @@ class ZCoinActivationBloc
) async {
try {
await _repository.cancelAllZCoinActivations();
emit(ZCoinActivationFailure('Cancelling ZHTLC activation...'));
emit(ZCoinActivationFailure(ZCoinActivationFailureReason.cancelled));
} catch (e) {
debugPrint('Failed to cancel ZHTLC activation: $e');
emit(
ZCoinActivationFailure('Failed to cancel ZHTLC activation'),
ZCoinActivationFailure(ZCoinActivationFailureReason.failedToCancel),
);
}
}
Expand Down
16 changes: 11 additions & 5 deletions lib/packages/z_coin_activation/bloc/z_coin_activation_state.dart
Original file line number Diff line number Diff line change
Expand Up @@ -34,15 +34,21 @@ class ZCoinActivationInProgess extends ZCoinActivationState {
}

class ZCoinActivationSuccess extends ZCoinActivationState {
ZCoinActivationSuccess(this.message);

final String message;
ZCoinActivationSuccess();
}

class ZCoinActivationFailure extends ZCoinActivationState {
const ZCoinActivationFailure(this.message);
const ZCoinActivationFailure(this.reason);

final String message;
final ZCoinActivationFailureReason reason;
}

enum ZCoinActivationFailureReason {
startFailed,
cancelled,
failedToCancel,
failedAfterStart,
failedOther,
}

class ZCoinActivationStatusLoading extends ZCoinActivationState {}
Expand Down
Loading

0 comments on commit 1647324

Please sign in to comment.