Fix Codex auth import and reset credit details
# Conflicts: # app/(tabs)/codex.tsx # app/(tabs)/index.tsx # app/(tabs)/settings.tsx # hooks/useCodexUsage.ts # lib/api/codexApi.ts # package-lock.json # package.json
This commit is contained in:
@@ -8,6 +8,13 @@ import { saveCodexAuth, loadCodexAuth } from "@/lib/storage";
|
||||
import type { CodexAuth } from "@/types/codex";
|
||||
import { COLORS } from "@/lib/constants";
|
||||
|
||||
function humanizeImportError(code: string): string {
|
||||
if (code === "DOCUMENT_NOT_READABLE") {
|
||||
return "The selected file could not be read. Try copying auth.json into Files or Downloads and import it again.";
|
||||
}
|
||||
return code;
|
||||
}
|
||||
|
||||
export default function OnboardingCodexScreen() {
|
||||
const [auth, setAuth] = useState<CodexAuth | null>(null);
|
||||
const [loading, setLoading] = useState(false);
|
||||
@@ -28,7 +35,7 @@ export default function OnboardingCodexScreen() {
|
||||
setAuth(parsed);
|
||||
} catch (e: unknown) {
|
||||
const msg = e instanceof Error ? e.message : "UNKNOWN_ERROR";
|
||||
if (msg !== "PICKER_CANCELLED") setError(msg);
|
||||
if (msg !== "PICKER_CANCELLED") setError(humanizeImportError(msg));
|
||||
} finally {
|
||||
setLoading(false);
|
||||
}
|
||||
@@ -86,7 +93,7 @@ export default function OnboardingCodexScreen() {
|
||||
<MaterialIcons name="check-circle" size={22} color={COLORS.codex} />
|
||||
</View>
|
||||
<View className="flex-1">
|
||||
<Text className="text-white font-semibold">Connected</Text>
|
||||
<Text className="text-white font-semibold">Imported</Text>
|
||||
{auth.accountId && (
|
||||
<Text className="text-neutral-500 text-sm font-mono">
|
||||
{auth.accountId.slice(0, 12)}…
|
||||
|
||||
@@ -77,7 +77,7 @@ export default function OnboardingDoneScreen() {
|
||||
Codex CLI
|
||||
</Text>
|
||||
<Text className="text-neutral-600 text-sm">
|
||||
{codexConfigured ? "Connected" : "Not configured"}
|
||||
{codexConfigured ? "Auth imported" : "Not configured"}
|
||||
</Text>
|
||||
</View>
|
||||
</View>
|
||||
@@ -105,7 +105,7 @@ export default function OnboardingDoneScreen() {
|
||||
Claude.ai
|
||||
</Text>
|
||||
<Text className="text-neutral-600 text-sm">
|
||||
{claudeConfigured ? "Connected" : "Not configured"}
|
||||
{claudeConfigured ? "Session saved" : "Not configured"}
|
||||
</Text>
|
||||
</View>
|
||||
</View>
|
||||
|
||||
Reference in New Issue
Block a user