File tree Expand file tree Collapse file tree 1 file changed +16
-0
lines changed Expand file tree Collapse file tree 1 file changed +16
-0
lines changed Original file line number Diff line number Diff line change @@ -433,6 +433,11 @@ abstract class PerAccountStoreBase {
433433 // See `UpdateMachine.load`.
434434 Uri get realmIcon => account.realmIcon! ;
435435
436+ /// Resolve [realmIcon] as a URL relative to [realmUrl] .
437+ ///
438+ /// This returns null if resolving fails.
439+ Uri ? resolveRealmIconUrl () => _tryResolveUrl (realmUrl, realmIcon);
440+
436441 /// Resolve [reference] as a URL relative to [realmUrl] .
437442 ///
438443 /// This returns null if [reference] fails to parse as a URL.
@@ -476,6 +481,17 @@ Uri? tryResolveUrlStr(Uri baseUrl, String reference) {
476481 }
477482}
478483
484+ const _tryResolveUrl = tryResolveUrl;
485+
486+ /// Like [Uri.resolve] , but on failure return null instead of throwing.
487+ Uri ? tryResolveUrl (Uri baseUrl, Uri reference) {
488+ try {
489+ return baseUrl.resolveUri (reference);
490+ } on FormatException {
491+ return null ;
492+ }
493+ }
494+
479495/// Store for the user's data for a given Zulip account.
480496///
481497/// This should always have a consistent snapshot of the state on the server,
You can’t perform that action at this time.
0 commit comments