nativescript-oauth2 icon indicating copy to clipboard operation
nativescript-oauth2 copied to clipboard

Expose Webview to allow custom config/handlers

Open airandfingers opened this issue 5 years ago • 3 comments

Hi, I see that you closed #33 citing that "Providing a custom UI goes against the Oauth2 spec", but there are other reasons that exposing the Webview would be very useful:

  • Set Android WebView settings:
    • webview.android.setWebChromeClient(new android.webkit.WebChromeClient());
    • android.getSettings().setBuiltInZoomControls(false);
    • android.getSettings().setUserAgentString('CUSTOM_UA_STRING');
  • Set custom loadStartedEvent and loadFinishedEvent handlers

Are there other ways to accomplish the tasks above without accessing the Webview?

airandfingers avatar Apr 22 '19 21:04 airandfingers

Here's how I messily satisfied this need in the original nativescript-oauth plugin: https://github.com/alexziskind1/nativescript-oauth/pull/58

airandfingers avatar May 23 '19 22:05 airandfingers

The main one for me is to be able to set the navigation button back text to the same title as the previous page.

https://github.com/alexziskind1/nativescript-oauth2/blob/accee37c3d387f7e03b83b20d2350251599ff042/src/tns-oauth-login-webview-controller.ts#L101

@alexziskind1 Is this something you would be happy to PR if I made options configurable?

eliottrobson avatar Jan 18 '20 13:01 eliottrobson

May we also allow config to add an activity indicator while the Webview is still loading the content and hide on pageLoadFinished?

var myloadingObject = { isLoading: true };
var indicator = new loading_indicator_1.ActivityIndicator();
indicator.bind({
   sourceProperty: "isLoading",
   targetProperty: "busy"
}, myloadingObject);
    
var stack = new stack_layout_1.StackLayout();
var grid = new grid_layout_1.GridLayout();
grid.addChild(webView)
stack.addChild(indicator);
stack.addChild(grid);

maplepam avatar Jun 10 '20 11:06 maplepam