refactor: Null safe dependencies

This commit is contained in:
Christian Pauly 2021-04-21 14:19:54 +02:00
parent c6083b6491
commit ca82a46238
34 changed files with 320 additions and 381 deletions

View File

@ -32,30 +32,30 @@ build_web:
paths: paths:
- build/web/ - build/web/
build_windows: #build_windows:
extends: # extends:
- .shared_windows_runners # - .shared_windows_runners
stage: coverage # stage: coverage
script: # script:
# Install chocolately # # Install chocolately
- Set-ExecutionPolicy Bypass -Scope Process # - Set-ExecutionPolicy Bypass -Scope Process
- Set-ExecutionPolicy Bypass -Scope Process -Force; [System.Net.ServicePointManager]::SecurityProtocol = [System.Net.ServicePointManager]::SecurityProtocol -bor 3072; iex ((New-Object System.Net.WebClient).DownloadString('https://chocolatey.org/install.ps1')) # - Set-ExecutionPolicy Bypass -Scope Process -Force; [System.Net.ServicePointManager]::SecurityProtocol = [System.Net.ServicePointManager]::SecurityProtocol -bor 3072; iex ((New-Object System.Net.WebClient).DownloadString('https://chocolatey.org/install.ps1'))
- choco install git -y # - choco install git -y
- choco install visualstudio2019community -y --package-parameters "--add Microsoft.VisualStudio.Product.BuildTools --includeRecommended --includeOptional --passive --locale en-US" # - choco install visualstudio2019community -y --package-parameters "--add Microsoft.VisualStudio.Product.BuildTools --includeRecommended --includeOptional --passive --locale en-US"
- cd ..; git clone https://github.com/flutter/flutter.git -b dev; $env:path += ";C:\GitLab-Runner\builds\famedly\flutter\bin"; cd fluffychat # - cd ..; git clone https://github.com/flutter/flutter.git -b dev; $env:path += ";C:\GitLab-Runner\builds\famedly\flutter\bin"; cd fluffychat
- flutter doctor # - flutter doctor
- flutter config --enable-windows-desktop # - flutter config --enable-windows-desktop
- '$package_override = "`r`ndependency_overrides:`r`n intl: 0.17.0-nullsafety.2"' # - '$package_override = "`r`ndependency_overrides:`r`n intl: 0.17.0-nullsafety.2"'
- '[System.IO.File]::AppendAllText("$CI_PROJECT_DIR/pubspec.yaml", $package_override, [System.Text.Encoding]::UTF8)' # - '[System.IO.File]::AppendAllText("$CI_PROJECT_DIR/pubspec.yaml", $package_override, [System.Text.Encoding]::UTF8)'
- flutter clean # - flutter clean
- flutter pub get # - flutter pub get
- flutter build windows # - flutter build windows
needs: [] # needs: []
artifacts: # artifacts:
paths: # paths:
- build/windows/runner/Release/ # - build/windows/runner/Release/
name: "Binaries" # name: "Binaries"
allow_failure: true # allow_failure: true
build_android_debug: build_android_debug:
stage: coverage stage: coverage
@ -159,34 +159,32 @@ build_linux:
stage: coverage stage: coverage
before_script: before_script:
[ [
sudo apt update && sudo apt install curl clang cmake ninja-build pkg-config libgtk-3-dev libblkid-dev liblzma-dev -y, sudo apt update && sudo apt install curl clang cmake ninja-build pkg-config libgtk-3-dev libblkid-dev liblzma-dev libjsoncpp-dev cmake-data libjsoncpp1 libsecret-1-dev libsecret-1-0 librhash0 -y,
] ]
script: [./scripts/build-linux.sh] script: [./scripts/build-linux.sh]
artifacts: artifacts:
when: on_success when: on_success
paths: paths:
- build/linux/release/bundle/ - build/linux/release/bundle/
allow_failure: true
snap:edge: #snap:edge:
stage: release # stage: release
image: "snapcore/snapcraft" # image: "snapcore/snapcraft"
before_script: # before_script:
- apt update && apt install git curl unzip clang cmake build-essential ninja-build pkg-config libgtk-3-dev libblkid-dev liblzma-dev -y # - apt update && apt install git curl unzip clang cmake build-essential ninja-build pkg-config libgtk-3-dev libblkid-dev liblzma-dev -y
- git clone https://github.com/flutter/flutter.git # - git clone https://github.com/flutter/flutter.git
- export PATH="$PATH:`pwd`/flutter/bin" # - export PATH="$PATH:`pwd`/flutter/bin"
variables: # variables:
SNAPCRAFT_LOGIN_FILE: ${SNAPCRAFT_LOGIN_FILE} # SNAPCRAFT_LOGIN_FILE: ${SNAPCRAFT_LOGIN_FILE}
only: # only:
- main # - main
script: [./scripts/publish-snap-edge.sh] # script: [./scripts/publish-snap-edge.sh]
needs: ["build_linux"] # needs: ["build_linux"]
dependencies: ["build_linux"] # dependencies: ["build_linux"]
artifacts: # artifacts:
paths: # paths:
- "./*.snap" # - "./*.snap"
when: on_success # when: on_success
allow_failure: true
#snap:publish: #snap:publish:
# stage: release # stage: release
@ -202,7 +200,6 @@ snap:edge:
# - "./*.snap" # - "./*.snap"
# when: on_success # when: on_success
# expire_in: 1 week # expire_in: 1 week
# allow_failure: true
update-dependencies: update-dependencies:
stage: coverage stage: coverage

View File

@ -3,29 +3,15 @@ package chat.fluffy.fluffychat
import io.flutter.app.FlutterApplication import io.flutter.app.FlutterApplication
import io.flutter.plugin.common.PluginRegistry import io.flutter.plugin.common.PluginRegistry
import io.flutter.plugin.common.PluginRegistry.PluginRegistrantCallback import io.flutter.plugin.common.PluginRegistry.PluginRegistrantCallback
import io.flutter.plugins.firebasemessaging.FirebaseMessagingPlugin
import io.flutter.view.FlutterMain import io.flutter.view.FlutterMain
import io.flutter.plugins.firebasemessaging.FlutterFirebaseMessagingService
import com.dexterous.flutterlocalnotifications.FlutterLocalNotificationsPlugin
import com.tekartik.sqflite.SqflitePlugin
import com.it_nomads.fluttersecurestorage.FlutterSecureStoragePlugin
import io.flutter.plugins.pathprovider.PathProviderPlugin
class Application : FlutterApplication(), PluginRegistrantCallback { class Application : FlutterApplication(), PluginRegistrantCallback {
override fun onCreate() { override fun onCreate() {
super.onCreate() super.onCreate()
FlutterFirebaseMessagingService.setPluginRegistrant(this);
FlutterMain.startInitialization(this) FlutterMain.startInitialization(this)
} }
override fun registerWith(registry: PluginRegistry?) { override fun registerWith(registry: PluginRegistry?) {
if (!registry!!.hasPlugin("io.flutter.plugins.firebasemessaging")) {
FirebaseMessagingPlugin.registerWith(registry!!.registrarFor("io.flutter.plugins.firebasemessaging.FirebaseMessagingPlugin"));
FlutterLocalNotificationsPlugin.registerWith(registry.registrarFor("com.dexterous.flutterlocalnotifications.FlutterLocalNotificationsPlugin"));
SqflitePlugin.registerWith(registry.registrarFor("com.tekartik.sqflite.SqflitePlugin"));
PathProviderPlugin.registerWith(registry.registrarFor("io.flutter.plugins.pathprovider.PathProviderPlugin"));
FlutterSecureStoragePlugin.registerWith(registry.registrarFor("com.it_nomads.fluttersecurestorage"));
}
} }
} }

View File

@ -0,0 +1,12 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- Modify this file to customize your launch splash screen -->
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
<item android:drawable="?android:colorBackground" />
<!-- You can insert your own image assets here -->
<!-- <item>
<bitmap
android:gravity="center"
android:src="@mipmap/launch_image" />
</item> -->
</layer-list>

View File

@ -6,9 +6,9 @@ buildscript {
} }
dependencies { dependencies {
classpath 'com.android.tools.build:gradle:3.5.4' classpath 'com.android.tools.build:gradle:4.1.0'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version" classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
classpath 'com.google.gms:google-services:4.3.2' classpath 'com.google.gms:google-services:4.3.3'
} }
} }

View File

@ -2,4 +2,4 @@ distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-5.6.2-all.zip distributionUrl=https\://services.gradle.org/distributions/gradle-6.7-all.zip

View File

@ -14,7 +14,7 @@ import 'package:flutter/material.dart';
import 'package:flutter/services.dart'; import 'package:flutter/services.dart';
import 'package:flutter_app_lock/flutter_app_lock.dart'; import 'package:flutter_app_lock/flutter_app_lock.dart';
import 'package:flutter_gen/gen_l10n/l10n.dart'; import 'package:flutter_gen/gen_l10n/l10n.dart';
import 'package:universal_html/prefer_universal/html.dart' as html; import 'package:universal_html/html.dart' as html;
import 'views/widgets/matrix.dart'; import 'views/widgets/matrix.dart';
import 'config/themes.dart'; import 'config/themes.dart';

View File

@ -34,7 +34,6 @@ import 'package:flutter_gen/gen_l10n/l10n.dart';
import 'package:flutter_gen/gen_l10n/l10n_en.dart'; import 'package:flutter_gen/gen_l10n/l10n_en.dart';
import 'package:flutter_local_notifications/flutter_local_notifications.dart'; import 'package:flutter_local_notifications/flutter_local_notifications.dart';
import 'package:path_provider/path_provider.dart'; import 'package:path_provider/path_provider.dart';
import 'package:firebase_messaging/firebase_messaging.dart';
import 'platform_infos.dart'; import 'platform_infos.dart';
import '../config/app_config.dart'; import '../config/app_config.dart';
import '../config/setting_keys.dart'; import '../config/setting_keys.dart';
@ -130,12 +129,7 @@ class BackgroundPush {
bool useDeviceSpecificAppId = false, bool useDeviceSpecificAppId = false,
}) async { }) async {
if (PlatformInfos.isIOS) { if (PlatformInfos.isIOS) {
FirebaseMessaging() await _fcmSharedIsolate.requestPermission();
.requestNotificationPermissions(IosNotificationSettings(
sound: true,
alert: true,
badge: true,
));
} }
final clientName = PlatformInfos.clientName; final clientName = PlatformInfos.clientName;
oldTokens ??= <String>{}; oldTokens ??= <String>{};
@ -355,7 +349,8 @@ class BackgroundPush {
.toString() .toString()
.split('?') .split('?')
.first; .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') { if (res['gateway'] == 'matrix') {
endpoint = url; endpoint = url;
} }
@ -699,7 +694,7 @@ class BackgroundPush {
final url = thumbnail final url = thumbnail
? content.getThumbnail(client, width: width, height: height) ? content.getThumbnail(client, width: width, height: height)
: content.getDownloadLink(client); : content.getDownloadLink(client);
final request = await HttpClient().getUrl(Uri.parse(url)); final request = await HttpClient().getUrl(url);
final response = await request.close(); final response = await request.close();
if (response.statusCode >= 300) { if (response.statusCode >= 300) {
// we are not in the 2xx range // we are not in the 2xx range

View File

@ -8,7 +8,7 @@ Future<Database> constructDb(
String password = ''}) async { String password = ''}) async {
Logs().v('[Moor] Using moor web'); Logs().v('[Moor] Using moor web');
return Database(WebDatabase.withStorage( return Database(WebDatabase.withStorage(
MoorWebStorage.indexedDbIfSupported(filename), await MoorWebStorage.indexedDbIfSupported(filename),
logStatements: logStatements)); logStatements: logStatements));
} }

View File

@ -87,7 +87,7 @@ extension LocalizedBody on Event {
} }
// check if the url is cached // check if the url is cached
final url = Uri.parse(mxcUrl).getDownloadLink(room.client); final url = Uri.parse(mxcUrl).getDownloadLink(room.client);
final file = await DefaultCacheManager().getFileFromCache(url); final file = await DefaultCacheManager().getFileFromCache(url.toString());
return file != null; return file != null;
} }
@ -96,8 +96,8 @@ extension LocalizedBody on Event {
final mxcUrl = attachmentOrThumbnailMxcUrl(getThumbnail: getThumbnail); final mxcUrl = attachmentOrThumbnailMxcUrl(getThumbnail: getThumbnail);
_downloadAndDecryptFutures[mxcUrl] ??= downloadAndDecryptAttachment( _downloadAndDecryptFutures[mxcUrl] ??= downloadAndDecryptAttachment(
getThumbnail: getThumbnail, getThumbnail: getThumbnail,
downloadCallback: (String url) async { downloadCallback: (Uri url) async {
final file = await DefaultCacheManager().getSingleFile(url); final file = await DefaultCacheManager().getSingleFile(url.toString());
return await file.readAsBytes(); return await file.readAsBytes();
}, },
); );

View File

@ -7,7 +7,7 @@ extension FilteredTimelineExtension on Timeline {
final filteredEvents = events final filteredEvents = events
.where((e) => .where((e) =>
// always filter out edit and reaction relationships // always filter out edit and reaction relationships
!{RelationshipTypes.Edit, RelationshipTypes.Reaction} !{RelationshipTypes.edit, RelationshipTypes.reaction}
.contains(e.relationshipType) && .contains(e.relationshipType) &&
// always filter out m.key.* events // always filter out m.key.* events
!e.type.startsWith('m.key.verification.') && !e.type.startsWith('m.key.verification.') &&

View File

@ -6,7 +6,7 @@ import 'package:fluffychat/utils/platform_infos.dart';
import 'package:flutter/foundation.dart'; import 'package:flutter/foundation.dart';
import 'package:open_file/open_file.dart'; import 'package:open_file/open_file.dart';
import 'package:path_provider/path_provider.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:mime_type/mime_type.dart';
import 'package:permission_handler/permission_handler.dart'; import 'package:permission_handler/permission_handler.dart';

View File

@ -22,13 +22,13 @@ abstract class SentryController {
return await storage.getItemBool(SettingKeys.sentry); 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 { static void captureException(error, stackTrace) async {
Logs().e('Capture exception', error, stackTrace); Logs().e('Capture exception', error, stackTrace);
if (!kDebugMode && await getSentryStatus()) { if (!kDebugMode && await getSentryStatus()) {
await sentry.captureException( await sentry.captureException(
exception: error, error,
stackTrace: stackTrace, stackTrace: stackTrace,
); );
} }

View File

@ -3,7 +3,7 @@ import 'dart:io';
import 'package:adaptive_dialog/adaptive_dialog.dart'; import 'package:adaptive_dialog/adaptive_dialog.dart';
import 'package:adaptive_page_layout/adaptive_page_layout.dart'; import 'package:adaptive_page_layout/adaptive_page_layout.dart';
import 'package:emoji_picker/emoji_picker.dart'; import 'package:emoji_picker_flutter/emoji_picker_flutter.dart';
import 'package:famedlysdk/famedlysdk.dart'; import 'package:famedlysdk/famedlysdk.dart';
import 'package:file_picker_cross/file_picker_cross.dart'; import 'package:file_picker_cross/file_picker_cross.dart';
import 'package:fluffychat/config/app_config.dart'; import 'package:fluffychat/config/app_config.dart';
@ -395,7 +395,7 @@ class ChatController extends State<Chat> {
event.sendAgain(); event.sendAgain();
} }
final allEditEvents = event final allEditEvents = event
.aggregatedEvents(timeline, RelationshipTypes.Edit) .aggregatedEvents(timeline, RelationshipTypes.edit)
.where((e) => e.status == -1); .where((e) => e.status == -1);
for (final e in allEditEvents) { for (final e in allEditEvents) {
e.sendAgain(); e.sendAgain();
@ -473,7 +473,7 @@ class ChatController extends State<Chat> {
children: [ children: [
Spacer(), Spacer(),
EmojiPicker( EmojiPicker(
onEmojiSelected: (emoji, category) { onEmojiSelected: (category, emoji) {
// recent emojis don't work, so we sadly have to re-implement them // recent emojis don't work, so we sadly have to re-implement them
// https://github.com/JeffG05/emoji_picker/issues/31 // https://github.com/JeffG05/emoji_picker/issues/31
SharedPreferences.getInstance().then((prefs) { SharedPreferences.getInstance().then((prefs) {
@ -482,7 +482,7 @@ class ChatController extends State<Chat> {
// make sure we remove duplicates // make sure we remove duplicates
prefs.setStringList('recents', recents.toSet().toList()); prefs.setStringList('recents', recents.toSet().toList());
}); });
Navigator.of(context, rootNavigator: false).pop<Emoji>(emoji); Navigator.of(context, rootNavigator: false).pop(emoji);
}, },
), ),
], ],

View File

@ -125,7 +125,7 @@ class ChatListController extends State<ChatList> {
context: context, context: context,
future: () => room.setPushRuleState( future: () => room.setPushRuleState(
room.pushRuleState == PushRuleState.notify room.pushRuleState == PushRuleState.notify
? PushRuleState.mentions_only ? PushRuleState.mentionsOnly
: PushRuleState.notify), : PushRuleState.notify),
); );
} }

View File

@ -15,7 +15,7 @@ import 'package:future_loading_dialog/future_loading_dialog.dart';
import 'package:receive_sharing_intent/receive_sharing_intent.dart'; import 'package:receive_sharing_intent/receive_sharing_intent.dart';
import 'package:url_launcher/url_launcher.dart'; import 'package:url_launcher/url_launcher.dart';
import '../utils/localized_exception_extension.dart'; import '../utils/localized_exception_extension.dart';
import 'package:universal_html/prefer_universal/html.dart' as html; import 'package:universal_html/html.dart' as html;
class HomeserverPicker extends StatefulWidget { class HomeserverPicker extends StatefulWidget {
@override @override

View File

@ -241,8 +241,8 @@ class ChatDetailsUI extends StatelessWidget {
), ),
if (room.canChangeHistoryVisibility) if (room.canChangeHistoryVisibility)
PopupMenuItem<HistoryVisibility>( PopupMenuItem<HistoryVisibility>(
value: HistoryVisibility.world_readable, value: HistoryVisibility.worldReadable,
child: Text(HistoryVisibility.world_readable child: Text(HistoryVisibility.worldReadable
.getLocalizedString( .getLocalizedString(
MatrixLocals(L10n.of(context)))), MatrixLocals(L10n.of(context)))),
), ),
@ -269,9 +269,9 @@ class ChatDetailsUI extends StatelessWidget {
<PopupMenuEntry<GuestAccess>>[ <PopupMenuEntry<GuestAccess>>[
if (room.canChangeGuestAccess) if (room.canChangeGuestAccess)
PopupMenuItem<GuestAccess>( PopupMenuItem<GuestAccess>(
value: GuestAccess.can_join, value: GuestAccess.canJoin,
child: Text( child: Text(
GuestAccess.can_join.getLocalizedString( GuestAccess.canJoin.getLocalizedString(
MatrixLocals(L10n.of(context))), MatrixLocals(L10n.of(context))),
), ),
), ),

View File

@ -431,7 +431,7 @@ class ChatUI extends StatelessWidget {
final emojis = List<String>.from(AppEmojis.emojis); final emojis = List<String>.from(AppEmojis.emojis);
final allReactionEvents = controller.selectedEvents.first final allReactionEvents = controller.selectedEvents.first
.aggregatedEvents( .aggregatedEvents(
controller.timeline, RelationshipTypes.Reaction) controller.timeline, RelationshipTypes.reaction)
?.where((event) => ?.where((event) =>
event.senderId == event.room.client.userID && event.senderId == event.room.client.userID &&
event.type == 'm.reaction'); event.type == 'm.reaction');

View File

@ -425,7 +425,7 @@ class _EmoteImage extends StatelessWidget {
method: ThumbnailMethod.scale, method: ThumbnailMethod.scale,
); );
return CachedNetworkImage( return CachedNetworkImage(
imageUrl: url, imageUrl: url.toString(),
fit: BoxFit.contain, fit: BoxFit.contain,
width: size, width: size,
height: size, height: size,

View File

@ -16,7 +16,7 @@ import 'package:fluffychat/utils/sentry_controller.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter_app_lock/flutter_app_lock.dart'; import 'package:flutter_app_lock/flutter_app_lock.dart';
import 'package:flutter_gen/gen_l10n/l10n.dart'; import 'package:flutter_gen/gen_l10n/l10n.dart';
import 'package:flutter_screen_lock/lock_screen.dart'; import 'package:flutter_screen_lock/functions.dart';
import 'package:flutter_secure_storage/flutter_secure_storage.dart'; import 'package:flutter_secure_storage/flutter_secure_storage.dart';
import 'package:image_picker/image_picker.dart'; import 'package:image_picker/image_picker.dart';
import 'package:url_launcher/url_launcher.dart'; import 'package:url_launcher/url_launcher.dart';
@ -296,11 +296,10 @@ class _SettingsState extends State<Settings> {
await FlutterSecureStorage().read(key: SettingKeys.appLockKey); await FlutterSecureStorage().read(key: SettingKeys.appLockKey);
if (currentLock?.isNotEmpty ?? false) { if (currentLock?.isNotEmpty ?? false) {
var unlocked = false; var unlocked = false;
await showLockScreen( await screenLock(
context: context, context: context,
correctString: currentLock, correctString: currentLock,
onUnlocked: () => unlocked = true, didConfirmed: (_) => unlocked = true,
canBiometric: true,
); );
if (unlocked != true) return; if (unlocked != true) return;
} }

View File

@ -8,7 +8,7 @@ import 'package:fluffychat/views/widgets/message_download_content.dart';
import 'package:flutter/foundation.dart'; import 'package:flutter/foundation.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter_sound_lite/flutter_sound.dart'; import 'package:flutter_sound_lite/flutter_sound.dart';
import 'package:universal_html/prefer_universal/html.dart' as html; import 'package:universal_html/html.dart' as html;
import 'package:flutter_gen/gen_l10n/l10n.dart'; import 'package:flutter_gen/gen_l10n/l10n.dart';
import '../../utils/ui_fake.dart' if (dart.library.html) 'dart:ui' as ui; import '../../utils/ui_fake.dart' if (dart.library.html) 'dart:ui' as ui;
import 'matrix.dart'; import 'matrix.dart';
@ -144,7 +144,8 @@ class _AudioPlayerState extends State<AudioPlayer> {
if (kIsWeb) { if (kIsWeb) {
if (widget.event.content['url'] is String) { if (widget.event.content['url'] is String) {
webSrcUrl = Uri.parse(widget.event.content['url']) webSrcUrl = Uri.parse(widget.event.content['url'])
.getDownloadLink(Matrix.of(context).client); .getDownloadLink(Matrix.of(context).client)
.toString();
return Container( return Container(
height: 50, height: 50,
width: 300, width: 300,

View File

@ -66,7 +66,7 @@ class Avatar extends StatelessWidget {
child: noPic child: noPic
? textWidget ? textWidget
: CachedNetworkImage( : CachedNetworkImage(
imageUrl: src, imageUrl: src.toString(),
fit: BoxFit.cover, fit: BoxFit.cover,
width: size, width: size,
height: size, height: size,

View File

@ -86,7 +86,7 @@ class _ChatSettingsPopupMenuState extends State<ChatSettingsPopupMenu> {
await showFutureLoadingDialog( await showFutureLoadingDialog(
context: context, context: context,
future: () => future: () =>
widget.room.setPushRuleState(PushRuleState.mentions_only)); widget.room.setPushRuleState(PushRuleState.mentionsOnly));
break; break;
case 'unmute': case 'unmute':
await showFutureLoadingDialog( await showFutureLoadingDialog(

View File

@ -53,7 +53,7 @@ class ContentBanner extends StatelessWidget {
opacity: opacity, opacity: opacity,
child: (!loading && mxContent != null) child: (!loading && mxContent != null)
? CachedNetworkImage( ? CachedNetworkImage(
imageUrl: src, imageUrl: src.toString(),
height: 300, height: 300,
fit: BoxFit.cover, fit: BoxFit.cover,
) )

View File

@ -56,13 +56,15 @@ class HtmlMessage extends StatelessWidget {
getMxcUrl: (String mxc, double width, double height, getMxcUrl: (String mxc, double width, double height,
{bool animated = false}) { {bool animated = false}) {
final ratio = MediaQuery.of(context).devicePixelRatio; final ratio = MediaQuery.of(context).devicePixelRatio;
return Uri.parse(mxc)?.getThumbnail( return Uri.parse(mxc)
?.getThumbnail(
matrix.client, matrix.client,
width: (width ?? 800) * ratio, width: (width ?? 800) * ratio,
height: (height ?? 800) * ratio, height: (height ?? 800) * ratio,
method: ThumbnailMethod.scale, method: ThumbnailMethod.scale,
animated: animated, animated: animated,
); )
.toString();
}, },
setCodeLanguage: (String key, String value) async { setCodeLanguage: (String key, String value) async {
await matrix.store.setItem('${SettingKeys.codeLanguage}.$key', value); await matrix.store.setItem('${SettingKeys.codeLanguage}.$key', value);

View File

@ -80,9 +80,10 @@ class _ImageBubbleState extends State<ImageBubble> {
@override @override
void initState() { void initState() {
thumbnailUrl = thumbnailUrl = widget.event
widget.event.getAttachmentUrl(getThumbnail: true, animated: true); .getAttachmentUrl(getThumbnail: true, animated: true)
attachmentUrl = widget.event.getAttachmentUrl(animated: true); .toString();
attachmentUrl = widget.event.getAttachmentUrl(animated: true).toString();
if (thumbnailUrl == null) { if (thumbnailUrl == null) {
_requestFile(getThumbnail: true); _requestFile(getThumbnail: true);
} }
@ -195,12 +196,15 @@ class _ImageBubbleState extends State<ImageBubble> {
_requestedThumbnailOnFailure = true; _requestedThumbnailOnFailure = true;
WidgetsBinding.instance.addPostFrameCallback((_) { WidgetsBinding.instance.addPostFrameCallback((_) {
setState(() { setState(() {
thumbnailUrl = widget.event.getAttachmentUrl( thumbnailUrl = widget.event
.getAttachmentUrl(
getThumbnail: true, getThumbnail: true,
useThumbnailMxcUrl: true, useThumbnailMxcUrl: true,
animated: true); animated: true)
.toString();
attachmentUrl = widget.event attachmentUrl = widget.event
.getAttachmentUrl(useThumbnailMxcUrl: true, animated: true); .getAttachmentUrl(useThumbnailMxcUrl: true, animated: true)
.toString();
}); });
}); });
} }

View File

@ -160,7 +160,7 @@ class InputBar extends StatelessWidget {
crossAxisAlignment: CrossAxisAlignment.center, crossAxisAlignment: CrossAxisAlignment.center,
children: <Widget>[ children: <Widget>[
CachedNetworkImage( CachedNetworkImage(
imageUrl: url, imageUrl: url.toString(),
width: size, width: size,
height: size, height: size,
), ),

View File

@ -92,7 +92,7 @@ class Message extends StatelessWidget {
mainAxisSize: MainAxisSize.min, mainAxisSize: MainAxisSize.min,
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[ children: <Widget>[
if (event.relationshipType == RelationshipTypes.Reply) if (event.relationshipType == RelationshipTypes.reply)
FutureBuilder<Event>( FutureBuilder<Event>(
future: event.getReplyEvent(timeline), future: event.getReplyEvent(timeline),
builder: (BuildContext context, snapshot) { builder: (BuildContext context, snapshot) {
@ -177,7 +177,7 @@ class Message extends StatelessWidget {
children: rowChildren, children: rowChildren,
); );
Widget container; Widget container;
if (event.hasAggregatedEvents(timeline, RelationshipTypes.Reaction)) { if (event.hasAggregatedEvents(timeline, RelationshipTypes.reaction)) {
container = Column( container = Column(
mainAxisSize: MainAxisSize.min, mainAxisSize: MainAxisSize.min,
crossAxisAlignment: crossAxisAlignment:
@ -253,7 +253,7 @@ class _MetaRow extends StatelessWidget {
fontSize: 11 * AppConfig.fontSizeFactor, fontSize: 11 * AppConfig.fontSizeFactor,
), ),
), ),
if (event.hasAggregatedEvents(timeline, RelationshipTypes.Edit)) if (event.hasAggregatedEvents(timeline, RelationshipTypes.edit))
Padding( Padding(
padding: const EdgeInsets.only(left: 2.0), padding: const EdgeInsets.only(left: 2.0),
child: Icon( child: Icon(

View File

@ -1,7 +1,7 @@
import 'package:fluffychat/config/setting_keys.dart'; import 'package:fluffychat/config/setting_keys.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter_app_lock/flutter_app_lock.dart'; import 'package:flutter_app_lock/flutter_app_lock.dart';
import 'package:flutter_screen_lock/lock_screen.dart'; import 'package:flutter_screen_lock/functions.dart';
import 'package:flutter_secure_storage/flutter_secure_storage.dart'; import 'package:flutter_secure_storage/flutter_secure_storage.dart';
class LockScreen extends StatelessWidget { class LockScreen extends StatelessWidget {
@ -17,11 +17,10 @@ class LockScreen extends StatelessWidget {
if (snapshot.connectionState == ConnectionState.done) { if (snapshot.connectionState == ConnectionState.done) {
WidgetsBinding.instance.addPostFrameCallback((_) { WidgetsBinding.instance.addPostFrameCallback((_) {
if (snapshot.data?.isNotEmpty ?? false) { if (snapshot.data?.isNotEmpty ?? false) {
showLockScreen( screenLock(
context: context, context: context,
correctString: snapshot.data, correctString: snapshot.data,
onUnlocked: () => AppLock.of(context).didUnlock(), didConfirmed: (_) => AppLock.of(context).didUnlock(),
canBiometric: true,
canCancel: false, canCancel: false,
); );
} else { } else {

View File

@ -16,7 +16,7 @@ import 'package:flutter_gen/gen_l10n/l10n.dart';
import 'package:flutter_secure_storage/flutter_secure_storage.dart'; import 'package:flutter_secure_storage/flutter_secure_storage.dart';
import 'package:future_loading_dialog/future_loading_dialog.dart'; import 'package:future_loading_dialog/future_loading_dialog.dart';
import 'package:provider/provider.dart'; import 'package:provider/provider.dart';
import 'package:universal_html/prefer_universal/html.dart' as html; import 'package:universal_html/html.dart' as html;
import 'package:http/http.dart' as http; import 'package:http/http.dart' as http;
import 'package:url_launcher/url_launcher.dart'; import 'package:url_launcher/url_launcher.dart';
/*import 'package:fluffychat/views/chat_ui.dart'; /*import 'package:fluffychat/views/chat_ui.dart';
@ -201,7 +201,7 @@ class MatrixState extends State<Matrix> with WidgetsBindingObserver {
html.Notification( html.Notification(
room.getLocalizedDisplayname(MatrixLocals(L10n.of(context))), room.getLocalizedDisplayname(MatrixLocals(L10n.of(context))),
body: body, body: body,
icon: icon, icon: icon.toString(),
); );
} else if (Platform.isLinux) { } else if (Platform.isLinux) {
/*var sessionBus = DBusClient.session(); /*var sessionBus = DBusClient.session();
@ -239,7 +239,7 @@ class MatrixState extends State<Matrix> with WidgetsBindingObserver {
Future<void> initConfig() async { Future<void> initConfig() async {
try { try {
final configJsonString = final configJsonString =
utf8.decode((await http.get('config.json')).bodyBytes); utf8.decode((await http.get(Uri.parse('config.json'))).bodyBytes);
final configJson = json.decode(configJsonString); final configJson = json.decode(configJsonString);
AppConfig.loadFromJson(configJson); AppConfig.loadFromJson(configJson);
} catch (e, s) { } catch (e, s) {

View File

@ -14,7 +14,7 @@ class MessageReactions extends StatelessWidget {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
final allReactionEvents = final allReactionEvents =
event.aggregatedEvents(timeline, RelationshipTypes.Reaction); event.aggregatedEvents(timeline, RelationshipTypes.reaction);
final reactionMap = <String, _ReactionEntry>{}; final reactionMap = <String, _ReactionEntry>{};
for (final e in allReactionEvents) { for (final e in allReactionEvents) {
if (e.content['m.relates_to'].containsKey('key')) { if (e.content['m.relates_to'].containsKey('key')) {
@ -97,7 +97,7 @@ class _Reaction extends StatelessWidget {
mainAxisSize: MainAxisSize.min, mainAxisSize: MainAxisSize.min,
children: <Widget>[ children: <Widget>[
CachedNetworkImage( CachedNetworkImage(
imageUrl: src, imageUrl: src.toString(),
height: fontSize, height: fontSize,
), ),
Container(width: 4), Container(width: 4),

View File

@ -5,12 +5,16 @@
#include "generated_plugin_registrant.h" #include "generated_plugin_registrant.h"
#include <file_chooser/file_chooser_plugin.h> #include <file_chooser/file_chooser_plugin.h>
#include <flutter_secure_storage/flutter_secure_storage_plugin.h>
#include <url_launcher_linux/url_launcher_plugin.h> #include <url_launcher_linux/url_launcher_plugin.h>
void fl_register_plugins(FlPluginRegistry* registry) { void fl_register_plugins(FlPluginRegistry* registry) {
g_autoptr(FlPluginRegistrar) file_chooser_registrar = g_autoptr(FlPluginRegistrar) file_chooser_registrar =
fl_plugin_registry_get_registrar_for_plugin(registry, "FileChooserPlugin"); fl_plugin_registry_get_registrar_for_plugin(registry, "FileChooserPlugin");
file_chooser_plugin_register_with_registrar(file_chooser_registrar); file_chooser_plugin_register_with_registrar(file_chooser_registrar);
g_autoptr(FlPluginRegistrar) flutter_secure_storage_registrar =
fl_plugin_registry_get_registrar_for_plugin(registry, "FlutterSecureStoragePlugin");
flutter_secure_storage_plugin_register_with_registrar(flutter_secure_storage_registrar);
g_autoptr(FlPluginRegistrar) url_launcher_linux_registrar = g_autoptr(FlPluginRegistrar) url_launcher_linux_registrar =
fl_plugin_registry_get_registrar_for_plugin(registry, "UrlLauncherPlugin"); fl_plugin_registry_get_registrar_for_plugin(registry, "UrlLauncherPlugin");
url_launcher_plugin_register_with_registrar(url_launcher_linux_registrar); url_launcher_plugin_register_with_registrar(url_launcher_linux_registrar);

View File

@ -4,6 +4,7 @@
list(APPEND FLUTTER_PLUGIN_LIST list(APPEND FLUTTER_PLUGIN_LIST
file_chooser file_chooser
flutter_secure_storage
url_launcher_linux url_launcher_linux
) )

File diff suppressed because it is too large Load Diff

View File

@ -14,51 +14,44 @@ dependencies:
git: git:
url: https://gitlab.com/famedly/famedlysdk.git url: https://gitlab.com/famedly/famedlysdk.git
ref: main ref: main
unifiedpush: unifiedpush:
git: git:
url: https://github.com/UnifiedPush/flutter-connector.git url: https://github.com/UnifiedPush/flutter-connector.git
ref: 8edc09a87d726d912926ac612e209573452c1273 ref: main
# Firebase Notifications
fcm_shared_isolate: fcm_shared_isolate:
git: git:
url: https://gitlab.com/famedly/libraries/fcm_shared_isolate.git url: https://gitlab.com/famedly/libraries/fcm_shared_isolate.git
ref: ios ref: main
firebase_messaging: any
cupertino_icons: any cupertino_icons: any
localstorage: ^3.0.6+9 localstorage: ^4.0.0+1
file_picker_cross: ^4.2.8 file_picker_cross: ^4.3.2
image_picker: ^0.6.7+21 image_picker: ^0.7.4
url_launcher: ^5.7.10 url_launcher: ^6.0.3
cached_network_image: ^2.5.0 cached_network_image: ^3.0.0
flutter_local_notifications: ^3.0.3 flutter_local_notifications: ^5.0.0+1
adaptive_page_layout: ^0.2.3 adaptive_page_layout: ^0.2.3
provider: ^4.3.3 provider: ^5.0.0
adaptive_theme: ^1.1.0 adaptive_theme: ^2.2.0
# desktop_notifications: ^0.0.0-dev.4 // Currently blocked by: https://github.com/canonical/desktop_notifications.dart/issues/5 # desktop_notifications: ^0.0.0-dev.4 // Currently blocked by: https://github.com/canonical/desktop_notifications.dart/issues/5
matrix_link_text: ^0.3.2 path_provider: ^2.0.1
path_provider: ^1.6.27 android_path_provider: ^0.2.1
android_path_provider: ^0.1.1 permission_handler: ^6.1.3
permission_handler: ^5.0.1+1 share: ^2.0.1
share: ^0.6.5+4 flutter_secure_storage: ^4.1.0
flutter_secure_storage: ^3.3.5 universal_html: ^2.0.8
universal_html: ^1.2.4 receive_sharing_intent: ^1.4.5
receive_sharing_intent: ^1.4.3 flutter_slidable: ^0.6.0
flutter_slidable: ^0.5.7 flutter_sound_lite: ^8.1.1
flutter_sound_lite: ^7.5.3+1 open_file: ^3.2.0
open_file: ^3.0.3 mime_type: ^1.0.0
mime_type: ^0.3.2 adaptive_dialog: ^0.10.0+5
adaptive_dialog: ^0.9.3 flutter_matrix_html: ^0.3.0
flutter_matrix_html: moor: ^4.2.1
git: sqlite3: ^1.0.0
url: https://github.com/Sorunome/flutter_matrix_html.git sqflite: ^2.0.0+3 # Still used to obtain the database location
ref: 6b6a850fcfc3b0a3e88a3dd6beb79eda3acac853 flutter_typeahead: ^3.1.1
moor: ^3.4.0
sqlite3: ^0.1.8
sqflite: ^1.3.2+2 # Still used to obtain the database location
flutter_typeahead: ^2.0.0
flutter_olm: ^1.1.1 flutter_olm: ^1.1.1
flutter_openssl_crypto: ^0.0.1
intl: any intl: any
circular_check_box: ^1.0.4 circular_check_box: ^1.0.4
flutter_localizations: flutter_localizations:
@ -67,34 +60,26 @@ dependencies:
git: git:
url: https://gitlab.com/famedly/libraries/native_imaging.git url: https://gitlab.com/famedly/libraries/native_imaging.git
ref: master ref: master
flutter_blurhash: ^0.5.0 flutter_blurhash: ^0.6.0
sentry: ">=3.0.0 <4.0.0" sentry: ^5.0.0
scroll_to_index: ^1.0.6 scroll_to_index: ^2.0.0
swipe_to_action: ^0.1.0 swipe_to_action: ^0.1.0
flutter_svg: ^0.19.3 flutter_svg: ^0.21.0+1
flutter_cache_manager: ^2.1.1 flutter_cache_manager: ^3.0.1
open_noti_settings: ^0.0.4 open_noti_settings: ^0.1.0
emoji_picker: ^0.1.0 emoji_picker_flutter: ^1.0.3
future_loading_dialog: ^0.1.2 future_loading_dialog: ^0.1.2
package_info: ^0.4.3+2 package_info: ^2.0.0
flutter_app_lock: ^1.4.0+1 flutter_app_lock: ^1.5.0
flutter_screen_lock: ^1.2.6 flutter_screen_lock: ^4.0.3
email_validator: ^1.0.6 email_validator: ^2.0.1
dev_dependencies: dev_dependencies:
flutter_test: flutter_test:
sdk: flutter sdk: flutter
pedantic: ^1.9.2 pedantic: ^1.11.0
dapackages: ^1.4.0 dapackages: ^1.6.0
# The flutter_maths version of flutter_matrix_html is weird and conflicts with a few of our packages.
# So, we have to force-override the dependencies to work out.
dependency_overrides:
provider: ^4.3.3
flutter_svg: ^0.19.3
# Was actually brought in via fcm packages and flutter_matrix_html
quiver: ^2.0.0
flutter: flutter:
generate: true generate: true