Skip to content

Commit aee0984

Browse files
dadachiclaude
andauthored
Normalize substrate naming to single NativeAppTemplate stem (#45)
Rename all `Nat`-prefixed Kotlin symbols to `NativeAppTemplate*` (NatApp, NatAppState, NatConstants, NatPreferencesDataSource, NatNavHost, NatAlertDialog, NatBackground, NatBottomBar, NatDispatchers, NatNavigationBar*, NatOkHttpClient, NatPreferences, NatTheme, NatTypography, plus rememberNatAppState) and rename the 8 corresponding source files. Rename Compose theme styles `Theme.Nat` and `Theme.Nat.Splash` (and the `NightAdjusted.Theme.Nat` parent) to the `Theme.NativeAppTemplate.*` family in themes.xml, values-night/themes.xml, and AndroidManifest.xml. Rename the three Gradle properties `NATEMPLATE_API_{DOMAIN,PORT,SCHEME}` to `NATIVEAPPTEMPLATE_API_*` in app/build.gradle.kts, README.md, and CLAUDE.md. Rename the `NATA-XXXX` error-code prefix to `NATIVEAPPTEMPLATE-XXXX` across ApiException.kt, AppError.kt, CodedErrorTest.kt, CLAUDE.md, and CHANGELOG.md. Goal: every reference to the product uses one canonical stem (`NativeAppTemplate`) so the upstream substrate renamer's `NativeAppTemplate -> <slug-pascal>` rename pair handles every occurrence in one rule. After this PR, `rg "Nat[A-Z]|NATEMPLATE|NATA-"` returns zero matches outside `.git/` and `docs-private/`. Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
1 parent 36300a2 commit aee0984

78 files changed

Lines changed: 251 additions & 251 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

CHANGELOG.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ All notable changes to this project will be documented in this file.
66

77
### Added
88
- Implemented pagination for item tags list screen.
9-
- Implemented CodedError system with NATA-XXXX error codes.
9+
- Implemented CodedError system with NATIVEAPPTEMPLATE-XXXX error codes.
1010
- Added unit tests for utils, network, and pre-push hook.
1111
- Added Spotless + ktlint for Kotlin code formatting.
1212
- Added app version and reorganized settings sections.

CLAUDE.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ MVVM layered architecture following [Android Modern App Architecture](https://de
3939
- **Network Layer** (`network/`): `AuthInterceptor` for token injection, `RequestHelper` for request construction.
4040
- **DI** (`di/modules/`): Hilt modules — `NetModule` (Retrofit/OkHttp), `DataModule` (repository bindings), `DataStoreModule`, `DispatchersModule`, `CoroutineScopesModule`.
4141
- **DataStore** (`datastore/`): Proto DataStore for user preferences. Proto definitions live in `app/src/main/proto/`.
42-
- **Navigation**: `NatNavHost.kt` is the top-level nav graph. Three bottom-nav sections: Shops, Scan, Settings. Each section uses nested navigation graphs via `*BaseRoute`.
42+
- **Navigation**: `NativeAppTemplateNavHost.kt` is the top-level nav graph. Three bottom-nav sections: Shops, Scan, Settings. Each section uses nested navigation graphs via `*BaseRoute`.
4343

4444
## Key Patterns
4545

@@ -49,15 +49,15 @@ MVVM layered architecture following [Android Modern App Architecture](https://de
4949
- **Proto DataStore**: User preferences and NFC scan state are persisted via Protocol Buffers (lite).
5050

5151
## Error Handling (CodedError System)
52-
All errors should use the `CodedError` interface. Error codes use the `NATA-XXXX` prefix (NativeAppTemplate Android).
52+
All errors should use the `CodedError` interface. Error codes use the `NATIVEAPPTEMPLATE-XXXX` prefix (NativeAppTemplate Android).
5353

5454
| Range | Type | Description |
5555
|-------|------|-------------|
56-
| NATA-1xxx | App/general errors | Unexpected errors, catch-all |
57-
| NATA-2xxx | API/network errors | HTTP request failures, parsing errors |
56+
| NATIVEAPPTEMPLATE-1xxx | App/general errors | Unexpected errors, catch-all |
57+
| NATIVEAPPTEMPLATE-2xxx | API/network errors | HTTP request failures, parsing errors |
5858

5959
- New error types must implement `CodedError`
60-
- Use `codedDescription` (not `message` or `localizedMessage`) in all user-facing error messages — this prepends `[NATA-XXXX]` for `CodedError` types
60+
- Use `codedDescription` (not `message` or `localizedMessage`) in all user-facing error messages — this prepends `[NATIVEAPPTEMPLATE-XXXX]` for `CodedError` types
6161

6262
## Testing
6363

@@ -76,4 +76,4 @@ cp scripts/pre-push .git/hooks/pre-push
7676

7777
## Connecting to Local API
7878

79-
The debug `buildConfigField` entries in `app/build.gradle.kts` read `NATEMPLATE_API_DOMAIN`, `NATEMPLATE_API_PORT`, and `NATEMPLATE_API_SCHEME` via `project.findProperty(...)` (not `System.getenv` — Android Studio launched from Finder/Dock does not inherit shell env). Set them in `~/.gradle/gradle.properties` (user-global, per-developer); the same config then works from both the terminal and the IDE. Falls back to `https://api.nativeapptemplate.com` when unset. One-off override: `./gradlew -PNATEMPLATE_API_DOMAIN=... assembleDebug`.
79+
The debug `buildConfigField` entries in `app/build.gradle.kts` read `NATIVEAPPTEMPLATE_API_DOMAIN`, `NATIVEAPPTEMPLATE_API_PORT`, and `NATIVEAPPTEMPLATE_API_SCHEME` via `project.findProperty(...)` (not `System.getenv` — Android Studio launched from Finder/Dock does not inherit shell env). Set them in `~/.gradle/gradle.properties` (user-global, per-developer); the same config then works from both the terminal and the IDE. Falls back to `https://api.nativeapptemplate.com` when unset. One-off override: `./gradlew -PNATIVEAPPTEMPLATE_API_DOMAIN=... assembleDebug`.

README.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -124,12 +124,12 @@ By default the debug build hits the hosted API (`https://api.nativeapptemplate.c
124124
```
125125
# Use your current Wi-Fi IP (macOS: `ipconfig getifaddr en0`), or 10.0.2.2 for emulator → host.
126126
# Never use 127.0.0.1, localhost, or 0.0.0.0 — Rails and this app must agree on one reachable address.
127-
NATEMPLATE_API_DOMAIN=192.168.1.21
128-
NATEMPLATE_API_PORT=3000
129-
NATEMPLATE_API_SCHEME=http
127+
NATIVEAPPTEMPLATE_API_DOMAIN=192.168.1.21
128+
NATIVEAPPTEMPLATE_API_PORT=3000
129+
NATIVEAPPTEMPLATE_API_SCHEME=http
130130
```
131131

132-
Then `./gradlew assembleDebug` — or Build → Rebuild Project from Android Studio. The debug `buildConfigField` entries in `app/build.gradle.kts` read these via `project.findProperty(...)`, so the same config works from both the terminal and the IDE. Remove the three properties to fall back to the hosted default. For a one-off override: `./gradlew -PNATEMPLATE_API_DOMAIN=192.168.1.21 -PNATEMPLATE_API_PORT=3000 -PNATEMPLATE_API_SCHEME=http assembleDebug`.
132+
Then `./gradlew assembleDebug` — or Build → Rebuild Project from Android Studio. The debug `buildConfigField` entries in `app/build.gradle.kts` read these via `project.findProperty(...)`, so the same config works from both the terminal and the IDE. Remove the three properties to fall back to the hosted default. For a one-off override: `./gradlew -PNATIVEAPPTEMPLATE_API_DOMAIN=192.168.1.21 -PNATIVEAPPTEMPLATE_API_PORT=3000 -PNATIVEAPPTEMPLATE_API_SCHEME=http assembleDebug`.
133133

134134
Cleartext HTTP to private IPs is already permitted in debug via `app/src/debug/res/xml/network_security_config.xml`; the release config (in `app/src/main/`) keeps `api.nativeapptemplate.com` HTTPS-only.
135135

app/build.gradle.kts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,9 +26,9 @@ android {
2626
debug {
2727
extra["alwaysUpdateBuildId"] = false
2828
isDebuggable = true
29-
buildConfigField("String", "DOMAIN", "\"${(project.findProperty("NATEMPLATE_API_DOMAIN") as String?)?.trim() ?: "api.nativeapptemplate.com"}\"")
30-
buildConfigField("String", "PORT", "\"${(project.findProperty("NATEMPLATE_API_PORT") as String?)?.trim() ?: ""}\"")
31-
buildConfigField("String", "SCHEME", "\"${(project.findProperty("NATEMPLATE_API_SCHEME") as String?)?.trim() ?: "https"}\"")
29+
buildConfigField("String", "DOMAIN", "\"${(project.findProperty("NATIVEAPPTEMPLATE_API_DOMAIN") as String?)?.trim() ?: "api.nativeapptemplate.com"}\"")
30+
buildConfigField("String", "PORT", "\"${(project.findProperty("NATIVEAPPTEMPLATE_API_PORT") as String?)?.trim() ?: ""}\"")
31+
buildConfigField("String", "SCHEME", "\"${(project.findProperty("NATIVEAPPTEMPLATE_API_SCHEME") as String?)?.trim() ?: "https"}\"")
3232
}
3333

3434
release {

app/src/main/AndroidManifest.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
android:icon="@mipmap/ic_launcher"
1515
android:label="@string/app_name"
1616
android:supportsRtl="true"
17-
android:theme="@style/Theme.Nat.Splash"
17+
android:theme="@style/Theme.NativeAppTemplate.Splash"
1818
android:networkSecurityConfig="@xml/network_security_config"
1919
tools:ignore="GoogleAppIndexingWarning"
2020
tools:targetApi="tiramisu">

app/src/main/kotlin/com/nativeapptemplate/nativeapptemplatefree/MainActivity.kt

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -20,10 +20,10 @@ import androidx.lifecycle.repeatOnLifecycle
2020
import com.nativeapptemplate.nativeapptemplatefree.MainActivityUiState.Loading
2121
import com.nativeapptemplate.nativeapptemplatefree.MainActivityUiState.Success
2222
import com.nativeapptemplate.nativeapptemplatefree.data.login.LoginRepository
23-
import com.nativeapptemplate.nativeapptemplatefree.designsystem.theme.NatTheme
23+
import com.nativeapptemplate.nativeapptemplatefree.designsystem.theme.NativeAppTemplateTheme
2424
import com.nativeapptemplate.nativeapptemplatefree.model.DarkThemeConfig
25-
import com.nativeapptemplate.nativeapptemplatefree.ui.app_root.NatApp
26-
import com.nativeapptemplate.nativeapptemplatefree.ui.app_root.rememberNatAppState
25+
import com.nativeapptemplate.nativeapptemplatefree.ui.app_root.NativeAppTemplateApp
26+
import com.nativeapptemplate.nativeapptemplatefree.ui.app_root.rememberNativeAppTemplateAppState
2727
import com.nativeapptemplate.nativeapptemplatefree.utils.NetworkMonitor
2828
import dagger.hilt.android.AndroidEntryPoint
2929
import kotlinx.coroutines.launch
@@ -89,15 +89,15 @@ class MainActivity : ComponentActivity() {
8989
onDispose {}
9090
}
9191

92-
val appState = rememberNatAppState(
92+
val appState = rememberNativeAppTemplateAppState(
9393
loginRepository = loginRepository,
9494
networkMonitor = networkMonitor,
9595
)
9696

97-
NatTheme(
97+
NativeAppTemplateTheme(
9898
darkTheme = darkTheme,
9999
) {
100-
NatApp(appState)
100+
NativeAppTemplateApp(appState)
101101
}
102102
}
103103
}

app/src/main/kotlin/com/nativeapptemplate/nativeapptemplatefree/NatConstants.kt renamed to app/src/main/kotlin/com/nativeapptemplate/nativeapptemplatefree/NativeAppTemplateConstants.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
package com.nativeapptemplate.nativeapptemplatefree
22

3-
object NatConstants {
3+
object NativeAppTemplateConstants {
44
const val SUPPORT_MAIL: String = "support@nativeapptemplate.com"
55
const val SUPPORT_WEBSITE_URL: String = "https://nativeapptemplate.com"
66
const val FAQS_URL: String = "https://nativeapptemplate.com/faqs"

app/src/main/kotlin/com/nativeapptemplate/nativeapptemplatefree/common/errors/ApiException.kt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,15 +7,15 @@ sealed class ApiException(message: String, cause: Throwable? = null) :
77
val code: Int,
88
val apiMessage: String,
99
) : ApiException("$apiMessage [Status: $code]") {
10-
override val errorCode: String = "NATA-2001"
10+
override val errorCode: String = "NATIVEAPPTEMPLATE-2001"
1111
override val errorDescription: String = "$apiMessage [Status: $code]"
1212
}
1313

1414
class UnprocessableError(
1515
val rawMessage: String,
1616
cause: Throwable? = null,
1717
) : ApiException("Not processable error($rawMessage).", cause) {
18-
override val errorCode: String = "NATA-2002"
18+
override val errorCode: String = "NATIVEAPPTEMPLATE-2002"
1919
override val errorDescription: String = "Processing error: $rawMessage"
2020
}
2121
}

app/src/main/kotlin/com/nativeapptemplate/nativeapptemplatefree/common/errors/AppError.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ sealed class AppError(
66
) : Exception(errorDescription), CodedError {
77

88
class Unexpected(detail: String? = null) : AppError(
9-
errorCode = "NATA-1001",
9+
errorCode = "NATIVEAPPTEMPLATE-1001",
1010
errorDescription = "Unexpected error" + if (detail != null) ": $detail" else "",
1111
)
1212
}

app/src/main/kotlin/com/nativeapptemplate/nativeapptemplatefree/data/item_tag/ItemTagRepositoryImpl.kt

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
package com.nativeapptemplate.nativeapptemplatefree.data.item_tag
22

3-
import com.nativeapptemplate.nativeapptemplatefree.datastore.NatPreferencesDataSource
3+
import com.nativeapptemplate.nativeapptemplatefree.datastore.NativeAppTemplatePreferencesDataSource
44
import com.nativeapptemplate.nativeapptemplatefree.model.*
55
import com.nativeapptemplate.nativeapptemplatefree.network.Dispatcher
6-
import com.nativeapptemplate.nativeapptemplatefree.network.NatDispatchers
6+
import com.nativeapptemplate.nativeapptemplatefree.network.NativeAppTemplateDispatchers
77
import com.nativeapptemplate.nativeapptemplatefree.network.emitApiResponse
88
import kotlinx.coroutines.CoroutineDispatcher
99
import kotlinx.coroutines.flow.first
@@ -12,9 +12,9 @@ import kotlinx.coroutines.flow.flowOn
1212
import javax.inject.Inject
1313

1414
class ItemTagRepositoryImpl @Inject constructor(
15-
private val mtcPreferencesDataSource: NatPreferencesDataSource,
15+
private val mtcPreferencesDataSource: NativeAppTemplatePreferencesDataSource,
1616
private val api: ItemTagApi,
17-
@Dispatcher(NatDispatchers.IO) private val ioDispatcher: CoroutineDispatcher,
17+
@Dispatcher(NativeAppTemplateDispatchers.IO) private val ioDispatcher: CoroutineDispatcher,
1818
) : ItemTagRepository {
1919

2020
override fun getItemTags(

0 commit comments

Comments
 (0)