also looking at this
feat(maps): add key-free native Android maps and shared map controls
#363
28 files
+1857
-481
Review threads live on the whole diff, not on one commit, so none are shown here - a thread's line means something in the branch's final form, and painting it into an intermediate step would put it on code it is not about.
| @@ -1,5 +1,3 @@ | ||
| 1 | import { androidMapHost, type AndroidMapProvider } from './native-map' | |
| 2 | export type { AndroidMapProvider } from './native-map' | |
| 3 | 1 | /** |
| 4 | 2 | * Craft Android Builder |
| 5 | 3 | * |
| @@ -9,8 +7,10 @@ export type { AndroidMapProvider } from './native-map' | ||
| 9 | 7 | import { cpSync, existsSync, mkdirSync, readFileSync, rmSync, statSync, writeFileSync } from 'node:fs' |
| 10 | 8 | import { dirname, extname, isAbsolute, join, relative, resolve, sep } from 'node:path' |
| 11 | 9 | import { $ } from 'bun' |
| 10 | import { androidMapHost, type AndroidMapProvider } from './native-map' | |
| 12 | 11 | import { renderAndroidPromiseRuntime } from './promise-runtime' |
| 13 | 12 | |
| 13 | export type { AndroidMapProvider } from './native-map' | |
| 14 | 14 | export { runKotlinFixture } from './testing.js' |
| 15 | 15 | export { createAndroidEmulator } from './emulator.js' |
| 16 | 16 | export type { AndroidEmulatorOptions, AndroidEmulatorSession } from './emulator.js' |
| @@ -2,6 +2,7 @@ import { readFileSync } from 'node:fs' | ||
| 2 | 2 | import { join } from 'node:path' |
| 3 | 3 | import { runInNewContext } from 'node:vm' |
| 4 | 4 | import { describe, expect, it } from 'bun:test' |
| 5 | import { androidMapHost } from '../packages/android/src/native-map' | |
| 5 | 6 | |
| 6 | 7 | const root = join(import.meta.dir, '..') |
| 7 | 8 | const ios = readFileSync(join(root, 'packages/ios/templates/CraftNativeScreen.swift'), 'utf8') |
| @@ -11,6 +12,8 @@ const iosHealth = readFileSync(join(root, 'packages/ios/templates/CraftHealth.sw | ||
| 11 | 12 | const iosWebAudio = readFileSync(join(root, 'packages/ios/templates/CraftWebAudio.swift'), 'utf8') |
| 12 | 13 | const iosFlatList = readFileSync(join(root, 'packages/ios/templates/CraftNativeFlatList.swift'), 'utf8') |
| 13 | 14 | const android = readFileSync(join(root, 'packages/android/templates/MainActivityNative.kt.template'), 'utf8') |
| 15 | .replace('', () => readFileSync(join(root, 'packages/android/templates', androidMapHost('google').template), 'utf8')) | |
| 16 | .replace('', () => androidMapHost('google').imports) | |
| 14 | 17 | const androidMutation = readFileSync(join(root, 'packages/android/templates/CraftNativeMutation.kt.template'), 'utf8') |
| 15 | 18 | const androidBuild = readFileSync(join(root, 'packages/android/templates/build.gradle.kts.app.template'), 'utf8') |
| 16 | 19 | const androidBuilder = readFileSync(join(root, 'packages/android/src/index.ts'), 'utf8') |
| @@ -568,9 +571,9 @@ describe('native renderer component contract', () => { renamed throughout | ||
| 568 | 571 | expect(android).toContain('override fun onLowMemory()') |
| 569 | 572 | expect(android).toContain('mapViews().forEach { it.lowMemory() }') |
| 570 | 573 | expect(android).toContain('released.filterIsInstance<CraftNativeMapView>().forEach { it.destroy() }') |
| 571 | expect(androidBuild).toContain('') | |
| 574 | expect(androidBuild).toContain('') | |
| 572 | 575 | expect(androidBuilder).toContain('mapsApiKey?: string') |
| 573 | expect(androidBuilder).toContain(".replace(/\\{\\{GOOGLE_MAPS_DEPENDENCY\\}\\}/g, config.renderer === 'native'") | |
| 576 | expect(androidBuilder).toContain(".replace(/\\{\\{NATIVE_MAP_DEPENDENCY\\}\\}/g, config.renderer === 'native'") | |
| 574 | 577 | expect(androidBuilder).toContain('com.google.android.geo.API_KEY') |
| 575 | 578 | expect(androidManifest).toContain('') |
| 576 | 579 | expect(guide).toContain('| `Map` | `CraftNativeMapView` (`MKMapView`) |') |