Skip to content

feat: show a member when a phone is added to their account - #122

Merged
crazeydave merged 1 commit into
mainfrom
feat/device-notice
Nov 29, 2026
Merged

crazeydave merged 1 commit into
mainfrom
feat/device-notice

Conversation

@crazeydave

Copy link
Copy Markdown
Contributor

Stage 5, piece 2b. The Functions side is bleedingdeacons/fellowship#76. That PR's rules must be deployed before this build can read anything.

Why

The intergroup's site decides who a member is. A site that had been broken into could add a phone as any member, or re-key one, and receive their messages from then on. That can't be prevented from a phone, so it is made visible. Firebase records every change in deviceEvents (fellowship#75), and now Link shows it to the member.

What changes

  • The warning. After every successful sync, and when a notice is pushed while Link is open, the message list shows the newest change that gave another phone access (enrol, replaceKey, takeOver) and that this phone hasn't seen. For example: "A new phone was added to your account on 28 Nov 2026 at 22:24. If this wasn't you, contact the intergroup." Its buttons are See devices and That was me. It stays until answered.
    • What counts as seen: everything up to this phone's own enrolment or takeover, then everything up to the change the member last answered. The mark is kept per device id in Preferences.
    • A phone enrolled before the record began (28 Nov) has no enrolment in it, so the first sync after updating shows the newest change from another phone once.
    • A record that can't be read leaves the banner as it was; a network drop doesn't clear a warning.
  • The history. Settings has a new "See changes to your devices" button, which opens a read-only list, newest first. It marks this phone, and shows changes made by an admin and takeovers that didn't prove the key in red. Link can't remove another phone; the page says to contact the intergroup.
  • The pushed notice ({t: 'device', e, kind}): Android shows it on a new Account security channel, link_account; iOS shows a local notification. The words are lock-screen safe. Tapping opens Link, whose message list shows the warning.
  • The banners on the message list are now stacked in one column. Before, two at once drew over each other.
  • IFellowshipClient.FetchDeviceChangesAsync: a Firestore runQuery on deviceEvents, where memberId == this device's member, ordered by at descending, limit 50 (uses build: move to xunit 4, as Register did #75's index).

Limits

  • A member whose only phone is taken over or re-keyed has no other phone to warn. Fellowship's Devices screen (piece 3) covers that.
  • iOS: not built locally. The push path only matters once iOS push is working; until then iPhones get the in-app check only.

Tests

  • DeviceChanges.feature: 15 scenarios for what is shown and what isn't. I checked they run by breaking an assertion: 7 failed as expected, then I restored it.
  • DeviceChangeTests: push parsing, notification text and keys, banner wording in local time, and each kind's words.
  • FirebaseFellowshipClientTests: the query's shape and mapping, and that a refused or failed read is null, not an empty record.
  • Local runs: Tests 667/667, Specs 229 passed and 43 skipped as before, and the Android build is clean.

The intergroup's site decides who a member is, so a site that had been
broken into could add a phone as any member and receive their messages.
Firebase records every change to a member's devices; Link now shows it.

After every sync, and when a notice is pushed, the message list shows the
newest change that gave another phone access and that this phone hasn't
seen: "A new phone was added to your account on <date>. If this wasn't
you, contact the intergroup." It stays until the member answers "That was
me". A push can be lost, so the check at each sync is what makes sure.

Settings has the history: every change, newest first, with this phone
marked and changes made by an admin or takeovers that didn't prove the
key in red. Android shows the pushed notice on a new "Account security"
channel, and iOS as a local notification.
@crazeydave
crazeydave merged commit 010d643 into main Nov 29, 2026
10 checks passed
@crazeydave
crazeydave deleted the feat/device-notice branch November 29, 2026 02:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant