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

fix: update did copy #251

Merged
merged 5 commits into from
Jul 30, 2024
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
6 changes: 3 additions & 3 deletions lib/features/account/account_page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import 'package:didpay/features/pfis/pfis_add_page.dart';
import 'package:didpay/features/pfis/pfis_notifier.dart';
import 'package:didpay/features/vcs/vcs_notifier.dart';
import 'package:didpay/l10n/app_localizations.dart';
import 'package:didpay/shared/modal/modal_remove_item.dart';
import 'package:didpay/shared/modal/modal_manage_item.dart';
import 'package:didpay/shared/theme/grid.dart';
import 'package:didpay/shared/tile_container.dart';
import 'package:flutter/material.dart';
Expand Down Expand Up @@ -146,7 +146,7 @@ class AccountPage extends HookConsumerWidget {
),
child: const Center(child: Icon(Icons.account_balance)),
),
onTap: () => ModalRemoveItem.show(
onTap: () => ModalManageItem.show(
context,
pfi.did,
Loc.of(context).removePfi,
Expand Down Expand Up @@ -229,7 +229,7 @@ class AccountPage extends HookConsumerWidget {
),
child: const Center(child: Icon(Icons.gpp_good)),
),
onTap: () => ModalRemoveItem.show(
onTap: () => ModalManageItem.show(
context,
_getCredentialTitle(credential),
Loc.of(context).removeCredential,
Expand Down
10 changes: 3 additions & 7 deletions lib/features/did/did_qr_code_page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -66,19 +66,15 @@ class DidQrCodePage extends HookConsumerWidget {
trailing: IconButton(
icon: const Icon(Icons.copy),
onPressed: () async {
final didJson = await ref
.read(didServiceProvider)
.getPortableDidJson();
final did = ref.read(didProvider);
await Clipboard.setData(
ClipboardData(
text: didJson ?? 'Error: portable did not found',
),
ClipboardData(text: did.uri),
);
if (context.mounted) {
ScaffoldMessenger.of(context).showSnackBar(
SnackBar(
content: Text(
'Copied portable did',
Loc.of(context).copiedToClipboard,
style: Theme.of(context)
.textTheme
.titleSmall
Expand Down
4 changes: 0 additions & 4 deletions lib/features/did/did_storage_service.dart
Original file line number Diff line number Diff line change
Expand Up @@ -34,10 +34,6 @@ class DidStorageService {
return did;
}

// TODO(ethan-tbd): remove portable did method
Future<String?> getPortableDidJson() async =>
storage.read(key: Constants.portableDidKey);

Future<BearerDid> regenerateDid() async {
await storage.delete(key: Constants.portableDidKey);

Expand Down
3 changes: 2 additions & 1 deletion lib/l10n/app_en.arb
Original file line number Diff line number Diff line change
Expand Up @@ -171,5 +171,6 @@
"areYouSure": "Are you sure?",
"allOfYourCredentialsWillAlsoBeDeleted": "All of your credentials will also be deleted",
"regenerate": "Regenerate",
"goBack": "Go back"
"goBack": "Go back",
"copiedToClipboard": "Copied to clipboard"
}
6 changes: 6 additions & 0 deletions lib/l10n/app_localizations.dart
Original file line number Diff line number Diff line change
Expand Up @@ -894,6 +894,12 @@ abstract class Loc {
/// In en, this message translates to:
/// **'Go back'**
String get goBack;

/// No description provided for @copiedToClipboard.
///
/// In en, this message translates to:
/// **'Copied to clipboard'**
String get copiedToClipboard;
}

class _LocDelegate extends LocalizationsDelegate<Loc> {
Expand Down
3 changes: 3 additions & 0 deletions lib/l10n/app_localizations_en.dart
Original file line number Diff line number Diff line change
Expand Up @@ -415,4 +415,7 @@ class LocEn extends Loc {

@override
String get goBack => 'Go back';

@override
String get copiedToClipboard => 'Copied to clipboard';
}
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import 'package:didpay/shared/theme/grid.dart';
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';

class ModalRemoveItem {
class ModalManageItem {
static Future<dynamic> show(
BuildContext context,
String title,
Expand All @@ -29,7 +29,7 @@ class ModalRemoveItem {
ScaffoldMessenger.of(context).showSnackBar(
SnackBar(
content: Text(
'Copied to clipboard',
Loc.of(context).copiedToClipboard,
style: Theme.of(context)
.textTheme
.titleSmall
Expand Down
Loading