|
@@ -22,7 +22,8 @@ export class SettingsPage {
|
|
revocationCertificate:string;
|
|
revocationCertificate:string;
|
|
email: string;
|
|
email: string;
|
|
keyid;
|
|
keyid;
|
|
-
|
|
+ userId;
|
|
|
|
+ email1: string;
|
|
constructor(
|
|
constructor(
|
|
public navCtrl: NavController,
|
|
public navCtrl: NavController,
|
|
public toastCtrl: ToastController,
|
|
public toastCtrl: ToastController,
|
|
@@ -34,9 +35,20 @@ export class SettingsPage {
|
|
private openpgp: PgpKeyServerProvider,
|
|
private openpgp: PgpKeyServerProvider,
|
|
private gun: P2pDatabaseGunProvider,
|
|
private gun: P2pDatabaseGunProvider,
|
|
) {
|
|
) {
|
|
|
|
+ this.init();
|
|
this.loadValuesFromStorage();
|
|
this.loadValuesFromStorage();
|
|
|
|
|
|
}
|
|
}
|
|
|
|
+ private async init() {
|
|
|
|
+ this.userId = await this.storage.get("userId");
|
|
|
|
+ console.log("email of teh user is FIRST ONE", this.email);
|
|
|
|
+ if(!this.email){
|
|
|
|
+ const email = await this.gun.getEmail(this.userId);
|
|
|
|
+ this.email1 = email.email;
|
|
|
|
+ console.log("email of the user is", this.email1);
|
|
|
|
+ await this.storage.set("email", this.email1);
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
|
|
async loadValuesFromStorage() {
|
|
async loadValuesFromStorage() {
|
|
this.privateKey = await this.storage.get("privateKey");
|
|
this.privateKey = await this.storage.get("privateKey");
|
|
@@ -97,12 +109,17 @@ export class SettingsPage {
|
|
await this.openpgp.publishPubKey(this.publicKey);
|
|
await this.openpgp.publishPubKey(this.publicKey);
|
|
this.showToast("Publc key published");
|
|
this.showToast("Publc key published");
|
|
|
|
|
|
- const userId = await this.storage.get("userId");
|
|
+
|
|
- await this.gun.setEmail(userId, this.email);
|
|
+ await this.gun.setEmail(this.userId, this.email);
|
|
|
|
|
|
- const email = await this.gun.getEmail(userId);
|
|
+ const email = await this.gun.getEmail(this.userId);
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+
|
|
exportPrivateKey() {
|
|
exportPrivateKey() {
|
|
if (this.privateKey.length) {
|
|
if (this.privateKey.length) {
|
|
this.sharing
|
|
this.sharing
|