Skip to content

Commit

Permalink
Uplift of #27450 (squashed) to beta
Browse files Browse the repository at this point in the history
  • Loading branch information
brave-builds committed Feb 7, 2025
1 parent 207c7cc commit ccb38fa
Showing 1 changed file with 7 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ export class SettingsBraveSyncCodeDialogElement extends SettingsBraveSyncCodeDia
];
}

private syncCode: string;
private syncCode: string | undefined;
private codeType: 'qr' | 'words' | 'choose' | 'input' | null;
private syncCodeValidationError: string;
private syncCodeWordCount_: number;
Expand All @@ -89,16 +89,12 @@ export class SettingsBraveSyncCodeDialogElement extends SettingsBraveSyncCodeDia
syncBrowserProxy_: BraveSyncBrowserProxy = BraveSyncBrowserProxy.getInstance();

async computeSyncCodeWordCount_() {
if (this.codeType !== 'input') {
return
}

if (!this.syncCode) {
if (this.codeType !== 'words' && this.codeType !== 'input') {
return
}

this.syncCodeWordCount_ =
await this.syncBrowserProxy_.getWordsCount(this.syncCode)
await this.syncBrowserProxy_.getWordsCount(this.syncCode ?? '')
}

isCodeType(askingType: string) {
Expand All @@ -125,6 +121,10 @@ export class SettingsBraveSyncCodeDialogElement extends SettingsBraveSyncCodeDia
}

handleSyncCodeCopy_() {
if (!this.syncCode) {
console.warn('Skip handleSyncCodeCopy because code words are empty')
return
}
window.clearTimeout(this.hasCopiedSyncCodeTimer_)
navigator.clipboard.writeText(this.syncCode)
this.hasCopiedSyncCode_ = true
Expand Down

0 comments on commit ccb38fa

Please sign in to comment.