mirror of
https://github.com/nostrlabs-io/zap-stream-flutter.git
synced 2025-06-15 11:48:21 +00:00
Compare commits
2 Commits
1575c7dd09
...
f553ecdab3
Author | SHA1 | Date | |
---|---|---|---|
f553ecdab3
|
|||
b7764d82c9
|
@ -1,6 +1,10 @@
|
|||||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
xmlns:tools="http://schemas.android.com/tools">
|
xmlns:tools="http://schemas.android.com/tools">
|
||||||
|
|
||||||
|
<uses-feature
|
||||||
|
android:name="android.hardware.camera"
|
||||||
|
android:required="false" />
|
||||||
|
|
||||||
<uses-permission android:name="android.permission.INTERNET" />
|
<uses-permission android:name="android.permission.INTERNET" />
|
||||||
<uses-permission android:name="android.permission.WAKE_LOCK" />
|
<uses-permission android:name="android.permission.WAKE_LOCK" />
|
||||||
<uses-permission android:name="android.permission.FOREGROUND_SERVICE" />
|
<uses-permission android:name="android.permission.FOREGROUND_SERVICE" />
|
||||||
|
@ -241,7 +241,7 @@ Future<void> _showNotification(
|
|||||||
android: AndroidNotificationDetails(
|
android: AndroidNotificationDetails(
|
||||||
notification.android!.channelId ?? "fcm",
|
notification.android!.channelId ?? "fcm",
|
||||||
"Push Notifications",
|
"Push Notifications",
|
||||||
category: AndroidNotificationCategory.social
|
category: AndroidNotificationCategory.social,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
@ -270,6 +270,11 @@ Future<void> setupNotifications() async {
|
|||||||
|
|
||||||
final signer = ndk.accounts.getLoggedAccount()?.signer;
|
final signer = ndk.accounts.getLoggedAccount()?.signer;
|
||||||
if (signer != null) {
|
if (signer != null) {
|
||||||
|
await configureNotifications(signer);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Future<void> configureNotifications(EventSigner signer) async {
|
||||||
FirebaseMessaging.onMessage.listen(_onNotification);
|
FirebaseMessaging.onMessage.listen(_onNotification);
|
||||||
//FirebaseMessaging.onBackgroundMessage(_onBackgroundNotification);
|
//FirebaseMessaging.onBackgroundMessage(_onBackgroundNotification);
|
||||||
FirebaseMessaging.onMessageOpenedApp.listen(_onOpenMessage);
|
FirebaseMessaging.onMessageOpenedApp.listen(_onOpenMessage);
|
||||||
@ -278,8 +283,7 @@ Future<void> setupNotifications() async {
|
|||||||
provisional: true,
|
provisional: true,
|
||||||
);
|
);
|
||||||
await FirebaseMessaging.instance.setAutoInitEnabled(true);
|
await FirebaseMessaging.instance.setAutoInitEnabled(true);
|
||||||
await FirebaseMessaging.instance
|
await FirebaseMessaging.instance.setForegroundNotificationPresentationOptions(
|
||||||
.setForegroundNotificationPresentationOptions(
|
|
||||||
alert: true,
|
alert: true,
|
||||||
badge: true,
|
badge: true,
|
||||||
sound: true,
|
sound: true,
|
||||||
@ -311,4 +315,3 @@ Future<void> setupNotifications() async {
|
|||||||
settings.authorizationStatus,
|
settings.authorizationStatus,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
@ -27,7 +27,19 @@ class ChatZapWidget extends StatelessWidget {
|
|||||||
crossAxisAlignment: CrossAxisAlignment.start,
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
children: [
|
children: [
|
||||||
_zapperRowZap(context, parsed),
|
_zapperRowZap(context, parsed),
|
||||||
if (parsed.comment?.isNotEmpty ?? false) NoteText(event: zap),
|
if (parsed.comment?.isNotEmpty ?? false)
|
||||||
|
RichText(
|
||||||
|
text: TextSpan(
|
||||||
|
children: textToSpans(
|
||||||
|
context,
|
||||||
|
parsed.comment ?? "",
|
||||||
|
[],
|
||||||
|
parsed.sender ?? "",
|
||||||
|
showEmbeds: false,
|
||||||
|
embedMedia: false,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
|
@ -17,7 +17,8 @@ class _NotificationsButtonWidget extends State<NotificationsButtonWidget> {
|
|||||||
return ValueListenableBuilder(
|
return ValueListenableBuilder(
|
||||||
valueListenable: notifications,
|
valueListenable: notifications,
|
||||||
builder: (context, state, _) {
|
builder: (context, state, _) {
|
||||||
final isNotified = (state?.notifyKeys ?? []).contains(widget.pubkey);
|
if (state == null) return SizedBox();
|
||||||
|
final isNotified = state.notifyKeys.contains(widget.pubkey);
|
||||||
return IconButton(
|
return IconButton(
|
||||||
iconSize: 20,
|
iconSize: 20,
|
||||||
onPressed: () async {
|
onPressed: () async {
|
||||||
|
Reference in New Issue
Block a user