-
Notifications
You must be signed in to change notification settings - Fork 112
Feature/network info #120
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Feature/network info #120
Conversation
- Add NetworkInfo interface with type, connection status, network name, and signal strength - Implement Android network info using ping connectivity test - Implement iOS network info using go-ios info command with fallback - Implement iPhone Simulator network info with host connectivity assumption - Register mobile_get_network_info MCP tool for cross-platform network status - Add comprehensive error handling and logging for network operations
- Add comprehensive network info testing to validate return types and values - Test network info structure (type, isConnected, optional fields) - Validate network type enum values (wifi, cellular, none, unknown) - Ensure cross-platform compatibility and consistent behavior - Tests pass successfully on Android and iPhone Simulator
- Move local helper functions to private class methods - Consistent with existing patterns like isAscii(), getUiAutomatorDump() - Applied across Android, iOS, and iPhone Simulator implementations - No functional changes, only style alignment
- Replace simctl spawn ping with direct host ping command - iOS simulators use host network, so check host connectivity directly - Fixes false negative where simulator showed 'none' despite working internet - Now correctly detects wifi/connected state matching actual connectivity - Network info feature complete across all platforms
@eamon831 this is an excellent pull request! thank you so much!! 🤯 💯 . I'll review the code later today/tomorrow and after manually testing, let's merge this!!! thank you!!! |
@@ -310,14 +349,117 @@ export class AndroidRobot implements Robot { | |||
|
|||
// disable auto-rotation prior to setting the orientation | |||
this.adb("shell", "settings", "put", "system", "accelerometer_rotation", "0"); | |||
this.adb("shell", "content", "insert", "--uri", "content://settings/system", "--bind", "name:s:user_rotation", "--bind", `value:i:${orientationValue}`); | |||
this.adb( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why is most of the PR just re-formatting :(
why is it modifying these lines?
} | ||
} | ||
|
||
private async getWifiInfo() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the code is copy-pasted entirely from android.ts, no?
} | ||
} | ||
|
||
private parseWifiInfo(info: string) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
where is the response type?
assert.ok(typeof networkInfo.isConnected === "boolean"); | ||
|
||
// type should be one of the valid network types | ||
const validTypes = ["wifi", "cellular", "none", "unknown"]; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
shouldn't this test assert not only the type? cause these should be enforced by typescript. but maybe assert that all simulators return a specific type (is it wifi?)
🎯 Overview
Adds comprehensive network connectivity detection to mobile-mcp, providing real-time network information across Android devices, iOS devices, and iOS simulators through a unified
getNetworkInfo()
API.✨ Features Added
NetworkInfo
interfacemobile_get_network_info
command🧪 Use Cases
🔧 Implementation Details
Android Implementation:
dumpsys connectivity
iOS Device Implementation:
go-ios wifi info
iOS Simulator Implementation:
📊 API Interface
🧪 Testing
💡 Technical Highlights
🔧 Usage Examples
🛠️ Breaking Changes
None - This is a new feature addition.
📋 Checklist
Ready for review and merge! Particularly useful for testing applications against various internet connectivity scenarios. Fully tested and validated with Cursor AI development environment. 🚀