Merge branch 'krille/followup-push' into 'main'
chore: Follow up push See merge request famedly/fluffychat!825
This commit is contained in:
commit
c1d978cb45
|
@ -2,12 +2,9 @@ import 'package:flutter/material.dart';
|
||||||
|
|
||||||
import 'package:collection/collection.dart' show IterableExtension;
|
import 'package:collection/collection.dart' show IterableExtension;
|
||||||
import 'package:flutter_gen/gen_l10n/l10n.dart';
|
import 'package:flutter_gen/gen_l10n/l10n.dart';
|
||||||
import 'package:flutter_local_notifications/flutter_local_notifications.dart';
|
|
||||||
import 'package:future_loading_dialog/future_loading_dialog.dart';
|
import 'package:future_loading_dialog/future_loading_dialog.dart';
|
||||||
import 'package:matrix/matrix.dart';
|
import 'package:matrix/matrix.dart';
|
||||||
import 'package:open_noti_settings/open_noti_settings.dart';
|
|
||||||
|
|
||||||
import 'package:fluffychat/config/app_config.dart';
|
|
||||||
import '../../widgets/matrix.dart';
|
import '../../widgets/matrix.dart';
|
||||||
import 'settings_notifications_view.dart';
|
import 'settings_notifications_view.dart';
|
||||||
|
|
||||||
|
@ -59,19 +56,6 @@ class SettingsNotifications extends StatefulWidget {
|
||||||
}
|
}
|
||||||
|
|
||||||
class SettingsNotificationsController extends State<SettingsNotifications> {
|
class SettingsNotificationsController extends State<SettingsNotifications> {
|
||||||
void openAndroidNotificationSettingsAction() async {
|
|
||||||
await NotificationSetting.configureChannel(
|
|
||||||
const NotificationDetails(
|
|
||||||
android: AndroidNotificationDetails(
|
|
||||||
AppConfig.pushNotificationsChannelId,
|
|
||||||
AppConfig.pushNotificationsChannelName,
|
|
||||||
AppConfig.pushNotificationsChannelDescription,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
);
|
|
||||||
return NotificationSetting.open();
|
|
||||||
}
|
|
||||||
|
|
||||||
bool? getNotificationSetting(NotificationSettingsItem item) {
|
bool? getNotificationSetting(NotificationSettingsItem item) {
|
||||||
final pushRules = Matrix.of(context).client.globalPushRules;
|
final pushRules = Matrix.of(context).client.globalPushRules;
|
||||||
switch (item.type) {
|
switch (item.type) {
|
||||||
|
|
|
@ -1,6 +1,3 @@
|
||||||
import 'dart:io';
|
|
||||||
|
|
||||||
import 'package:flutter/foundation.dart';
|
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
|
|
||||||
import 'package:flutter_gen/gen_l10n/l10n.dart';
|
import 'package:flutter_gen/gen_l10n/l10n.dart';
|
||||||
|
@ -51,17 +48,6 @@ class SettingsNotificationsView extends StatelessWidget {
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
if (!Matrix.of(context).client.allPushNotificationsMuted) ...{
|
if (!Matrix.of(context).client.allPushNotificationsMuted) ...{
|
||||||
if (!kIsWeb && Platform.isAndroid)
|
|
||||||
ListTile(
|
|
||||||
title: Text(L10n.of(context)!.soundVibrationLedColor),
|
|
||||||
trailing: CircleAvatar(
|
|
||||||
backgroundColor:
|
|
||||||
Theme.of(context).scaffoldBackgroundColor,
|
|
||||||
foregroundColor: Colors.grey,
|
|
||||||
child: const Icon(Icons.edit_outlined),
|
|
||||||
),
|
|
||||||
onTap: controller.openAndroidNotificationSettingsAction,
|
|
||||||
),
|
|
||||||
const Divider(thickness: 1),
|
const Divider(thickness: 1),
|
||||||
ListTile(
|
ListTile(
|
||||||
title: Text(
|
title: Text(
|
||||||
|
|
|
@ -3,6 +3,7 @@ import 'dart:ui';
|
||||||
|
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
|
|
||||||
|
import 'package:flutter_cache_manager/flutter_cache_manager.dart';
|
||||||
import 'package:flutter_gen/gen_l10n/l10n.dart';
|
import 'package:flutter_gen/gen_l10n/l10n.dart';
|
||||||
import 'package:flutter_local_notifications/flutter_local_notifications.dart';
|
import 'package:flutter_local_notifications/flutter_local_notifications.dart';
|
||||||
import 'package:matrix/matrix.dart';
|
import 'package:matrix/matrix.dart';
|
||||||
|
@ -37,11 +38,9 @@ Future<void> pushHelper(
|
||||||
// Initialise the plugin. app_icon needs to be a added as a drawable resource to the Android head project
|
// Initialise the plugin. app_icon needs to be a added as a drawable resource to the Android head project
|
||||||
final _flutterLocalNotificationsPlugin = FlutterLocalNotificationsPlugin();
|
final _flutterLocalNotificationsPlugin = FlutterLocalNotificationsPlugin();
|
||||||
await _flutterLocalNotificationsPlugin.initialize(
|
await _flutterLocalNotificationsPlugin.initialize(
|
||||||
InitializationSettings(
|
const InitializationSettings(
|
||||||
android: const AndroidInitializationSettings('notifications_icon'),
|
android: AndroidInitializationSettings('notifications_icon'),
|
||||||
iOS: IOSInitializationSettings(
|
iOS: IOSInitializationSettings(),
|
||||||
onDidReceiveLocalNotification: (i, a, b, c) async => null,
|
|
||||||
),
|
|
||||||
),
|
),
|
||||||
onSelectNotification: onSelectNotification,
|
onSelectNotification: onSelectNotification,
|
||||||
);
|
);
|
||||||
|
@ -79,16 +78,20 @@ Future<void> pushHelper(
|
||||||
// The person object for the android message style notification
|
// The person object for the android message style notification
|
||||||
if (isBackgroundMessage) WidgetsFlutterBinding.ensureInitialized();
|
if (isBackgroundMessage) WidgetsFlutterBinding.ensureInitialized();
|
||||||
final avatar = event.room.avatar?.toString();
|
final avatar = event.room.avatar?.toString();
|
||||||
|
final avatarFile =
|
||||||
|
avatar == null ? null : await DefaultCacheManager().getSingleFile(avatar);
|
||||||
|
|
||||||
final person = Person(
|
final person = Person(
|
||||||
name: event.room.getLocalizedDisplayname(matrixLocals),
|
name: event.room.getLocalizedDisplayname(matrixLocals),
|
||||||
icon: avatar == null ? null : ContentUriAndroidIcon(avatar),
|
icon:
|
||||||
|
avatarFile == null ? null : BitmapFilePathAndroidIcon(avatarFile.path),
|
||||||
);
|
);
|
||||||
|
|
||||||
// Show notification
|
// Show notification
|
||||||
final androidPlatformChannelSpecifics = AndroidNotificationDetails(
|
final androidPlatformChannelSpecifics = AndroidNotificationDetails(
|
||||||
AppConfig.pushNotificationsChannelId,
|
AppConfig.pushNotificationsChannelId,
|
||||||
AppConfig.pushNotificationsChannelName,
|
AppConfig.pushNotificationsChannelName,
|
||||||
AppConfig.pushNotificationsChannelDescription,
|
channelDescription: AppConfig.pushNotificationsChannelDescription,
|
||||||
styleInformation: MessagingStyleInformation(
|
styleInformation: MessagingStyleInformation(
|
||||||
person,
|
person,
|
||||||
conversationTitle: title,
|
conversationTitle: title,
|
||||||
|
|
|
@ -12,6 +12,7 @@ import desktop_lifecycle
|
||||||
import device_info_plus_macos
|
import device_info_plus_macos
|
||||||
import emoji_picker_flutter
|
import emoji_picker_flutter
|
||||||
import file_selector_macos
|
import file_selector_macos
|
||||||
|
import flutter_app_badger
|
||||||
import flutter_local_notifications
|
import flutter_local_notifications
|
||||||
import flutter_secure_storage_macos
|
import flutter_secure_storage_macos
|
||||||
import flutter_web_auth
|
import flutter_web_auth
|
||||||
|
@ -35,6 +36,7 @@ func RegisterGeneratedPlugins(registry: FlutterPluginRegistry) {
|
||||||
DeviceInfoPlusMacosPlugin.register(with: registry.registrar(forPlugin: "DeviceInfoPlusMacosPlugin"))
|
DeviceInfoPlusMacosPlugin.register(with: registry.registrar(forPlugin: "DeviceInfoPlusMacosPlugin"))
|
||||||
EmojiPickerFlutterPlugin.register(with: registry.registrar(forPlugin: "EmojiPickerFlutterPlugin"))
|
EmojiPickerFlutterPlugin.register(with: registry.registrar(forPlugin: "EmojiPickerFlutterPlugin"))
|
||||||
FileSelectorPlugin.register(with: registry.registrar(forPlugin: "FileSelectorPlugin"))
|
FileSelectorPlugin.register(with: registry.registrar(forPlugin: "FileSelectorPlugin"))
|
||||||
|
FlutterAppBadgerPlugin.register(with: registry.registrar(forPlugin: "FlutterAppBadgerPlugin"))
|
||||||
FlutterLocalNotificationsPlugin.register(with: registry.registrar(forPlugin: "FlutterLocalNotificationsPlugin"))
|
FlutterLocalNotificationsPlugin.register(with: registry.registrar(forPlugin: "FlutterLocalNotificationsPlugin"))
|
||||||
FlutterSecureStorageMacosPlugin.register(with: registry.registrar(forPlugin: "FlutterSecureStorageMacosPlugin"))
|
FlutterSecureStorageMacosPlugin.register(with: registry.registrar(forPlugin: "FlutterSecureStorageMacosPlugin"))
|
||||||
FlutterWebAuthPlugin.register(with: registry.registrar(forPlugin: "FlutterWebAuthPlugin"))
|
FlutterWebAuthPlugin.register(with: registry.registrar(forPlugin: "FlutterWebAuthPlugin"))
|
||||||
|
|
18
pubspec.lock
18
pubspec.lock
|
@ -546,14 +546,21 @@ packages:
|
||||||
name: flutter_local_notifications
|
name: flutter_local_notifications
|
||||||
url: "https://pub.dartlang.org"
|
url: "https://pub.dartlang.org"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "8.2.0"
|
version: "9.4.0"
|
||||||
|
flutter_local_notifications_linux:
|
||||||
|
dependency: transitive
|
||||||
|
description:
|
||||||
|
name: flutter_local_notifications_linux
|
||||||
|
url: "https://pub.dartlang.org"
|
||||||
|
source: hosted
|
||||||
|
version: "0.4.2"
|
||||||
flutter_local_notifications_platform_interface:
|
flutter_local_notifications_platform_interface:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
name: flutter_local_notifications_platform_interface
|
name: flutter_local_notifications_platform_interface
|
||||||
url: "https://pub.dartlang.org"
|
url: "https://pub.dartlang.org"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "4.0.1"
|
version: "5.0.0"
|
||||||
flutter_localizations:
|
flutter_localizations:
|
||||||
dependency: "direct main"
|
dependency: "direct main"
|
||||||
description: flutter
|
description: flutter
|
||||||
|
@ -1091,13 +1098,6 @@ packages:
|
||||||
url: "https://pub.dartlang.org"
|
url: "https://pub.dartlang.org"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "2.0.0"
|
version: "2.0.0"
|
||||||
open_noti_settings:
|
|
||||||
dependency: "direct main"
|
|
||||||
description:
|
|
||||||
name: open_noti_settings
|
|
||||||
url: "https://pub.dartlang.org"
|
|
||||||
source: hosted
|
|
||||||
version: "0.4.0"
|
|
||||||
package_config:
|
package_config:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
|
|
|
@ -32,7 +32,7 @@ dependencies:
|
||||||
flutter_app_lock: ^2.0.0
|
flutter_app_lock: ^2.0.0
|
||||||
flutter_blurhash: ^0.6.4
|
flutter_blurhash: ^0.6.4
|
||||||
flutter_cache_manager: ^3.3.0
|
flutter_cache_manager: ^3.3.0
|
||||||
flutter_local_notifications: ^8.2.0
|
flutter_local_notifications: ^9.4.0
|
||||||
flutter_localizations:
|
flutter_localizations:
|
||||||
sdk: flutter
|
sdk: flutter
|
||||||
flutter_map: ^0.14.0
|
flutter_map: ^0.14.0
|
||||||
|
@ -61,7 +61,6 @@ dependencies:
|
||||||
matrix_link_text: ^1.0.2
|
matrix_link_text: ^1.0.2
|
||||||
native_imaging:
|
native_imaging:
|
||||||
git: https://gitlab.com/famedly/company/frontend/libraries/native_imaging.git
|
git: https://gitlab.com/famedly/company/frontend/libraries/native_imaging.git
|
||||||
open_noti_settings: ^0.4.0
|
|
||||||
package_info_plus: ^1.3.0
|
package_info_plus: ^1.3.0
|
||||||
path_provider: ^2.0.9
|
path_provider: ^2.0.9
|
||||||
permission_handler: ^9.2.0
|
permission_handler: ^9.2.0
|
||||||
|
|
Loading…
Reference in New Issue