Skip to content

Commit

Permalink
feat(settings): add direct link to documentation for service notifica…
Browse files Browse the repository at this point in the history
…tions
  • Loading branch information
JagandeepBrar committed Mar 30, 2023
1 parent 4e243d6 commit 0f4ac9a
Showing 1 changed file with 21 additions and 14 deletions.
35 changes: 21 additions & 14 deletions lib/modules/settings/routes/notifications/widgets/module_tile.dart
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:lunasea/core.dart';
import 'package:lunasea/extensions/string/links.dart';
import 'package:lunasea/firebase/auth.dart';
import 'package:lunasea/firebase/messaging.dart';
import 'package:lunasea/system/webhooks.dart';
Expand All @@ -21,33 +22,39 @@ class SettingsNotificationsModuleTile extends StatelessWidget {
iconColor: module.color,
bodyText: module.information,
buttons: [
LunaButton.text(
text: 'settings.Device'.tr(),
icon: Icons.devices_rounded,
onTap: () async {
String deviceId = (await LunaFirebaseMessaging().token)!;
await Clipboard.setData(ClipboardData(
text: LunaWebhooks.buildDeviceTokenURL(deviceId, module)));
showLunaInfoSnackBar(
title: 'settings.CopiedURLFor'.tr(args: [module.title]),
message: 'settings.CopiedDeviceURL'.tr(),
);
},
),
if (LunaFirebaseAuth().isSignedIn)
LunaButton.text(
text: 'User',
text: 'settings.User'.tr(),
icon: Icons.person_rounded,
onTap: () async {
if (!LunaFirebaseAuth().isSignedIn) return;
String userId = LunaFirebaseAuth().uid!;
await Clipboard.setData(ClipboardData(
text: LunaWebhooks.buildUserTokenURL(userId, module)));
showLunaInfoSnackBar(
title: 'Copied URL for ${module.title}',
message: 'Copied your user-based URL to the clipboard',
title: 'settings.CopiedURLFor'.tr(args: [module.title]),
message: 'settings.CopiedUserURL'.tr(),
);
},
),
LunaButton.text(
text: 'Device',
icon: Icons.devices_rounded,
onTap: () async {
String deviceId = (await LunaFirebaseMessaging().token)!;
await Clipboard.setData(ClipboardData(
text: LunaWebhooks.buildDeviceTokenURL(deviceId, module)));
showLunaInfoSnackBar(
title: 'Copied URL for ${module.title}',
message: 'Copied your device-based URL to the clipboard',
);
},
text: 'settings.Documentation'.tr(),
icon: LunaIcons.DOCUMENTATION,
color: LunaColours.blue,
onTap: module.webhookDocs!.openLink,
),
],
);
Expand Down

0 comments on commit 0f4ac9a

Please sign in to comment.