Skip to content

Add address book data service#37

Open
Jim8y wants to merge 11 commits into
neoorder:masterfrom
Jim8y:codex/address-book-core
Open

Add address book data service#37
Jim8y wants to merge 11 commits into
neoorder:masterfrom
Jim8y:codex/address-book-core

Conversation

@Jim8y

@Jim8y Jim8y commented Jun 20, 2026

Copy link
Copy Markdown
Contributor

Purpose

Split out the address-book data/service foundation from the larger address-book work so it can be reviewed independently.

Scope

  • Adds an idempotent contact schema migration for Note and IsAddressBookEntry.
  • Extends Contact with note/address-book metadata and display helpers.
  • Adds AddressBookService for Neo address normalization, label resolution, label availability checks, contact lookup, and contact suggestions.
  • Registers the service and ensures migrations run on app startup.
  • Adds the required English, Simplified Chinese, and Traditional Chinese resources.

Out of scope

  • No local transaction record storage.
  • No transfer history table or transfer recording.
  • No contacts page redesign.
  • No send/send-NFT UI integration.
  • No Shell/tabbar behavior changes.

Validation

  • xmllint --noout OneGateApp/Properties/Strings.resx OneGateApp/Properties/Strings.zh-Hans.resx OneGateApp/Properties/Strings.zh-Hant.resx
  • git diff --check
  • MD_APPLE_SDK_ROOT=/Applications/Xcode-26.5.0.app dotnet build OneGateApp/OneGateApp.csproj -f net10.0-ios -p:RuntimeIdentifier=iossimulator-arm64 -p:EnableCodeSigning=false -p:CodesignKey= -p:CodesignProvision= -p:ProvisioningType=automatic

Known existing warnings remain: SQLitePCLRaw NU1903 and iOS asset duplicate MT7158.

RecordTransferAsync loaded the contact via a NoTracking query (global
QueryTrackingBehavior.NoTracking), so mutating LastUsedAt/TransferCount/
LastTransactionHash on the detached entity was silently dropped by
SaveChangesAsync. Attach the entity as Modified so the update persists.
Jim8y added 3 commits June 20, 2026 18:20
…core

# Conflicts:
#	OneGateApp/Properties/Strings.resx
#	OneGateApp/Properties/Strings.zh-Hans.resx
#	OneGateApp/Properties/Strings.zh-Hant.resx
Comment thread OneGateApp/Data/Contact.cs Outdated
Per review, we do not store transaction records locally (online access only):
remove the ContactTransfer table/entity, the transfer-tracking Contact columns
(LastUsedAt/TransferCount/LastTransactionHash), RecordTransferAsync/GetTransfersAsync,
and the related strings. The address book keeps address/label/note + suggestions/search.
@Jim8y

Jim8y commented Jun 20, 2026

Copy link
Copy Markdown
Contributor Author

Erik's note about not storing transaction records locally is handled in the current branch state.

Audit check:

  • The final diff no longer contains local contact transaction/history storage changes.
  • git diff origin/master...Jim8y/codex/address-book-core --name-only | rg 'ContactTransaction|ContactTransfer|History|Transaction' returns no matches.
  • The original review thread is now outdated.

Previously posted validation for this PR includes Android and iOS simulator screenshots/build checks.

@erikzhang

Copy link
Copy Markdown
Contributor

conflicts

Copilot AI review requested due to automatic review settings June 21, 2026 18:59
@Jim8y

Jim8y commented Jun 21, 2026

Copy link
Copy Markdown
Contributor Author

Maintenance update after review audit:

  • Merged current master into this existing PR branch and resolved the remaining resource designer conflict.
  • Kept Erik’s direction intact: this PR no longer stores local transaction records/statistics; the address book remains contact-focused.
  • Fixed resource parity across all current .resx files, including the address-book keys and the existing Transfer key used by IntentsView.
  • Verified no conflict markers and no diff whitespace issues.

Validation:

  • Android build passed with AndroidSdkDirectory=/opt/homebrew/share/android-commandlinetools.
  • Android simulator install/launch passed on emulator-5554 using a complete Debug APK with EmbedAssembliesIntoApk=true. Foreground activity confirmed as org.neoorder.onegate/crc64e93af8ff8666345c.MainActivity; crash log empty.
  • iOS simulator build passed for net10.0-ios / iossimulator-arm64 using Xcode 26.5 and ad-hoc simulator signing override.
  • iOS simulator install/launch passed on OneGate-PR51-iPhone17 (64569B2C-8629-45DA-B52F-EC2B5DFA1C21).
  • Resource parity check passed: 15 resource files match 288 keys.

Screenshots:

Copilot AI 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.

Pull request overview

This PR extracts the address-book data/service foundation by extending the Contact model, adding an address-book oriented service layer, and wiring up a lightweight idempotent SQLite schema update plus supporting localized resources.

Changes:

  • Added AddressBookService for address normalization, label availability checks, entry lookup, and suggestion generation.
  • Extended Contact with Note, IsAddressBookEntry, and UI-friendly computed properties (display name, avatar text, short address, badge/detail text).
  • Added startup-time schema migration helpers to add new contact columns, registered the service, and updated string resources.

Reviewed changes

Copilot reviewed 20 out of 21 changed files in this pull request and generated 5 comments.

Show a summary per file
File Description
OneGateApp/Services/AddressBookService.cs New address book service (normalize/resolve address, label availability, entry listing/suggestions).
OneGateApp/Data/Contact.cs Adds note/address-book metadata and computed display helpers.
OneGateApp/Data/ApplicationDbContext.cs Adds idempotent schema migration helper to add Note/IsAddressBookEntry columns.
OneGateApp/App.xaml.cs Ensures migrations run on app startup.
OneGateApp/MauiProgram.cs Registers AddressBookService with DI.
OneGateApp/Properties/Strings*.resx Adds new UI strings (note/search/recent recipient/label exists) and reorders Transfer in some locales.
OneGateApp/Properties/Strings.Designer.cs Updates generated strongly-typed resource accessors for new keys.
Files not reviewed (1)
  • OneGateApp/Properties/Strings.Designer.cs: Generated file

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread OneGateApp/Services/AddressBookService.cs
Comment thread OneGateApp/Services/AddressBookService.cs
Comment thread OneGateApp/Services/AddressBookService.cs
Comment thread OneGateApp/Services/AddressBookService.cs Outdated
Comment thread OneGateApp/Data/ApplicationDbContext.cs
@Jim8y

Jim8y commented Jun 21, 2026

Copy link
Copy Markdown
Contributor Author

Review feedback update:

  • Narrowed address normalization error handling so invalid address formats return false without swallowing unrelated failures.
  • Moved address-book label resolution, label availability, entry listing, and suggestions filtering/sorting back into EF/SQLite queries instead of client-side AsEnumerable/ToArray scans.
  • Added LIKE escaping for address-book suggestions so user input containing %, _, or backslash is treated literally.
  • Parameterized the pragma_table_info lookup in AddColumnIfMissing while keeping sanitized identifiers for the ALTER TABLE statement.
  • Preserved Erik’s direction: no local transaction-record/statistics storage was reintroduced.

Validation:

  • git diff --check passed.
  • Android complete Debug APK build passed with AndroidSdkDirectory=/opt/homebrew/share/android-commandlinetools and EmbedAssembliesIntoApk=true.
  • Android simulator install/launch passed on emulator-5554. Foreground activity confirmed as org.neoorder.onegate/crc64e93af8ff8666345c.MainActivity; crash log empty.
  • iOS simulator build passed for net10.0-ios / iossimulator-arm64 using Xcode 26.5 and ad-hoc simulator signing override.
  • iOS simulator install/launch passed on OneGate-PR51-iPhone17 (64569B2C-8629-45DA-B52F-EC2B5DFA1C21).

Screenshots:

…core

# Conflicts:
#	OneGateApp/Properties/Strings.Designer.cs
@Jim8y

Jim8y commented Jun 22, 2026

Copy link
Copy Markdown
Contributor Author

Conflict refresh after latest master update.

  • Merged origin/master into codex/address-book-core and resolved the generated Strings.Designer.cs resource conflict by keeping the new base UnderstandAndContinue resource accessor together with the address book resources.
  • GitHub mergeability is back to MERGEABLE; unresolved review threads remain 0.
  • Android validation passed: dotnet build -f net10.0-android -c Debug -p:EmbedAssembliesIntoApk=true, then installed on emulator-5554, launched org.neoorder.onegate/crc64e93af8ff8666345c.MainActivity, confirmed process stayed running, and captured screenshot.
  • iOS validation passed: dotnet build -f net10.0-ios -c Debug -p:RuntimeIdentifier=iossimulator-arm64 with ad-hoc simulator signing, then installed/launched on iPhone 17 Pro iOS 26.5 simulator and captured screenshot.
  • Existing warning only: SQLitePCLRaw NU1903 package advisory.

Android screenshot:
Android PR 37

iOS screenshot:
iOS PR 37

…core

# Conflicts:
#	OneGateApp/Properties/Strings.Designer.cs
@Jim8y

Jim8y commented Jun 22, 2026

Copy link
Copy Markdown
Contributor Author

Base refresh validation update:

  • Merged latest origin/master (c3514d4) into codex/address-book-core; pushed merge commit e0ac95a.
  • Conflict resolution was limited to generated OneGateApp/Properties/Strings.Designer.cs: kept the base Developer Tools / DApp debug panel resources and removed the stale generated DeveloperModeEnabled accessor. No feature logic changed.
  • GitHub reports this PR as mergeable; unresolved review threads: 0.
  • Android emulator validation (emulator-5554): dotnet build OneGateApp/OneGateApp.csproj -f net10.0-android -c Debug -p:EmbedAssembliesIntoApk=true, installed the signed APK, launched org.neoorder.onegate/crc64e93af8ff8666345c.MainActivity, and captured a screenshot.
  • iOS simulator validation (iPhone 17 Pro, iOS 26.5): dotnet build OneGateApp/OneGateApp.csproj -f net10.0-ios -c Debug -p:RuntimeIdentifier=iossimulator-arm64, installed and launched the app, and captured a screenshot.
  • Existing warning observed: SQLitePCLRaw.lib.e_sqlite3 NU1903, unchanged/pre-existing.

Screenshots are stored as GitHub release assets only, not committed to the repo:

…core

# Conflicts:
#	OneGateApp/Properties/Strings.Designer.cs
@Jim8y

Jim8y commented Jun 22, 2026

Copy link
Copy Markdown
Contributor Author

Base refresh validation update:

  • Merged latest origin/master (3b20d5f) into codex/address-book-core; pushed merge commit 0ebd2fe.
  • Conflict resolution was limited to generated OneGateApp/Properties/Strings.Designer.cs: kept the base DApp submission localization accessors and preserved this PR branch. No feature logic changed.
  • GitHub reports this PR as mergeable; unresolved review threads: 0.
  • Android emulator validation (emulator-5554): dotnet build OneGateApp/OneGateApp.csproj -f net10.0-android -c Debug -p:EmbedAssembliesIntoApk=true, installed the signed APK, launched org.neoorder.onegate/crc64e93af8ff8666345c.MainActivity, confirmed a running pid, and captured a screenshot.
  • iOS simulator validation (iPhone 17 Pro, iOS 26.5): dotnet build OneGateApp/OneGateApp.csproj -f net10.0-ios -c Debug -p:RuntimeIdentifier=iossimulator-arm64, installed and launched the app, and captured a screenshot.
  • Existing warning observed: SQLitePCLRaw.lib.e_sqlite3 NU1903, unchanged/pre-existing.

Screenshots are stored as GitHub release assets only, not committed to the repo:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

3 participants