refactor: Null safe dependencies
This commit is contained in:
parent
16eb370e5f
commit
1a477adcb1
34 changed files with 320 additions and 381 deletions
|
|
@ -34,7 +34,6 @@ import 'package:flutter_gen/gen_l10n/l10n.dart';
|
|||
import 'package:flutter_gen/gen_l10n/l10n_en.dart';
|
||||
import 'package:flutter_local_notifications/flutter_local_notifications.dart';
|
||||
import 'package:path_provider/path_provider.dart';
|
||||
import 'package:firebase_messaging/firebase_messaging.dart';
|
||||
import 'platform_infos.dart';
|
||||
import '../config/app_config.dart';
|
||||
import '../config/setting_keys.dart';
|
||||
|
|
@ -130,12 +129,7 @@ class BackgroundPush {
|
|||
bool useDeviceSpecificAppId = false,
|
||||
}) async {
|
||||
if (PlatformInfos.isIOS) {
|
||||
FirebaseMessaging()
|
||||
.requestNotificationPermissions(IosNotificationSettings(
|
||||
sound: true,
|
||||
alert: true,
|
||||
badge: true,
|
||||
));
|
||||
await _fcmSharedIsolate.requestPermission();
|
||||
}
|
||||
final clientName = PlatformInfos.clientName;
|
||||
oldTokens ??= <String>{};
|
||||
|
|
@ -355,7 +349,8 @@ class BackgroundPush {
|
|||
.toString()
|
||||
.split('?')
|
||||
.first;
|
||||
final res = json.decode(utf8.decode((await http.get(url)).bodyBytes));
|
||||
final res =
|
||||
json.decode(utf8.decode((await http.get(Uri.parse(url))).bodyBytes));
|
||||
if (res['gateway'] == 'matrix') {
|
||||
endpoint = url;
|
||||
}
|
||||
|
|
@ -699,7 +694,7 @@ class BackgroundPush {
|
|||
final url = thumbnail
|
||||
? content.getThumbnail(client, width: width, height: height)
|
||||
: content.getDownloadLink(client);
|
||||
final request = await HttpClient().getUrl(Uri.parse(url));
|
||||
final request = await HttpClient().getUrl(url);
|
||||
final response = await request.close();
|
||||
if (response.statusCode >= 300) {
|
||||
// we are not in the 2xx range
|
||||
|
|
|
|||
|
|
@ -8,7 +8,7 @@ Future<Database> constructDb(
|
|||
String password = ''}) async {
|
||||
Logs().v('[Moor] Using moor web');
|
||||
return Database(WebDatabase.withStorage(
|
||||
MoorWebStorage.indexedDbIfSupported(filename),
|
||||
await MoorWebStorage.indexedDbIfSupported(filename),
|
||||
logStatements: logStatements));
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -87,7 +87,7 @@ extension LocalizedBody on Event {
|
|||
}
|
||||
// check if the url is cached
|
||||
final url = Uri.parse(mxcUrl).getDownloadLink(room.client);
|
||||
final file = await DefaultCacheManager().getFileFromCache(url);
|
||||
final file = await DefaultCacheManager().getFileFromCache(url.toString());
|
||||
return file != null;
|
||||
}
|
||||
|
||||
|
|
@ -96,8 +96,8 @@ extension LocalizedBody on Event {
|
|||
final mxcUrl = attachmentOrThumbnailMxcUrl(getThumbnail: getThumbnail);
|
||||
_downloadAndDecryptFutures[mxcUrl] ??= downloadAndDecryptAttachment(
|
||||
getThumbnail: getThumbnail,
|
||||
downloadCallback: (String url) async {
|
||||
final file = await DefaultCacheManager().getSingleFile(url);
|
||||
downloadCallback: (Uri url) async {
|
||||
final file = await DefaultCacheManager().getSingleFile(url.toString());
|
||||
return await file.readAsBytes();
|
||||
},
|
||||
);
|
||||
|
|
|
|||
|
|
@ -7,7 +7,7 @@ extension FilteredTimelineExtension on Timeline {
|
|||
final filteredEvents = events
|
||||
.where((e) =>
|
||||
// always filter out edit and reaction relationships
|
||||
!{RelationshipTypes.Edit, RelationshipTypes.Reaction}
|
||||
!{RelationshipTypes.edit, RelationshipTypes.reaction}
|
||||
.contains(e.relationshipType) &&
|
||||
// always filter out m.key.* events
|
||||
!e.type.startsWith('m.key.verification.') &&
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@ import 'package:fluffychat/utils/platform_infos.dart';
|
|||
import 'package:flutter/foundation.dart';
|
||||
import 'package:open_file/open_file.dart';
|
||||
import 'package:path_provider/path_provider.dart';
|
||||
import 'package:universal_html/prefer_universal/html.dart' as html;
|
||||
import 'package:universal_html/html.dart' as html;
|
||||
import 'package:mime_type/mime_type.dart';
|
||||
import 'package:permission_handler/permission_handler.dart';
|
||||
|
||||
|
|
|
|||
|
|
@ -22,13 +22,13 @@ abstract class SentryController {
|
|||
return await storage.getItemBool(SettingKeys.sentry);
|
||||
}
|
||||
|
||||
static final sentry = SentryClient(dsn: AppConfig.sentryDns);
|
||||
static final sentry = SentryClient(SentryOptions(dsn: AppConfig.sentryDns));
|
||||
|
||||
static void captureException(error, stackTrace) async {
|
||||
Logs().e('Capture exception', error, stackTrace);
|
||||
if (!kDebugMode && await getSentryStatus()) {
|
||||
await sentry.captureException(
|
||||
exception: error,
|
||||
error,
|
||||
stackTrace: stackTrace,
|
||||
);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue