Skip to content

Commit cb03896

Browse files
committed
add support for cordova & browser apis
1 parent e38985f commit cb03896

File tree

9 files changed

+208
-54
lines changed

9 files changed

+208
-54
lines changed

config.xml

Lines changed: 25 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -7,24 +7,38 @@
77
<author email="[email protected]" href="https://conceal.network">
88
Conceal Network
99
</author>
10-
<content src="index.html" />
1110

12-
<!-- Access -->
11+
<!-- Allow Intent -->
12+
<content src="index.html" />
1313
<access origin="*" />
14-
<allow-intent href="http://*/*" />
15-
<allow-intent href="https://*/*" />
14+
<allow-navigation href="https://wallet.conceal.network" />
15+
<allow-intent href="http://*/*" />
16+
<allow-intent href="https://*/*" />
17+
<allow-intent href="tel:*" />
18+
<allow-intent href="sms:*" />
19+
<allow-intent href="mailto:*" />
20+
<allow-intent href="geo:*" />
1621

1722
<!-- Android Preferences -->
1823
<platform name="android">
19-
<!-- Permissions -->
24+
25+
<!-- Allow Intent -->
2026
<allow-intent href="market:*"/>
21-
<edit-config file="AndroidManifest.xml" mode="merge" target="/manifest/uses-permission">
22-
</edit-config>
27+
28+
<!-- Android Permissions -->
29+
<config-file target="AndroidManifest.xml" parent="/*">
30+
<uses-permission android:name="android.permission.INTERNET" />
31+
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
32+
<uses-permission android:name="android.permission.READ_CLIPBOARD" />
33+
<uses-permission android:name="android.permission.WRITE_CLIPBOARD"/>
34+
<uses-permission android:name="android.permission.CAMERA" />
35+
<uses-feature android:name="android.hardware.camera2" android:required="false" />
36+
<uses-feature android:name="android.hardware.camera2.autofocus" android:required="false" />
37+
</config-file>
38+
2339
<!-- Preferences -->
2440
<preference name="android-targetSdkVersion" value="33"/>
2541
<preference name="AndroidXEnabled" value="true" />
26-
<preference name="scheme" value="https" />
27-
<preference name="hostname" value="wallet.conceal.network" />
2842
<preference name="AndroidWindowSplashScreenAnimatedIcon" value="res/screen/android/splashscreen.xml" />
2943
<preference name="AndroidWindowSplashScreenBackground" value="#333333" />
3044
<preference name="Fullscreen" value="false"/>
@@ -33,6 +47,7 @@
3347
<preference name="StatusBarStyle" value="lightcontent"/>
3448
<preference name="NavigationBarBackgroundColor" value="#111111"/>
3549
<preference name="NavigationBarLight" value="false"/>
50+
3651
<!-- Icons -->
3752
<resource-file src="res/values/colors.xml" target="/app/src/main/res/values/colors.xml"/>
3853
<icon background="@color/background" density="ldpi" foreground="res/icon/android/ldpi-foreground.png" />
@@ -41,6 +56,7 @@
4156
<icon background="@color/background" density="xhdpi" foreground="res/icon/android/xhdpi-foreground.png" />
4257
<icon background="@color/background" density="xxhdpi" foreground="res/icon/android/xxhdpi-foreground.png" />
4358
<icon background="@color/background" density="xxxhdpi" foreground="res/icon/android/xxxhdpi-foreground.png" />
59+
4460
</platform>
4561

4662
</widget>

package-lock.json

Lines changed: 10 additions & 36 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -18,17 +18,14 @@
1818
},
1919
"cordova": {
2020
"plugins": {
21-
"cordova-plugin-advanced-http": {
22-
"ANDROIDBLACKLISTSECURESOCKETPROTOCOLS": "SSLv3,TLSv1"
23-
}
21+
"cordova-plugin-android-permissions": {}
2422
},
2523
"platforms": [
2624
"android"
2725
]
2826
},
2927
"devDependencies": {
3028
"cordova-android": "^11.0.0",
31-
"cordova-plugin-advanced-http": "^3.3.1",
32-
"cordova-plugin-file": "^7.0.0"
29+
"cordova-plugin-android-permissions": "^1.1.4"
3330
}
3431
}

www/.gitignore

Lines changed: 0 additions & 4 deletions
This file was deleted.

www/css/index.css

Lines changed: 97 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,97 @@
1+
* {
2+
-webkit-tap-highlight-color: rgba(0,0,0,0);
3+
}
4+
5+
body {
6+
-webkit-touch-callout: none;
7+
-webkit-text-size-adjust: none;
8+
-webkit-user-select: none;
9+
background-color:#E4E4E4;
10+
background-image:linear-gradient(top, #A7A7A7 0%, #E4E4E4 51%);
11+
background-image:-webkit-linear-gradient(top, #A7A7A7 0%, #E4E4E4 51%);
12+
background-image:-ms-linear-gradient(top, #A7A7A7 0%, #E4E4E4 51%);
13+
background-image:-webkit-gradient(
14+
linear,
15+
left top,
16+
left bottom,
17+
color-stop(0, #A7A7A7),
18+
color-stop(0.51, #E4E4E4)
19+
);
20+
background-attachment:fixed;
21+
font-family:'HelveticaNeue-Light', 'HelveticaNeue', Helvetica, Arial, sans-serif;
22+
font-size:12px;
23+
height:100%;
24+
margin:0px;
25+
padding:0px;
26+
text-transform:uppercase;
27+
width:100%;
28+
29+
background-color:#32383d;
30+
font-family: 'RobotoRegular', 'Droid Sans', 'Segoe UI', Segoe, 'San Francisco', 'Helvetica Neue', Helvetica, Arial, Geneva, sans-serif;
31+
font-size:12px;
32+
}
33+
34+
.app {
35+
background: url(../images/cordova.png) no-repeat center top;
36+
position: absolute;
37+
left: 50%;
38+
top: 50%;
39+
height: 50px;
40+
width: 225px;
41+
text-align: center;
42+
padding: 180px 0px 0px 0px;
43+
margin: -115px 0px 0px -112px;
44+
}
45+
46+
@media screen and (min-aspect-ratio: 1/1) and (min-width:400px) {
47+
.app {
48+
background-position:left center;
49+
padding:75px 0px 75px 170px;
50+
margin:-90px 0px 0px -198px;
51+
}
52+
}
53+
54+
h1 {
55+
font-size:24px;
56+
font-weight:normal;
57+
margin:0px;
58+
overflow:visible;
59+
padding:0px;
60+
text-align:center;
61+
}
62+
63+
.event {
64+
border-radius:4px;
65+
-webkit-border-radius:4px;
66+
color:#FFFFFF;
67+
font-size:12px;
68+
margin:0px 30px;
69+
padding:2px 0px;
70+
}
71+
72+
.event.listening {
73+
background-color:#333333;
74+
display:block;
75+
}
76+
77+
.event.received {
78+
background-color:#4B946A;
79+
display:none;
80+
}
81+
82+
@keyframes fade {
83+
from { opacity: 1.0; }
84+
50% { opacity: 0.4; }
85+
to { opacity: 1.0; }
86+
}
87+
88+
@-webkit-keyframes fade {
89+
from { opacity: 1.0; }
90+
50% { opacity: 0.4; }
91+
to { opacity: 1.0; }
92+
}
93+
94+
.blink {
95+
animation:fade 3000ms infinite;
96+
-webkit-animation:fade 3000ms infinite;
97+
}

www/images/cordova.png

21.3 KB
Loading

www/index.html

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
<!DOCTYPE html>
2+
<html>
3+
<head>
4+
<!-- Customize the content security policy in the meta tag below as needed. Add 'unsafe-inline' to default-src to enable inline JavaScript. -->
5+
<meta http-equiv="Content-Security-Policy" content="default-src 'self' data: gap: https://wallet.conceal.network 'unsafe-eval'; style-src 'self' 'unsafe-inline'; media-src *">
6+
7+
<meta http-equiv="content-type" content="text/html; charset=UTF-8" />
8+
<meta name="format-detection" content="telephone=no">
9+
<meta name="msapplication-tap-highlight" content="no">
10+
<meta name="viewport" content="user-scalable=no, initial-scale=1, maximum-scale=1, minimum-scale=1, width=device-width">
11+
<link rel="stylesheet" type="text/css" href="css/index.css">
12+
<title>CordovaHostedApp</title>
13+
</head>
14+
<body>
15+
Verifying connectivity..
16+
<a id="bkpLink" href="https://wallet.conceal.network">wallet.conceal.network</a>
17+
18+
<div class="app">
19+
<h1>Apache Cordova</h1>
20+
<div id="deviceready" class="blink">
21+
<p class="event listening">Connecting to Device</p>
22+
<p class="event received">Device is Ready</p>
23+
</div>
24+
</div>
25+
<script type="text/javascript" src="cordova.js"></script>
26+
<script type="text/javascript" src="scripts/index.js"></script>
27+
</body>
28+
</html>

www/scripts/index.js

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
var app = {
2+
// Application Constructor
3+
initialize: function () {
4+
this.bindEvents();
5+
},
6+
bindEvents: function () {
7+
document.addEventListener('deviceready', this.onDeviceReady, false);
8+
},
9+
onDeviceReady: function () {
10+
app.receivedEvent('deviceready');
11+
// Here, we redirect to the web site.
12+
var targetUrl = "https://wallet.conceal.network/?platform=" + cordova.platformId;
13+
var bkpLink = document.getElementById("bkpLink");
14+
bkpLink.setAttribute("href", targetUrl);
15+
bkpLink.text = targetUrl;
16+
window.location.replace(targetUrl);
17+
18+
// get camera permission
19+
var permissions = cordova.plugins.permissions;
20+
permissions.requestPermission(permissions.CAMERA, success, error);
21+
22+
function error() {
23+
console.warn('Camera permission is not turned on');
24+
}
25+
26+
function success( status ) {
27+
if( !status.hasPermission ) error();
28+
}
29+
30+
},
31+
// Note: This code is taken from the Cordova CLI template.
32+
receivedEvent: function (id) {
33+
var parentElement = document.getElementById(id);
34+
var listeningElement = parentElement.querySelector('.listening');
35+
var receivedElement = parentElement.querySelector('.received');
36+
listeningElement.setAttribute('style', 'display:none;');
37+
receivedElement.setAttribute('style', 'display:block;');
38+
console.log('Received Event: ' + id);
39+
}
40+
};
41+
42+
app.initialize();

www/scripts/platformOverrides.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
/*
2+
This file is replaced with platform-specific code from the /merges folder.
3+
More info at http://taco.visualstudio.com/en-us/docs/configure-app/#Content.
4+
*/

0 commit comments

Comments
 (0)