@@ -125,29 +125,33 @@ class NarrowLink extends InternalLink {
125125 final Narrow narrow;
126126}
127127
128- /// A [Narrow] from a given URL, on `store` 's realm.
128+ /// Try to parse the given URL as a page in this app , on `store` 's realm.
129129///
130130/// `url` must already be a result from [PerAccountStore.tryResolveUrl]
131131/// on `store` .
132132///
133- /// Returns `null` if any of the operator/operand pairs are invalid.
133+ /// Returns null if the URL isn't on this realm,
134+ /// or isn't a valid Zulip URL,
135+ /// or isn't currently supported as leading to a page in this app.
134136///
137+ /// In particular this will return null if `url` is a `/#narrow/…` URL
138+ /// and any of the operator/operand pairs are invalid.
135139/// Since narrow links can combine operators in ways our [Narrow] type can't
136140/// represent, this can also return null for valid narrow links.
137141///
138142/// This can also return null for some valid narrow links that our Narrow
139143/// type *could* accurately represent. We should try to understand these
140- /// better, but some kinds will be rare, even unheard-of:
144+ /// better, but some kinds will be rare, even unheard-of. For example :
141145/// #narrow/stream/1-announce/stream/1-announce (duplicated operator)
142146// TODO(#252): handle all valid narrow links, returning a search narrow
143- Narrow ? parseInternalLink (Uri url, PerAccountStore store) {
147+ InternalLink ? parseInternalLink (Uri url, PerAccountStore store) {
144148 if (! _isInternalLink (url, store.realmUrl)) return null ;
145149
146150 final (category, segments) = _getCategoryAndSegmentsFromFragment (url.fragment);
147151 switch (category) {
148152 case 'narrow' :
149153 if (segments.isEmpty || ! segments.length.isEven) return null ;
150- return _interpretNarrowSegments (segments, store)? .narrow ;
154+ return _interpretNarrowSegments (segments, store);
151155 }
152156 return null ;
153157}
0 commit comments