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 "../components"
import "../js/twemoji.js" as Emoji import "../js/twemoji.js" as Emoji
import "../js/functions.js" as Functions import "../js/functions.js" as Functions
import "../js/debug.js" as Debug
Page { Page {
id: newChatPage id: newChatPage
allowedOrientations: Orientation.All allowedOrientations: Orientation.All
property bool isLoading: true; property bool isLoading: true;
property bool syncSupported: false;
function resetFocus() { function resetFocus() {
contactsSearchField.focus = false; contactsSearchField.focus = false;
@ -39,7 +41,6 @@ Page {
newChatPage.isLoading = false; newChatPage.isLoading = false;
} }
onStatusChanged: { onStatusChanged: {
if (status === PageStatus.Active) { if (status === PageStatus.Active) {
reloadContacts(); 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 { SilicaFlickable {
id: newChatContainer id: newChatContainer
contentHeight: newChatPage.height contentHeight: newChatPage.height
anchors.fill: parent anchors.fill: parent
PullDownMenu { PullDownMenu {
visible: contactsModel.canSynchronizeContacts() visible: contactsModel.canSynchronizeContacts() && newChatPage.syncSupported
MenuItem { MenuItem {
onClicked: { onClicked: {
newChatPage.isLoading = true; newChatPage.isLoading = true;

View file

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

View file

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