@@ -21,6 +21,7 @@ import Ubuntu.Components.Popups 1.3
2121import Ubuntu.PushNotifications 0.1
2222import Ubuntu.Content 1.3
2323import Ubuntu.DownloadManager 1.2
24+import QtQuick.Window 2.12
2425import QtQuick.Layouts 1.3
2526import Qt.labs.settings 1.0
2627import QtQml 2.12
@@ -42,7 +43,7 @@ MainView {
4243 ? UbuntuApplication
4344 .inputMethod
4445 .keyboardRectangle
45− .height / (units.gridUnit / 8)
46+ .height / Screen.devicePixelRatio
4647 : 0
4748 Behavior on bottomMargin {
4849 NumberAnimation {
@@ -62,11 +63,8 @@ MainView {
6263 }
6364
6465 Component.onCompleted: function () {
65− theme.name = "" // set system theme
66+ theme.name = ""
6667 appSettings.systemTheme = theme.name.substring(theme.name.lastIndexOf(".")+1)
67−
68− //appSettings.pushAppId = 'cinny.nitanmarcel_cinny'
69− console.log("appSettings.pushAppId " + appSettings.pushAppId)
7068 }
7169 onActiveChanged: () => {appSettings.windowActive = mainView.active}
7270
@@ -96,9 +94,8 @@ MainView {
9694 id : webView
9795 anchors.fill : parent
9896 focus : true
99− url : "http://localhost:19999/" // Qt.resolvedUrl(Backend.getIndexPath())
97+ url : "http://localhost:19999/"
10098 webChannel: channel
101− //zoomFactor : 2.5
10299 settings.pluginsEnabled : true
103100 settings.javascriptEnabled : true
104101 profile : WebEngineProfile {
@@ -107,8 +104,6 @@ MainView {
107104 persistentStoragePath : "/home/phablet/.local/share/cinny.nitanmarcel/QWebEngine"
108105
109106 onDownloadRequested: function (download) {
110− console.log("Downloading")
111− console.log(download.path)
112107 download.accept()
113108 }
114109
@@ -130,19 +125,6 @@ MainView {
130125 })
131126 }
132127
133− onJavaScriptDialogRequested: function (request) {
134− request.accepted = true;
135− var popup = PopupUtils.open(jsDialogComponent, this, {"title": request.title, "message": request.message})
136− popup.dialogAccepted.connect(function () {
137− request.dialogAccept()
138− PopupUtils.close(popup)
139− })
140− popup.dialogRejected.connect(function () {
141− request.dialogReject()
142− PopupUtils.close(popup)
143− })
144− }
145−
146128 onFullScreenRequested : function (request) {
147129 request.accept()
148130 if (request.toggleOn)
@@ -153,20 +135,6 @@ MainView {
153135
154136 }
155137
156− Connections {
157− target: UriHandler
158−
159− onOpened: {
160− console.log('Open from UriHandler')
161−
162− if (uris.length > 0) {
163− if (uris[0].match(/^cinny:\/\/sso\/\?loginToken=.*/)) {
164− webView.url = "http://localhost:19999/" + uris[0].replace("cinny://sso/", "");
165− }
166− }
167− }
168− }
169−
170138 WebChannel {
171139 id: channel
172140 registeredObjects: [webChannelObject]
@@ -191,36 +159,6 @@ MainView {
191159 setCurrentTheme(themeName)
192160 }
193161 }
194−
195− Component {
196− id: jsDialogComponent
197−
198− Dialog {
199−
200− id: jsDialog
201−
202− title: i18n.tr("Javascript Dialog")
203− property var message
204−
205− signal dialogAccepted()
206− signal dialogRejected()
207−
208− Label {
209− wrapMode: Text.WordWrap
210− text: jsDialog.message
211− }
212−
213− Button {
214− text: i18n.tr("Yes")
215− color: UbuntuColors.green
216− onClicked: () => dialogAccepted()
217− }
218− Button {
219− text: i18n.tr("Cancel")
220− onClicked: () => dialogRejected()
221− }
222− }
223− }
224162 }
225163 }
226164
@@ -232,36 +170,5 @@ MainView {
232170 appSettings.pushToken = token
233171 webChannelObject.matrixPushTokenChanged();
234172 }
235−
236− function sendPushNotification(icon, title, body) {
237− var req = new XMLHttpRequest();
238− req.open("post", "https://push.ubports.com/notify", true);
239− req.setRequestHeader("Content-type", "application/json");
240− req.onreadystatechange = function() {
241− if ( req.readyState === XMLHttpRequest.DONE ) {
242− console.log("✍ Answer:", req.responseText);
243− }
244− }
245− var approxExpire = new Date ();
246− approxExpire.setUTCMinutes(approxExpire.getUTCMinutes()+10);
247− req.send(JSON.stringify({
248− "appid" : "cinny.nitanmarcel_cinny",
249− "expire_on": approxExpire.toISOString(),
250− "token": appSettings.pushToken,
251− "data": {
252− "notification": {
253− "card": {
254− "icon": icon,
255− "summary": title,
256− "body": body,
257− "popup": true,
258− "persist": true
259− },
260− "vibrate": true,
261− "sound": true
262− }
263− }
264− }));
265− }
266173 }
267174}