Compare commits
2 Commits
develop-po
...
a689cf4fef
| Author | SHA1 | Date | |
|---|---|---|---|
| a689cf4fef | |||
| 8f92ab06d9 |
29
assets/ca/lets-encrypt-r13.pem
Normal file
29
assets/ca/lets-encrypt-r13.pem
Normal file
@@ -0,0 +1,29 @@
|
|||||||
|
-----BEGIN CERTIFICATE-----
|
||||||
|
MIIFBTCCAu2gAwIBAgIQWgDyEtjUtIDzkkFX6imDBTANBgkqhkiG9w0BAQsFADBP
|
||||||
|
MQswCQYDVQQGEwJVUzEpMCcGA1UEChMgSW50ZXJuZXQgU2VjdXJpdHkgUmVzZWFy
|
||||||
|
Y2ggR3JvdXAxFTATBgNVBAMTDElTUkcgUm9vdCBYMTAeFw0yNDAzMTMwMDAwMDBa
|
||||||
|
Fw0yNzAzMTIyMzU5NTlaMDMxCzAJBgNVBAYTAlVTMRYwFAYDVQQKEw1MZXQncyBF
|
||||||
|
bmNyeXB0MQwwCgYDVQQDEwNSMTMwggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEK
|
||||||
|
AoIBAQClZ3CN0FaBZBUXYc25BtStGZCMJlA3mBZjklTb2cyEBZPs0+wIG6BgUUNI
|
||||||
|
fSvHSJaetC3ancgnO1ehn6vw1g7UDjDKb5ux0daknTI+WE41b0VYaHEX/D7YXYKg
|
||||||
|
L7JRbLAaXbhZzjVlyIuhrxA3/+OcXcJJFzT/jCuLjfC8cSyTDB0FxLrHzarJXnzR
|
||||||
|
yQH3nAP2/Apd9Np75tt2QnDr9E0i2gB3b9bJXxf92nUupVcM9upctuBzpWjPoXTi
|
||||||
|
dYJ+EJ/B9aLrAek4sQpEzNPCifVJNYIKNLMc6YjCR06CDgo28EdPivEpBHXazeGa
|
||||||
|
XP9enZiVuppD0EqiFwUBBDDTMrOPAgMBAAGjgfgwgfUwDgYDVR0PAQH/BAQDAgGG
|
||||||
|
MB0GA1UdJQQWMBQGCCsGAQUFBwMCBggrBgEFBQcDATASBgNVHRMBAf8ECDAGAQH/
|
||||||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ewok=
|
||||||
|
-----END CERTIFICATE-----
|
||||||
@@ -1,18 +0,0 @@
|
|||||||
import 'dart:convert';
|
|
||||||
|
|
||||||
import 'package:http/http.dart' as http;
|
|
||||||
|
|
||||||
import '../talkApi.dart';
|
|
||||||
import 'getPollStateResponse.dart';
|
|
||||||
|
|
||||||
class GetPollState extends TalkApi<GetPollStateResponse> {
|
|
||||||
String token;
|
|
||||||
int pollId;
|
|
||||||
GetPollState({required this.token, required this.pollId}) : super('v1/poll/$token/$pollId', null);
|
|
||||||
|
|
||||||
@override
|
|
||||||
GetPollStateResponse assemble(String raw) => GetPollStateResponse.fromJson(jsonDecode(raw)['ocs']);
|
|
||||||
|
|
||||||
@override
|
|
||||||
Future<http.Response> request(Uri uri, Object? body, Map<String, String>? headers) => http.get(uri, headers: headers);
|
|
||||||
}
|
|
||||||
@@ -1,50 +0,0 @@
|
|||||||
import 'package:json_annotation/json_annotation.dart';
|
|
||||||
|
|
||||||
import '../../../apiResponse.dart';
|
|
||||||
|
|
||||||
part 'getPollStateResponse.g.dart';
|
|
||||||
|
|
||||||
@JsonSerializable(explicitToJson: true)
|
|
||||||
class GetPollStateResponse extends ApiResponse {
|
|
||||||
GetPollStateResponseObject data;
|
|
||||||
|
|
||||||
GetPollStateResponse(this.data);
|
|
||||||
|
|
||||||
factory GetPollStateResponse.fromJson(Map<String, dynamic> json) => _$GetPollStateResponseFromJson(json);
|
|
||||||
Map<String, dynamic> toJson() => _$GetPollStateResponseToJson(this);
|
|
||||||
}
|
|
||||||
|
|
||||||
@JsonSerializable(explicitToJson: true)
|
|
||||||
class GetPollStateResponseObject {
|
|
||||||
int id;
|
|
||||||
String question;
|
|
||||||
List<String> options;
|
|
||||||
dynamic votes;
|
|
||||||
String actorType;
|
|
||||||
String actorId;
|
|
||||||
String actorDisplayName;
|
|
||||||
int status;
|
|
||||||
int resultMode;
|
|
||||||
int maxVotes;
|
|
||||||
List<int> votedSelf;
|
|
||||||
int? numVoters;
|
|
||||||
List<String>? details;
|
|
||||||
|
|
||||||
GetPollStateResponseObject(
|
|
||||||
this.id,
|
|
||||||
this.question,
|
|
||||||
this.options,
|
|
||||||
this.votes,
|
|
||||||
this.actorType,
|
|
||||||
this.actorId,
|
|
||||||
this.actorDisplayName,
|
|
||||||
this.status,
|
|
||||||
this.resultMode,
|
|
||||||
this.maxVotes,
|
|
||||||
this.votedSelf,
|
|
||||||
this.numVoters,
|
|
||||||
this.details);
|
|
||||||
|
|
||||||
factory GetPollStateResponseObject.fromJson(Map<String, dynamic> json) => _$GetPollStateResponseObjectFromJson(json);
|
|
||||||
Map<String, dynamic> toJson() => _$GetPollStateResponseObjectToJson(this);
|
|
||||||
}
|
|
||||||
@@ -1,60 +0,0 @@
|
|||||||
// GENERATED CODE - DO NOT MODIFY BY HAND
|
|
||||||
|
|
||||||
part of 'getPollStateResponse.dart';
|
|
||||||
|
|
||||||
// **************************************************************************
|
|
||||||
// JsonSerializableGenerator
|
|
||||||
// **************************************************************************
|
|
||||||
|
|
||||||
GetPollStateResponse _$GetPollStateResponseFromJson(
|
|
||||||
Map<String, dynamic> json) =>
|
|
||||||
GetPollStateResponse(
|
|
||||||
GetPollStateResponseObject.fromJson(json['data'] as Map<String, dynamic>),
|
|
||||||
)..headers = (json['headers'] as Map<String, dynamic>?)?.map(
|
|
||||||
(k, e) => MapEntry(k, e as String),
|
|
||||||
);
|
|
||||||
|
|
||||||
Map<String, dynamic> _$GetPollStateResponseToJson(
|
|
||||||
GetPollStateResponse instance) =>
|
|
||||||
<String, dynamic>{
|
|
||||||
if (instance.headers case final value?) 'headers': value,
|
|
||||||
'data': instance.data.toJson(),
|
|
||||||
};
|
|
||||||
|
|
||||||
GetPollStateResponseObject _$GetPollStateResponseObjectFromJson(
|
|
||||||
Map<String, dynamic> json) =>
|
|
||||||
GetPollStateResponseObject(
|
|
||||||
(json['id'] as num).toInt(),
|
|
||||||
json['question'] as String,
|
|
||||||
(json['options'] as List<dynamic>).map((e) => e as String).toList(),
|
|
||||||
json['votes'],
|
|
||||||
json['actorType'] as String,
|
|
||||||
json['actorId'] as String,
|
|
||||||
json['actorDisplayName'] as String,
|
|
||||||
(json['status'] as num).toInt(),
|
|
||||||
(json['resultMode'] as num).toInt(),
|
|
||||||
(json['maxVotes'] as num).toInt(),
|
|
||||||
(json['votedSelf'] as List<dynamic>)
|
|
||||||
.map((e) => (e as num).toInt())
|
|
||||||
.toList(),
|
|
||||||
(json['numVoters'] as num?)?.toInt(),
|
|
||||||
(json['details'] as List<dynamic>?)?.map((e) => e as String).toList(),
|
|
||||||
);
|
|
||||||
|
|
||||||
Map<String, dynamic> _$GetPollStateResponseObjectToJson(
|
|
||||||
GetPollStateResponseObject instance) =>
|
|
||||||
<String, dynamic>{
|
|
||||||
'id': instance.id,
|
|
||||||
'question': instance.question,
|
|
||||||
'options': instance.options,
|
|
||||||
'votes': instance.votes,
|
|
||||||
'actorType': instance.actorType,
|
|
||||||
'actorId': instance.actorId,
|
|
||||||
'actorDisplayName': instance.actorDisplayName,
|
|
||||||
'status': instance.status,
|
|
||||||
'resultMode': instance.resultMode,
|
|
||||||
'maxVotes': instance.maxVotes,
|
|
||||||
'votedSelf': instance.votedSelf,
|
|
||||||
'numVoters': instance.numVoters,
|
|
||||||
'details': instance.details,
|
|
||||||
};
|
|
||||||
@@ -1,30 +0,0 @@
|
|||||||
import 'dart:convert';
|
|
||||||
import 'dart:developer';
|
|
||||||
|
|
||||||
import 'package:http/http.dart' as http;
|
|
||||||
import 'package:http/http.dart';
|
|
||||||
|
|
||||||
import '../getPoll/getPollStateResponse.dart';
|
|
||||||
import '../talkApi.dart';
|
|
||||||
import 'votePollParams.dart';
|
|
||||||
|
|
||||||
class VotePoll extends TalkApi {
|
|
||||||
String token;
|
|
||||||
int pollId;
|
|
||||||
VotePoll({required this.token, required this.pollId, required VotePollParams params}) : super('v1/poll/$token/$pollId', params);
|
|
||||||
|
|
||||||
@override
|
|
||||||
GetPollStateResponse assemble(String raw) {
|
|
||||||
log(raw);
|
|
||||||
return GetPollStateResponse.fromJson(jsonDecode(raw)['ocs']);
|
|
||||||
}
|
|
||||||
|
|
||||||
@override
|
|
||||||
Future<Response>? request(Uri uri, Object? body, Map<String, String>? headers) {
|
|
||||||
if(body is VotePollParams) {
|
|
||||||
log(body.toJson().toString());
|
|
||||||
return http.post(uri, headers: headers, body: body.toJson().toString());
|
|
||||||
}
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,14 +0,0 @@
|
|||||||
import 'package:json_annotation/json_annotation.dart';
|
|
||||||
|
|
||||||
import '../../../apiParams.dart';
|
|
||||||
|
|
||||||
part 'votePollParams.g.dart';
|
|
||||||
|
|
||||||
@JsonSerializable()
|
|
||||||
class VotePollParams extends ApiParams {
|
|
||||||
List<int> optionIds;
|
|
||||||
|
|
||||||
VotePollParams({required this.optionIds});
|
|
||||||
factory VotePollParams.fromJson(Map<String, dynamic> json) => _$VotePollParamsFromJson(json);
|
|
||||||
Map<String, dynamic> toJson() => _$VotePollParamsToJson(this);
|
|
||||||
}
|
|
||||||
@@ -1,19 +0,0 @@
|
|||||||
// GENERATED CODE - DO NOT MODIFY BY HAND
|
|
||||||
|
|
||||||
part of 'votePollParams.dart';
|
|
||||||
|
|
||||||
// **************************************************************************
|
|
||||||
// JsonSerializableGenerator
|
|
||||||
// **************************************************************************
|
|
||||||
|
|
||||||
VotePollParams _$VotePollParamsFromJson(Map<String, dynamic> json) =>
|
|
||||||
VotePollParams(
|
|
||||||
optionIds: (json['optionIds'] as List<dynamic>)
|
|
||||||
.map((e) => (e as num).toInt())
|
|
||||||
.toList(),
|
|
||||||
);
|
|
||||||
|
|
||||||
Map<String, dynamic> _$VotePollParamsToJson(VotePollParams instance) =>
|
|
||||||
<String, dynamic>{
|
|
||||||
'optionIds': instance.optionIds,
|
|
||||||
};
|
|
||||||
@@ -46,6 +46,7 @@ Future<void> main() async {
|
|||||||
|
|
||||||
PlatformAssetBundle().load('assets/ca/lets-encrypt-r3.pem').then(addCertificateAsTrusted),
|
PlatformAssetBundle().load('assets/ca/lets-encrypt-r3.pem').then(addCertificateAsTrusted),
|
||||||
PlatformAssetBundle().load('assets/ca/lets-encrypt-r10.pem').then(addCertificateAsTrusted),
|
PlatformAssetBundle().load('assets/ca/lets-encrypt-r10.pem').then(addCertificateAsTrusted),
|
||||||
|
PlatformAssetBundle().load('assets/ca/lets-encrypt-r13.pem').then(addCertificateAsTrusted),
|
||||||
|
|
||||||
Future(() async {
|
Future(() async {
|
||||||
await HydratedStorage.build(
|
await HydratedStorage.build(
|
||||||
|
|||||||
@@ -41,7 +41,7 @@ class EndpointData {
|
|||||||
|
|
||||||
Endpoint webuntis() => EndpointOptions(
|
Endpoint webuntis() => EndpointOptions(
|
||||||
live: Endpoint(
|
live: Endpoint(
|
||||||
domain: 'peleus.webuntis.com',
|
domain: 'marianum-fulda.webuntis.com',
|
||||||
),
|
),
|
||||||
staged: Endpoint(
|
staged: Endpoint(
|
||||||
domain: 'mhsl.eu',
|
domain: 'mhsl.eu',
|
||||||
|
|||||||
@@ -6,9 +6,6 @@ import 'package:flutter/material.dart';
|
|||||||
import 'package:flutter/services.dart';
|
import 'package:flutter/services.dart';
|
||||||
import 'package:jiffy/jiffy.dart';
|
import 'package:jiffy/jiffy.dart';
|
||||||
import 'package:open_filex/open_filex.dart';
|
import 'package:open_filex/open_filex.dart';
|
||||||
import '../../../../api/marianumcloud/talk/getPoll/getPollState.dart';
|
|
||||||
import '../../../../api/marianumcloud/talk/votePoll/votePoll.dart';
|
|
||||||
import '../../../../api/marianumcloud/talk/votePoll/votePollParams.dart';
|
|
||||||
import '../../../../extensions/text.dart';
|
import '../../../../extensions/text.dart';
|
||||||
import 'package:provider/provider.dart';
|
import 'package:provider/provider.dart';
|
||||||
|
|
||||||
@@ -21,13 +18,11 @@ import '../../../../api/marianumcloud/talk/reactMessage/reactMessageParams.dart'
|
|||||||
import '../../../../api/marianumcloud/talk/room/getRoomResponse.dart';
|
import '../../../../api/marianumcloud/talk/room/getRoomResponse.dart';
|
||||||
import '../../../../model/chatList/chatProps.dart';
|
import '../../../../model/chatList/chatProps.dart';
|
||||||
import '../../../../widget/debug/debugTile.dart';
|
import '../../../../widget/debug/debugTile.dart';
|
||||||
import '../../../../widget/loadingSpinner.dart';
|
|
||||||
import '../../files/fileElement.dart';
|
import '../../files/fileElement.dart';
|
||||||
import 'answerReference.dart';
|
import 'answerReference.dart';
|
||||||
import 'chatBubbleStyles.dart';
|
import 'chatBubbleStyles.dart';
|
||||||
import 'chatMessage.dart';
|
import 'chatMessage.dart';
|
||||||
import '../messageReactions.dart';
|
import '../messageReactions.dart';
|
||||||
import 'pollOptionsList.dart';
|
|
||||||
|
|
||||||
class ChatBubble extends StatefulWidget {
|
class ChatBubble extends StatefulWidget {
|
||||||
final BuildContext context;
|
final BuildContext context;
|
||||||
@@ -302,42 +297,6 @@ class _ChatBubbleState extends State<ChatBubble> with SingleTickerProviderStateM
|
|||||||
onLongPress: showOptionsDialog,
|
onLongPress: showOptionsDialog,
|
||||||
onDoubleTap: showOptionsDialog,
|
onDoubleTap: showOptionsDialog,
|
||||||
onTap: () {
|
onTap: () {
|
||||||
if(message.originalData?['object']?.type == RichObjectStringObjectType.talkPoll) {
|
|
||||||
var pollId = int.parse(message.originalData!['object']!.id);
|
|
||||||
var pollState = GetPollState(token: widget.bubbleData.token, pollId: pollId).run();
|
|
||||||
List<int>? ownVotes;
|
|
||||||
showDialog(context: context, builder: (context) => AlertDialog(
|
|
||||||
title: Text(message.originalData!['object']!.name, textScaler: TextScaler.linear(0.9)),
|
|
||||||
content: FutureBuilder(
|
|
||||||
future: pollState,
|
|
||||||
builder: (context, snapshot) {
|
|
||||||
if(snapshot.connectionState == ConnectionState.waiting) return const LoadingSpinner();
|
|
||||||
|
|
||||||
var pollData = snapshot.data!.data;
|
|
||||||
ownVotes = pollData.votedSelf;
|
|
||||||
return PollOptionsList(
|
|
||||||
pollData: pollData,
|
|
||||||
callback: (votes) => ownVotes = votes
|
|
||||||
);
|
|
||||||
}
|
|
||||||
),
|
|
||||||
actions: [
|
|
||||||
TextButton(
|
|
||||||
onPressed: () async {
|
|
||||||
Navigator.of(context).pop();
|
|
||||||
if(ownVotes == null) return;
|
|
||||||
VotePoll(pollId: pollId, token: widget.bubbleData.token, params: VotePollParams(optionIds: ownVotes!)).run();
|
|
||||||
},
|
|
||||||
child: const Text('Stimme abgeben')
|
|
||||||
),
|
|
||||||
TextButton(
|
|
||||||
onPressed: () => Navigator.of(context).pop(),
|
|
||||||
child: const Text('Abbrechen')
|
|
||||||
),
|
|
||||||
],
|
|
||||||
));
|
|
||||||
}
|
|
||||||
|
|
||||||
if(message.file == null) return;
|
if(message.file == null) return;
|
||||||
|
|
||||||
if(downloadProgress > 0) {
|
if(downloadProgress > 0) {
|
||||||
|
|||||||
@@ -32,14 +32,6 @@ class ChatMessage {
|
|||||||
onOpen: onOpen,
|
onOpen: onOpen,
|
||||||
);
|
);
|
||||||
|
|
||||||
if(originalData?['object']?.type == RichObjectStringObjectType.talkPoll) {
|
|
||||||
return ListTile(
|
|
||||||
leading: const Icon(Icons.poll_outlined),
|
|
||||||
title: Text(originalData!['object']!.name),
|
|
||||||
contentPadding: const EdgeInsets.only(left: 10),
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
if(file == null) return contentWidget;
|
if(file == null) return contentWidget;
|
||||||
|
|
||||||
return Padding(
|
return Padding(
|
||||||
|
|||||||
@@ -1,47 +0,0 @@
|
|||||||
import 'package:flutter/cupertino.dart';
|
|
||||||
import 'package:flutter/material.dart';
|
|
||||||
|
|
||||||
import '../../../../api/marianumcloud/talk/getPoll/getPollStateResponse.dart';
|
|
||||||
|
|
||||||
class PollOptionsList extends StatefulWidget {
|
|
||||||
final GetPollStateResponseObject pollData;
|
|
||||||
final Function(List<int>) callback;
|
|
||||||
const PollOptionsList({super.key, required this.pollData, required this.callback});
|
|
||||||
|
|
||||||
@override
|
|
||||||
State<PollOptionsList> createState() => _PollOptionsListState();
|
|
||||||
}
|
|
||||||
|
|
||||||
class _PollOptionsListState extends State<PollOptionsList> {
|
|
||||||
late List<int> ownVotes;
|
|
||||||
|
|
||||||
@override
|
|
||||||
void initState() {
|
|
||||||
super.initState();
|
|
||||||
ownVotes = widget.pollData.votedSelf;
|
|
||||||
}
|
|
||||||
|
|
||||||
@override
|
|
||||||
Widget build(BuildContext context) => ListView(
|
|
||||||
shrinkWrap: true,
|
|
||||||
children: [
|
|
||||||
...widget.pollData.options.map<Widget>(
|
|
||||||
(option) => CheckboxListTile(
|
|
||||||
value: ownVotes.contains(widget.pollData.options.indexOf(option)),
|
|
||||||
title: Text(option),
|
|
||||||
onChanged: (value) {
|
|
||||||
var optionId = widget.pollData.options.indexOf(option);
|
|
||||||
setState(() {
|
|
||||||
if(ownVotes.contains(optionId)) {
|
|
||||||
ownVotes.remove(optionId);
|
|
||||||
} else {
|
|
||||||
ownVotes.add(optionId);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
widget.callback(ownVotes);
|
|
||||||
}
|
|
||||||
)
|
|
||||||
)
|
|
||||||
],
|
|
||||||
);
|
|
||||||
}
|
|
||||||
Reference in New Issue
Block a user