Smart WebView v7.0 empowers developers to build even more dynamic and feature-rich hybrid applications. This release focuses on extensibility with a new plugin architecture, alongside improvements to core functionalities. Users will benefit from enhanced performance, streamlined file handling, and other capabilities. The update reflects a commitment to providing a versatile and efficient platform for app development.
Changelog
Major Features and Enhancements:
- Plugin Architecture:
- Introduced a new, self-contained plugin architecture enabling developers to extend Smart WebView's functionality without modifying core files.
- Plugins can register themselves and handle their own lifecycles, permissions, and activity results.
- File Uploads and Camera Access:
- Refactored file upload and camera access logic into a dedicated
FileProcessing
class for improved code organization. - Dynamically handles file MIME types based on HTML input
accept
attributes. - Enhanced error handling and user feedback during file selection and camera operations.
- Refactored file upload and camera access logic into a dedicated
- Firebase Cloud Messaging (FCM):
- Updated FCM implementation to use the latest Firebase SDK.
- Resolved issues with token retrieval and
onNewToken()
not being called.
- Google Analytics (gtag.js):
- Dynamically injects the gtag.js script after page load to prevent interference with page loading and improve performance.
- Permissions:
- Refactored permission handling to request permissions on demand only when needed.
- Added support for granular media permissions and the
POST_NOTIFICATIONS
permission for Android 13 and above. - Implemented rationale dialogs for explaining permission requests to the user.
- Security:
- Enforced HTTPS by default and optional to disable certificate verification with alert toast in debug mode.
- Removed the deprecated
WRITE_EXTERNAL_STORAGE
permission, relying on Scoped Storage for file access.
Other Improvements and Updates:
- Modernized Codebase:
- Updated project to target Android 14 (API level 35) and use the latest AndroidX libraries.
- Adopted Java 17 source and target compatibility.
- Refactored code for better modularity, readability, and maintainability.
- Dependency Management:
- Updated all dependencies to their latest versions.
- Removed deprecated Firebase dependencies.
- Bug Fixes:
- Fixed an issue where the welcome screen would not disappear in certain scenarios.
- Resolved several issues related to file uploads and camera access.
- Addressed potential
NullPointerExceptions
related to context handling inFirebase
.
- Code Cleanup:
- Removed unused code, variables, and functions.
- Improved comments and documentation.
API Changes:
PluginInterface
: Introduced a newPluginInterface
with methods for plugin initialization, event handling, and simplified interaction with the WebView.PluginManager
: Added aPluginManager
class to handle plugin registration, lifecycle events, and communication with plugins.FileProcessing
: Added aFileProcessing
class to encapsulate file upload and camera access logic.Functions
: Removed several methods related to printing, cookies, orientation, file access, permissions, ratings, FCM, and device info. These are either handled elsewhere or no longer needed.SmartWebView
: Removed or modified several variables related to configuration, user agent, and permissions, and added variables related to debugging and Google Tag. Also, removedASWP_OFFLINE
logic.MainActivity
: Refactored to use thePluginManager
andFileProcessing
classes. ModifiedonShowFileChooser()
,Callback
class,shouldOverrideUrlLoading()
,onPageFinished()
,onRequestPermissionsResult()
andonActivityResult()
. Removed unused methods and variables related to permissions and other features now handled by plugins or other classes.Firebase
: Refactored to improve context handling, remove unnecessary constructor, and simplify notification handling logic.
New Files:
MetaPull.java
: Pulls device and SWV release details.FileProcessing.java
: Handles file upload and camera access.PluginManager.java
: Manages the plugin architecture.PluginInterface.java
: Defines the interface for plugins.
Testing:
- Thoroughly test all features on a variety of devices and Android versions (especially API levels 23, 24, 29 and above) to ensure compatibility and proper functionality.
Migration from v6.x:
- Developers who have created custom features (now plugins) for Smart WebView v6.x can update their scripts to plugins to conform to the new
PluginInterface
and register them using thePluginManager
. - Any code that directly interacted with the removed methods or variables in
MainActivity
,Functions
, orSmartWebView
will need to be updated to use the new plugin architecture or the appropriate classes (e.g.,FileProcessing
andPluginManager
).