From 9ca4be2e0afd4b1541e3cf211e8edd6399ffa914 Mon Sep 17 00:00:00 2001 From: Sahilll <150071026+sahilsharda@users.noreply.github.com> Date: Wed, 26 Nov 2025 02:15:55 +0530 Subject: [PATCH 1/2] docs(platforms): add README.md for android and ios packages - Create android/README.md with installation, usage, and configuration details - Create ios/README.md with installation, usage, and configuration details - Include version compatibility tables - Add links to official documentation and resources This ensures all core packages have proper documentation on npm and GitHub. --- android/README.md | 73 +++++++++++++++++++++++++++++++++++++++++++++ ios/README.md | 75 +++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 148 insertions(+) create mode 100644 android/README.md create mode 100644 ios/README.md diff --git a/android/README.md b/android/README.md new file mode 100644 index 000000000..5bd5bda31 --- /dev/null +++ b/android/README.md @@ -0,0 +1,73 @@ +# Capacitor Android + +The Capacitor Android package provides the Android runtime for Capacitor applications. It allows you to build and deploy your web application to Android devices and emulators. + +## Installation + +Install the android package: + +```bash +npm install @capacitor/android +``` + +Add the Android platform to your Capacitor project: + +```bash +npx cap add android +``` + +## Usage + +### Opening the Android Project + +To open your Android project in Android Studio: + +```bash +npx cap open android +``` + +### Running on Device/Emulator + +You can run your app directly from the command line: + +```bash +npx cap run android +``` + +## Configuration + +The Android configuration is handled primarily through `capacitor.config.ts` and the native `AndroidManifest.xml`. + +### Permissions + +Add permissions to your `android/app/src/main/AndroidManifest.xml` file as needed by your plugins. + +```xml + + +``` + +## Version Compatibility + +| Capacitor Version | Android Version | Gradle Version | +|------------------|-----------------|----------------| +| v6.x | Android 14+ | 8.2+ | +| v5.x | Android 13+ | 8.0+ | + +## Local Development + +If you're contributing to the Capacitor Android runtime: + +1. Clone the repository +2. Open `android/` in Android Studio +3. Let Gradle sync and build the project + +## Resources + +- [Android Deployment Guide](https://capacitorjs.com/docs/android/deploy) +- [Troubleshooting Android](https://capacitorjs.com/docs/android/troubleshooting) +- [Capacitor Documentation](https://capacitorjs.com/docs) + +## License + +- [MIT](https://github.com/ionic-team/capacitor/blob/HEAD/LICENSE) diff --git a/ios/README.md b/ios/README.md new file mode 100644 index 000000000..cb943ec9b --- /dev/null +++ b/ios/README.md @@ -0,0 +1,75 @@ +# Capacitor iOS + +The Capacitor iOS package provides the iOS runtime for Capacitor applications. It allows you to build and deploy your web application to iOS devices and simulators. + +## Installation + +Install the ios package: + +```bash +npm install @capacitor/ios +``` + +Add the iOS platform to your Capacitor project: + +```bash +npx cap add ios +``` + +## Usage + +### Opening the iOS Project + +To open your iOS project in Xcode: + +```bash +npx cap open ios +``` + +### Running on Simulator/Device + +You can run your app directly from the command line: + +```bash +npx cap run ios +``` + +## Configuration + +The iOS configuration is handled primarily through `capacitor.config.ts` and the native `Info.plist`. + +### Permissions + +Add usage descriptions to your `ios/App/App/Info.plist` file as needed by your plugins. + +```xml +NSCameraUsageDescription +We need access to the camera to take photos +NSLocationWhenInUseUsageDescription +We need your location to show local content +``` + +## Version Compatibility + +| Capacitor Version | iOS Version | Xcode Version | +|------------------|-------------|---------------| +| v6.x | iOS 13+ | 15.0+ | +| v5.x | iOS 13+ | 14.1+ | + +## Local Development + +If you're contributing to the Capacitor iOS runtime: + +1. Clone the repository +2. Run `npm install` in the root +3. Open `ios/Capacitor/Capacitor.xcworkspace` in Xcode + +## Resources + +- [iOS Deployment Guide](https://capacitorjs.com/docs/ios/deploy) +- [Troubleshooting iOS](https://capacitorjs.com/docs/ios/troubleshooting) +- [Capacitor Documentation](https://capacitorjs.com/docs) + +## License + +- [MIT](https://github.com/ionic-team/capacitor/blob/HEAD/LICENSE) From 385e5526aa4f72d3b5b0a37f17bef95d762d63fe Mon Sep 17 00:00:00 2001 From: Sahilll <150071026+sahilsharda@users.noreply.github.com> Date: Wed, 26 Nov 2025 02:23:08 +0530 Subject: [PATCH 2/2] feat(core): export native bridge utility functions - Export isRelativeOrProxyUrl and createProxyUrl on Capacitor global object - Update CapacitorInstance interface to include new methods - Remove TODO comments in native-bridge.ts This allows plugins and other parts of the system to use these utility functions for URL handling. --- core/native-bridge.ts | 7 ++++--- core/src/definitions-internal.ts | 10 ++++++++++ 2 files changed, 14 insertions(+), 3 deletions(-) diff --git a/core/native-bridge.ts b/core/native-bridge.ts index 8a6050f90..d756fed2c 100644 --- a/core/native-bridge.ts +++ b/core/native-bridge.ts @@ -125,11 +125,9 @@ const convertBody = async ( const CAPACITOR_HTTP_INTERCEPTOR = '/_capacitor_http_interceptor_'; const CAPACITOR_HTTP_INTERCEPTOR_URL_PARAM = 'u'; -// TODO: export as Cap function const isRelativeOrProxyUrl = (url: string | undefined): boolean => !url || !(url.startsWith('http:') || url.startsWith('https:')) || url.indexOf(CAPACITOR_HTTP_INTERCEPTOR) > -1; -// TODO: export as Cap function const createProxyUrl = (url: string, win: WindowCapacitor): string => { if (isRelativeOrProxyUrl(url)) return url; const bridgeUrl = new URL(win.Capacitor?.getServerUrl() ?? ''); @@ -237,6 +235,9 @@ const initBridge = (w: any): void => { return false; }; + cap.isRelativeOrProxyUrl = isRelativeOrProxyUrl; + cap.createProxyUrl = createProxyUrl; + win.Capacitor = cap; }; @@ -604,7 +605,7 @@ const initBridge = (w: any): void => { // XHR patch interface PatchedXMLHttpRequestConstructor extends XMLHttpRequest { - new (): XMLHttpRequest; + new(): XMLHttpRequest; } window.XMLHttpRequest = function () { diff --git a/core/src/definitions-internal.ts b/core/src/definitions-internal.ts index abe73d313..0f38eb32d 100644 --- a/core/src/definitions-internal.ts +++ b/core/src/definitions-internal.ts @@ -89,6 +89,16 @@ export interface CapacitorInstance extends CapacitorGlobal { * Low-level API used by the native bridge. */ withPlugin?: (pluginName: string, fn: (...args: any[]) => any) => void; + + /** + * Checks if a URL is relative or a proxy URL. + */ + isRelativeOrProxyUrl: (url: string | undefined) => boolean; + + /** + * Creates a proxy URL for the given URL. + */ + createProxyUrl: (url: string, win: WindowCapacitor) => string; } export interface MessageCallData {