├── example
├── src
│ ├── assets
│ │ └── .gitkeep
│ ├── app
│ │ ├── app.component.css
│ │ ├── app-routing.module.ts
│ │ ├── app.module.ts
│ │ ├── app.component.html
│ │ ├── app.component.spec.ts
│ │ └── app.component.ts
│ ├── styles.css
│ ├── favicon.ico
│ ├── main.ts
│ └── index.html
├── android
│ ├── app
│ │ ├── .gitignore
│ │ ├── src
│ │ │ ├── main
│ │ │ │ ├── res
│ │ │ │ │ ├── drawable
│ │ │ │ │ │ ├── splash.png
│ │ │ │ │ │ └── ic_launcher_background.xml
│ │ │ │ │ ├── mipmap-hdpi
│ │ │ │ │ │ ├── ic_launcher.png
│ │ │ │ │ │ ├── ic_launcher_round.png
│ │ │ │ │ │ └── ic_launcher_foreground.png
│ │ │ │ │ ├── mipmap-mdpi
│ │ │ │ │ │ ├── ic_launcher.png
│ │ │ │ │ │ ├── ic_launcher_round.png
│ │ │ │ │ │ └── ic_launcher_foreground.png
│ │ │ │ │ ├── drawable-land-hdpi
│ │ │ │ │ │ └── splash.png
│ │ │ │ │ ├── drawable-land-mdpi
│ │ │ │ │ │ └── splash.png
│ │ │ │ │ ├── drawable-land-xhdpi
│ │ │ │ │ │ └── splash.png
│ │ │ │ │ ├── drawable-port-hdpi
│ │ │ │ │ │ └── splash.png
│ │ │ │ │ ├── drawable-port-mdpi
│ │ │ │ │ │ └── splash.png
│ │ │ │ │ ├── drawable-port-xhdpi
│ │ │ │ │ │ └── splash.png
│ │ │ │ │ ├── mipmap-xhdpi
│ │ │ │ │ │ ├── ic_launcher.png
│ │ │ │ │ │ ├── ic_launcher_round.png
│ │ │ │ │ │ └── ic_launcher_foreground.png
│ │ │ │ │ ├── mipmap-xxhdpi
│ │ │ │ │ │ ├── ic_launcher.png
│ │ │ │ │ │ ├── ic_launcher_round.png
│ │ │ │ │ │ └── ic_launcher_foreground.png
│ │ │ │ │ ├── mipmap-xxxhdpi
│ │ │ │ │ │ ├── ic_launcher.png
│ │ │ │ │ │ ├── ic_launcher_round.png
│ │ │ │ │ │ └── ic_launcher_foreground.png
│ │ │ │ │ ├── drawable-land-xxhdpi
│ │ │ │ │ │ └── splash.png
│ │ │ │ │ ├── drawable-land-xxxhdpi
│ │ │ │ │ │ └── splash.png
│ │ │ │ │ ├── drawable-port-xxhdpi
│ │ │ │ │ │ └── splash.png
│ │ │ │ │ ├── drawable-port-xxxhdpi
│ │ │ │ │ │ └── splash.png
│ │ │ │ │ ├── values
│ │ │ │ │ │ ├── ic_launcher_background.xml
│ │ │ │ │ │ ├── strings.xml
│ │ │ │ │ │ └── styles.xml
│ │ │ │ │ ├── xml
│ │ │ │ │ │ ├── config.xml
│ │ │ │ │ │ └── file_paths.xml
│ │ │ │ │ ├── mipmap-anydpi-v26
│ │ │ │ │ │ ├── ic_launcher.xml
│ │ │ │ │ │ └── ic_launcher_round.xml
│ │ │ │ │ ├── layout
│ │ │ │ │ │ └── activity_main.xml
│ │ │ │ │ └── drawable-v24
│ │ │ │ │ │ └── ic_launcher_foreground.xml
│ │ │ │ ├── java
│ │ │ │ │ └── com
│ │ │ │ │ │ └── example
│ │ │ │ │ │ └── webview_overlay
│ │ │ │ │ │ └── MainActivity.java
│ │ │ │ ├── assets
│ │ │ │ │ └── capacitor.config.json
│ │ │ │ └── AndroidManifest.xml
│ │ │ ├── test
│ │ │ │ └── java
│ │ │ │ │ └── com
│ │ │ │ │ └── getcapacitor
│ │ │ │ │ └── myapp
│ │ │ │ │ └── ExampleUnitTest.java
│ │ │ └── androidTest
│ │ │ │ └── java
│ │ │ │ └── com
│ │ │ │ └── getcapacitor
│ │ │ │ └── myapp
│ │ │ │ └── ExampleInstrumentedTest.java
│ │ ├── capacitor.build.gradle
│ │ ├── proguard-rules.pro
│ │ └── build.gradle
│ ├── gradle
│ │ └── wrapper
│ │ │ ├── gradle-wrapper.jar
│ │ │ └── gradle-wrapper.properties
│ ├── settings.gradle
│ ├── capacitor.settings.gradle
│ ├── variables.gradle
│ ├── build.gradle
│ ├── gradle.properties
│ ├── .gitignore
│ ├── gradlew.bat
│ └── gradlew
├── ios
│ ├── App
│ │ ├── App
│ │ │ ├── Assets.xcassets
│ │ │ │ ├── Contents.json
│ │ │ │ ├── AppIcon.appiconset
│ │ │ │ │ ├── AppIcon-512@2x.png
│ │ │ │ │ ├── AppIcon-20x20@1x.png
│ │ │ │ │ ├── AppIcon-20x20@2x.png
│ │ │ │ │ ├── AppIcon-20x20@3x.png
│ │ │ │ │ ├── AppIcon-29x29@1x.png
│ │ │ │ │ ├── AppIcon-29x29@2x.png
│ │ │ │ │ ├── AppIcon-29x29@3x.png
│ │ │ │ │ ├── AppIcon-40x40@1x.png
│ │ │ │ │ ├── AppIcon-40x40@2x.png
│ │ │ │ │ ├── AppIcon-40x40@3x.png
│ │ │ │ │ ├── AppIcon-60x60@2x.png
│ │ │ │ │ ├── AppIcon-60x60@3x.png
│ │ │ │ │ ├── AppIcon-76x76@1x.png
│ │ │ │ │ ├── AppIcon-76x76@2x.png
│ │ │ │ │ ├── AppIcon-20x20@2x-1.png
│ │ │ │ │ ├── AppIcon-29x29@2x-1.png
│ │ │ │ │ ├── AppIcon-40x40@2x-1.png
│ │ │ │ │ ├── AppIcon-83.5x83.5@2x.png
│ │ │ │ │ └── Contents.json
│ │ │ │ └── Splash.imageset
│ │ │ │ │ ├── splash-2732x2732.png
│ │ │ │ │ ├── splash-2732x2732-1.png
│ │ │ │ │ ├── splash-2732x2732-2.png
│ │ │ │ │ └── Contents.json
│ │ │ ├── config.xml
│ │ │ ├── capacitor.config.json
│ │ │ ├── Base.lproj
│ │ │ │ ├── Main.storyboard
│ │ │ │ └── LaunchScreen.storyboard
│ │ │ ├── Info.plist
│ │ │ └── AppDelegate.swift
│ │ ├── App.xcodeproj
│ │ │ ├── project.xcworkspace
│ │ │ │ └── contents.xcworkspacedata
│ │ │ └── project.pbxproj
│ │ ├── App.xcworkspace
│ │ │ ├── contents.xcworkspacedata
│ │ │ └── xcshareddata
│ │ │ │ └── IDEWorkspaceChecks.plist
│ │ ├── Podfile
│ │ └── Podfile.lock
│ └── .gitignore
├── tsconfig.app.json
├── tsconfig.spec.json
├── .editorconfig
├── capacitor.config.ts
├── .gitignore
├── tsconfig.json
├── README.md
├── package.json
└── angular.json
├── android
├── .gitignore
├── src
│ ├── main
│ │ ├── res
│ │ │ ├── .gitkeep
│ │ │ ├── drawable
│ │ │ │ └── icon.png
│ │ │ └── layout
│ │ │ │ └── bridge_layout_main.xml
│ │ ├── AndroidManifest.xml
│ │ └── java
│ │ │ └── com
│ │ │ └── clearxp
│ │ │ └── capacitor
│ │ │ └── webviewoverlay
│ │ │ ├── FileChooserWebChromeClient.java
│ │ │ └── WebviewOverlayPlugin.java
│ ├── test
│ │ └── java
│ │ │ └── com
│ │ │ └── getcapacitor
│ │ │ └── ExampleUnitTest.java
│ └── androidTest
│ │ └── java
│ │ └── com
│ │ └── getcapacitor
│ │ └── android
│ │ └── ExampleInstrumentedTest.java
├── gradle
│ └── wrapper
│ │ ├── gradle-wrapper.jar
│ │ └── gradle-wrapper.properties
├── settings.gradle
├── proguard-rules.pro
├── gradle.properties
├── build.gradle
├── gradlew.bat
└── gradlew
├── .prettierignore
├── src
├── index.ts
├── definitions.ts
└── plugin.ts
├── ios
└── Plugin
│ ├── Resources
│ └── icon.png
│ ├── Plugin.xcworkspace
│ ├── xcuserdata
│ │ └── max.xcuserdatad
│ │ │ └── UserInterfaceState.xcuserstate
│ └── contents.xcworkspacedata
│ ├── Plugin.xcodeproj
│ ├── project.xcworkspace
│ │ └── contents.xcworkspacedata
│ ├── xcuserdata
│ │ └── max.xcuserdatad
│ │ │ └── xcschemes
│ │ │ └── xcschememanagement.plist
│ └── project.pbxproj
│ ├── Plugin
│ ├── Plugin.h
│ ├── Info.plist
│ ├── Plugin.m
│ └── Plugin.swift
│ └── Podfile
├── .editorconfig
├── tsconfig.json
├── rollup.config.js
├── ClearCapacitorWebviewOverlay.podspec
├── README.md
├── .gitignore
└── package.json
/example/src/assets/.gitkeep:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/android/.gitignore:
--------------------------------------------------------------------------------
1 | /build
2 |
--------------------------------------------------------------------------------
/android/src/main/res/.gitkeep:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/example/src/app/app.component.css:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/.prettierignore:
--------------------------------------------------------------------------------
1 | build
2 | dist
3 |
--------------------------------------------------------------------------------
/example/android/app/.gitignore:
--------------------------------------------------------------------------------
1 | /build/*
2 | !/build/.npmkeep
3 |
--------------------------------------------------------------------------------
/src/index.ts:
--------------------------------------------------------------------------------
1 | export * from './definitions';
2 | export * from './plugin';
3 |
--------------------------------------------------------------------------------
/example/src/styles.css:
--------------------------------------------------------------------------------
1 | /* You can add global styles to this file, and also import other style files */
2 |
--------------------------------------------------------------------------------
/example/src/favicon.ico:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/clear/capacitor-webview-overlay/main/example/src/favicon.ico
--------------------------------------------------------------------------------
/ios/Plugin/Resources/icon.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/clear/capacitor-webview-overlay/main/ios/Plugin/Resources/icon.png
--------------------------------------------------------------------------------
/example/ios/App/App/Assets.xcassets/Contents.json:
--------------------------------------------------------------------------------
1 | {
2 | "info" : {
3 | "version" : 1,
4 | "author" : "xcode"
5 | }
6 | }
--------------------------------------------------------------------------------
/android/src/main/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
3 |
4 |
--------------------------------------------------------------------------------
/android/src/main/res/drawable/icon.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/clear/capacitor-webview-overlay/main/android/src/main/res/drawable/icon.png
--------------------------------------------------------------------------------
/android/gradle/wrapper/gradle-wrapper.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/clear/capacitor-webview-overlay/main/android/gradle/wrapper/gradle-wrapper.jar
--------------------------------------------------------------------------------
/android/settings.gradle:
--------------------------------------------------------------------------------
1 | include ':capacitor-android'
2 | project(':capacitor-android').projectDir = new File('../node_modules/@capacitor/android/capacitor')
--------------------------------------------------------------------------------
/example/android/gradle/wrapper/gradle-wrapper.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/clear/capacitor-webview-overlay/main/example/android/gradle/wrapper/gradle-wrapper.jar
--------------------------------------------------------------------------------
/example/android/app/src/main/res/drawable/splash.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/clear/capacitor-webview-overlay/main/example/android/app/src/main/res/drawable/splash.png
--------------------------------------------------------------------------------
/example/android/app/src/main/res/mipmap-hdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/clear/capacitor-webview-overlay/main/example/android/app/src/main/res/mipmap-hdpi/ic_launcher.png
--------------------------------------------------------------------------------
/example/android/app/src/main/res/mipmap-mdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/clear/capacitor-webview-overlay/main/example/android/app/src/main/res/mipmap-mdpi/ic_launcher.png
--------------------------------------------------------------------------------
/example/android/app/src/main/res/drawable-land-hdpi/splash.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/clear/capacitor-webview-overlay/main/example/android/app/src/main/res/drawable-land-hdpi/splash.png
--------------------------------------------------------------------------------
/example/android/app/src/main/res/drawable-land-mdpi/splash.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/clear/capacitor-webview-overlay/main/example/android/app/src/main/res/drawable-land-mdpi/splash.png
--------------------------------------------------------------------------------
/example/android/app/src/main/res/drawable-land-xhdpi/splash.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/clear/capacitor-webview-overlay/main/example/android/app/src/main/res/drawable-land-xhdpi/splash.png
--------------------------------------------------------------------------------
/example/android/app/src/main/res/drawable-port-hdpi/splash.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/clear/capacitor-webview-overlay/main/example/android/app/src/main/res/drawable-port-hdpi/splash.png
--------------------------------------------------------------------------------
/example/android/app/src/main/res/drawable-port-mdpi/splash.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/clear/capacitor-webview-overlay/main/example/android/app/src/main/res/drawable-port-mdpi/splash.png
--------------------------------------------------------------------------------
/example/android/app/src/main/res/drawable-port-xhdpi/splash.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/clear/capacitor-webview-overlay/main/example/android/app/src/main/res/drawable-port-xhdpi/splash.png
--------------------------------------------------------------------------------
/example/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/clear/capacitor-webview-overlay/main/example/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/example/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/clear/capacitor-webview-overlay/main/example/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/example/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/clear/capacitor-webview-overlay/main/example/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/example/android/app/src/main/res/drawable-land-xxhdpi/splash.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/clear/capacitor-webview-overlay/main/example/android/app/src/main/res/drawable-land-xxhdpi/splash.png
--------------------------------------------------------------------------------
/example/android/app/src/main/res/drawable-land-xxxhdpi/splash.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/clear/capacitor-webview-overlay/main/example/android/app/src/main/res/drawable-land-xxxhdpi/splash.png
--------------------------------------------------------------------------------
/example/android/app/src/main/res/drawable-port-xxhdpi/splash.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/clear/capacitor-webview-overlay/main/example/android/app/src/main/res/drawable-port-xxhdpi/splash.png
--------------------------------------------------------------------------------
/example/android/app/src/main/res/drawable-port-xxxhdpi/splash.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/clear/capacitor-webview-overlay/main/example/android/app/src/main/res/drawable-port-xxxhdpi/splash.png
--------------------------------------------------------------------------------
/example/android/app/src/main/res/values/ic_launcher_background.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | #FFFFFF
4 |
--------------------------------------------------------------------------------
/example/android/app/src/main/res/mipmap-hdpi/ic_launcher_round.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/clear/capacitor-webview-overlay/main/example/android/app/src/main/res/mipmap-hdpi/ic_launcher_round.png
--------------------------------------------------------------------------------
/example/android/app/src/main/res/mipmap-mdpi/ic_launcher_round.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/clear/capacitor-webview-overlay/main/example/android/app/src/main/res/mipmap-mdpi/ic_launcher_round.png
--------------------------------------------------------------------------------
/example/android/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/clear/capacitor-webview-overlay/main/example/android/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png
--------------------------------------------------------------------------------
/example/android/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/clear/capacitor-webview-overlay/main/example/android/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png
--------------------------------------------------------------------------------
/example/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/clear/capacitor-webview-overlay/main/example/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png
--------------------------------------------------------------------------------
/example/android/app/src/main/res/mipmap-hdpi/ic_launcher_foreground.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/clear/capacitor-webview-overlay/main/example/android/app/src/main/res/mipmap-hdpi/ic_launcher_foreground.png
--------------------------------------------------------------------------------
/example/android/app/src/main/res/mipmap-mdpi/ic_launcher_foreground.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/clear/capacitor-webview-overlay/main/example/android/app/src/main/res/mipmap-mdpi/ic_launcher_foreground.png
--------------------------------------------------------------------------------
/example/android/app/src/main/res/mipmap-xhdpi/ic_launcher_foreground.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/clear/capacitor-webview-overlay/main/example/android/app/src/main/res/mipmap-xhdpi/ic_launcher_foreground.png
--------------------------------------------------------------------------------
/example/android/app/src/main/res/mipmap-xxhdpi/ic_launcher_foreground.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/clear/capacitor-webview-overlay/main/example/android/app/src/main/res/mipmap-xxhdpi/ic_launcher_foreground.png
--------------------------------------------------------------------------------
/example/ios/App/App/Assets.xcassets/AppIcon.appiconset/AppIcon-512@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/clear/capacitor-webview-overlay/main/example/ios/App/App/Assets.xcassets/AppIcon.appiconset/AppIcon-512@2x.png
--------------------------------------------------------------------------------
/example/ios/App/App/Assets.xcassets/Splash.imageset/splash-2732x2732.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/clear/capacitor-webview-overlay/main/example/ios/App/App/Assets.xcassets/Splash.imageset/splash-2732x2732.png
--------------------------------------------------------------------------------
/example/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher_foreground.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/clear/capacitor-webview-overlay/main/example/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher_foreground.png
--------------------------------------------------------------------------------
/example/ios/App/App/Assets.xcassets/AppIcon.appiconset/AppIcon-20x20@1x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/clear/capacitor-webview-overlay/main/example/ios/App/App/Assets.xcassets/AppIcon.appiconset/AppIcon-20x20@1x.png
--------------------------------------------------------------------------------
/example/ios/App/App/Assets.xcassets/AppIcon.appiconset/AppIcon-20x20@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/clear/capacitor-webview-overlay/main/example/ios/App/App/Assets.xcassets/AppIcon.appiconset/AppIcon-20x20@2x.png
--------------------------------------------------------------------------------
/example/ios/App/App/Assets.xcassets/AppIcon.appiconset/AppIcon-20x20@3x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/clear/capacitor-webview-overlay/main/example/ios/App/App/Assets.xcassets/AppIcon.appiconset/AppIcon-20x20@3x.png
--------------------------------------------------------------------------------
/example/ios/App/App/Assets.xcassets/AppIcon.appiconset/AppIcon-29x29@1x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/clear/capacitor-webview-overlay/main/example/ios/App/App/Assets.xcassets/AppIcon.appiconset/AppIcon-29x29@1x.png
--------------------------------------------------------------------------------
/example/ios/App/App/Assets.xcassets/AppIcon.appiconset/AppIcon-29x29@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/clear/capacitor-webview-overlay/main/example/ios/App/App/Assets.xcassets/AppIcon.appiconset/AppIcon-29x29@2x.png
--------------------------------------------------------------------------------
/example/ios/App/App/Assets.xcassets/AppIcon.appiconset/AppIcon-29x29@3x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/clear/capacitor-webview-overlay/main/example/ios/App/App/Assets.xcassets/AppIcon.appiconset/AppIcon-29x29@3x.png
--------------------------------------------------------------------------------
/example/ios/App/App/Assets.xcassets/AppIcon.appiconset/AppIcon-40x40@1x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/clear/capacitor-webview-overlay/main/example/ios/App/App/Assets.xcassets/AppIcon.appiconset/AppIcon-40x40@1x.png
--------------------------------------------------------------------------------
/example/ios/App/App/Assets.xcassets/AppIcon.appiconset/AppIcon-40x40@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/clear/capacitor-webview-overlay/main/example/ios/App/App/Assets.xcassets/AppIcon.appiconset/AppIcon-40x40@2x.png
--------------------------------------------------------------------------------
/example/ios/App/App/Assets.xcassets/AppIcon.appiconset/AppIcon-40x40@3x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/clear/capacitor-webview-overlay/main/example/ios/App/App/Assets.xcassets/AppIcon.appiconset/AppIcon-40x40@3x.png
--------------------------------------------------------------------------------
/example/ios/App/App/Assets.xcassets/AppIcon.appiconset/AppIcon-60x60@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/clear/capacitor-webview-overlay/main/example/ios/App/App/Assets.xcassets/AppIcon.appiconset/AppIcon-60x60@2x.png
--------------------------------------------------------------------------------
/example/ios/App/App/Assets.xcassets/AppIcon.appiconset/AppIcon-60x60@3x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/clear/capacitor-webview-overlay/main/example/ios/App/App/Assets.xcassets/AppIcon.appiconset/AppIcon-60x60@3x.png
--------------------------------------------------------------------------------
/example/ios/App/App/Assets.xcassets/AppIcon.appiconset/AppIcon-76x76@1x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/clear/capacitor-webview-overlay/main/example/ios/App/App/Assets.xcassets/AppIcon.appiconset/AppIcon-76x76@1x.png
--------------------------------------------------------------------------------
/example/ios/App/App/Assets.xcassets/AppIcon.appiconset/AppIcon-76x76@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/clear/capacitor-webview-overlay/main/example/ios/App/App/Assets.xcassets/AppIcon.appiconset/AppIcon-76x76@2x.png
--------------------------------------------------------------------------------
/example/ios/App/App/Assets.xcassets/Splash.imageset/splash-2732x2732-1.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/clear/capacitor-webview-overlay/main/example/ios/App/App/Assets.xcassets/Splash.imageset/splash-2732x2732-1.png
--------------------------------------------------------------------------------
/example/ios/App/App/Assets.xcassets/Splash.imageset/splash-2732x2732-2.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/clear/capacitor-webview-overlay/main/example/ios/App/App/Assets.xcassets/Splash.imageset/splash-2732x2732-2.png
--------------------------------------------------------------------------------
/example/ios/App/App/Assets.xcassets/AppIcon.appiconset/AppIcon-20x20@2x-1.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/clear/capacitor-webview-overlay/main/example/ios/App/App/Assets.xcassets/AppIcon.appiconset/AppIcon-20x20@2x-1.png
--------------------------------------------------------------------------------
/example/ios/App/App/Assets.xcassets/AppIcon.appiconset/AppIcon-29x29@2x-1.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/clear/capacitor-webview-overlay/main/example/ios/App/App/Assets.xcassets/AppIcon.appiconset/AppIcon-29x29@2x-1.png
--------------------------------------------------------------------------------
/example/ios/App/App/Assets.xcassets/AppIcon.appiconset/AppIcon-40x40@2x-1.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/clear/capacitor-webview-overlay/main/example/ios/App/App/Assets.xcassets/AppIcon.appiconset/AppIcon-40x40@2x-1.png
--------------------------------------------------------------------------------
/example/ios/App/App/Assets.xcassets/AppIcon.appiconset/AppIcon-83.5x83.5@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/clear/capacitor-webview-overlay/main/example/ios/App/App/Assets.xcassets/AppIcon.appiconset/AppIcon-83.5x83.5@2x.png
--------------------------------------------------------------------------------
/example/android/app/src/main/java/com/example/webview_overlay/MainActivity.java:
--------------------------------------------------------------------------------
1 | package com.example.webview_overlay;
2 |
3 | import com.getcapacitor.BridgeActivity;
4 |
5 | public class MainActivity extends BridgeActivity {}
6 |
--------------------------------------------------------------------------------
/example/ios/App/App/config.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/ios/Plugin/Plugin.xcworkspace/xcuserdata/max.xcuserdatad/UserInterfaceState.xcuserstate:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/clear/capacitor-webview-overlay/main/ios/Plugin/Plugin.xcworkspace/xcuserdata/max.xcuserdatad/UserInterfaceState.xcuserstate
--------------------------------------------------------------------------------
/example/android/app/src/main/res/xml/config.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/example/ios/App/App.xcodeproj/project.xcworkspace/contents.xcworkspacedata:
--------------------------------------------------------------------------------
1 |
2 |
4 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/ios/Plugin/Plugin.xcodeproj/project.xcworkspace/contents.xcworkspacedata:
--------------------------------------------------------------------------------
1 |
2 |
4 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/example/android/settings.gradle:
--------------------------------------------------------------------------------
1 | include ':app'
2 | include ':capacitor-cordova-android-plugins'
3 | project(':capacitor-cordova-android-plugins').projectDir = new File('./capacitor-cordova-android-plugins/')
4 |
5 | apply from: 'capacitor.settings.gradle'
--------------------------------------------------------------------------------
/example/src/main.ts:
--------------------------------------------------------------------------------
1 | import { platformBrowserDynamic } from '@angular/platform-browser-dynamic';
2 |
3 | import { AppModule } from './app/app.module';
4 |
5 |
6 | platformBrowserDynamic().bootstrapModule(AppModule)
7 | .catch(err => console.error(err));
8 |
--------------------------------------------------------------------------------
/android/gradle/wrapper/gradle-wrapper.properties:
--------------------------------------------------------------------------------
1 | distributionBase=GRADLE_USER_HOME
2 | distributionPath=wrapper/dists
3 | distributionUrl=https\://services.gradle.org/distributions/gradle-7.4.2-all.zip
4 | zipStoreBase=GRADLE_USER_HOME
5 | zipStorePath=wrapper/dists
6 |
--------------------------------------------------------------------------------
/example/android/gradle/wrapper/gradle-wrapper.properties:
--------------------------------------------------------------------------------
1 | distributionBase=GRADLE_USER_HOME
2 | distributionPath=wrapper/dists
3 | distributionUrl=https\://services.gradle.org/distributions/gradle-7.4.2-all.zip
4 | zipStoreBase=GRADLE_USER_HOME
5 | zipStorePath=wrapper/dists
6 |
--------------------------------------------------------------------------------
/example/android/app/src/main/res/xml/file_paths.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
--------------------------------------------------------------------------------
/example/ios/App/App/capacitor.config.json:
--------------------------------------------------------------------------------
1 | {
2 | "appId": "com.example.webview_overlay",
3 | "appName": "example",
4 | "webDir": "dist/example",
5 | "bundledWebRuntime": false,
6 | "server": {
7 | "url": "http://localhost:4200",
8 | "cleartext": true
9 | }
10 | }
11 |
--------------------------------------------------------------------------------
/.editorconfig:
--------------------------------------------------------------------------------
1 | # EditorConfig is awesome: https://EditorConfig.org
2 |
3 | # top-most EditorConfig file
4 | root = true
5 |
6 | [*]
7 | indent_style = space
8 | indent_size = 4
9 | end_of_line = lf
10 | charset = utf-8
11 | trim_trailing_whitespace = false
12 | insert_final_newline = false
--------------------------------------------------------------------------------
/example/android/app/src/main/assets/capacitor.config.json:
--------------------------------------------------------------------------------
1 | {
2 | "appId": "com.example.webview_overlay",
3 | "appName": "example",
4 | "webDir": "dist/example",
5 | "bundledWebRuntime": false,
6 | "server": {
7 | "url": "http://localhost:4200",
8 | "cleartext": true
9 | }
10 | }
11 |
--------------------------------------------------------------------------------
/example/ios/.gitignore:
--------------------------------------------------------------------------------
1 | App/build
2 | App/Pods
3 | App/Podfile.lock
4 | App/App/public
5 | DerivedData
6 | xcuserdata
7 |
8 | # Cordova plugins for Capacitor
9 | capacitor-cordova-ios-plugins
10 |
11 | # Generated Config files
12 | App/App/capacitor.config.json
13 | App/App/config.xml
14 |
--------------------------------------------------------------------------------
/example/ios/App/App.xcworkspace/contents.xcworkspacedata:
--------------------------------------------------------------------------------
1 |
2 |
4 |
6 |
7 |
9 |
10 |
11 |
--------------------------------------------------------------------------------
/example/src/app/app-routing.module.ts:
--------------------------------------------------------------------------------
1 | import { NgModule } from '@angular/core';
2 | import { RouterModule, Routes } from '@angular/router';
3 |
4 | const routes: Routes = [];
5 |
6 | @NgModule({
7 | imports: [RouterModule.forRoot(routes)],
8 | exports: [RouterModule]
9 | })
10 | export class AppRoutingModule { }
11 |
--------------------------------------------------------------------------------
/ios/Plugin/Plugin.xcworkspace/contents.xcworkspacedata:
--------------------------------------------------------------------------------
1 |
2 |
4 |
6 |
7 |
9 |
10 |
11 |
--------------------------------------------------------------------------------
/example/ios/App/App.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | IDEDidComputeMac32BitWarning
6 |
7 |
8 |
9 |
--------------------------------------------------------------------------------
/example/android/app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
--------------------------------------------------------------------------------
/example/android/app/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
--------------------------------------------------------------------------------
/example/tsconfig.app.json:
--------------------------------------------------------------------------------
1 | /* To learn more about this file see: https://angular.io/config/tsconfig. */
2 | {
3 | "extends": "./tsconfig.json",
4 | "compilerOptions": {
5 | "outDir": "./out-tsc/app",
6 | "types": []
7 | },
8 | "files": [
9 | "src/main.ts"
10 | ],
11 | "include": [
12 | "src/**/*.d.ts"
13 | ]
14 | }
15 |
--------------------------------------------------------------------------------
/example/tsconfig.spec.json:
--------------------------------------------------------------------------------
1 | /* To learn more about this file see: https://angular.io/config/tsconfig. */
2 | {
3 | "extends": "./tsconfig.json",
4 | "compilerOptions": {
5 | "outDir": "./out-tsc/spec",
6 | "types": [
7 | "jasmine"
8 | ]
9 | },
10 | "include": [
11 | "src/**/*.spec.ts",
12 | "src/**/*.d.ts"
13 | ]
14 | }
15 |
--------------------------------------------------------------------------------
/example/.editorconfig:
--------------------------------------------------------------------------------
1 | # Editor configuration, see https://editorconfig.org
2 | root = true
3 |
4 | [*]
5 | charset = utf-8
6 | indent_style = space
7 | indent_size = 2
8 | insert_final_newline = true
9 | trim_trailing_whitespace = true
10 |
11 | [*.ts]
12 | quote_type = single
13 |
14 | [*.md]
15 | max_line_length = off
16 | trim_trailing_whitespace = false
17 |
--------------------------------------------------------------------------------
/example/android/app/src/main/res/values/strings.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | example
4 | example
5 | com.example.webview_overlay
6 | com.example.webview_overlay
7 |
8 |
--------------------------------------------------------------------------------
/example/capacitor.config.ts:
--------------------------------------------------------------------------------
1 | import { CapacitorConfig } from '@capacitor/cli';
2 |
3 | const config: CapacitorConfig = {
4 | appId: 'com.example.webview_overlay',
5 | appName: 'example',
6 | webDir: 'dist/example',
7 | bundledWebRuntime: false,
8 | server: {
9 | url: 'http://localhost:4200',
10 | cleartext: true,
11 | },
12 | };
13 |
14 | export default config;
15 |
--------------------------------------------------------------------------------
/example/android/capacitor.settings.gradle:
--------------------------------------------------------------------------------
1 | // DO NOT EDIT THIS FILE! IT IS GENERATED EACH TIME "capacitor update" IS RUN
2 | include ':capacitor-android'
3 | project(':capacitor-android').projectDir = new File('../node_modules/@capacitor/android/capacitor')
4 |
5 | include ':clear-capacitor-webview-overlay'
6 | project(':clear-capacitor-webview-overlay').projectDir = new File('../../android')
7 |
--------------------------------------------------------------------------------
/example/src/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | Example
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
--------------------------------------------------------------------------------
/ios/Plugin/Plugin/Plugin.h:
--------------------------------------------------------------------------------
1 | #import
2 |
3 | //! Project version number for Plugin.
4 | FOUNDATION_EXPORT double PluginVersionNumber;
5 |
6 | //! Project version string for Plugin.
7 | FOUNDATION_EXPORT const unsigned char PluginVersionString[];
8 |
9 | // In this header, you should import all the public headers of your framework using statements like #import
10 |
11 |
--------------------------------------------------------------------------------
/ios/Plugin/Podfile:
--------------------------------------------------------------------------------
1 | # Uncomment the next line to define a global platform for your project
2 | platform :ios, '13.0'
3 |
4 | target 'Plugin' do
5 | # Comment the next line if you're not using Swift and don't want to use dynamic frameworks
6 | use_frameworks!
7 |
8 | # Pods for IonicRunner
9 | pod 'Capacitor'
10 | end
11 |
12 | target 'PluginTests' do
13 | use_frameworks!
14 |
15 | pod 'Capacitor'
16 | end
--------------------------------------------------------------------------------
/ios/Plugin/Plugin.xcodeproj/xcuserdata/max.xcuserdatad/xcschemes/xcschememanagement.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | SchemeUserState
6 |
7 | Plugin.xcscheme
8 |
9 | orderHint
10 | 0
11 |
12 |
13 |
14 |
15 |
--------------------------------------------------------------------------------
/example/src/app/app.module.ts:
--------------------------------------------------------------------------------
1 | import { NgModule } from '@angular/core';
2 | import { BrowserModule } from '@angular/platform-browser';
3 |
4 | import { AppRoutingModule } from './app-routing.module';
5 | import { AppComponent } from './app.component';
6 |
7 | @NgModule({
8 | declarations: [
9 | AppComponent
10 | ],
11 | imports: [
12 | BrowserModule,
13 | AppRoutingModule
14 | ],
15 | providers: [],
16 | bootstrap: [AppComponent]
17 | })
18 | export class AppModule { }
19 |
--------------------------------------------------------------------------------
/android/src/test/java/com/getcapacitor/ExampleUnitTest.java:
--------------------------------------------------------------------------------
1 | package com.getcapacitor;
2 |
3 | import static org.junit.Assert.*;
4 |
5 | import org.junit.Test;
6 |
7 | /**
8 | * Example local unit test, which will execute on the development machine (host).
9 | *
10 | * @see Testing documentation
11 | */
12 | public class ExampleUnitTest {
13 |
14 | @Test
15 | public void addition_isCorrect() throws Exception {
16 | assertEquals(4, 2 + 2);
17 | }
18 | }
19 |
--------------------------------------------------------------------------------
/example/android/app/capacitor.build.gradle:
--------------------------------------------------------------------------------
1 | // DO NOT EDIT THIS FILE! IT IS GENERATED EACH TIME "capacitor update" IS RUN
2 |
3 | android {
4 | compileOptions {
5 | sourceCompatibility JavaVersion.VERSION_11
6 | targetCompatibility JavaVersion.VERSION_11
7 | }
8 | }
9 |
10 | apply from: "../capacitor-cordova-android-plugins/cordova.variables.gradle"
11 | dependencies {
12 | implementation project(':clear-capacitor-webview-overlay')
13 |
14 | }
15 |
16 |
17 | if (hasProperty('postBuildExtras')) {
18 | postBuildExtras()
19 | }
20 |
--------------------------------------------------------------------------------
/example/android/app/src/test/java/com/getcapacitor/myapp/ExampleUnitTest.java:
--------------------------------------------------------------------------------
1 | package com.getcapacitor.myapp;
2 |
3 | import static org.junit.Assert.*;
4 |
5 | import org.junit.Test;
6 |
7 | /**
8 | * Example local unit test, which will execute on the development machine (host).
9 | *
10 | * @see Testing documentation
11 | */
12 | public class ExampleUnitTest {
13 |
14 | @Test
15 | public void addition_isCorrect() throws Exception {
16 | assertEquals(4, 2 + 2);
17 | }
18 | }
19 |
--------------------------------------------------------------------------------
/example/ios/App/App/Assets.xcassets/Splash.imageset/Contents.json:
--------------------------------------------------------------------------------
1 | {
2 | "images" : [
3 | {
4 | "idiom" : "universal",
5 | "filename" : "splash-2732x2732-2.png",
6 | "scale" : "1x"
7 | },
8 | {
9 | "idiom" : "universal",
10 | "filename" : "splash-2732x2732-1.png",
11 | "scale" : "2x"
12 | },
13 | {
14 | "idiom" : "universal",
15 | "filename" : "splash-2732x2732.png",
16 | "scale" : "3x"
17 | }
18 | ],
19 | "info" : {
20 | "version" : 1,
21 | "author" : "xcode"
22 | }
23 | }
--------------------------------------------------------------------------------
/example/android/variables.gradle:
--------------------------------------------------------------------------------
1 | ext {
2 | minSdkVersion = 22
3 | compileSdkVersion = 32
4 | targetSdkVersion = 32
5 | androidxActivityVersion = '1.4.0'
6 | androidxAppCompatVersion = '1.4.2'
7 | androidxCoordinatorLayoutVersion = '1.2.0'
8 | androidxCoreVersion = '1.8.0'
9 | androidxFragmentVersion = '1.4.1'
10 | coreSplashScreenVersion = '1.0.0-rc01'
11 | androidxWebkitVersion = '1.4.0'
12 | junitVersion = '4.13.2'
13 | androidxJunitVersion = '1.1.3'
14 | androidxEspressoCoreVersion = '3.4.0'
15 | cordovaAndroidVersion = '10.1.1'
16 | }
--------------------------------------------------------------------------------
/tsconfig.json:
--------------------------------------------------------------------------------
1 | {
2 | "compilerOptions": {
3 | "allowUnreachableCode": false,
4 | "declaration": true,
5 | "esModuleInterop": true,
6 | "lib": ["dom", "es2017"],
7 | "module": "esnext",
8 | "moduleResolution": "node",
9 | "noFallthroughCasesInSwitch": true,
10 | "noUnusedLocals": true,
11 | "noUnusedParameters": true,
12 | "outDir": "dist/esm",
13 | "pretty": true,
14 | "sourceMap": true,
15 | "strict": false,
16 | "target": "es2017"
17 | },
18 | "files": ["src/index.ts"]
19 | }
20 |
--------------------------------------------------------------------------------
/example/android/app/src/main/res/layout/activity_main.xml:
--------------------------------------------------------------------------------
1 |
2 |
8 |
9 |
12 |
13 |
--------------------------------------------------------------------------------
/rollup.config.js:
--------------------------------------------------------------------------------
1 | export default {
2 | input: 'dist/esm/index.js',
3 | output: [
4 | {
5 | file: 'dist/plugin.js',
6 | format: 'iife',
7 | name: 'capacitorWebviewOverlay',
8 | globals: {
9 | '@capacitor/core': 'capacitorExports',
10 | },
11 | sourcemap: true,
12 | inlineDynamicImports: true,
13 | },
14 | {
15 | file: 'dist/plugin.cjs.js',
16 | format: 'cjs',
17 | sourcemap: true,
18 | inlineDynamicImports: true,
19 | },
20 | ],
21 | external: ['@capacitor/core'],
22 | };
23 |
--------------------------------------------------------------------------------
/ClearCapacitorWebviewOverlay.podspec:
--------------------------------------------------------------------------------
1 | require 'json'
2 |
3 | package = JSON.parse(File.read(File.join(__dir__, 'package.json')))
4 |
5 | Pod::Spec.new do |s|
6 | s.name = 'ClearCapacitorWebviewOverlay'
7 | s.version = package['version']
8 | s.summary = package['description']
9 | s.license = package['license']
10 | s.homepage = package['repository']['url']
11 | s.author = package['author']
12 | s.source = { :git => package['repository']['url'], :tag => s.version.to_s }
13 | s.source_files = 'ios/Plugin/**/*.{swift,h,m,c,cc,mm,cpp}'
14 | s.ios.deployment_target = '13.0'
15 | s.dependency 'Capacitor'
16 | s.dependency 'GCDWebServer'
17 | s.swift_version = '5.1'
18 | end
19 |
--------------------------------------------------------------------------------
/android/src/main/res/layout/bridge_layout_main.xml:
--------------------------------------------------------------------------------
1 |
2 |
9 |
10 |
14 |
15 |
16 |
--------------------------------------------------------------------------------
/example/.gitignore:
--------------------------------------------------------------------------------
1 | # See http://help.github.com/ignore-files/ for more about ignoring files.
2 |
3 | # Compiled output
4 | /dist
5 | /tmp
6 | /out-tsc
7 | /bazel-out
8 |
9 | # Node
10 | /node_modules
11 | npm-debug.log
12 | yarn-error.log
13 |
14 | # IDEs and editors
15 | .idea/
16 | .project
17 | .classpath
18 | .c9/
19 | *.launch
20 | .settings/
21 | *.sublime-workspace
22 |
23 | # Visual Studio Code
24 | .vscode/*
25 | !.vscode/settings.json
26 | !.vscode/tasks.json
27 | !.vscode/launch.json
28 | !.vscode/extensions.json
29 | .history/*
30 |
31 | # Miscellaneous
32 | /.angular/cache
33 | .sass-cache/
34 | /connect.lock
35 | /coverage
36 | /libpeerconnection.log
37 | testem.log
38 | /typings
39 |
40 | # System files
41 | .DS_Store
42 | Thumbs.db
43 |
--------------------------------------------------------------------------------
/example/android/build.gradle:
--------------------------------------------------------------------------------
1 | // Top-level build file where you can add configuration options common to all sub-projects/modules.
2 |
3 | buildscript {
4 |
5 | repositories {
6 | google()
7 | mavenCentral()
8 | }
9 | dependencies {
10 | classpath 'com.android.tools.build:gradle:7.2.1'
11 | classpath 'com.google.gms:google-services:4.3.13'
12 |
13 | // NOTE: Do not place your application dependencies here; they belong
14 | // in the individual module build.gradle files
15 | }
16 | }
17 |
18 | apply from: "variables.gradle"
19 |
20 | allprojects {
21 | repositories {
22 | google()
23 | mavenCentral()
24 | }
25 | }
26 |
27 | task clean(type: Delete) {
28 | delete rootProject.buildDir
29 | }
30 |
--------------------------------------------------------------------------------
/example/ios/App/Podfile:
--------------------------------------------------------------------------------
1 | require_relative '../../node_modules/@capacitor/ios/scripts/pods_helpers'
2 |
3 | platform :ios, '13.0'
4 | use_frameworks!
5 |
6 | # workaround to avoid Xcode caching of Pods that requires
7 | # Product -> Clean Build Folder after new Cordova plugins installed
8 | # Requires CocoaPods 1.6 or newer
9 | install! 'cocoapods', :disable_input_output_paths => true
10 |
11 | def capacitor_pods
12 | pod 'Capacitor', :path => '../../node_modules/@capacitor/ios'
13 | pod 'CapacitorCordova', :path => '../../node_modules/@capacitor/ios'
14 | pod 'ClearCapacitorWebviewOverlay', :path => '../../..'
15 | end
16 |
17 | target 'App' do
18 | capacitor_pods
19 | # Add your Pods here
20 | end
21 |
22 | post_install do |installer|
23 | assertDeploymentTarget(installer)
24 | end
25 |
--------------------------------------------------------------------------------
/android/proguard-rules.pro:
--------------------------------------------------------------------------------
1 | # Add project specific ProGuard rules here.
2 | # You can control the set of applied configuration files using the
3 | # proguardFiles setting in build.gradle.
4 | #
5 | # For more details, see
6 | # http://developer.android.com/guide/developing/tools/proguard.html
7 |
8 | # If your project uses WebView with JS, uncomment the following
9 | # and specify the fully qualified class name to the JavaScript interface
10 | # class:
11 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview {
12 | # public *;
13 | #}
14 |
15 | # Uncomment this to preserve the line number information for
16 | # debugging stack traces.
17 | #-keepattributes SourceFile,LineNumberTable
18 |
19 | # If you keep the line number information, uncomment this to
20 | # hide the original source file name.
21 | #-renamesourcefileattribute SourceFile
22 |
--------------------------------------------------------------------------------
/example/android/app/proguard-rules.pro:
--------------------------------------------------------------------------------
1 | # Add project specific ProGuard rules here.
2 | # You can control the set of applied configuration files using the
3 | # proguardFiles setting in build.gradle.
4 | #
5 | # For more details, see
6 | # http://developer.android.com/guide/developing/tools/proguard.html
7 |
8 | # If your project uses WebView with JS, uncomment the following
9 | # and specify the fully qualified class name to the JavaScript interface
10 | # class:
11 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview {
12 | # public *;
13 | #}
14 |
15 | # Uncomment this to preserve the line number information for
16 | # debugging stack traces.
17 | #-keepattributes SourceFile,LineNumberTable
18 |
19 | # If you keep the line number information, uncomment this to
20 | # hide the original source file name.
21 | #-renamesourcefileattribute SourceFile
22 |
--------------------------------------------------------------------------------
/ios/Plugin/Plugin/Info.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | CFBundleDevelopmentRegion
6 | $(DEVELOPMENT_LANGUAGE)
7 | CFBundleExecutable
8 | $(EXECUTABLE_NAME)
9 | CFBundleIdentifier
10 | $(PRODUCT_BUNDLE_IDENTIFIER)
11 | CFBundleInfoDictionaryVersion
12 | 6.0
13 | CFBundleName
14 | $(PRODUCT_NAME)
15 | CFBundlePackageType
16 | FMWK
17 | CFBundleShortVersionString
18 | 1.0
19 | CFBundleVersion
20 | $(CURRENT_PROJECT_VERSION)
21 | NSPrincipalClass
22 |
23 |
24 |
25 |
--------------------------------------------------------------------------------
/example/android/app/src/main/res/values/styles.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
11 |
12 |
17 |
18 |
19 |
22 |
--------------------------------------------------------------------------------
/android/src/androidTest/java/com/getcapacitor/android/ExampleInstrumentedTest.java:
--------------------------------------------------------------------------------
1 | package com.getcapacitor.android;
2 |
3 | import static org.junit.Assert.*;
4 |
5 | import android.content.Context;
6 | import androidx.test.ext.junit.runners.AndroidJUnit4;
7 | import androidx.test.platform.app.InstrumentationRegistry;
8 | import org.junit.Test;
9 | import org.junit.runner.RunWith;
10 |
11 | /**
12 | * Instrumented test, which will execute on an Android device.
13 | *
14 | * @see Testing documentation
15 | */
16 | @RunWith(AndroidJUnit4.class)
17 | public class ExampleInstrumentedTest {
18 |
19 | @Test
20 | public void useAppContext() throws Exception {
21 | // Context of the app under test.
22 | Context appContext = InstrumentationRegistry.getInstrumentation().getTargetContext();
23 |
24 | assertEquals("com.getcapacitor.android", appContext.getPackageName());
25 | }
26 | }
27 |
--------------------------------------------------------------------------------
/example/android/app/src/androidTest/java/com/getcapacitor/myapp/ExampleInstrumentedTest.java:
--------------------------------------------------------------------------------
1 | package com.getcapacitor.myapp;
2 |
3 | import static org.junit.Assert.*;
4 |
5 | import android.content.Context;
6 | import androidx.test.ext.junit.runners.AndroidJUnit4;
7 | import androidx.test.platform.app.InstrumentationRegistry;
8 | import org.junit.Test;
9 | import org.junit.runner.RunWith;
10 |
11 | /**
12 | * Instrumented test, which will execute on an Android device.
13 | *
14 | * @see Testing documentation
15 | */
16 | @RunWith(AndroidJUnit4.class)
17 | public class ExampleInstrumentedTest {
18 |
19 | @Test
20 | public void useAppContext() throws Exception {
21 | // Context of the app under test.
22 | Context appContext = InstrumentationRegistry.getInstrumentation().getTargetContext();
23 |
24 | assertEquals("com.getcapacitor.app", appContext.getPackageName());
25 | }
26 | }
27 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # @clear/capacitor-webview-overlay
2 |
3 | Webview Overlay
4 |
5 | ## Install
6 |
7 | ```bash
8 | npm install @clear/capacitor-webview-overlay
9 | npx cap sync
10 | ```
11 |
12 | ## API
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 | ## Usage
22 |
23 | This plugin uses a custom Javascript frontend, so each instance of the `WebviewOverlay` class will control a separate webview. The plugin requires an empty HTML element to determine the position and dimensions of the webview. This element is also used to display a screen capture of the webview if you need to have any app UI elements overlay the webview at any time. See the example project for implementation.
24 |
25 | ## Development
26 |
27 | You can develop locally by using `pnpm link` in your app project to use a local version of the plugin.
--------------------------------------------------------------------------------
/ios/Plugin/Plugin/Plugin.m:
--------------------------------------------------------------------------------
1 | #import
2 | #import
3 |
4 | CAP_PLUGIN(WebviewOverlayPlugin, "WebviewOverlayPlugin",
5 | CAP_PLUGIN_METHOD(open, CAPPluginReturnPromise);
6 | CAP_PLUGIN_METHOD(close, CAPPluginReturnPromise);
7 | CAP_PLUGIN_METHOD(loadUrl, CAPPluginReturnPromise);
8 | CAP_PLUGIN_METHOD(show, CAPPluginReturnPromise);
9 | CAP_PLUGIN_METHOD(hide, CAPPluginReturnPromise);
10 | CAP_PLUGIN_METHOD(updateDimensions, CAPPluginReturnPromise);
11 | CAP_PLUGIN_METHOD(getSnapshot, CAPPluginReturnPromise);
12 | CAP_PLUGIN_METHOD(evaluateJavaScript, CAPPluginReturnPromise);
13 | CAP_PLUGIN_METHOD(toggleFullscreen, CAPPluginReturnPromise);
14 | CAP_PLUGIN_METHOD(goBack, CAPPluginReturnPromise);
15 | CAP_PLUGIN_METHOD(goForward, CAPPluginReturnPromise);
16 | CAP_PLUGIN_METHOD(reload, CAPPluginReturnPromise);
17 | CAP_PLUGIN_METHOD(handleNavigationEvent, CAPPluginReturnPromise);
18 | )
19 |
--------------------------------------------------------------------------------
/example/src/app/app.component.html:
--------------------------------------------------------------------------------
1 |
11 |
12 |
41 |
--------------------------------------------------------------------------------
/example/tsconfig.json:
--------------------------------------------------------------------------------
1 | /* To learn more about this file see: https://angular.io/config/tsconfig. */
2 | {
3 | "compileOnSave": false,
4 | "compilerOptions": {
5 | "baseUrl": "./",
6 | "outDir": "./dist/out-tsc",
7 | "forceConsistentCasingInFileNames": true,
8 | "strict": true,
9 | "noImplicitOverride": true,
10 | "noPropertyAccessFromIndexSignature": true,
11 | "noImplicitReturns": true,
12 | "noFallthroughCasesInSwitch": true,
13 | "sourceMap": true,
14 | "declaration": false,
15 | "downlevelIteration": true,
16 | "experimentalDecorators": true,
17 | "moduleResolution": "node",
18 | "importHelpers": true,
19 | "target": "ES2022",
20 | "module": "ES2022",
21 | "useDefineForClassFields": false,
22 | "lib": [
23 | "ES2022",
24 | "dom"
25 | ]
26 | },
27 | "angularCompilerOptions": {
28 | "enableI18nLegacyMessageIdFormat": false,
29 | "strictInjectionParameters": true,
30 | "strictInputAccessModifiers": true,
31 | "strictTemplates": true
32 | }
33 | }
34 |
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | # node files
2 | dist
3 | node_modules
4 |
5 | # iOS files
6 | Pods
7 | Podfile.lock
8 | Build
9 | xcuserdata
10 |
11 | # macOS files
12 | .DS_Store
13 |
14 |
15 |
16 | # Based on Android gitignore template: https://github.com/github/gitignore/blob/HEAD/Android.gitignore
17 |
18 | # Built application files
19 | *.apk
20 | *.ap_
21 |
22 | # Files for the ART/Dalvik VM
23 | *.dex
24 |
25 | # Java class files
26 | *.class
27 |
28 | # Generated files
29 | bin
30 | gen
31 | out
32 |
33 | # Gradle files
34 | .gradle
35 | build
36 |
37 | # Local configuration file (sdk path, etc)
38 | local.properties
39 |
40 | # Proguard folder generated by Eclipse
41 | proguard
42 |
43 | # Log Files
44 | *.log
45 |
46 | # Android Studio Navigation editor temp files
47 | .navigation
48 |
49 | # Android Studio captures folder
50 | captures
51 |
52 | # IntelliJ
53 | *.iml
54 | .idea
55 |
56 | # Keystore files
57 | # Uncomment the following line if you do not want to check your keystore files in.
58 | #*.jks
59 |
60 | # External native build folder generated in Android Studio 2.2 and later
61 | .externalNativeBuild
62 |
--------------------------------------------------------------------------------
/example/ios/App/App/Base.lproj/Main.storyboard:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
--------------------------------------------------------------------------------
/example/README.md:
--------------------------------------------------------------------------------
1 | # Example
2 |
3 | This project was generated with [Angular CLI](https://github.com/angular/angular-cli) version 15.1.4.
4 |
5 | ## Development server
6 |
7 | Run `ng serve` for a dev server. Navigate to `http://localhost:4200/`. The application will automatically reload if you change any of the source files.
8 |
9 | ## Code scaffolding
10 |
11 | Run `ng generate component component-name` to generate a new component. You can also use `ng generate directive|pipe|service|class|guard|interface|enum|module`.
12 |
13 | ## Build
14 |
15 | Run `ng build` to build the project. The build artifacts will be stored in the `dist/` directory.
16 |
17 | ## Running unit tests
18 |
19 | Run `ng test` to execute the unit tests via [Karma](https://karma-runner.github.io).
20 |
21 | ## Running end-to-end tests
22 |
23 | Run `ng e2e` to execute the end-to-end tests via a platform of your choice. To use this command, you need to first add a package that implements end-to-end testing capabilities.
24 |
25 | ## Further help
26 |
27 | To get more help on the Angular CLI use `ng help` or go check out the [Angular CLI Overview and Command Reference](https://angular.io/cli) page.
28 |
--------------------------------------------------------------------------------
/android/gradle.properties:
--------------------------------------------------------------------------------
1 | # Project-wide Gradle settings.
2 |
3 | # IDE (e.g. Android Studio) users:
4 | # Gradle settings configured through the IDE *will override*
5 | # any settings specified in this file.
6 |
7 | # For more details on how to configure your build environment visit
8 | # http://www.gradle.org/docs/current/userguide/build_environment.html
9 |
10 | # Specifies the JVM arguments used for the daemon process.
11 | # The setting is particularly useful for tweaking memory settings.
12 | org.gradle.jvmargs=-Xmx1536m
13 |
14 | # When configured, Gradle will run in incubating parallel mode.
15 | # This option should only be used with decoupled projects. More details, visit
16 | # http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
17 | # org.gradle.parallel=true
18 |
19 | # AndroidX package structure to make it clearer which packages are bundled with the
20 | # Android operating system, and which are packaged with your app's APK
21 | # https://developer.android.com/topic/libraries/support-library/androidx-rn
22 | android.useAndroidX=true
23 | # Automatically convert third-party libraries to use AndroidX
24 | android.enableJetifier=true
25 |
--------------------------------------------------------------------------------
/example/android/gradle.properties:
--------------------------------------------------------------------------------
1 | # Project-wide Gradle settings.
2 |
3 | # IDE (e.g. Android Studio) users:
4 | # Gradle settings configured through the IDE *will override*
5 | # any settings specified in this file.
6 |
7 | # For more details on how to configure your build environment visit
8 | # http://www.gradle.org/docs/current/userguide/build_environment.html
9 |
10 | # Specifies the JVM arguments used for the daemon process.
11 | # The setting is particularly useful for tweaking memory settings.
12 | org.gradle.jvmargs=-Xmx1536m
13 |
14 | # When configured, Gradle will run in incubating parallel mode.
15 | # This option should only be used with decoupled projects. More details, visit
16 | # http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
17 | # org.gradle.parallel=true
18 |
19 | # AndroidX package structure to make it clearer which packages are bundled with the
20 | # Android operating system, and which are packaged with your app's APK
21 | # https://developer.android.com/topic/libraries/support-library/androidx-rn
22 | android.useAndroidX=true
23 | # Automatically convert third-party libraries to use AndroidX
24 | android.enableJetifier=true
25 |
--------------------------------------------------------------------------------
/example/ios/App/Podfile.lock:
--------------------------------------------------------------------------------
1 | PODS:
2 | - Capacitor (4.6.3):
3 | - CapacitorCordova
4 | - CapacitorCordova (4.6.3)
5 | - ClearCapacitorWebviewOverlay (3.0.0):
6 | - Capacitor
7 | - GCDWebServer
8 | - GCDWebServer (3.5.4):
9 | - GCDWebServer/Core (= 3.5.4)
10 | - GCDWebServer/Core (3.5.4)
11 |
12 | DEPENDENCIES:
13 | - "Capacitor (from `../../node_modules/@capacitor/ios`)"
14 | - "CapacitorCordova (from `../../node_modules/@capacitor/ios`)"
15 | - ClearCapacitorWebviewOverlay (from `../../..`)
16 |
17 | SPEC REPOS:
18 | trunk:
19 | - GCDWebServer
20 |
21 | EXTERNAL SOURCES:
22 | Capacitor:
23 | :path: "../../node_modules/@capacitor/ios"
24 | CapacitorCordova:
25 | :path: "../../node_modules/@capacitor/ios"
26 | ClearCapacitorWebviewOverlay:
27 | :path: "../../.."
28 |
29 | SPEC CHECKSUMS:
30 | Capacitor: 744b9eea76ac615076a15f1eb2a754f155012e54
31 | CapacitorCordova: 4c146609d8f3a3ce164ed0996761759c65cc6402
32 | ClearCapacitorWebviewOverlay: 79d45301f2d386dd290d89bcc3497551e22359d1
33 | GCDWebServer: 2c156a56c8226e2d5c0c3f208a3621ccffbe3ce4
34 |
35 | PODFILE CHECKSUM: 8c7d8e33742f18e12b8dbdebd27708c34ce29f95
36 |
37 | COCOAPODS: 1.11.3
38 |
--------------------------------------------------------------------------------
/example/src/app/app.component.spec.ts:
--------------------------------------------------------------------------------
1 | import { TestBed } from '@angular/core/testing';
2 | import { RouterTestingModule } from '@angular/router/testing';
3 | import { AppComponent } from './app.component';
4 |
5 | describe('AppComponent', () => {
6 | beforeEach(async () => {
7 | await TestBed.configureTestingModule({
8 | imports: [
9 | RouterTestingModule
10 | ],
11 | declarations: [
12 | AppComponent
13 | ],
14 | }).compileComponents();
15 | });
16 |
17 | it('should create the app', () => {
18 | const fixture = TestBed.createComponent(AppComponent);
19 | const app = fixture.componentInstance;
20 | expect(app).toBeTruthy();
21 | });
22 |
23 | it(`should have as title 'example'`, () => {
24 | const fixture = TestBed.createComponent(AppComponent);
25 | const app = fixture.componentInstance;
26 | expect(app.title).toEqual('example');
27 | });
28 |
29 | it('should render title', () => {
30 | const fixture = TestBed.createComponent(AppComponent);
31 | fixture.detectChanges();
32 | const compiled = fixture.nativeElement as HTMLElement;
33 | expect(compiled.querySelector('.content span')?.textContent).toContain('example app is running!');
34 | });
35 | });
36 |
--------------------------------------------------------------------------------
/example/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "example",
3 | "version": "0.0.0",
4 | "scripts": {
5 | "ng": "ng",
6 | "start": "ng serve",
7 | "build": "ng build",
8 | "watch": "ng build --watch --configuration development",
9 | "test": "ng test"
10 | },
11 | "private": true,
12 | "dependencies": {
13 | "@angular/animations": "^15.1.0",
14 | "@angular/common": "^15.1.0",
15 | "@angular/compiler": "^15.1.0",
16 | "@angular/core": "^15.1.0",
17 | "@angular/forms": "^15.1.0",
18 | "@angular/platform-browser": "^15.1.0",
19 | "@angular/platform-browser-dynamic": "^15.1.0",
20 | "@angular/router": "^15.1.0",
21 | "@capacitor/android": "^4.6.3",
22 | "@capacitor/angular": "^2.0.3",
23 | "@capacitor/core": "latest",
24 | "@capacitor/ios": "^4.6.3",
25 | "@clear/capacitor-webview-overlay": "file:..",
26 | "rxjs": "~7.8.0",
27 | "tslib": "^2.3.0",
28 | "zone.js": "~0.12.0"
29 | },
30 | "devDependencies": {
31 | "@angular-devkit/build-angular": "^15.1.4",
32 | "@angular/cli": "~15.1.4",
33 | "@angular/compiler-cli": "^15.1.0",
34 | "@capacitor/cli": "latest",
35 | "@types/jasmine": "~4.3.0",
36 | "jasmine-core": "~4.5.0",
37 | "karma": "~6.4.0",
38 | "karma-chrome-launcher": "~3.1.0",
39 | "karma-coverage": "~2.2.0",
40 | "karma-jasmine": "~5.1.0",
41 | "karma-jasmine-html-reporter": "~2.0.0",
42 | "typescript": "~4.9.4"
43 | }
44 | }
45 |
--------------------------------------------------------------------------------
/example/src/app/app.component.ts:
--------------------------------------------------------------------------------
1 | import { Component, ElementRef, ViewChild } from '@angular/core';
2 | import { WebviewOverlay } from '@clear/capacitor-webview-overlay';
3 |
4 | @Component({
5 | selector: 'app-root',
6 | templateUrl: './app.component.html',
7 | styleUrls: ['./app.component.css']
8 | })
9 | export class AppComponent {
10 | @ViewChild("view")
11 | view?: ElementRef;
12 |
13 | overlays: WebviewOverlay[] = [];
14 | intervals: number[] = [];
15 |
16 | newViewButton() {
17 | this.openOverlay("https://google.com");
18 | }
19 |
20 | openOverlay(url: string) {
21 | let overlay = new WebviewOverlay(this.view?.nativeElement);
22 | overlay.init({ url });
23 |
24 | overlay.onPageLoaded(() => {
25 | console.log("Page loaded!");
26 |
27 | overlay.handleNavigation((e: any) => {
28 | console.log("Attempting to navigate to", e.url);
29 |
30 | let allow = confirm("Allow navigation to " + e.url);
31 | e.complete(allow);
32 |
33 | if (!allow) {
34 | this.openOverlay(e.url);
35 | }
36 | })
37 |
38 | let interval = setInterval(async () => console.log(await overlay.evaluateJavaScript("document.title")), 1000) as unknown as number;
39 | this.intervals.push(interval);
40 | })
41 |
42 | this.overlays.push(overlay);
43 | }
44 |
45 | doneButton() {
46 | let overlay = this.overlays.pop();
47 | let interval = this.intervals.pop();
48 | clearInterval(interval);
49 |
50 | if (overlay) {
51 | overlay.close();
52 | }
53 | }
54 | }
55 |
--------------------------------------------------------------------------------
/example/android/app/src/main/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
2 |
4 |
5 |
12 |
13 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
33 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
--------------------------------------------------------------------------------
/example/ios/App/App/Info.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | CFBundleDevelopmentRegion
6 | en
7 | CFBundleDisplayName
8 | example
9 | CFBundleExecutable
10 | $(EXECUTABLE_NAME)
11 | CFBundleIdentifier
12 | $(PRODUCT_BUNDLE_IDENTIFIER)
13 | CFBundleInfoDictionaryVersion
14 | 6.0
15 | CFBundleName
16 | $(PRODUCT_NAME)
17 | CFBundlePackageType
18 | APPL
19 | CFBundleShortVersionString
20 | $(MARKETING_VERSION)
21 | CFBundleVersion
22 | $(CURRENT_PROJECT_VERSION)
23 | LSRequiresIPhoneOS
24 |
25 | UILaunchStoryboardName
26 | LaunchScreen
27 | UIMainStoryboardFile
28 | Main
29 | UIRequiredDeviceCapabilities
30 |
31 | armv7
32 |
33 | UISupportedInterfaceOrientations
34 |
35 | UIInterfaceOrientationPortrait
36 | UIInterfaceOrientationLandscapeLeft
37 | UIInterfaceOrientationLandscapeRight
38 |
39 | UISupportedInterfaceOrientations~ipad
40 |
41 | UIInterfaceOrientationPortrait
42 | UIInterfaceOrientationPortraitUpsideDown
43 | UIInterfaceOrientationLandscapeLeft
44 | UIInterfaceOrientationLandscapeRight
45 |
46 | UIViewControllerBasedStatusBarAppearance
47 |
48 |
49 |
50 |
--------------------------------------------------------------------------------
/src/definitions.ts:
--------------------------------------------------------------------------------
1 | import { PluginListenerHandle } from '@capacitor/core';
2 |
3 | export interface IWebviewOverlayPlugin {
4 | /**
5 | * Open a webview with the given URL
6 | */
7 | open(options: OpenOptions): Promise<{ id: string }>;
8 |
9 | /**
10 | * Close an open webview.
11 | */
12 | close(options: { id: string }): Promise;
13 |
14 | /**
15 | * Load a url in the webview.
16 | */
17 | loadUrl(options: { id: string, url: string }): Promise;
18 |
19 | /**
20 | * Get snapshot image
21 | */
22 | getSnapshot(options: { id: string }): Promise<{ src: string }>;
23 |
24 | show(options: { id: string }): Promise;
25 | hide(options: { id: string }): Promise;
26 |
27 | toggleFullscreen(options: { id: string }): Promise;
28 | goBack(options: { id: string }): Promise;
29 | goForward(options: { id: string }): Promise;
30 | reload(options: { id: string }): Promise;
31 |
32 | handleNavigationEvent(options: { id: string, allow: boolean }): Promise;
33 |
34 | updateDimensions(options: { id: string, dimensions: Dimensions }): Promise;
35 |
36 | evaluateJavaScript(options: { id: string, javascript: string }): Promise<{result: string}>;
37 |
38 | addListener(eventName: 'pageLoaded' | 'updateSnapshot' | 'progress' | string, listenerFunc: (...args: any[]) => void): PluginListenerHandle;
39 | }
40 |
41 | interface OpenOptions extends Dimensions {
42 | /**
43 | * The URL to open the webview to
44 | */
45 | url: string;
46 |
47 | javascript?: string;
48 | injectionTime?: ScriptInjectionTime;
49 | }
50 |
51 | interface Dimensions {
52 | width: number;
53 | height: number;
54 | x: number;
55 | y: number;
56 | }
57 |
58 | export enum ScriptInjectionTime {
59 | atDocumentStart,
60 | atDocumentEnd
61 | }
62 |
--------------------------------------------------------------------------------
/example/android/app/src/main/res/drawable-v24/ic_launcher_foreground.xml:
--------------------------------------------------------------------------------
1 |
7 |
12 |
13 |
19 |
22 |
25 |
26 |
27 |
28 |
34 |
35 |
--------------------------------------------------------------------------------
/example/ios/App/App/Base.lproj/LaunchScreen.storyboard:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
--------------------------------------------------------------------------------
/example/android/app/build.gradle:
--------------------------------------------------------------------------------
1 | apply plugin: 'com.android.application'
2 |
3 | android {
4 | compileSdkVersion rootProject.ext.compileSdkVersion
5 | defaultConfig {
6 | applicationId "com.example.webview_overlay"
7 | minSdkVersion rootProject.ext.minSdkVersion
8 | targetSdkVersion rootProject.ext.targetSdkVersion
9 | versionCode 1
10 | versionName "1.0"
11 | testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
12 | aaptOptions {
13 | // Files and dirs to omit from the packaged assets dir, modified to accommodate modern web apps.
14 | // Default: https://android.googlesource.com/platform/frameworks/base/+/282e181b58cf72b6ca770dc7ca5f91f135444502/tools/aapt/AaptAssets.cpp#61
15 | ignoreAssetsPattern '!.svn:!.git:!.ds_store:!*.scc:.*:!CVS:!thumbs.db:!picasa.ini:!*~'
16 | }
17 | }
18 | buildTypes {
19 | release {
20 | minifyEnabled false
21 | proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
22 | }
23 | }
24 | }
25 |
26 | repositories {
27 | flatDir{
28 | dirs '../capacitor-cordova-android-plugins/src/main/libs', 'libs'
29 | }
30 | }
31 |
32 | dependencies {
33 | implementation fileTree(include: ['*.jar'], dir: 'libs')
34 | implementation "androidx.appcompat:appcompat:$androidxAppCompatVersion"
35 | implementation "androidx.coordinatorlayout:coordinatorlayout:$androidxCoordinatorLayoutVersion"
36 | implementation "androidx.core:core-splashscreen:$coreSplashScreenVersion"
37 | implementation project(':capacitor-android')
38 | testImplementation "junit:junit:$junitVersion"
39 | androidTestImplementation "androidx.test.ext:junit:$androidxJunitVersion"
40 | androidTestImplementation "androidx.test.espresso:espresso-core:$androidxEspressoCoreVersion"
41 | implementation project(':capacitor-cordova-android-plugins')
42 | }
43 |
44 | apply from: 'capacitor.build.gradle'
45 |
46 | try {
47 | def servicesJSON = file('google-services.json')
48 | if (servicesJSON.text) {
49 | apply plugin: 'com.google.gms.google-services'
50 | }
51 | } catch(Exception e) {
52 | logger.info("google-services.json not found, google-services plugin not applied. Push Notifications won't work")
53 | }
54 |
--------------------------------------------------------------------------------
/example/android/.gitignore:
--------------------------------------------------------------------------------
1 | # Using Android gitignore template: https://github.com/github/gitignore/blob/HEAD/Android.gitignore
2 |
3 | # Built application files
4 | *.apk
5 | *.aar
6 | *.ap_
7 | *.aab
8 |
9 | # Files for the ART/Dalvik VM
10 | *.dex
11 |
12 | # Java class files
13 | *.class
14 |
15 | # Generated files
16 | bin/
17 | gen/
18 | out/
19 | # Uncomment the following line in case you need and you don't have the release build type files in your app
20 | # release/
21 |
22 | # Gradle files
23 | .gradle/
24 | build/
25 |
26 | # Local configuration file (sdk path, etc)
27 | local.properties
28 |
29 | # Proguard folder generated by Eclipse
30 | proguard/
31 |
32 | # Log Files
33 | *.log
34 |
35 | # Android Studio Navigation editor temp files
36 | .navigation/
37 |
38 | # Android Studio captures folder
39 | captures/
40 |
41 | # IntelliJ
42 | *.iml
43 | .idea/workspace.xml
44 | .idea/tasks.xml
45 | .idea/gradle.xml
46 | .idea/assetWizardSettings.xml
47 | .idea/dictionaries
48 | .idea/libraries
49 | # Android Studio 3 in .gitignore file.
50 | .idea/caches
51 | .idea/modules.xml
52 | # Comment next line if keeping position of elements in Navigation Editor is relevant for you
53 | .idea/navEditor.xml
54 |
55 | # Keystore files
56 | # Uncomment the following lines if you do not want to check your keystore files in.
57 | #*.jks
58 | #*.keystore
59 |
60 | # External native build folder generated in Android Studio 2.2 and later
61 | .externalNativeBuild
62 | .cxx/
63 |
64 | # Google Services (e.g. APIs or Firebase)
65 | # google-services.json
66 |
67 | # Freeline
68 | freeline.py
69 | freeline/
70 | freeline_project_description.json
71 |
72 | # fastlane
73 | fastlane/report.xml
74 | fastlane/Preview.html
75 | fastlane/screenshots
76 | fastlane/test_output
77 | fastlane/readme.md
78 |
79 | # Version control
80 | vcs.xml
81 |
82 | # lint
83 | lint/intermediates/
84 | lint/generated/
85 | lint/outputs/
86 | lint/tmp/
87 | # lint/reports/
88 |
89 | # Android Profiling
90 | *.hprof
91 |
92 | # Cordova plugins for Capacitor
93 | capacitor-cordova-android-plugins
94 |
95 | # Copied web assets
96 | app/src/main/assets/public
97 |
98 | # Generated Config files
99 | app/src/main/assets/capacitor.config.json
100 | app/src/main/assets/capacitor.plugins.json
101 | app/src/main/res/xml/config.xml
102 |
--------------------------------------------------------------------------------
/android/build.gradle:
--------------------------------------------------------------------------------
1 | ext {
2 | junitVersion = project.hasProperty('junitVersion') ? rootProject.ext.junitVersion : '4.13.1'
3 | androidxAppCompatVersion = project.hasProperty('androidxAppCompatVersion') ? rootProject.ext.androidxAppCompatVersion : '1.4.2'
4 | androidxJunitVersion = project.hasProperty('androidxJunitVersion') ? rootProject.ext.androidxJunitVersion : '1.1.3'
5 | androidxEspressoCoreVersion = project.hasProperty('androidxEspressoCoreVersion') ? rootProject.ext.androidxEspressoCoreVersion : '3.4.0'
6 | }
7 |
8 | buildscript {
9 | repositories {
10 | google()
11 | jcenter()
12 | mavenCentral()
13 | }
14 | dependencies {
15 | classpath 'com.android.tools.build:gradle:7.2.1'
16 | }
17 | }
18 |
19 | apply plugin: 'com.android.library'
20 |
21 | android {
22 | namespace "com.clearxp.capacitor.webviewoverlay"
23 | compileSdkVersion project.hasProperty('compileSdkVersion') ? rootProject.ext.compileSdkVersion : 33
24 | defaultConfig {
25 | minSdkVersion project.hasProperty('minSdkVersion') ? rootProject.ext.minSdkVersion : 22
26 | targetSdkVersion project.hasProperty('targetSdkVersion') ? rootProject.ext.targetSdkVersion : 33
27 | versionCode 1
28 | versionName "1.0"
29 | testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
30 | }
31 | buildTypes {
32 | release {
33 | minifyEnabled false
34 | proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
35 | }
36 | }
37 | lintOptions {
38 | abortOnError false
39 | }
40 | compileOptions {
41 | sourceCompatibility JavaVersion.VERSION_11
42 | targetCompatibility JavaVersion.VERSION_11
43 | }
44 | }
45 |
46 | repositories {
47 | google()
48 | mavenCentral()
49 | }
50 |
51 |
52 | dependencies {
53 | implementation fileTree(dir: 'libs', include: ['*.jar'])
54 | implementation project(':capacitor-android')
55 | implementation "androidx.appcompat:appcompat:$androidxAppCompatVersion"
56 | implementation 'org.nanohttpd:nanohttpd:2.3.1'
57 | implementation 'com.android.support:support-compat:28.0.0'
58 | implementation 'com.android.support:design:28.0.0'
59 | testImplementation "junit:junit:$junitVersion"
60 | androidTestImplementation "androidx.test.ext:junit:$androidxJunitVersion"
61 | androidTestImplementation "androidx.test.espresso:espresso-core:$androidxEspressoCoreVersion"
62 | }
63 |
64 |
--------------------------------------------------------------------------------
/example/ios/App/App/Assets.xcassets/AppIcon.appiconset/Contents.json:
--------------------------------------------------------------------------------
1 | {
2 | "images" : [
3 | {
4 | "size" : "20x20",
5 | "idiom" : "iphone",
6 | "filename" : "AppIcon-20x20@2x.png",
7 | "scale" : "2x"
8 | },
9 | {
10 | "size" : "20x20",
11 | "idiom" : "iphone",
12 | "filename" : "AppIcon-20x20@3x.png",
13 | "scale" : "3x"
14 | },
15 | {
16 | "size" : "29x29",
17 | "idiom" : "iphone",
18 | "filename" : "AppIcon-29x29@2x-1.png",
19 | "scale" : "2x"
20 | },
21 | {
22 | "size" : "29x29",
23 | "idiom" : "iphone",
24 | "filename" : "AppIcon-29x29@3x.png",
25 | "scale" : "3x"
26 | },
27 | {
28 | "size" : "40x40",
29 | "idiom" : "iphone",
30 | "filename" : "AppIcon-40x40@2x.png",
31 | "scale" : "2x"
32 | },
33 | {
34 | "size" : "40x40",
35 | "idiom" : "iphone",
36 | "filename" : "AppIcon-40x40@3x.png",
37 | "scale" : "3x"
38 | },
39 | {
40 | "size" : "60x60",
41 | "idiom" : "iphone",
42 | "filename" : "AppIcon-60x60@2x.png",
43 | "scale" : "2x"
44 | },
45 | {
46 | "size" : "60x60",
47 | "idiom" : "iphone",
48 | "filename" : "AppIcon-60x60@3x.png",
49 | "scale" : "3x"
50 | },
51 | {
52 | "size" : "20x20",
53 | "idiom" : "ipad",
54 | "filename" : "AppIcon-20x20@1x.png",
55 | "scale" : "1x"
56 | },
57 | {
58 | "size" : "20x20",
59 | "idiom" : "ipad",
60 | "filename" : "AppIcon-20x20@2x-1.png",
61 | "scale" : "2x"
62 | },
63 | {
64 | "size" : "29x29",
65 | "idiom" : "ipad",
66 | "filename" : "AppIcon-29x29@1x.png",
67 | "scale" : "1x"
68 | },
69 | {
70 | "size" : "29x29",
71 | "idiom" : "ipad",
72 | "filename" : "AppIcon-29x29@2x.png",
73 | "scale" : "2x"
74 | },
75 | {
76 | "size" : "40x40",
77 | "idiom" : "ipad",
78 | "filename" : "AppIcon-40x40@1x.png",
79 | "scale" : "1x"
80 | },
81 | {
82 | "size" : "40x40",
83 | "idiom" : "ipad",
84 | "filename" : "AppIcon-40x40@2x-1.png",
85 | "scale" : "2x"
86 | },
87 | {
88 | "size" : "76x76",
89 | "idiom" : "ipad",
90 | "filename" : "AppIcon-76x76@1x.png",
91 | "scale" : "1x"
92 | },
93 | {
94 | "size" : "76x76",
95 | "idiom" : "ipad",
96 | "filename" : "AppIcon-76x76@2x.png",
97 | "scale" : "2x"
98 | },
99 | {
100 | "size" : "83.5x83.5",
101 | "idiom" : "ipad",
102 | "filename" : "AppIcon-83.5x83.5@2x.png",
103 | "scale" : "2x"
104 | },
105 | {
106 | "size" : "1024x1024",
107 | "idiom" : "ios-marketing",
108 | "filename" : "AppIcon-512@2x.png",
109 | "scale" : "1x"
110 | }
111 | ],
112 | "info" : {
113 | "version" : 1,
114 | "author" : "xcode"
115 | }
116 | }
--------------------------------------------------------------------------------
/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "@clear/capacitor-webview-overlay",
3 | "version": "3.1.1",
4 | "description": "Webview Overlay",
5 | "main": "dist/plugin.cjs.js",
6 | "module": "dist/esm/index.js",
7 | "types": "dist/esm/index.d.ts",
8 | "unpkg": "dist/plugin.js",
9 | "files": [
10 | "android/src/main/",
11 | "android/build.gradle",
12 | "dist/",
13 | "ios/Plugin/",
14 | "ClearCapacitorWebviewOverlay.podspec"
15 | ],
16 | "author": "",
17 | "license": "MIT",
18 | "repository": {
19 | "type": "git",
20 | "url": "git+https://github.com/clear/capacitor-webview-overlay.git"
21 | },
22 | "bugs": {
23 | "url": "https://github.com/clear/capacitor-webview-overlay/issues"
24 | },
25 | "keywords": [
26 | "capacitor",
27 | "plugin",
28 | "native"
29 | ],
30 | "scripts": {
31 | "verify": "npm run verify:ios && npm run verify:android && npm run verify:web",
32 | "verify:ios": "cd ios && pod install && xcodebuild -workspace Plugin.xcworkspace -scheme Plugin && cd ..",
33 | "verify:android": "cd android && ./gradlew clean build test && cd ..",
34 | "verify:web": "npm run build",
35 | "lint": "npm run eslint && npm run prettier -- --check && npm run swiftlint -- lint",
36 | "fmt": "npm run eslint -- --fix && npm run prettier -- --write && npm run swiftlint -- autocorrect --format",
37 | "eslint": "eslint . --ext ts",
38 | "prettier": "prettier \"**/*.{css,html,ts,js,java}\"",
39 | "swiftlint": "node-swiftlint",
40 | "build": "npm run clean && tsc && rollup -c rollup.config.js",
41 | "clean": "rimraf ./dist",
42 | "watch": "tsc --watch",
43 | "prepublishOnly": "npm run build"
44 | },
45 | "publishConfig": {
46 | "registry": "https://npm.pkg.github.com"
47 | },
48 | "dependencies": {
49 | "resize-observer-polyfill": "^1.5.1"
50 | },
51 | "devDependencies": {
52 | "@capacitor/android": "^4.0.0",
53 | "@capacitor/cli": "^4.0.0",
54 | "@capacitor/core": "^4.0.0",
55 | "@capacitor/ios": "^4.0.0",
56 | "@ionic/eslint-config": "^0.3.0",
57 | "@ionic/prettier-config": "^2.0.0",
58 | "@ionic/swiftlint-config": "^1.1.2",
59 | "eslint": "^7.11.0",
60 | "prettier": "~2.3.0",
61 | "prettier-plugin-java": "~1.0.2",
62 | "rimraf": "^3.0.2",
63 | "rollup": "^2.32.0",
64 | "swiftlint": "^1.0.1",
65 | "typescript": "~4.1.5"
66 | },
67 | "peerDependencies": {
68 | "@capacitor/core": "^4.0.0"
69 | },
70 | "prettier": "@ionic/prettier-config",
71 | "swiftlint": "@ionic/swiftlint-config",
72 | "eslintConfig": {
73 | "extends": "@ionic/eslint-config/recommended"
74 | },
75 | "capacitor": {
76 | "ios": {
77 | "src": "ios"
78 | },
79 | "android": {
80 | "src": "android"
81 | }
82 | }
83 | }
84 |
--------------------------------------------------------------------------------
/android/gradlew.bat:
--------------------------------------------------------------------------------
1 | @rem
2 | @rem Copyright 2015 the original author or authors.
3 | @rem
4 | @rem Licensed under the Apache License, Version 2.0 (the "License");
5 | @rem you may not use this file except in compliance with the License.
6 | @rem You may obtain a copy of the License at
7 | @rem
8 | @rem https://www.apache.org/licenses/LICENSE-2.0
9 | @rem
10 | @rem Unless required by applicable law or agreed to in writing, software
11 | @rem distributed under the License is distributed on an "AS IS" BASIS,
12 | @rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | @rem See the License for the specific language governing permissions and
14 | @rem limitations under the License.
15 | @rem
16 |
17 | @if "%DEBUG%" == "" @echo off
18 | @rem ##########################################################################
19 | @rem
20 | @rem Gradle startup script for Windows
21 | @rem
22 | @rem ##########################################################################
23 |
24 | @rem Set local scope for the variables with windows NT shell
25 | if "%OS%"=="Windows_NT" setlocal
26 |
27 | set DIRNAME=%~dp0
28 | if "%DIRNAME%" == "" set DIRNAME=.
29 | set APP_BASE_NAME=%~n0
30 | set APP_HOME=%DIRNAME%
31 |
32 | @rem Resolve any "." and ".." in APP_HOME to make it shorter.
33 | for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi
34 |
35 | @rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
36 | set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m"
37 |
38 | @rem Find java.exe
39 | if defined JAVA_HOME goto findJavaFromJavaHome
40 |
41 | set JAVA_EXE=java.exe
42 | %JAVA_EXE% -version >NUL 2>&1
43 | if "%ERRORLEVEL%" == "0" goto execute
44 |
45 | echo.
46 | echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
47 | echo.
48 | echo Please set the JAVA_HOME variable in your environment to match the
49 | echo location of your Java installation.
50 |
51 | goto fail
52 |
53 | :findJavaFromJavaHome
54 | set JAVA_HOME=%JAVA_HOME:"=%
55 | set JAVA_EXE=%JAVA_HOME%/bin/java.exe
56 |
57 | if exist "%JAVA_EXE%" goto execute
58 |
59 | echo.
60 | echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
61 | echo.
62 | echo Please set the JAVA_HOME variable in your environment to match the
63 | echo location of your Java installation.
64 |
65 | goto fail
66 |
67 | :execute
68 | @rem Setup the command line
69 |
70 | set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
71 |
72 |
73 | @rem Execute Gradle
74 | "%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %*
75 |
76 | :end
77 | @rem End local scope for the variables with windows NT shell
78 | if "%ERRORLEVEL%"=="0" goto mainEnd
79 |
80 | :fail
81 | rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
82 | rem the _cmd.exe /c_ return code!
83 | if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
84 | exit /b 1
85 |
86 | :mainEnd
87 | if "%OS%"=="Windows_NT" endlocal
88 |
89 | :omega
90 |
--------------------------------------------------------------------------------
/example/android/gradlew.bat:
--------------------------------------------------------------------------------
1 | @rem
2 | @rem Copyright 2015 the original author or authors.
3 | @rem
4 | @rem Licensed under the Apache License, Version 2.0 (the "License");
5 | @rem you may not use this file except in compliance with the License.
6 | @rem You may obtain a copy of the License at
7 | @rem
8 | @rem https://www.apache.org/licenses/LICENSE-2.0
9 | @rem
10 | @rem Unless required by applicable law or agreed to in writing, software
11 | @rem distributed under the License is distributed on an "AS IS" BASIS,
12 | @rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | @rem See the License for the specific language governing permissions and
14 | @rem limitations under the License.
15 | @rem
16 |
17 | @if "%DEBUG%" == "" @echo off
18 | @rem ##########################################################################
19 | @rem
20 | @rem Gradle startup script for Windows
21 | @rem
22 | @rem ##########################################################################
23 |
24 | @rem Set local scope for the variables with windows NT shell
25 | if "%OS%"=="Windows_NT" setlocal
26 |
27 | set DIRNAME=%~dp0
28 | if "%DIRNAME%" == "" set DIRNAME=.
29 | set APP_BASE_NAME=%~n0
30 | set APP_HOME=%DIRNAME%
31 |
32 | @rem Resolve any "." and ".." in APP_HOME to make it shorter.
33 | for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi
34 |
35 | @rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
36 | set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m"
37 |
38 | @rem Find java.exe
39 | if defined JAVA_HOME goto findJavaFromJavaHome
40 |
41 | set JAVA_EXE=java.exe
42 | %JAVA_EXE% -version >NUL 2>&1
43 | if "%ERRORLEVEL%" == "0" goto execute
44 |
45 | echo.
46 | echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
47 | echo.
48 | echo Please set the JAVA_HOME variable in your environment to match the
49 | echo location of your Java installation.
50 |
51 | goto fail
52 |
53 | :findJavaFromJavaHome
54 | set JAVA_HOME=%JAVA_HOME:"=%
55 | set JAVA_EXE=%JAVA_HOME%/bin/java.exe
56 |
57 | if exist "%JAVA_EXE%" goto execute
58 |
59 | echo.
60 | echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
61 | echo.
62 | echo Please set the JAVA_HOME variable in your environment to match the
63 | echo location of your Java installation.
64 |
65 | goto fail
66 |
67 | :execute
68 | @rem Setup the command line
69 |
70 | set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
71 |
72 |
73 | @rem Execute Gradle
74 | "%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %*
75 |
76 | :end
77 | @rem End local scope for the variables with windows NT shell
78 | if "%ERRORLEVEL%"=="0" goto mainEnd
79 |
80 | :fail
81 | rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
82 | rem the _cmd.exe /c_ return code!
83 | if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
84 | exit /b 1
85 |
86 | :mainEnd
87 | if "%OS%"=="Windows_NT" endlocal
88 |
89 | :omega
90 |
--------------------------------------------------------------------------------
/example/ios/App/App/AppDelegate.swift:
--------------------------------------------------------------------------------
1 | import UIKit
2 | import Capacitor
3 |
4 | @UIApplicationMain
5 | class AppDelegate: UIResponder, UIApplicationDelegate {
6 |
7 | var window: UIWindow?
8 |
9 | func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
10 | // Override point for customization after application launch.
11 | return true
12 | }
13 |
14 | func applicationWillResignActive(_ application: UIApplication) {
15 | // Sent when the application is about to move from active to inactive state. This can occur for certain types of temporary interruptions (such as an incoming phone call or SMS message) or when the user quits the application and it begins the transition to the background state.
16 | // Use this method to pause ongoing tasks, disable timers, and invalidate graphics rendering callbacks. Games should use this method to pause the game.
17 | }
18 |
19 | func applicationDidEnterBackground(_ application: UIApplication) {
20 | // Use this method to release shared resources, save user data, invalidate timers, and store enough application state information to restore your application to its current state in case it is terminated later.
21 | // If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits.
22 | }
23 |
24 | func applicationWillEnterForeground(_ application: UIApplication) {
25 | // Called as part of the transition from the background to the active state; here you can undo many of the changes made on entering the background.
26 | }
27 |
28 | func applicationDidBecomeActive(_ application: UIApplication) {
29 | // Restart any tasks that were paused (or not yet started) while the application was inactive. If the application was previously in the background, optionally refresh the user interface.
30 | }
31 |
32 | func applicationWillTerminate(_ application: UIApplication) {
33 | // Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:.
34 | }
35 |
36 | func application(_ app: UIApplication, open url: URL, options: [UIApplication.OpenURLOptionsKey: Any] = [:]) -> Bool {
37 | // Called when the app was launched with a url. Feel free to add additional processing here,
38 | // but if you want the App API to support tracking app url opens, make sure to keep this call
39 | return ApplicationDelegateProxy.shared.application(app, open: url, options: options)
40 | }
41 |
42 | func application(_ application: UIApplication, continue userActivity: NSUserActivity, restorationHandler: @escaping ([UIUserActivityRestoring]?) -> Void) -> Bool {
43 | // Called when the app was launched with an activity, including Universal Links.
44 | // Feel free to add additional processing here, but if you want the App API to support
45 | // tracking app url opens, make sure to keep this call
46 | return ApplicationDelegateProxy.shared.application(application, continue: userActivity, restorationHandler: restorationHandler)
47 | }
48 |
49 | }
50 |
--------------------------------------------------------------------------------
/example/angular.json:
--------------------------------------------------------------------------------
1 | {
2 | "$schema": "./node_modules/@angular/cli/lib/config/schema.json",
3 | "version": 1,
4 | "cli": {
5 | "packageManager": "npm"
6 | },
7 | "newProjectRoot": "projects",
8 | "projects": {
9 | "example": {
10 | "projectType": "application",
11 | "schematics": {},
12 | "root": "",
13 | "sourceRoot": "src",
14 | "prefix": "app",
15 | "architect": {
16 | "build": {
17 | "builder": "@angular-devkit/build-angular:browser",
18 | "options": {
19 | "outputPath": "dist/example",
20 | "index": "src/index.html",
21 | "main": "src/main.ts",
22 | "polyfills": [
23 | "zone.js"
24 | ],
25 | "tsConfig": "tsconfig.app.json",
26 | "assets": [
27 | "src/favicon.ico",
28 | "src/assets"
29 | ],
30 | "styles": [
31 | "src/styles.css"
32 | ],
33 | "scripts": []
34 | },
35 | "configurations": {
36 | "production": {
37 | "budgets": [
38 | {
39 | "type": "initial",
40 | "maximumWarning": "500kb",
41 | "maximumError": "1mb"
42 | },
43 | {
44 | "type": "anyComponentStyle",
45 | "maximumWarning": "2kb",
46 | "maximumError": "4kb"
47 | }
48 | ],
49 | "outputHashing": "all"
50 | },
51 | "development": {
52 | "buildOptimizer": false,
53 | "optimization": false,
54 | "vendorChunk": true,
55 | "extractLicenses": false,
56 | "sourceMap": true,
57 | "namedChunks": true
58 | }
59 | },
60 | "defaultConfiguration": "production"
61 | },
62 | "serve": {
63 | "builder": "@angular-devkit/build-angular:dev-server",
64 | "configurations": {
65 | "production": {
66 | "browserTarget": "example:build:production"
67 | },
68 | "development": {
69 | "browserTarget": "example:build:development"
70 | }
71 | },
72 | "defaultConfiguration": "development"
73 | },
74 | "extract-i18n": {
75 | "builder": "@angular-devkit/build-angular:extract-i18n",
76 | "options": {
77 | "browserTarget": "example:build"
78 | }
79 | },
80 | "test": {
81 | "builder": "@angular-devkit/build-angular:karma",
82 | "options": {
83 | "polyfills": [
84 | "zone.js",
85 | "zone.js/testing"
86 | ],
87 | "tsConfig": "tsconfig.spec.json",
88 | "assets": [
89 | "src/favicon.ico",
90 | "src/assets"
91 | ],
92 | "styles": [
93 | "src/styles.css"
94 | ],
95 | "scripts": []
96 | }
97 | }
98 | }
99 | }
100 | }
101 | }
102 |
--------------------------------------------------------------------------------
/example/android/app/src/main/res/drawable/ic_launcher_background.xml:
--------------------------------------------------------------------------------
1 |
2 |
7 |
10 |
15 |
20 |
25 |
30 |
35 |
40 |
45 |
50 |
55 |
60 |
65 |
70 |
75 |
80 |
85 |
90 |
95 |
100 |
105 |
110 |
115 |
120 |
125 |
130 |
135 |
140 |
145 |
150 |
155 |
160 |
165 |
170 |
171 |
--------------------------------------------------------------------------------
/android/gradlew:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env sh
2 |
3 | #
4 | # Copyright 2015 the original author or authors.
5 | #
6 | # Licensed under the Apache License, Version 2.0 (the "License");
7 | # you may not use this file except in compliance with the License.
8 | # You may obtain a copy of the License at
9 | #
10 | # https://www.apache.org/licenses/LICENSE-2.0
11 | #
12 | # Unless required by applicable law or agreed to in writing, software
13 | # distributed under the License is distributed on an "AS IS" BASIS,
14 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 | # See the License for the specific language governing permissions and
16 | # limitations under the License.
17 | #
18 |
19 | ##############################################################################
20 | ##
21 | ## Gradle start up script for UN*X
22 | ##
23 | ##############################################################################
24 |
25 | # Attempt to set APP_HOME
26 | # Resolve links: $0 may be a link
27 | PRG="$0"
28 | # Need this for relative symlinks.
29 | while [ -h "$PRG" ] ; do
30 | ls=`ls -ld "$PRG"`
31 | link=`expr "$ls" : '.*-> \(.*\)$'`
32 | if expr "$link" : '/.*' > /dev/null; then
33 | PRG="$link"
34 | else
35 | PRG=`dirname "$PRG"`"/$link"
36 | fi
37 | done
38 | SAVED="`pwd`"
39 | cd "`dirname \"$PRG\"`/" >/dev/null
40 | APP_HOME="`pwd -P`"
41 | cd "$SAVED" >/dev/null
42 |
43 | APP_NAME="Gradle"
44 | APP_BASE_NAME=`basename "$0"`
45 |
46 | # Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
47 | DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
48 |
49 | # Use the maximum available, or set MAX_FD != -1 to use that value.
50 | MAX_FD="maximum"
51 |
52 | warn () {
53 | echo "$*"
54 | }
55 |
56 | die () {
57 | echo
58 | echo "$*"
59 | echo
60 | exit 1
61 | }
62 |
63 | # OS specific support (must be 'true' or 'false').
64 | cygwin=false
65 | msys=false
66 | darwin=false
67 | nonstop=false
68 | case "`uname`" in
69 | CYGWIN* )
70 | cygwin=true
71 | ;;
72 | Darwin* )
73 | darwin=true
74 | ;;
75 | MINGW* )
76 | msys=true
77 | ;;
78 | NONSTOP* )
79 | nonstop=true
80 | ;;
81 | esac
82 |
83 | CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
84 |
85 |
86 | # Determine the Java command to use to start the JVM.
87 | if [ -n "$JAVA_HOME" ] ; then
88 | if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
89 | # IBM's JDK on AIX uses strange locations for the executables
90 | JAVACMD="$JAVA_HOME/jre/sh/java"
91 | else
92 | JAVACMD="$JAVA_HOME/bin/java"
93 | fi
94 | if [ ! -x "$JAVACMD" ] ; then
95 | die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
96 |
97 | Please set the JAVA_HOME variable in your environment to match the
98 | location of your Java installation."
99 | fi
100 | else
101 | JAVACMD="java"
102 | which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
103 |
104 | Please set the JAVA_HOME variable in your environment to match the
105 | location of your Java installation."
106 | fi
107 |
108 | # Increase the maximum file descriptors if we can.
109 | if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then
110 | MAX_FD_LIMIT=`ulimit -H -n`
111 | if [ $? -eq 0 ] ; then
112 | if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then
113 | MAX_FD="$MAX_FD_LIMIT"
114 | fi
115 | ulimit -n $MAX_FD
116 | if [ $? -ne 0 ] ; then
117 | warn "Could not set maximum file descriptor limit: $MAX_FD"
118 | fi
119 | else
120 | warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT"
121 | fi
122 | fi
123 |
124 | # For Darwin, add options to specify how the application appears in the dock
125 | if $darwin; then
126 | GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\""
127 | fi
128 |
129 | # For Cygwin or MSYS, switch paths to Windows format before running java
130 | if [ "$cygwin" = "true" -o "$msys" = "true" ] ; then
131 | APP_HOME=`cygpath --path --mixed "$APP_HOME"`
132 | CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
133 |
134 | JAVACMD=`cygpath --unix "$JAVACMD"`
135 |
136 | # We build the pattern for arguments to be converted via cygpath
137 | ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null`
138 | SEP=""
139 | for dir in $ROOTDIRSRAW ; do
140 | ROOTDIRS="$ROOTDIRS$SEP$dir"
141 | SEP="|"
142 | done
143 | OURCYGPATTERN="(^($ROOTDIRS))"
144 | # Add a user-defined pattern to the cygpath arguments
145 | if [ "$GRADLE_CYGPATTERN" != "" ] ; then
146 | OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)"
147 | fi
148 | # Now convert the arguments - kludge to limit ourselves to /bin/sh
149 | i=0
150 | for arg in "$@" ; do
151 | CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -`
152 | CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option
153 |
154 | if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition
155 | eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"`
156 | else
157 | eval `echo args$i`="\"$arg\""
158 | fi
159 | i=`expr $i + 1`
160 | done
161 | case $i in
162 | 0) set -- ;;
163 | 1) set -- "$args0" ;;
164 | 2) set -- "$args0" "$args1" ;;
165 | 3) set -- "$args0" "$args1" "$args2" ;;
166 | 4) set -- "$args0" "$args1" "$args2" "$args3" ;;
167 | 5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;;
168 | 6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;;
169 | 7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;;
170 | 8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;;
171 | 9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;;
172 | esac
173 | fi
174 |
175 | # Escape application args
176 | save () {
177 | for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done
178 | echo " "
179 | }
180 | APP_ARGS=`save "$@"`
181 |
182 | # Collect all arguments for the java command, following the shell quoting and substitution rules
183 | eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS"
184 |
185 | exec "$JAVACMD" "$@"
186 |
--------------------------------------------------------------------------------
/android/src/main/java/com/clearxp/capacitor/webviewoverlay/FileChooserWebChromeClient.java:
--------------------------------------------------------------------------------
1 | package com.clearxp.capacitor.webviewoverlay;
2 |
3 | import android.Manifest;
4 | import android.app.Activity;
5 | import android.app.AlertDialog;
6 | import androidx.core.app.ActivityCompat;
7 | import android.content.Intent;
8 | import android.content.pm.ResolveInfo;
9 | import android.net.Uri;
10 | import android.os.Environment;
11 | import android.provider.MediaStore;
12 | import android.util.Log;
13 | import android.webkit.ValueCallback;
14 | import android.webkit.WebChromeClient;
15 | import android.webkit.WebView;
16 |
17 | import androidx.core.content.FileProvider;
18 |
19 | import java.io.File;
20 | import java.io.IOException;
21 | import java.text.SimpleDateFormat;
22 | import java.util.Date;
23 | import java.util.List;
24 |
25 | /**
26 | * A custom WebChromeClient designed to handle file chooser requests from a WebView.
27 | * This implementation allows for both capturing a new photo with the camera and
28 | * selecting an existing file from the device's storage.
29 | */
30 | public class FileChooserWebChromeClient extends WebChromeClient {
31 |
32 | private static final String TAG = "CxpFileChooserClient";
33 | public static final int INPUT_FILE_REQUEST_CODE = 1;
34 | private static final int REQUEST_CAMERA_PERMISSION = 101;
35 |
36 |
37 | // NOTE: Using static fields is a simplification to bridge the Activity and the plugin.
38 | // This is a fragile approach and can cause issues if multiple WebViews are used
39 | // simultaneously or if the Android OS terminates and restores the app. A more
40 | // robust solution would require a more complex architecture.
41 | public static ValueCallback mFilePathCallback;
42 | public static String mCameraPhotoPath;
43 |
44 | private Activity activity;
45 |
46 | public FileChooserWebChromeClient(Activity activity) {
47 | this.activity = activity;
48 |
49 | Log.d(TAG, "Creating FileChooserWebChromeClient");
50 | }
51 |
52 | /**
53 | * Creates a temporary image file to be used for storing the photo from the camera.
54 | * @return The created File object.
55 | * @throws IOException If the file could not be created.
56 | */
57 | private File createImageFile() throws IOException {
58 | Log.d(TAG, "createImageFile");
59 |
60 | String timeStamp = new SimpleDateFormat("yyyyMMdd_HHmmss").format(new Date());
61 | String imageFileName = "JPEG_" + timeStamp + "_";
62 |
63 | // Use the app's private external files directory for better compatibility with Scoped Storage.
64 | File storageDir = activity.getExternalFilesDir(Environment.DIRECTORY_PICTURES);
65 | if (storageDir != null && !storageDir.exists()) {
66 | storageDir.mkdirs();
67 | }
68 |
69 | File imageFile = File.createTempFile(imageFileName, ".jpg", storageDir);
70 | mCameraPhotoPath = imageFile.getAbsolutePath();
71 | return imageFile;
72 | }
73 |
74 | /**
75 | * This method is called by the WebView when a file input is clicked.
76 | */
77 | @Override
78 | public boolean onShowFileChooser(WebView webView, ValueCallback filePathCallback, FileChooserParams fileChooserParams) {
79 | Log.d(TAG, "onShowFileChooser");
80 |
81 | // If there's already a callback, cancel it to avoid issues.
82 | if (mFilePathCallback != null) {
83 | mFilePathCallback.onReceiveValue(null);
84 | mFilePathCallback = null;
85 | }
86 |
87 | mFilePathCallback = filePathCallback;
88 |
89 | // Create an intent to launch the camera
90 | Intent takePictureIntent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE);
91 | if (takePictureIntent.resolveActivity(activity.getPackageManager())!= null) {
92 | Log.d(TAG, "onShowFileChooser - take picture");
93 |
94 | File photoFile = null;
95 | try {
96 | photoFile = createImageFile();
97 | } catch (IOException ex) {
98 | Log.e(TAG, "Unable to create Image File", ex);
99 | }
100 |
101 | if (photoFile != null) {
102 | Uri photoURI = FileProvider.getUriForFile(
103 | activity,
104 | activity.getPackageName() + ".fileprovider",
105 | photoFile
106 | );
107 |
108 | takePictureIntent.putExtra(MediaStore.EXTRA_OUTPUT, photoURI);
109 | takePictureIntent.addFlags(Intent.FLAG_GRANT_WRITE_URI_PERMISSION | Intent.FLAG_GRANT_READ_URI_PERMISSION);
110 |
111 | // Grant permission to all camera apps that can handle this intent
112 | List resInfoList = activity.getPackageManager().queryIntentActivities(takePictureIntent, 0);
113 |
114 | for (ResolveInfo resolveInfo : resInfoList) {
115 | String packageName = resolveInfo.activityInfo.packageName;
116 | activity.grantUriPermission(packageName, photoURI, Intent.FLAG_GRANT_WRITE_URI_PERMISSION | Intent.FLAG_GRANT_READ_URI_PERMISSION);
117 | }
118 | } else {
119 | takePictureIntent = null;
120 | }
121 | }
122 |
123 | // Create an intent to open the file picker
124 | Intent contentSelectionIntent = new Intent(Intent.ACTION_GET_CONTENT);
125 | contentSelectionIntent.addCategory(Intent.CATEGORY_OPENABLE);
126 | contentSelectionIntent.setType("*/*"); // You can restrict this to "image/*" etc.
127 |
128 | // Create an array of intents to include the camera option
129 | Intent[] intentArray;
130 | if (takePictureIntent != null) {
131 | intentArray = new Intent[]{ takePictureIntent };
132 | } else {
133 | intentArray = new Intent[]{};
134 | }
135 |
136 | Log.d(TAG, "onShowFileChooser - choose intent");
137 |
138 | // The main chooser intent that wraps the file picker
139 | Intent chooserIntent = new Intent(Intent.ACTION_CHOOSER);
140 | chooserIntent.putExtra(Intent.EXTRA_INTENT, contentSelectionIntent);
141 | chooserIntent.putExtra(Intent.EXTRA_TITLE, "Choose Action");
142 | // Add the camera intent as an extra option in the chooser
143 | chooserIntent.putExtra(Intent.EXTRA_INITIAL_INTENTS, intentArray);
144 |
145 | activity.startActivityForResult(chooserIntent, INPUT_FILE_REQUEST_CODE);
146 | this.requestCameraPermission();
147 |
148 | return true; // Return true to indicate we've handled the event.
149 | }
150 |
151 | private void requestCameraPermission() {
152 | if (ActivityCompat.shouldShowRequestPermissionRationale(this.activity, Manifest.permission.CAMERA)) {
153 | // Show an explanation to the user
154 | new AlertDialog.Builder(this.activity)
155 | .setTitle("Permission Needed")
156 | .setMessage("This permission is needed to access the camera for taking pictures.")
157 | .setPositiveButton("OK", (dialog, which) -> {
158 | ActivityCompat.requestPermissions(this.activity, new String[]{Manifest.permission.CAMERA}, REQUEST_CAMERA_PERMISSION);
159 | })
160 | .setNegativeButton("Cancel", (dialog, which) -> dialog.dismiss())
161 | .create()
162 | .show();
163 | } else {
164 | // No explanation needed; request the permission
165 | ActivityCompat.requestPermissions(this.activity, new String[]{Manifest.permission.CAMERA}, REQUEST_CAMERA_PERMISSION);
166 | }
167 | }
168 | }
169 |
--------------------------------------------------------------------------------
/src/plugin.ts:
--------------------------------------------------------------------------------
1 | import { PluginListenerHandle, registerPlugin } from '@capacitor/core';
2 | import { IWebviewOverlayPlugin, ScriptInjectionTime } from './definitions';
3 |
4 | import ResizeObserver from 'resize-observer-polyfill';
5 |
6 | const WebviewOverlayPlugin = registerPlugin('WebviewOverlayPlugin');
7 |
8 | export interface WebviewOverlayOpenOptions {
9 | /**
10 | * The URL to open the webview to
11 | */
12 | url: string;
13 |
14 | script?: {
15 | javascript: string;
16 | injectionTime?: ScriptInjectionTime;
17 | };
18 | }
19 |
20 | export class WebviewOverlay {
21 | private updateSnapshotEvent: PluginListenerHandle;
22 | private pageLoadedEvent: PluginListenerHandle;
23 | private progressEvent: PluginListenerHandle;
24 | private navigationHandlerEvent: PluginListenerHandle;
25 | private resizeObserver: ResizeObserver;
26 |
27 | private id: string | null = null;
28 |
29 | private preinitialised_navigation_event: ((any) => void) | null = null;
30 |
31 | constructor(private element: HTMLElement) { }
32 |
33 | async init(options: WebviewOverlayOpenOptions): Promise {
34 | if (this.element && this.element.style) {
35 | this.element.style.backgroundSize = 'cover';
36 | this.element.style.backgroundRepeat = 'no-repeat';
37 | this.element.style.backgroundPosition = 'center';
38 | }
39 |
40 | const boundingBox = this.element.getBoundingClientRect() as DOMRect;
41 |
42 | let overlay = await WebviewOverlayPlugin.open({
43 | url: options.url,
44 | javascript: options.script ? options.script.javascript : '',
45 | injectionTime: options.script
46 | ? options.script.injectionTime || ScriptInjectionTime.atDocumentStart
47 | : ScriptInjectionTime.atDocumentStart,
48 | width: Math.round(boundingBox.width),
49 | height: Math.round(boundingBox.height),
50 | x: Math.round(boundingBox.x),
51 | y: Math.round(boundingBox.y),
52 | });
53 | this.id = overlay.id;
54 |
55 | if (this.preinitialised_navigation_event !== null) {
56 | this.navigationHandlerEvent = WebviewOverlayPlugin.addListener(`navigationHandler_${this.id}`, this.preinitialised_navigation_event);
57 | this.preinitialised_navigation_event = null;
58 | }
59 |
60 | this.updateSnapshotEvent = WebviewOverlayPlugin.addListener('updateSnapshot', (e) => {
61 | if (e.id === this.id) {
62 | setTimeout(() => {
63 | this.toggleSnapshot(true);
64 | }, 100);
65 | }
66 | });
67 |
68 | this.resizeObserver = new ResizeObserver((entries) => {
69 | for (const _entry of entries) {
70 | const boundingBox = this.element.getBoundingClientRect() as DOMRect;
71 | WebviewOverlayPlugin.updateDimensions({
72 | id: overlay.id,
73 | dimensions: {
74 | width: Math.round(boundingBox.width),
75 | height: Math.round(boundingBox.height),
76 | x: Math.round(boundingBox.x),
77 | y: Math.round(boundingBox.y),
78 | },
79 | });
80 | }
81 | });
82 |
83 | this.resizeObserver.observe(this.element);
84 | }
85 |
86 | close(): Promise {
87 | this.element = null;
88 |
89 | this.resizeObserver.disconnect();
90 |
91 | this.updateSnapshotEvent?.remove();
92 | this.pageLoadedEvent?.remove();
93 | this.progressEvent?.remove();
94 | this.navigationHandlerEvent?.remove();
95 |
96 | return WebviewOverlayPlugin.close({ id: this.id });
97 | }
98 |
99 | async toggleSnapshot(snapshotVisible: boolean): Promise {
100 | return new Promise(async (resolve) => {
101 | const snapshot = (await WebviewOverlayPlugin.getSnapshot({ id: this.id })).src;
102 | if (snapshotVisible) {
103 | if (snapshot) {
104 | const buffer = await (await fetch('data:image/jpeg;base64,' + snapshot)).arrayBuffer();
105 | const blob = new Blob([buffer], { type: 'image/jpeg' });
106 | const blobUrl = URL.createObjectURL(blob);
107 | const img = new Image();
108 | img.onload = async () => {
109 | if (this.element && this.element.style) {
110 | this.element.style.backgroundImage = `url(${blobUrl})`;
111 | }
112 | setTimeout(async () => {
113 | await WebviewOverlayPlugin.hide({ id: this.id });
114 | resolve();
115 | }, 25);
116 | };
117 | img.src = blobUrl;
118 | } else {
119 | if (this.element && this.element.style) {
120 | this.element.style.backgroundImage = `none`;
121 | }
122 | await WebviewOverlayPlugin.hide({ id: this.id });
123 | resolve();
124 | }
125 | } else {
126 | if (this.element && this.element.style) {
127 | this.element.style.backgroundImage = `none`;
128 | }
129 | await WebviewOverlayPlugin.show({ id: this.id });
130 | resolve();
131 | }
132 | });
133 | }
134 |
135 | async evaluateJavaScript(javascript: string): Promise {
136 | let result = (
137 | await WebviewOverlayPlugin.evaluateJavaScript({
138 | id: this.id,
139 | javascript,
140 | })
141 | ).result;
142 |
143 | // Unwrap string from quotes
144 | result = (result || '').match(/^"?(.*?)"?$/)[1];
145 |
146 | return result;
147 | }
148 |
149 | onPageLoaded(listenerFunc: () => void) {
150 | this.pageLoadedEvent = WebviewOverlayPlugin.addListener('pageLoaded', (e) => {
151 | if (e.id === this.id) {
152 | listenerFunc();
153 | }
154 | });
155 | }
156 | onProgress(listenerFunc: (progress: { value: number }) => void) {
157 | this.progressEvent = WebviewOverlayPlugin.addListener('progress', (e) => {
158 | if (e.id === this.id) {
159 | listenerFunc(e);
160 | }
161 | });
162 | }
163 |
164 | handleNavigation(
165 | listenerFunc: (event: {
166 | url: string;
167 | newWindow: boolean;
168 | sameHost: boolean;
169 | complete: (allow: boolean) => void;
170 | }) => void
171 | ) {
172 | function event_handler(event: any) {
173 | if (event.id === this.id) {
174 | const complete = (allow: boolean) => {
175 | WebviewOverlayPlugin.handleNavigationEvent({ id: this.id, allow });
176 | };
177 | listenerFunc({ ...event, complete });
178 | }
179 | }
180 |
181 | if (this.id !== null) {
182 | this.navigationHandlerEvent = WebviewOverlayPlugin.addListener(`navigationHandler_${this.id}`, event_handler.bind(this));
183 | } else {
184 | this.preinitialised_navigation_event = event_handler.bind(this);
185 | }
186 | }
187 |
188 | toggleFullscreen() {
189 | WebviewOverlayPlugin.toggleFullscreen({ id: this.id });
190 | }
191 |
192 | goBack() {
193 | WebviewOverlayPlugin.goBack({ id: this.id });
194 | }
195 |
196 | goForward() {
197 | WebviewOverlayPlugin.goForward({ id: this.id });
198 | }
199 |
200 | reload() {
201 | WebviewOverlayPlugin.reload({ id: this.id });
202 | }
203 |
204 | loadUrl(url: string) {
205 | return WebviewOverlayPlugin.loadUrl({ id: this.id, url });
206 | }
207 | }
208 |
--------------------------------------------------------------------------------
/example/android/gradlew:
--------------------------------------------------------------------------------
1 | #!/bin/sh
2 |
3 | #
4 | # Copyright © 2015-2021 the original authors.
5 | #
6 | # Licensed under the Apache License, Version 2.0 (the "License");
7 | # you may not use this file except in compliance with the License.
8 | # You may obtain a copy of the License at
9 | #
10 | # https://www.apache.org/licenses/LICENSE-2.0
11 | #
12 | # Unless required by applicable law or agreed to in writing, software
13 | # distributed under the License is distributed on an "AS IS" BASIS,
14 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 | # See the License for the specific language governing permissions and
16 | # limitations under the License.
17 | #
18 |
19 | ##############################################################################
20 | #
21 | # Gradle start up script for POSIX generated by Gradle.
22 | #
23 | # Important for running:
24 | #
25 | # (1) You need a POSIX-compliant shell to run this script. If your /bin/sh is
26 | # noncompliant, but you have some other compliant shell such as ksh or
27 | # bash, then to run this script, type that shell name before the whole
28 | # command line, like:
29 | #
30 | # ksh Gradle
31 | #
32 | # Busybox and similar reduced shells will NOT work, because this script
33 | # requires all of these POSIX shell features:
34 | # * functions;
35 | # * expansions «$var», «${var}», «${var:-default}», «${var+SET}»,
36 | # «${var#prefix}», «${var%suffix}», and «$( cmd )»;
37 | # * compound commands having a testable exit status, especially «case»;
38 | # * various built-in commands including «command», «set», and «ulimit».
39 | #
40 | # Important for patching:
41 | #
42 | # (2) This script targets any POSIX shell, so it avoids extensions provided
43 | # by Bash, Ksh, etc; in particular arrays are avoided.
44 | #
45 | # The "traditional" practice of packing multiple parameters into a
46 | # space-separated string is a well documented source of bugs and security
47 | # problems, so this is (mostly) avoided, by progressively accumulating
48 | # options in "$@", and eventually passing that to Java.
49 | #
50 | # Where the inherited environment variables (DEFAULT_JVM_OPTS, JAVA_OPTS,
51 | # and GRADLE_OPTS) rely on word-splitting, this is performed explicitly;
52 | # see the in-line comments for details.
53 | #
54 | # There are tweaks for specific operating systems such as AIX, CygWin,
55 | # Darwin, MinGW, and NonStop.
56 | #
57 | # (3) This script is generated from the Groovy template
58 | # https://github.com/gradle/gradle/blob/master/subprojects/plugins/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt
59 | # within the Gradle project.
60 | #
61 | # You can find Gradle at https://github.com/gradle/gradle/.
62 | #
63 | ##############################################################################
64 |
65 | # Attempt to set APP_HOME
66 |
67 | # Resolve links: $0 may be a link
68 | app_path=$0
69 |
70 | # Need this for daisy-chained symlinks.
71 | while
72 | APP_HOME=${app_path%"${app_path##*/}"} # leaves a trailing /; empty if no leading path
73 | [ -h "$app_path" ]
74 | do
75 | ls=$( ls -ld "$app_path" )
76 | link=${ls#*' -> '}
77 | case $link in #(
78 | /*) app_path=$link ;; #(
79 | *) app_path=$APP_HOME$link ;;
80 | esac
81 | done
82 |
83 | APP_HOME=$( cd "${APP_HOME:-./}" && pwd -P ) || exit
84 |
85 | APP_NAME="Gradle"
86 | APP_BASE_NAME=${0##*/}
87 |
88 | # Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
89 | DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
90 |
91 | # Use the maximum available, or set MAX_FD != -1 to use that value.
92 | MAX_FD=maximum
93 |
94 | warn () {
95 | echo "$*"
96 | } >&2
97 |
98 | die () {
99 | echo
100 | echo "$*"
101 | echo
102 | exit 1
103 | } >&2
104 |
105 | # OS specific support (must be 'true' or 'false').
106 | cygwin=false
107 | msys=false
108 | darwin=false
109 | nonstop=false
110 | case "$( uname )" in #(
111 | CYGWIN* ) cygwin=true ;; #(
112 | Darwin* ) darwin=true ;; #(
113 | MSYS* | MINGW* ) msys=true ;; #(
114 | NONSTOP* ) nonstop=true ;;
115 | esac
116 |
117 | CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
118 |
119 |
120 | # Determine the Java command to use to start the JVM.
121 | if [ -n "$JAVA_HOME" ] ; then
122 | if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
123 | # IBM's JDK on AIX uses strange locations for the executables
124 | JAVACMD=$JAVA_HOME/jre/sh/java
125 | else
126 | JAVACMD=$JAVA_HOME/bin/java
127 | fi
128 | if [ ! -x "$JAVACMD" ] ; then
129 | die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
130 |
131 | Please set the JAVA_HOME variable in your environment to match the
132 | location of your Java installation."
133 | fi
134 | else
135 | JAVACMD=java
136 | which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
137 |
138 | Please set the JAVA_HOME variable in your environment to match the
139 | location of your Java installation."
140 | fi
141 |
142 | # Increase the maximum file descriptors if we can.
143 | if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then
144 | case $MAX_FD in #(
145 | max*)
146 | MAX_FD=$( ulimit -H -n ) ||
147 | warn "Could not query maximum file descriptor limit"
148 | esac
149 | case $MAX_FD in #(
150 | '' | soft) :;; #(
151 | *)
152 | ulimit -n "$MAX_FD" ||
153 | warn "Could not set maximum file descriptor limit to $MAX_FD"
154 | esac
155 | fi
156 |
157 | # Collect all arguments for the java command, stacking in reverse order:
158 | # * args from the command line
159 | # * the main class name
160 | # * -classpath
161 | # * -D...appname settings
162 | # * --module-path (only if needed)
163 | # * DEFAULT_JVM_OPTS, JAVA_OPTS, and GRADLE_OPTS environment variables.
164 |
165 | # For Cygwin or MSYS, switch paths to Windows format before running java
166 | if "$cygwin" || "$msys" ; then
167 | APP_HOME=$( cygpath --path --mixed "$APP_HOME" )
168 | CLASSPATH=$( cygpath --path --mixed "$CLASSPATH" )
169 |
170 | JAVACMD=$( cygpath --unix "$JAVACMD" )
171 |
172 | # Now convert the arguments - kludge to limit ourselves to /bin/sh
173 | for arg do
174 | if
175 | case $arg in #(
176 | -*) false ;; # don't mess with options #(
177 | /?*) t=${arg#/} t=/${t%%/*} # looks like a POSIX filepath
178 | [ -e "$t" ] ;; #(
179 | *) false ;;
180 | esac
181 | then
182 | arg=$( cygpath --path --ignore --mixed "$arg" )
183 | fi
184 | # Roll the args list around exactly as many times as the number of
185 | # args, so each arg winds up back in the position where it started, but
186 | # possibly modified.
187 | #
188 | # NB: a `for` loop captures its iteration list before it begins, so
189 | # changing the positional parameters here affects neither the number of
190 | # iterations, nor the values presented in `arg`.
191 | shift # remove old arg
192 | set -- "$@" "$arg" # push replacement arg
193 | done
194 | fi
195 |
196 | # Collect all arguments for the java command;
197 | # * $DEFAULT_JVM_OPTS, $JAVA_OPTS, and $GRADLE_OPTS can contain fragments of
198 | # shell script including quotes and variable substitutions, so put them in
199 | # double quotes to make sure that they get re-expanded; and
200 | # * put everything else in single quotes, so that it's not re-expanded.
201 |
202 | set -- \
203 | "-Dorg.gradle.appname=$APP_BASE_NAME" \
204 | -classpath "$CLASSPATH" \
205 | org.gradle.wrapper.GradleWrapperMain \
206 | "$@"
207 |
208 | # Use "xargs" to parse quoted args.
209 | #
210 | # With -n1 it outputs one arg per line, with the quotes and backslashes removed.
211 | #
212 | # In Bash we could simply go:
213 | #
214 | # readarray ARGS < <( xargs -n1 <<<"$var" ) &&
215 | # set -- "${ARGS[@]}" "$@"
216 | #
217 | # but POSIX shell has neither arrays nor command substitution, so instead we
218 | # post-process each arg (as a line of input to sed) to backslash-escape any
219 | # character that might be a shell metacharacter, then use eval to reverse
220 | # that process (while maintaining the separation between arguments), and wrap
221 | # the whole thing up as a single "set" statement.
222 | #
223 | # This will of course break if any of these variables contains a newline or
224 | # an unmatched quote.
225 | #
226 |
227 | eval "set -- $(
228 | printf '%s\n' "$DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS" |
229 | xargs -n1 |
230 | sed ' s~[^-[:alnum:]+,./:=@_]~\\&~g; ' |
231 | tr '\n' ' '
232 | )" '"$@"'
233 |
234 | exec "$JAVACMD" "$@"
235 |
--------------------------------------------------------------------------------
/example/ios/App/App.xcodeproj/project.pbxproj:
--------------------------------------------------------------------------------
1 | // !$*UTF8*$!
2 | {
3 | archiveVersion = 1;
4 | classes = {
5 | };
6 | objectVersion = 48;
7 | objects = {
8 |
9 | /* Begin PBXBuildFile section */
10 | 2FAD9763203C412B000D30F8 /* config.xml in Resources */ = {isa = PBXBuildFile; fileRef = 2FAD9762203C412B000D30F8 /* config.xml */; };
11 | 50379B232058CBB4000EE86E /* capacitor.config.json in Resources */ = {isa = PBXBuildFile; fileRef = 50379B222058CBB4000EE86E /* capacitor.config.json */; };
12 | 504EC3081FED79650016851F /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 504EC3071FED79650016851F /* AppDelegate.swift */; };
13 | 504EC30D1FED79650016851F /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 504EC30B1FED79650016851F /* Main.storyboard */; };
14 | 504EC30F1FED79650016851F /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 504EC30E1FED79650016851F /* Assets.xcassets */; };
15 | 504EC3121FED79650016851F /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 504EC3101FED79650016851F /* LaunchScreen.storyboard */; };
16 | 50B271D11FEDC1A000F3C39B /* public in Resources */ = {isa = PBXBuildFile; fileRef = 50B271D01FEDC1A000F3C39B /* public */; };
17 | A084ECDBA7D38E1E42DFC39D /* Pods_App.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = AF277DCFFFF123FFC6DF26C7 /* Pods_App.framework */; };
18 | /* End PBXBuildFile section */
19 |
20 | /* Begin PBXFileReference section */
21 | 2FAD9762203C412B000D30F8 /* config.xml */ = {isa = PBXFileReference; lastKnownFileType = text.xml; path = config.xml; sourceTree = ""; };
22 | 50379B222058CBB4000EE86E /* capacitor.config.json */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.json; path = capacitor.config.json; sourceTree = ""; };
23 | 504EC3041FED79650016851F /* App.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = App.app; sourceTree = BUILT_PRODUCTS_DIR; };
24 | 504EC3071FED79650016851F /* AppDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = ""; };
25 | 504EC30C1FED79650016851F /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = ""; };
26 | 504EC30E1FED79650016851F /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = ""; };
27 | 504EC3111FED79650016851F /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = ""; };
28 | 504EC3131FED79650016851F /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; };
29 | 50B271D01FEDC1A000F3C39B /* public */ = {isa = PBXFileReference; lastKnownFileType = folder; path = public; sourceTree = ""; };
30 | AF277DCFFFF123FFC6DF26C7 /* Pods_App.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_App.framework; sourceTree = BUILT_PRODUCTS_DIR; };
31 | AF51FD2D460BCFE21FA515B2 /* Pods-App.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-App.release.xcconfig"; path = "Pods/Target Support Files/Pods-App/Pods-App.release.xcconfig"; sourceTree = ""; };
32 | FC68EB0AF532CFC21C3344DD /* Pods-App.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-App.debug.xcconfig"; path = "Pods/Target Support Files/Pods-App/Pods-App.debug.xcconfig"; sourceTree = ""; };
33 | /* End PBXFileReference section */
34 |
35 | /* Begin PBXFrameworksBuildPhase section */
36 | 504EC3011FED79650016851F /* Frameworks */ = {
37 | isa = PBXFrameworksBuildPhase;
38 | buildActionMask = 2147483647;
39 | files = (
40 | A084ECDBA7D38E1E42DFC39D /* Pods_App.framework in Frameworks */,
41 | );
42 | runOnlyForDeploymentPostprocessing = 0;
43 | };
44 | /* End PBXFrameworksBuildPhase section */
45 |
46 | /* Begin PBXGroup section */
47 | 27E2DDA53C4D2A4D1A88CE4A /* Frameworks */ = {
48 | isa = PBXGroup;
49 | children = (
50 | AF277DCFFFF123FFC6DF26C7 /* Pods_App.framework */,
51 | );
52 | name = Frameworks;
53 | sourceTree = "";
54 | };
55 | 504EC2FB1FED79650016851F = {
56 | isa = PBXGroup;
57 | children = (
58 | 504EC3061FED79650016851F /* App */,
59 | 504EC3051FED79650016851F /* Products */,
60 | 7F8756D8B27F46E3366F6CEA /* Pods */,
61 | 27E2DDA53C4D2A4D1A88CE4A /* Frameworks */,
62 | );
63 | sourceTree = "";
64 | };
65 | 504EC3051FED79650016851F /* Products */ = {
66 | isa = PBXGroup;
67 | children = (
68 | 504EC3041FED79650016851F /* App.app */,
69 | );
70 | name = Products;
71 | sourceTree = "";
72 | };
73 | 504EC3061FED79650016851F /* App */ = {
74 | isa = PBXGroup;
75 | children = (
76 | 50379B222058CBB4000EE86E /* capacitor.config.json */,
77 | 504EC3071FED79650016851F /* AppDelegate.swift */,
78 | 504EC30B1FED79650016851F /* Main.storyboard */,
79 | 504EC30E1FED79650016851F /* Assets.xcassets */,
80 | 504EC3101FED79650016851F /* LaunchScreen.storyboard */,
81 | 504EC3131FED79650016851F /* Info.plist */,
82 | 2FAD9762203C412B000D30F8 /* config.xml */,
83 | 50B271D01FEDC1A000F3C39B /* public */,
84 | );
85 | path = App;
86 | sourceTree = "";
87 | };
88 | 7F8756D8B27F46E3366F6CEA /* Pods */ = {
89 | isa = PBXGroup;
90 | children = (
91 | FC68EB0AF532CFC21C3344DD /* Pods-App.debug.xcconfig */,
92 | AF51FD2D460BCFE21FA515B2 /* Pods-App.release.xcconfig */,
93 | );
94 | name = Pods;
95 | sourceTree = "";
96 | };
97 | /* End PBXGroup section */
98 |
99 | /* Begin PBXNativeTarget section */
100 | 504EC3031FED79650016851F /* App */ = {
101 | isa = PBXNativeTarget;
102 | buildConfigurationList = 504EC3161FED79650016851F /* Build configuration list for PBXNativeTarget "App" */;
103 | buildPhases = (
104 | 6634F4EFEBD30273BCE97C65 /* [CP] Check Pods Manifest.lock */,
105 | 504EC3001FED79650016851F /* Sources */,
106 | 504EC3011FED79650016851F /* Frameworks */,
107 | 504EC3021FED79650016851F /* Resources */,
108 | 9592DBEFFC6D2A0C8D5DEB22 /* [CP] Embed Pods Frameworks */,
109 | );
110 | buildRules = (
111 | );
112 | dependencies = (
113 | );
114 | name = App;
115 | productName = App;
116 | productReference = 504EC3041FED79650016851F /* App.app */;
117 | productType = "com.apple.product-type.application";
118 | };
119 | /* End PBXNativeTarget section */
120 |
121 | /* Begin PBXProject section */
122 | 504EC2FC1FED79650016851F /* Project object */ = {
123 | isa = PBXProject;
124 | attributes = {
125 | LastSwiftUpdateCheck = 0920;
126 | LastUpgradeCheck = 0920;
127 | TargetAttributes = {
128 | 504EC3031FED79650016851F = {
129 | CreatedOnToolsVersion = 9.2;
130 | LastSwiftMigration = 1100;
131 | ProvisioningStyle = Automatic;
132 | };
133 | };
134 | };
135 | buildConfigurationList = 504EC2FF1FED79650016851F /* Build configuration list for PBXProject "App" */;
136 | compatibilityVersion = "Xcode 8.0";
137 | developmentRegion = en;
138 | hasScannedForEncodings = 0;
139 | knownRegions = (
140 | en,
141 | Base,
142 | );
143 | mainGroup = 504EC2FB1FED79650016851F;
144 | productRefGroup = 504EC3051FED79650016851F /* Products */;
145 | projectDirPath = "";
146 | projectRoot = "";
147 | targets = (
148 | 504EC3031FED79650016851F /* App */,
149 | );
150 | };
151 | /* End PBXProject section */
152 |
153 | /* Begin PBXResourcesBuildPhase section */
154 | 504EC3021FED79650016851F /* Resources */ = {
155 | isa = PBXResourcesBuildPhase;
156 | buildActionMask = 2147483647;
157 | files = (
158 | 504EC3121FED79650016851F /* LaunchScreen.storyboard in Resources */,
159 | 50B271D11FEDC1A000F3C39B /* public in Resources */,
160 | 504EC30F1FED79650016851F /* Assets.xcassets in Resources */,
161 | 50379B232058CBB4000EE86E /* capacitor.config.json in Resources */,
162 | 504EC30D1FED79650016851F /* Main.storyboard in Resources */,
163 | 2FAD9763203C412B000D30F8 /* config.xml in Resources */,
164 | );
165 | runOnlyForDeploymentPostprocessing = 0;
166 | };
167 | /* End PBXResourcesBuildPhase section */
168 |
169 | /* Begin PBXShellScriptBuildPhase section */
170 | 6634F4EFEBD30273BCE97C65 /* [CP] Check Pods Manifest.lock */ = {
171 | isa = PBXShellScriptBuildPhase;
172 | buildActionMask = 2147483647;
173 | files = (
174 | );
175 | inputPaths = (
176 | "${PODS_PODFILE_DIR_PATH}/Podfile.lock",
177 | "${PODS_ROOT}/Manifest.lock",
178 | );
179 | name = "[CP] Check Pods Manifest.lock";
180 | outputPaths = (
181 | "$(DERIVED_FILE_DIR)/Pods-App-checkManifestLockResult.txt",
182 | );
183 | runOnlyForDeploymentPostprocessing = 0;
184 | shellPath = /bin/sh;
185 | shellScript = "diff \"${PODS_PODFILE_DIR_PATH}/Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n# This output is used by Xcode 'outputs' to avoid re-running this script phase.\necho \"SUCCESS\" > \"${SCRIPT_OUTPUT_FILE_0}\"\n";
186 | showEnvVarsInLog = 0;
187 | };
188 | 9592DBEFFC6D2A0C8D5DEB22 /* [CP] Embed Pods Frameworks */ = {
189 | isa = PBXShellScriptBuildPhase;
190 | buildActionMask = 2147483647;
191 | files = (
192 | );
193 | inputPaths = (
194 | );
195 | name = "[CP] Embed Pods Frameworks";
196 | outputPaths = (
197 | );
198 | runOnlyForDeploymentPostprocessing = 0;
199 | shellPath = /bin/sh;
200 | shellScript = "\"${PODS_ROOT}/Target Support Files/Pods-App/Pods-App-frameworks.sh\"\n";
201 | showEnvVarsInLog = 0;
202 | };
203 | /* End PBXShellScriptBuildPhase section */
204 |
205 | /* Begin PBXSourcesBuildPhase section */
206 | 504EC3001FED79650016851F /* Sources */ = {
207 | isa = PBXSourcesBuildPhase;
208 | buildActionMask = 2147483647;
209 | files = (
210 | 504EC3081FED79650016851F /* AppDelegate.swift in Sources */,
211 | );
212 | runOnlyForDeploymentPostprocessing = 0;
213 | };
214 | /* End PBXSourcesBuildPhase section */
215 |
216 | /* Begin PBXVariantGroup section */
217 | 504EC30B1FED79650016851F /* Main.storyboard */ = {
218 | isa = PBXVariantGroup;
219 | children = (
220 | 504EC30C1FED79650016851F /* Base */,
221 | );
222 | name = Main.storyboard;
223 | sourceTree = "";
224 | };
225 | 504EC3101FED79650016851F /* LaunchScreen.storyboard */ = {
226 | isa = PBXVariantGroup;
227 | children = (
228 | 504EC3111FED79650016851F /* Base */,
229 | );
230 | name = LaunchScreen.storyboard;
231 | sourceTree = "";
232 | };
233 | /* End PBXVariantGroup section */
234 |
235 | /* Begin XCBuildConfiguration section */
236 | 504EC3141FED79650016851F /* Debug */ = {
237 | isa = XCBuildConfiguration;
238 | buildSettings = {
239 | ALWAYS_SEARCH_USER_PATHS = NO;
240 | CLANG_ANALYZER_NONNULL = YES;
241 | CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE;
242 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++14";
243 | CLANG_CXX_LIBRARY = "libc++";
244 | CLANG_ENABLE_MODULES = YES;
245 | CLANG_ENABLE_OBJC_ARC = YES;
246 | CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;
247 | CLANG_WARN_BOOL_CONVERSION = YES;
248 | CLANG_WARN_COMMA = YES;
249 | CLANG_WARN_CONSTANT_CONVERSION = YES;
250 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
251 | CLANG_WARN_DOCUMENTATION_COMMENTS = YES;
252 | CLANG_WARN_EMPTY_BODY = YES;
253 | CLANG_WARN_ENUM_CONVERSION = YES;
254 | CLANG_WARN_INFINITE_RECURSION = YES;
255 | CLANG_WARN_INT_CONVERSION = YES;
256 | CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;
257 | CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
258 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
259 | CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
260 | CLANG_WARN_STRICT_PROTOTYPES = YES;
261 | CLANG_WARN_SUSPICIOUS_MOVE = YES;
262 | CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE;
263 | CLANG_WARN_UNREACHABLE_CODE = YES;
264 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
265 | CODE_SIGN_IDENTITY = "iPhone Developer";
266 | COPY_PHASE_STRIP = NO;
267 | DEBUG_INFORMATION_FORMAT = dwarf;
268 | ENABLE_STRICT_OBJC_MSGSEND = YES;
269 | ENABLE_TESTABILITY = YES;
270 | GCC_C_LANGUAGE_STANDARD = gnu11;
271 | GCC_DYNAMIC_NO_PIC = NO;
272 | GCC_NO_COMMON_BLOCKS = YES;
273 | GCC_OPTIMIZATION_LEVEL = 0;
274 | GCC_PREPROCESSOR_DEFINITIONS = (
275 | "DEBUG=1",
276 | "$(inherited)",
277 | );
278 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
279 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
280 | GCC_WARN_UNDECLARED_SELECTOR = YES;
281 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
282 | GCC_WARN_UNUSED_FUNCTION = YES;
283 | GCC_WARN_UNUSED_VARIABLE = YES;
284 | IPHONEOS_DEPLOYMENT_TARGET = 13.0;
285 | MTL_ENABLE_DEBUG_INFO = YES;
286 | ONLY_ACTIVE_ARCH = YES;
287 | SDKROOT = iphoneos;
288 | SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG;
289 | SWIFT_OPTIMIZATION_LEVEL = "-Onone";
290 | };
291 | name = Debug;
292 | };
293 | 504EC3151FED79650016851F /* Release */ = {
294 | isa = XCBuildConfiguration;
295 | buildSettings = {
296 | ALWAYS_SEARCH_USER_PATHS = NO;
297 | CLANG_ANALYZER_NONNULL = YES;
298 | CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE;
299 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++14";
300 | CLANG_CXX_LIBRARY = "libc++";
301 | CLANG_ENABLE_MODULES = YES;
302 | CLANG_ENABLE_OBJC_ARC = YES;
303 | CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;
304 | CLANG_WARN_BOOL_CONVERSION = YES;
305 | CLANG_WARN_COMMA = YES;
306 | CLANG_WARN_CONSTANT_CONVERSION = YES;
307 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
308 | CLANG_WARN_DOCUMENTATION_COMMENTS = YES;
309 | CLANG_WARN_EMPTY_BODY = YES;
310 | CLANG_WARN_ENUM_CONVERSION = YES;
311 | CLANG_WARN_INFINITE_RECURSION = YES;
312 | CLANG_WARN_INT_CONVERSION = YES;
313 | CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;
314 | CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
315 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
316 | CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
317 | CLANG_WARN_STRICT_PROTOTYPES = YES;
318 | CLANG_WARN_SUSPICIOUS_MOVE = YES;
319 | CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE;
320 | CLANG_WARN_UNREACHABLE_CODE = YES;
321 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
322 | CODE_SIGN_IDENTITY = "iPhone Developer";
323 | COPY_PHASE_STRIP = NO;
324 | DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
325 | ENABLE_NS_ASSERTIONS = NO;
326 | ENABLE_STRICT_OBJC_MSGSEND = YES;
327 | GCC_C_LANGUAGE_STANDARD = gnu11;
328 | GCC_NO_COMMON_BLOCKS = YES;
329 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
330 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
331 | GCC_WARN_UNDECLARED_SELECTOR = YES;
332 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
333 | GCC_WARN_UNUSED_FUNCTION = YES;
334 | GCC_WARN_UNUSED_VARIABLE = YES;
335 | IPHONEOS_DEPLOYMENT_TARGET = 13.0;
336 | MTL_ENABLE_DEBUG_INFO = NO;
337 | SDKROOT = iphoneos;
338 | SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule";
339 | VALIDATE_PRODUCT = YES;
340 | };
341 | name = Release;
342 | };
343 | 504EC3171FED79650016851F /* Debug */ = {
344 | isa = XCBuildConfiguration;
345 | baseConfigurationReference = FC68EB0AF532CFC21C3344DD /* Pods-App.debug.xcconfig */;
346 | buildSettings = {
347 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
348 | CODE_SIGN_STYLE = Automatic;
349 | CURRENT_PROJECT_VERSION = 1;
350 | INFOPLIST_FILE = App/Info.plist;
351 | IPHONEOS_DEPLOYMENT_TARGET = 13.0;
352 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
353 | MARKETING_VERSION = 1.0;
354 | OTHER_SWIFT_FLAGS = "$(inherited) \"-D\" \"COCOAPODS\" \"-DDEBUG\"";
355 | PRODUCT_BUNDLE_IDENTIFIER = com.example.webview_overlay;
356 | PRODUCT_NAME = "$(TARGET_NAME)";
357 | SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG;
358 | SWIFT_VERSION = 5.0;
359 | TARGETED_DEVICE_FAMILY = "1,2";
360 | };
361 | name = Debug;
362 | };
363 | 504EC3181FED79650016851F /* Release */ = {
364 | isa = XCBuildConfiguration;
365 | baseConfigurationReference = AF51FD2D460BCFE21FA515B2 /* Pods-App.release.xcconfig */;
366 | buildSettings = {
367 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
368 | CODE_SIGN_STYLE = Automatic;
369 | CURRENT_PROJECT_VERSION = 1;
370 | INFOPLIST_FILE = App/Info.plist;
371 | IPHONEOS_DEPLOYMENT_TARGET = 13.0;
372 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
373 | MARKETING_VERSION = 1.0;
374 | PRODUCT_BUNDLE_IDENTIFIER = com.example.webview_overlay;
375 | PRODUCT_NAME = "$(TARGET_NAME)";
376 | SWIFT_ACTIVE_COMPILATION_CONDITIONS = "";
377 | SWIFT_VERSION = 5.0;
378 | TARGETED_DEVICE_FAMILY = "1,2";
379 | };
380 | name = Release;
381 | };
382 | /* End XCBuildConfiguration section */
383 |
384 | /* Begin XCConfigurationList section */
385 | 504EC2FF1FED79650016851F /* Build configuration list for PBXProject "App" */ = {
386 | isa = XCConfigurationList;
387 | buildConfigurations = (
388 | 504EC3141FED79650016851F /* Debug */,
389 | 504EC3151FED79650016851F /* Release */,
390 | );
391 | defaultConfigurationIsVisible = 0;
392 | defaultConfigurationName = Release;
393 | };
394 | 504EC3161FED79650016851F /* Build configuration list for PBXNativeTarget "App" */ = {
395 | isa = XCConfigurationList;
396 | buildConfigurations = (
397 | 504EC3171FED79650016851F /* Debug */,
398 | 504EC3181FED79650016851F /* Release */,
399 | );
400 | defaultConfigurationIsVisible = 0;
401 | defaultConfigurationName = Release;
402 | };
403 | /* End XCConfigurationList section */
404 | };
405 | rootObject = 504EC2FC1FED79650016851F /* Project object */;
406 | }
407 |
--------------------------------------------------------------------------------
/android/src/main/java/com/clearxp/capacitor/webviewoverlay/WebviewOverlayPlugin.java:
--------------------------------------------------------------------------------
1 | package com.clearxp.capacitor.webviewoverlay;
2 | import android.annotation.SuppressLint;
3 | import android.graphics.Bitmap;
4 | import android.graphics.Canvas;
5 | import android.os.Message;
6 | import android.util.Log;
7 | import android.view.View;
8 | import android.view.ViewGroup;
9 | import android.webkit.MimeTypeMap;
10 | import android.webkit.WebChromeClient;
11 | import android.webkit.WebSettings;
12 | import android.webkit.WebView;
13 | import android.webkit.WebViewClient;
14 |
15 | import com.getcapacitor.JSObject;
16 | import com.getcapacitor.Plugin;
17 | import com.getcapacitor.PluginCall;
18 | import com.getcapacitor.PluginMethod;
19 | import com.getcapacitor.annotation.CapacitorPlugin;
20 |
21 | import java.io.ByteArrayOutputStream;
22 | import java.io.File;
23 | import java.io.FileInputStream;
24 | import java.net.MalformedURLException;
25 | import java.net.URL;
26 | import java.util.HashMap;
27 | import java.util.UUID;
28 |
29 | import android.util.Base64;
30 |
31 | import fi.iki.elonen.NanoHTTPD;
32 |
33 | import com.clearxp.capacitor.webviewoverlay.FileChooserWebChromeClient;
34 |
35 | class MyHTTPD extends NanoHTTPD {
36 | public static final int PORT = 8080;
37 |
38 | public MyHTTPD() {
39 | super(PORT);
40 | }
41 |
42 | @Override
43 | public Response serve(IHTTPSession session) {
44 | String uri = session.getUri();
45 |
46 | try {
47 | File file = new File(uri);
48 | FileInputStream fis = new FileInputStream(file);
49 |
50 | String extension = MimeTypeMap.getFileExtensionFromUrl(uri);
51 | String mimeType = MimeTypeMap.getSingleton().getMimeTypeFromExtension(extension);
52 |
53 | return newChunkedResponse(Response.Status.OK, mimeType, fis);
54 |
55 | } catch(Exception e) {}
56 |
57 | return null;
58 | }
59 | }
60 |
61 | @CapacitorPlugin(name = "WebviewOverlayPlugin")
62 | public class WebviewOverlayPlugin extends Plugin {
63 | private boolean hidden = false;
64 | private boolean fullscreen = false;
65 | private int width;
66 | private int height;
67 | private float x;
68 | private float y;
69 |
70 | private HashMap webviews = new HashMap();
71 |
72 | private String targetUrl;
73 |
74 | private PluginCall loadUrlCall;
75 |
76 | private MyHTTPD server;
77 |
78 | @Override
79 | public void load() {
80 | super.load();
81 | }
82 |
83 | private float getPixels(int value) {
84 | return value * getContext().getResources().getDisplayMetrics().density + 0.5f;
85 | }
86 |
87 | @SuppressLint("SetJavaScriptEnabled")
88 | @PluginMethod()
89 | public void open(final PluginCall call) {
90 | getActivity().runOnUiThread(() -> {
91 | hidden = false;
92 |
93 | String browser_uuid = UUID.randomUUID().toString();
94 | WebView webView = new WebView(getContext());
95 | WebviewOverlayPlugin.this.webviews.put(browser_uuid, webView);
96 |
97 | WebSettings settings = webView.getSettings();
98 | settings.setAllowContentAccess(true);
99 | settings.setAllowFileAccess(true);
100 | settings.setAllowFileAccessFromFileURLs(true);
101 | settings.setAllowUniversalAccessFromFileURLs(true);
102 | settings.setJavaScriptEnabled(true);
103 | settings.setMixedContentMode(WebSettings.MIXED_CONTENT_ALWAYS_ALLOW);
104 | settings.setDomStorageEnabled(true);
105 | settings.setSupportMultipleWindows(true);
106 |
107 | // Temp fix until this setting is on by default
108 | bridge.getWebView().getSettings().setJavaScriptCanOpenWindowsAutomatically(true);
109 |
110 | final String javascript = call.getString("javascript", "");
111 |
112 | final int injectionTime = call.getInt("injectionTime", 0);
113 |
114 | webView.setWebChromeClient(new FileChooserWebChromeClient(getActivity()) {
115 | @Override
116 | public void onProgressChanged(WebView view, int progress) {
117 | JSObject progressValue = new JSObject();
118 | progressValue.put("value", progress/100.0);
119 | WebviewOverlayPlugin.this.notify("progress", progressValue, browser_uuid);
120 | }
121 |
122 | @Override
123 | public boolean onCreateWindow(WebView view, boolean isDialog, boolean isUserGesture, Message resultMsg) {
124 | final WebView targetWebView = new WebView(getActivity());
125 | targetWebView.setWebViewClient(new WebViewClient() {
126 | @Override
127 | public void onLoadResource(WebView view, String url) {
128 | if (hasListeners("navigationHandler_" + browser_uuid)) {
129 | handleNavigation(browser_uuid, url, true);
130 | JSObject progressValue = new JSObject();
131 | progressValue.put("value", 0.1);
132 | WebviewOverlayPlugin.this.notify("progress", progressValue, browser_uuid);
133 | }
134 | else {
135 | webView.loadUrl(url);
136 | }
137 | targetWebView.removeAllViews();
138 | targetWebView.destroy();
139 | }
140 | });
141 | WebView.WebViewTransport transport = (WebView.WebViewTransport) resultMsg.obj;
142 | transport.setWebView(targetWebView);
143 | resultMsg.sendToTarget();
144 | return true;
145 | }
146 | });
147 |
148 | webView.setWebViewClient(new WebViewClient() {
149 | @Override
150 | public void onPageStarted(WebView view, String url, Bitmap favicon) {
151 | super.onPageStarted(view, url, favicon);
152 |
153 | if (!javascript.isEmpty() && injectionTime == 0) {
154 | webView.evaluateJavascript(javascript, null);
155 | }
156 | }
157 |
158 | @Override
159 | public void onPageFinished(WebView view, String url) {
160 | super.onPageFinished(view, url);
161 |
162 | if (!javascript.isEmpty() && injectionTime == 1) {
163 | webView.evaluateJavascript(javascript, null);
164 | }
165 | if (!hidden) {
166 | webView.setVisibility(View.VISIBLE);
167 | } else {
168 | webView.setVisibility(View.INVISIBLE);
169 | WebviewOverlayPlugin.this.notify("updateSnapshot", new JSObject(), browser_uuid);
170 | }
171 |
172 | if (loadUrlCall != null) {
173 | loadUrlCall.resolve();
174 | loadUrlCall = null;
175 | }
176 | WebviewOverlayPlugin.this.notify("pageLoaded", new JSObject(), browser_uuid);
177 | }
178 | @Override
179 | public boolean shouldOverrideUrlLoading(WebView view, String url) {
180 |
181 | if (hasListeners("navigationHandler_" + browser_uuid)) {
182 | handleNavigation(browser_uuid, url, false);
183 | return true;
184 | }
185 | else {
186 | targetUrl = null;
187 | return false;
188 | }
189 | }
190 | });
191 |
192 | webView.setVisibility(View.INVISIBLE);
193 |
194 | String urlString = call.getString("url", "");
195 |
196 | if (urlString.isEmpty()) {
197 | call.reject("Must provide a URL to open");
198 | return;
199 | }
200 |
201 | width = (int) getPixels(call.getInt("width", 1));
202 | height = (int) getPixels(call.getInt("height", 1));
203 | x = getPixels(call.getInt("x", 0));
204 | y = getPixels(call.getInt("y", 0));
205 |
206 | ViewGroup.LayoutParams params = new ViewGroup.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT);
207 | webView.setLayoutParams(params);
208 | params.width = width;
209 | params.height = height;
210 | webView.setX(x);
211 | webView.setY(y);
212 | webView.requestLayout();
213 |
214 | ((ViewGroup) getBridge().getWebView().getParent()).addView(webView);
215 |
216 | if (urlString.contains("file:")) {
217 | try {
218 | server = new MyHTTPD();
219 | server.start();
220 | } catch (Exception e) {}
221 |
222 | webView.loadUrl(urlString.replace("file://", "http://localhost:8080"));
223 | }
224 | else {
225 | webView.loadUrl(urlString);
226 | }
227 |
228 | JSObject ret = new JSObject();
229 | ret.put("id", browser_uuid);
230 | call.resolve(ret);
231 | });
232 | }
233 |
234 | private void handleNavigation(String browser_uuid, String url, Boolean newWindow) {
235 | targetUrl = url;
236 | boolean sameHost;
237 |
238 | WebView webView = this.webviews.get(browser_uuid);
239 |
240 | try {
241 | URL currentUrl = new URL(webView.getUrl());
242 | URL targetUrl = new URL(url);
243 | sameHost = currentUrl.getHost().equals(targetUrl.getHost());
244 |
245 | JSObject navigationHandlerValue = new JSObject();
246 | navigationHandlerValue.put("url", url);
247 | navigationHandlerValue.put("newWindow", newWindow);
248 | navigationHandlerValue.put("sameHost", sameHost);
249 |
250 | WebviewOverlayPlugin.this.notify("navigationHandler_" + browser_uuid, navigationHandlerValue, browser_uuid);
251 | }
252 | catch(MalformedURLException e) { }
253 | }
254 |
255 | @PluginMethod()
256 | public void close(final PluginCall call) {
257 | getActivity().runOnUiThread(() -> {
258 | String browser_uuid = call.getString("id");
259 | if (browser_uuid == null) {
260 | call.reject("Must provide a browser id");
261 | return;
262 | }
263 |
264 | WebView webView = WebviewOverlayPlugin.this.webviews.remove(browser_uuid);
265 | if (webView != null) {
266 | if (server != null && server.isAlive()) {
267 | server.stop();
268 | }
269 |
270 | ViewGroup rootGroup = ((ViewGroup) getBridge().getWebView().getParent());
271 | int count = rootGroup.getChildCount();
272 | if (count > 1) {
273 | rootGroup.removeView(webView);
274 | }
275 | hidden = false;
276 |
277 | webView.destroy();
278 | }
279 | call.resolve();
280 | });
281 | }
282 |
283 | @PluginMethod()
284 | public void show(final PluginCall call) {
285 | getActivity().runOnUiThread(() -> {
286 | String browser_uuid = call.getString("id");
287 | if (browser_uuid == null) {
288 | call.reject("Must provide a browser id");
289 | return;
290 | }
291 |
292 | hidden = false;
293 |
294 | WebView webView = WebviewOverlayPlugin.this.webviews.get(browser_uuid);
295 | if (webView != null) {
296 | webView.setVisibility(View.VISIBLE);
297 | }
298 | call.resolve();
299 | });
300 | }
301 |
302 | @PluginMethod()
303 | public void hide(final PluginCall call) {
304 | getActivity().runOnUiThread(() -> {
305 | String browser_uuid = call.getString("id");
306 | if (browser_uuid == null) {
307 | call.reject("Must provide a browser id");
308 | return;
309 | }
310 |
311 | hidden = true;
312 |
313 | WebView webView = WebviewOverlayPlugin.this.webviews.get(browser_uuid);
314 | if (webView != null) {
315 | webView.setVisibility(View.INVISIBLE);
316 | }
317 | call.resolve();
318 | });
319 | }
320 |
321 | @PluginMethod()
322 | public void updateDimensions(final PluginCall call) {
323 | getActivity().runOnUiThread(() -> {
324 | String browser_uuid = call.getString("id");
325 | if (browser_uuid == null) {
326 | call.reject("Must provide a browser id");
327 | return;
328 | }
329 |
330 | JSObject dimensions_object = call.getObject("dimensions");
331 | if (dimensions_object == null) {
332 | call.reject("Must pass dimensions object");
333 | return;
334 | }
335 |
336 | width = (int) getPixels(dimensions_object.getInteger("width", 1));
337 | height = (int) getPixels(dimensions_object.getInteger("height", 1));
338 | x = getPixels(dimensions_object.getInteger("x", 0));
339 | y = getPixels(dimensions_object.getInteger("y", 0));
340 |
341 | WebView webView = WebviewOverlayPlugin.this.webviews.get(browser_uuid);
342 | if (webView == null) {
343 | call.reject("Can't find browser matching id");
344 | return;
345 | }
346 |
347 | ViewGroup.LayoutParams params = webView.getLayoutParams();
348 | if (!fullscreen) {
349 | params.width = width;
350 | params.height = height;
351 | webView.setX(x);
352 | webView.setY(y);
353 | webView.requestLayout();
354 | }
355 | else {
356 | params.width = ViewGroup.LayoutParams.MATCH_PARENT;
357 | params.height = ViewGroup.LayoutParams.MATCH_PARENT;
358 | webView.setX(0);
359 | webView.setY(0);
360 | webView.requestLayout();
361 | }
362 |
363 | if (hidden) {
364 | WebviewOverlayPlugin.this.notify("updateSnapshot", new JSObject(), browser_uuid);
365 | }
366 |
367 | call.resolve();
368 | });
369 | }
370 |
371 | @PluginMethod()
372 | public void getSnapshot(final PluginCall call) {
373 | getActivity().runOnUiThread(() -> {
374 | String browser_uuid = call.getString("id");
375 | if (browser_uuid == null) {
376 | call.reject("Must provide a browser id");
377 | return;
378 | }
379 |
380 | WebView webView = WebviewOverlayPlugin.this.webviews.get(browser_uuid);
381 |
382 | final JSObject object = new JSObject();
383 | if (webView != null) {
384 | Bitmap bm = Bitmap.createBitmap(width == 0 ? 1 : width, height == 0 ? 1 : height, Bitmap.Config.ARGB_8888);
385 | Canvas canvas = new Canvas(bm);
386 | webView.draw(canvas);
387 | ByteArrayOutputStream os = new ByteArrayOutputStream();
388 | bm.compress(Bitmap.CompressFormat.JPEG, 100, os);
389 | byte[] byteArray = os.toByteArray();
390 | String src = Base64.encodeToString(byteArray, Base64.DEFAULT);
391 | object.put("src", src);
392 | call.resolve(object);
393 | } else {
394 | object.put("src", "");
395 | call.resolve(object);
396 | }
397 | });
398 | }
399 |
400 | @PluginMethod()
401 | public void evaluateJavaScript(final PluginCall call) {
402 | final String javascript = call.getString("javascript", "");
403 | if (javascript.isEmpty()) {
404 | call.reject("Must provide javascript string");
405 | return;
406 | }
407 |
408 | String browser_uuid = call.getString("id");
409 | if (browser_uuid == null) {
410 | call.reject("Must provide a browser id");
411 | return;
412 | }
413 |
414 | WebView webView = this.webviews.get(browser_uuid);
415 |
416 | if (webView != null) {
417 | final JSObject object = new JSObject();
418 | getActivity().runOnUiThread(() -> webView.evaluateJavascript(javascript, value -> {
419 | if (value != null) {
420 | object.put("result", value);
421 | call.resolve(object);
422 | }
423 | }));
424 | }
425 | }
426 |
427 | @PluginMethod()
428 | public void toggleFullscreen(final PluginCall call) {
429 | getActivity().runOnUiThread(() -> {
430 | String browser_uuid = call.getString("id");
431 | if (browser_uuid == null) {
432 | call.reject("Must provide a browser id");
433 | return;
434 | }
435 |
436 | WebView webView = WebviewOverlayPlugin.this.webviews.get(browser_uuid);
437 | if (webView != null) {
438 | ViewGroup.LayoutParams params = webView.getLayoutParams();
439 | if (fullscreen) {
440 | params.width = width;
441 | params.height = height;
442 | webView.setX(x);
443 | webView.setY(y);
444 | webView.requestLayout();
445 | fullscreen = false;
446 | }
447 | else {
448 | params.width = ViewGroup.LayoutParams.MATCH_PARENT;
449 | params.height = ViewGroup.LayoutParams.MATCH_PARENT;
450 | webView.setX(0);
451 | webView.setY(0);
452 | webView.requestLayout();
453 | fullscreen = true;
454 | }
455 | }
456 |
457 | call.resolve();
458 | });
459 | }
460 |
461 | @PluginMethod()
462 | public void goBack(final PluginCall call) {
463 | getActivity().runOnUiThread(() -> {
464 | String browser_uuid = call.getString("id");
465 | if (browser_uuid == null) {
466 | call.reject("Must provide a browser id");
467 | return;
468 | }
469 |
470 | WebView webView = WebviewOverlayPlugin.this.webviews.get(browser_uuid);
471 | if (webView != null) {
472 | webView.goBack();
473 | }
474 | call.resolve();
475 | });
476 | }
477 |
478 | @PluginMethod()
479 | public void goForward(final PluginCall call) {
480 | getActivity().runOnUiThread(() -> {
481 | String browser_uuid = call.getString("id");
482 | if (browser_uuid == null) {
483 | call.reject("Must provide a browser id");
484 | return;
485 | }
486 |
487 | WebView webView = WebviewOverlayPlugin.this.webviews.get(browser_uuid);
488 | if (webView != null) {
489 | webView.goForward();
490 | }
491 | call.resolve();
492 | });
493 | }
494 |
495 | @PluginMethod()
496 | public void reload(final PluginCall call) {
497 | getActivity().runOnUiThread(() -> {
498 | String browser_uuid = call.getString("id");
499 | if (browser_uuid == null) {
500 | call.reject("Must provide a browser id");
501 | return;
502 | }
503 |
504 | WebView webView = WebviewOverlayPlugin.this.webviews.get(browser_uuid);
505 | if (webView != null) {
506 | webView.reload();
507 | }
508 | call.resolve();
509 | });
510 | }
511 |
512 | @PluginMethod()
513 | public void loadUrl(final PluginCall call) {
514 | getActivity().runOnUiThread(() -> {
515 | String browser_uuid = call.getString("id");
516 | if (browser_uuid == null) {
517 | call.reject("Must provide a browser id");
518 | return;
519 | }
520 |
521 | WebView webView = WebviewOverlayPlugin.this.webviews.get(browser_uuid);
522 | if (call.getString("url") != null) {
523 | webView.loadUrl(call.getString("url"));
524 | loadUrlCall = call;
525 | }
526 | });
527 | }
528 |
529 | @PluginMethod()
530 | public void handleNavigationEvent(final PluginCall call) {
531 | getActivity().runOnUiThread(() -> {
532 | String browser_uuid = call.getString("id");
533 | if (browser_uuid == null) {
534 | call.reject("Must provide a browser id");
535 | return;
536 | }
537 |
538 | WebView webView = WebviewOverlayPlugin.this.webviews.get(browser_uuid);
539 | if (webView != null && targetUrl != null) {
540 | if (call.getBoolean("allow")) {
541 | webView.loadUrl(targetUrl);
542 | }
543 | else {
544 | WebviewOverlayPlugin.this.notify("pageLoaded", new JSObject(), browser_uuid);
545 | }
546 | targetUrl = null;
547 | }
548 | call.resolve();
549 | });
550 | }
551 |
552 | public void notify(String eventName, JSObject data, String browser_uuid) {
553 | data.put("id", browser_uuid);
554 | notifyListeners(eventName, data);
555 | }
556 | }
557 |
--------------------------------------------------------------------------------
/ios/Plugin/Plugin/Plugin.swift:
--------------------------------------------------------------------------------
1 | import Foundation
2 | import Capacitor
3 | import GCDWebServer
4 |
5 | @available(iOS 11.0, *)
6 | class WebviewOverlay: UIViewController, WKUIDelegate, WKNavigationDelegate {
7 | var id: String?
8 | var webview: WKWebView?
9 | var plugin: WebviewOverlayPlugin!
10 | var configuration: WKWebViewConfiguration!
11 |
12 | var closeFullscreenButton: UIButton!
13 | var topSafeArea: CGFloat!
14 |
15 | var webServer: GCDWebServer?
16 |
17 | var currentDecisionHandler: ((WKNavigationResponsePolicy) -> Void)? = nil
18 |
19 | var openNewWindow: Bool = false
20 |
21 | var currentUrl: URL?
22 |
23 | var loadUrlCall: CAPPluginCall?
24 |
25 | init(_ plugin: WebviewOverlayPlugin, configuration: WKWebViewConfiguration, id: String) {
26 | super.init(nibName: "WebviewOverlay", bundle: nil)
27 | self.plugin = plugin
28 | self.configuration = configuration
29 | self.id = id
30 | }
31 |
32 | deinit {
33 | self.clearDecisionHandler()
34 | self.webview?.removeObserver(self, forKeyPath: #keyPath(WKWebView.estimatedProgress))
35 | }
36 |
37 | required init?(coder aDecoder: NSCoder) {
38 | fatalError("init(coder:) has not been implemented")
39 | }
40 |
41 | override func loadView() {
42 | self.webview = WKWebView(frame: .zero, configuration: self.configuration)
43 | self.webview?.uiDelegate = self
44 | self.webview?.navigationDelegate = self
45 |
46 | view = self.webview
47 | view.isHidden = plugin.hidden
48 | self.webview?.scrollView.bounces = false
49 | self.webview?.allowsBackForwardNavigationGestures = true
50 |
51 | // self.webview?.isOpaque = false
52 |
53 | let button = UIButton(frame: CGRect(x: UIScreen.main.bounds.width - 60, y: 20, width: 40, height: 40))
54 | let image = UIImage(named: "icon", in: Bundle(for: NSClassFromString("WebviewOverlayPlugin")!), compatibleWith: nil)
55 | button.setImage(image, for: .normal)
56 | button.isHidden = true;
57 | button.imageEdgeInsets = UIEdgeInsets(top: 10, left: 10, bottom: 10, right: 10)
58 | button.adjustsImageWhenHighlighted = false
59 | button.layer.cornerRadius = 0.5 * button.bounds.size.width
60 | // button.addTarget(self, action: #selector(buttonAction), for: .touchUpInside)
61 |
62 | let blur = UIVisualEffectView(effect: UIBlurEffect(style: UIBlurEffect.Style.regular))
63 | blur.frame = button.bounds
64 | blur.layer.cornerRadius = 0.5 * button.bounds.size.width
65 | blur.clipsToBounds = true
66 | blur.isUserInteractionEnabled = false
67 | button.insertSubview(blur, at: 0)
68 | button.bringSubviewToFront(button.imageView!)
69 |
70 | self.closeFullscreenButton = button
71 | view.addSubview(self.closeFullscreenButton)
72 |
73 | self.webview?.addObserver(self, forKeyPath: #keyPath(WKWebView.estimatedProgress), options: .new, context: nil)
74 | }
75 |
76 | override func viewDidLayoutSubviews() {
77 | self.topSafeArea = view.safeAreaInsets.top
78 | self.closeFullscreenButton.frame = CGRect(x: UIScreen.main.bounds.width - 60, y: self.topSafeArea + 20, width: 40, height: 40)
79 | }
80 |
81 | // @objc func buttonAction(sender: UIButton!) {
82 | // plugin.toggleFullscreen()
83 | // }
84 |
85 | public func webView(_ webView: WKWebView, didFinish navigation: WKNavigation!) {
86 | currentUrl = webView.url
87 | view.isHidden = plugin.hidden
88 | if (plugin.hidden) {
89 | self.notify("updateSnapshot", data: [:])
90 | }
91 | if (self.loadUrlCall != nil) {
92 | self.loadUrlCall?.resolve()
93 | self.loadUrlCall = nil
94 | }
95 | self.notify("pageLoaded", data: [:])
96 |
97 | // Remove tap highlight
98 | let script = "function addStyleString(str) {" +
99 | "var node = document.createElement('style');" +
100 | "node.innerHTML = str;" +
101 | "document.body.appendChild(node);" +
102 | "}" +
103 | "addStyleString('html, body {-webkit-tap-highlight-color: transparent;}');"
104 | webView.evaluateJavaScript(script)
105 | }
106 |
107 | public func webView(_ webView: WKWebView, createWebViewWith configuration: WKWebViewConfiguration, for navigationAction: WKNavigationAction, windowFeatures: WKWindowFeatures) -> WKWebView? {
108 | if navigationAction.targetFrame == nil, let url = navigationAction.request.url {
109 | if (plugin.hasListeners("navigationHandler")) {
110 | self.openNewWindow = true
111 | }
112 | self.loadUrl(url)
113 | }
114 | return nil
115 | }
116 |
117 | public func webView(_ webView: WKWebView, didStartProvisionalNavigation navigation: WKNavigation!) {
118 | self.clearDecisionHandler()
119 | }
120 |
121 | func clearDecisionHandler() {
122 | if (self.currentDecisionHandler != nil) {
123 | self.currentDecisionHandler!(.allow)
124 | self.currentDecisionHandler = nil
125 | }
126 | }
127 |
128 | public func webView(_ webView: WKWebView, decidePolicyFor navigationResponse: WKNavigationResponse, decisionHandler: @escaping (WKNavigationResponsePolicy) -> Void) {
129 | if (self.currentDecisionHandler != nil) {
130 | self.clearDecisionHandler()
131 | }
132 |
133 | let event_name = "navigationHandler_\(self.id!)"
134 | if (navigationResponse.isForMainFrame && plugin.hasListeners(event_name)) {
135 | self.currentDecisionHandler = decisionHandler
136 | self.notify(event_name, data: [
137 | "url": navigationResponse.response.url?.absoluteString ?? "",
138 | "newWindow": self.openNewWindow,
139 | "sameHost": currentUrl?.host == navigationResponse.response.url?.host
140 | ])
141 | self.openNewWindow = false
142 | }
143 | else {
144 | decisionHandler(.allow)
145 | return
146 | }
147 | }
148 |
149 | public func clearWebServer() {
150 | if (self.webServer != nil) {
151 | if (self.webServer?.isRunning == true) {
152 | self.webServer?.stop()
153 | }
154 | self.webServer = nil
155 | }
156 | }
157 |
158 | public func loadUrl(_ url: URL) {
159 | if url.absoluteString.hasPrefix("file") {
160 | self.clearWebServer()
161 | self.webServer = GCDWebServer()
162 | self.webServer?.addGETHandler(forBasePath: "/", directoryPath: url.deletingLastPathComponent().path, indexFilename: nil, cacheAge: 3600, allowRangeRequests: true)
163 | do {
164 | try self.webServer?.start(options: [
165 | GCDWebServerOption_BindToLocalhost: true
166 | ])
167 | } catch {
168 | print(error)
169 | }
170 | self.webview?.load(URLRequest(url: (self.webServer?.serverURL?.appendingPathComponent(url.lastPathComponent))!))
171 | }
172 | else {
173 | self.webview?.load(URLRequest(url: url))
174 | }
175 | }
176 |
177 | override func observeValue(forKeyPath keyPath: String?, of object: Any?, change: [NSKeyValueChangeKey : Any]?, context: UnsafeMutableRawPointer?) {
178 | if (keyPath == "estimatedProgress") {
179 | self.notify("progress", data: ["value":self.webview?.estimatedProgress ?? 1])
180 | }
181 | }
182 |
183 | public func notify(_ eventName: String, data: [String : Any]?) {
184 | // Add ID to event data
185 | var idData = data ?? [:]
186 | idData["id"] = self.id
187 |
188 | // Propagate event
189 | self.plugin.notifyListeners(eventName, data: idData)
190 | }
191 | }
192 |
193 | @available(iOS 11.0, *)
194 | @objc(WebviewOverlayPlugin)
195 | public class WebviewOverlayPlugin: CAPPlugin {
196 |
197 | var width: CGFloat!
198 | var height: CGFloat!
199 | var x: CGFloat!
200 | var y: CGFloat!
201 |
202 | var hidden: Bool = false
203 |
204 | var fullscreen: Bool = false
205 |
206 | var overlays: [String: WebviewOverlay] = [:]
207 |
208 | /**
209 | * Capacitor Plugin load
210 | */
211 | override public func load() {}
212 |
213 | @objc func open(_ call: CAPPluginCall) {
214 | DispatchQueue.main.async {
215 | // Generate an ID to refer to this browser context as
216 | let browser_uuid = NSUUID().uuidString
217 |
218 | let webConfiguration = WKWebViewConfiguration()
219 | webConfiguration.allowsInlineMediaPlayback = true
220 | webConfiguration.mediaTypesRequiringUserActionForPlayback = []
221 | webConfiguration.preferences.setValue(true, forKey: "allowFileAccessFromFileURLs")
222 |
223 | // Content controller
224 | let javascript = call.getString("javascript") ?? ""
225 | if (javascript != "") {
226 | var injectionTime: WKUserScriptInjectionTime!
227 |
228 | switch(call.getInt("injectionTime")) {
229 | case 0:
230 | injectionTime = .atDocumentStart
231 | break;
232 | case 1:
233 | injectionTime = .atDocumentEnd
234 | break;
235 | default:
236 | injectionTime = .atDocumentStart
237 | break;
238 | }
239 |
240 | let contentController = WKUserContentController()
241 | let script = WKUserScript(source: String(javascript), injectionTime: injectionTime, forMainFrameOnly: true)
242 | contentController.addUserScript(script)
243 | webConfiguration.userContentController = contentController
244 | }
245 |
246 | // Create the overlay
247 | let overlay = WebviewOverlay(self, configuration: webConfiguration, id: browser_uuid)
248 |
249 | // Save it to the dictionary
250 | self.overlays[browser_uuid] = overlay
251 |
252 | guard let urlString = call.getString("url") else {
253 | call.reject("Must provide a URL to open")
254 | return
255 | }
256 |
257 | let url = URL(string: urlString)
258 |
259 | self.hidden = false
260 |
261 | self.width = CGFloat(call.getFloat("width") ?? 0)
262 | self.height = CGFloat(call.getFloat("height") ?? 0)
263 | self.x = CGFloat(call.getFloat("x") ?? 0)
264 | self.y = CGFloat(call.getFloat("y") ?? 0)
265 |
266 | overlay.view.isHidden = false
267 | self.bridge?.viewController?.addChild(overlay)
268 | self.bridge?.viewController?.view.addSubview(overlay.view)
269 | overlay.view.frame = CGRect(x: self.x, y: self.y, width: self.width, height: self.height)
270 | overlay.didMove(toParent: self.bridge?.viewController)
271 |
272 | overlay.loadUrl(url!)
273 |
274 | // Send the ID back to the caller
275 | call.resolve([
276 | "id": browser_uuid
277 | ])
278 | }
279 | }
280 |
281 | @objc func close(_ call: CAPPluginCall) {
282 | DispatchQueue.main.async {
283 | guard let browser_uuid = call.getString("id") else {
284 | call.reject("Must provide a browser id")
285 | return
286 | }
287 |
288 | guard let overlay = self.overlays[browser_uuid] else {
289 | call.reject("Can't find browser matching id")
290 | return
291 | }
292 |
293 | overlay.view.removeFromSuperview()
294 | overlay.removeFromParent()
295 | overlay.clearWebServer()
296 |
297 | self.overlays.removeValue(forKey: browser_uuid)
298 |
299 | self.hidden = false
300 |
301 | call.resolve()
302 | }
303 | }
304 |
305 | @objc func getSnapshot(_ call: CAPPluginCall) {
306 | DispatchQueue.main.async {
307 | guard let browser_uuid = call.getString("id") else {
308 | call.reject("Must provide a browser id")
309 | return
310 | }
311 |
312 | guard let overlay = self.overlays[browser_uuid] else {
313 | call.reject("Can't find browser matching id")
314 | return
315 | }
316 |
317 | if (overlay != nil) {
318 | if (overlay.webview != nil) {
319 | let offset: CGPoint = (overlay.webview?.scrollView.contentOffset)!
320 | overlay.webview?.scrollView.setContentOffset(offset, animated: false)
321 |
322 | overlay.webview?.takeSnapshot(with: nil) {image, error in
323 | if let image = image {
324 | guard let jpeg = image.jpegData(compressionQuality: 1) else {
325 | return
326 | }
327 | let base64String = jpeg.base64EncodedString()
328 | call.resolve(["src": base64String])
329 | } else {
330 | call.resolve(["src": ""])
331 | }
332 | }
333 | }
334 | else {
335 | call.resolve(["src": ""])
336 | }
337 | }
338 | else {
339 | call.resolve(["src": ""])
340 | }
341 | }
342 | }
343 |
344 | @objc func updateDimensions(_ call: CAPPluginCall) {
345 | DispatchQueue.main.async {
346 | guard let browser_uuid = call.getString("id") else {
347 | call.reject("Must provide a browser id")
348 | return
349 | }
350 |
351 | guard let overlay = self.overlays[browser_uuid] else {
352 | call.reject("Can't find browser matching id")
353 | return
354 | }
355 |
356 | let dimensions = call.getObject("dimensions") ?? [:]
357 | self.width = CGFloat(dimensions["width"] as? Float ?? 0)
358 | self.height = CGFloat(dimensions["height"] as? Float ?? 0)
359 | self.x = CGFloat(dimensions["x"] as? Float ?? 0)
360 | self.y = CGFloat(dimensions["y"] as? Float ?? 0)
361 |
362 | if (!self.fullscreen) {
363 | let rect = CGRect(x: self.x, y: self.y, width: self.width, height: self.height)
364 | overlay.view.frame = rect
365 | }
366 | else {
367 | let width = UIScreen.main.bounds.width
368 | let height = UIScreen.main.bounds.height
369 | let rect = CGRect(x: 0, y: 0, width: width, height: height)
370 | overlay.view.frame = rect
371 | }
372 |
373 | if (overlay.topSafeArea != nil && overlay.closeFullscreenButton != nil) {
374 | overlay.closeFullscreenButton.frame = CGRect(x: UIScreen.main.bounds.width - 60, y: overlay.topSafeArea + 20, width: 40, height: 40)
375 | }
376 |
377 | if (self.hidden) {
378 | overlay.notify("updateSnapshot", data: [:])
379 | }
380 |
381 | call.resolve()
382 | }
383 | }
384 |
385 | @objc func show(_ call: CAPPluginCall) {
386 | DispatchQueue.main.async {
387 | guard let browser_uuid = call.getString("id") else {
388 | call.reject("Must provide a browser id")
389 | return
390 | }
391 |
392 | guard let overlay = self.overlays[browser_uuid] else {
393 | call.reject("Can't find browser matching id")
394 | return
395 | }
396 |
397 | self.hidden = false
398 | if (overlay != nil) {
399 | overlay.view.isHidden = false
400 | }
401 | call.resolve()
402 | }
403 | }
404 |
405 | @objc func hide(_ call: CAPPluginCall) {
406 | DispatchQueue.main.async {
407 | guard let browser_uuid = call.getString("id") else {
408 | call.reject("Must provide a browser id")
409 | return
410 | }
411 |
412 | guard let overlay = self.overlays[browser_uuid] else {
413 | call.reject("Can't find browser matching id")
414 | return
415 | }
416 |
417 | self.hidden = true
418 | if (overlay != nil) {
419 | overlay.view.isHidden = true
420 | }
421 | call.resolve()
422 | }
423 | }
424 |
425 | @objc func evaluateJavaScript(_ call: CAPPluginCall) {
426 | DispatchQueue.main.async {
427 | guard let browser_uuid = call.getString("id") else {
428 | call.reject("Must provide a browser id")
429 | return
430 | }
431 |
432 | guard let overlay = self.overlays[browser_uuid] else {
433 | call.reject("Can't find browser matching id")
434 | return
435 | }
436 |
437 | guard let javascript = call.getString("javascript") else {
438 | call.reject("Must provide javascript string")
439 | return
440 | }
441 | if (overlay != nil) {
442 | if (overlay.webview != nil) {
443 | func eval(completionHandler: @escaping (_ response: String?) -> Void) {
444 | overlay.webview?.evaluateJavaScript(String(javascript)) { (value, error) in
445 | if error != nil {
446 | call.reject(error?.localizedDescription ?? "unknown error")
447 | }
448 | else if let valueName = value as? String {
449 | completionHandler(valueName)
450 | }
451 | }
452 | }
453 |
454 | eval(completionHandler: { response in
455 | call.resolve(["result": response as Any])
456 | })
457 | }
458 | else {
459 | call.resolve(["result": ""])
460 | }
461 | }
462 | else {
463 | call.resolve(["result": ""])
464 | }
465 | }
466 | }
467 |
468 | @objc func toggleFullscreen(_ call: CAPPluginCall) {
469 | DispatchQueue.main.async {
470 | guard let browser_uuid = call.getString("id") else {
471 | call.reject("Must provide a browser id")
472 | return
473 | }
474 |
475 | guard let overlay = self.overlays[browser_uuid] else {
476 | call.reject("Can't find browser matching id")
477 | return
478 | }
479 |
480 | if (overlay != nil) {
481 | if (self.fullscreen) {
482 | let rect = CGRect(x: self.x, y: self.y, width: self.width, height: self.height)
483 | overlay.view.frame = rect
484 | self.fullscreen = false
485 | overlay.closeFullscreenButton.isHidden = true
486 | }
487 | else {
488 | let width = UIScreen.main.bounds.width
489 | let height = UIScreen.main.bounds.height
490 | let rect = CGRect(x: 0, y: 0, width: width, height: height)
491 | overlay.view.frame = rect
492 | self.fullscreen = true
493 | overlay.closeFullscreenButton.isHidden = false
494 | }
495 | if (call != nil) {
496 | call.resolve()
497 | }
498 | }
499 | }
500 | }
501 |
502 | @objc func goBack(_ call: CAPPluginCall) {
503 | DispatchQueue.main.async {
504 | guard let browser_uuid = call.getString("id") else {
505 | call.reject("Must provide a browser id")
506 | return
507 | }
508 |
509 | guard let overlay = self.overlays[browser_uuid] else {
510 | call.reject("Can't find browser matching id")
511 | return
512 | }
513 |
514 | if (overlay != nil) {
515 | overlay.webview?.goBack()
516 | call.resolve()
517 | }
518 | }
519 | }
520 |
521 | @objc func goForward(_ call: CAPPluginCall) {
522 | DispatchQueue.main.async {
523 | guard let browser_uuid = call.getString("id") else {
524 | call.reject("Must provide a browser id")
525 | return
526 | }
527 |
528 | guard let overlay = self.overlays[browser_uuid] else {
529 | call.reject("Can't find browser matching id")
530 | return
531 | }
532 |
533 | if (overlay != nil) {
534 | overlay.webview?.goForward()
535 | call.resolve()
536 | }
537 | }
538 | }
539 |
540 | @objc func reload(_ call: CAPPluginCall) {
541 | DispatchQueue.main.async {
542 | guard let browser_uuid = call.getString("id") else {
543 | call.reject("Must provide a browser id")
544 | return
545 | }
546 |
547 | guard let overlay = self.overlays[browser_uuid] else {
548 | call.reject("Can't find browser matching id")
549 | return
550 | }
551 |
552 | if (overlay != nil) {
553 | overlay.webview?.reload()
554 | call.resolve()
555 | }
556 | }
557 | }
558 |
559 | @objc func loadUrl(_ call: CAPPluginCall) {
560 | DispatchQueue.main.async {
561 | guard let browser_uuid = call.getString("id") else {
562 | call.reject("Must provide a browser id")
563 | return
564 | }
565 |
566 | guard let overlay = self.overlays[browser_uuid] else {
567 | call.reject("Can't find browser matching id")
568 | return
569 | }
570 |
571 | if (overlay != nil) {
572 | let url = call.getString("url") ?? ""
573 | overlay.loadUrlCall = call
574 | overlay.loadUrl(URL(string: url)!)
575 | }
576 | }
577 | }
578 |
579 | @objc func handleNavigationEvent(_ call: CAPPluginCall) {
580 | guard let browser_uuid = call.getString("id") else {
581 | call.reject("Must provide a browser id")
582 | return
583 | }
584 |
585 | guard let overlay = self.overlays[browser_uuid] else {
586 | call.reject("Can't find browser matching id")
587 | return
588 | }
589 |
590 | if (overlay.currentDecisionHandler != nil) {
591 | if (call.getBool("allow") ?? true) {
592 | overlay.currentDecisionHandler!(.allow)
593 | }
594 | else {
595 | overlay.currentDecisionHandler!(.cancel)
596 | overlay.notify("pageLoaded", data: [:])
597 | }
598 | overlay.currentDecisionHandler = nil
599 | call.resolve()
600 | }
601 | }
602 | }
603 |
--------------------------------------------------------------------------------
/ios/Plugin/Plugin.xcodeproj/project.pbxproj:
--------------------------------------------------------------------------------
1 | // !$*UTF8*$!
2 | {
3 | archiveVersion = 1;
4 | classes = {
5 | };
6 | objectVersion = 48;
7 | objects = {
8 |
9 | /* Begin PBXBuildFile section */
10 | 03FC29A292ACC40490383A1F /* Pods_Plugin.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 3B2A61DA5A1F2DD4F959604D /* Pods_Plugin.framework */; };
11 | 20C0B05DCFC8E3958A738AF2 /* Pods_PluginTests.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = F6753A823D3815DB436415E3 /* Pods_PluginTests.framework */; };
12 | 50ADFF92201F53D600D50D53 /* Plugin.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 50ADFF88201F53D600D50D53 /* Plugin.framework */; };
13 | 50ADFF97201F53D600D50D53 /* PluginTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 50ADFF96201F53D600D50D53 /* PluginTests.swift */; };
14 | 50ADFF99201F53D600D50D53 /* Plugin.h in Headers */ = {isa = PBXBuildFile; fileRef = 50ADFF8B201F53D600D50D53 /* Plugin.h */; settings = {ATTRIBUTES = (Public, ); }; };
15 | 50ADFFA42020D75100D50D53 /* Capacitor.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 50ADFFA52020D75100D50D53 /* Capacitor.framework */; };
16 | 50ADFFA82020EE4F00D50D53 /* Plugin.m in Sources */ = {isa = PBXBuildFile; fileRef = 50ADFFA72020EE4F00D50D53 /* Plugin.m */; };
17 | 50E1A94820377CB70090CE1A /* Plugin.swift in Sources */ = {isa = PBXBuildFile; fileRef = 50E1A94720377CB70090CE1A /* Plugin.swift */; };
18 | /* End PBXBuildFile section */
19 |
20 | /* Begin PBXContainerItemProxy section */
21 | 50ADFF93201F53D600D50D53 /* PBXContainerItemProxy */ = {
22 | isa = PBXContainerItemProxy;
23 | containerPortal = 50ADFF7F201F53D600D50D53 /* Project object */;
24 | proxyType = 1;
25 | remoteGlobalIDString = 50ADFF87201F53D600D50D53;
26 | remoteInfo = Plugin;
27 | };
28 | /* End PBXContainerItemProxy section */
29 |
30 | /* Begin PBXFileReference section */
31 | 3B2A61DA5A1F2DD4F959604D /* Pods_Plugin.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_Plugin.framework; sourceTree = BUILT_PRODUCTS_DIR; };
32 | 50ADFF88201F53D600D50D53 /* Plugin.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Plugin.framework; sourceTree = BUILT_PRODUCTS_DIR; };
33 | 50ADFF8B201F53D600D50D53 /* Plugin.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = Plugin.h; sourceTree = ""; };
34 | 50ADFF8C201F53D600D50D53 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; };
35 | 50ADFF91201F53D600D50D53 /* PluginTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = PluginTests.xctest; sourceTree = BUILT_PRODUCTS_DIR; };
36 | 50ADFF96201F53D600D50D53 /* PluginTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PluginTests.swift; sourceTree = ""; };
37 | 50ADFF98201F53D600D50D53 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; };
38 | 50ADFFA52020D75100D50D53 /* Capacitor.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; path = Capacitor.framework; sourceTree = BUILT_PRODUCTS_DIR; };
39 | 50ADFFA72020EE4F00D50D53 /* Plugin.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = Plugin.m; sourceTree = ""; };
40 | 50E1A94720377CB70090CE1A /* Plugin.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Plugin.swift; sourceTree = ""; };
41 | 5E23F77F099397094342571A /* Pods-Plugin.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Plugin.debug.xcconfig"; path = "Pods/Target Support Files/Pods-Plugin/Pods-Plugin.debug.xcconfig"; sourceTree = ""; };
42 | 91781294A431A2A7CC6EB714 /* Pods-Plugin.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Plugin.release.xcconfig"; path = "Pods/Target Support Files/Pods-Plugin/Pods-Plugin.release.xcconfig"; sourceTree = ""; };
43 | 96ED1B6440D6672E406C8D19 /* Pods-PluginTests.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-PluginTests.debug.xcconfig"; path = "Pods/Target Support Files/Pods-PluginTests/Pods-PluginTests.debug.xcconfig"; sourceTree = ""; };
44 | F65BB2953ECE002E1EF3E424 /* Pods-PluginTests.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-PluginTests.release.xcconfig"; path = "Pods/Target Support Files/Pods-PluginTests/Pods-PluginTests.release.xcconfig"; sourceTree = ""; };
45 | F6753A823D3815DB436415E3 /* Pods_PluginTests.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_PluginTests.framework; sourceTree = BUILT_PRODUCTS_DIR; };
46 | /* End PBXFileReference section */
47 |
48 | /* Begin PBXFrameworksBuildPhase section */
49 | 50ADFF84201F53D600D50D53 /* Frameworks */ = {
50 | isa = PBXFrameworksBuildPhase;
51 | buildActionMask = 2147483647;
52 | files = (
53 | 50ADFFA42020D75100D50D53 /* Capacitor.framework in Frameworks */,
54 | 03FC29A292ACC40490383A1F /* Pods_Plugin.framework in Frameworks */,
55 | );
56 | runOnlyForDeploymentPostprocessing = 0;
57 | };
58 | 50ADFF8E201F53D600D50D53 /* Frameworks */ = {
59 | isa = PBXFrameworksBuildPhase;
60 | buildActionMask = 2147483647;
61 | files = (
62 | 50ADFF92201F53D600D50D53 /* Plugin.framework in Frameworks */,
63 | 20C0B05DCFC8E3958A738AF2 /* Pods_PluginTests.framework in Frameworks */,
64 | );
65 | runOnlyForDeploymentPostprocessing = 0;
66 | };
67 | /* End PBXFrameworksBuildPhase section */
68 |
69 | /* Begin PBXGroup section */
70 | 50ADFF7E201F53D600D50D53 = {
71 | isa = PBXGroup;
72 | children = (
73 | 50ADFF8A201F53D600D50D53 /* Plugin */,
74 | 50ADFF95201F53D600D50D53 /* PluginTests */,
75 | 50ADFF89201F53D600D50D53 /* Products */,
76 | 8C8E7744173064A9F6D438E3 /* Pods */,
77 | A797B9EFA3DCEFEA1FBB66A9 /* Frameworks */,
78 | );
79 | sourceTree = "";
80 | };
81 | 50ADFF89201F53D600D50D53 /* Products */ = {
82 | isa = PBXGroup;
83 | children = (
84 | 50ADFF88201F53D600D50D53 /* Plugin.framework */,
85 | 50ADFF91201F53D600D50D53 /* PluginTests.xctest */,
86 | );
87 | name = Products;
88 | sourceTree = "";
89 | };
90 | 50ADFF8A201F53D600D50D53 /* Plugin */ = {
91 | isa = PBXGroup;
92 | children = (
93 | 50E1A94720377CB70090CE1A /* Plugin.swift */,
94 | 50ADFF8B201F53D600D50D53 /* Plugin.h */,
95 | 50ADFFA72020EE4F00D50D53 /* Plugin.m */,
96 | 50ADFF8C201F53D600D50D53 /* Info.plist */,
97 | );
98 | path = Plugin;
99 | sourceTree = "";
100 | };
101 | 50ADFF95201F53D600D50D53 /* PluginTests */ = {
102 | isa = PBXGroup;
103 | children = (
104 | 50ADFF96201F53D600D50D53 /* PluginTests.swift */,
105 | 50ADFF98201F53D600D50D53 /* Info.plist */,
106 | );
107 | path = PluginTests;
108 | sourceTree = "";
109 | };
110 | 8C8E7744173064A9F6D438E3 /* Pods */ = {
111 | isa = PBXGroup;
112 | children = (
113 | 5E23F77F099397094342571A /* Pods-Plugin.debug.xcconfig */,
114 | 91781294A431A2A7CC6EB714 /* Pods-Plugin.release.xcconfig */,
115 | 96ED1B6440D6672E406C8D19 /* Pods-PluginTests.debug.xcconfig */,
116 | F65BB2953ECE002E1EF3E424 /* Pods-PluginTests.release.xcconfig */,
117 | );
118 | name = Pods;
119 | sourceTree = "";
120 | };
121 | A797B9EFA3DCEFEA1FBB66A9 /* Frameworks */ = {
122 | isa = PBXGroup;
123 | children = (
124 | 50ADFFA52020D75100D50D53 /* Capacitor.framework */,
125 | 3B2A61DA5A1F2DD4F959604D /* Pods_Plugin.framework */,
126 | F6753A823D3815DB436415E3 /* Pods_PluginTests.framework */,
127 | );
128 | name = Frameworks;
129 | sourceTree = "";
130 | };
131 | /* End PBXGroup section */
132 |
133 | /* Begin PBXHeadersBuildPhase section */
134 | 50ADFF85201F53D600D50D53 /* Headers */ = {
135 | isa = PBXHeadersBuildPhase;
136 | buildActionMask = 2147483647;
137 | files = (
138 | 50ADFF99201F53D600D50D53 /* Plugin.h in Headers */,
139 | );
140 | runOnlyForDeploymentPostprocessing = 0;
141 | };
142 | /* End PBXHeadersBuildPhase section */
143 |
144 | /* Begin PBXNativeTarget section */
145 | 50ADFF87201F53D600D50D53 /* Plugin */ = {
146 | isa = PBXNativeTarget;
147 | buildConfigurationList = 50ADFF9C201F53D600D50D53 /* Build configuration list for PBXNativeTarget "Plugin" */;
148 | buildPhases = (
149 | AB5B3E54B4E897F32C2279DA /* [CP] Check Pods Manifest.lock */,
150 | 50ADFF83201F53D600D50D53 /* Sources */,
151 | 50ADFF84201F53D600D50D53 /* Frameworks */,
152 | 50ADFF85201F53D600D50D53 /* Headers */,
153 | 50ADFF86201F53D600D50D53 /* Resources */,
154 | AE646EB3107D841B880D174A /* [CP] Copy Pods Resources */,
155 | );
156 | buildRules = (
157 | );
158 | dependencies = (
159 | );
160 | name = Plugin;
161 | productName = Plugin;
162 | productReference = 50ADFF88201F53D600D50D53 /* Plugin.framework */;
163 | productType = "com.apple.product-type.framework";
164 | };
165 | 50ADFF90201F53D600D50D53 /* PluginTests */ = {
166 | isa = PBXNativeTarget;
167 | buildConfigurationList = 50ADFF9F201F53D600D50D53 /* Build configuration list for PBXNativeTarget "PluginTests" */;
168 | buildPhases = (
169 | 0596884F929ED6F1DE134961 /* [CP] Check Pods Manifest.lock */,
170 | 50ADFF8D201F53D600D50D53 /* Sources */,
171 | 50ADFF8E201F53D600D50D53 /* Frameworks */,
172 | 50ADFF8F201F53D600D50D53 /* Resources */,
173 | CCA81D3B7E26D0D727D24C84 /* [CP] Embed Pods Frameworks */,
174 | 32BFB60F8ADE8D433EDE204C /* [CP] Copy Pods Resources */,
175 | );
176 | buildRules = (
177 | );
178 | dependencies = (
179 | 50ADFF94201F53D600D50D53 /* PBXTargetDependency */,
180 | );
181 | name = PluginTests;
182 | productName = PluginTests;
183 | productReference = 50ADFF91201F53D600D50D53 /* PluginTests.xctest */;
184 | productType = "com.apple.product-type.bundle.unit-test";
185 | };
186 | /* End PBXNativeTarget section */
187 |
188 | /* Begin PBXProject section */
189 | 50ADFF7F201F53D600D50D53 /* Project object */ = {
190 | isa = PBXProject;
191 | attributes = {
192 | LastSwiftUpdateCheck = 0920;
193 | LastUpgradeCheck = 0920;
194 | ORGANIZATIONNAME = "Max Lynch";
195 | TargetAttributes = {
196 | 50ADFF87201F53D600D50D53 = {
197 | CreatedOnToolsVersion = 9.2;
198 | LastSwiftMigration = 0920;
199 | ProvisioningStyle = Automatic;
200 | };
201 | 50ADFF90201F53D600D50D53 = {
202 | CreatedOnToolsVersion = 9.2;
203 | ProvisioningStyle = Automatic;
204 | };
205 | };
206 | };
207 | buildConfigurationList = 50ADFF82201F53D600D50D53 /* Build configuration list for PBXProject "Plugin" */;
208 | compatibilityVersion = "Xcode 8.0";
209 | developmentRegion = en;
210 | hasScannedForEncodings = 0;
211 | knownRegions = (
212 | en,
213 | );
214 | mainGroup = 50ADFF7E201F53D600D50D53;
215 | productRefGroup = 50ADFF89201F53D600D50D53 /* Products */;
216 | projectDirPath = "";
217 | projectRoot = "";
218 | targets = (
219 | 50ADFF87201F53D600D50D53 /* Plugin */,
220 | 50ADFF90201F53D600D50D53 /* PluginTests */,
221 | );
222 | };
223 | /* End PBXProject section */
224 |
225 | /* Begin PBXResourcesBuildPhase section */
226 | 50ADFF86201F53D600D50D53 /* Resources */ = {
227 | isa = PBXResourcesBuildPhase;
228 | buildActionMask = 2147483647;
229 | files = (
230 | );
231 | runOnlyForDeploymentPostprocessing = 0;
232 | };
233 | 50ADFF8F201F53D600D50D53 /* Resources */ = {
234 | isa = PBXResourcesBuildPhase;
235 | buildActionMask = 2147483647;
236 | files = (
237 | );
238 | runOnlyForDeploymentPostprocessing = 0;
239 | };
240 | /* End PBXResourcesBuildPhase section */
241 |
242 | /* Begin PBXShellScriptBuildPhase section */
243 | 0596884F929ED6F1DE134961 /* [CP] Check Pods Manifest.lock */ = {
244 | isa = PBXShellScriptBuildPhase;
245 | buildActionMask = 2147483647;
246 | files = (
247 | );
248 | inputPaths = (
249 | "${PODS_PODFILE_DIR_PATH}/Podfile.lock",
250 | "${PODS_ROOT}/Manifest.lock",
251 | );
252 | name = "[CP] Check Pods Manifest.lock";
253 | outputPaths = (
254 | "$(DERIVED_FILE_DIR)/Pods-PluginTests-checkManifestLockResult.txt",
255 | );
256 | runOnlyForDeploymentPostprocessing = 0;
257 | shellPath = /bin/sh;
258 | shellScript = "diff \"${PODS_PODFILE_DIR_PATH}/Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n# This output is used by Xcode 'outputs' to avoid re-running this script phase.\necho \"SUCCESS\" > \"${SCRIPT_OUTPUT_FILE_0}\"\n";
259 | showEnvVarsInLog = 0;
260 | };
261 | 32BFB60F8ADE8D433EDE204C /* [CP] Copy Pods Resources */ = {
262 | isa = PBXShellScriptBuildPhase;
263 | buildActionMask = 2147483647;
264 | files = (
265 | );
266 | inputPaths = (
267 | );
268 | name = "[CP] Copy Pods Resources";
269 | outputPaths = (
270 | );
271 | runOnlyForDeploymentPostprocessing = 0;
272 | shellPath = /bin/sh;
273 | shellScript = "\"${SRCROOT}/Pods/Target Support Files/Pods-PluginTests/Pods-PluginTests-resources.sh\"\n";
274 | showEnvVarsInLog = 0;
275 | };
276 | AB5B3E54B4E897F32C2279DA /* [CP] Check Pods Manifest.lock */ = {
277 | isa = PBXShellScriptBuildPhase;
278 | buildActionMask = 2147483647;
279 | files = (
280 | );
281 | inputPaths = (
282 | "${PODS_PODFILE_DIR_PATH}/Podfile.lock",
283 | "${PODS_ROOT}/Manifest.lock",
284 | );
285 | name = "[CP] Check Pods Manifest.lock";
286 | outputPaths = (
287 | "$(DERIVED_FILE_DIR)/Pods-Plugin-checkManifestLockResult.txt",
288 | );
289 | runOnlyForDeploymentPostprocessing = 0;
290 | shellPath = /bin/sh;
291 | shellScript = "diff \"${PODS_PODFILE_DIR_PATH}/Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n# This output is used by Xcode 'outputs' to avoid re-running this script phase.\necho \"SUCCESS\" > \"${SCRIPT_OUTPUT_FILE_0}\"\n";
292 | showEnvVarsInLog = 0;
293 | };
294 | AE646EB3107D841B880D174A /* [CP] Copy Pods Resources */ = {
295 | isa = PBXShellScriptBuildPhase;
296 | buildActionMask = 2147483647;
297 | files = (
298 | );
299 | inputPaths = (
300 | );
301 | name = "[CP] Copy Pods Resources";
302 | outputPaths = (
303 | );
304 | runOnlyForDeploymentPostprocessing = 0;
305 | shellPath = /bin/sh;
306 | shellScript = "\"${SRCROOT}/Pods/Target Support Files/Pods-Plugin/Pods-Plugin-resources.sh\"\n";
307 | showEnvVarsInLog = 0;
308 | };
309 | CCA81D3B7E26D0D727D24C84 /* [CP] Embed Pods Frameworks */ = {
310 | isa = PBXShellScriptBuildPhase;
311 | buildActionMask = 2147483647;
312 | files = (
313 | );
314 | inputPaths = (
315 | "${SRCROOT}/Pods/Target Support Files/Pods-PluginTests/Pods-PluginTests-frameworks.sh",
316 | "${BUILT_PRODUCTS_DIR}/Capacitor/Capacitor.framework",
317 | "${BUILT_PRODUCTS_DIR}/CapacitorCordova/Cordova.framework",
318 | "${BUILT_PRODUCTS_DIR}/GCDWebServer/GCDWebServer.framework",
319 | );
320 | name = "[CP] Embed Pods Frameworks";
321 | outputPaths = (
322 | "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/Capacitor.framework",
323 | "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/Cordova.framework",
324 | "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/GCDWebServer.framework",
325 | );
326 | runOnlyForDeploymentPostprocessing = 0;
327 | shellPath = /bin/sh;
328 | shellScript = "\"${SRCROOT}/Pods/Target Support Files/Pods-PluginTests/Pods-PluginTests-frameworks.sh\"\n";
329 | showEnvVarsInLog = 0;
330 | };
331 | /* End PBXShellScriptBuildPhase section */
332 |
333 | /* Begin PBXSourcesBuildPhase section */
334 | 50ADFF83201F53D600D50D53 /* Sources */ = {
335 | isa = PBXSourcesBuildPhase;
336 | buildActionMask = 2147483647;
337 | files = (
338 | 50E1A94820377CB70090CE1A /* Plugin.swift in Sources */,
339 | 50ADFFA82020EE4F00D50D53 /* Plugin.m in Sources */,
340 | );
341 | runOnlyForDeploymentPostprocessing = 0;
342 | };
343 | 50ADFF8D201F53D600D50D53 /* Sources */ = {
344 | isa = PBXSourcesBuildPhase;
345 | buildActionMask = 2147483647;
346 | files = (
347 | 50ADFF97201F53D600D50D53 /* PluginTests.swift in Sources */,
348 | );
349 | runOnlyForDeploymentPostprocessing = 0;
350 | };
351 | /* End PBXSourcesBuildPhase section */
352 |
353 | /* Begin PBXTargetDependency section */
354 | 50ADFF94201F53D600D50D53 /* PBXTargetDependency */ = {
355 | isa = PBXTargetDependency;
356 | target = 50ADFF87201F53D600D50D53 /* Plugin */;
357 | targetProxy = 50ADFF93201F53D600D50D53 /* PBXContainerItemProxy */;
358 | };
359 | /* End PBXTargetDependency section */
360 |
361 | /* Begin XCBuildConfiguration section */
362 | 50ADFF9A201F53D600D50D53 /* Debug */ = {
363 | isa = XCBuildConfiguration;
364 | buildSettings = {
365 | ALWAYS_SEARCH_USER_PATHS = NO;
366 | CLANG_ANALYZER_NONNULL = YES;
367 | CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE;
368 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++14";
369 | CLANG_CXX_LIBRARY = "libc++";
370 | CLANG_ENABLE_MODULES = YES;
371 | CLANG_ENABLE_OBJC_ARC = YES;
372 | CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;
373 | CLANG_WARN_BOOL_CONVERSION = YES;
374 | CLANG_WARN_COMMA = YES;
375 | CLANG_WARN_CONSTANT_CONVERSION = YES;
376 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
377 | CLANG_WARN_DOCUMENTATION_COMMENTS = YES;
378 | CLANG_WARN_EMPTY_BODY = YES;
379 | CLANG_WARN_ENUM_CONVERSION = YES;
380 | CLANG_WARN_INFINITE_RECURSION = YES;
381 | CLANG_WARN_INT_CONVERSION = YES;
382 | CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;
383 | CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
384 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
385 | CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
386 | CLANG_WARN_STRICT_PROTOTYPES = YES;
387 | CLANG_WARN_SUSPICIOUS_MOVE = YES;
388 | CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE;
389 | CLANG_WARN_UNREACHABLE_CODE = YES;
390 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
391 | CODE_SIGN_IDENTITY = "iPhone Developer";
392 | COPY_PHASE_STRIP = NO;
393 | CURRENT_PROJECT_VERSION = 1;
394 | DEBUG_INFORMATION_FORMAT = dwarf;
395 | ENABLE_STRICT_OBJC_MSGSEND = YES;
396 | ENABLE_TESTABILITY = YES;
397 | GCC_C_LANGUAGE_STANDARD = gnu11;
398 | GCC_DYNAMIC_NO_PIC = NO;
399 | GCC_NO_COMMON_BLOCKS = YES;
400 | GCC_OPTIMIZATION_LEVEL = 0;
401 | GCC_PREPROCESSOR_DEFINITIONS = (
402 | "DEBUG=1",
403 | "$(inherited)",
404 | );
405 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
406 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
407 | GCC_WARN_UNDECLARED_SELECTOR = YES;
408 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
409 | GCC_WARN_UNUSED_FUNCTION = YES;
410 | GCC_WARN_UNUSED_VARIABLE = YES;
411 | IPHONEOS_DEPLOYMENT_TARGET = 13.0;
412 | MTL_ENABLE_DEBUG_INFO = YES;
413 | ONLY_ACTIVE_ARCH = YES;
414 | SDKROOT = iphoneos;
415 | SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG;
416 | SWIFT_OPTIMIZATION_LEVEL = "-Onone";
417 | VERSIONING_SYSTEM = "apple-generic";
418 | VERSION_INFO_PREFIX = "";
419 | };
420 | name = Debug;
421 | };
422 | 50ADFF9B201F53D600D50D53 /* Release */ = {
423 | isa = XCBuildConfiguration;
424 | buildSettings = {
425 | ALWAYS_SEARCH_USER_PATHS = NO;
426 | CLANG_ANALYZER_NONNULL = YES;
427 | CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE;
428 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++14";
429 | CLANG_CXX_LIBRARY = "libc++";
430 | CLANG_ENABLE_MODULES = YES;
431 | CLANG_ENABLE_OBJC_ARC = YES;
432 | CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;
433 | CLANG_WARN_BOOL_CONVERSION = YES;
434 | CLANG_WARN_COMMA = YES;
435 | CLANG_WARN_CONSTANT_CONVERSION = YES;
436 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
437 | CLANG_WARN_DOCUMENTATION_COMMENTS = YES;
438 | CLANG_WARN_EMPTY_BODY = YES;
439 | CLANG_WARN_ENUM_CONVERSION = YES;
440 | CLANG_WARN_INFINITE_RECURSION = YES;
441 | CLANG_WARN_INT_CONVERSION = YES;
442 | CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;
443 | CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
444 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
445 | CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
446 | CLANG_WARN_STRICT_PROTOTYPES = YES;
447 | CLANG_WARN_SUSPICIOUS_MOVE = YES;
448 | CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE;
449 | CLANG_WARN_UNREACHABLE_CODE = YES;
450 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
451 | CODE_SIGN_IDENTITY = "iPhone Developer";
452 | COPY_PHASE_STRIP = NO;
453 | CURRENT_PROJECT_VERSION = 1;
454 | DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
455 | ENABLE_NS_ASSERTIONS = NO;
456 | ENABLE_STRICT_OBJC_MSGSEND = YES;
457 | GCC_C_LANGUAGE_STANDARD = gnu11;
458 | GCC_NO_COMMON_BLOCKS = YES;
459 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
460 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
461 | GCC_WARN_UNDECLARED_SELECTOR = YES;
462 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
463 | GCC_WARN_UNUSED_FUNCTION = YES;
464 | GCC_WARN_UNUSED_VARIABLE = YES;
465 | IPHONEOS_DEPLOYMENT_TARGET = 13.0;
466 | MTL_ENABLE_DEBUG_INFO = NO;
467 | SDKROOT = iphoneos;
468 | SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule";
469 | VALIDATE_PRODUCT = YES;
470 | VERSIONING_SYSTEM = "apple-generic";
471 | VERSION_INFO_PREFIX = "";
472 | };
473 | name = Release;
474 | };
475 | 50ADFF9D201F53D600D50D53 /* Debug */ = {
476 | isa = XCBuildConfiguration;
477 | baseConfigurationReference = 5E23F77F099397094342571A /* Pods-Plugin.debug.xcconfig */;
478 | buildSettings = {
479 | CLANG_ENABLE_MODULES = YES;
480 | CODE_SIGN_IDENTITY = "";
481 | CODE_SIGN_STYLE = Automatic;
482 | DEFINES_MODULE = YES;
483 | DYLIB_COMPATIBILITY_VERSION = 1;
484 | DYLIB_CURRENT_VERSION = 1;
485 | DYLIB_INSTALL_NAME_BASE = "@rpath";
486 | INFOPLIST_FILE = Plugin/Info.plist;
487 | INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks";
488 | IPHONEOS_DEPLOYMENT_TARGET = 13.0;
489 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks $(FRAMEWORK_SEARCH_PATHS)\n$(FRAMEWORK_SEARCH_PATHS)\n$(FRAMEWORK_SEARCH_PATHS)";
490 | ONLY_ACTIVE_ARCH = YES;
491 | PRODUCT_BUNDLE_IDENTIFIER = com.getcapacitor.Plugin;
492 | PRODUCT_NAME = "$(TARGET_NAME:c99extidentifier)";
493 | SKIP_INSTALL = YES;
494 | SWIFT_OPTIMIZATION_LEVEL = "-Onone";
495 | SWIFT_VERSION = 4.0;
496 | TARGETED_DEVICE_FAMILY = "1,2";
497 | };
498 | name = Debug;
499 | };
500 | 50ADFF9E201F53D600D50D53 /* Release */ = {
501 | isa = XCBuildConfiguration;
502 | baseConfigurationReference = 91781294A431A2A7CC6EB714 /* Pods-Plugin.release.xcconfig */;
503 | buildSettings = {
504 | CLANG_ENABLE_MODULES = YES;
505 | CODE_SIGN_IDENTITY = "";
506 | CODE_SIGN_STYLE = Automatic;
507 | DEFINES_MODULE = YES;
508 | DYLIB_COMPATIBILITY_VERSION = 1;
509 | DYLIB_CURRENT_VERSION = 1;
510 | DYLIB_INSTALL_NAME_BASE = "@rpath";
511 | INFOPLIST_FILE = Plugin/Info.plist;
512 | INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks";
513 | IPHONEOS_DEPLOYMENT_TARGET = 11.0;
514 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks $(FRAMEWORK_SEARCH_PATHS)";
515 | ONLY_ACTIVE_ARCH = NO;
516 | PRODUCT_BUNDLE_IDENTIFIER = com.getcapacitor.Plugin;
517 | PRODUCT_NAME = "$(TARGET_NAME:c99extidentifier)";
518 | SKIP_INSTALL = YES;
519 | SWIFT_VERSION = 4.0;
520 | TARGETED_DEVICE_FAMILY = "1,2";
521 | };
522 | name = Release;
523 | };
524 | 50ADFFA0201F53D600D50D53 /* Debug */ = {
525 | isa = XCBuildConfiguration;
526 | baseConfigurationReference = 96ED1B6440D6672E406C8D19 /* Pods-PluginTests.debug.xcconfig */;
527 | buildSettings = {
528 | ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES;
529 | CODE_SIGN_STYLE = Automatic;
530 | INFOPLIST_FILE = PluginTests/Info.plist;
531 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
532 | PRODUCT_BUNDLE_IDENTIFIER = com.getcapacitor.PluginTests;
533 | PRODUCT_NAME = "$(TARGET_NAME)";
534 | SWIFT_VERSION = 4.0;
535 | TARGETED_DEVICE_FAMILY = "1,2";
536 | };
537 | name = Debug;
538 | };
539 | 50ADFFA1201F53D600D50D53 /* Release */ = {
540 | isa = XCBuildConfiguration;
541 | baseConfigurationReference = F65BB2953ECE002E1EF3E424 /* Pods-PluginTests.release.xcconfig */;
542 | buildSettings = {
543 | ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES;
544 | CODE_SIGN_STYLE = Automatic;
545 | INFOPLIST_FILE = PluginTests/Info.plist;
546 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
547 | PRODUCT_BUNDLE_IDENTIFIER = com.getcapacitor.PluginTests;
548 | PRODUCT_NAME = "$(TARGET_NAME)";
549 | SWIFT_VERSION = 4.0;
550 | TARGETED_DEVICE_FAMILY = "1,2";
551 | };
552 | name = Release;
553 | };
554 | /* End XCBuildConfiguration section */
555 |
556 | /* Begin XCConfigurationList section */
557 | 50ADFF82201F53D600D50D53 /* Build configuration list for PBXProject "Plugin" */ = {
558 | isa = XCConfigurationList;
559 | buildConfigurations = (
560 | 50ADFF9A201F53D600D50D53 /* Debug */,
561 | 50ADFF9B201F53D600D50D53 /* Release */,
562 | );
563 | defaultConfigurationIsVisible = 0;
564 | defaultConfigurationName = Release;
565 | };
566 | 50ADFF9C201F53D600D50D53 /* Build configuration list for PBXNativeTarget "Plugin" */ = {
567 | isa = XCConfigurationList;
568 | buildConfigurations = (
569 | 50ADFF9D201F53D600D50D53 /* Debug */,
570 | 50ADFF9E201F53D600D50D53 /* Release */,
571 | );
572 | defaultConfigurationIsVisible = 0;
573 | defaultConfigurationName = Release;
574 | };
575 | 50ADFF9F201F53D600D50D53 /* Build configuration list for PBXNativeTarget "PluginTests" */ = {
576 | isa = XCConfigurationList;
577 | buildConfigurations = (
578 | 50ADFFA0201F53D600D50D53 /* Debug */,
579 | 50ADFFA1201F53D600D50D53 /* Release */,
580 | );
581 | defaultConfigurationIsVisible = 0;
582 | defaultConfigurationName = Release;
583 | };
584 | /* End XCConfigurationList section */
585 | };
586 | rootObject = 50ADFF7F201F53D600D50D53 /* Project object */;
587 | }
588 |
--------------------------------------------------------------------------------