Skip to content

Commit 2c629b9

Browse files
committed
Merge pull request #12 from rishabhdixit/master
Added plugin init data functionality, ticket: #115466299
2 parents c3fac9f + 6ac6aed commit 2c629b9

2 files changed

Lines changed: 23 additions & 17 deletions

File tree

control/content/index.html

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,13 @@
4949
buildfire.datastore.get(function (err, result) {
5050
if (!err) {
5151
$scope.datastoreInitialized = true;
52+
if (result && !result.id) {
53+
$scope.data = {
54+
content : {
55+
facebookId: "https://www.facebook.com/zuck"
56+
}
57+
};
58+
}
5259
} else {
5360
console.error("Error: ", err);
5461
return;
@@ -57,14 +64,7 @@
5764
if (result && result.data && !angular.equals({}, result.data)) {
5865
$scope.data = result.data;
5966
$scope.id = result.id;
60-
} else {
61-
$scope.data = {
62-
content: {
63-
facebookId: ""
64-
}
65-
};
6667
}
67-
6868
/*
6969
* watch for changes in data and trigger the saveDataWithDelay function on change
7070
* */

widget/index.html

Lines changed: 16 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -47,19 +47,25 @@
4747
if (result && result.data && !angular.equals({}, result.data)) {
4848
if (result.data.content) {
4949
content = result.data.content;
50-
buildfire.spinner.hide();
51-
buildfire.getContext(function (err, context) {
52-
if (context.device.platform != "web") {
53-
buildfire.navigation.openWindow(content.facebookId, "_blank");
54-
buildfire.navigation.goBack();
55-
} else {
56-
document.querySelector(".link-verified").style.display = "block";
57-
}
58-
});
50+
} else if(!result.id && !result.data.content) {
51+
content = {
52+
facebookId: "https://www.facebook.com/zuck"
53+
}
5954
}
6055
} else {
61-
buildfire.spinner.hide();
56+
content = {
57+
facebookId: "https://www.facebook.com/zuck"
58+
};
6259
}
60+
buildfire.spinner.hide();
61+
buildfire.getContext(function (err, context) {
62+
if (context.device.platform != "web") {
63+
buildfire.navigation.openWindow(content.facebookId, "_blank");
64+
buildfire.navigation.goBack();
65+
} else {
66+
document.querySelector(".link-verified").style.display = "block";
67+
}
68+
});
6369
}
6470
/*
6571
* Go pull saved data

0 commit comments

Comments
 (0)