Merge branch 'develop' into develop-moreEmojiReactions
This commit is contained in:
commit
0a577b5f48
@ -6,12 +6,14 @@ part 'addFeedbackParams.g.dart';
|
|||||||
class AddFeedbackParams {
|
class AddFeedbackParams {
|
||||||
String user;
|
String user;
|
||||||
String feedback;
|
String feedback;
|
||||||
|
String? screenshot;
|
||||||
int appVersion;
|
int appVersion;
|
||||||
|
|
||||||
|
|
||||||
AddFeedbackParams({
|
AddFeedbackParams({
|
||||||
required this.user,
|
required this.user,
|
||||||
required this.feedback,
|
required this.feedback,
|
||||||
|
this.screenshot,
|
||||||
required this.appVersion,
|
required this.appVersion,
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -10,6 +10,7 @@ AddFeedbackParams _$AddFeedbackParamsFromJson(Map<String, dynamic> json) =>
|
|||||||
AddFeedbackParams(
|
AddFeedbackParams(
|
||||||
user: json['user'] as String,
|
user: json['user'] as String,
|
||||||
feedback: json['feedback'] as String,
|
feedback: json['feedback'] as String,
|
||||||
|
screenshot: json['screenshot'] as String?,
|
||||||
appVersion: json['appVersion'] as int,
|
appVersion: json['appVersion'] as int,
|
||||||
);
|
);
|
||||||
|
|
||||||
@ -17,5 +18,6 @@ Map<String, dynamic> _$AddFeedbackParamsToJson(AddFeedbackParams instance) =>
|
|||||||
<String, dynamic>{
|
<String, dynamic>{
|
||||||
'user': instance.user,
|
'user': instance.user,
|
||||||
'feedback': instance.feedback,
|
'feedback': instance.feedback,
|
||||||
|
'screenshot': instance.screenshot,
|
||||||
'appVersion': instance.appVersion,
|
'appVersion': instance.appVersion,
|
||||||
};
|
};
|
||||||
|
@ -14,6 +14,7 @@ import 'api/mhsl/server/userIndex/update/updateUserindex.dart';
|
|||||||
import 'model/breakers/Breaker.dart';
|
import 'model/breakers/Breaker.dart';
|
||||||
import 'model/breakers/BreakerProps.dart';
|
import 'model/breakers/BreakerProps.dart';
|
||||||
import 'model/chatList/chatListProps.dart';
|
import 'model/chatList/chatListProps.dart';
|
||||||
|
import 'model/dataCleaner.dart';
|
||||||
import 'model/timetable/timetableProps.dart';
|
import 'model/timetable/timetableProps.dart';
|
||||||
import 'notification/notificationController.dart';
|
import 'notification/notificationController.dart';
|
||||||
import 'notification/notificationTasks.dart';
|
import 'notification/notificationTasks.dart';
|
||||||
@ -87,6 +88,8 @@ class _AppState extends State<App> with WidgetsBindingObserver {
|
|||||||
FirebaseMessaging.onMessageOpenedApp.listen((message) => NotificationController.onAppOpenedByNotification(message, context));
|
FirebaseMessaging.onMessageOpenedApp.listen((message) => NotificationController.onAppOpenedByNotification(message, context));
|
||||||
FirebaseMessaging.instance.getInitialMessage().then((message) => message == null ? null : NotificationController.onAppOpenedByNotification(message, context));
|
FirebaseMessaging.instance.getInitialMessage().then((message) => message == null ? null : NotificationController.onAppOpenedByNotification(message, context));
|
||||||
|
|
||||||
|
DataCleaner.cleanOldCache();
|
||||||
|
|
||||||
super.initState();
|
super.initState();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
15
lib/model/dataCleaner.dart
Normal file
15
lib/model/dataCleaner.dart
Normal file
@ -0,0 +1,15 @@
|
|||||||
|
import 'package:localstore/localstore.dart';
|
||||||
|
|
||||||
|
import '../widget/debug/cacheView.dart';
|
||||||
|
|
||||||
|
class DataCleaner {
|
||||||
|
static void cleanOldCache() async {
|
||||||
|
var cacheData = await Localstore.instance.collection(CacheView.collection).get();
|
||||||
|
cacheData?.forEach((key, value) async {
|
||||||
|
DateTime lastUpdate = DateTime.fromMillisecondsSinceEpoch(value['lastupdate']);
|
||||||
|
if(DateTime.now().subtract(const Duration(days: 200)).isAfter(lastUpdate)) {
|
||||||
|
await Localstore.instance.collection(CacheView.collection).doc(key.split('/').last).delete();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
@ -1,10 +1,20 @@
|
|||||||
|
|
||||||
|
import 'dart:convert';
|
||||||
|
import 'dart:typed_data';
|
||||||
|
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
|
import 'package:image_picker/image_picker.dart';
|
||||||
|
import 'package:loader_overlay/loader_overlay.dart';
|
||||||
import 'package:package_info/package_info.dart';
|
import 'package:package_info/package_info.dart';
|
||||||
|
import 'package:provider/provider.dart';
|
||||||
|
import 'package:badges/badges.dart' as badges;
|
||||||
|
|
||||||
import '../../../../api/mhsl/server/feedback/addFeedback.dart';
|
import '../../../../api/mhsl/server/feedback/addFeedback.dart';
|
||||||
import '../../../../api/mhsl/server/feedback/addFeedbackParams.dart';
|
import '../../../../api/mhsl/server/feedback/addFeedbackParams.dart';
|
||||||
import '../../../../model/accountData.dart';
|
import '../../../../model/accountData.dart';
|
||||||
|
import '../../../../storage/base/settingsProvider.dart';
|
||||||
|
import '../../../../widget/filePick.dart';
|
||||||
|
import '../../../../widget/focusBehaviour.dart';
|
||||||
import '../../../../widget/infoDialog.dart';
|
import '../../../../widget/infoDialog.dart';
|
||||||
|
|
||||||
class FeedbackDialog extends StatefulWidget {
|
class FeedbackDialog extends StatefulWidget {
|
||||||
@ -15,64 +25,151 @@ class FeedbackDialog extends StatefulWidget {
|
|||||||
}
|
}
|
||||||
|
|
||||||
class _FeedbackDialogState extends State<FeedbackDialog> {
|
class _FeedbackDialogState extends State<FeedbackDialog> {
|
||||||
|
final ImagePicker picker = ImagePicker();
|
||||||
|
|
||||||
final TextEditingController _feedbackInput = TextEditingController();
|
final TextEditingController _feedbackInput = TextEditingController();
|
||||||
|
Uint8List? _image;
|
||||||
String? _error;
|
String? _error;
|
||||||
|
bool _textFieldEmpty = false;
|
||||||
|
|
||||||
|
@override
|
||||||
|
void initState() {
|
||||||
|
super.initState();
|
||||||
|
_feedbackInput.addListener(() {
|
||||||
|
setState(() {
|
||||||
|
_textFieldEmpty = _feedbackInput.text.isEmpty;
|
||||||
|
_error = null;
|
||||||
|
});
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
return AlertDialog(
|
return Scaffold(
|
||||||
|
appBar: AppBar(
|
||||||
title: const Text('Feedback'),
|
title: const Text('Feedback'),
|
||||||
content: Column(
|
),
|
||||||
mainAxisSize: MainAxisSize.min,
|
body: Column(
|
||||||
|
mainAxisSize: MainAxisSize.max,
|
||||||
children: [
|
children: [
|
||||||
const Text('Feedback, Anregungen, Ideen, Fehler und Verbesserungen'),
|
const SizedBox(height: 5),
|
||||||
const SizedBox(height: 10),
|
const Text('Feedback, Anregungen, Ideen, Fehler und Verbesserungen', textAlign: TextAlign.center),
|
||||||
const Text('Bitte gib keine geheimen Daten wie z.B. Passwörter weiter.', style: TextStyle(fontSize: 10)),
|
const SizedBox(height: 15),
|
||||||
const SizedBox(height: 10),
|
const Text('Bitte gib keine geheimen Daten wie z.B. Passwörter weiter.', textAlign: TextAlign.center, style: TextStyle(fontSize: 11)),
|
||||||
TextField(
|
const SizedBox(height: 20),
|
||||||
|
Padding(
|
||||||
|
padding: const EdgeInsets.all(10),
|
||||||
|
child: TextField(
|
||||||
controller: _feedbackInput,
|
controller: _feedbackInput,
|
||||||
autofocus: true,
|
autofocus: true,
|
||||||
decoration: const InputDecoration(
|
decoration: InputDecoration(
|
||||||
border: OutlineInputBorder(),
|
border: const OutlineInputBorder(),
|
||||||
label: Text('Feedback und Verbesserungen')
|
label: const Text('Feedback und Verbesserungen'),
|
||||||
|
errorText: _textFieldEmpty ? 'Bitte gib eine Beschreibung an' : null,
|
||||||
),
|
),
|
||||||
// style: TextStyle(),
|
minLines: 4,
|
||||||
// expands: true,
|
maxLines: 7,
|
||||||
minLines: 3,
|
onTapOutside: (PointerDownEvent event) => FocusBehaviour.textFieldTapOutside(context),
|
||||||
maxLines: 5,
|
),
|
||||||
|
),
|
||||||
|
const SizedBox(height: 10),
|
||||||
|
if(_image != null) Row(
|
||||||
|
mainAxisAlignment: MainAxisAlignment.center,
|
||||||
|
children: [
|
||||||
|
badges.Badge(
|
||||||
|
badgeContent: const Icon(Icons.close_outlined, size: 17),
|
||||||
|
badgeStyle: const badges.BadgeStyle(
|
||||||
|
padding: EdgeInsets.all(2),
|
||||||
|
),
|
||||||
|
child: Container(
|
||||||
|
decoration: BoxDecoration(
|
||||||
|
borderRadius: const BorderRadius.all(Radius.circular(5)),
|
||||||
|
border: Border.all(
|
||||||
|
width: 3,
|
||||||
|
color: Theme.of(context).primaryColor,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
height: 150,
|
||||||
|
child: Image(
|
||||||
|
image: Image.memory(_image!).image,
|
||||||
|
fit: BoxFit.contain,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
onTap: () async {
|
||||||
|
setState(() {
|
||||||
|
_image = null;
|
||||||
|
});
|
||||||
|
},
|
||||||
),
|
),
|
||||||
Visibility(
|
|
||||||
visible: _error != null,
|
|
||||||
child: Text('Senden fehlgeschlagen: $_error', style: const TextStyle(color: Colors.red))
|
|
||||||
)
|
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
actions: [
|
Padding(
|
||||||
TextButton(onPressed: () => Navigator.of(context).pop(), child: const Text('Abbrechen')),
|
padding: const EdgeInsets.all(5),
|
||||||
|
child: Visibility(
|
||||||
|
visible: _error != null,
|
||||||
|
child: Visibility(
|
||||||
|
visible: Provider.of<SettingsProvider>(context, listen: false).val().devToolsEnabled,
|
||||||
|
replacement: const Text('Senden fehlgeschlagen, bitte überprüfe die Internetverbindung.', textAlign: TextAlign.center, style: TextStyle(color: Colors.red)),
|
||||||
|
child: Text('Senden fehlgeschlagen: \n $_error', textAlign: TextAlign.center, style: const TextStyle(color: Colors.red)),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
Padding(
|
||||||
|
padding: const EdgeInsets.only(right: 20, left: 10),
|
||||||
|
child: Row(
|
||||||
|
mainAxisAlignment: MainAxisAlignment.end,
|
||||||
|
children: [
|
||||||
|
Visibility(
|
||||||
|
visible: _image == null,
|
||||||
|
child: IconButton(
|
||||||
|
onPressed: () async {
|
||||||
|
context.loaderOverlay.show();
|
||||||
|
var imageData = await (await FilePick.galleryPick())?.readAsBytes();
|
||||||
|
context.loaderOverlay.hide();
|
||||||
|
setState(() {
|
||||||
|
_image = imageData;
|
||||||
|
});
|
||||||
|
},
|
||||||
|
icon: const Icon(Icons.attach_file_outlined),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
const Expanded(child: SizedBox.shrink()),
|
||||||
TextButton(
|
TextButton(
|
||||||
onPressed: () async {
|
onPressed: () async {
|
||||||
|
if(_feedbackInput.text.isEmpty){
|
||||||
|
setState(() {
|
||||||
|
_textFieldEmpty = true;
|
||||||
|
});
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
context.loaderOverlay.show();
|
||||||
AddFeedback(
|
AddFeedback(
|
||||||
AddFeedbackParams(
|
AddFeedbackParams(
|
||||||
user: AccountData().getUserSecret(),
|
user: AccountData().getUserSecret(),
|
||||||
feedback: _feedbackInput.text,
|
feedback: _feedbackInput.text,
|
||||||
appVersion: int.parse((await PackageInfo.fromPlatform()).buildNumber)
|
screenshot: _image != null ? base64Encode(_image!) : null,
|
||||||
|
appVersion: int.parse((await PackageInfo.fromPlatform()).buildNumber),
|
||||||
)
|
)
|
||||||
)
|
).run().then((value) {
|
||||||
.run()
|
|
||||||
.then((value) {
|
|
||||||
Navigator.of(context).pop();
|
Navigator.of(context).pop();
|
||||||
InfoDialog.show(context, 'Danke für dein Feedback!');
|
InfoDialog.show(context, 'Danke für dein Feedback!');
|
||||||
})
|
context.loaderOverlay.hide();
|
||||||
.catchError((error, trace) {
|
}).catchError((error, trace) {
|
||||||
setState(() {
|
setState(() {
|
||||||
_error = error.toString();
|
_error = error.toString();
|
||||||
});
|
});
|
||||||
|
context.loaderOverlay.hide();
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
child: const Text('Senden'),
|
child: const Text('Senden'),
|
||||||
)
|
)
|
||||||
|
]
|
||||||
|
)
|
||||||
|
)
|
||||||
|
|
||||||
],
|
],
|
||||||
|
),
|
||||||
);
|
);
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -74,7 +74,7 @@ class Overhang extends StatelessWidget {
|
|||||||
title: const Text('Du hast eine Idee?'),
|
title: const Text('Du hast eine Idee?'),
|
||||||
subtitle: const Text('Fehler und Verbessungsvorschläge'),
|
subtitle: const Text('Fehler und Verbessungsvorschläge'),
|
||||||
trailing: const Icon(Icons.arrow_right),
|
trailing: const Icon(Icons.arrow_right),
|
||||||
onTap: () => showDialog(context: context, barrierDismissible: false, builder: (context) => const FeedbackDialog()),
|
onTap: () => pushScreen(context, withNavBar: false, screen: const FeedbackDialog()),
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
|
@ -115,7 +115,7 @@ class _ChatViewState extends State<ChatView> {
|
|||||||
scale: 1.5,
|
scale: 1.5,
|
||||||
opacity: 1,
|
opacity: 1,
|
||||||
repeat: ImageRepeat.repeat,
|
repeat: ImageRepeat.repeat,
|
||||||
invertColors: AppTheme.isDarkMode(context)
|
invertColors: AppTheme.isDarkMode(context),
|
||||||
)
|
)
|
||||||
),
|
),
|
||||||
child: data.primaryLoading() ? const LoadingSpinner() : Column(
|
child: data.primaryLoading() ? const LoadingSpinner() : Column(
|
||||||
|
@ -14,6 +14,7 @@ import '../../../../api/marianumcloud/webdav/webdavApi.dart';
|
|||||||
import '../../../../model/chatList/chatProps.dart';
|
import '../../../../model/chatList/chatProps.dart';
|
||||||
import '../../../../storage/base/settingsProvider.dart';
|
import '../../../../storage/base/settingsProvider.dart';
|
||||||
import '../../../../widget/filePick.dart';
|
import '../../../../widget/filePick.dart';
|
||||||
|
import '../../../../widget/focusBehaviour.dart';
|
||||||
import '../../files/fileUploadDialog.dart';
|
import '../../files/fileUploadDialog.dart';
|
||||||
|
|
||||||
class ChatTextfield extends StatefulWidget {
|
class ChatTextfield extends StatefulWidget {
|
||||||
@ -156,6 +157,7 @@ class _ChatTextfieldState extends State<ChatTextfield> {
|
|||||||
}
|
}
|
||||||
setDraft(text);
|
setDraft(text);
|
||||||
},
|
},
|
||||||
|
onTapOutside: (PointerDownEvent event) => FocusBehaviour.textFieldTapOutside(context),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
const SizedBox(width: 15),
|
const SizedBox(width: 15),
|
||||||
|
@ -15,6 +15,7 @@ import '../../../api/mhsl/customTimetableEvent/update/updateCustomTimetableEvent
|
|||||||
import '../../../api/mhsl/customTimetableEvent/update/updateCustomTimetableEventParams.dart';
|
import '../../../api/mhsl/customTimetableEvent/update/updateCustomTimetableEventParams.dart';
|
||||||
import '../../../model/accountData.dart';
|
import '../../../model/accountData.dart';
|
||||||
import '../../../model/timetable/timetableProps.dart';
|
import '../../../model/timetable/timetableProps.dart';
|
||||||
|
import '../../../widget/focusBehaviour.dart';
|
||||||
import '../../../widget/infoDialog.dart';
|
import '../../../widget/infoDialog.dart';
|
||||||
import 'customTimetableColors.dart';
|
import 'customTimetableColors.dart';
|
||||||
|
|
||||||
@ -67,6 +68,7 @@ class _AddCustomTimetableEventDialogState extends State<CustomTimetableEventEdit
|
|||||||
labelText: 'Terminname',
|
labelText: 'Terminname',
|
||||||
border: OutlineInputBorder()
|
border: OutlineInputBorder()
|
||||||
),
|
),
|
||||||
|
onTapOutside: (PointerDownEvent event) => FocusBehaviour.textFieldTapOutside(context),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
ListTile(
|
ListTile(
|
||||||
@ -78,6 +80,7 @@ class _AddCustomTimetableEventDialogState extends State<CustomTimetableEventEdit
|
|||||||
labelText: 'Beschreibung',
|
labelText: 'Beschreibung',
|
||||||
border: OutlineInputBorder()
|
border: OutlineInputBorder()
|
||||||
),
|
),
|
||||||
|
onTapOutside: (PointerDownEvent event) => FocusBehaviour.textFieldTapOutside(context),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
const Divider(),
|
const Divider(),
|
||||||
|
@ -11,7 +11,7 @@ import '../../../widget/placeholderView.dart';
|
|||||||
import 'jsonViewer.dart';
|
import 'jsonViewer.dart';
|
||||||
|
|
||||||
class CacheView extends StatefulWidget {
|
class CacheView extends StatefulWidget {
|
||||||
final collection = 'MarianumMobile';
|
static String collection = 'MarianumMobile';
|
||||||
const CacheView({super.key});
|
const CacheView({super.key});
|
||||||
|
|
||||||
@override
|
@override
|
||||||
@ -34,7 +34,7 @@ class _CacheViewState extends State<CacheView> {
|
|||||||
|
|
||||||
@override
|
@override
|
||||||
void initState() {
|
void initState() {
|
||||||
files = Localstore.instance.collection(widget.collection).get();
|
files = Localstore.instance.collection(CacheView.collection).get();
|
||||||
super.initState();
|
super.initState();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
7
lib/widget/focusBehaviour.dart
Normal file
7
lib/widget/focusBehaviour.dart
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
import 'package:flutter/cupertino.dart';
|
||||||
|
|
||||||
|
class FocusBehaviour {
|
||||||
|
static void textFieldTapOutside(BuildContext context) {
|
||||||
|
FocusScope.of(context).requestFocus(FocusNode());
|
||||||
|
}
|
||||||
|
}
|
@ -1,23 +0,0 @@
|
|||||||
import 'package:flutter/material.dart';
|
|
||||||
|
|
||||||
class QuickMenu {
|
|
||||||
static void quickMenu(BuildContext context, BuildContext widgetContext, List<PopupMenuItem<dynamic>> items) {
|
|
||||||
final RenderBox overlay = Overlay.of(context).context.findRenderObject() as RenderBox;
|
|
||||||
|
|
||||||
final RenderBox widgetRenderBox = widgetContext.findRenderObject() as RenderBox;
|
|
||||||
final Offset position = widgetRenderBox.localToGlobal(Offset.zero);
|
|
||||||
|
|
||||||
showMenu(
|
|
||||||
context: context,
|
|
||||||
position: RelativeRect.fromRect(
|
|
||||||
Rect.fromPoints(
|
|
||||||
position,
|
|
||||||
position.translate(0, 0),
|
|
||||||
),
|
|
||||||
Offset.zero & overlay.size,
|
|
||||||
),
|
|
||||||
items: items,
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
Loading…
x
Reference in New Issue
Block a user