Skip to content

Commit

Permalink
Merge pull request #134 from CityOfLosAngeles/uncomment-cnctd-svcs
Browse files Browse the repository at this point in the history
Uncomment Connected Services
  • Loading branch information
cbhernan authored Oct 10, 2024
2 parents 982cdea + 06366bb commit e6d3ba7
Show file tree
Hide file tree
Showing 3 changed files with 97 additions and 97 deletions.
4 changes: 2 additions & 2 deletions functions/auth0/api/auth0.js
Original file line number Diff line number Diff line change
Expand Up @@ -172,11 +172,11 @@ export const authMethods = onRequest(async (req, res) => {

const request = await axios.request(config);

// const applications = await getConnectedServices(userId);
const applications = await getConnectedServices(userId);

const response = {
mfaMethods: request.data,
// services: applications.filter((e) => e !== null)
services: applications.filter((e) => e !== null)
}

res.status(200).send(response);
Expand Down
154 changes: 77 additions & 77 deletions lib/views/screens/advanced_security_screen.dart
Original file line number Diff line number Diff line change
Expand Up @@ -353,83 +353,83 @@ class _AdvancedSecurityState extends State<AdvancedSecurityScreen> {
)
]
),
// const SizedBox(height: 25),
// Semantics(
// header: true,
// child: const Text(
// 'Your Connected Services',
// textAlign: TextAlign.left,
// style: headerStyle
// )
// ),
// const SizedBox(height: 10),
// _connectedServices.isEmpty ?
// const Text('No connected services')
// :
// ListView.builder(
// shrinkWrap: true,
// padding: const EdgeInsets.all(0),
// itemCount: _connectedServices.length,
// itemBuilder: (final BuildContext context, final int index) {
// final service = _connectedServices[index];
// return ListTile(
// contentPadding: const EdgeInsets.all(0),
// leading: service.icon.isNotEmpty ? ClipRRect(
// borderRadius: BorderRadius.circular(100),
// child: Image.network(
// semanticLabel: '${service.name} logo',
// service.icon,
// width: 50,
// height: 50,
// ),
// ) : null,
// title: Text(service.name),
// subtitle: Text(service.scope.join(', ').toString()),
// trailing: TextButton(
// key: Key('disconnect_${service.grantId}'),
// onPressed: () => showDialog<int>(
// context: context,
// builder: (final BuildContext context) => AlertDialog(
// title: Text('Revoke consent for ${service.name}?'),
// content: Container(
// width: MediaQuery.of(context).size.width * 0.4,
// child: SingleChildScrollView(
// child: ListBody(
// children: <Widget>[
// // ignore: avoid_escaping_inner_quotes
// // ignore: lines_longer_than_80_chars
// Text('Your Angeleno Account information will no longer be shared with ${service.name}.', style: const TextStyle(fontWeight: FontWeight.bold)),
// const SizedBox(height: 10),
// // ignore: lines_longer_than_80_chars
// Text('The information you already shared with ${service.name} will not be deleted. If you want to delete the information you shared with ${service.name}, you will need to contact ${service.name}.'),
// const SizedBox(height: 10),
// // ignore: lines_longer_than_80_chars
// Text('To access ${service.name} again in the future, you will need to give your consent to share your Angeleno Account information again. You can give consent again by going to the ${service.name} site and logging in.')
// ],
// )
// )
// ),
// actions: <Widget>[
// TextButton(
// child: const Text('Cancel'),
// onPressed: () {
// Navigator.pop(context);
// },
// ),
// TextButton(
// child: const Text('Ok'),
// onPressed: () {
// removeConnection(service.grantId);
// },
// )
// ],
// )
// ),
// child: const Text('Disconnect')
// ),
// );
// }
// )
const SizedBox(height: 25),
Semantics(
header: true,
child: const Text(
'Your Connected Services',
textAlign: TextAlign.left,
style: headerStyle
)
),
const SizedBox(height: 10),
_connectedServices.isEmpty ?
const Text('No connected services')
:
ListView.builder(
shrinkWrap: true,
padding: const EdgeInsets.all(0),
itemCount: _connectedServices.length,
itemBuilder: (final BuildContext context, final int index) {
final service = _connectedServices[index];
return ListTile(
contentPadding: const EdgeInsets.all(0),
leading: service.icon.isNotEmpty ? ClipRRect(
borderRadius: BorderRadius.circular(100),
child: Image.network(
semanticLabel: '${service.name} logo',
service.icon,
width: 50,
height: 50,
),
) : null,
title: Text(service.name),
subtitle: Text(service.scope.join(', ').toString()),
trailing: TextButton(
key: Key('disconnect_${service.grantId}'),
onPressed: () => showDialog<int>(
context: context,
builder: (final BuildContext context) => AlertDialog(
title: Text('Revoke consent for ${service.name}?'),
content: Container(
width: MediaQuery.of(context).size.width * 0.4,
child: SingleChildScrollView(
child: ListBody(
children: <Widget>[
// ignore: avoid_escaping_inner_quotes
// ignore: lines_longer_than_80_chars
Text('Your Angeleno Account information will no longer be shared with ${service.name}.', style: const TextStyle(fontWeight: FontWeight.bold)),
const SizedBox(height: 10),
// ignore: lines_longer_than_80_chars
Text('The information you already shared with ${service.name} will not be deleted. If you want to delete the information you shared with ${service.name}, you will need to contact ${service.name}.'),
const SizedBox(height: 10),
// ignore: lines_longer_than_80_chars
Text('To access ${service.name} again in the future, you will need to give your consent to share your Angeleno Account information again. You can give consent again by going to the ${service.name} site and logging in.')
],
)
)
),
actions: <Widget>[
TextButton(
child: const Text('Cancel'),
onPressed: () {
Navigator.pop(context);
},
),
TextButton(
child: const Text('Ok'),
onPressed: () {
removeConnection(service.grantId);
},
)
],
)
),
child: const Text('Disconnect')
),
);
}
)
],
)
)
Expand Down
36 changes: 18 additions & 18 deletions test/advanced_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -290,23 +290,23 @@ void main() {
expect(find.byKey(const Key('enableSMS')), findsOneWidget);
expect(find.byKey(const Key('disableVoice')), findsOneWidget);

// await tester.tap(find.byKey(const Key('disconnect_123')));
// await tester.pumpAndSettle();
//
// expect(find.byType(AlertDialog), findsOneWidget);
//
// await tester.tap(find.text('Cancel'));
// await tester.pumpAndSettle();
//
// expect(find.byType(AlertDialog), findsNothing);
//
// await tester.tap(find.byKey(const Key('disconnect_123')));
// await tester.pumpAndSettle();
//
// await tester.tap(find.text('Ok'));
// await tester.pumpAndSettle();
//
// expect(find.byType(SnackBar), findsOneWidget);
// expect(find.byKey(const Key('disconnect_123')), findsNothing);
await tester.tap(find.byKey(const Key('disconnect_123')));
await tester.pumpAndSettle();

expect(find.byType(AlertDialog), findsOneWidget);

await tester.tap(find.text('Cancel'));
await tester.pumpAndSettle();

expect(find.byType(AlertDialog), findsNothing);

await tester.tap(find.byKey(const Key('disconnect_123')));
await tester.pumpAndSettle();

await tester.tap(find.text('Ok'));
await tester.pumpAndSettle();

expect(find.byType(SnackBar), findsOneWidget);
expect(find.byKey(const Key('disconnect_123')), findsNothing);
});
}

0 comments on commit e6d3ba7

Please sign in to comment.