* better error logging when requesting notifications permission

* check that speech to text card in mounted before calling setState

* only log first 10 entries in other category keys list
This commit is contained in:
ggurdin 2024-11-27 12:19:11 -05:00 committed by GitHub
parent 7e34f40a48
commit 401a26ef85
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 32 additions and 20 deletions

View file

@ -129,7 +129,7 @@ class ConstructListModel {
"others": others
.map(
(entry) =>
("${entry.key}: ${entry.value.map((uses) => uses.id.string).toList()}"),
("${entry.key}: ${entry.value.map((uses) => uses.id.string).toList().sublist(0, 10)}"),
)
.toList(),
},

View file

@ -63,14 +63,12 @@ class MessageSpeechToTextCardState extends State<MessageSpeechToTextCard> {
data: widget.messageEvent.event.content,
);
} finally {
setState(() => _fetchingTranscription = false);
if (mounted) {
setState(() => _fetchingTranscription = false);
}
}
}
void closeHint() {
setState(() {});
}
TextSpan _buildTranscriptText(BuildContext context) {
final Transcript transcript = speechToTextResponse!.transcript;
final List<InlineSpan> spans = [];
@ -114,13 +112,15 @@ class MessageSpeechToTextCardState extends State<MessageSpeechToTextCard> {
..onTap = () {
debugPrint('Token tapped');
debugPrint(token.toJson().toString());
setState(() {
if (selectedToken == token) {
selectedToken = null;
} else {
selectedToken = token;
}
});
if (mounted) {
setState(() {
if (selectedToken == token) {
selectedToken = null;
} else {
selectedToken = token;
}
});
}
},
),
);

View file

@ -163,14 +163,26 @@ class BackgroundPush {
Set<String?>? oldTokens,
bool useDeviceSpecificAppId = false,
}) async {
if (PlatformInfos.isIOS) {
await firebase?.requestPermission();
} else if (PlatformInfos.isAndroid) {
_flutterLocalNotificationsPlugin
.resolvePlatformSpecificImplementation<
AndroidFlutterLocalNotificationsPlugin>()
?.requestNotificationsPermission();
// #Pangea
try {
// Pangea#
if (PlatformInfos.isIOS) {
await firebase?.requestPermission();
} else if (PlatformInfos.isAndroid) {
_flutterLocalNotificationsPlugin
.resolvePlatformSpecificImplementation<
AndroidFlutterLocalNotificationsPlugin>()
?.requestNotificationsPermission();
}
// #Pangea
} catch (err, s) {
ErrorHandler.logError(
e: "Error requesting notifications permission: $err",
s: s,
);
}
// Pangea#
final clientName = PlatformInfos.clientName;
oldTokens ??= <String>{};
final pushers = await (client.getPushers().catchError((e) {