Repository navigation
Android: contacts import read and checked on the phone - #63
Conversation
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>
Codex Review Summary: ✅ CompletedThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
Deploying dikho with
|
| Latest commit: |
c295dde
|
| Status: | ✅ Deploy successful! |
| Preview URL: | https://326ee895.dikho.pages.dev |
| Branch Preview URL: | https://feat-android-native-3.dikho.pages.dev |
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>
There was a problem hiding this comment.
💡 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".
| for (final column in table.columns) { | ||
| final value = (row[column] ?? '').trim(); | ||
| if (value.isNotEmpty) attributes[column] = value.length > 2000 ? value.substring(0, 2000) : value; |
There was a problem hiding this comment.
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)); |
There was a problem hiding this comment.
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 👍 / 👎.
| | `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) | |
There was a problem hiding this comment.
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 👍 / 👎.
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.dartandcontact_import.dartportsrc/lib/parseSheet.jsandsrc/lib/contactImport.js: same limits, same header and column detection, same skip reasons. Read off the screen's thread.phone_numbers_parser(MIT, Google's numbering metadata).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.Checked
flutter analyzeclean, 413 tests (15 parity checks, a native import test with a stand-in server).contactsscenario 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
🤖 Generated with Claude Code