Skip to content
Open
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
2 changes: 1 addition & 1 deletion commet/lib/client/matrix/matrix_client.dart
Original file line number Diff line number Diff line change
Expand Up @@ -212,7 +212,7 @@ class MatrixClient extends Client {

static Future<void> _checkSystem(ClientManager clientManager) async {
try {
await vod.init(wasmPath: './assets/assets/vodozemac/');
await vodozemac.init(wasmPath: './assets/assets/vodozemac/');
if (!vod.isInitialized()) {
throw Exception("Vodozemac failed to initialize!");
}
Expand Down
34 changes: 27 additions & 7 deletions commet/lib/main.dart
Original file line number Diff line number Diff line change
Expand Up @@ -217,6 +217,32 @@ Future<void> initNecessary() async {
NeedsPostLoginInit.doPostLoginInit();
}

/// Wrapping the initialization functions in closures prevents an exception
/// "Null check operator used on a null value". Despite the try/catch,
/// the error does not actually occur inside of the closure now.
/// This has the added benefit of providing a stacktrace if there is an
/// error.
Future<List> _loadLocalization(Locale locale) async {
// Wrap the localization initialization functions with a try/catch
// and if there is an exception print the error and stack trace.
Future<void> _load(dynamic Function() loadFunction) async {
try {
await loadFunction();
} catch (e, st) {
Log.e("Error loading localization: $e\n$st");
}
}

return await Future.wait<dynamic>([
_load(() async => UnicodeEmojis.load()),
if (!preferences.debugTranslations.value)
_load(() async => initializeMessages(locale.languageCode)),
if (preferences.debugTranslations.value)
_load(() async => initializeMessagesDebug()),
_load(() async => initializeDateFormatting(locale.languageCode)),
]);
}

/// Initializes everything that is needed to run in GUI mode
Future<void> initGuiRequirements() async {
isHeadless = false;
Expand All @@ -225,13 +251,7 @@ Future<void> initGuiRequirements() async {

var locale = PlatformDispatcher.instance.locale;

Future.wait([
UnicodeEmojis.load(),
if (!preferences.debugTranslations.value)
initializeMessages(locale.languageCode),
if (preferences.debugTranslations.value) initializeMessagesDebug(),
initializeDateFormatting(locale.languageCode),
]);
await _loadLocalization(locale);

tiamat.getAppScale = () {
return preferences.appScale.value;
Expand Down
5 changes: 5 additions & 0 deletions tiamat/lib/config/style/theme_common.dart
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,11 @@ import 'dart:io' show Platform;

class ThemeCommon {
static List<String>? fontFamilyFallback() {
// Apple does not render emoji with the default font
// instead use the system-available emoji font.
if (!kIsWeb && (Platform.isMacOS || Platform.isIOS)) {
return ["Apple Color Emoji"];
}
const fonts = ["EmojiFont"];
return fonts;
}
Expand Down