try to set size constraints, but firefox fails; show attachment size
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
<?xml version='1.0' encoding='utf-8'?>
|
||||
<manifest android:hardwareAccelerated="true" android:versionCode="361" android:versionName="0.3.61" package="ch.safechat" xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<manifest android:hardwareAccelerated="true" android:versionCode="506" android:versionName="0.5.6" package="ch.safechat" xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<supports-screens android:anyDensity="true" android:largeScreens="true" android:normalScreens="true" android:resizeable="true" android:smallScreens="true" android:xlargeScreens="true" />
|
||||
<uses-permission android:name="android.permission.INTERNET" />
|
||||
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
|
||||
|
@@ -3,30 +3,33 @@ module.exports = [
|
||||
{
|
||||
"file": "plugins/cordova-plugin-whitelist/whitelist.js",
|
||||
"id": "cordova-plugin-whitelist.whitelist",
|
||||
"pluginId": "cordova-plugin-whitelist",
|
||||
"runs": true
|
||||
},
|
||||
{
|
||||
"file": "plugins/de.appplant.cordova.plugin.background-mode/www/background-mode.js",
|
||||
"id": "de.appplant.cordova.plugin.background-mode.BackgroundMode",
|
||||
"clobbers": [
|
||||
"cordova.plugins.backgroundMode",
|
||||
"plugin.backgroundMode"
|
||||
]
|
||||
},
|
||||
{
|
||||
"file": "plugins/cordova-plugin-device/www/device.js",
|
||||
"id": "cordova-plugin-device.device",
|
||||
"pluginId": "cordova-plugin-device",
|
||||
"clobbers": [
|
||||
"device"
|
||||
]
|
||||
},
|
||||
{
|
||||
"file": "plugins/de.appplant.cordova.plugin.background-mode/www/background-mode.js",
|
||||
"id": "de.appplant.cordova.plugin.background-mode.BackgroundMode",
|
||||
"pluginId": "de.appplant.cordova.plugin.background-mode",
|
||||
"clobbers": [
|
||||
"cordova.plugins.backgroundMode",
|
||||
"plugin.backgroundMode"
|
||||
]
|
||||
}
|
||||
];
|
||||
module.exports.metadata =
|
||||
// TOP OF METADATA
|
||||
{
|
||||
"cordova-plugin-whitelist": "1.0.0",
|
||||
"de.appplant.cordova.plugin.background-mode": "0.6.4",
|
||||
"cordova-plugin-device": "1.1.0"
|
||||
"cordova-plugin-device": "1.1.0",
|
||||
"de.appplant.cordova.plugin.background-mode": "0.6.4"
|
||||
}
|
||||
// BOTTOM OF METADATA
|
||||
});
|
@@ -1,10 +1,17 @@
|
||||
<?xml version='1.0' encoding='utf-8'?>
|
||||
<widget id="ch.safechat" version="0.3.61" xmlns="http://www.w3.org/ns/widgets" xmlns:cdv="http://cordova.apache.org/ns/1.0">
|
||||
<widget id="ch.safechat" version="0.5.6" xmlns="http://www.w3.org/ns/widgets" xmlns:cdv="http://cordova.apache.org/ns/1.0">
|
||||
<preference name="loglevel" value="DEBUG" />
|
||||
<feature name="Whitelist">
|
||||
<param name="android-package" value="org.apache.cordova.whitelist.WhitelistPlugin" />
|
||||
<param name="onload" value="true" />
|
||||
</feature>
|
||||
<feature name="Device">
|
||||
<param name="android-package" value="org.apache.cordova.device.Device" />
|
||||
</feature>
|
||||
<feature name="BackgroundMode">
|
||||
<param name="android-package" value="de.appplant.cordova.plugin.background.BackgroundMode" />
|
||||
</feature>
|
||||
<preference name="KeepRunning" value="true" />
|
||||
<allow-intent href="market:*" />
|
||||
<name>SafeChat</name>
|
||||
<description>
|
||||
|
@@ -47,6 +47,27 @@ function pad(n) {
|
||||
return n<10 ? '0'+n : n
|
||||
}
|
||||
|
||||
/// Convert number of bytes to readable text
|
||||
function size(num) {
|
||||
if (num>0.6*1024) {
|
||||
if (num>0.6*1024*1024) {
|
||||
if (num>0.6*1024*1024*1024) {
|
||||
if (num>0.6*1024*1024*1024*1024) {
|
||||
return Math.round(num/1024/1024/1024/1024)+"TB";
|
||||
} else {
|
||||
return Math.round(num/1024/1024/1024)+"GB";
|
||||
}
|
||||
} else {
|
||||
return Math.round(num/1024/1024)+"MB";
|
||||
}
|
||||
} else {
|
||||
return Math.round(num/1024)+"kB";
|
||||
}
|
||||
} else {
|
||||
return num+"B";
|
||||
}
|
||||
}
|
||||
|
||||
var reboottimer = null;
|
||||
/// Show error messsage
|
||||
/** Fades in an error message and logs to console.
|
||||
@@ -396,18 +417,19 @@ function recordvideo() {
|
||||
$("#videorecorder").show();
|
||||
recorder = new MediaStreamRecorder({
|
||||
video: {
|
||||
mandatory: {
|
||||
maxWidth: 400,
|
||||
maxHeight: 400
|
||||
}
|
||||
width: {ideal: 180},
|
||||
height: {ideal: 160}
|
||||
},
|
||||
audio: true
|
||||
});
|
||||
recorder.on("ready", function() {
|
||||
$("#videorecorder video").attr("src", recorder.preview());
|
||||
$("#videorecorder video").css("width", 180);
|
||||
$("#videorecorder video").css("height", 160);
|
||||
$("#videorecorder video").attr("width", 180);
|
||||
$("#videorecorder video").attr("height", 160);
|
||||
recorder.start();
|
||||
});
|
||||
recorder.on('')
|
||||
} catch (e) {
|
||||
console.log(e);
|
||||
error("cannot access camera", true);
|
||||
@@ -440,8 +462,8 @@ function previewfile(content, type, name) {
|
||||
$("#preview").append(img);
|
||||
success('image is ready to be sent');
|
||||
}
|
||||
img.title = name;
|
||||
img.src = canvas.toDataURL(file.type);
|
||||
img.title = name+"\n"+size(img.src.length);
|
||||
}
|
||||
img.src=content;
|
||||
} else if (type.match('^video/')) {
|
||||
@@ -450,13 +472,13 @@ function previewfile(content, type, name) {
|
||||
video.setAttribute("controls", "controls");
|
||||
video.setAttribute("loop", "loop");
|
||||
video.setAttribute("src", content);
|
||||
video.setAttribute("title", name);
|
||||
video.setAttribute("title", name+"\n"+size(content.length));
|
||||
$("#preview").append(video);
|
||||
} else {
|
||||
filecontent.push({name: name, type: type, content: content});
|
||||
var img = document.createElement("img");
|
||||
img.src = "images/Document_sans_PICOL-PIctorial-COmmunication-Language.svg";
|
||||
img.title = name;
|
||||
img.title = name+"\n"+size(content.length);
|
||||
$("#preview").append(img);
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user