Skip to content

Commit

Permalink
Do not attempt to download topic list if offline, but still load from…
Browse files Browse the repository at this point in the history
… db #69
  • Loading branch information
bsenyk committed Feb 3, 2016
1 parent 2bfecac commit c6e5860
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
5 changes: 4 additions & 1 deletion platforms/android/assets/www/js/controllers.js
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ angular.module('starter.controllers', ['starter.services'])
var INDEX_URL = $scope.settingsData.contentUrl + '/index.json';

$scope.refreshTopics = function() {
if($scope.allowRefresh) {
if($scope.allowRefresh && window.isOnline) {
$http({
method: 'GET',
url: INDEX_URL,
Expand Down Expand Up @@ -188,6 +188,9 @@ angular.module('starter.controllers', ['starter.services'])
});
} else {
//quickly return if we've disabled the refresher
var topics = DBService.getAllTopics();
$scope.topics = topics;
doFilter();
$scope.$broadcast('scroll.refreshComplete');
}
};
Expand Down
5 changes: 4 additions & 1 deletion www/js/controllers.js
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ angular.module('starter.controllers', ['starter.services'])
var INDEX_URL = $scope.settingsData.contentUrl + '/index.json';

$scope.refreshTopics = function() {
if($scope.allowRefresh) {
if($scope.allowRefresh && window.isOnline) {
$http({
method: 'GET',
url: INDEX_URL,
Expand Down Expand Up @@ -188,6 +188,9 @@ angular.module('starter.controllers', ['starter.services'])
});
} else {
//quickly return if we've disabled the refresher
var topics = DBService.getAllTopics();
$scope.topics = topics;
doFilter();
$scope.$broadcast('scroll.refreshComplete');
}
};
Expand Down

0 comments on commit c6e5860

Please sign in to comment.