Skip to content

Instantly share code, notes, and snippets.

@marcinwasowicz
Created December 14, 2023 13:05
Show Gist options
  • Save marcinwasowicz/7f04bd592dd4a800adbc96b720e200b7 to your computer and use it in GitHub Desktop.
Save marcinwasowicz/7f04bd592dd4a800adbc96b720e200b7 to your computer and use it in GitHub Desktop.
Temporary testing for CSA Metadata event emitter.
diff --git a/native/cpp/CommonCpp/NativeModules/DraftStoreOperations.h b/native/cpp/CommonCpp/NativeModules/DraftStoreOperations.h
index 4ae8b8e3a..2d6d6dff3 100644
--- a/native/cpp/CommonCpp/NativeModules/DraftStoreOperations.h
+++ b/native/cpp/CommonCpp/NativeModules/DraftStoreOperations.h
@@ -1,5 +1,6 @@
#pragma once
+#include "CommServicesAuthMetadataEmitter.h"
#include "DatabaseManager.h"
#include <jsi/jsi.h>
@@ -20,6 +21,10 @@ public:
text{payload.getProperty(rt, "text").asString(rt).utf8(rt)} {
}
virtual void execute() override {
+ CommServicesAuthMetadataEmitter::sendAuthMetadataToJS(
+ rust::String(std::string("accessToken")),
+ rust::String(std::string("userID")),
+ rust::String(std::string("deviceID")));
DatabaseManager::getQueryExecutor().updateDraft(this->key, this->text);
}
diff --git a/native/redux/redux-setup.js b/native/redux/redux-setup.js
index f86933d69..50542e366 100644
--- a/native/redux/redux-setup.js
+++ b/native/redux/redux-setup.js
@@ -40,6 +40,7 @@ import {
} from './action-types.js';
import { defaultState } from './default-state.js';
import { remoteReduxDevServerConfig } from './dev-tools.js';
+import { getCommServicesAuthMetadataEmitter } from './event-emitters.js';
import { persistConfig, setPersistor } from './persist.js';
import { onStateDifference } from './redux-debug-utils.js';
import { processDBStoreOperations } from './redux-utils.js';
@@ -344,6 +345,14 @@ function fixUnreadActiveThread(
};
}
+const listener = getCommServicesAuthMetadataEmitter().addListener(
+ 'commServicesAuthMetadata',
+ obj => {
+ console.log(obj);
+ },
+);
+console.log(listener);
+
let appLastBecameInactive = 0;
function appBecameInactive() {
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment