!2232 【RDB端云】退账号场景,开库时注册监听

Merge pull request !2232 from Hollokin/master
This commit is contained in:
openharmony_ci 2024-09-02 12:18:40 +00:00 committed by Gitee
commit b81d8d3266
No known key found for this signature in database
GPG Key ID: 173E9B9CA92EEF8F
4 changed files with 9 additions and 4 deletions

View File

@ -27,6 +27,7 @@ public:
FEATURE_INIT = EVT_CLOUD,
GET_SCHEMA,
LOCAL_CHANGE,
CLEAN_DATA,
CLOUD_SYNC,
DATA_CHANGE,
SET_SEARCHABLE,

View File

@ -211,6 +211,11 @@ void CloudServiceImpl::DoClean(int32_t user, const SchemaMeta &schemaMeta, int32
ZLOGE("store null, storeId:%{public}s", meta.GetStoreAlias().c_str());
continue;
}
DistributedData::StoreInfo storeInfo;
storeInfo.bundleName = meta.bundleName;
storeInfo.user = atoi(meta.user.c_str());
storeInfo.storeName = meta.storeId;
EventCenter::GetInstance().PostEvent(std::make_unique<CloudEvent>(CloudEvent::CLEAN_DATA, storeInfo));
auto status = store->Clean({}, action, "");
if (status != E_OK) {
ZLOGW("remove device data status:%{public}d, user:%{public}d, bundleName:%{public}s, "

View File

@ -99,10 +99,7 @@ void KVDBServiceImpl::Init()
auto process = [this](const Event &event) {
const auto &evt = static_cast<const CloudEvent &>(event);
const auto &storeInfo = evt.GetStoreInfo();
StoreMetaData meta;
meta.storeId = storeInfo.storeName;
meta.bundleName = storeInfo.bundleName;
meta.user = std::to_string(storeInfo.user);
StoreMetaData meta(storeInfo);
meta.deviceId = DMAdapter::GetInstance().GetLocalDevice().uuid;
if (!MetaDataManager::GetInstance().LoadMeta(meta.GetKey(), meta, true)) {
if (meta.user == "0") {
@ -132,6 +129,7 @@ void KVDBServiceImpl::Init()
store->RegisterDetailProgressObserver(nullptr);
};
EventCenter::GetInstance().Subscribe(CloudEvent::CLOUD_SYNC, process);
EventCenter::GetInstance().Subscribe(CloudEvent::CLEAN_DATA, process);
}
void KVDBServiceImpl::RegisterKvServiceInfo()

View File

@ -120,6 +120,7 @@ RdbServiceImpl::RdbServiceImpl()
store->RegisterDetailProgressObserver(GetCallbacks(meta.tokenId, storeInfo.storeName));
};
EventCenter::GetInstance().Subscribe(CloudEvent::CLOUD_SYNC, process);
EventCenter::GetInstance().Subscribe(CloudEvent::CLEAN_DATA, process);
EventCenter::GetInstance().Subscribe(CloudEvent::MAKE_QUERY, [](const Event& event) {
auto& evt = static_cast<const MakeQueryEvent&>(event);