Skip to content

Commit 6135700

Browse files
authored
Merge pull request #9959 from cmgustavo/bug/copay-to-clipboard-02
fix(clipboard): missing catch for unsupported devices
2 parents 8e54e84 + ba03620 commit 6135700

File tree

2 files changed

+18
-12
lines changed

2 files changed

+18
-12
lines changed

src/pages/home/home.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -489,7 +489,7 @@ export class HomePage {
489489
this.slideDown = true;
490490
})
491491
.catch(err => {
492-
this.logger.warn('Paste from clipboard err: ', err);
492+
this.logger.warn('Paste from clipboard: ', err);
493493
});
494494
}
495495

src/providers/clipboard/clipboard.ts

Lines changed: 17 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ export class ClipboardProvider {
3030
} else if (this.isElectron) {
3131
return this.electronProvider.readFromClipboard();
3232
} else {
33-
return Promise.reject('Not supported');
33+
return Promise.reject('Not supported for this device');
3434
}
3535
}
3636

@@ -53,15 +53,21 @@ export class ClipboardProvider {
5353
}
5454

5555
public clearClipboardIfValidData(typeArray: string[]): void {
56-
this.getData().then(data => {
57-
const validDataFromClipboard = this.incomingDataProvider.parseData(data);
58-
if (
59-
validDataFromClipboard &&
60-
typeArray.indexOf(validDataFromClipboard.type) != -1
61-
) {
62-
this.logger.info('Cleaning clipboard data');
63-
this.clear(); // clear clipboard data if exist
64-
}
65-
});
56+
this.getData()
57+
.then(data => {
58+
const validDataFromClipboard = this.incomingDataProvider.parseData(
59+
data
60+
);
61+
if (
62+
validDataFromClipboard &&
63+
typeArray.indexOf(validDataFromClipboard.type) != -1
64+
) {
65+
this.logger.info('Cleaning clipboard data: done');
66+
this.clear(); // clear clipboard data if exist
67+
}
68+
})
69+
.catch(err => {
70+
this.logger.debug('Cleaning clipboard data: ', err);
71+
});
6672
}
6773
}

0 commit comments

Comments
 (0)