From 6ac6aed63cd30ae5fc84f5696901291683440824 Mon Sep 17 00:00:00 2001 From: rishabhdixit Date: Fri, 1 Apr 2016 18:43:48 +0530 Subject: [PATCH] Added plugin init data functionality, ticket: #115466299 --- control/content/index.html | 14 +++++++------- widget/index.html | 26 ++++++++++++++++---------- 2 files changed, 23 insertions(+), 17 deletions(-) diff --git a/control/content/index.html b/control/content/index.html index 77fa2b0..a8bbb89 100644 --- a/control/content/index.html +++ b/control/content/index.html @@ -49,6 +49,13 @@ buildfire.datastore.get(function (err, result) { if (!err) { $scope.datastoreInitialized = true; + if (result && !result.id) { + $scope.data = { + content : { + facebookId: "https://www.facebook.com/zuck" + } + }; + } } else { console.error("Error: ", err); return; @@ -57,14 +64,7 @@ if (result && result.data && !angular.equals({}, result.data)) { $scope.data = result.data; $scope.id = result.id; - } else { - $scope.data = { - content: { - facebookId: "" - } - }; } - /* * watch for changes in data and trigger the saveDataWithDelay function on change * */ diff --git a/widget/index.html b/widget/index.html index 2f3bd61..692642e 100644 --- a/widget/index.html +++ b/widget/index.html @@ -47,19 +47,25 @@ if (result && result.data && !angular.equals({}, result.data)) { if (result.data.content) { content = result.data.content; - buildfire.spinner.hide(); - buildfire.getContext(function (err, context) { - if (context.device.platform != "web") { - buildfire.navigation.openWindow(content.facebookId, "_blank"); - buildfire.navigation.goBack(); - } else { - document.querySelector(".link-verified").style.display = "block"; - } - }); + } else if(!result.id && !result.data.content) { + content = { + facebookId: "https://www.facebook.com/zuck" + } } } else { - buildfire.spinner.hide(); + content = { + facebookId: "https://www.facebook.com/zuck" + }; } + buildfire.spinner.hide(); + buildfire.getContext(function (err, context) { + if (context.device.platform != "web") { + buildfire.navigation.openWindow(content.facebookId, "_blank"); + buildfire.navigation.goBack(); + } else { + document.querySelector(".link-verified").style.display = "block"; + } + }); } /* * Go pull saved data