Skip to content

Commit eae79aa

Browse files
author
Lalit Sharma
committed
feat: update changelog for version 1.1.48, fix Google Maps short-link parsing for Android, add regression test for state payload coordinates, and bump mobile version
1 parent ed9ed6c commit eae79aa

4 files changed

Lines changed: 54 additions & 3 deletions

File tree

CHANGELOG.md

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,17 @@ All notable changes to this project will be documented in this file.
55
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
66
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
77

8+
## [1.1.48] — 2026-02-27
9+
10+
### Fixed
11+
- Fixed Google Maps short-link parsing for Android response variants that do not include `pb=%21...2d...3d...` preview tokens by adding fallback extraction from embedded map-state coordinate arrays (for example `[[distance,lon,lat],[0,0,0],[w,h],zoom]`) in fetched HTML payloads.
12+
13+
### Added
14+
- Added regression test coverage for short-link parsing using the Android-style Google Maps state payload coordinate format.
15+
16+
### Changed
17+
- Bumped `apps/mobile` version to `1.1.48`.
18+
819
## [1.1.47] — 2026-02-27
920

1021
### Fixed

apps/mobile/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@eclipse-timer/mobile",
3-
"version": "1.1.47",
3+
"version": "1.1.48",
44
"private": true,
55
"main": "index.js",
66
"scripts": {

apps/mobile/src/utils/sharedMapLink.ts

Lines changed: 25 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,10 @@ const GOOGLE_PB_COORD_RE = new RegExp(
3737
`(?:%21|!)2d(${NUMBER_PART})(?:%21|!)3d(${NUMBER_PART})`,
3838
"i",
3939
);
40+
const GOOGLE_STATE_COORD_RE = new RegExp(
41+
`\\[\\[(${NUMBER_PART})\\s*,\\s*(${NUMBER_PART})\\s*,\\s*(${NUMBER_PART})\\]\\s*,\\s*\\[0\\s*,\\s*0\\s*,\\s*0\\]\\s*,\\s*\\[\\d+\\s*,\\s*\\d+\\]\\s*,\\s*(${NUMBER_PART})\\]`,
42+
"i",
43+
);
4044

4145
type ExpandedShortMapUrlResult = {
4246
expandedUrl: string;
@@ -161,6 +165,25 @@ function parseGooglePreviewCoordinatesFromText(input: string): { lat: number; lo
161165
return sanitizeCoordinates({ lat, lon });
162166
}
163167

168+
function parseGoogleStateCoordinatesFromText(input: string): { lat: number; lon: number } | null {
169+
if (!input) return null;
170+
171+
const match = input.match(GOOGLE_STATE_COORD_RE);
172+
if (!match) return null;
173+
174+
const [, _distanceRaw = "", lonRaw = "", latRaw = "", _zoomRaw = ""] = match;
175+
const lon = Number(lonRaw);
176+
const lat = Number(latRaw);
177+
if (!Number.isFinite(lat) || !Number.isFinite(lon)) return null;
178+
if (Math.abs(lat) > 90 || Math.abs(lon) > 180) return null;
179+
180+
return sanitizeCoordinates({ lat, lon });
181+
}
182+
183+
function parseGoogleCoordinatesFromText(input: string): { lat: number; lon: number } | null {
184+
return parseGooglePreviewCoordinatesFromText(input) ?? parseGoogleStateCoordinatesFromText(input);
185+
}
186+
164187
async function expandShortMapUrlWithResponse(
165188
url: string,
166189
options: ExpandShortMapUrlOptions = {},
@@ -340,10 +363,10 @@ export async function parseSharedMapLinkAsync(
340363
if (parsedExpandedLink) return parsedExpandedLink;
341364
}
342365

343-
let parsedFromPreviewPayload = parseGooglePreviewCoordinatesFromText(responseText ?? "");
366+
let parsedFromPreviewPayload = parseGoogleCoordinatesFromText(responseText ?? "");
344367
if (!parsedFromPreviewPayload && expandedUrl !== extracted) {
345368
const expandedPageText = await fetchMapPageText(expandedUrl, options);
346-
parsedFromPreviewPayload = parseGooglePreviewCoordinatesFromText(expandedPageText ?? "");
369+
parsedFromPreviewPayload = parseGoogleCoordinatesFromText(expandedPageText ?? "");
347370
}
348371

349372
if (!parsedFromPreviewPayload) return null;

apps/mobile/tests/shared-map-link.test.ts

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -185,6 +185,23 @@ describe("shared map link parser", () => {
185185
});
186186
});
187187

188+
it("parses short links from google state payload coordinates when preview token is absent", async () => {
189+
const fetchImpl = vi.fn(async () => ({
190+
url: "https://www.google.com/maps/place/Somewhere",
191+
text: async () =>
192+
'...,"uk",[[19529.54214059542,-1.55405635,52.276200949999996],[0,0,0],[1024,768],13.1],"token"...',
193+
}));
194+
195+
const parsed = await parseSharedMapLinkAsync("https://maps.app.goo.gl/abc123", { fetchImpl });
196+
197+
expect(parsed).toEqual({
198+
provider: "google",
199+
lat: 52.276200949999996,
200+
lon: -1.55405635,
201+
rawUrl: "https://maps.app.goo.gl/abc123",
202+
});
203+
});
204+
188205
it("re-fetches expanded url page when short-link response body is unavailable", async () => {
189206
const fetchImpl = vi.fn(async (input: string) => {
190207
if (input === "https://maps.app.goo.gl/abc123") {

0 commit comments

Comments
 (0)