Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions app/webview/[path].tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@ import { SafeAreaView } from 'react-native-safe-area-context';
import CookieManager from '@react-native-cookies/cookies';
import { generateUserAgent } from '../../utils/userAgent';
import { ShouldStartLoadRequest } from 'react-native-webview/lib/WebViewTypes';
import { webUrl } from '../../constants/constants';

const WEB_URL = 'https://agit.gg';
const ALLOWED_URL_SCHEMES = ['kakaotalk', 'nidlogin'];
const userAgent = generateUserAgent();

Expand Down Expand Up @@ -80,7 +80,7 @@ export default function Index() {
onNavigationStateChange={(navState) => {
canGoBackRef.current = navState.canGoBack;
}}
source={{ uri: `${WEB_URL}/${local.path ?? ''}` }}
source={{ uri: `${webUrl}/${local.path ?? ''}` }}
style={styles.webview}
javaScriptEnabled
domStorageEnabled
Expand Down
5 changes: 5 additions & 0 deletions constants/constants.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
const APP_ENV = process.env.APP_ENV || 'production';

export const apiUrl =
APP_ENV === 'development' ? 'https://api.stage.agit.gg' : 'https://api.agit.gg';
export const webUrl = APP_ENV === 'development' ? 'https://stage.agit.gg' : 'https://agit.gg';
Comment on lines +1 to +5
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🔴 Critical

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
# Check for environment variable handling configuration in babel or metro config
echo "=== Checking babel.config.js for env plugin ==="
fd -t f "babel.config" --exec cat {}

echo ""
echo "=== Checking for .env related packages in package.json ==="
fd -t f "package.json" -d 1 --exec cat {} | jq '.dependencies, .devDependencies' 2>/dev/null | grep -i -E "(dotenv|env|babel-plugin)"

echo ""
echo "=== Checking metro.config.js ==="
fd -t f "metro.config" --exec cat {}

echo ""
echo "=== Full package.json for complete dependency list ==="
cat package.json 2>/dev/null | head -100

Repository: BCSDLab/KONECT_REACT_NATIVE

Length of output: 2388


🏁 Script executed:

#!/bin/bash
# Check for .env files
echo "=== Checking for .env files ==="
fd -t f "\.env" || echo "No .env files found"

echo ""
echo "=== Checking if babel.config.js or metro.config.js exist as js/ts files ==="
ls -la | grep -E "(babel|metro)" || echo "No babel or metro config files"

echo ""
echo "=== Check app.json for expo configuration ==="
fd -t f "app.json" --exec cat {}

Repository: BCSDLab/KONECT_REACT_NATIVE

Length of output: 257


Verify process.env.APP_ENV is properly configured for React Native.

In React Native, environment variables via process.env require explicit bundler configuration (e.g., babel-plugin-transform-inline-environment-variables, react-native-dotenv, or similar). Without proper setup, process.env.APP_ENV will be undefined at runtime, always falling back to 'production'. Currently, no babel configuration, environment variable packages, or .env files are present in the project.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@constants/constants.ts` around lines 1 - 5, The constants file relies on
process.env.APP_ENV (symbols: APP_ENV, apiUrl, webUrl in constants/constants.ts)
which won't be available in plain React Native; update the project to use a
supported RN env solution (e.g., install and configure react-native-config or a
Babel plugin like react-native-dotenv / transform-inline-environment-variables
and add .env files) and replace the current lookup with the configured mechanism
(or use the RN __DEV__ boolean as a safe fallback) so APP_ENV is correctly
populated at build/runtime and apiUrl/webUrl resolve as intended.

3 changes: 2 additions & 1 deletion services/forceupdate.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { Platform } from 'react-native';
import * as Application from 'expo-application';
import { apiUrl } from '../constants/constants';

interface ForceUpdateVersionResponse {
platform: string;
Expand All @@ -18,7 +19,7 @@ export const versionToNumber = (version: string): number => {

export const getForceUpdate = async (): Promise<ForceUpdateVersionResponse | null> => {
try {
const response = await fetch(`https://api.agit.gg/versions/latest?platform=${platform}`, {
const response = await fetch(`${apiUrl}/versions/latest?platform=${platform}`, {
method: 'GET',
});

Expand Down