Skip to content

Commit

Permalink
fix no error on modal close , publish v2.1.17-beta.1
Browse files Browse the repository at this point in the history
  • Loading branch information
SteveMieskoski committed Dec 23, 2020
1 parent 9952d63 commit 23255ed
Show file tree
Hide file tree
Showing 7 changed files with 32 additions and 22 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
### Release v2.1.17-beta.1
- fix error not getting thrown on window close, if desired behavior

### Release v2.1.16
- fix invalid import

Expand Down
19 changes: 12 additions & 7 deletions example/app/src/App.vue
Original file line number Diff line number Diff line change
Expand Up @@ -276,6 +276,7 @@ export default {
// Initialize the provider based client
// this.connect = new mewConnect.Provider({windowClosedError: true, rpcUrl: 'ws://127.0.0.1:8545', /*chainId: 1*/});
// 859569f6decc4446a5da1bb680e7e9cf
this.connect = new mewConnect.Provider({windowClosedError: true, rpcUrl: 'wss://mainnet.infura.io/ws/v3/859569f6decc4446a5da1bb680e7e9cf'});
this.connect.on('popupWindowClosed', () =>{
console.log(`popup window closed EVENT`);
Expand Down Expand Up @@ -339,17 +340,21 @@ export default {
animateConnectedNotifier() {
this.connect.showConnectedNotice();
},
onClick() {
this.ethereum.send('eth_requestAccounts').then(accounts => {
console.log(`User's address is ${accounts[0]}`);
this.userAddress = accounts[0];
});
console.log(mewConnect.Provider.isConnected); // todo remove dev item
// this.ethereum.enable().then(accounts => {
async onClick() {
try{
const accounts = await this.ethereum.enable()
console.log(`User's address is ${accounts[0]}`);
this.userAddress = accounts[0];
} catch(e){
console.error(e); // todo replace with proper error
}
// this.ethereum.send('eth_requestAccounts').then(accounts => {
// console.log(`User's address is ${accounts[0]}`);
// this.userAddress = accounts[0];
// })
// .catch(console.error)
console.log(mewConnect.Provider.isConnected); // todo remove dev item
},
disconnect() {
this.connect.disconnect();
Expand Down
2 changes: 1 addition & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "@myetherwallet/mewconnect-web-client",
"homepage": "https://github.com/myetherwallet/MEWconnect-web-client",
"version": "2.1.16",
"version": "2.1.17-beta.1",
"main": "./dist/index.js",
"module": "./src/index.js",
"scripts": {
Expand Down
25 changes: 13 additions & 12 deletions src/connectProvider/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -91,20 +91,21 @@ export default class Integration extends EventEmitter {
);
}

async enable() {
return new Promise((resolve, reject) => {
nativeCheck().then(res => {
if (res) {
if (MEWconnectWallet.getConnectionState() === 'disconnected') {
this.returnPromise = this.enabler();
}
if (typeof popUpCreator.popupWindowOpen === 'boolean') {
popUpCreator.showDialog();
}
return resolve(this.returnPromise);
enable() {
return nativeCheck().then(res => {
if (res) {
if (MEWconnectWallet.getConnectionState() === 'disconnected') {
this.returnPromise = this.enabler();
}
});
if (typeof popUpCreator.popupWindowOpen === 'boolean') {
popUpCreator.showDialog();
}
return this.returnPromise;
}
});
// return new Promise((resolve, reject) => {
//
// });
}

enabler() {
Expand Down

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions src/connectWindow/popUpCreator.js
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,7 @@ export default class PopUpCreator {
this.popupWindowOpen = null;
this.hideNotifier();
this.closePopupWindow();
this.windowClosedListener();
}

createQrCodeModal() {
Expand Down

0 comments on commit 23255ed

Please sign in to comment.