|
|
|
@ -2,6 +2,8 @@
|
|
|
|
|
#include <flutter/method-channel.h> |
|
|
|
|
#include <flutter/application.h> |
|
|
|
|
#include <QSettings> |
|
|
|
|
#include <QMetaType> |
|
|
|
|
#include <QVariant> |
|
|
|
|
|
|
|
|
|
SharedPreferencesAuroraPlugin::SharedPreferencesAuroraPlugin(): settings( |
|
|
|
|
QString::fromStdString(Application::GetID().orgname),
|
|
|
|
@ -117,9 +119,7 @@ void SharedPreferencesAuroraPlugin::onGetStringList(const MethodCall &call)
|
|
|
|
|
const auto [key, value] = this->getArguments(call); |
|
|
|
|
|
|
|
|
|
std::vector<Encodable> vec; |
|
|
|
|
QStringList list = settings.value(key, "") |
|
|
|
|
.toString() |
|
|
|
|
.split(","); |
|
|
|
|
QStringList list = settings.value(key, {}).toStringList(); |
|
|
|
|
|
|
|
|
|
for (const auto& item : list) |
|
|
|
|
{ |
|
|
|
@ -137,18 +137,15 @@ void SharedPreferencesAuroraPlugin::onSetStringList(const MethodCall &call)
|
|
|
|
|
{ |
|
|
|
|
const auto [key, value] = this->getArguments(call); |
|
|
|
|
const auto vec = value.GetList(); |
|
|
|
|
std::stringstream ss; |
|
|
|
|
|
|
|
|
|
QStringList strings; |
|
|
|
|
|
|
|
|
|
for (const auto& item : vec) |
|
|
|
|
{ |
|
|
|
|
if (ss.rdbuf()->in_avail() != 0)
|
|
|
|
|
{ |
|
|
|
|
ss << ","; |
|
|
|
|
} |
|
|
|
|
ss << item; |
|
|
|
|
strings.append(QString::fromStdString(item.GetString())); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
settings.setValue(key, QString::fromStdString(ss.str())); |
|
|
|
|
settings.setValue(key, strings); |
|
|
|
|
call.SendSuccessResponse(true); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|