Skip to content

Commit

Permalink
switched plugins to reduce android permissions, added cast support - …
Browse files Browse the repository at this point in the history
…but it breaks in android, will likely disable
  • Loading branch information
pliablepixels committed Jun 1, 2016
1 parent ee562f4 commit 67e00b6
Show file tree
Hide file tree
Showing 8 changed files with 107 additions and 26 deletions.
8 changes: 8 additions & 0 deletions checkperms.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
#!/bin/sh
if [ -z "$1" ]; then
FILE="platforms/android/build/outputs/apk/android-debug.apk"
else
FILE="$1"
fi
echo "*** Permissions for $FILE ***"
`echo $ANDROID_HOME`/build-tools/23.0.1/aapt d permissions $FILE
1 change: 1 addition & 0 deletions config.xml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
<access origin="*" subdomains="true" />
<allow-navigation href="*" />
<allow-intent href="*" />
<access origin="mailto:*" launch-external="yes"/>
<preference name="xwalkCommandLine" value="--disable-pull-to-refresh-effect" />
<preference name="xwalkMode" value="embedded" />
<preference name="xwalkMultipleApk" value="true" />
Expand Down
34 changes: 26 additions & 8 deletions plugins/fetch.json
Original file line number Diff line number Diff line change
Expand Up @@ -115,39 +115,57 @@
"is_top_level": true,
"variables": {}
},
"cordova-plugin-media": {
"com.telerik.plugins.nativepagetransitions": {
"source": {
"type": "git",
"url": "https://github.com/pliablepixels/cordova-plugin-media",
"url": "https://github.com/Telerik-Verified-Plugins/NativePageTransitions",
"subdir": "."
},
"is_top_level": true,
"variables": {}
},
"com.telerik.plugins.nativepagetransitions": {
"cordova-plugin-globalization": {
"source": {
"type": "git",
"url": "https://github.com/Telerik-Verified-Plugins/NativePageTransitions",
"url": "https://git-wip-us.apache.org/repos/asf/cordova-plugin-globalization.git",
"subdir": "."
},
"is_top_level": true,
"variables": {}
},
"cordova-plugin-email-composer": {
"cordova-plugin-connectsdk": {
"source": {
"type": "registry",
"id": "cordova-plugin-email-composer"
"id": "cordova-plugin-connectsdk"
},
"is_top_level": true,
"variables": {}
},
"cordova-plugin-globalization": {
"cordova-plugin-console": {
"source": {
"type": "registry",
"id": "cordova-plugin-console"
},
"is_top_level": true,
"variables": {}
},
"com.jcjee.plugins.emailcomposer": {
"source": {
"type": "git",
"url": "https://git-wip-us.apache.org/repos/asf/cordova-plugin-globalization.git",
"url": "https://github.com/jcjee/email-composer",
"subdir": "."
},
"is_top_level": true,
"variables": {}
},
"org.apache.cordova.media": {
"source": {
"type": "git",
"url": "https://github.com/pliablepixels/cordova-plugin-media",
"subdir": ".",
"ref": "playback-only"
},
"is_top_level": true,
"variables": {}
}
}
30 changes: 14 additions & 16 deletions www/js/LogCtrl.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
/* jslint browser: true*/
/* global saveAs, cordova,StatusBar,angular,console,moment */

angular.module('zmApp.controllers').controller('zmApp.LogCtrl', ['$scope', '$rootScope','zm', '$ionicModal', 'ZMDataModel', '$ionicSideMenuDelegate', '$fileLogger', '$cordovaEmailComposer', '$ionicPopup', '$timeout', '$ionicHistory', '$state', '$interval', '$ionicLoading', '$tranaslate', function ($scope, $rootScope,zm, $ionicModal, ZMDataModel, $ionicSideMenuDelegate, $fileLogger, $cordovaEmailComposer, $ionicPopup, $timeout, $ionicHistory, $state, $interval, $ionicLoading, $translate) {
angular.module('zmApp.controllers').controller('zmApp.LogCtrl', ['$scope', '$rootScope','zm', '$ionicModal', 'ZMDataModel', '$ionicSideMenuDelegate', '$fileLogger', '$cordovaEmailComposer', '$ionicPopup', '$timeout', '$ionicHistory', '$state', '$interval', '$ionicLoading', '$translate', function ($scope, $rootScope,zm, $ionicModal, ZMDataModel, $ionicSideMenuDelegate, $fileLogger, $cordovaEmailComposer, $ionicPopup, $timeout, $ionicHistory, $state, $interval, $ionicLoading, $translate) {
$scope.openMenu = function () {
$ionicSideMenuDelegate.toggleLeft();
};
Expand Down Expand Up @@ -88,8 +88,11 @@ angular.module('zmApp.controllers').controller('zmApp.LogCtrl', ['$scope', '$roo
//--------------------------------------------------------------------------
function sendEmailReally(logstring) {
if (window.cordova) {




$cordovaEmailComposer.isAvailable().then(function () {


// do my best to replace sensitive information
var loginData = ZMDataModel.getLogin();
Expand Down Expand Up @@ -122,21 +125,11 @@ angular.module('zmApp.controllers').controller('zmApp.LogCtrl', ['$scope', '$roo
logstring = logstring.replace(re4, "<server>");
}

var email = {
to: zm.authoremail,
subject: $rootScope.appName + ' Logs',
body: logstring,
isHtml: false
};
$cordovaEmailComposer.open(email)
.then(null, function () {
// user cancelled email
});
}, function () {
ZMDataModel.zmLog("Email plugin not found", "error");
});
window.plugins.emailComposer.showEmailComposerWithCallback(callback,$rootScope.appName+' logs',logstring,[zm.authoremail]);


} else {
console.log("Using default email client to send data");
// console.log("Using default email client to send data");

var fname = $rootScope.appName+"-logs-" +
moment().format('MMM-DD-YY_HH-mm-ss') + ".txt";
Expand All @@ -148,6 +141,11 @@ saveAs(blob, fname);

}

function callback ()
{
console.log ("EMAIL SENT");
}

function loadLogs()
{
//console.log ("GETTING LOGS");
Expand Down
51 changes: 50 additions & 1 deletion www/js/MonitorModalCtrl.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// Common Controller for the montage view
/* jshint -W041 */
/* jslint browser: true*/
/* global saveAs, cordova,StatusBar,angular,console,ionic, moment, imagesLoaded */
/* global saveAs, cordova,StatusBar,angular,console,ionic, moment, imagesLoaded, ConnectSDK */



Expand Down Expand Up @@ -192,6 +192,55 @@ angular.module('zmApp.controllers').controller('MonitorModalCtrl', ['$scope', '$

});


$scope.cast = function(mid, mon)
{

console.log ("PASSED WITH " + JSON.stringify(mon));
//ConnectSDK.discoveryManager.startDiscovery();
ConnectSDK.discoveryManager.startDiscovery();
ConnectSDK.discoveryManager.pickDevice()
.success(function (device) {
//device.disconnect();
function sendVideo (mid,mon) {
//device.getMediaPlayer().playMedia("http://media.w3.org/2010/05/sintel/trailer.mp4", "video/mp4");

// var url = "http://www.connectsdk.com/files/9613/9656/8539/test_image.jpg";

//var url = mon.Monitor.streamingURL+"/nph-zms?mode=jpeg&monitor="+mid+$rootScope.authSession+"&rand="+$rootScope.modalRand;

var ld = ZMDataModel.getLogin();
var url = mon.Monitor.streamingURL+"/nph-zms?mode=jpeg&monitor="+mid+"&user="+ld.username+"&pass="+ld.password+"&rand="+$rootScope.modalRand;

console.log ("URL: " + url);
var iconUrl = "http://www.connectsdk.com/files/9613/9656/8539/test_image.jpg";
var mimeType = "image/jpeg";

device.getMediaPlayer().displayImage(url, mimeType, {
title: "Monitor: "+mid,
description: "Monitor feed",
}).success(function (launchSession, mediaControl) {
console.log("Image launch successful");
}).error(function (err) {
console.log("error: " + err.message);
});
}

if (device.isReady()) { // already connected
console.log (">>> device ready sending video");
sendVideo(mid,mon);
} else {
device.on("ready", function() {sendVideo(mid,mon);});
console.log (">>> device not ready connecting");
device.connect();
}
})
.error (
function (error) {
console.log ("ERROR");
});
};

//-------------------------------------------------------------
// PTZ enable/disable
//-------------------------------------------------------------
Expand Down
3 changes: 2 additions & 1 deletion www/js/MontageCtrl.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// Controller for the montage view
/* jshint -W041 */
/* jslint browser: true*/
/* global cordova,StatusBar,angular,console,ionic,Packery, Draggabilly, imagesLoaded */
/* global cordova,StatusBar,angular,console,ionic,Packery, Draggabilly, imagesLoaded, ConnectSDK */


angular.module('zmApp.controllers').controller('zmApp.MontageCtrl', ['$scope', '$rootScope', 'ZMDataModel', 'message', '$ionicSideMenuDelegate', '$timeout', '$interval', '$ionicModal', '$ionicLoading', '$http', '$state', '$ionicPopup', '$stateParams', '$ionicHistory', '$ionicScrollDelegate', '$ionicPlatform', 'zm', '$ionicPopover', '$controller', 'imageLoadingDataShare', '$window', '$localstorage', '$translate', function ($scope, $rootScope, ZMDataModel, message, $ionicSideMenuDelegate, $timeout, $interval, $ionicModal, $ionicLoading, $http, $state, $ionicPopup, $stateParams, $ionicHistory, $ionicScrollDelegate, $ionicPlatform, zm, $ionicPopover, $controller, imageLoadingDataShare, $window, $localstorage, $translate) {
Expand All @@ -28,6 +28,7 @@ angular.module('zmApp.controllers').controller('zmApp.MontageCtrl', ['$scope', '
// Handling of back button in case modal is open should
// close the modal
// --------------------------------------------------------


$ionicPlatform.registerBackButtonAction(function (e) {
e.preventDefault();
Expand Down
1 change: 1 addition & 0 deletions www/js/TimelineCtrl.js
Original file line number Diff line number Diff line change
Expand Up @@ -881,6 +881,7 @@ angular.module('zmApp.controllers').controller('zmApp.TimelineCtrl', ['$ionicPla
empty: false,

onclick: function () {


move(0.2);
}
Expand Down
5 changes: 5 additions & 0 deletions www/templates/monitors-modal.html
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,11 @@
<li>
<a href="" ng-click="enableAlarm(monitorId,false)"> <i class="icon ion-flash-off"></i></a>
</li>

<li>
<a href="" ng-click="cast(monitorId, monitor)"> <i class="icon ion-android-funnel"></i></a>
</li>




Expand Down

0 comments on commit 67e00b6

Please sign in to comment.