Disable contacts sync on Sailfish OS 4.x

This commit is contained in:
Sebastian Wolf 2021-02-18 22:48:01 +01:00
parent 9715e03971
commit b2f2ee5453
No known key found for this signature in database
GPG key ID: CEA9522B5F38A90A
3 changed files with 23 additions and 2 deletions

View file

@ -21,12 +21,14 @@ import Sailfish.Silica 1.0
import "../components"
import "../js/twemoji.js" as Emoji
import "../js/functions.js" as Functions
import "../js/debug.js" as Debug
Page {
id: newChatPage
allowedOrientations: Orientation.All
property bool isLoading: true;
property bool syncSupported: false;
function resetFocus() {
contactsSearchField.focus = false;
@ -39,7 +41,6 @@ Page {
newChatPage.isLoading = false;
}
onStatusChanged: {
if (status === PageStatus.Active) {
reloadContacts();
@ -54,13 +55,26 @@ Page {
}
}
Component.onCompleted: {
// With Sailfish OS 4 we can't get up-to-date contacts andmore. We might need to enter Sailjail eventually...
// Details see https://forum.sailfishos.org/t/4-0-1-45-non-jailed-contacts-sqlite-database-no-longer-updated/4724
var sailfishOSVersion = fernschreiberUtils.getSailfishOSVersion().split(".");
if (parseInt(sailfishOSVersion[0]) < 4) {
Debug.log("Sailfish OS version 3.x - contact sync should still be possible...")
newChatPage.syncSupported = true;
} else {
Debug.log("Sailfish OS version 4.x - contact sync no longer supported...")
newChatPage.syncSupported = false;
}
}
SilicaFlickable {
id: newChatContainer
contentHeight: newChatPage.height
anchors.fill: parent
PullDownMenu {
visible: contactsModel.canSynchronizeContacts()
visible: contactsModel.canSynchronizeContacts() && newChatPage.syncSupported
MenuItem {
onClicked: {
newChatPage.isLoading = true;

View file

@ -29,6 +29,7 @@
#include <QDateTime>
#include <QGeoCoordinate>
#include <QGeoLocation>
#include <QSysInfo>
#define DEBUG_MODULE FernschreiberUtils
#include "debuglog.h"
@ -246,6 +247,11 @@ bool FernschreiberUtils::supportsGeoLocation()
return this->geoPositionInfoSource;
}
QString FernschreiberUtils::getSailfishOSVersion()
{
return QSysInfo::productVersion();
}
void FernschreiberUtils::handleAudioRecorderStatusChanged(QMediaRecorder::Status status)
{
LOG("Audio recorder status changed:" << status);

View file

@ -52,6 +52,7 @@ public:
Q_INVOKABLE void startGeoLocationUpdates();
Q_INVOKABLE void stopGeoLocationUpdates();
Q_INVOKABLE bool supportsGeoLocation();
Q_INVOKABLE QString getSailfishOSVersion();
signals:
void voiceNoteDurationChanged(qlonglong duration);