@@ -120,9 +120,10 @@ sealed class InternalLink {
120120/// The result of parsing some URL that points to a narrow on a Zulip realm,
121121/// when the narrow is of a type that this app understands.
122122class NarrowLink extends InternalLink {
123- NarrowLink (this .narrow, {required super .realmUrl});
123+ NarrowLink (this .narrow, this .nearMessageId, {required super .realmUrl});
124124
125125 final Narrow narrow;
126+ final int ? nearMessageId;
126127}
127128
128129/// Try to parse the given URL as a page in this app, on `store` 's realm.
@@ -184,6 +185,7 @@ NarrowLink? _interpretNarrowSegments(List<String> segments, PerAccountStore stor
184185 ApiNarrowDm ? dmElement;
185186 ApiNarrowWith ? withElement;
186187 Set <IsOperand > isElementOperands = {};
188+ int ? nearMessageId;
187189
188190 for (var i = 0 ; i < segments.length; i += 2 ) {
189191 final (operator , negated) = _parseOperator (segments[i]);
@@ -221,8 +223,11 @@ NarrowLink? _interpretNarrowSegments(List<String> segments, PerAccountStore stor
221223 // It is fine to have duplicates of the same [IsOperand].
222224 isElementOperands.add (IsOperand .fromRawString (operand));
223225
224- case _NarrowOperator .near: // TODO(#82): support for near
225- continue ;
226+ case _NarrowOperator .near:
227+ if (nearMessageId != null ) return null ;
228+ final messageId = int .tryParse (operand, radix: 10 );
229+ if (messageId == null ) return null ;
230+ nearMessageId = messageId;
226231
227232 case _NarrowOperator .unknown:
228233 return null ;
@@ -264,7 +269,7 @@ NarrowLink? _interpretNarrowSegments(List<String> segments, PerAccountStore stor
264269 return null ;
265270 }
266271
267- return NarrowLink (narrow, realmUrl: store.realmUrl);
272+ return NarrowLink (narrow, nearMessageId, realmUrl: store.realmUrl);
268273}
269274
270275@JsonEnum (fieldRename: FieldRename .kebab, alwaysCreate: true )
0 commit comments