send log_in and log_out event

This commit is contained in:
Son NK
2022-11-03 14:56:01 +01:00
parent 7d0aa4ee8e
commit 03d0effe18
3 changed files with 35 additions and 2 deletions
+1
View File
@@ -15,6 +15,7 @@
"activeTab",
"storage",
"contextMenus",
"nativeMessaging",
"https://*.simplelogin.io/*",
"http://*/*",
"https://*/*"
+14 -1
View File
@@ -27,7 +27,9 @@
v-show="showSLButton"
target="_blank"
>
<br /><font-awesome-icon icon="bug" /> Report an issue
<br />
<font-awesome-icon icon="bug" />
Report an issue
</a>
</small>
</td>
@@ -165,6 +167,17 @@ export default {
await SLStorage.remove(SLStorage.SETTINGS.API_KEY);
EventManager.broadcast(EventManager.EVENT.SETTINGS_CHANGED);
Navigation.clearHistoryAndNavigateTo(Navigation.PATH.LOGIN);
try {
console.log("send log out event to host app");
let r = await browser.runtime.sendNativeMessage("application.id", {
message: {
logged_out: {},
},
});
} catch (error) {
console.info("can't send data to native app", error);
}
},
async setMailToUri() {
+20 -1
View File
@@ -93,7 +93,8 @@
class="btn btn-outline-primary btn-sm"
@click="createRandomAlias"
>
<font-awesome-icon icon="random" /> OR create a totally random alias
<font-awesome-icon icon="random" />
OR create a totally random alias
</button>
</div>
@@ -257,6 +258,24 @@ export default {
this.apiUrl = await SLStorage.get(SLStorage.SETTINGS.API_URL);
this.apiKey = await SLStorage.get(SLStorage.SETTINGS.API_KEY);
if (this.apiKey) {
try {
console.log("send api key to host app");
let r = await browser.runtime.sendNativeMessage("application.id", {
message: {
logged_in: {
data: {
api_key: this.apiKey,
api_url: this.apiUrl,
},
},
},
});
} catch (error) {
console.info("can't send data to native app", error);
}
}
this.contentElem = document.querySelector(".app > .content");
await this.getUserOptions();