mattermost-mobile/CLAUDE-IOS-SIMULATOR.md
Nick Misasi 12c8d80f4a
[MM-66591] Channel Summaries with Agents (#9405)
* Add support for Channel Summarization, inline citations

* Add support for Channel Summarization, inline citations

* Revert package-lock to master

* i18n fixes

* e2e fixes

* Remove a few tests as they're already covered by unit

* Ensure channel summary is offline compatible

- Add channel persistence check before switching to summary channel
- Fetch and persist channel/membership if not in database
- Fix TypeScript error handling for unknown error types
- Update tests to properly mock DatabaseManager

* Fixes

* Fix expo-image patch file - remove accidental build artifacts

The patch file was accidentally corrupted with build artifacts from
node_modules/expo-image/android/build/ including .dex files, results.bin,
and Oops.rej. This was causing the 16KB page size compatibility patch
to fail during CI.

* Fix iOS date picker spacing and placeholder text

- Increase snap points on iOS to accommodate inline date picker spinner
- Update AI prompt placeholder to "Ask AI about this channel"

* Fix padding

* Address PR review feedback from larkox

- Fix i18n: use defineMessages pattern instead of separate labelId/defaultLabel
- Replace custom SummaryOptionItem with existing OptionItem component
- Add ScrollView for scrollability on smaller phones
- Extract AgentItem to separate file, use FlatList for virtualization
- Extract DateInputField component, unify DateTimePicker, add useCallback
- Consolidate types into app/products/agents/types/api.ts
- Remove unnecessary fetchPostById (WebSocket handles post delivery)
- Use jest.mocked() instead of 'as jest.Mock' for type safety
- Improve transform.ts: use urlParse, add post ID length constraint,
  validate internal links with serverUrl parameter, add subpath support
- Add transform.test.ts cases for external links, subpaths, URL encoding
- Remove unnecessary Platform.select in inline_entity_link
- Revert video_file.tsx and prefetch.ts to use cachePath (patches include types)

* Update en.json with new channel summary option translations

Added missing translation keys for the defineMessages pattern used
in channel summary sheet options.

* Fix regex patterns and add negative assertions per PR review

- Use exact 26-character constraint in post ID regex instead of
  permissive pattern followed by validation
- Use specific identifier pattern in channel regex instead of [^/]+
- Remove unused ID_PATH_PATTERN and IDENTIFIER_PATH_PATTERN imports
- Add negative assertions to processInlineEntities tests to verify
  mutual exclusivity of link vs inline_entity_link nodes

* Add test cases for non-internal URLs and escaped slashes

Per PR review feedback, added tests for:
- Non-internal URLs with similar shape to internal links
- URLs with escaped slashes (%2F) in various positions

* Improve UI consistency for channel summary date picker and AI input

- Add focus state (border highlight) to AI prompt input on Ask Agents sheet
- Add active state highlight to Start/End date fields in date range picker
- Increase back button tap area on date range picker using hitSlop
- Fix date picker theme mismatch by setting themeVariant based on app theme
- Apply initial date when opening picker so value matches displayed date

Co-authored-by: Cursor <cursoragent@cursor.com>

* Gate AskAgentsOption behind agents plugin availability check

Add a plugin availability check for the "Ask Agents" feature that
mirrors the webapp's useGetAgentsBridgeEnabled hook. Calls
GET /api/v4/agents/status on WebSocket connect and plugin status
change events, stores the result in an RxJS BehaviorSubject
ephemeral store, and conditionally renders the AskAgentsOption
component based on the plugin being available.

Co-authored-by: Cursor <cursoragent@cursor.com>

* Fix quick actions tests and default date range to last 7 days

Mock useAgentsConfig in quick actions tests so the Ask Agents button
renders when agents plugin availability is gated. Default the date
range picker to the last 7 days instead of empty.

Co-authored-by: Cursor <cursoragent@cursor.com>

* Address enahum's review feedback on channel summaries PR

- Remove pluginEnabled=false on network error in agents_status
- Use enableDynamicSizing for channel summary bottom sheet
- Extract channel navigation logic to switchToChannelByName action
- Move icon color to stylesheet, null guard to parent in InlineEntityLink
- Replace custom URL parsing with parseDeepLink in transform.ts
- Reorder channel membership check before API request in channel_summary
- Use FormattedText, FormattedDate, FloatingTextInput consistently
- Use getErrorMessage for proper intl error handling in alerts
- Simplify agent_item to always use expo-image, memoize styles
- Gate Ask Agents item count on agentsEnabled in header.tsx
- Clean up CLAUDE-IOS-SIMULATOR.md per review suggestions
- Update tests to match new behavior

Co-authored-by: Cursor <cursoragent@cursor.com>

* Fix i18n extraction for date_range_picker translated strings

Add defineMessages declarations so the i18n extraction tool can find
the translated string IDs passed through custom props to DateInputField.

Co-authored-by: Cursor <cursoragent@cursor.com>

* Fix agent profile image not rendering on agent selector

* Reduce channel summary bottom sheet max height from 80% to 50%

The 80% snap point created too much whitespace below the options.
50% fits the main content well while still leaving room for the
iOS date picker spinner when the custom date range view is shown.

Co-authored-by: Cursor <cursoragent@cursor.com>

* Adjust channel summary bottom sheet max height to 65%

50% was too short, cutting off the iOS date picker spinner.
65% provides enough room for the date range view with spinner
while keeping the main options view compact.

Co-authored-by: Cursor <cursoragent@cursor.com>

* Use platform-specific max height for channel summary bottom sheet

iOS uses 65% to accommodate the inline date picker spinner.
Android uses 50% since its modal date picker doesn't need extra space.

Co-authored-by: Cursor <cursoragent@cursor.com>

* Reduce height on android slightly

* Final tweaks for spacing

* Address PR review feedback from larkox and pvev

- Use MessageDescriptor props instead of separate id/defaultMessage strings in DateInputField
- Extract hitSlop constant outside component for render stability
- Normalize date range to UTC start/end of day to avoid timezone data loss
- Replace hardcoded '#FFFFFF' with theme.buttonColor

Co-authored-by: Cursor <cursoragent@cursor.com>

---------

Co-authored-by: Mattermost Build <build@mattermost.com>
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-02-13 07:00:43 -05:00

172 lines
4 KiB
Markdown

# iOS Simulator Setup Guide for AI Agents
This guide documents the process for setting up and running the Mattermost Mobile app on an iOS simulator.
## Prerequisites Check
Before starting, verify these are installed:
```bash
# Check Xcode
xcodebuild -version
# Check CocoaPods
pod --version
# Check Node.js
node --version
# Check npm dependencies
test -d node_modules && echo "node_modules exists" || echo "Run: npm install"
```
## Step 1: iOS Simulator Runtime
Check if iOS simulators are available:
```bash
xcrun simctl list devices available
```
If no devices are listed or you see "Install Started", you need to download the iOS platform:
```bash
xcodebuild -downloadPlatform iOS
```
**Note:** This downloads ~8GB and takes several minutes. The command runs in the foreground and shows progress.
## Step 2: CocoaPods Installation
### Critical: Set UTF-8 Encoding
CocoaPods requires UTF-8 encoding. Always set this before running pod commands:
```bash
export LANG=en_US.UTF-8
export LC_ALL=en_US.UTF-8
```
### Install Pods (Apple Silicon Mac)
```bash
cd ios
RCT_NEW_ARCH_ENABLED=0 arch -x86_64 pod install
```
### Common CocoaPods Issues
#### Issue: "Unicode Normalization not appropriate for ASCII-8BIT"
**Solution:** Set UTF-8 encoding as shown above.
#### Issue: Podfile.lock version conflicts
**Solution:** Clean install:
```bash
cd ios
rm -rf Pods Podfile.lock build
export LANG=en_US.UTF-8 && export LC_ALL=en_US.UTF-8
RCT_NEW_ARCH_ENABLED=0 arch -x86_64 pod install
```
#### Issue: GitHub SSH timeouts during pod install
**Symptom:** Errors like "Connection to github.com port 22: Operation timed out"
**Solution:** Temporarily configure git to use HTTPS instead of SSH:
```bash
git config --global url."https://github.com/".insteadOf git@github.com:
```
**IMPORTANT:** Revert this after pod install completes, or the user won't be able to push:
```bash
git config --global --unset url.https://github.com/.insteadof
```
**Warning:** Never leave git URL rewrites in place without informing the user!
## Step 3: Start Metro Bundler (if not already running)
```bash
npm start
```
Wait for "Dev server ready" message before proceeding.
## Step 4: Run iOS App (if not already built)
### Using npm script
```bash
npm run ios -- --simulator="iPhone 17 Pro"
```
### Or specify a different simulator
List available simulators first:
```bash
xcrun simctl list devices available | grep -E "iPhone|iPad"
```
Then run with your chosen device:
```bash
npm run ios -- --simulator="iPhone 16e"
```
## Build Times
- **First build:** 10-30 minutes (compiles all native code)
- **Subsequent builds:** Much faster (incremental)
- **JS/TS changes:** ~3 seconds hot reload (no native rebuild needed)
## Troubleshooting Build Failures
### Getting Better Error Messages
If `npm run ios` fails, run xcodebuild directly for clearer errors:
```bash
xcodebuild -workspace ios/Mattermost.xcworkspace \
-configuration Debug \
-scheme Mattermost \
-destination 'platform=iOS Simulator,name=iPhone 17 Pro' \
2>&1 | grep -E "error:|fatal error"
```
### Clean Build
If builds fail mysteriously, try a clean build:
```bash
# Clean Xcode derived data
rm -rf ~/Library/Developer/Xcode/DerivedData/Mattermost-*
# Clean and reinstall pods
cd ios
rm -rf Pods build
export LANG=en_US.UTF-8 && export LC_ALL=en_US.UTF-8
RCT_NEW_ARCH_ENABLED=0 arch -x86_64 pod install
```
### Opening in Xcode
For complex build issues, open in Xcode for better debugging:
```bash
open ios/Mattermost.xcworkspace
```
Then select your simulator target and press Cmd+B to build.
## Quick Reference
```bash
# Full setup sequence (Apple Silicon)
export LANG=en_US.UTF-8 && export LC_ALL=en_US.UTF-8
cd ios && RCT_NEW_ARCH_ENABLED=0 arch -x86_64 pod install && cd ..
npm start &
sleep 10
npm run ios -- --simulator="iPhone 17 Pro"
```
## Do NOT Modify
- **Git configuration:** Never permanently change git URL rewrites without reverting
- **Podfile:** Don't add modular_headers to pods unless you understand the implications
- **New Architecture:** Keep `RCT_NEW_ARCH_ENABLED=0` as the project uses the old architecture