Skip to content

chore: consolidate and migrate native-apps/unity_ii to icp-cli#1440

Open
marc0olo wants to merge 3 commits into
masterfrom
chore/migrate-unity-ii-to-icp-cli
Open

chore: consolidate and migrate native-apps/unity_ii to icp-cli#1440
marc0olo wants to merge 3 commits into
masterfrom
chore/migrate-unity-ii-to-icp-cli

Conversation

@marc0olo

Copy link
Copy Markdown
Member

Closes #1347.

Summary

  • Consolidates unity_ii_applink and unity_ii_universallink into unity_ii_deeplink (single canonical example)
  • Migrates from dfx to icp-cli: replaces dfx.json + webpack with icp.yaml, mops.toml, and Vite
  • Ports frontend to @icp-sdk/auth v7 + @icp-sdk/core v5.3 — no @dfinity/* packages remain
  • Fixes duplicate-check bug in AndroidPostBuildProcessor.cs (was already in the applink variant but missing from deeplink)
  • Makes Unity canister fields configurable via Inspector (removes hardcoded mainnet IDs, adds icGateway for local device testing)
  • Adds test.sh, CI workflow, and consolidated README documenting local vs. mainnet testability for all three URL-scheme variants

Key decisions

Double-delegation bridge — preserved intact; educational value depends on it.

No local II deploymenticp.yaml has no ii: true. The frontend hardcodes https://id.ai/authorize (the default in @icp-sdk/auth v7). icp-cli ≥ 0.2.4 trusts mainnet BLS signatures on the local replica, so delegations from mainnet II work locally.

SDK migration (@dfinity/*@icp-sdk/*):

  • AuthClient.create({identity}) + login({onSuccess})new AuthClient({identity}) + signIn()
  • ECDSAKeyIdentity, DelegationChain, Ed25519PublicKey from @icp-sdk/core/identity
  • safeGetCanisterEnv() from @icp-sdk/core/agent/canister-env

Motoko: mo:base/Principalmo:core/Principal (matches AGENTS.md and who_am_i)

What can be tested locally

Step Testable locally?
II login (mainnet II in local browser)
Deep link internetidentity:// callback
Backend call with delegation identity
Android App Links (HTTPS scheme) ❌ (requires deployed assetlinks.json over HTTPS)
iOS Universal Links ❌ (requires Apple dev account + HTTPS AASA)

Test plan

  • icp network start -d && icp deploy && bash test.sh passes in the native-apps/unity_ii_deeplink directory
  • Frontend builds without errors (npm run build --prefix frontend)
  • CI workflow passes (triggers on PR paths)
  • Full end-to-end test on a physical device via local deployment (see README "Testing locally" section)
  • Mainnet deployment with icp deploy -e ic and Unity Inspector updated with deployed canister IDs

🤖 Generated with Claude Code

Consolidates unity_ii_applink and unity_ii_universallink into
unity_ii_deeplink and migrates the entire example to icp-cli.

- Replace dfx.json + webpack with icp.yaml, mops.toml, and Vite
- Port frontend to @icp-sdk/auth v7 + @icp-sdk/core v5.3 (no @dfinity/* deps)
  - AuthClient.signIn() replaces the old login({onSuccess}) callback pattern
  - ECDSAKeyIdentity, DelegationChain, Ed25519PublicKey from @icp-sdk/core/identity
  - identityProvider defaults to https://id.ai/authorize (works locally since
    icp-cli >= 0.2.4 trusts mainnet II signatures on the local replica)
- Update app.mo to use mo:core/Principal (replaces mo:base/Principal)
- Add duplicate-check to AndroidPostBuildProcessor.cs (from applink variant)
- Make greetFrontend, greetBackendCanister, icGateway configurable fields
  in TestICPAgent.cs (removes hardcoded mainnet canister IDs)
- Add test.sh, CI workflow, and consolidated README documenting local vs
  mainnet testability for all three URL-scheme variants

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@marc0olo marc0olo requested review from a team as code owners July 10, 2026 13:33
marc0olo and others added 2 commits July 10, 2026 15:57
- After II login, show "Logged in as: <principal>" in the page instead of
  no visible feedback
- Replace silent console.error on Launch button with an inline message when
  the page was opened without a sessionkey (direct browser, not from Unity app)
- Add TESTING.md with the full test sequence for Levels 1–4

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
- Replace `icp canister id` with `icp canister status -i` throughout
  TESTING.md and README.md
- Note AgentAndPlugin as the GameObject that holds TestICPAgent

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
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.

Examples audit: restructure for docs integration (educational assessment)

1 participant