Commit ec0cb962 authored by Wilko Manger's avatar Wilko Manger

Upgrade Matrix SDK and remove MatrixImage dep

parent c5776f0b
......@@ -18,14 +18,16 @@
import 'dart:async';
import 'package:firebase_messaging/firebase_messaging.dart';
import 'package:flutter_cache_manager/flutter_cache_manager.dart';
import 'package:flutter_local_notifications/flutter_local_notifications.dart';
import 'package:matrix_image/matrix_image.dart';
import 'package:matrix_sdk/matrix_sdk.dart';
import 'package:pattle/src/di.dart' as di;
import 'package:pattle/src/ui/util/room.dart';
import 'package:pattle/src/ui/util/user.dart';
import 'ui/util/url.dart';
FirebaseMessaging _firebase;
FlutterLocalNotificationsPlugin _notifications;
......@@ -65,12 +67,14 @@ Future<void> _showNotification(Map<String, dynamic> message) async {
final senderName = displayNameOf(event.sender);
final icon = await DefaultCacheManager().getSingleFile(
event.sender.avatarUrl.toThumbnailStringWith(user.homeserver),
);
final senderPerson = Person(
bot: false,
name: senderName,
icon: await MatrixCacheManager(di.getHomeserver()).getPathOf(
event.sender.avatarUrl.toString(),
),
icon: icon.path,
iconSource: IconSource.FilePath,
);
......
......@@ -16,11 +16,11 @@
// along with Pattle. If not, see <https://www.gnu.org/licenses/>.
import 'dart:async';
import 'package:cached_network_image/cached_network_image.dart';
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:future_or_builder/future_or_builder.dart';
import 'package:image_picker/image_picker.dart';
import 'package:matrix_image/matrix_image.dart';
import 'package:matrix_sdk/matrix_sdk.dart';
import 'package:pattle/src/app.dart';
import 'package:pattle/src/ui/main/chat/chat_bloc.dart';
......@@ -38,6 +38,8 @@ import 'package:pattle/src/ui/util/color.dart';
import 'package:pattle/src/di.dart' as di;
import 'package:pattle/src/ui/util/room.dart';
import '../../util/url.dart';
import 'widgets/bubble.dart';
class ChatPageState extends State<ChatPage> {
......@@ -101,11 +103,8 @@ class ChatPageState extends State<ChatPage> {
tag: room.id,
child: CircleAvatar(
backgroundColor: Colors.white,
backgroundImage: MatrixImage(
avatarUrl,
width: 64,
height: 64,
homeserver: di.getHomeserver(),
backgroundImage: CachedNetworkImageProvider(
avatarUrl.toThumbnailString(context),
),
),
);
......
......@@ -15,8 +15,8 @@
//
// You should have received a copy of the GNU Affero General Public License
// along with Pattle. If not, see <https://www.gnu.org/licenses/>.
import 'package:cached_network_image/cached_network_image.dart';
import 'package:flutter/material.dart';
import 'package:matrix_image/matrix_image.dart';
import 'package:matrix_sdk/matrix_sdk.dart';
import 'package:pattle/src/ui/main/chat/image/image_bloc.dart';
import 'package:pattle/src/ui/main/models/chat_item.dart';
......@@ -25,6 +25,7 @@ import 'package:pattle/src/ui/util/user.dart';
import 'package:photo_view/photo_view.dart';
import 'package:photo_view/photo_view_gallery.dart';
import '../../../util/url.dart';
import 'package:pattle/src/di.dart' as di;
class ImagePageState extends State<ImagePage> {
......@@ -111,9 +112,8 @@ class ImagePageState extends State<ImagePage> {
reverse: true,
builder: (context, index) {
return PhotoViewGalleryPageOptions(
imageProvider: MatrixImage(
events[index].content.url,
homeserver: di.getHomeserver(),
imageProvider: CachedNetworkImageProvider(
events[index].content.url.toThumbnailString(context),
),
heroTag: message.id,
minScale: PhotoViewComputedScale.contained,
......
......@@ -14,11 +14,11 @@
//
// You should have received a copy of the GNU Affero General Public License
// along with Pattle. If not, see <https://www.gnu.org/licenses/>.
import 'package:cached_network_image/cached_network_image.dart';
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:flutter/rendering.dart';
import 'package:future_or_builder/future_or_builder.dart';
import 'package:matrix_image/matrix_image.dart';
import 'package:matrix_sdk/matrix_sdk.dart';
import 'package:pattle/src/ui/main/chat/settings/chat_settings_bloc.dart';
import 'package:pattle/src/ui/main/widgets/chat_name.dart';
......@@ -26,6 +26,8 @@ import 'package:pattle/src/ui/main/widgets/user_item.dart';
import 'package:pattle/src/ui/resources/localizations.dart';
import 'package:pattle/src/ui/resources/theme.dart';
import '../../../util/url.dart';
import 'package:pattle/src/di.dart' as di;
import 'package:pattle/src/ui/util/color.dart';
import 'package:pattle/src/ui/util/room.dart';
......@@ -77,12 +79,8 @@ class ChatSettingsPageState extends State<ChatSettingsPage> {
],
),
),
background: Image(
image: MatrixImage(
avatarUrlOf(room),
homeserver: di.getHomeserver(),
),
fit: BoxFit.cover,
background: CachedNetworkImage(
imageUrl: avatarUrlOf(room).toThumbnailString(context),
),
),
),
......
......@@ -15,13 +15,13 @@
// You should have received a copy of the GNU Affero General Public License
// along with Pattle. If not, see <https://www.gnu.org/licenses/>.
import 'package:cached_network_image/cached_network_image.dart';
import 'package:flutter/material.dart';
import 'package:matrix_image/matrix_image.dart';
import 'package:matrix_sdk/matrix_sdk.dart';
import 'package:pattle/src/app.dart';
import 'package:pattle/src/ui/main/models/chat_item.dart';
import 'package:pattle/src/di.dart' as di;
import '../../../util/url.dart';
import 'bubble.dart';
import 'message_bubble.dart';
......@@ -146,11 +146,9 @@ class ImageBubbleState extends MessageBubbleState<ImageBubble> {
borderRadius: borderRadius(),
child: Hero(
tag: widget.event.id,
child: Image(
image: MatrixImage(
widget.event.content.url,
homeserver: di.getHomeserver(),
),
child: CachedNetworkImage(
imageUrl:
widget.event.content.url.toThumbnailString(context),
fit: BoxFit.cover,
),
),
......
......@@ -15,15 +15,16 @@
// You should have received a copy of the GNU Affero General Public License
// along with Pattle. If not, see <https://www.gnu.org/licenses/>.
import 'package:cached_network_image/cached_network_image.dart';
import 'package:flutter/material.dart';
import 'package:matrix_image/matrix_image.dart';
import 'package:matrix_sdk/matrix_sdk.dart';
import 'package:mdi/mdi.dart';
import 'package:pattle/src/ui/resources/theme.dart';
import 'package:pattle/src/ui/util/room.dart';
import 'package:pattle/src/ui/util/user.dart';
import 'package:transparent_image/transparent_image.dart';
import 'package:pattle/src/di.dart' as di;
import '../../../util/url.dart';
class ChatAvatar extends StatelessWidget {
final Room room;
......@@ -43,11 +44,8 @@ class ChatAvatar extends StatelessWidget {
child: FadeInImage(
fit: BoxFit.cover,
placeholder: MemoryImage(kTransparentImage),
image: MatrixImage(
avatarUrl,
width: 64,
height: 64,
homeserver: di.getHomeserver(),
image: CachedNetworkImageProvider(
avatarUrl.toThumbnailString(context),
),
),
),
......
......@@ -15,11 +15,12 @@
// You should have received a copy of the GNU Affero General Public License
// along with Pattle. If not, see <https://www.gnu.org/licenses/>.
import 'package:cached_network_image/cached_network_image.dart';
import 'package:flutter/material.dart';
import 'package:matrix_image/matrix_image.dart';
import 'package:matrix_sdk/matrix_sdk.dart';
import 'package:pattle/src/ui/util/user.dart';
import 'package:pattle/src/di.dart' as di;
import '../../util/url.dart';
class UserAvatar extends StatelessWidget {
final User user;
......@@ -33,11 +34,8 @@ class UserAvatar extends StatelessWidget {
return CircleAvatar(
radius: radius,
backgroundColor: Colors.transparent,
backgroundImage: MatrixImage(
user.avatarUrl,
width: 64,
height: 64,
homeserver: di.getHomeserver(),
backgroundImage: CachedNetworkImageProvider(
user.avatarUrl.toThumbnailString(context),
),
);
} else {
......
// Copyright (C) 2019 Wilko Manger
//
// This file is part of Pattle.
//
// Pattle is free software: you can redistribute it and/or modify
// it under the terms of the GNU Affero General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// Pattle is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Affero General Public License for more details.
//
// You should have received a copy of the GNU Affero General Public License
// along with Pattle. If not, see <https://www.gnu.org/licenses/>.
import 'package:flutter/material.dart';
import 'package:matrix_sdk/matrix_sdk.dart';
import 'package:url/url.dart';
import 'package:pattle/src/di.dart' as di;
extension UrlResolver on Url {
String toThumbnailString(BuildContext context) =>
this.toThumbnailStringWith(di.getHomeserver());
String toThumbnailStringWith(Homeserver homeserver) => homeserver
.resolveThumbnailUrl(
this,
width: 256,
height: 256,
)
.toString();
}
......@@ -36,6 +36,13 @@ packages:
url: "https://pub.dartlang.org"
source: hosted
version: "1.0.5"
cached_network_image:
dependency: "direct main"
description:
name: cached_network_image
url: "https://pub.dartlang.org"
source: hosted
version: "2.0.0-rc.1"
charcode:
dependency: transitive
description:
......@@ -99,6 +106,13 @@ packages:
url: "https://pub.dartlang.org"
source: hosted
version: "1.0.1"
ffi:
dependency: transitive
description:
name: ffi
url: "https://pub.dartlang.org"
source: hosted
version: "0.1.3"
firebase_core:
dependency: "direct main"
description:
......@@ -119,7 +133,7 @@ packages:
source: sdk
version: "0.0.0"
flutter_cache_manager:
dependency: transitive
dependency: "direct main"
description:
name: flutter_cache_manager
url: "https://pub.dartlang.org"
......@@ -241,21 +255,16 @@ packages:
name: matcher
url: "https://pub.dartlang.org"
source: hosted
version: "0.12.5"
matrix_image:
dependency: "direct main"
description:
name: matrix_image
url: "https://pub.dartlang.org"
source: hosted
version: "1.0.5"
version: "0.12.6"
matrix_sdk:
dependency: "direct main"
description:
name: matrix_sdk
url: "https://pub.dartlang.org"
source: hosted
version: "0.27.1"
path: "."
ref: "2270417472417ee16861ca1ce8984852d52e552e"
resolved-ref: "2270417472417ee16861ca1ce8984852d52e552e"
url: "https://git.pattle.im/pattle/library/matrix-dart-sdk.git"
source: git
version: "0.0.0"
matrix_sdk_sqflite:
dependency: "direct main"
description:
......@@ -516,5 +525,5 @@ packages:
source: hosted
version: "2.2.0"
sdks:
dart: ">=2.5.0 <3.0.0"
flutter: ">=1.9.1+hotfix.5 <2.0.0"
dart: ">=2.6.0 <3.0.0"
flutter: ">=1.10.15-pre.148 <2.0.0"
......@@ -2,7 +2,7 @@ name: pattle
description: An easy to use Matrix app.
environment:
sdk: ">=2.1.0 <3.0.0"
sdk: ">=2.6.0 <3.0.0"
dependencies:
flutter:
......@@ -12,10 +12,12 @@ dependencies:
injector: ^1.0.8
matrix_sdk: ^0.27.0
matrix_sdk: ^0.29.0
matrix_sdk_sqflite: ^0.20.0
matrix_image: ^1.0.5
cached_network_image: ^2.0.0-rc.1
flutter_cache_manager: ^1.1.3
future_or_builder: ^1.0.3
sqflite: ^1.1.6
......@@ -66,6 +68,12 @@ dependencies:
flutter_local_notifications: ^0.8.4
dependency_overrides:
matrix_sdk:
git:
url: https://git.pattle.im/pattle/library/matrix-dart-sdk.git
ref: 2270417472417ee16861ca1ce8984852d52e552e
dev_dependencies:
flutter_launcher_icons: ^0.7.2+1
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment