nativescript-inappbrowser
Advanced tools
Comparing version 3.0.0 to 3.0.1
@@ -5,3 +5,2 @@ var Uri = android.net.Uri; | ||
var Intent = android.content.Intent; | ||
var Color = android.graphics.Color; | ||
var BitmapFactory = android.graphics.BitmapFactory; | ||
@@ -15,2 +14,3 @@ var Browser = android.provider.Browser; | ||
import { getDrawableId, toolbarIsLight, CustomTabsIntent, DISMISSED_EVENT, ARROW_BACK_WHITE, ARROW_BACK_BLACK, getPreferredPackages, openAuthSessionPolyfillAsync, closeAuthSessionPolyfillAsync, } from './utils.android'; | ||
import { parseColor } from './utils.common'; | ||
let InAppBrowserModuleInstance; | ||
@@ -45,7 +45,10 @@ function setup() { | ||
var builder = new CustomTabsIntent.Builder(); | ||
if (inAppBrowserOptions[InAppBrowserModule.KEY_TOOLBAR_COLOR]) { | ||
var colorString = inAppBrowserOptions[InAppBrowserModule.KEY_TOOLBAR_COLOR]; | ||
var colorString = inAppBrowserOptions[InAppBrowserModule.KEY_TOOLBAR_COLOR]; | ||
if (colorString) { | ||
try { | ||
builder.setToolbarColor(Color.parseColor(colorString)); | ||
this.isLightTheme = toolbarIsLight(colorString); | ||
var color = parseColor(colorString); | ||
if (color) { | ||
builder.setToolbarColor(color.android); | ||
this.isLightTheme = toolbarIsLight(color.android); | ||
} | ||
} | ||
@@ -56,6 +59,9 @@ catch (error) { | ||
} | ||
if (inAppBrowserOptions[InAppBrowserModule.KEY_SECONDARY_TOOLBAR_COLOR]) { | ||
var colorString = inAppBrowserOptions[InAppBrowserModule.KEY_SECONDARY_TOOLBAR_COLOR]; | ||
colorString = inAppBrowserOptions[InAppBrowserModule.KEY_SECONDARY_TOOLBAR_COLOR]; | ||
if (colorString) { | ||
try { | ||
builder.setSecondaryToolbarColor(Color.parseColor(colorString)); | ||
var color = parseColor(colorString); | ||
if (color) { | ||
builder.setSecondaryToolbarColor(color.android); | ||
} | ||
} | ||
@@ -62,0 +68,0 @@ catch (error) { |
@@ -0,1 +1,2 @@ | ||
import { Color } from "@nativescript/core"; | ||
export interface RedirectEvent { | ||
@@ -14,4 +15,4 @@ url: 'string'; | ||
dismissButtonStyle?: 'done' | 'close' | 'cancel'; | ||
preferredBarTintColor?: string; | ||
preferredControlTintColor?: string; | ||
preferredBarTintColor?: string | Color; | ||
preferredControlTintColor?: string | Color; | ||
readerMode?: boolean; | ||
@@ -33,4 +34,4 @@ animated?: boolean; | ||
showTitle?: boolean; | ||
toolbarColor?: string; | ||
secondaryToolbarColor?: string; | ||
toolbarColor?: string | Color; | ||
secondaryToolbarColor?: string | Color; | ||
enableUrlBarHiding?: boolean; | ||
@@ -37,0 +38,0 @@ enableDefaultShare?: boolean; |
@@ -1,2 +0,3 @@ | ||
import { Color, Utils } from '@nativescript/core'; | ||
import { Utils } from '@nativescript/core'; | ||
import { parseColor } from './utils.common'; | ||
import { getDefaultOptions, BROWSER_TYPES, DISMISS_BUTTON_STYLES, InAppBrowserErrorMessage, } from './InAppBrowser.common'; | ||
@@ -68,6 +69,12 @@ import { getTransitionStyle, getPresentationStyle, setModalInPresentation, dismissWithoutAnimation, InAppBrowserOpenAuthErrorMessage, } from './utils.ios'; | ||
if (inAppBrowserOptions.preferredBarTintColor) { | ||
_this.safariVC.preferredBarTintColor = new Color(inAppBrowserOptions.preferredBarTintColor).ios; | ||
var color = parseColor(inAppBrowserOptions.preferredBarTintColor); | ||
if (color) { | ||
_this.safariVC.preferredBarTintColor = color.ios; | ||
} | ||
} | ||
if (inAppBrowserOptions.preferredControlTintColor) { | ||
_this.safariVC.preferredControlTintColor = new Color(inAppBrowserOptions.preferredControlTintColor).ios; | ||
var color = parseColor(inAppBrowserOptions.preferredBarTintColor); | ||
if (color) { | ||
_this.safariVC.preferredControlTintColor = color.ios; | ||
} | ||
} | ||
@@ -74,0 +81,0 @@ } |
{ | ||
"name": "nativescript-inappbrowser", | ||
"version": "3.0.0", | ||
"version": "3.0.1", | ||
"description": "InAppBrowser for NativeScript", | ||
@@ -5,0 +5,0 @@ "main": "InAppBrowser", |
@@ -24,3 +24,3 @@ import Activity = android.app.Activity; | ||
export declare function getPreferredPackages(context: Context): List<ResolveInfo>; | ||
export declare function toolbarIsLight(themeColor: string): boolean; | ||
export declare function toolbarIsLight(themeColor: number): boolean; | ||
export declare function getDefaultBrowser(context: Context): string; |
var Intent = android.content.Intent; | ||
var NfcAdapter = android.nfc.NfcAdapter; | ||
var Color = android.graphics.Color; | ||
var Arrays = java.util.Arrays; | ||
@@ -99,3 +98,3 @@ import { Utils, Application, AndroidApplication } from '@nativescript/core'; | ||
export function toolbarIsLight(themeColor) { | ||
return ColorUtils.calculateLuminance(Color.parseColor(themeColor)) > 0.5; | ||
return ColorUtils.calculateLuminance(themeColor) > 0.5; | ||
} | ||
@@ -102,0 +101,0 @@ export function getDefaultBrowser(context) { |
81194
28
941