angular.module("mystrom.firmwareupgrade.controllers",["ionic"]).controller("FirmwareUpgradeController",["$scope","$ionicHistory","stateService","firmwareService",function(e,r,o,i){e.isAndroid=ionic.Platform.isAndroid(),e.isIPad=ionic.Platform.isIPad(),e.currentFirmwareVersion=i.getDevice().currentFirmwareVersion,e.newFirmwareVersion=i.getDevice().newFirmwareVersion,e.goBack=function(){r.goBack()},e.downloadFirmware=function(){e.isIPad?o.goState("index.upgrade-download",{},!1):o.goState("upgrade-download",{},!1),i.startFirmwareUpgrade({id:i.getDevice().id}).then(function(r){"ok"===r.data.status?e.isIPad?o.goState("index.upgrade-process",{},!1):o.goState("upgrade-process",{},!1):e.isIPad?o.goState("index.upgrade-error",{},!1):o.goState("upgrade-error",{},!1)},function(){e.isIPad?o.goState("index.upgrade-error",{},!1):o.goState("upgrade-error",{},!1)})},e.goToUpgradeInfo=function(){e.isIPad?o.goState("index.upgrade-info",{},!1):o.goState("upgrade-info",{},!1)},e.goToMain=function(){!_.isUndefined(o.modal)&&o.modal.isShown()&&o.modal.hide(),r.nextViewOptions({historyRoot:!0}),r.clearCache(),o.goState("index",{},!1),r.clearHistory()}}]);