Skip to content

Commit

Permalink
add support for cordova & browser apis
Browse files Browse the repository at this point in the history
  • Loading branch information
ThrownLemon committed Oct 11, 2022
1 parent e38985f commit cb03896
Show file tree
Hide file tree
Showing 9 changed files with 208 additions and 54 deletions.
34 changes: 25 additions & 9 deletions config.xml
Original file line number Diff line number Diff line change
Expand Up @@ -7,24 +7,38 @@
<author email="[email protected]" href="https://conceal.network">
Conceal Network
</author>
<content src="index.html" />

<!-- Access -->
<!-- Allow Intent -->
<content src="index.html" />
<access origin="*" />
<allow-intent href="http://*/*" />
<allow-intent href="https://*/*" />
<allow-navigation href="https://wallet.conceal.network" />
<allow-intent href="http://*/*" />
<allow-intent href="https://*/*" />
<allow-intent href="tel:*" />
<allow-intent href="sms:*" />
<allow-intent href="mailto:*" />
<allow-intent href="geo:*" />

<!-- Android Preferences -->
<platform name="android">
<!-- Permissions -->

<!-- Allow Intent -->
<allow-intent href="market:*"/>
<edit-config file="AndroidManifest.xml" mode="merge" target="/manifest/uses-permission">
</edit-config>

<!-- Android Permissions -->
<config-file target="AndroidManifest.xml" parent="/*">
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.READ_CLIPBOARD" />
<uses-permission android:name="android.permission.WRITE_CLIPBOARD"/>
<uses-permission android:name="android.permission.CAMERA" />
<uses-feature android:name="android.hardware.camera2" android:required="false" />
<uses-feature android:name="android.hardware.camera2.autofocus" android:required="false" />
</config-file>

<!-- Preferences -->
<preference name="android-targetSdkVersion" value="33"/>
<preference name="AndroidXEnabled" value="true" />
<preference name="scheme" value="https" />
<preference name="hostname" value="wallet.conceal.network" />
<preference name="AndroidWindowSplashScreenAnimatedIcon" value="res/screen/android/splashscreen.xml" />
<preference name="AndroidWindowSplashScreenBackground" value="#333333" />
<preference name="Fullscreen" value="false"/>
Expand All @@ -33,6 +47,7 @@
<preference name="StatusBarStyle" value="lightcontent"/>
<preference name="NavigationBarBackgroundColor" value="#111111"/>
<preference name="NavigationBarLight" value="false"/>

<!-- Icons -->
<resource-file src="res/values/colors.xml" target="/app/src/main/res/values/colors.xml"/>
<icon background="@color/background" density="ldpi" foreground="res/icon/android/ldpi-foreground.png" />
Expand All @@ -41,6 +56,7 @@
<icon background="@color/background" density="xhdpi" foreground="res/icon/android/xhdpi-foreground.png" />
<icon background="@color/background" density="xxhdpi" foreground="res/icon/android/xxhdpi-foreground.png" />
<icon background="@color/background" density="xxxhdpi" foreground="res/icon/android/xxxhdpi-foreground.png" />

</platform>

</widget>
46 changes: 10 additions & 36 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 2 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,17 +18,14 @@
},
"cordova": {
"plugins": {
"cordova-plugin-advanced-http": {
"ANDROIDBLACKLISTSECURESOCKETPROTOCOLS": "SSLv3,TLSv1"
}
"cordova-plugin-android-permissions": {}
},
"platforms": [
"android"
]
},
"devDependencies": {
"cordova-android": "^11.0.0",
"cordova-plugin-advanced-http": "^3.3.1",
"cordova-plugin-file": "^7.0.0"
"cordova-plugin-android-permissions": "^1.1.4"
}
}
4 changes: 0 additions & 4 deletions www/.gitignore

This file was deleted.

97 changes: 97 additions & 0 deletions www/css/index.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,97 @@
* {
-webkit-tap-highlight-color: rgba(0,0,0,0);
}

body {
-webkit-touch-callout: none;
-webkit-text-size-adjust: none;
-webkit-user-select: none;
background-color:#E4E4E4;
background-image:linear-gradient(top, #A7A7A7 0%, #E4E4E4 51%);
background-image:-webkit-linear-gradient(top, #A7A7A7 0%, #E4E4E4 51%);
background-image:-ms-linear-gradient(top, #A7A7A7 0%, #E4E4E4 51%);
background-image:-webkit-gradient(
linear,
left top,
left bottom,
color-stop(0, #A7A7A7),
color-stop(0.51, #E4E4E4)
);
background-attachment:fixed;
font-family:'HelveticaNeue-Light', 'HelveticaNeue', Helvetica, Arial, sans-serif;
font-size:12px;
height:100%;
margin:0px;
padding:0px;
text-transform:uppercase;
width:100%;

background-color:#32383d;
font-family: 'RobotoRegular', 'Droid Sans', 'Segoe UI', Segoe, 'San Francisco', 'Helvetica Neue', Helvetica, Arial, Geneva, sans-serif;
font-size:12px;
}

.app {
background: url(../images/cordova.png) no-repeat center top;
position: absolute;
left: 50%;
top: 50%;
height: 50px;
width: 225px;
text-align: center;
padding: 180px 0px 0px 0px;
margin: -115px 0px 0px -112px;
}

@media screen and (min-aspect-ratio: 1/1) and (min-width:400px) {
.app {
background-position:left center;
padding:75px 0px 75px 170px;
margin:-90px 0px 0px -198px;
}
}

h1 {
font-size:24px;
font-weight:normal;
margin:0px;
overflow:visible;
padding:0px;
text-align:center;
}

.event {
border-radius:4px;
-webkit-border-radius:4px;
color:#FFFFFF;
font-size:12px;
margin:0px 30px;
padding:2px 0px;
}

.event.listening {
background-color:#333333;
display:block;
}

.event.received {
background-color:#4B946A;
display:none;
}

@keyframes fade {
from { opacity: 1.0; }
50% { opacity: 0.4; }
to { opacity: 1.0; }
}

@-webkit-keyframes fade {
from { opacity: 1.0; }
50% { opacity: 0.4; }
to { opacity: 1.0; }
}

.blink {
animation:fade 3000ms infinite;
-webkit-animation:fade 3000ms infinite;
}
Binary file added www/images/cordova.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
28 changes: 28 additions & 0 deletions www/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
<!DOCTYPE html>
<html>
<head>
<!-- Customize the content security policy in the meta tag below as needed. Add 'unsafe-inline' to default-src to enable inline JavaScript. -->
<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 *">

<meta http-equiv="content-type" content="text/html; charset=UTF-8" />
<meta name="format-detection" content="telephone=no">
<meta name="msapplication-tap-highlight" content="no">
<meta name="viewport" content="user-scalable=no, initial-scale=1, maximum-scale=1, minimum-scale=1, width=device-width">
<link rel="stylesheet" type="text/css" href="css/index.css">
<title>CordovaHostedApp</title>
</head>
<body>
Verifying connectivity..
<a id="bkpLink" href="https://wallet.conceal.network">wallet.conceal.network</a>

<div class="app">
<h1>Apache Cordova</h1>
<div id="deviceready" class="blink">
<p class="event listening">Connecting to Device</p>
<p class="event received">Device is Ready</p>
</div>
</div>
<script type="text/javascript" src="cordova.js"></script>
<script type="text/javascript" src="scripts/index.js"></script>
</body>
</html>
42 changes: 42 additions & 0 deletions www/scripts/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
var app = {
// Application Constructor
initialize: function () {
this.bindEvents();
},
bindEvents: function () {
document.addEventListener('deviceready', this.onDeviceReady, false);
},
onDeviceReady: function () {
app.receivedEvent('deviceready');
// Here, we redirect to the web site.
var targetUrl = "https://wallet.conceal.network/?platform=" + cordova.platformId;
var bkpLink = document.getElementById("bkpLink");
bkpLink.setAttribute("href", targetUrl);
bkpLink.text = targetUrl;
window.location.replace(targetUrl);

// get camera permission
var permissions = cordova.plugins.permissions;
permissions.requestPermission(permissions.CAMERA, success, error);

function error() {
console.warn('Camera permission is not turned on');
}

function success( status ) {
if( !status.hasPermission ) error();
}

},
// Note: This code is taken from the Cordova CLI template.
receivedEvent: function (id) {
var parentElement = document.getElementById(id);
var listeningElement = parentElement.querySelector('.listening');
var receivedElement = parentElement.querySelector('.received');
listeningElement.setAttribute('style', 'display:none;');
receivedElement.setAttribute('style', 'display:block;');
console.log('Received Event: ' + id);
}
};

app.initialize();
4 changes: 4 additions & 0 deletions www/scripts/platformOverrides.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
/*
This file is replaced with platform-specific code from the /merges folder.
More info at http://taco.visualstudio.com/en-us/docs/configure-app/#Content.
*/

0 comments on commit cb03896

Please sign in to comment.