Skip to content
This repository was archived by the owner on Apr 1, 2026. It is now read-only.

Commit 0387602

Browse files
committed
Merge pull request #19 from sakshityagi/master
Showed dummy data in case user has not interacted with plugin data yet
2 parents a63f377 + 340bdc3 commit 0387602

File tree

2 files changed

+27
-8
lines changed

2 files changed

+27
-8
lines changed

control/content/app.js

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -20,11 +20,10 @@ webviewPluginApp.controller("webviewPluginCtrl", ["$scope", "$log", "$timeout",
2020
console.error("Error: ", err);
2121
return;
2222
}
23-
24-
if (result && result.data && !angular.equals({}, result.data)) {
23+
if (result && result.data && !angular.equals({}, result.data) && result.id) {
2524
$scope.data = result.data;
2625
$scope.id = result.id;
27-
if (typeof result.data.content.openInApp != 'undefined') {
26+
if (typeof result.data.content.openInApp != 'undefined' && typeof result.data.content.openInApp != 'object') {
2827
if (result.data.content.openInApp)
2928
$scope.data.content.view = $scope.viewType.NATIVE_IN_APP;
3029
else
@@ -33,7 +32,7 @@ webviewPluginApp.controller("webviewPluginCtrl", ["$scope", "$log", "$timeout",
3332
} else {
3433
$scope.data = {
3534
content: {
36-
url: "",
35+
url: "http://hellacompany.com/",
3736
view: $scope.viewType.NATIVE_IN_APP
3837
}
3938
};
@@ -83,7 +82,8 @@ webviewPluginApp.controller("webviewPluginCtrl", ["$scope", "$log", "$timeout",
8382
if (!/^https?\:\/\//.test(data.content.url)) {
8483
data.content.url = "http://" + data.content.url;
8584
}
86-
if (data.content.openInApp != 'undefined')
85+
86+
if (data.content.openInApp != undefined)
8787
data.content.openInApp = null;
8888
buildfire.datastore.save(data, function (err, result) {
8989
if (err || !result) {
@@ -104,8 +104,10 @@ webviewPluginApp.controller("webviewPluginCtrl", ["$scope", "$log", "$timeout",
104104
dataChanged = true;
105105
if (!$scope.frmMain.$invalid) {
106106
var data = $scope.data;
107-
if (data.content.openInApp != 'undefined')
107+
console.log("***********save", data.content.openInApp);
108+
if (data.content.openInApp != undefined) {
108109
data.content.openInApp = null;
110+
}
109111
buildfire.datastore.save(data, function (err, result) {
110112
if (err || !result) {
111113
$log.error('Error saving the widget details: ', err);
@@ -127,5 +129,5 @@ webviewPluginApp.controller("webviewPluginCtrl", ["$scope", "$log", "$timeout",
127129
$log.info('Widget details saved');
128130
}
129131
});
130-
}
132+
};
131133
}]);

widget/index.html

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,8 @@
2626
</style>
2727
</head>
2828
<body class="no-scroll" ng-controller="webviewPluginCtrl" ng-cloak>
29-
<div class="scrollable" ng-if="(data.content.view == 'Native In App') || data.content.openInApp">
29+
<div class="scrollable"
30+
ng-if="(data.content.view == 'Native In App') || data.content.openInApp">
3031
<iframe ng-src="{{ url }}"
3132
style="height:100%; width:1px; min-width:100%;"
3233
scrolling="auto"
@@ -64,6 +65,7 @@ <h2>Success!</h2>
6465

6566
function dataLoadedHandler(result) {
6667
var content = null;
68+
console.log("________________", result);
6769
if (result && result.data && !angular.equals({}, result.data)) {
6870
if (result.data.content) {
6971
content = result.data.content;
@@ -87,6 +89,21 @@ <h2>Success!</h2>
8789
buildfire.spinner.hide();
8890
});
8991
}
92+
} else {
93+
content = {
94+
view: "Native In App",
95+
url: "http://hellacompany.com/"
96+
};
97+
$scope.data = {
98+
content: {
99+
view: "Native In App",
100+
url: "http://hellacompany.com/"
101+
}
102+
};
103+
$scope.url = $sce.trustAsResourceUrl(content.url);
104+
if (!$scope.$$phase && !$scope.$root.$$phase) {
105+
$scope.$apply();
106+
}
90107
}
91108
}
92109

0 commit comments

Comments
 (0)