app name and icons 2

master
gitea 2 months ago
parent 923408e404
commit ea3c745a3a

@ -0,0 +1,69 @@
#!/bin/bash
# Script to sync APP_NAME from .env to platform-specific configuration files
# Usage: ./scripts/set_app_name.sh
set -e
# Colors for output
RED='\033[0;31m'
GREEN='\033[0;32m'
YELLOW='\033[1;33m'
NC='\033[0m' # No Color
# Check if .env file exists
if [ ! -f .env ]; then
echo -e "${RED}Error: .env file not found!${NC}"
echo "Please create .env file first (copy from .env.example)"
exit 1
fi
# Read APP_NAME from .env
APP_NAME=$(grep "^APP_NAME=" .env | cut -d '=' -f2 | tr -d '"' | tr -d "'" | xargs)
if [ -z "$APP_NAME" ]; then
echo -e "${RED}Error: APP_NAME not found in .env file!${NC}"
exit 1
fi
echo -e "${GREEN}Found APP_NAME: ${APP_NAME}${NC}"
echo "Updating platform-specific files..."
# Update Android AndroidManifest.xml
ANDROID_MANIFEST="android/app/src/main/AndroidManifest.xml"
if [ -f "$ANDROID_MANIFEST" ]; then
# Use sed to replace android:label value
if [[ "$OSTYPE" == "darwin"* ]]; then
# macOS
sed -i '' "s/android:label=\"[^\"]*\"/android:label=\"$APP_NAME\"/" "$ANDROID_MANIFEST"
else
# Linux
sed -i "s/android:label=\"[^\"]*\"/android:label=\"$APP_NAME\"/" "$ANDROID_MANIFEST"
fi
echo -e "${GREEN}✓ Updated Android: $ANDROID_MANIFEST${NC}"
else
echo -e "${YELLOW}⚠ Android manifest not found: $ANDROID_MANIFEST${NC}"
fi
# Update macOS AppInfo.xcconfig
MACOS_CONFIG="macos/Runner/Configs/AppInfo.xcconfig"
if [ -f "$MACOS_CONFIG" ]; then
# Use sed to replace PRODUCT_NAME value
if [[ "$OSTYPE" == "darwin"* ]]; then
# macOS
sed -i '' "s/^PRODUCT_NAME = .*/PRODUCT_NAME = $APP_NAME/" "$MACOS_CONFIG"
else
# Linux
sed -i "s/^PRODUCT_NAME = .*/PRODUCT_NAME = $APP_NAME/" "$MACOS_CONFIG"
fi
echo -e "${GREEN}✓ Updated macOS: $MACOS_CONFIG${NC}"
else
echo -e "${YELLOW}⚠ macOS config not found: $MACOS_CONFIG${NC}"
fi
echo -e "${GREEN}Done! App name has been updated to: ${APP_NAME}${NC}"
echo ""
echo "Note: You may need to rebuild the app for changes to take effect:"
echo " flutter clean"
echo " flutter run"
Loading…
Cancel
Save

Powered by TurnKey Linux.