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
4 changes: 0 additions & 4 deletions assets/l10n/app_en.arb
Original file line number Diff line number Diff line change
Expand Up @@ -39,10 +39,6 @@
"@settingsPageTitle": {
"description": "Title for the settings page."
},
"switchAccountButton": "Switch account",
"@switchAccountButton": {
"description": "Label for main-menu button leading to the choose-account page."
},
"tryAnotherAccountMessage": "Your account at {url} is taking a while to load.",
"@tryAnotherAccountMessage": {
"description": "Message that appears on the loading screen after waiting for some time.",
Expand Down
6 changes: 0 additions & 6 deletions lib/generated/l10n/zulip_localizations.dart
Original file line number Diff line number Diff line change
Expand Up @@ -199,12 +199,6 @@ abstract class ZulipLocalizations {
/// **'Settings'**
String get settingsPageTitle;

/// Label for main-menu button leading to the choose-account page.
///
/// In en, this message translates to:
/// **'Switch account'**
String get switchAccountButton;

/// Message that appears on the loading screen after waiting for some time.
///
/// In en, this message translates to:
Expand Down
3 changes: 0 additions & 3 deletions lib/generated/l10n/zulip_localizations_ar.dart
Original file line number Diff line number Diff line change
Expand Up @@ -40,9 +40,6 @@ class ZulipLocalizationsAr extends ZulipLocalizations {
@override
String get settingsPageTitle => 'الإعدادات';

@override
String get switchAccountButton => 'تبديل الحساب';

@override
String tryAnotherAccountMessage(Object url) {
return 'Your account at $url is taking a while to load.';
Expand Down
3 changes: 0 additions & 3 deletions lib/generated/l10n/zulip_localizations_de.dart
Original file line number Diff line number Diff line change
Expand Up @@ -40,9 +40,6 @@ class ZulipLocalizationsDe extends ZulipLocalizations {
@override
String get settingsPageTitle => 'Einstellungen';

@override
String get switchAccountButton => 'Konto wechseln';

@override
String tryAnotherAccountMessage(Object url) {
return 'Dein Account bei $url benötigt einige Zeit zum Laden.';
Expand Down
3 changes: 0 additions & 3 deletions lib/generated/l10n/zulip_localizations_el.dart
Original file line number Diff line number Diff line change
Expand Up @@ -40,9 +40,6 @@ class ZulipLocalizationsEl extends ZulipLocalizations {
@override
String get settingsPageTitle => 'Settings';

@override
String get switchAccountButton => 'Switch account';

@override
String tryAnotherAccountMessage(Object url) {
return 'Your account at $url is taking a while to load.';
Expand Down
3 changes: 0 additions & 3 deletions lib/generated/l10n/zulip_localizations_en.dart
Original file line number Diff line number Diff line change
Expand Up @@ -40,9 +40,6 @@ class ZulipLocalizationsEn extends ZulipLocalizations {
@override
String get settingsPageTitle => 'Settings';

@override
String get switchAccountButton => 'Switch account';

@override
String tryAnotherAccountMessage(Object url) {
return 'Your account at $url is taking a while to load.';
Expand Down
3 changes: 0 additions & 3 deletions lib/generated/l10n/zulip_localizations_es.dart
Original file line number Diff line number Diff line change
Expand Up @@ -40,9 +40,6 @@ class ZulipLocalizationsEs extends ZulipLocalizations {
@override
String get settingsPageTitle => 'Settings';

@override
String get switchAccountButton => 'Switch account';

@override
String tryAnotherAccountMessage(Object url) {
return 'Your account at $url is taking a while to load.';
Expand Down
3 changes: 0 additions & 3 deletions lib/generated/l10n/zulip_localizations_fr.dart
Original file line number Diff line number Diff line change
Expand Up @@ -41,9 +41,6 @@ class ZulipLocalizationsFr extends ZulipLocalizations {
@override
String get settingsPageTitle => 'Paramètres';

@override
String get switchAccountButton => 'Changer de compte';

@override
String tryAnotherAccountMessage(Object url) {
return 'Votre compte à $url prend du temps à se charger.';
Expand Down
3 changes: 0 additions & 3 deletions lib/generated/l10n/zulip_localizations_he.dart
Original file line number Diff line number Diff line change
Expand Up @@ -40,9 +40,6 @@ class ZulipLocalizationsHe extends ZulipLocalizations {
@override
String get settingsPageTitle => 'Settings';

@override
String get switchAccountButton => 'Switch account';

@override
String tryAnotherAccountMessage(Object url) {
return 'Your account at $url is taking a while to load.';
Expand Down
3 changes: 0 additions & 3 deletions lib/generated/l10n/zulip_localizations_hu.dart
Original file line number Diff line number Diff line change
Expand Up @@ -40,9 +40,6 @@ class ZulipLocalizationsHu extends ZulipLocalizations {
@override
String get settingsPageTitle => 'Settings';

@override
String get switchAccountButton => 'Switch account';

@override
String tryAnotherAccountMessage(Object url) {
return 'Your account at $url is taking a while to load.';
Expand Down
3 changes: 0 additions & 3 deletions lib/generated/l10n/zulip_localizations_it.dart
Original file line number Diff line number Diff line change
Expand Up @@ -40,9 +40,6 @@ class ZulipLocalizationsIt extends ZulipLocalizations {
@override
String get settingsPageTitle => 'Impostazioni';

@override
String get switchAccountButton => 'Cambia account';

@override
String tryAnotherAccountMessage(Object url) {
return 'Il caricamento dell\'account su $url sta richiedendo un po\' di tempo.';
Expand Down
3 changes: 0 additions & 3 deletions lib/generated/l10n/zulip_localizations_ja.dart
Original file line number Diff line number Diff line change
Expand Up @@ -39,9 +39,6 @@ class ZulipLocalizationsJa extends ZulipLocalizations {
@override
String get settingsPageTitle => '設定';

@override
String get switchAccountButton => 'アカウントを切り替える';

@override
String tryAnotherAccountMessage(Object url) {
return '$url のアカウントの読み込みに時間がかかっています。';
Expand Down
3 changes: 0 additions & 3 deletions lib/generated/l10n/zulip_localizations_nb.dart
Original file line number Diff line number Diff line change
Expand Up @@ -40,9 +40,6 @@ class ZulipLocalizationsNb extends ZulipLocalizations {
@override
String get settingsPageTitle => 'Settings';

@override
String get switchAccountButton => 'Switch account';

@override
String tryAnotherAccountMessage(Object url) {
return 'Your account at $url is taking a while to load.';
Expand Down
3 changes: 0 additions & 3 deletions lib/generated/l10n/zulip_localizations_pl.dart
Original file line number Diff line number Diff line change
Expand Up @@ -40,9 +40,6 @@ class ZulipLocalizationsPl extends ZulipLocalizations {
@override
String get settingsPageTitle => 'Ustawienia';

@override
String get switchAccountButton => 'Przełącz konto';

@override
String tryAnotherAccountMessage(Object url) {
return 'Twoje konto na $url wymaga jeszcze chwili na załadowanie.';
Expand Down
3 changes: 0 additions & 3 deletions lib/generated/l10n/zulip_localizations_ru.dart
Original file line number Diff line number Diff line change
Expand Up @@ -40,9 +40,6 @@ class ZulipLocalizationsRu extends ZulipLocalizations {
@override
String get settingsPageTitle => 'Настройки';

@override
String get switchAccountButton => 'Сменить учетную запись';

@override
String tryAnotherAccountMessage(Object url) {
return 'Ваша учетная запись на $url загружается медленно.';
Expand Down
3 changes: 0 additions & 3 deletions lib/generated/l10n/zulip_localizations_sk.dart
Original file line number Diff line number Diff line change
Expand Up @@ -40,9 +40,6 @@ class ZulipLocalizationsSk extends ZulipLocalizations {
@override
String get settingsPageTitle => 'Settings';

@override
String get switchAccountButton => 'Zmeniť účet';

@override
String tryAnotherAccountMessage(Object url) {
return 'Načítavanie vášho konta na adrese $url chvílu trvá.';
Expand Down
3 changes: 0 additions & 3 deletions lib/generated/l10n/zulip_localizations_sl.dart
Original file line number Diff line number Diff line change
Expand Up @@ -39,9 +39,6 @@ class ZulipLocalizationsSl extends ZulipLocalizations {
@override
String get settingsPageTitle => 'Nastavitve';

@override
String get switchAccountButton => 'Preklopi račun';

@override
String tryAnotherAccountMessage(Object url) {
return 'Nalaganje vašega računa iz $url traja dlje kot običajno.';
Expand Down
3 changes: 0 additions & 3 deletions lib/generated/l10n/zulip_localizations_uk.dart
Original file line number Diff line number Diff line change
Expand Up @@ -40,9 +40,6 @@ class ZulipLocalizationsUk extends ZulipLocalizations {
@override
String get settingsPageTitle => 'Налаштування';

@override
String get switchAccountButton => 'Змінити обліковий запис';

@override
String tryAnotherAccountMessage(Object url) {
return 'Ваш обліковий запис на $url завантажується деякий час.';
Expand Down
9 changes: 0 additions & 9 deletions lib/generated/l10n/zulip_localizations_zh.dart
Original file line number Diff line number Diff line change
Expand Up @@ -40,9 +40,6 @@ class ZulipLocalizationsZh extends ZulipLocalizations {
@override
String get settingsPageTitle => 'Settings';

@override
String get switchAccountButton => 'Switch account';

@override
String tryAnotherAccountMessage(Object url) {
return 'Your account at $url is taking a while to load.';
Expand Down Expand Up @@ -1200,9 +1197,6 @@ class ZulipLocalizationsZhHansCn extends ZulipLocalizationsZh {
@override
String get settingsPageTitle => '设置';

@override
String get switchAccountButton => '切换账号';

@override
String tryAnotherAccountMessage(Object url) {
return '您在 $url 的账号加载时间过长。';
Expand Down Expand Up @@ -2305,9 +2299,6 @@ class ZulipLocalizationsZhHantTw extends ZulipLocalizationsZh {
@override
String get settingsPageTitle => '設定';

@override
String get switchAccountButton => '切換帳號';

@override
String tryAnotherAccountMessage(Object url) {
return '您在 $url 的帳號載入的比較久。';
Expand Down
32 changes: 27 additions & 5 deletions lib/model/store.dart
Original file line number Diff line number Diff line change
Expand Up @@ -423,14 +423,25 @@ abstract class PerAccountStoreBase {
/// Always equal to `account.realmUrl` and `connection.realmUrl`.
Uri get realmUrl => connection.realmUrl;

String? get realmName => account.realmName;
// The `account` is populated with the `realmName` before
// PerAccountStore is created, so this should never be null.
// See `UpdateMachine.load`.
String get realmName => account.realmName!;

Uri? get realmIcon => account.realmIcon;
// The `account` is populated with the `realmIcon` before
// PerAccountStore is created, so this should never be null.
// See `UpdateMachine.load`.
Uri get realmIcon => account.realmIcon!;

/// Resolve [realmIcon] as a URL relative to [realmUrl].
///
/// This returns null if resolving fails.
Uri? resolveRealmIconUrl() => _tryResolveUrl(realmUrl, realmIcon);

/// Resolve [reference] as a URL relative to [realmUrl].
///
/// This returns null if [reference] fails to parse as a URL.
Uri? tryResolveUrl(String reference) => _tryResolveUrl(realmUrl, reference);
Uri? tryResolveUrl(String reference) => _tryResolveUrlStr(realmUrl, reference);

/// Always equal to `connection.zulipFeatureLevel`
/// and `account.zulipFeatureLevel`.
Expand Down Expand Up @@ -459,17 +470,28 @@ abstract class PerAccountStoreBase {
int get selfUserId => core.selfUserId;
}

const _tryResolveUrl = tryResolveUrl;
const _tryResolveUrlStr = tryResolveUrlStr;

/// Like [Uri.resolve], but on failure return null instead of throwing.
Uri? tryResolveUrl(Uri baseUrl, String reference) {
Uri? tryResolveUrlStr(Uri baseUrl, String reference) {
try {
return baseUrl.resolve(reference);
} on FormatException {
return null;
}
}

const _tryResolveUrl = tryResolveUrl;

/// Like [Uri.resolve], but on failure return null instead of throwing.
Uri? tryResolveUrl(Uri baseUrl, Uri reference) {
try {
return baseUrl.resolveUri(reference);
} on FormatException {
return null;
}
}

/// Store for the user's data for a given Zulip account.
///
/// This should always have a consistent snapshot of the state on the server,
Expand Down
Loading