@capacitor/android
Advanced tools
Comparing version 7.0.0-alpha.1 to 7.0.0-alpha.2
@@ -145,5 +145,3 @@ | ||
// TODO: export as Cap function | ||
const isRelativeOrProxyUrl = (url) => !url || | ||
!(url.startsWith('http:') || url.startsWith('https:')) || | ||
url.indexOf(CAPACITOR_HTTP_INTERCEPTOR) > -1; | ||
const isRelativeOrProxyUrl = (url) => !url || !(url.startsWith('http:') || url.startsWith('https:')) || url.indexOf(CAPACITOR_HTTP_INTERCEPTOR) > -1; | ||
// TODO: export as Cap function | ||
@@ -178,7 +176,6 @@ const createProxyUrl = (url, win) => { | ||
else if (filePath.startsWith('file://')) { | ||
return (webviewServerUrl + filePath.replace('file://', '/_capacitor_file_')); | ||
return webviewServerUrl + filePath.replace('file://', '/_capacitor_file_'); | ||
} | ||
else if (filePath.startsWith('content://')) { | ||
return (webviewServerUrl + | ||
filePath.replace('content:/', '/_capacitor_content_')); | ||
return webviewServerUrl + filePath.replace('content:/', '/_capacitor_content_'); | ||
} | ||
@@ -294,5 +291,2 @@ } | ||
} | ||
// deprecated in v3, remove from v4 | ||
cap.platform = cap.getPlatform(); | ||
cap.isNative = cap.isNativePlatform(); | ||
win.Capacitor = cap; | ||
@@ -327,10 +321,3 @@ }; | ||
const initLogger = (win, cap) => { | ||
const BRIDGED_CONSOLE_METHODS = [ | ||
'debug', | ||
'error', | ||
'info', | ||
'log', | ||
'trace', | ||
'warn', | ||
]; | ||
const BRIDGED_CONSOLE_METHODS = ['debug', 'error', 'info', 'log', 'trace', 'warn']; | ||
const createLogFromNative = (c) => (result) => { | ||
@@ -342,9 +329,3 @@ if (isFullConsole(c)) { | ||
: 'font-style: italic; font-weight: lighter; color: red'; | ||
c.groupCollapsed('%cresult %c' + | ||
result.pluginId + | ||
'.' + | ||
result.methodName + | ||
' (#' + | ||
result.callbackId + | ||
')', tagStyles, 'font-style: italic; font-weight: bold; color: #444'); | ||
c.groupCollapsed('%cresult %c' + result.pluginId + '.' + result.methodName + ' (#' + result.callbackId + ')', tagStyles, 'font-style: italic; font-weight: bold; color: #444'); | ||
if (result.success === false) { | ||
@@ -369,9 +350,3 @@ c.error(result.error); | ||
if (isFullConsole(c)) { | ||
c.groupCollapsed('%cnative %c' + | ||
call.pluginId + | ||
'.' + | ||
call.methodName + | ||
' (#' + | ||
call.callbackId + | ||
')', 'font-weight: lighter; color: gray', 'font-weight: bold; color: #000'); | ||
c.groupCollapsed('%cnative %c' + call.pluginId + '.' + call.methodName + ' (#' + call.callbackId + ')', 'font-weight: lighter; color: gray', 'font-weight: bold; color: #000'); | ||
c.dir(call); | ||
@@ -388,5 +363,3 @@ c.groupEnd(); | ||
} | ||
return (typeof c.groupCollapsed === 'function' || | ||
typeof c.groupEnd === 'function' || | ||
typeof c.dir === 'function'); | ||
return typeof c.groupCollapsed === 'function' || typeof c.groupEnd === 'function' || typeof c.dir === 'function'; | ||
}; | ||
@@ -450,5 +423,3 @@ const serializeConsoleMessage = (msg) => { | ||
const domainSection = val.toLowerCase().split('domain=')[1]; | ||
const domain = cookiePairs.length > 1 && | ||
domainSection != null && | ||
domainSection.length > 0 | ||
const domain = cookiePairs.length > 1 && domainSection != null && domainSection.length > 0 | ||
? domainSection.split(';')[0].trim() | ||
@@ -538,4 +509,3 @@ : ''; | ||
}); | ||
const contentType = nativeResponse.headers['Content-Type'] || | ||
nativeResponse.headers['content-type']; | ||
const contentType = nativeResponse.headers['Content-Type'] || nativeResponse.headers['content-type']; | ||
let data = (contentType === null || contentType === void 0 ? void 0 : contentType.startsWith('application/json')) | ||
@@ -582,4 +552,3 @@ ? JSON.stringify(nativeResponse.data) | ||
const prototype = win.CapacitorWebXMLHttpRequest.prototype; | ||
const isProgressEventAvailable = () => typeof ProgressEvent !== 'undefined' && | ||
ProgressEvent.prototype instanceof Event; | ||
const isProgressEventAvailable = () => typeof ProgressEvent !== 'undefined' && ProgressEvent.prototype instanceof Event; | ||
// XHR patch abort | ||
@@ -665,5 +634,3 @@ prototype.abort = function () { | ||
convertBody(body).then(({ data, type, headers }) => { | ||
const otherHeaders = this._headers != null && Object.keys(this._headers).length > 0 | ||
? this._headers | ||
: undefined; | ||
const otherHeaders = this._headers != null && Object.keys(this._headers).length > 0 ? this._headers : undefined; | ||
// intercept request & pass to the bridge | ||
@@ -692,4 +659,3 @@ cap | ||
this.status = nativeResponse.status; | ||
if (this.responseType === '' || | ||
this.responseType === 'text') { | ||
if (this.responseType === '' || this.responseType === 'text') { | ||
this.response = | ||
@@ -703,4 +669,3 @@ typeof nativeResponse.data !== 'string' | ||
} | ||
this.responseText = ((_a = (nativeResponse.headers['Content-Type'] || | ||
nativeResponse.headers['content-type'])) === null || _a === void 0 ? void 0 : _a.startsWith('application/json')) | ||
this.responseText = ((_a = (nativeResponse.headers['Content-Type'] || nativeResponse.headers['content-type'])) === null || _a === void 0 ? void 0 : _a.startsWith('application/json')) | ||
? JSON.stringify(nativeResponse.data) | ||
@@ -821,3 +786,3 @@ : nativeResponse.data; | ||
cap.logFromNative = createLogFromNative(win.console); | ||
cap.handleError = err => win.console.error(err); | ||
cap.handleError = (err) => win.console.error(err); | ||
win.Capacitor = cap; | ||
@@ -831,3 +796,3 @@ }; | ||
cap.getServerUrl = () => webviewServerUrl; | ||
cap.convertFileSrc = filePath => convertFileSrcServerUrl(webviewServerUrl, filePath); | ||
cap.convertFileSrc = (filePath) => convertFileSrcServerUrl(webviewServerUrl, filePath); | ||
// Counter of callback ids, randomized to avoid | ||
@@ -841,3 +806,3 @@ // any issues during reloads if a call comes back with | ||
cap.getPlatform = getPlatform; | ||
cap.isPluginAvailable = name => Object.prototype.hasOwnProperty.call(cap.Plugins, name); | ||
cap.isPluginAvailable = (name) => Object.prototype.hasOwnProperty.call(cap.Plugins, name); | ||
cap.isNativePlatform = isNativePlatform; | ||
@@ -847,3 +812,3 @@ // create the postToNative() fn if needed | ||
// android platform | ||
postToNative = data => { | ||
postToNative = (data) => { | ||
var _a; | ||
@@ -860,3 +825,3 @@ try { | ||
// ios platform | ||
postToNative = data => { | ||
postToNative = (data) => { | ||
var _a; | ||
@@ -906,4 +871,3 @@ try { | ||
if (storedCallback && | ||
(typeof storedCallback.callback === 'function' || | ||
typeof storedCallback.resolve === 'function')) { | ||
(typeof storedCallback.callback === 'function' || typeof storedCallback.resolve === 'function')) { | ||
// store the call for later lookup | ||
@@ -943,3 +907,3 @@ callbackId = String(++callbackIdCount); | ||
*/ | ||
cap.fromNative = result => { | ||
cap.fromNative = (result) => { | ||
returnResult(result); | ||
@@ -946,0 +910,0 @@ }; |
{ | ||
"name": "@capacitor/android", | ||
"version": "7.0.0-alpha.1", | ||
"version": "7.0.0-alpha.2", | ||
"description": "Capacitor: Cross-platform apps with JavaScript and the web", | ||
@@ -26,3 +26,3 @@ "homepage": "https://capacitorjs.com", | ||
"peerDependencies": { | ||
"@capacitor/core": "^7.0.0-alpha.1" | ||
"@capacitor/core": "^7.0.0-alpha.2" | ||
}, | ||
@@ -29,0 +29,0 @@ "publishConfig": { |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
425507
981