@@ -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,35 +125,16 @@ 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− })
128+ onFullScreenRequested : function (request) {
129+ request.accept()
130+ if (request.toggleOn)
131+ window.showFullScreen()
132+ else
133+ window.showNormal()
144134 }
145135
146136 }
147137
148− Connections {
149− target: UriHandler
150−
151− onOpened: {
152− console.log('Open from UriHandler')
153−
154− if (uris.length > 0) {
155− if (uris[0].match(/^cinny:\/\/sso\/\?loginToken=.*/)) {
156− webView.url = "http://localhost:19999/" + uris[0].replace("cinny://sso/", "");
157− }
158− }
159− }
160− }
161−
162138 WebChannel {
163139 id: channel
164140 registeredObjects: [webChannelObject]
@@ -183,36 +159,6 @@ MainView {
183159 setCurrentTheme(themeName)
184160 }
185161 }
186−
187− Component {
188− id: jsDialogComponent
189−
190− Dialog {
191−
192− id: jsDialog
193−
194− title: i18n.tr("Javascript Dialog")
195− property var message
196−
197− signal dialogAccepted()
198− signal dialogRejected()
199−
200− Label {
201− wrapMode: Text.WordWrap
202− text: jsDialog.message
203− }
204−
205− Button {
206− text: i18n.tr("Yes")
207− color: UbuntuColors.green
208− onClicked: () => dialogAccepted()
209− }
210− Button {
211− text: i18n.tr("Cancel")
212− onClicked: () => dialogRejected()
213− }
214− }
215− }
216162 }
217163 }
218164
@@ -224,36 +170,5 @@ MainView {
224170 appSettings.pushToken = token
225171 webChannelObject.matrixPushTokenChanged();
226172 }
227−
228− function sendPushNotification(icon, title, body) {
229− var req = new XMLHttpRequest();
230− req.open("post", "https://push.ubports.com/notify", true);
231− req.setRequestHeader("Content-type", "application/json");
232− req.onreadystatechange = function() {
233− if ( req.readyState === XMLHttpRequest.DONE ) {
234− console.log("✍ Answer:", req.responseText);
235− }
236− }
237− var approxExpire = new Date ();
238− approxExpire.setUTCMinutes(approxExpire.getUTCMinutes()+10);
239− req.send(JSON.stringify({
240− "appid" : "cinny.nitanmarcel_cinny",
241− "expire_on": approxExpire.toISOString(),
242− "token": appSettings.pushToken,
243− "data": {
244− "notification": {
245− "card": {
246− "icon": icon,
247− "summary": title,
248− "body": body,
249− "popup": true,
250− "persist": true
251− },
252− "vibrate": true,
253− "sound": true
254− }
255− }
256− }));
257− }
258173 }
259174}