This repository was archived by the owner on Sep 15, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1k
Expand file tree
/
Copy pathwebIntent.js
More file actions
75 lines (72 loc) · 2.18 KB
/
webIntent.js
File metadata and controls
75 lines (72 loc) · 2.18 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
ngCordovaMocks.factory('$webIntent', ['$q', '$rootScope', function($q, $rootScope) {
var scope = $rootScope.$new();
var has = true;
var url = "http://url.mock/ressource";
var throwsError = false;
return{
has: has,
url: url,
throwsError: throwsError,
startActivity: function (params) {
var q = $q.defer();
if(this.throwsError) {
q.reject(new Error());
} else {
q.resolve();
}
return q.promise;
},
hasExtra: function (params) {
var q = $q.defer();
if(this.throwsError) {
q.reject(new Error());
} else {
q.resolve(has);
}
return q.promise;
},
getUri: function () {
var q = $q.defer();
if(this.throwsError) {
q.reject(new Error());
} else {
q.resolve(url);
}
return q.promise;
},
getExtra: function (params) {
var q = $q.defer();
if(this.throwsError) {
q.reject(new Error());
} else {
q.resolve(url);
}
return q.promise;
},
onNewIntent: function (callback) {
scope.$on('newIntent', function() {
callback(url);
});
},
newIntent: function() {
scope.$broadcast('newIntent')
},
sendBroadcast: function (params) {
var q = $q.defer();
if(this.throwsError) {
q.reject(new Error());
} else {
q.resolve();
}
return q.promise;
},
actionSend: function() {return "actionSend"},
actionView: function() {return "actionView"},
actionCall: function() {return "actionCall"},
actionSendTo: function() {return "actionSendTo"},
extraText: function() {return "extraText"},
extraSubject: function() {return "extraSubject"},
extraStream: function() {return "extraStream"},
extraEmail: function() {return "extraEmail"}
}
}]);