ai/at
1
0

add ios social-app

This commit is contained in:
2025-12-06 21:14:08 +09:00
parent 948551c185
commit 335a88aa05
5 changed files with 164 additions and 0 deletions

8
ios/README.md Normal file
View File

@@ -0,0 +1,8 @@
今回の./ios (social-app)開発の要点をまとめます。
1. MITのライセンスを遵守すること、iosアプリとして出品しても問題ないようにすること
https://raw.githubusercontent.com/bluesky-social/social-app/refs/heads/main/LICENSE
2. "Bluesky"という名称を使用しないこと。アイコンの変更。リンクの変更
3. selfhostでも動くこと。本来のsocial-appは動きませんので、これは不便なのでiosアプリに出品することにしました。なお、これはすでにpatchで実現しています。

14
ios/config.zsh Normal file
View File

@@ -0,0 +1,14 @@
APP_NAME="syuis"
DEVICE_ID="xxx"
REPO_DIR="../repos/social-app"
APP_SLUG="syuis"
APP_SCHEME="syui"
BUNDLE_ID="is.syu"
APP_GROUP="group.is.syu"
SERVICE_URL="https://syu.is"
HELP_URL="https://syu.is/help"
PRIVACY_URL="https://syu.is/privacy"
TERMS_URL="https://syu.is/terms"
REPO_DIR="../repos/social-app"
CONFIG_FILE="$REPO_DIR/app.config.js"
CONSTANTS_FILE="$REPO_DIR/src/lib/constants.ts"

BIN
ios/icon.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 60 KiB

48
ios/preview.zsh Executable file
View File

@@ -0,0 +1,48 @@
#!/bin/zsh
set -e
d=${0:a:h}
source $d/config.zsh
cd $d
echo "Running iOS preview workflow..."
cd "$REPO_DIR"
# 0. Environment Setup (Fix Node Version)
export NVM_DIR="$HOME/.nvm"
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" # This loads nvm
echo "Checking Node version..."
# Try to use LTS or v22/v20 if available, as v25 causes build errors with better-sqlite3
if command -v nvm >/dev/null; then
nvm use 22 || nvm use 20 || echo "Warning: Could not switch to Node 22/20. Current: $(node -v)"
else
echo "nvm not found, using system node: $(node -v)"
fi
# 1. Install dependencies
echo "1. Installing dependencies (yarn)..."
yarn install
# 2. Prebuild (Generate ios directory)
echo "2. Running Expo Prebuild..."
# Clean old ios folder if exists to ensure fresh config application
rm -rf ios
npx expo prebuild --platform ios --clean
# 3. CocoaPods
echo "3. Installing CocoaPods..."
# Ensure PATH includes Homebrew ruby gems if needed (User suggestion)
export PATH="/opt/homebrew/lib/ruby/gems/3.4.0/bin:$PATH"
cd ios
pod install
cd ..
# 4. Signing (Manual Step)
echo "4. Opening Xcode for Signing..."
# Find the project file
#XCODE_PROJ=$(find ios -name "*.xcodeproj" | head -n 1)
open ./ios/${APP_NAME}.xcodeproj
# 5. Run
echo "5. Building and Running on device $DEVICE_ID..."
npx expo run:ios
#npx expo run:ios --device "$DEVICE_ID" --configuration Release

94
ios/setup.zsh Executable file
View File

@@ -0,0 +1,94 @@
#!/bin/zsh
set -e
d=${0:a:h}
source $d/config.zsh
# Sed compatibility wrapper
function sediment() {
if [[ "$OSTYPE" == "darwin"* ]]; then
sed -i '' "$@"
else
sed -i "$@"
fi
}
echo "Configuring $APP_NAME..."
# Check if repo exists
if [ ! -d "$REPO_DIR" ]; then
echo "Cloning social-app..."
git clone https://github.com/bluesky-social/social-app "$REPO_DIR"
else
echo "Updating social-app..."
pushd "$REPO_DIR"
git stash -u
if ! git pull; then
echo "Git pull failed. Resetting..."
git reset --hard HEAD
git pull
fi
popd
fi
# Backup config if not exists
if [ ! -f "$CONFIG_FILE.bak" ]; then
cp "$CONFIG_FILE" "$CONFIG_FILE.bak"
fi
# 1. app.config.js modifications
echo "Updating app.config.js..."
# Replace name
sediment "s/name: 'Bluesky'/name: '$APP_NAME'/g" "$CONFIG_FILE"
sediment "s/name: 'Aiat'/name: '$APP_NAME'/g" "$CONFIG_FILE" # Handle re-run
sediment "s/slug: 'bluesky'/slug: '$APP_SLUG'/g" "$CONFIG_FILE"
sediment "s/slug: 'aiat'/slug: '$APP_SLUG'/g" "$CONFIG_FILE" # Handle re-run
sediment "s/scheme: 'bsky'/scheme: '$APP_SCHEME'/g" "$CONFIG_FILE"
# Replace Bundle ID and App Group
sediment "s/xyz.blueskyweb.app/$BUNDLE_ID/g" "$CONFIG_FILE"
sediment "s/group.app.bsky/$APP_GROUP/g" "$CONFIG_FILE"
# Inject NSAppTransportSecurity for development/preview (Allow Arbitrary Loads)
if ! grep -q "NSAppTransportSecurity" "$CONFIG_FILE"; then
if [[ "$OSTYPE" == "darwin"* ]]; then
sed -i '' "/ios: {/a\\
infoPlist: {\\
NSAppTransportSecurity: {\\
NSAllowsArbitraryLoads: true,\\
},\\
}," "$CONFIG_FILE"
else
sed -i "/ios: {/a\\
infoPlist: {\\
NSAppTransportSecurity: {\\
NSAllowsArbitraryLoads: true,\\
},\\
}," "$CONFIG_FILE"
fi
fi
# 2. constants.ts modifications
echo "Updating constants.ts..."
sediment "s|export const BSKY_SERVICE = 'https://bsky.social'|export const BSKY_SERVICE = '$SERVICE_URL'|g" "$CONSTANTS_FILE"
sediment "s|export const BSKY_SERVICE_DID = 'did:web:bsky.social'|export const BSKY_SERVICE_DID = 'did:web:syu.is'|g" "$CONSTANTS_FILE"
sediment "s|export const PUBLIC_BSKY_SERVICE = 'https://public.api.bsky.app'|export const PUBLIC_BSKY_SERVICE = 'https://bsky.syu.is'|g" "$CONSTANTS_FILE"
sediment "s|const HELP_DESK_LANG = 'en-us'|const HELP_DESK_LANG = 'ja-jp'|g" "$CONSTANTS_FILE"
sediment "s|export const HELP_DESK_URL = \`https://blueskyweb.zendesk.com/hc/\${HELP_DESK_LANG}\`|export const HELP_DESK_URL = '$HELP_URL'|g" "$CONSTANTS_FILE"
# 3. Footer/Link replacements (Global text replacement for specific URLs)
echo "Replacing links..."
grep -r "https://bsky.social/about/blog" "$REPO_DIR/src" -l | xargs -I {} zsh -c "if [[ \"\$OSTYPE\" == \"darwin\"* ]]; then sed -i '' \"s|https://bsky.social/about/blog|$HELP_URL|g\" {}; else sed -i \"s|https://bsky.social/about/blog|$HELP_URL|g\" {}; fi"
grep -r "https://bsky.social/about/blog/jobs" "$REPO_DIR/src" -l | xargs -I {} zsh -c "if [[ \"\$OSTYPE\" == \"darwin\"* ]]; then sed -i '' \"s|https://bsky.social/about/blog/jobs|$HELP_URL|g\" {}; else sed -i \"s|https://bsky.social/about/blog/jobs|$HELP_URL|g\" {}; fi"
grep -r "/support/privacy" "$REPO_DIR/src" -l | xargs -I {} zsh -c "if [[ \"\$OSTYPE\" == \"darwin\"* ]]; then sed -i '' \"s|/support/privacy|$PRIVACY_URL|g\" {}; else sed -i \"s|/support/privacy|$PRIVACY_URL|g\" {}; fi"
grep -r "/support/tos" "$REPO_DIR/src" -l | xargs -I {} zsh -c "if [[ \"\$OSTYPE\" == \"darwin\"* ]]; then sed -i '' \"s|/support/tos|$TERMS_URL|g\" {}; else sed -i \"s|/support/tos|$TERMS_URL|g\" {}; fi"
# 4. Icon replacement (Stub)
if [ -f "icon.png" ]; then
echo "Updating icon..."
cp "icon.png" "$REPO_DIR/assets/icon.png"
cp "icon.png" "$REPO_DIR/assets/icon-android-notification.png"
fi
echo "Setup complete."