forked from LedgerHQ/ledger-live-mobile
-
Notifications
You must be signed in to change notification settings - Fork 0
/
deep-links-test-page.html
170 lines (147 loc) Β· 4.41 KB
/
deep-links-test-page.html
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
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<meta http-equiv="X-UA-Compatible" content="ie=edge" />
<title>Deep Link test page</title>
<style>
body,
html {
width: 100%;
height: 100%;
margin: 0;
}
body {
background-color: #4b84ff19;
display: flex;
flex-direction: column;
justify-content: flex-start;
align-items: flex-start;
font-family: sans-serif;
padding: 16px;
box-sizing: border-box;
color: #6490f1;
}
header {
flex: 0 0 100px
}
.scrollContent {
width: 100%;
flex: 1 0 0%;
overflow: auto;
display: flex;
flex-direction: column;
}
.link {
width: 100%;
display: flex;
flex-direction: row;
justify-content: space-between;
background-color: white;
padding-left: 16px;
border-radius: 50px;
box-sizing: border-box;
margin: 8px 0;
border: none;
color: #6490f1;
height: 50px;
border-radius: 50px;
line-height: 50px;
cursor: pointer;
flex: 0 0 50px;
}
button p {
margin: 0;
padding-right: 8px;
}
:focus {
outline: none
}
input {
min-height: 50px;
height: 50px;
border: none;
background-color: white;
border-radius: 50px;
padding: 0 0 0 16px;
margin: 8px 0;
color: #6490f1;
}
.separator {
display: block;
width: 100px;
height: 4px;
align-self: center;
background-color: #4b84ff19;
margin: 8px 0;
}
</style>
</head>
<body>
<header>
<h2 class="title">LedgerLive - Deep Links</h1>
<p>
Edit the parameters if needed then press on each link to test them.
</p>
</header>
<div class="scrollContent">
<input type="text" value="" placeholder="Edit currency..." id="input">
<button class="link" onclick="onClick('ledgerlive:\/\/')">
<p>ledgerlive://</p> <p>π</p>
</button>
<div class="separator"></div>
<button class="link" onclick="onClick('ledgerlive:\/\/account')">
<p>ledgerlive://account</p> <p>π</p>
</button>
<button class="link" onclick="onClick('ledgerlive:\/\/account?currency=CURRENCY_PARAM')">
<p>ledgerlive://account?currency=<b class="currencyName">bitcoin</b></p> <p>π</p>
</button>
<div class="separator"></div>
<button class="link" onclick="onClick('ledgerlive:\/\/send')">
<p>ledgerlive://send</p>
<p>π</p>
</button>
<button class="link" onclick="onClick('ledgerlive:\/\/send?currency=CURRENCY_PARAM')">
<p>ledgerlive://send?currency=<b class="currencyName">bitcoin</b></p>
<p>π</p>
</button>
<div class="separator"></div>
<button class="link" onclick="onClick('ledgerlive:\/\/receive')">
<p>ledgerlive://receive</p>
<p>π</p>
</button>
<button class="link" onclick="onClick('ledgerlive:\/\/receive?currency=CURRENCY_PARAM')">
<p>ledgerlive://receive?currency=<b class="currencyName">bitcoin</b></p>
<p>π</p>
</button>
<div class="separator"></div>
<button class="link" onclick="onClick('ledgerlive:\/\/buy')">
<p>ledgerlive://buy</p>
<p>π</p>
</button>
<button class="link" onclick="onClick('ledgerlive:\/\/buy/CURRENCY_PARAM')">
<p>ledgerlive://buy/<b class="currencyName">bitcoin</b></p>
<p>π</p>
</button>
<div class="separator"></div>
<button class="link" onclick="onClick('ledgerlive:\/\/swap')">
<p>ledgerlive://swap</p>
<p>π</p>
</button>
</div>
<script>
let currency = "bitcoin";
function onClick(url) {
window.open(url.replace(/CURRENCY_PARAM/, currency), "_blank");
}
function onChangeCurrency(evt) {
currency = evt.target.value.toLowerCase();
Array.from(document.querySelectorAll("b.currencyName")).forEach(el => el.innerHTML = currency)
}
window.onload = () => {
document.getElementById("input").onchange = onChangeCurrency;
}
</script>
</body>
</html>