-
Notifications
You must be signed in to change notification settings - Fork 733
Set default alpine parameter to true in methods #1784
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Closed
Closed
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,17 @@ | ||
| { | ||
| "name": "com.foxdebug.acode.rk.customtabs", | ||
| "version": "1.0.0", | ||
| "description": "Custom tabs api", | ||
| "cordova": { | ||
| "id": "com.foxdebug.acode.rk.customtabs", | ||
| "platforms": [ | ||
| "android" | ||
| ] | ||
| }, | ||
| "keywords": [ | ||
| "ecosystem:cordova", | ||
| "cordova-android" | ||
| ], | ||
| "author": "@RohitKushvaha01", | ||
| "license": "MIT" | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,36 @@ | ||
| <?xml version="1.0" encoding="UTF-8"?> | ||
| <plugin xmlns="http://apache.org/cordova/ns/plugins/1.0" xmlns:android="http://schemas.android.com/apk/res/android" id="com.foxdebug.acode.rk.customtabs" version="1.0.0"> | ||
| <name>Custom Tabs</name> | ||
|
|
||
|
|
||
| <js-module name="CustomTabs" src="www/customtabs.js"> | ||
| <clobbers target="CustomTabs"/> | ||
| </js-module> | ||
|
|
||
|
|
||
| <platform name="android"> | ||
|
|
||
| <config-file parent="/*" target="res/xml/config.xml"> | ||
| <feature name="CustomTabs"> | ||
| <param name="android-package" value="com.foxdebug.acode.rk.customtabs.CustomTabsPlugin" /> | ||
| </feature> | ||
|
|
||
| </config-file> | ||
|
|
||
| <config-file parent="/*" target="AndroidManifest.xml"> | ||
| <queries> | ||
| <intent> | ||
| <action android:name="android.support.customtabs.action.CustomTabsService" /> | ||
| </intent> | ||
| </queries> | ||
| </config-file> | ||
|
|
||
| <framework src="androidx.browser:browser:1.8.0"/> | ||
|
|
||
| <source-file | ||
| src="src/CustomTabsPlugin.java" | ||
| target-dir="src/com/foxdebug/acode/rk/customtabs"/> | ||
|
|
||
|
|
||
| </platform> | ||
| </plugin> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,80 @@ | ||
| package com.foxdebug.acode.rk.customtabs; | ||
|
|
||
| import android.content.ActivityNotFoundException; | ||
| import android.content.Intent; | ||
| import android.net.Uri; | ||
| import android.graphics.Color; | ||
|
|
||
| import androidx.browser.customtabs.CustomTabsIntent; | ||
|
|
||
| import org.apache.cordova.CallbackContext; | ||
| import org.apache.cordova.CordovaPlugin; | ||
| import org.json.JSONArray; | ||
| import org.json.JSONObject; | ||
|
|
||
| public class CustomTabsPlugin extends CordovaPlugin { | ||
|
|
||
| @Override | ||
| public boolean execute( | ||
| String action, | ||
| JSONArray args, | ||
| CallbackContext callbackContext | ||
| ) { | ||
|
|
||
| if ("open".equals(action)) { | ||
| try { | ||
| final String url = args.getString(0); | ||
| final JSONObject options = args.optJSONObject(1) != null | ||
| ? args.optJSONObject(1) | ||
| : new JSONObject(); | ||
|
|
||
| cordova.getActivity().runOnUiThread(() -> { | ||
| try { | ||
| openCustomTab(url, options); | ||
| callbackContext.success(); | ||
| } catch (Exception e) { | ||
| callbackContext.error(e.getMessage()); | ||
| } | ||
| }); | ||
|
|
||
| return true; | ||
|
|
||
| } catch (Exception e) { | ||
| callbackContext.error(e.getMessage()); | ||
| return true; | ||
| } | ||
| } | ||
|
|
||
| return false; | ||
| } | ||
|
|
||
| private void openCustomTab(String url, JSONObject options) { | ||
| CustomTabsIntent.Builder builder = new CustomTabsIntent.Builder(); | ||
|
|
||
| if (options.optBoolean("showTitle", true)) { | ||
| builder.setShowTitle(true); | ||
| } | ||
|
|
||
| String toolbarColor = options.optString("toolbarColor", null); | ||
| if (toolbarColor != null && !toolbarColor.isEmpty()) { | ||
| builder.setToolbarColor(Color.parseColor(toolbarColor)); | ||
| } | ||
|
|
||
| CustomTabsIntent customTabsIntent = builder.build(); | ||
| customTabsIntent.intent.setPackage("com.android.chrome"); | ||
|
|
||
| try { | ||
| customTabsIntent.launchUrl( | ||
| cordova.getActivity(), | ||
| Uri.parse(url) | ||
| ); | ||
| } catch (ActivityNotFoundException e) { | ||
| // Fallback to default browser | ||
| Intent fallback = new Intent( | ||
| Intent.ACTION_VIEW, | ||
| Uri.parse(url) | ||
| ); | ||
| cordova.getActivity().startActivity(fallback); | ||
| } | ||
| } | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,11 @@ | ||
| var exec = require('cordova/exec'); | ||
|
|
||
| exports.open = function (url, options, success, error) { | ||
| exec( | ||
| success, | ||
| error, | ||
| 'CustomTabs', | ||
| 'open', | ||
| [url, options || {}] | ||
| ); | ||
| }; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Changing the default value of
alpinetotruefor theexecutemethod introduces a critical regression. Several functions inTerminal.jsrely onexecuteto run commands on the host system for managing the environment.For example:
install()(line 232) uses it to extract the Alpine tarball. This must happen on the host, before the Alpine environment exists.stopAxs(),isAxsRunning(),backup(),restore(), anduninstall()also execute host-level commands.These calls will fail with
alpine=true. Since the call sites are not updated in this PR to explicitly passalpine: false, please revert this change for theexecutemethod to avoid breaking core functionality. The change forstart()is appropriate as it's used for interactive shells.