forked from danielsogl/awesome-cordova-plugins
-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.ts
170 lines (159 loc) · 3.95 KB
/
index.ts
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
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
import { Injectable } from '@angular/core';
import { Plugin, Cordova, CordovaProperty, IonicNativePlugin } from '@ionic-native/core';
/**
* @name Pollfish
* @description
* Pollfish Ionic Native plugin wrapper
*
* @usage
* ```typescript
* import { Pollfish } from '@ionic-native/pollfish/ngx';
*
*
* constructor(private pollfish: Pollfish) { }
*
* ...
*
* this.pollfish.init(false, false, 'YOUR_API_KEY', 1, 8, 'REQUEST_UUID', false);
*
* this.pollfish.initWithUserAttributes(false, false, 'YOUR_API_KEY', 1, 8, 'REQUEST_UUID', false, {
* 'gender': '1',
* ...
* });
*
* this.pollfish.showPollfish();
*
* this.pollfish.hidePollfish();
*
* // Event Listeners
*
* this.pollfish.setEventCallback(pollfish.EventListener.OnPollfishSurveyReceived, (surveyInfo) => {
* console.log("Survey Received: " + JSON.stringify(surveyInfo));
* });
*
* this.pollfish.setEventCallback(pollfish.EventListener.OnPollfishSurveyCompleted, (result) => {
* console.log("Survey Completed: " + JSON.stringify(surveyInfo));
* });
*
* this.pollfish.setEventCallback(pollfish.EventListener.OnPollfishUserNotEligible, (_) => {
* console.log("Pollfish User Not Eligible");
* });
*
* this.pollfish.setEventCallback(pollfish.EventListener.OnPollfishSurveyNotAvailable, (_) => {
* console.log("Pollfish Survey not available");
* });
*
* this.pollfish.setEventCallback(pollfish.EventListener.OnPollfishOpened, (_) => {
* console.log("Pollfish Survey panel is open");
* });
*
* this.pollfish.setEventCallback(pollfish.EventListener.OnPollfishClosed, (_) => {
* console.log("Pollfish Survey panel is closed");
* });
*
* this.pollfish.setEventCallback(pollfish.EventListener.OnPollfishUserRejectedSurvey, (_) => {
* console.log("Pollfish User Rejected Survey");
* });
*
* ```
*/
@Plugin({
pluginName: 'Pollfish',
plugin: 'com.pollfish.cordova_plugin',
pluginRef: 'pollfishplugin',
repo: 'https://github.com/pollfish/cordova-plugin-pollfish',
platforms: ['Android', 'iOS'],
})
@Injectable()
export class Pollfish extends IonicNativePlugin {
@CordovaProperty()
EventListener: {
OnPollfishClosed: string;
OnPollfishOpened: string;
OnPollfishSurveyReceived: string;
OnPollfishSurveyCompleted: string;
OnPollfishUserNotEligible: string;
OnPollfishUserRejectedSurvey: string;
OnPollfishSurveyNotAvailable: string;
};
@CordovaProperty()
Position: {
TOP_LEFT: number;
TOP_RIGHT: number;
MIDDLE_LEFT: number;
MIDDLE_RIGHT: number;
BOTTOM_LEFT: number;
BOTTOM_RIGHT: number;
};
/**
* Function to init Pollfish
* @param releaseMode {boolean}
* @param rewardMode {boolean}
* @param apiKey {string}
* @param position {number}
* @param padding {number}
* @param requestUUID {string}
* @param offerwallMode {boolean}
*/
@Cordova()
init(
releaseMode: boolean,
rewardMode: boolean,
apiKey: string,
position: number,
padding: number,
requestUUID: string,
offerwallMode: boolean
): any {
return;
}
/**
* Function to init Pollfish with user attributes
* @param releaseMode {boolean}
* @param rewardMode {boolean}
* @param apiKey {string}
* @param position {number}
* @param padding {number}
* @param requestUUID {string}
* @param offerwallMode {boolean}
* @param userAttributes {Json}
*/
@Cordova()
initWithUserAttributes(
releaseMode: boolean,
rewardMode: boolean,
apiKey: string,
position: number,
padding: number,
requestUUID: string,
offerwallMode: boolean,
userAttributes: {}
) {
return;
}
/**
* Function to manually show Pollfish
*/
@Cordova()
showPollfish() {
return;
}
/**
* Function to manually hide Pollfish
*/
@Cordova()
hidePollfish() {
return;
}
/**
* Function to set event callbacks
* @param eventName
* @param callback
*/
@Cordova({
sync: true,
})
setEventCallback(eventName: string, callback: (info?: any) => void) {
return;
}
}