on xenial help sign in
Remove here

This removes here location thingy

commit5ec8526cc958e3510fb32286a1053391445bdda7 authorMarius Gripsgard <marius@ubports.com> dateThu 4 Apr 2019, 01:18 (8 years ago) parent3e105e0
7 files changed−284
plugins/AccountsService/AccountsService.cpp−29 plugins/AccountsService/AccountsService.h−16 qml/Wizard/Pages/here-terms.qml−126 tests/mocks/AccountsService/AccountsService.cpp−36 tests/mocks/AccountsService/AccountsService.h−20 tests/plugins/AccountsService/client.cpp−28 tests/qmltests/Wizard/tst_Wizard.qml−29
plugins/AccountsService/AccountsService.cpp−29
@@ -25,7 +25,6 @@
2525#include <glib.h>
2626
2727#define IFACE_ACCOUNTS_USER QStringLiteral("org.freedesktop.Accounts.User")
28−#define IFACE_LOCATION_HERE QStringLiteral("com.ubuntu.location.providers.here.AccountsService")
2928#define IFACE_UBUNTU_INPUT QStringLiteral("com.ubuntu.AccountsService.Input")
3029#define IFACE_UBUNTU_SECURITY QStringLiteral("com.ubuntu.AccountsService.SecurityPrivacy")
3130#define IFACE_UBUNTU_SECURITY_OLD QStringLiteral("com.ubuntu.touch.AccountsService.SecurityPrivacy")
@@ -93,8 +92,6 @@ AccountsService::AccountsService(QObject* parent, const QString &user)
9392 registerProperty(IFACE_ACCOUNTS_USER, PROP_EMAIL, QStringLiteral("emailChanged"));
9493 registerProperty(IFACE_ACCOUNTS_USER, PROP_REAL_NAME, QStringLiteral("realNameChanged"));
9594 registerProperty(IFACE_ACCOUNTS_USER, PROP_INPUT_SOURCES, QStringLiteral("keymapsChanged"));
96− registerProperty(IFACE_LOCATION_HERE, PROP_LICENSE_ACCEPTED, QStringLiteral("hereEnabledChanged"));
97− registerProperty(IFACE_LOCATION_HERE, PROP_LICENSE_BASE_PATH, QStringLiteral("hereLicensePathChanged"));
9895 registerProperty(IFACE_UBUNTU_SECURITY, PROP_ENABLE_FINGERPRINT_IDENTIFICATION, QStringLiteral("enableFingerprintIdentificationChanged"));
9996 registerProperty(IFACE_UBUNTU_SECURITY, PROP_ENABLE_LAUNCHER_WHILE_LOCKED, QStringLiteral("enableLauncherWhileLockedChanged"));
10097 registerProperty(IFACE_UBUNTU_SECURITY, PROP_ENABLE_INDICATORS_WHILE_LOCKED, QStringLiteral("enableIndicatorsWhileLockedChanged"));
@@ -216,32 +213,6 @@ AccountsService::PasswordDisplayHint AccountsService::passwordDisplayHint() cons
216213 return (PasswordDisplayHint)value.toInt();
217214}
218215
219−bool AccountsService::hereEnabled() const
220−{
221− auto value = getProperty(IFACE_LOCATION_HERE, PROP_LICENSE_ACCEPTED);
222− return value.toBool();
223−}
224−
225−void AccountsService::setHereEnabled(bool enabled)
226−{
227− setProperty(IFACE_LOCATION_HERE, PROP_LICENSE_ACCEPTED, enabled);
228−}
229−
230−QString AccountsService::hereLicensePath() const
231−{
232− auto value = getProperty(IFACE_LOCATION_HERE, PROP_LICENSE_BASE_PATH);
233− QString hereLicensePath = value.toString();
234− if (hereLicensePath.isEmpty() || !QFile::exists(hereLicensePath))
235− hereLicensePath = QStringLiteral("");
236− return hereLicensePath;
237−}
238−
239−bool AccountsService::hereLicensePathValid() const
240−{
241− auto value = getProperty(IFACE_LOCATION_HERE, PROP_LICENSE_BASE_PATH);
242− return !value.toString().isNull();
243−}
244−
245216QString AccountsService::realName() const
246217{
247218 auto value = getProperty(IFACE_ACCOUNTS_USER, PROP_REAL_NAME);
plugins/AccountsService/AccountsService.h−16
@@ -66,16 +66,6 @@ class AccountsService: public QObject
6666 READ failedFingerprintLogins
6767 WRITE setFailedFingerprintLogins
6868 NOTIFY failedFingerprintLoginsChanged)
69− Q_PROPERTY(bool hereEnabled
70− READ hereEnabled
71− WRITE setHereEnabled
72− NOTIFY hereEnabledChanged)
73− Q_PROPERTY(QString hereLicensePath
74− READ hereLicensePath
75− NOTIFY hereLicensePathChanged)
76− Q_PROPERTY(bool hereLicensePathValid // qml sees a null string as "", so we use proxy setting for that
77− READ hereLicensePathValid
78− NOTIFY hereLicensePathChanged)
7969 Q_PROPERTY(QString realName READ realName WRITE setRealName NOTIFY realNameChanged)
8070 Q_PROPERTY(QString email READ email WRITE setEmail NOTIFY emailChanged)
8171 Q_PROPERTY(QStringList keymaps READ keymaps WRITE setKeymaps NOTIFY keymapsChanged)
@@ -106,10 +96,6 @@ public:
10696 void setFailedLogins(uint failedLogins);
10797 uint failedFingerprintLogins() const;
10898 void setFailedFingerprintLogins(uint failedFingerprintLogins);
109− bool hereEnabled() const;
110− void setHereEnabled(bool enabled);
111− QString hereLicensePath() const;
112− bool hereLicensePathValid() const;
11399 QString realName() const;
114100 void setRealName(const QString &realName);
115101 QString email() const;
@@ -129,8 +115,6 @@ Q_SIGNALS:
129115 void passwordDisplayHintChanged();
130116 void failedLoginsChanged();
131117 void failedFingerprintLoginsChanged();
132− void hereEnabledChanged();
133− void hereLicensePathChanged();
134118 void realNameChanged();
135119 void emailChanged();
136120 void keymapsChanged();
qml/Wizard/Pages/here-terms.qmldeleted−126
@@ -1,126 +0,0 @@
1−/*
2− * Copyright (C) 2014-2016 Canonical, Ltd.
3− *
4− * This program is free software; you can redistribute it and/or modify
5− * it under the terms of the GNU General Public License as published by
6− * the Free Software Foundation; version 3.
7− *
8− * This program is distributed in the hope that it will be useful,
9− * but WITHOUT ANY WARRANTY; without even the implied warranty of
10− * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11− * GNU General Public License for more details.
12− *
13− * You should have received a copy of the GNU General Public License
14− * along with this program. If not, see <http://www.gnu.org/licenses/>.
15− */
16−
17−import QtQuick 2.4
18−import Ubuntu.Components 1.3
19−import Ubuntu.Web 0.2
20−import ".." as LocalComponents
21−
22−LocalComponents.Page {
23− objectName: "hereTermsPage"
24−
25− title: i18n.tr("Terms & Conditions")
26− customBack: true
27− customTitle: true
28−
29− onBackClicked: {
30− if (webview.visible) {
31− showBrowser(false);
32− } else {
33− pageStack.prev();
34− }
35− }
36−
37− function showBrowser(show) {
38− if (show) {
39− label1.visible = false;
40− label2.visible = false;
41− label3.visible = false;
42− label4.visible = false;
43− webview.visible = true;
44− } else {
45− webview.visible = false;
46− label1.visible = true;
47− label2.visible = true;
48− label3.visible = true;
49− label4.visible = true;
50− }
51− }
52−
53− Column {
54− id: column
55− anchors.fill: content
56− anchors.leftMargin: staticMargin
57− anchors.rightMargin: wideMode ? parent.rightMargin : staticMargin
58− spacing: units.gu(3)
59−
60− Label {
61− id: label1
62− anchors.left: parent.left
63− anchors.right: parent.right
64− wrapMode: Text.Wrap
65− color: textColor
66− fontSize: "small"
67− font.weight: Font.Light
68− lineHeight: 1.2
69− text: i18n.tr("Your device uses positioning technologies provided by HERE.")
70− }
71−
72− Label {
73− id: label2
74− anchors.left: parent.left
75− anchors.right: parent.right
76− wrapMode: Text.Wrap
77− color: textColor
78− fontSize: "small"
79− font.weight: Font.Light
80− lineHeight: 1.2
81− text: i18n.tr("To provide you with positioning services and to improve their quality, HERE collects information about nearby cell towers and Wi-Fi hotspots around your current location whenever your position is being found.")
82− }
83−
84− Label {
85− id: label3
86− anchors.left: parent.left
87− anchors.right: parent.right
88− wrapMode: Text.Wrap
89− color: textColor
90− fontSize: "small"
91− font.weight: Font.Light
92− lineHeight: 1.2
93− text: i18n.tr("The information collected is used to analyze the service and to improve the use of service, but not to identify you personally.")
94− }
95−
96− Label {
97− id: label4
98− anchors.left: parent.left
99− anchors.right: parent.right
100− wrapMode: Text.Wrap
101− color: textColor
102− fontSize: "small"
103− font.weight: Font.Light
104− lineHeight: 1.2
105− linkColor: UbuntuColors.orange
106− text: i18n.tr("By continuing, you agree to the HERE platform %1 and %2.")
107− .arg("<a href=\"http://here.com/terms/service-terms\">" + i18n.tr("Service Terms") + "</a>")
108− .arg("<a href=\"http://here.com/privacy/privacy-policy\">" + i18n.tr("Privacy Policy") + "</a>");
109− onLinkActivated: {
110− showBrowser(true);
111− webview.url = link;
112− }
113− }
114−
115− WebView {
116− id: webview
117− objectName: "webview"
118− anchors.left: parent.left
119− anchors.right: parent.right
120− anchors.leftMargin: -leftMargin
121− anchors.rightMargin: -rightMargin
122− height: parent.height
123− visible: false
124− }
125− }
126−}
tests/mocks/AccountsService/AccountsService.cpp−36
@@ -31,8 +31,6 @@ AccountsService::AccountsService(QObject* parent)
3131 m_failedFingerprintLogins(0),
3232 m_demoEdges(false),
3333 m_demoEdgesCompleted(),
34− m_hereEnabled(false),
35− m_hereLicensePath(""),
3634 m_usersModel(new UsersModel(this))
3735{
3836}
@@ -176,40 +174,6 @@ void AccountsService::setFailedFingerprintLogins(uint failedFingerprintLogins)
176174 failedFingerprintLoginsChanged();
177175}
178176
179−bool AccountsService::hereEnabled() const
180−{
181− return m_hereEnabled;
182−}
183−
184−void AccountsService::setHereEnabled(bool enabled)
185−{
186− m_hereEnabled = enabled;
187− hereEnabledChanged();
188−}
189−
190−QString AccountsService::hereLicensePath() const
191−{
192− return m_hereLicensePath;
193−}
194−
195−void AccountsService::setHereLicensePath(const QString &path)
196−{
197− // Path should always be valid (this code is all synchronous)
198− if (path == " ") {
199− m_hereLicensePath = QString::null;
200− } else if (path.isNull()) { // because qml collapses null and empty
201− m_hereLicensePath = "";
202− } else {
203− m_hereLicensePath = path;
204− }
205− hereLicensePathChanged();
206−}
207−
208−bool AccountsService::hereLicensePathValid() const
209−{
210− return !m_hereLicensePath.isNull();
211−}
212−
213177QString AccountsService::realName() const
214178{
215179 return m_realName;
tests/mocks/AccountsService/AccountsService.h−20
@@ -69,17 +69,6 @@ class AccountsService: public QObject
6969 READ failedFingerprintLogins
7070 WRITE setFailedFingerprintLogins
7171 NOTIFY failedFingerprintLoginsChanged)
72− Q_PROPERTY(bool hereEnabled
73− READ hereEnabled
74− WRITE setHereEnabled
75− NOTIFY hereEnabledChanged)
76− Q_PROPERTY(QString hereLicensePath
77− READ hereLicensePath
78− WRITE setHereLicensePath // only available in mock
79− NOTIFY hereLicensePathChanged)
80− Q_PROPERTY(bool hereLicensePathValid // qml sees a null string as "", so we use proxy setting for that
81− READ hereLicensePathValid
82− NOTIFY hereLicensePathChanged)
8372 Q_PROPERTY(QString realName READ realName WRITE setRealName NOTIFY realNameChanged)
8473 Q_PROPERTY(QString email READ email WRITE setEmail NOTIFY emailChanged)
8574 Q_PROPERTY(QStringList keymaps
@@ -118,11 +107,6 @@ public:
118107 void setFailedLogins(uint failedLogins);
119108 uint failedFingerprintLogins() const;
120109 void setFailedFingerprintLogins(uint failedFingerprintLogins);
121− bool hereEnabled() const;
122− void setHereEnabled(bool enabled);
123− QString hereLicensePath() const;
124− void setHereLicensePath(const QString &path);
125− bool hereLicensePathValid() const;
126110 QString realName() const;
127111 void setRealName(const QString &realName);
128112 QString email() const;
@@ -142,8 +126,6 @@ Q_SIGNALS:
142126 void passwordDisplayHintChanged();
143127 void failedLoginsChanged();
144128 void failedFingerprintLoginsChanged();
145− void hereEnabledChanged();
146− void hereLicensePathChanged();
147129 void realNameChanged();
148130 void emailChanged();
149131 void keymapsChanged();
@@ -159,8 +141,6 @@ private:
159141 uint m_failedFingerprintLogins;
160142 bool m_demoEdges;
161143 QStringList m_demoEdgesCompleted;
162− bool m_hereEnabled;
163− QString m_hereLicensePath;
164144 QString m_realName;
165145 QStringList m_kbdMap;
166146 QString m_email;
tests/plugins/AccountsService/client.cpp−28
@@ -116,10 +116,6 @@ private Q_SLOTS:
116116 QCOMPARE(session.failedLogins(), (uint)0);
117117 session.setFailedLogins(5);
118118 QCOMPARE(session.failedLogins(), (uint)5);
119−
120− QCOMPARE(session.hereEnabled(), false);
121− session.setHereEnabled(true);
122− QCOMPARE(session.hereEnabled(), true);
123119 }
124120
125121 void testMarkDemoEdgeCompleted()
@@ -231,30 +227,6 @@ private Q_SLOTS:
231227 QTRY_COMPARE(session.passwordDisplayHint(), AccountsService::Numeric);
232228 }
233229
234− void testAsynchronousChangeForLicenseAccepted()
235− {
236− AccountsService session(this, QTest::currentTestFunction());
237−
238− QCOMPARE(session.hereEnabled(), false);
239− ASSERT_DBUS_CALL(m_userInterface->asyncCall("Set",
240− "com.ubuntu.location.providers.here.AccountsService",
241− "LicenseAccepted",
242− dbusVariant(true)));
243− QTRY_COMPARE(session.hereEnabled(), true);
244− }
245−
246− void testAsynchronousChangeForLicenseBasePath()
247− {
248− AccountsService session(this, QTest::currentTestFunction());
249−
250− QCOMPARE(session.hereLicensePath(), QString());
251− ASSERT_DBUS_CALL(m_userInterface->asyncCall("Set",
252− "com.ubuntu.location.providers.here.AccountsService",
253− "LicenseBasePath",
254− dbusVariant("/")));
255− QTRY_COMPARE(session.hereLicensePath(), QString("/"));
256− }
257−
258230 void testAsynchronousChangeForBackgroundFile()
259231 {
260232 AccountsService session(this, QTest::currentTestFunction());
tests/qmltests/Wizard/tst_Wizard.qml−29
@@ -87,8 +87,6 @@ Item {
8787 }
8888
8989 function setup() {
90− AccountsService.hereEnabled = false;
91− AccountsService.hereLicensePath = Qt.resolvedUrl("licenses");
9290 i18n.language = "en";
9391 MockQOfono.setModems(["sim1"], [false], []);
9492 MockQOfono.available = true;
@@ -395,7 +393,6 @@ Item {
395393 function test_locationGpsOnly() {
396394 var page = goToPage("locationPage");
397395 var gpsCheck = findChild(page, "gpsCheckLabel");
398− var hereCheck = findChild(page, "hereCheckLabel");
399396 var nopeCheck = findChild(page, "nopeCheckLabel");
400397
401398 var locationActionGroup = findInvisibleChild(page, "locationActionGroup");
@@ -404,11 +401,9 @@ Item {
404401
405402 tap(gpsCheck);
406403 tryCompare(gpsCheck, "checked", true);
407− tryCompare(hereCheck, "checked", false);
408404 tryCompare(nopeCheck, "checked", false);
409405
410406 tap(findChild(page, "forwardButton"));
411− tryCompare(AccountsService, "hereEnabled", false);
412407 tryCompare(activateLocationSpy, "count", 1)
413408 tryCompare(activateGPSSpy, "count", 1)
414409 }
@@ -416,7 +411,6 @@ Item {
416411 function test_locationNope() {
417412 var page = goToPage("locationPage");
418413 var gpsCheck = findChild(page, "gpsCheckLabel");
419− var hereCheck = findChild(page, "hereCheckLabel");
420414 var nopeCheck = findChild(page, "nopeCheckLabel");
421415
422416 var locationActionGroup = findInvisibleChild(page, "locationActionGroup");
@@ -425,36 +419,13 @@ Item {
425419
426420 tap(nopeCheck);
427421 tryCompare(gpsCheck, "checked", false);
428− tryCompare(hereCheck, "checked", false);
429422 tryCompare(nopeCheck, "checked", true);
430423
431424 tap(findChild(page, "forwardButton"));
432− tryCompare(AccountsService, "hereEnabled", false);
433425 tryCompare(activateLocationSpy, "count", 0);
434426 tryCompare(activateGPSSpy, "count", 0);
435427 }
436428
437− function test_locationHere() {
438− var page = goToPage("locationPage");
439− var gpsCheck = findChild(page, "gpsCheckLabel");
440− var hereCheck = findChild(page, "hereCheckLabel");
441− var nopeCheck = findChild(page, "nopeCheckLabel");
442−
443− var locationActionGroup = findInvisibleChild(page, "locationActionGroup");
444− activateLocationSpy.target = locationActionGroup.location;
445− activateGPSSpy.target = locationActionGroup.gps;
446−
447− // no tap because HERE is the default
448− tryCompare(gpsCheck, "checked", false);
449− tryCompare(hereCheck, "checked", true);
450− tryCompare(nopeCheck, "checked", false);
451−
452− tap(findChild(page, "forwardButton"));
453− tryCompare(AccountsService, "hereEnabled", true);
454− tryCompare(activateLocationSpy, "count", 1);
455− tryCompare(activateGPSSpy, "count", 1);
456− }
457−
458429 function test_timezonePage() {
459430 var page = goToPage("tzPage");
460431 verify(page);