Skip to content
This repository has been archived by the owner on Sep 15, 2021. It is now read-only.

Commit

Permalink
add the show() method that exists for android. show expects one param…
Browse files Browse the repository at this point in the history
…eter which is the indicator message
  • Loading branch information
nraboy committed Dec 27, 2014
1 parent ab44bdb commit 67f5f0d
Show file tree
Hide file tree
Showing 7 changed files with 132 additions and 33 deletions.
11 changes: 9 additions & 2 deletions demo/www/lib/ngCordova/dist/ng-cordova.js
Original file line number Diff line number Diff line change
Expand Up @@ -3081,9 +3081,11 @@ angular.module('ngCordova.plugins.keyboard', [])

angular.module('ngCordova.plugins.keychain', [])

.factory('$cordovaKeychain', ['$q', function ($q) {
.factory('$cordovaKeychain', ['$q', '$window', function ($q, $window) {

var kc = new Keychain();
if ('Keychain' in $window) {
var kc = new Keychain();
}

return {
getForKey: function (key, serviceName) {
Expand Down Expand Up @@ -4720,6 +4722,11 @@ angular.module('ngCordova.plugins.progressIndicator', [])
.factory('$cordovaProgress', ['$q', function ($q) {

return {
show: function(_message) {
var message = _message || "Please wait...";
return ProgressIndicator.show(message);
},

showSimple: function (_dim) {
var dim = _dim || false;
return ProgressIndicator.showSimple(dim);
Expand Down
4 changes: 2 additions & 2 deletions demo/www/lib/ngCordova/dist/ng-cordova.min.js

Large diffs are not rendered by default.

128 changes: 104 additions & 24 deletions dist/ng-cordova-mocks.js
Original file line number Diff line number Diff line change
Expand Up @@ -893,6 +893,8 @@ ngCordovaMocks.factory('$cordovaDialogs', ['$q', function ($q) {
ngCordovaMocks.factory('$cordovaFile', ['$q', function($q) {
var throwsError = false;
var fileSystem = {};
var shouldMockFiles = false;
var files = {};

var mockIt = function(errorMessage) {
var defer = $q.defer();
Expand Down Expand Up @@ -927,41 +929,119 @@ ngCordovaMocks.factory('$cordovaFile', ['$q', function($q) {
**/
fileSystem: fileSystem,

checkDir: function(directory) {
return mockIt.call(this, 'There was an error checking the directory.');
},
/**
* @ngdoc property
* @name shouldMockFiles
* @propertyOf ngCordovaMocks.cordovaFile
*
* @description
* A flag that signals whether one wish to mock files.
* This is useful if you need mocks specific file scenarios.
* This property should only be used in automated tests.
**/
shouldMockFiles: shouldMockFiles,

createDir: function(directory, overwrite) {
return mockIt.call(this, 'There was an error creating the directory.');
},
/**
* @ngdoc property
* @name files
* @propertyOf ngCordovaMocks.cordovaFile
*
* @description
* An object that may be used for mocking files on the device.
* This property should only be used in automated tests.
*
* **/
files : files,

checkDir: function(directory) {
if(this.shouldMockFiles){
var defer = $q.defer();
if(this.files[directory] && !this.files[directory].isFile){
defer.resolve();
}
else{
defer.reject();
}
return defer.promise;
}

return mockIt.call(this, 'There was an error checking the directory.');
},

createDir: function(directory, overwrite) {
if(this.shouldMockFiles ){
var defer = $q.defer();
this.files[directory] = { isFile : false};
defer.resolve();
return defer.promise;
}
return mockIt.call(this, 'There was an error creating the directory.');
},

listDir: function(filePath) {
return mockIt.call(this, 'There was an error listing the directory');
},

checkFile: function(directory, file) {
return mockIt.call(this, 'There was an error checking for the file.');
},

createFile: function(directory, file, overwrite) {
return mockIt.call(this, 'There was an error creating the file.');
},
checkFile: function(filePath) {
if(this.shouldMockFiles){
var defer = $q.defer();
if(this.files[filePath] && this.files[filePath].isFile){
defer.resolve();
}
else{
defer.reject();
}
return defer.promise;
}
return mockIt.call(this, 'There was an error checking for the file.');
},


createFile: function(filePath,overwrite) {
if(this.shouldMockFiles){
var defer = $q.defer();
this.files[filePath] = {
isFile : true,
fileContent : ''
};
defer.resolve();
return defer.promise;
}

return mockIt.call(this, 'There was an error creating the file.');
},

removeFile: function(directory, file) {
return mockIt.call(this,'There was an error removng the file.');
},

writeFile: function(directory, file, options) {
return mockIt.call(this,'There was an error writing the file.');
},

readFile: function(directory, file) {
return mockIt.call(this, 'There was an error reading the file.');
},

readAsText: function (filePath) {
return mockIt.call(this, 'There was an error reading the file as text.');
},
writeFile: function(filePath,data,options) {
if(this.shouldMockFiles && filePath && data){
this.files[filePath] = {
isFile : true,
fileContent : data
};
}
return mockIt.call(this,'There was an error writing the file.');
},

readFile: function(filePath) {
return this.readAsText(filePath);
},

readAsText: function (filePath) {
if(this.shouldMockFiles){
var defer = $q.defer();
if(files[filePath] && files[filePath].isFile){
defer.resolve(files[filePath].fileContent);
}
else{
defer.reject();
}
return defer.promise;
}
return mockIt.call(this, 'There was an error reading the file as text.');
},

readAsDataURL: function (filePath) {
return mockIt.call(this, 'There was an error reading the file as a data url.');
Expand Down

0 comments on commit 67f5f0d

Please sign in to comment.