Merge branch 'main' into lenient-permissions
This commit is contained in:
commit
f0ca8af2be
13 changed files with 108 additions and 30 deletions
|
|
@ -298,7 +298,10 @@ class AudioPlayerState extends State<AudioPlayerWidget> {
|
|||
final statusText = this.statusText ??= _durationString ?? '00:00';
|
||||
final audioPlayer = this.audioPlayer;
|
||||
return Padding(
|
||||
padding: const EdgeInsets.all(12.0),
|
||||
// #Pangea
|
||||
// padding: const EdgeInsets.all(12.0),
|
||||
padding: const EdgeInsets.all(5.0),
|
||||
// Pangea#
|
||||
child: Row(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: <Widget>[
|
||||
|
|
@ -332,7 +335,10 @@ class AudioPlayerState extends State<AudioPlayerWidget> {
|
|||
},
|
||||
),
|
||||
),
|
||||
const SizedBox(width: 8),
|
||||
// #Pangea
|
||||
// const SizedBox(width: 8),
|
||||
const SizedBox(width: 5),
|
||||
// Pangea#
|
||||
Row(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: [
|
||||
|
|
@ -368,7 +374,10 @@ class AudioPlayerState extends State<AudioPlayerWidget> {
|
|||
),
|
||||
],
|
||||
),
|
||||
const SizedBox(width: 8),
|
||||
// #Pangea
|
||||
// const SizedBox(width: 8),
|
||||
const SizedBox(width: 5),
|
||||
// Pangea#
|
||||
SizedBox(
|
||||
width: 36,
|
||||
child: Text(
|
||||
|
|
|
|||
|
|
@ -1,21 +1,20 @@
|
|||
import 'dart:io';
|
||||
|
||||
import 'package:flutter/foundation.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
import 'package:chewie/chewie.dart';
|
||||
import 'package:flutter_gen/gen_l10n/l10n.dart';
|
||||
import 'package:matrix/matrix.dart';
|
||||
import 'package:path_provider/path_provider.dart';
|
||||
import 'package:universal_html/html.dart' as html;
|
||||
import 'package:video_player/video_player.dart';
|
||||
|
||||
import 'package:fluffychat/config/app_config.dart';
|
||||
import 'package:fluffychat/pages/chat/events/image_bubble.dart';
|
||||
import 'package:fluffychat/utils/localized_exception_extension.dart';
|
||||
import 'package:fluffychat/utils/matrix_sdk_extensions/event_extension.dart';
|
||||
import 'package:fluffychat/utils/platform_infos.dart';
|
||||
import 'package:fluffychat/widgets/blur_hash.dart';
|
||||
import 'package:flutter/foundation.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_gen/gen_l10n/l10n.dart';
|
||||
import 'package:matrix/matrix.dart';
|
||||
import 'package:path_provider/path_provider.dart';
|
||||
import 'package:universal_html/html.dart' as html;
|
||||
import 'package:video_player/video_player.dart';
|
||||
|
||||
import '../../../utils/error_reporter.dart';
|
||||
|
||||
class EventVideoPlayer extends StatefulWidget {
|
||||
|
|
@ -71,7 +70,7 @@ class EventVideoPlayerState extends State<EventVideoPlayer> {
|
|||
autoInitialize: true,
|
||||
);
|
||||
}
|
||||
} on MatrixConnectionException catch (e) {
|
||||
} on Exception catch (e) {
|
||||
ScaffoldMessenger.of(context).showSnackBar(
|
||||
SnackBar(
|
||||
content: Text(e.toLocalizedString(context)),
|
||||
|
|
|
|||
|
|
@ -504,6 +504,9 @@ class InputBar extends StatelessWidget {
|
|||
onSubmitted!(text);
|
||||
},
|
||||
// #Pangea
|
||||
style: controller?.isMaxLength ?? false
|
||||
? const TextStyle(color: Colors.red)
|
||||
: null,
|
||||
onTap: () {
|
||||
controller!.onInputTap(
|
||||
context,
|
||||
|
|
|
|||
|
|
@ -53,6 +53,25 @@ class _SpaceViewState extends State<SpaceView> {
|
|||
widget.controller.pangeaController.pStoreService.read(_chatCountsKey) ??
|
||||
{},
|
||||
);
|
||||
|
||||
/// Used to filter out sync updates with hierarchy updates for the active
|
||||
/// space so that the view can be auto-reloaded in the room subscription
|
||||
bool hasHierarchyUpdate(SyncUpdate update) {
|
||||
final joinTimeline =
|
||||
update.rooms?.join?[widget.controller.activeSpaceId]?.timeline;
|
||||
final leaveTimeline =
|
||||
update.rooms?.leave?[widget.controller.activeSpaceId]?.timeline;
|
||||
if (joinTimeline == null && leaveTimeline == null) return false;
|
||||
final bool hasJoinUpdate = joinTimeline?.events?.any(
|
||||
(event) => event.type == EventTypes.SpaceChild,
|
||||
) ??
|
||||
false;
|
||||
final bool hasLeaveUpdate = leaveTimeline?.events?.any(
|
||||
(event) => event.type == EventTypes.SpaceChild,
|
||||
) ??
|
||||
false;
|
||||
return hasJoinUpdate || hasLeaveUpdate;
|
||||
}
|
||||
// Pangea#
|
||||
|
||||
@override
|
||||
|
|
@ -78,12 +97,9 @@ class _SpaceViewState extends State<SpaceView> {
|
|||
// Listen for changes to the activeSpace's hierarchy,
|
||||
// and reload the hierarchy when they come through
|
||||
final client = Matrix.of(context).client;
|
||||
_roomSubscription ??= client.onRoomState.stream.where((u) {
|
||||
return u.state.type == EventTypes.SpaceChild &&
|
||||
u.roomId == widget.controller.activeSpaceId;
|
||||
}).listen((update) {
|
||||
loadHierarchy(hasUpdate: true);
|
||||
});
|
||||
_roomSubscription ??= client.onSync.stream
|
||||
.where(hasHierarchyUpdate)
|
||||
.listen((update) => loadHierarchy(hasUpdate: true));
|
||||
// Pangea#
|
||||
super.initState();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,5 +1,6 @@
|
|||
import 'package:fluffychat/pangea/controllers/pangea_controller.dart';
|
||||
import 'package:get_storage/get_storage.dart';
|
||||
import 'package:sentry_flutter/sentry_flutter.dart';
|
||||
|
||||
/// Utility to save and read data both in the matrix profile (this is the default
|
||||
/// behavior) and in the local storage (local needs to be specificied). An
|
||||
|
|
@ -66,6 +67,9 @@ class PStore {
|
|||
|
||||
/// Clears the storage by erasing all data in the box.
|
||||
void clearStorage() {
|
||||
// this could potenitally be interfering with openning database
|
||||
// at the start of the session, which is causing auto log outs on iOS
|
||||
Sentry.addBreadcrumb(Breadcrumb(message: 'Clearing local storage'));
|
||||
_box.erase();
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -44,6 +44,7 @@ class InputBarWrapper extends StatefulWidget {
|
|||
|
||||
class InputBarWrapperState extends State<InputBarWrapper> {
|
||||
StreamSubscription? _choreoSub;
|
||||
String _currentText = '';
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
|
|
@ -61,6 +62,24 @@ class InputBarWrapperState extends State<InputBarWrapper> {
|
|||
super.dispose();
|
||||
}
|
||||
|
||||
void refreshOnChange(String text) {
|
||||
if (widget.onChanged != null) {
|
||||
widget.onChanged!(text);
|
||||
}
|
||||
|
||||
final bool decreasedFromMaxLength =
|
||||
_currentText.length >= PangeaTextController.maxLength &&
|
||||
text.length < PangeaTextController.maxLength;
|
||||
final bool reachedMaxLength =
|
||||
_currentText.length < PangeaTextController.maxLength &&
|
||||
text.length < PangeaTextController.maxLength;
|
||||
|
||||
if (decreasedFromMaxLength || reachedMaxLength) {
|
||||
setState(() {});
|
||||
}
|
||||
_currentText = text;
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return InputBar(
|
||||
|
|
@ -73,7 +92,7 @@ class InputBarWrapperState extends State<InputBarWrapper> {
|
|||
focusNode: widget.focusNode,
|
||||
controller: widget.controller,
|
||||
decoration: widget.decoration,
|
||||
onChanged: widget.onChanged,
|
||||
onChanged: refreshOnChange,
|
||||
autofocus: widget.autofocus,
|
||||
textInputAction: widget.textInputAction,
|
||||
readOnly: widget.readOnly,
|
||||
|
|
|
|||
|
|
@ -25,6 +25,10 @@ class PangeaTextController extends TextEditingController {
|
|||
text ??= '';
|
||||
this.text = text;
|
||||
}
|
||||
|
||||
static const int maxLength = 1000;
|
||||
bool get isMaxLength => text.length == 1000;
|
||||
|
||||
bool forceKeepOpen = false;
|
||||
|
||||
setSystemText(String text, EditType type) {
|
||||
|
|
|
|||
|
|
@ -1,7 +1,6 @@
|
|||
import 'dart:io';
|
||||
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
import 'package:flutter_gen/gen_l10n/l10n.dart';
|
||||
import 'package:matrix/encryption.dart';
|
||||
import 'package:matrix/matrix.dart';
|
||||
|
|
@ -67,9 +66,7 @@ extension LocalizedExceptionExtension on Object {
|
|||
supportedVersions,
|
||||
);
|
||||
}
|
||||
if (this is MatrixConnectionException ||
|
||||
this is SocketException ||
|
||||
this is SyncConnectionException) {
|
||||
if (this is SocketException || this is SyncConnectionException) {
|
||||
return L10n.of(context)!.noConnectionToTheServer;
|
||||
}
|
||||
if (this is String) return toString();
|
||||
|
|
|
|||
|
|
@ -7,6 +7,7 @@ import 'package:flutter/foundation.dart';
|
|||
import 'package:matrix/matrix.dart';
|
||||
import 'package:path/path.dart';
|
||||
import 'package:path_provider/path_provider.dart';
|
||||
import 'package:sentry_flutter/sentry_flutter.dart';
|
||||
import 'package:sqflite_common_ffi/sqflite_ffi.dart';
|
||||
import 'package:universal_html/html.dart' as html;
|
||||
|
||||
|
|
@ -80,6 +81,9 @@ Future<MatrixSdkDatabase> _constructDatabase(Client client) async {
|
|||
}
|
||||
|
||||
final cipher = await getDatabaseCipher();
|
||||
// #Pangea
|
||||
Sentry.addBreadcrumb(Breadcrumb(message: 'Database cipher: $cipher'));
|
||||
// Pangea#
|
||||
|
||||
Directory? fileStorageLocation;
|
||||
try {
|
||||
|
|
@ -97,6 +101,9 @@ Future<MatrixSdkDatabase> _constructDatabase(Client client) async {
|
|||
// import the SQLite / SQLCipher shared objects / dynamic libraries
|
||||
final factory =
|
||||
createDatabaseFactoryFfi(ffiInit: SQfLiteEncryptionHelper.ffiInit);
|
||||
// #Pangea
|
||||
Sentry.addBreadcrumb(Breadcrumb(message: 'Database path: $path'));
|
||||
// Pangea#
|
||||
|
||||
// migrate from potential previous SQLite database path to current one
|
||||
await _migrateLegacyLocation(path, client.clientName);
|
||||
|
|
@ -113,6 +120,9 @@ Future<MatrixSdkDatabase> _constructDatabase(Client client) async {
|
|||
path: path,
|
||||
cipher: cipher,
|
||||
);
|
||||
// #Pangea
|
||||
Sentry.addBreadcrumb(Breadcrumb(message: 'Database cipher helper: $helper'));
|
||||
// Pangea#
|
||||
|
||||
// check whether the DB is already encrypted and otherwise do so
|
||||
await helper?.ensureDatabaseFileEncrypted();
|
||||
|
|
|
|||
|
|
@ -5,6 +5,7 @@ import 'package:fluffychat/config/setting_keys.dart';
|
|||
import 'package:flutter/services.dart';
|
||||
import 'package:flutter_secure_storage/flutter_secure_storage.dart';
|
||||
import 'package:matrix/matrix.dart';
|
||||
import 'package:sentry_flutter/sentry_flutter.dart';
|
||||
import 'package:shared_preferences/shared_preferences.dart';
|
||||
|
||||
const _passwordStorageKey = 'database_password';
|
||||
|
|
@ -58,6 +59,12 @@ void _sendNoEncryptionWarning(Object exception) async {
|
|||
// l10n.noDatabaseEncryption,
|
||||
// exception.toString(),
|
||||
// );
|
||||
Sentry.addBreadcrumb(
|
||||
Breadcrumb(
|
||||
message: 'No database encryption',
|
||||
data: {'exception': exception},
|
||||
),
|
||||
);
|
||||
// Pangea#
|
||||
|
||||
await store.setBool(SettingKeys.noEncryptionWarningShown, true);
|
||||
|
|
|
|||
|
|
@ -344,4 +344,10 @@ class MatrixLocals extends MatrixLocalizations {
|
|||
@override
|
||||
String startedKeyVerification(String senderName) =>
|
||||
l10n.startedKeyVerification(senderName);
|
||||
|
||||
@override
|
||||
String invitedBy(String senderName) {
|
||||
// TODO: implement invitedBy
|
||||
throw UnimplementedError();
|
||||
}
|
||||
}
|
||||
|
|
|
|||
11
pubspec.lock
11
pubspec.lock
|
|
@ -1432,11 +1432,12 @@ packages:
|
|||
matrix:
|
||||
dependency: "direct main"
|
||||
description:
|
||||
name: matrix
|
||||
sha256: bb6de59d0f69e10bb6893130a967f1ffcbfa3d3ffed3864f0736ce3d968e669c
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "0.29.12"
|
||||
path: "."
|
||||
ref: main
|
||||
resolved-ref: "0a95cd8f3cfac8c9b0b59d6ee7fdbdb159949ca3"
|
||||
url: "https://github.com/pangeachat/matrix-dart-sdk.git"
|
||||
source: git
|
||||
version: "0.30.0"
|
||||
meta:
|
||||
dependency: transitive
|
||||
description:
|
||||
|
|
|
|||
|
|
@ -70,7 +70,10 @@ dependencies:
|
|||
keyboard_shortcuts: ^0.1.4
|
||||
latlong2: ^0.9.1
|
||||
linkify: ^5.0.0
|
||||
matrix: ^0.29.12
|
||||
matrix:
|
||||
git:
|
||||
url: https://github.com/pangeachat/matrix-dart-sdk.git # repo
|
||||
ref: main # branch
|
||||
native_imaging: ^0.1.1
|
||||
package_info_plus: ^6.0.0
|
||||
pasteboard: ^0.2.0
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue