Skip to content

Android: contacts import read and checked on the phone - #63

Merged
Axoineo merged 2 commits into
mainfrom
feat/android-native-3
Nov 19, 2026
Merged

Axoineo merged 2 commits into
mainfrom
feat/android-native-3

Conversation

@Axoineo

@Axoineo Axoineo commented Nov 19, 2026

Copy link
Copy Markdown
Owner

The Android app imports WhatsApp contacts from CSV, Excel and JSON files itself, instead of opening the web importer. Nothing changes on the website: this PR touches only the app, its tests and docs.

  • sheet_reader.dart and contact_import.dart port src/lib/parseSheet.js and src/lib/contactImport.js: same limits, same header and column detection, same skip reasons. Read off the screen's thread.
  • New app dependency phone_numbers_parser (MIT, Google's numbering metadata).
  • A parity test compares the Dart answers with the web functions' own answers, produced in Node from the same inputs (test/fixtures/contact_import_web.json, including a real .xlsx). It caught a real difference: with India as the destination country, the library turned +44 7911 123456 into an Indian number. Fixed (India is the caller country only) and pinned by a test.
  • The request body is checked against the API's 4 MB limit before sending, with a clear message.

Checked

  • App: flutter analyze clean, 413 tests (15 parity checks, a native import test with a stand-in server).
  • Android emulator, new contacts scenario 3 of 3: a CSV chosen in Android's own file picker, columns found, a landline and a blank explained, only the 2 good rows sent, a +44 number kept British, the list showing them.

Not checked

  • A real phone, and real large files (thousands of rows): speed on a low-end phone is unmeasured.
  • Excel files from every spreadsheet program: tested with a generated .xlsx and the web's own rules.

🤖 Generated with Claude Code

The Android app imports WhatsApp contacts from CSV, Excel (.xlsx) and JSON files
itself instead of opening the web importer. sheet_reader.dart and
contact_import.dart port src/lib/parseSheet.js and src/lib/contactImport.js
with the same limits (rows, columns, cell length, ZIP entries and inflation) and
the same column detection, run off the screen's thread. Numbers are checked with
phone_numbers_parser (MIT, Google's numbering metadata).

A test holds the port to answers the web's own functions gave in Node for the
same inputs (test/fixtures/contact_import_web.json, including a real .xlsx).
It caught one difference: with India as the destination country the library
rewrote +44 7911 123456 as an Indian number; India is now only the caller's
country, and a test pins it.

The import screen: choose a file, check or change the number, name, email and
company columns, see how many are ready and why the rest are skipped, import.
The 4 MB request limit is checked before sending.

Emulator: new `contacts` scenario, 3 of 3, through Android's file picker.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 19, 2026 •

Copy link
Copy Markdown
Codex Review Summary: ✅ Completed

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-19T12:09:18.391378Z 5b72350 PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@cloudflare-workers-and-pages

cloudflare-workers-and-pages Bot commented Nov 19, 2026 •

Copy link
Copy Markdown

Deploying dikho with  Cloudflare Pages  Cloudflare Pages

Latest commit: c295dde
Status: ✅  Deploy successful!
Preview URL: https://326ee895.dikho.pages.dev
Branch Preview URL: https://feat-android-native-3.dikho.pages.dev

View logs

The formatter ran over the whole test folder in the previous commit. These files
are back as they were, so the pull request shows only the import work.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@Axoineo
Axoineo merged commit 979c756 into main Nov 19, 2026
9 checks passed

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 5b72350a81

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment on lines +459 to +461
for (final column in table.columns) {
final value = (row[column] ?? '').trim();
if (value.isNotEmpty) attributes[column] = value.length > 2000 ? value.substring(0, 2000) : value;

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Reject oversized attribute headers before previewing

When a CSV, XLSX, or JSON header exceeds 100 characters and its column has values, this loop sends the raw header as an attribute key. /contacts/import-rows rejects rows with keys over 100 characters, so a sheet that previews as ready can fail to import. Validate the header length before building attributes and surface the constraint in the preview.

AGENTS.md reference: AGENTS.md:L87-L90

Useful? React with 👍 / 👎.

try {
final result = await widget.api.post('/contacts/import-rows', body);
if (!mounted) return;
widget.onImported(importSummary(result, read.preview.skipped));

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Preserve the imported audience for native campaigns

For a file whose numbers already exist in the CRM but belong to contacts outside the newest 2,000, /contacts/import-rows returns the file's contacts so a campaign wizard can select them, but this screen passes only a summary and discards that list. The native CampaignWizardScreen._loadContacts() later fetches only /contacts (the newest 2,000), so those imported contacts cannot be selected for a campaign. Preserve the returned contacts for the wizard or let it access the full imported set.

Useful? React with 👍 / 👎.

Comment thread docs/ANDROID.md
| `npm run check` (lint, tests, build, secret scan) | passed |
| `native`: drawer, native Clients (paging, details, edit and add through Supabase, unsaved-change prompt, New order into the native order form, Back on the start screen), native Leads (paging, search on the server, WhatsApp state, details, a link handed to another app), inbox paging, search, realtime, send, voice note recorded and accepted by the API's own check, microphone released on leaving a chat, Phone contacts, template to a number with consent and refusal, direct call, native Templates with previews, native WhatsApp dashboard (figures, changes, charts, range, button taps), a campaign's own screen and Back, the page handing `/whatsapp` to the app, native WhatsApp Contacts (server search, details, select and delete after asking, the web importer and Back), native Campaigns (progress, a campaign's screen, the new-campaign wizard sending once with a request id), native Vendors (details with the account masked, New PO into the web form, a new vendor saved vendor first then address), native Sales orders (purchase orders left out, the page handing `/sales-orders` to the app, figures and lines, Tax invoice saved as a PDF by the web page and Back to the list, a new order saved order first then its line with GST worked out), session across a restart, sign-out | 55 of 55 (2026-11-13) |
| `orders`: signs in through the app, then native Sales orders and Purchase orders (lists, details, the tax invoice drawn on the phone and its text read back from the saved PDF, tax total included, a new order and a new purchase order saved step by step) | 6 of 6 (2026-11-19) |
| `contacts`: signs in through the app, then native WhatsApp Contacts' import: a CSV with a title line written on the phone and chosen in Android's own file picker, its columns found, a landline and a blank number explained, only the two good rows sent (a +44 number kept British), the list showing them | 3 of 3 (2026-11-20) |

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Correct the future-dated emulator result

This row records the contacts emulator scenario as passing 3/3 on 2026-11-20, while the commit and its task note are dated 2026-11-19. That leaves the verification record dated a day after the change; correct the date or omit the result until its date is accurate.

AGENTS.md reference: AGENTS.md:L180-L180

Useful? React with 👍 / 👎.

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