Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Sentry #849

Merged
merged 5 commits into from
Oct 25, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions lib/main.dart
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import 'package:collection/collection.dart';
import 'package:fluffychat/config/app_config.dart';
import 'package:fluffychat/pangea/config/environment.dart';
import 'package:fluffychat/pangea/controllers/language_list_controller.dart';
import 'package:fluffychat/pangea/utils/error_handler.dart';
import 'package:fluffychat/pangea/utils/firebase_analytics.dart';
Expand Down Expand Up @@ -100,6 +101,18 @@ Future<void> startGui(List<Client> clients, SharedPreferences store) async {
await firstClient?.accountDataLoading;

ErrorWidget.builder = (details) => FluffyChatErrorWidget(details);

// #Pangea
// errors seems to happen a lot when users switch better production / staging
// while testing by accident. If the account is a production account but server is
// staging or vice versa, logout.
final isStagingUser = firstClient?.userID?.domain?.contains("staging");
final isStagingServer = Environment.isStaging;
if (isStagingServer != isStagingUser) {
await firstClient?.logout();
}
// Pangea#

runApp(FluffyChatApp(clients: clients, pincode: pin, store: store));
}

Expand Down
1 change: 1 addition & 0 deletions lib/pangea/choreographer/controllers/choreographer.dart
Original file line number Diff line number Diff line change
Expand Up @@ -593,6 +593,7 @@ class Choreographer {
if (isFetching) return false;
if (errorService.isError) return true;
if (itEnabled && isRunningIT) return false;
if (igc.igcTextData == null) return false;

final hasITMatches =
igc.igcTextData!.matches.any((match) => match.isITStart);
Expand Down
2 changes: 1 addition & 1 deletion lib/pangea/choreographer/widgets/it_feedback_card.dart
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ class ITFeedbackCardController extends State<ITFeedbackCard> {
@override
Widget build(BuildContext context) => error == null
? ITFeedbackCardView(controller: this)
: CardErrorWidget(error: error);
: CardErrorWidget(error: error!);
}

class ITFeedbackCardView extends StatelessWidget {
Expand Down
5 changes: 4 additions & 1 deletion lib/pangea/choreographer/widgets/send_button.dart
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,10 @@ class ChoreographerSendButtonState extends State<ChoreographerSendButton> {
color: widget.controller.choreographer.assistanceState
.stateColor(context),
onPressed: () {
widget.controller.choreographer.send(context);
widget.controller.choreographer.canSendMessage
? widget.controller.choreographer.send(context)
: widget.controller.choreographer.igc
.showFirstMatch(context);
},
tooltip: L10n.of(context)!.send,
),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ extension AnalyticsRoomExtension on Room {
return;
}

if (!isRoomAdmin) return;
if (client.userID == null || !isRoomAdmin) return;
final spaceHierarchy = await client.getSpaceHierarchy(
id,
maxDepth: 1,
Expand Down
2 changes: 1 addition & 1 deletion lib/pangea/widgets/chat/message_speech_to_text_card.dart
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,7 @@ class MessageSpeechToTextCardState extends State<MessageSpeechToTextCard> {
// done fetchig but not results means some kind of error
if (speechToTextResponse == null) {
return CardErrorWidget(
error: error,
error: error ?? "Failed to fetch speech to text",
maxWidth: AppConfig.toolbarMinWidth,
);
}
Expand Down
4 changes: 2 additions & 2 deletions lib/pangea/widgets/igc/card_error_widget.dart
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,14 @@ import 'package:fluffychat/pangea/widgets/igc/card_header.dart';
import 'package:flutter/material.dart';

class CardErrorWidget extends StatelessWidget {
final Object? error;
final Object error;
final Choreographer? choreographer;
final int? offset;
final double? maxWidth;

const CardErrorWidget({
super.key,
this.error,
required this.error,
this.choreographer,
this.offset,
this.maxWidth,
Expand Down
2 changes: 1 addition & 1 deletion lib/pangea/widgets/igc/word_data_card.dart
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,7 @@ class WordDataCardView extends StatelessWidget {
Widget build(BuildContext context) {
if (controller.wordNetError != null) {
return CardErrorWidget(
error: controller.wordNetError,
error: controller.wordNetError!,
maxWidth: AppConfig.toolbarMinWidth,
);
}
Expand Down
2 changes: 1 addition & 1 deletion pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ description: Learn a language while texting your friends.
# Pangea#
publish_to: none
# On version bump also increase the build number for F-Droid
version: 1.22.8+3558
version: 1.22.9+3559

environment:
sdk: ">=3.0.0 <4.0.0"
Expand Down
Loading