Skip to content

Commit

Permalink
Merge pull request #12 from fablabbcn/fix-registerflow
Browse files Browse the repository at this point in the history
Hot fixes for the community
  • Loading branch information
pral2a authored Dec 14, 2016
2 parents 15625cb + 0cc121d commit 08b26b4
Show file tree
Hide file tree
Showing 5 changed files with 43 additions and 15 deletions.
23 changes: 13 additions & 10 deletions src/app/wizard/scripts/accountController.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
/**
* Created by Lucian on 10/12/16.
*/
angular.module('app').controller('accountController', function($scope, scopePayload, AnimationService, platform){
angular.module('app').controller('accountController', function($scope, scopePayload, AnimationService, platform, $timeout){
$scope.$parent.payload = scopePayload;
AnimationService.animate(scopePayload.index);

Expand Down Expand Up @@ -109,17 +109,19 @@ angular.module('app').controller('accountController', function($scope, scopePayl
/********** Functions **********/

function loginAndBakeDevice(){
blockSegue();
platform.login($scope.$parent.submittedData.user).then(function(data){
platform.setAuth(data);
platform.bakeDevice().then(function (data) {
$scope.$parent.submittedData.deviceData.id = data.id;
console.log(data);
prepSegue();
}, function(){
console.log(data);
blockSegue();
});
$timeout(function() {
platform.bakeDevice().then(function (data) {
$timeout(function() {
$scope.$parent.submittedData.deviceData.id = data.id;
prepSegue();
}, 500); // This is temp
}, function(){
console.log(data);
blockSegue();
});
}, 500); // This is temp
}, function (data) {
console.log(data);
blockSegue();
Expand All @@ -133,6 +135,7 @@ angular.module('app').controller('accountController', function($scope, scopePayl
$scope.$parent.pre_made = true;
}, function (data) {
console.log(data);
$scope.$parent.pre_made = false;
$scope.$parent.submittedData.user.username = ' ';
})
}
Expand Down
2 changes: 1 addition & 1 deletion src/app/wizard/scripts/handshakeController.js
Original file line number Diff line number Diff line change
Expand Up @@ -228,7 +228,7 @@ angular.module('app').controller('handshakeController', function($scope, scopePa
console.log("Light process done...");
$scope.watchDog = $timeout(function() {
blockError();
}, 12000);
}, 18000);
});
});

Expand Down
2 changes: 1 addition & 1 deletion src/app/wizard/scripts/nameController.js
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ angular.module('app').controller('nameCtlr', function($scope, scopePayload, Anim


function prepSegue(){
$scope.payload.segueButton = 'Listo!';
$scope.payload.segueButton = 'LISTO!';
$scope.$parent.segueControl ='ready';
}
function blockSegue(){
Expand Down
2 changes: 1 addition & 1 deletion src/app/wizard/scripts/router.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

angular.module('app').config(function($stateProvider, $urlRouterProvider, $locationProvider, RestangularProvider) {

var refreshed = true;
var refreshed = false;

$stateProvider

Expand Down
29 changes: 27 additions & 2 deletions src/app/wizard/scripts/wizard.js
Original file line number Diff line number Diff line change
Expand Up @@ -151,6 +151,18 @@ angular.module('app').controller('wizardCtrl', function($scope, $location, $sce,
$rootScope.$broadcast('modal');
};

$scope.kitRegisterFailed = function() {
$scope.modalBox = 'red';
var data = {
title: "Uh oh",
body: "It seems there was a problem while registering your kit! Sorry, you need to restart the process.",
button: "Restart the process!",
action: "restart"
};
$scope.modalContent = data;
$rootScope.$broadcast('modal');
};

$scope.handshakeFailed = function() {
$scope.modalBox = 'red';
var data = {
Expand Down Expand Up @@ -185,9 +197,22 @@ angular.module('app').controller('wizardCtrl', function($scope, $location, $sce,
}, 500);
};
$scope.modalButtonClick = function() {
if ($scope.modalContent.action == 'email') $window.open('mailto:feedback-4873-IVVSumgXA4EEA4e7blwZvyE2sshIpRRK@feedback.doorbell.io?Subject=MakingSense Support [' + $scope.onboarding_session + ']', '_blank');
else if ($scope.modalContent.action == 'retry') $scope.seque;
switch ($scope.modalContent.action) {
case 'email':
$window.open('mailto:feedback-4873-IVVSumgXA4EEA4e7blwZvyE2sshIpRRK@feedback.doorbell.io?Subject=MakingSense Support [' + $scope.onboarding_session + ']', '_blank');
break;
case 'retry':
$scope.seque;
break;
case 'restart':
$state.go('wizard.landing');
break;
default:
$scope.seque;
break;
}
};

$scope.$on('modal', function() {
$scope.modalClass = 'showing';
});
Expand Down

0 comments on commit 08b26b4

Please sign in to comment.