Skip to content

Commit

Permalink
Merge pull request #320 from vechain/dev
Browse files Browse the repository at this point in the history
v2.0.9
  • Loading branch information
libotony authored Dec 20, 2023
2 parents 93adfb1 + 0f904b8 commit a4fb5a3
Show file tree
Hide file tree
Showing 13 changed files with 339 additions and 159 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@ Compared to Sync v1, the most significant change is that the built-in dApp brows
| | macOS | [Releases](https://github.com/vechain/sync2/releases/latest) |
| | Linux | [Releases](https://github.com/vechain/sync2/releases/latest) |
| Mobile | | |
| | Android | [Releases](https://github.com/vechain/sync2/releases/latest) |
| | iOS | WIP |
| | Android | [Google Play](https://play.google.com/store/apps/details?id=org.vechain.sync2) |
| | iOS | [App Store](https://apps.apple.com/app/6446363029) |

## Port dApps to Sync2

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,6 +1,6 @@
{
"name": "org.vechain.sync2",
"version": "2.0.8",
"version": "2.0.9",
"description": "VeChain Sync2",
"productName": "Sync2",
"cordovaId": "org.vechain.sync2",
Expand Down
2 changes: 1 addition & 1 deletion src-cordova/config.xml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<?xml version='1.0' encoding='utf-8'?>
<widget android-versionCode="200080" id="org.vechain.sync2" ios-CFBundleIdentifier="org.vechain.sync2app" ios-CFBundleVersion="5" version="2.0.8" xmlns="http://www.w3.org/ns/widgets" xmlns:cdv="http://cordova.apache.org/ns/1.0">
<widget android-versionCode="200090" id="org.vechain.sync2" ios-CFBundleIdentifier="org.vechain.sync2app" ios-CFBundleVersion="6" version="2.0.9" xmlns="http://www.w3.org/ns/widgets" xmlns:cdv="http://cordova.apache.org/ns/1.0">
<name>Sync2</name>
<description>VeChain Sync2</description>
<author email="[email protected]" href="http://cordova.io">
Expand Down
2 changes: 1 addition & 1 deletion src/core/vault/vault.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ export function newVault(entity: Entity): Vault {
unlock: key => {
const clearText = vault.decrypt(key)
const words = clearText.toString('utf8').split(' ')
return HDNode.fromMnemonic(words).derive(index).privateKey!
return HDNode.fromMnemonic(words, entity.path).derive(index).privateKey!
}
}
} else {
Expand Down
5 changes: 4 additions & 1 deletion src/i18n/en-us/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,10 @@ export default {
msg_backup_tips_1: 'Write it down in given order',
msg_backup_tips_2: 'Keep it in a secure place',
msg_backup_tips_3: 'No screenshot or screen recording',
label_your_mnemonic: 'Write Down Your Mnemonic Words'
label_your_mnemonic: 'Write Down Your Mnemonic Words',

// notify
msg_wallet_not_found: 'Wallet not found'
},
sign: {
title: 'Sign',
Expand Down
5 changes: 4 additions & 1 deletion src/i18n/zh-cn/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,10 @@ export default {
msg_backup_tips_1: '请按照顺序抄写',
msg_backup_tips_2: '请确保存放于安全的地方',
msg_backup_tips_3: '请勿截图或录制屏幕',
label_your_mnemonic: '抄写您的助记词'
label_your_mnemonic: '抄写您的助记词',

// notify
msg_wallet_not_found: '找不到钱包'
},
sign: {
title: '签名',
Expand Down
78 changes: 78 additions & 0 deletions src/pages/Backup/BackupDialog.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
<template>
<q-dialog
ref="dialog"
@hide="$emit('hide')"
maximized
transition-show="slide-up"
transition-hide="slide-down"
>
<q-card class="column no-wrap">
<page-toolbar
:title="$t('backup.title')"
icon="close"
@action="hide()"
/>
<backup-panel
:wallet-id="walletId"
:words="words"
:meta="meta"
:panel="panel"
@start="next"
@next="next"
@done="onDone"
/>
</q-card>
</q-dialog>
</template>
<script lang="ts">
import Vue from 'vue'
import { QDialog } from 'quasar'
import BackupPanel from './BackupPanel.vue'
import PageToolbar from 'src/components/PageToolbar.vue'
export default Vue.extend({
components: {
QDialog,
PageToolbar,
BackupPanel
},
props: {
walletId: Number,
words: {
type: Array as () => string[],
default: () => []
},
meta: {
type: Object as () => M.Wallet.Meta,
default: () => {}
}
},
data() {
return {
panel: 'notice' as 'notice' | 'words' | 'check' | 'done'
}
},
methods: {
// method is REQUIRED by $q.dialog
show() { (this.$refs.dialog as QDialog).show() },
// method is REQUIRED by $q.dialog
hide() { (this.$refs.dialog as QDialog).hide() },
next() {
switch (this.panel) {
case 'notice':
this.panel = 'words'
break
case 'words':
this.panel = 'check'
break
case 'check':
this.panel = 'done'
break
}
},
onDone() {
this.hide()
}
}
})
</script>
151 changes: 151 additions & 0 deletions src/pages/Backup/BackupPanel.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,151 @@
<template>
<q-tab-panels
class="col"
animated
v-model="panel"
transition-next="jump-up"
>
<q-tab-panel
name="notice"
class="column q-pa-none no-wrap"
>
<page-content
padding
class="col"
innerClass="fit column justify-evenly"
>
<notice />
</page-content>
<page-action>
<q-btn
:label="$t('common.next')"
unelevated
color="primary"
@click="$emit('start')"
/>
</page-action>
</q-tab-panel>
<q-tab-panel
name="words"
class="column q-pa-none no-wrap"
>
<page-content class="col q-pa-sm">
<Words :words="words" />
</page-content>
<page-action>
<q-btn
:label="$t('backup.action_next_verify')"
unelevated
@click="$emit('next')"
color="primary"
/>
</page-action>
</q-tab-panel>
<q-tab-panel
name="check"
class="column q-pa-none no-wrap"
>
<page-content
class="col q-pa-sm"
innerClass="fit"
>
<CheckWords
:words="words"
@checked="$emit('next')"
/>
</page-content>
</q-tab-panel>
<q-tab-panel
name="done"
class="column q-pa-none no-wrap"
>
<page-content
class="column fit"
innerClass="fit column justify-evenly"
>
<q-list class="text-center">
<q-item>
<q-item-section>
<q-icon
size="4rem"
class="q-mx-auto"
name="verified_user"
color="positive"
/>
</q-item-section>
</q-item>
<q-item>
<q-item-section>
<q-item-label class="text-h6 text-dark">{{$t('backup.label_backed_up')}}</q-item-label>
</q-item-section>
</q-item>
<q-item>
<q-item-section>
<q-item-label class="text-body1 text-dark">{{$t('backup.msg_backed_up')}}</q-item-label>
</q-item-section>
</q-item>

</q-list>
</page-content>
<page-action>
<q-btn
:label="$t('common.finish')"
unelevated
@click="onFinish"
color="primary"
/>
</page-action>
</q-tab-panel>
</q-tab-panels>
</template>
<script lang="ts">
import Vue from 'vue'
import Words from './Words.vue'
import CheckWords from './CheckWords.vue'
import Notice from './Notice.vue'
import PageContent from 'src/components/PageContent.vue'
import PageAction from 'src/components/PageAction.vue'
export default Vue.extend({
props: {
panel: String,
walletId: Number,
words: {
type: Array as () => string[],
default: () => []
},
meta: {
type: Object as () => M.Wallet.Meta,
default: () => {}
}
},
components: {
Words,
CheckWords,
Notice,
PageContent,
PageAction
},
data() {
return {}
},
methods: {
async onFinish() {
const m: M.Wallet.Meta = {
...this.meta as M.Wallet.Meta,
backedUp: true
}
try {
await this.$loading(
() => {
return this.$svc.wallet.update(this.walletId, m)
}
)
} catch (error) {
console.warn(error)
}
this.$emit('done')
}
}
})
</script>
Loading

0 comments on commit a4fb5a3

Please sign in to comment.