Skip to content

Commit 2133d07

Browse files
Merge pull request #14 from Instabug/feature/integrate-instabug-cordova-with-sample-app
Add instabug-cordova integration to cordova-sample-app
2 parents 13adadf + 8577abc commit 2133d07

File tree

7 files changed

+137
-14
lines changed

7 files changed

+137
-14
lines changed

sample-app/config.xml

Lines changed: 15 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,28 @@
11
<?xml version='1.0' encoding='utf-8'?>
2-
<widget id="com.instabug.cordova-sample-app" version="1.0.0" xmlns="http://www.w3.org/ns/widgets"
3-
>
2+
<widget id="com.instabug.cordova-sample-app" version="1.0.0" xmlns="http://www.w3.org/ns/widgets">
43
<name>HelloCordova</name>
54
<description>
65
A sample Apache Cordova application that responds to the deviceready event.
76
</description>
87
<author email="[email protected]" href="http://cordova.io">
98
Apache Cordova Team
109
</author>
11-
<content src="index.html"/>
12-
<plugin name="cordova-plugin-whitelist" spec="1"/>
13-
<access origin="*"/>
14-
<allow-intent href="http://*/*"/>
15-
<allow-intent href="https://*/*"/>
16-
<allow-intent href="tel:*"/>
17-
<allow-intent href="sms:*"/>
18-
<allow-intent href="mailto:*"/>
19-
<allow-intent href="geo:*"/>
10+
<content src="index.html" />
11+
<plugin name="cordova-plugin-whitelist" spec="1" />
12+
<access origin="*" />
13+
<allow-intent href="http://*/*" />
14+
<allow-intent href="https://*/*" />
15+
<allow-intent href="tel:*" />
16+
<allow-intent href="sms:*" />
17+
<allow-intent href="mailto:*" />
18+
<allow-intent href="geo:*" />
2019
<platform name="android">
21-
<allow-intent href="market:*"/>
20+
<allow-intent href="market:*" />
2221
</platform>
2322
<platform name="ios">
24-
<allow-intent href="itms:*"/>
25-
<allow-intent href="itms-apps:*"/>
23+
<allow-intent href="itms:*" />
24+
<allow-intent href="itms-apps:*" />
2625
</platform>
26+
<plugin name="com.instabug.cordova.plugin" spec="https://github.com/Instabug/instabug-cordova#master" />
27+
<plugin name="cordova-plugin-dialogs" spec="~1.3.2" />
2728
</widget>

sample-app/www/css/second.css

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
html, body {
2+
margin: 0;
3+
padding: 0;
4+
background: #243143;
5+
}
6+
7+
.second {
8+
padding: 20px 0;
9+
color: #f2f2f2;
10+
}
11+
12+
.mylist ul {
13+
color: #f2f2f2;
14+
text-align: center;
15+
list-style: none;
16+
margin: 0;
17+
padding: 0;
18+
}
19+
20+
.mylist ul li {
21+
margin: 10px;
22+
background: #bdbfc3;
23+
color: #405372;
24+
font-size: 18px;
25+
padding: 5px;
26+
}
27+
28+
.iblogo {
29+
width: 100px;
30+
height: 100px;
31+
display: block;
32+
margin: 0 auto;
33+
}

sample-app/www/img/bg.png

21.4 KB
Loading

sample-app/www/index.html

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@
3535
<meta name="viewport"
3636
content="user-scalable=no, initial-scale=1, maximum-scale=1, minimum-scale=1, width=device-width">
3737
<link rel="stylesheet" type="text/css" href="css/index.css">
38+
<link rel="stylesheet" type="text/css" href="css/second.css">
3839
<title>Hello World</title>
3940
</head>
4041
<body>
@@ -43,9 +44,14 @@ <h1>Apache Cordova</h1>
4344
<div id="deviceready" class="blink">
4445
<p class="event listening">Connecting to Device</p>
4546
<p class="event received">Device is Ready</p>
47+
<button id="feedback">
48+
<a href="second.html">second</a>
49+
</button>
50+
4651
</div>
4752
</div>
4853
<script type="text/javascript" src="cordova.js"></script>
4954
<script type="text/javascript" src="js/index.js"></script>
55+
<script type="text/javascript" src="js/instabugSample.js"></script>
5056
</body>
5157
</html>

sample-app/www/js/index.js

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,8 @@ var app = {
2828
// 'pause', 'resume', etc.
2929
onDeviceReady: function () {
3030
this.receivedEvent('deviceready');
31+
// document.getElementById("feedback").addEventListener("click", startInstabug);
32+
initInstabug();
3133
},
3234

3335
// Update DOM on a Received Event
@@ -43,4 +45,25 @@ var app = {
4345
}
4446
};
4547

48+
function initInstabug() {
49+
cordova.plugins.instabug.activate(
50+
{
51+
android: 'ANDROID_TOKEN',
52+
ios: 'IOS_TOKEN'
53+
},
54+
'button',
55+
{
56+
commentRequired: true,
57+
colorTheme: 'light',
58+
enableIntroDialog: false
59+
},
60+
function () {
61+
console.log('Instabug initialized.');
62+
},
63+
function (error) {
64+
console.log('Instabug could not be initialized - ' + error);
65+
}
66+
);
67+
}
68+
4669
app.initialize();

sample-app/www/js/instabugSample.js

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
/**
2+
* Created by hossam on 3/16/17.
3+
*/
4+
5+
function startInstabug() {
6+
// navigator.notification.alert("message", invoke, "title", "button");
7+
invoke();
8+
}
9+
10+
function invoke() {
11+
cordova.plugins.instabug.invoke(
12+
'options'
13+
,
14+
function () {
15+
console.log('Instabug initialized.');
16+
},
17+
function (error) {
18+
console.log('Instabug could not be initialized - ' + error);
19+
}
20+
)
21+
}

sample-app/www/second.html

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
<!DOCTYPE html>
2+
<html>
3+
<head>
4+
<meta http-equiv="Content-Security-Policy"
5+
content="default-src 'self' data: gap: https://ssl.gstatic.com 'unsafe-eval'; style-src 'self' 'unsafe-inline'; media-src *; img-src 'self' data: content:;">
6+
<meta name="format-detection" content="telephone=no">
7+
<meta name="msapplication-tap-highlight" content="no">
8+
<meta name="viewport"
9+
content="user-scalable=no, initial-scale=1, maximum-scale=1, minimum-scale=1, width=device-width">
10+
<link rel="stylesheet" type="text/css" href="css/index.css">
11+
<link rel="stylesheet" type="text/css" href="css/second.css">
12+
<title>Hello World</title>
13+
</head>
14+
<body>
15+
<div class="second">
16+
<h1>Instabug Cordova</h1>
17+
<div class="head">
18+
<h1>instabug</h1>
19+
<img src="img/bg.png" class="iblogo"/>
20+
</div>
21+
<div class="mylist">
22+
<ul>
23+
<li> tem 1</li>
24+
<li>item 2</li>
25+
<li>item 3</li>
26+
<li>item 4</li>
27+
<li>item 5</li>
28+
<li>item 6</li>
29+
<li>item 7</li>
30+
<li>item 3</li>
31+
<li>item 4</li>
32+
<li>item 5</li>
33+
<li>item 6</li>
34+
<li>item 7</li>
35+
</ul>
36+
</div>
37+
</div>
38+
</body>
39+
</html>

0 commit comments

Comments
 (0)