diff --git a/lib/api/marianumcloud/talk/votePoll/votePoll.dart b/lib/api/marianumcloud/talk/votePoll/votePoll.dart index a0880bd..7cedfe1 100644 --- a/lib/api/marianumcloud/talk/votePoll/votePoll.dart +++ b/lib/api/marianumcloud/talk/votePoll/votePoll.dart @@ -1,5 +1,4 @@ import 'dart:convert'; -import 'dart:developer'; import 'package:http/http.dart' as http; import 'package:http/http.dart'; @@ -8,22 +7,18 @@ import '../getPoll/getPollStateResponse.dart'; import '../talkApi.dart'; import 'votePollParams.dart'; -@Deprecated('VotePoll is broken (known issues)') +@Deprecated('VotePoll is broken') 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']); - } + GetPollStateResponse assemble(String raw) => GetPollStateResponse.fromJson(jsonDecode(raw)['ocs']); @override Future? request(Uri uri, Object? body, Map? headers) { if(body is VotePollParams) { - log(body.toJson().toString()); return http.post(uri, headers: headers, body: body.toJson().toString()); } return null; diff --git a/lib/api/marianumcloud/talk/votePoll/votePollParams.dart b/lib/api/marianumcloud/talk/votePoll/votePollParams.dart index c8a7bca..151459d 100644 --- a/lib/api/marianumcloud/talk/votePoll/votePollParams.dart +++ b/lib/api/marianumcloud/talk/votePoll/votePollParams.dart @@ -5,10 +5,11 @@ import '../../../apiParams.dart'; part 'votePollParams.g.dart'; @JsonSerializable() +@Deprecated('VotePoll is broken') class VotePollParams extends ApiParams { List optionIds; VotePollParams({required this.optionIds}); factory VotePollParams.fromJson(Map json) => _$VotePollParamsFromJson(json); Map toJson() => _$VotePollParamsToJson(this); -} \ No newline at end of file +} diff --git a/lib/view/pages/talk/components/chatBubble.dart b/lib/view/pages/talk/components/chatBubble.dart index 0190b3b..08b9866 100644 --- a/lib/view/pages/talk/components/chatBubble.dart +++ b/lib/view/pages/talk/components/chatBubble.dart @@ -304,7 +304,7 @@ class _ChatBubbleState extends State with SingleTickerProviderStateM var pollId = int.parse(message.originalData!['object']!.id); var pollState = GetPollState(token: widget.bubbleData.token, pollId: pollId).run(); showDialog(context: context, builder: (context) => AlertDialog( - title: Text(message.originalData!['object']!.name, textScaler: TextScaler.linear(0.9), overflow: TextOverflow.ellipsis), + title: Text(message.originalData!['object']!.name, overflow: TextOverflow.ellipsis), content: FutureBuilder( future: pollState, builder: (context, snapshot) { diff --git a/lib/view/pages/talk/components/pollOptionsList.dart b/lib/view/pages/talk/components/pollOptionsList.dart index dd9cd70..3e4eec4 100644 --- a/lib/view/pages/talk/components/pollOptionsList.dart +++ b/lib/view/pages/talk/components/pollOptionsList.dart @@ -22,8 +22,9 @@ class _PollOptionsListState extends State { var optionId = widget.pollData.options.indexOf(option); var votedSelf = widget.pollData.votedSelf.contains(optionId); var portionsVisible = widget.pollData.votes is Map; - var votes = !portionsVisible ? 0 - : (widget.pollData.votes['option-$optionId'] as num?) ?? 0; + var votes = portionsVisible + ? (widget.pollData.votes['option-$optionId'] as num?) ?? 0 + : 0; var numVoters = widget.pollData.numVoters ?? 0; double portion = numVoters == 0 ? 0 : (votes / numVoters);