@fellow/capacitor-ios
Advanced tools
Comparing version
@@ -170,17 +170,2 @@ | ||
}; | ||
const safeStringify = (value) => { | ||
const seen = new Set(); | ||
return JSON.stringify(value, (_k, v) => { | ||
if (seen.has(v)) { | ||
if (v === null) | ||
return null; | ||
else | ||
return '...'; | ||
} | ||
if (typeof v === 'object') { | ||
seen.add(v); | ||
} | ||
return v; | ||
}); | ||
}; | ||
const initLogger = (win, cap) => { | ||
@@ -252,3 +237,3 @@ const BRIDGED_CONSOLE_METHODS = [ | ||
try { | ||
msg = safeStringify(msg); | ||
msg = JSON.stringify(msg); | ||
} | ||
@@ -263,20 +248,17 @@ catch (e) { | ||
const isIos = getPlatformId(win) === 'ios'; | ||
const originalConsole = Object.assign({}, win.console); | ||
if (win.console && isIos) { | ||
for (const logfn of BRIDGED_CONSOLE_METHODS) { | ||
win.console[logfn] = (...args) => { | ||
const msgs = [...args]; | ||
originalConsole[logfn](...msgs); | ||
try { | ||
Object.defineProperties(win.console, BRIDGED_CONSOLE_METHODS.reduce((props, method) => { | ||
const consoleMethod = win.console[method].bind(win.console); | ||
props[method] = { | ||
value: (...args) => { | ||
const msgs = [...args]; | ||
cap.toNative('Console', 'log', { | ||
level: logfn, | ||
level: method, | ||
message: msgs.map(serializeConsoleMessage).join(' '), | ||
}); | ||
} | ||
catch (e) { | ||
// error converting/posting console messages | ||
originalConsole.error(e); | ||
} | ||
return consoleMethod(...args); | ||
}, | ||
}; | ||
} | ||
return props; | ||
}, {})); | ||
} | ||
@@ -326,3 +308,3 @@ cap.logJs = (msg, level) => { | ||
try { | ||
win.androidBridge.postMessage(safeStringify(data)); | ||
win.androidBridge.postMessage(JSON.stringify(data)); | ||
} | ||
@@ -358,3 +340,3 @@ catch (e) { | ||
col: columnNo, | ||
errorObject: safeStringify(err), | ||
errorObject: JSON.stringify(err), | ||
}, | ||
@@ -509,2 +491,2 @@ }; | ||
}({})); | ||
})({}); |
{ | ||
"name": "@fellow/capacitor-ios", | ||
"version": "3.2.0-beta.1", | ||
"version": "3.5.1-beta.1", | ||
"description": "Capacitor: Cross-platform apps with JavaScript and the web", | ||
@@ -23,10 +23,8 @@ "homepage": "https://capacitorjs.com", | ||
"scripts": { | ||
"verify": "npm run xc:build:Capacitor && npm run xc:build:CapacitorCordova && npm run pod:lint:Capacitor && npm run pod:lint:CapacitorCordova", | ||
"verify": "npm run xc:build:Capacitor && npm run xc:build:CapacitorCordova", | ||
"xc:build:Capacitor": "cd Capacitor && xcodebuild -workspace Capacitor.xcworkspace -scheme Capacitor && cd ..", | ||
"xc:build:CapacitorCordova": "cd CapacitorCordova && xcodebuild && cd ..", | ||
"pod:lint:Capacitor": "pod lib lint --allow-warnings Capacitor.podspec", | ||
"pod:lint:CapacitorCordova": "pod lib lint --allow-warnings CapacitorCordova.podspec" | ||
"xc:build:CapacitorCordova": "cd CapacitorCordova && xcodebuild && cd .." | ||
}, | ||
"peerDependencies": { | ||
"@capacitor/core": "^3.2.0" | ||
"@capacitor/core": "^3.5.0" | ||
}, | ||
@@ -33,0 +31,0 @@ "publishConfig": { |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
246853
0.58%87
3.57%479
-3.62%