diff --git a/CMakeLists.txt b/CMakeLists.txt index d9c9c51a4d8095e774fa62c43e323442843ca89a..5fa7344b79ccc8c8bcceafbcf521cf958b2f81a0 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -798,6 +798,7 @@ else() MACOSX_BUNDLE_COPYRIGHT "${PROJ_COPYRIGHT}") if(APPSTORE) message(STATUS "app store version") + add_definitions(-DAPPSTORE) set_target_properties(${PROJECT_NAME} PROPERTIES XCODE_ATTRIBUTE_CODE_SIGN_ENTITLEMENTS "${CMAKE_CURRENT_SOURCE_DIR}/resources/entitlements/appstore/Jami.entitlements") else() diff --git a/src/app/appsettingsmanager.h b/src/app/appsettingsmanager.h index 826472cc900bb8ac77103c2682799e2c5271ece0..a12709eac0ed72b32743f674ae56fa2b48eae1ea 100644 --- a/src/app/appsettingsmanager.h +++ b/src/app/appsettingsmanager.h @@ -20,20 +20,21 @@ #pragma once -#include "utils.h" - #include <QMetaEnum> #include <QObject> #include <QString> #include <QStandardPaths> #include <QWindow> // for QWindow::AutomaticVisibility +#include <QSettings> +#include <QDir> #include <QTranslator> extern const QString defaultDownloadPath; // clang-format off -#define KEYS \ +// Common key-value pairs for both APPSTORE and non-APPSTORE builds +#define COMMON_KEYS \ X(MinimizeOnClose, false) \ X(DownloadPath, defaultDownloadPath) \ X(ScreenshotPath, {}) \ @@ -64,11 +65,19 @@ extern const QString defaultDownloadPath; X(ShowMardownOption, false) \ X(ChatViewEnterIsNewLine, false) \ X(ShowSendOption, false) \ - X(Donation2023VisibleDate, "2023-11-27 05:00") \ - X(IsDonationVisible, true) \ - X(Donation2023EndDate, "2024-01-31 00:00") \ X(EnablePtt, false) \ X(PttKeys, 32) +#ifdef APPSTORE +#define KEYS COMMON_KEYS +#else +// Additional key-value pairs for non-APPSTORE builds including donation +// related settings. +#define KEYS COMMON_KEYS \ + X(Donation2023VisibleDate, "2023-11-27 05:00") \ + X(IsDonationVisible, true) \ + X(Donation2023EndDate, "2024-01-31 00:00") +#endif + /* * A class to expose settings keys in both c++ and QML. * Note: this is using a non-constructable class instead of a @@ -106,8 +115,9 @@ public: default: return {}; } } + private: - Settings() = delete; + Settings() = delete; }; Q_DECLARE_METATYPE(Settings::Key) // clang-format on diff --git a/src/app/mainapplication.cpp b/src/app/mainapplication.cpp index ded566d6bc375a7c41a80f8c519a95ff8f8f38be..6594e8eb7125f85c3c6cb59d7557fd6957255b48 100644 --- a/src/app/mainapplication.cpp +++ b/src/app/mainapplication.cpp @@ -200,12 +200,19 @@ MainApplication::init() auto startMinimizedSetting = settingsManager_->getValue(Settings::Key::StartMinimized).toBool(); // The presence of start URI should override the startMinimized setting for this instance. set_startMinimized(startMinimizedSetting && runOptions_[Option::StartUri].isNull()); + #ifdef WITH_WEBENGINE engine_.get()->rootContext()->setContextProperty("WITH_WEBENGINE", QVariant(true)); #else engine_.get()->rootContext()->setContextProperty("WITH_WEBENGINE", QVariant(false)); #endif +#ifdef APPSTORE + engine_.get()->rootContext()->setContextProperty("APPSTORE", QVariant(true)); +#else + engine_.get()->rootContext()->setContextProperty("APPSTORE", QVariant(false)); +#endif + initQmlLayer(); settingsManager_->setValue(Settings::Key::StartMinimized, diff --git a/src/app/settingsview/components/SystemSettingsPage.qml b/src/app/settingsview/components/SystemSettingsPage.qml index a637c8707f2223759bfc36c9a9f9ac16a0d126a9..07d800deb5b0661d77b8df582b99a3a3d6f19e02 100644 --- a/src/app/settingsview/components/SystemSettingsPage.qml +++ b/src/app/settingsview/components/SystemSettingsPage.qml @@ -84,7 +84,7 @@ SettingsPageBase { ToggleSwitch { id: enableDonation Layout.fillWidth: true - visible: new Date() >= new Date(Date.parse("2023-11-01")) + visible: (new Date() >= new Date(Date.parse("2023-11-01")) && !APPSTORE) checked: UtilsAdapter.getAppValue(Settings.Key.IsDonationVisible) labelText: JamiStrings.enableDonation diff --git a/src/app/tipsmodel.cpp b/src/app/tipsmodel.cpp index 914713a61abf00274e41b113a355ae867aca6d0f..516a77bca3acf7c1d869945536ade335664aa8a1 100644 --- a/src/app/tipsmodel.cpp +++ b/src/app/tipsmodel.cpp @@ -75,10 +75,13 @@ TipsModel::reset() beginResetModel(); tips_.clear(); +#ifndef APPSTORE QDate date = QDate::currentDate(); if (date >= QDate::fromString("2023-11-27", "yyyy-MM-dd")) { tips_.append({{"id", "14"}, {"title", tr("Donate")}, {"desc", ""}, {"type", "donation"}}); } +#endif + tips_.append({{"id", "0"}, {"title", tr("Customize")}, {"desc", ""}, {"type", "customize"}}); tips_.append({{"id", "13"}, {"title", tr("Backup account")}, {"desc", ""}, {"type", "backup"}}); tips_.append({{"id", "1"}, diff --git a/src/app/utilsadapter.h b/src/app/utilsadapter.h index 33c10541ad7e99b3c14e02ed15176868cb875cf0..7bafca689ebe804e77dae9eb1c4338d5ba8882bd 100644 --- a/src/app/utilsadapter.h +++ b/src/app/utilsadapter.h @@ -22,13 +22,15 @@ #pragma once -#include <QApplication> -#include <QObject> - #include "qmladapterbase.h" #include "appsettingsmanager.h" #include "qtutils.h" +#include <api/member.h> + +#include <QApplication> +#include <QObject> + #if __has_include(<gio/gio.h>) #include <gio/gio.h> #endif