Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
53 commits
Select commit Hold shift + click to select a range
00f65f9
feat: split wallet app entries
hanszhoou Apr 20, 2022
4957651
chore: type
hanszhoou Apr 20, 2022
9653259
chore: type
hanszhoou Apr 20, 2022
a724a45
Merge branch 'develop' into hancheng/split-application-wallet-entry
hanszhoou Apr 22, 2022
a6a0438
chore: solve conflict
hanszhoou Apr 26, 2022
3f84e7e
Revert "chore: solve conflict"
hanszhoou Apr 26, 2022
68358ed
Merge branch 'develop' into hancheng/split-application-wallet-entry
hanszhoou Apr 27, 2022
d6f5ed4
chore: solve conflict
hanszhoou Apr 27, 2022
c66d357
feat: recommend feature app
hanszhoou Apr 27, 2022
dd64f52
chore: update event
hanszhoou Apr 27, 2022
1dfe7e9
Merge branch 'develop' into hancheng/split-application-wallet-entry
hanszhoou Apr 27, 2022
dc84ea1
chore: persona connect
hanszhoou Apr 27, 2022
086d846
fix: little fix
hanszhoou Apr 27, 2022
b2d96dd
Merge branch 'develop' into hancheng/split-application-wallet-entry
hanszhoou Apr 28, 2022
df51ff4
fix: dialog title text center
hanszhoou Apr 28, 2022
6dd82ca
fix: style
hanszhoou Apr 28, 2022
7fd0bdd
chore: add comment
hanszhoou Apr 28, 2022
caea3be
fix: ui style
hanszhoou Apr 28, 2022
321f852
chore: ui style
hanszhoou Apr 28, 2022
dec1140
chore: for test
hanszhoou Apr 29, 2022
5e2e901
Merge branch 'develop' into hancheng/split-application-wallet-entry
hanszhoou May 1, 2022
1bbd1b5
refactor: use entry status context
hanszhoou May 1, 2022
4c6d226
chore: adjust logic
hanszhoou May 1, 2022
cc146d9
chore: add persona against sns connect status hook
hanszhoou May 1, 2022
a34ca93
chore: close app board after wallet connect
hanszhoou May 1, 2022
1d1e836
chore: close app board after wallet connect
hanszhoou May 1, 2022
e650953
fix: ui style
hanszhoou May 1, 2022
5941365
fix: bug
hanszhoou May 3, 2022
9b65e92
fix: mf 612
hanszhoou May 3, 2022
f988373
chore: icon
hanszhoou May 3, 2022
c61e1cf
fix: bug
hanszhoou May 3, 2022
2d867a8
chore: little fix
hanszhoou May 3, 2022
22b6e61
chore: transaction list ui
hanszhoou May 4, 2022
3e9cd46
chore: tip content ui
hanszhoou May 4, 2022
7e95326
chore: transaction list ui
hanszhoou May 5, 2022
0a9fb7c
chore: remove debug code
hanszhoou May 5, 2022
4122fba
fix: bug
hanszhoou May 6, 2022
18eb26c
chore: scroll for testing
hanszhoou May 6, 2022
6992066
Merge branch 'develop' into hancheng/split-application-wallet-entry
hanszhoou May 6, 2022
795a44c
chore: spell
hanszhoou May 6, 2022
84d459e
chore: little fix
hanszhoou May 6, 2022
3a1d2ea
chore: remove debug code
hanszhoou May 6, 2022
8b81d3b
chore: solve type error
hanszhoou May 6, 2022
e0a0ae3
Merge branch 'develop' into hancheng/split-application-wallet-entry
hanszhoou May 7, 2022
e972a09
chore: prevent scroll parent
hanszhoou May 7, 2022
12edbe3
fix: style
hanszhoou May 7, 2022
9b2db6d
chore: remove code for test
hanszhoou May 8, 2022
d5577f6
chore: reply code review
hanszhoou May 9, 2022
08cff12
chore: reply code review
hanszhoou May 9, 2022
0b834ed
chore: reply code review
hanszhoou May 10, 2022
42bf5dd
Merge branch 'develop' into hancheng/split-application-wallet-entry
hanszhoou May 10, 2022
7dddc6f
chore: reply code review
hanszhoou May 10, 2022
3826fd2
Merge branch 'develop' into hancheng/split-application-wallet-entry
hanszhoou May 10, 2022
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions cspell.json
Original file line number Diff line number Diff line change
Expand Up @@ -398,6 +398,7 @@
"txreceipt",
"txts",
"uaddr",
"uipd",
"unauthenticate",
"unitoken",
"unlocklock",
Expand Down
35 changes: 35 additions & 0 deletions packages/icons/general/AccountBalanceWallet.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
import { createPaletteAwareIcon } from '../utils'

export const AccountBalanceWalletIcon = createPaletteAwareIcon(
'AccountBalanceWalletIcon',
<svg width="27" height="26" viewBox="0 0 27 26" fill="none" xmlns="http://www.w3.org/2000/svg">
<path
d="M2.13062 14.2392V24.498V14.2392ZM21.9248 2.17517H4.84818C3.34754 2.17517 2.13062 3.39209 2.13062 4.89273V21.1076C2.13062 22.6082 3.34754 23.8252 4.84818 23.8252H21.9248C23.4254 23.8252 24.6424 22.6082 24.6424 21.1076V4.89273C24.6424 3.39182 23.4254 2.17517 21.9248 2.17517ZM22.7401 21.1076C22.7401 21.5571 22.3743 21.9229 21.9248 21.9229H4.84818C4.39869 21.9229 4.03291 21.5571 4.03291 21.1076V4.89273C4.03291 4.44325 4.39869 4.07746 4.84818 4.07746H21.9248C22.3743 4.07746 22.7401 4.44325 22.7401 4.89273V21.1076Z"
fill="#111418"
/>
<path
d="M22.7401 15.8696H17.524C15.9418 15.8696 14.6545 14.5823 14.6545 12.9998C14.6545 11.4174 15.9415 10.1304 17.524 10.1304H22.7401V8.22806H17.524C14.8887 8.22806 12.7522 10.3643 12.7522 12.9998C12.7522 15.6353 14.8885 17.7719 17.524 17.7719H22.7401V15.8696Z"
fill="#111418"
/>
<path
d="M17.7461 13.0002C17.7461 13.2524 17.8463 13.4943 18.0247 13.6727C18.2031 13.8511 18.445 13.9513 18.6972 13.9513C18.9495 13.9513 19.1914 13.8511 19.3698 13.6727C19.5482 13.4943 19.6484 13.2524 19.6484 13.0002C19.6484 12.7479 19.5482 12.506 19.3698 12.3276C19.1914 12.1492 18.9495 12.049 18.6972 12.049C18.445 12.049 18.2031 12.1492 18.0247 12.3276C17.8463 12.506 17.7461 12.7479 17.7461 13.0002Z"
fill="#111418"
/>
</svg>,
<svg width="27" height="26" viewBox="0 0 27 26" fill="none" xmlns="http://www.w3.org/2000/svg">
<path
d="M2.13086 14.2392V24.498V14.2392ZM21.925 2.17517H4.84842C3.34778 2.17517 2.13086 3.39209 2.13086 4.89273V21.1076C2.13086 22.6082 3.34778 23.8252 4.84842 23.8252H21.925C23.4257 23.8252 24.6426 22.6082 24.6426 21.1076V4.89273C24.6426 3.39182 23.4257 2.17517 21.925 2.17517ZM22.7403 21.1076C22.7403 21.5571 22.3745 21.9229 21.925 21.9229H4.84842C4.39894 21.9229 4.03315 21.5571 4.03315 21.1076V4.89273C4.03315 4.44325 4.39894 4.07746 4.84842 4.07746H21.925C22.3745 4.07746 22.7403 4.44325 22.7403 4.89273V21.1076Z"
fill="#EFF3F4"
/>
<path
d="M22.7403 15.8696H17.5242C15.942 15.8696 14.6547 14.5823 14.6547 12.9998C14.6547 11.4174 15.9418 10.1304 17.5242 10.1304H22.7403V8.22806H17.5242C14.889 8.22806 12.7524 10.3643 12.7524 12.9998C12.7524 15.6353 14.8887 17.7719 17.5242 17.7719H22.7403V15.8696Z"
fill="#EFF3F4"
/>
<path
d="M17.7461 13.0002C17.7461 13.2524 17.8463 13.4943 18.0247 13.6727C18.2031 13.8511 18.445 13.9513 18.6972 13.9513C18.9495 13.9513 19.1914 13.8511 19.3698 13.6727C19.5482 13.4943 19.6484 13.2524 19.6484 13.0002C19.6484 12.7479 19.5482 12.506 19.3698 12.3276C19.1914 12.1492 18.9495 12.049 18.6972 12.049C18.445 12.049 18.2031 12.1492 18.0247 12.3276C17.8463 12.506 17.7461 12.7479 17.7461 13.0002Z"
fill="#EFF3F4"
/>
</svg>,
undefined,
'0 0 27 26',
)
34 changes: 7 additions & 27 deletions packages/icons/general/LinkOut.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,38 +5,18 @@ export const LinkOutIcon: typeof SvgIcon = createPaletteAwareIcon(
'LinkOutIcon',
<g>
<path
d="M15 10.8333V15.8333C15 16.2754 14.8244 16.6993 14.5118 17.0118C14.1993 17.3244 13.7754 17.5 13.3333 17.5H4.16667C3.72464 17.5 3.30072 17.3244 2.98816 17.0118C2.67559 16.6993 2.5 16.2754 2.5 15.8333V6.66667C2.5 6.22464 2.67559 5.80072 2.98816 5.48816C3.30072 5.17559 3.72464 5 4.16667 5H9.16667"
stroke="#111432"
strokeWidth="1.25"
strokeLinecap="round"
strokeLinejoin="round"
/>
<path d="M12.5 2.5H17.5V7.5" stroke="#111432" strokeWidth="1.25" strokeLinecap="round" strokeLinejoin="round" />
<path
d="M8.33331 11.6667L17.5 2.5"
stroke="#111432"
strokeWidth="1.25"
strokeLinecap="round"
strokeLinejoin="round"
d="M12.6667 13.1667H13.1667V12.6667V8.5H13.5V12.6667C13.5 13.1239 13.1239 13.5 12.6667 13.5H3.33333C2.8711 13.5 2.5 13.1255 2.5 12.6667V3.33333C2.5 2.87451 2.8711 2.5 3.33333 2.5H7.5V2.83333H3.33333H2.83333V3.33333V12.6667V13.1667H3.33333H12.6667ZM13.1667 6.16667V4.27333V3.06623L12.3131 3.91978L6.11333 10.1196L5.88044 9.88667L12.0802 3.68689L12.9338 2.83333H11.7267H9.83333V2.5H13.5V6.16667H13.1667Z"
fill="#07101B"
stroke="#07101B"
/>
</g>,
<g>
<path
d="M15 10.8333V15.8333C15 16.2754 14.8244 16.6993 14.5118 17.0118C14.1993 17.3244 13.7754 17.5 13.3333 17.5H4.16667C3.72464 17.5 3.30072 17.3244 2.98816 17.0118C2.67559 16.6993 2.5 16.2754 2.5 15.8333V6.66667C2.5 6.22464 2.67559 5.80072 2.98816 5.48816C3.30072 5.17559 3.72464 5 4.16667 5H9.16667"
stroke="white"
strokeWidth="1.25"
strokeLinecap="round"
strokeLinejoin="round"
/>
<path d="M12.5 2.5H17.5V7.5" stroke="white" strokeWidth="1.25" strokeLinecap="round" strokeLinejoin="round" />
<path
d="M8.33325 11.6667L17.4999 2.5"
stroke="white"
strokeWidth="1.25"
strokeLinecap="round"
strokeLinejoin="round"
d="M12.6667 13.1667H13.1667V12.6667V8.5H13.5V12.6667C13.5 13.1239 13.1239 13.5 12.6667 13.5H3.33333C2.8711 13.5 2.5 13.1255 2.5 12.6667V3.33333C2.5 2.87451 2.8711 2.5 3.33333 2.5H7.5V2.83333H3.33333H2.83333V3.33333V12.6667V13.1667H3.33333H12.6667ZM13.1667 6.16667V4.27333V3.06623L12.3131 3.91978L6.11333 10.1196L5.88044 9.88667L12.0802 3.68689L12.9338 2.83333H11.7267H9.83333V2.5H13.5V6.16667H13.1667Z"
fill="#F5F5F5"
stroke="#F5F5F5"
/>
</g>,
undefined,
'0 0 20 20',
'0 0 16 16',
)
24 changes: 24 additions & 0 deletions packages/icons/general/WarningTriangle.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
import { createIcon } from '../utils'

export const WarningTriangleIcon = createIcon(
'WarningTriangleIcon',
<g>
<path
d="M8.55695 3.59847C9.19845 2.48736 10.8022 2.48736 11.4437 3.59847L17.2456 13.6476C17.8871 14.7587 17.0852 16.1476 15.8022 16.1476H4.19845C2.91545 16.1476 2.11357 14.7587 2.75507 13.6476L8.55695 3.59847Z"
fill="#FFB100"
/>
<path
fillRule="evenodd"
clipRule="evenodd"
d="M10.0005 6.33447C10.4147 6.33447 10.7505 6.67026 10.7505 7.08447L10.7505 11.6009C10.7505 12.0152 10.4147 12.3509 10.0005 12.3509C9.58627 12.3509 9.25049 12.0152 9.25049 11.6009L9.25049 7.08447C9.25049 6.67026 9.58627 6.33447 10.0005 6.33447Z"
fill="white"
/>
<path
fillRule="evenodd"
clipRule="evenodd"
d="M10.0005 13.2114C10.4147 13.2114 10.7505 13.5472 10.7505 13.9614L10.7505 13.9806C10.7505 14.3948 10.4147 14.7306 10.0005 14.7306C9.58627 14.7306 9.25049 14.3948 9.25049 13.9806L9.25049 13.9614C9.25049 13.5472 9.58627 13.2114 10.0005 13.2114Z"
fill="white"
/>
</g>,
'0 0 20 20',
)
2 changes: 2 additions & 0 deletions packages/icons/general/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,7 @@ export * from './Verified'
export * from './Pin'
export * from './Selected'
export * from './Cram'
export * from './AccountBalanceWallet'
export * from './TriangleWarning'
export * from './OpenSeaColoredIcon'
export * from './Collectible'
Expand All @@ -115,5 +116,6 @@ export * from './CircleLoading'
export * from './AddUser'
export * from './PopupRestore'
export * from './Direct'
export * from './WarningTriangle'
export * from './Furucombo'
export * from './CryptoArt'
1 change: 1 addition & 0 deletions packages/mask/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,7 @@
"millify": "^4.0.0",
"next-tick": "^1.0.0",
"opensea-js": "^1.2.7",
"pure-react-carousel": "^1.28.1",
Comment thread
Jack-Works marked this conversation as resolved.
"promievent": "^0.1.4",
"protobufjs": "^6.11.2",
"react-dnd": "^16.0.1",
Expand Down
15 changes: 10 additions & 5 deletions packages/mask/shared-ui/locales/en-US.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,12 @@
"add_nft_contract_search_hint": "Search NFT Contract Symbol Name or Address",
"applications": "Applications",
"application_settings": "Application Settings",
"application_tooltip_hint_sns_persona_unmatched": "Twitter ID verified persona({{currentSNSConnectedPersonaPublicKey}}) is not consistent with your current persona({{currentPersonaPublicKey}}). Please switch to persona({{currentSNSConnectedPersonaPublicKey}}) and try again.",
"application_tooltip_hint_verify": "Please verify your social account",
"application_tooltip_hint_create_persona": "Please create your persona and use it",
"application_tooltip_hint_connect_persona": "Please connect your persona",
"application_tooltip_hint_connect_wallet": "Please connect your wallet",
"application_tooltip_hint_switch_to_evm_wallet": "Please switch to EVM wallets",
"application_settings_tab_app_list": "APP list",
"application_settings_tab_plug_in_switch": "Plug-in switch",
"application_settings_tab_plug_app-list-unlisted": "Unlisted",
Expand Down Expand Up @@ -214,9 +220,8 @@
"wallet_balance": "Balance",
"wallet_balance_eth": "Balance(ETH)",
"wallet_new": "New Wallet",
"wallets": "Wallets",
"wallet_status_pending": "Pending",
"wallet_status_pending_clear_all": "Clear all",
"wallet_status_pending": "Pending{{plural}}",
"wallet_status_pending_clear_all": "Clear All",
"wallet_status_pending_clear": "Clear",
"wallet_status_button_change": "Change",
"wallet_status_button_copy_address": "Copy Address",
Expand Down Expand Up @@ -303,7 +308,7 @@
"plugin_wallet_on_create": "Create Wallet",
"plugin_wallet_on_connect": "Connect Wallet",
"plugin_wallet_wrong_network": "Wrong Network",
"plugin_wallet_pending_transactions": "{{count}} Pending",
"plugin_wallet_pending_transactions": "{{count}} Pending{{plural}}",
"plugin_wallet_import_wallet": "Import Wallet",
"plugin_wallet_select_provider_dialog_title": "Connect Wallet",
"plugin_wallet_qr_code_with_wallet_connect": "Scan QR code with a WalletConnect-compatible wallet",
Expand All @@ -330,6 +335,7 @@
"plugin_red_packet_erc20_tab_title": "Token",
"plugin_red_packet_erc721_tab_title": "Collectibles",
"plugin_red_packet_name": "Lucky Drop",
"plugin_red_packet_recommend_feature_description": "Surpirse your social friends with Lucky Drop",
"plugin_red_packet_description": "Gift crypto or NFTs to any users, first come, first served.",
"plugin_red_packet_erc721_insufficient_balance": "Insufficient Balance",
"plugin_red_packet_details": "Lucky Drop Details",
Expand Down Expand Up @@ -1092,7 +1098,6 @@
"plugin_artblocks_share_no_official_account": "I just purchased a beautiful piece of art from '{{name}}' collection for {{price}} {{symbol}}. Welcome to join.",
"plugin_tips_disconnect_introduction": "Are you going to disconnect {{persona}} from wallet <strong>{{address}}<strong/>?",
"plugin_tips_not_evm_alert": "The tips feature currently supports only EVM chains. Support for other chains will be added in the future.",
"plugin_tips_sns_persona_unmatched": "Twitter ID verified persona({{currentSNSConnectedPersonaPublicKey}}) is not consistent with your current persona({{currentPersonaPublicKey}}). Please switch to persona({{currentSNSConnectedPersonaPublicKey}}) and try again.",
"plugin_artblocks_description": "Artblocks allow you to pick a style that you like, pay for the work, and a randomly generated version of the content is created by an algorithm and sent to your Ethereum account.",
"plugin_artblocks_name": "Artblocks",
"plugin_dhedge_description": "Decentralized hedge funds on Ethereum and Polygon (Matic).",
Expand Down
1 change: 0 additions & 1 deletion packages/mask/shared-ui/locales/ja-JP.json
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,6 @@
"wallet_rename": "ウォレット名を変更",
"wallet_balance": "残高",
"wallet_new": "新規ウォレット名",
"wallets": "ウォレット",
"wallet_status_button_change": "変更",
"wallet_status_button_copy_address": "アドレスをコピー",
"wallet_transfer_to_address": "宛先のアドレス",
Expand Down
1 change: 0 additions & 1 deletion packages/mask/shared-ui/locales/ko-KR.json
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,6 @@
"plugin_airdrop_nft_claim_failed": "토큰 수령이 실패되었습니다",
"wallet_balance": "잔액",
"wallet_new": "새로운 월렛",
"wallets": "월렛",
"wallet_status_button_change": "바꾸기",
"wallet_status_button_copy_address": "주소 복사",
"wallet_transfer_to_address": "주소",
Expand Down
2 changes: 1 addition & 1 deletion packages/mask/shared-ui/locales/qya-AA.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
"add_token": "crwdns3983:0crwdne3983:0",
"add_nft_contract_search_hint": "crwdns8123:0crwdne8123:0",
"applications": "crwdns9513:0crwdne9513:0",
"application_tooltip_hint_sns_persona_unmatched": "crwdns16428:0{{currentSNSConnectedPersonaPublicKey}}crwdnd16428:0{{currentPersonaPublicKey}}crwdnd16428:0{{currentSNSConnectedPersonaPublicKey}}crwdne16428:0",
"application_settings": "crwdns16220:0crwdne16220:0",
"application_settings_tab_app_list": "crwdns16222:0crwdne16222:0",
"application_settings_tab_plug_in_switch": "crwdns16224:0crwdne16224:0",
Expand Down Expand Up @@ -1088,7 +1089,6 @@
"plugin_artblocks_share_no_official_account": "crwdns14524:0{{name}}crwdnd14524:0{{price}}crwdnd14524:0{{symbol}}crwdne14524:0",
"plugin_tips_disconnect_introduction": "crwdns16410:0{{persona}}crwdnd16410:0{{address}}crwdne16410:0",
"plugin_tips_not_evm_alert": "crwdns16414:0crwdne16414:0",
"plugin_tips_sns_persona_unmatched": "crwdns16428:0{{currentSNSConnectedPersonaPublicKey}}crwdnd16428:0{{currentPersonaPublicKey}}crwdnd16428:0{{currentSNSConnectedPersonaPublicKey}}crwdne16428:0",
"plugin_artblocks_description": "crwdns16264:0crwdne16264:0",
"plugin_artblocks_name": "crwdns16266:0crwdne16266:0",
"plugin_dhedge_description": "crwdns16268:0crwdne16268:0",
Expand Down
1 change: 0 additions & 1 deletion packages/mask/shared-ui/locales/zh-CN.json
Original file line number Diff line number Diff line change
Expand Up @@ -209,7 +209,6 @@
"wallet_balance": "余额",
"wallet_balance_eth": "余额(ETH)",
"wallet_new": "新建钱包",
"wallets": "钱包",
"wallet_status_button_change": "切换",
"wallet_status_button_copy_address": "复制地址",
"wallet_transfer_account": "转账账户",
Expand Down
1 change: 0 additions & 1 deletion packages/mask/shared-ui/locales/zh-TW.json
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,6 @@
"wallet_balance": "餘額",
"wallet_balance_eth": "餘額(ETH)",
"wallet_new": "新錢包",
"wallets": "錢包",
"wallet_status_button_change": "更改",
"wallet_status_button_copy_address": "複製地址",
"wallet_transfer_receiving_account": "接收地址",
Expand Down
10 changes: 2 additions & 8 deletions packages/mask/src/components/CompositionDialog/Composition.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { useCallback, useEffect, useState, useRef } from 'react'
import { DialogContent } from '@mui/material'
import { DialogStackingProvider } from '@masknet/theme'
import { activatedSocialNetworkUI, globalUIState } from '../../social-network'
import { activatedSocialNetworkUI } from '../../social-network'
import { MaskMessages, useI18N } from '../../utils'
import { CrossIsolationMessages } from '@masknet/shared-base'
import { useRecipientsList } from './useRecipientsList'
Expand All @@ -20,7 +20,6 @@ export interface PostDialogProps {
let openOnInitAnswered = false
export function Composition({ type = 'timeline', requireClipboardPermission }: PostDialogProps) {
const { t } = useI18N()

const currentIdentity = useCurrentIdentity()?.identifier
/** @deprecated */
const { value: hasLocalKey } = useAsync(
Expand Down Expand Up @@ -56,12 +55,7 @@ export function Composition({ type = 'timeline', requireClipboardPermission }: P

useEffect(() => {
return CrossIsolationMessages.events.requestComposition.on(({ reason, open, content, options }) => {
if (
(reason !== 'reply' && reason !== type) ||
(reason === 'reply' && type === 'popup') ||
globalUIState.profiles.value.length <= 0
)
return
if ((reason !== 'reply' && reason !== type) || (reason === 'reply' && type === 'popup')) return
setOpen(open)
setReason(reason)
if (content) UI.current?.setMessage(content)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ export function useSubmit(onClose: () => void, reason: 'timeline' | 'popup' | 'r
return useCallback(
async (info: SubmitComposition) => {
const { content, encode, target } = info

const currentProfile = globalUIState.profiles.value?.[0].identifier

const _encrypted = await Services.Crypto.encryptTo(content, target, whoAmI?.identifier ?? currentProfile)
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
import type { PersonaInformation, NextIDPlatform } from '@masknet/shared-base'
import { useAsyncRetry } from 'react-use'
import { useMemo } from 'react'
import Services from '../../extension/service'
import { activatedSocialNetworkUI } from '../../social-network'
import { useLastRecognizedIdentity } from './useActivatedUI'
import { useMyPersonas } from './useMyPersonas'
import { useSetupGuideStatusState } from './useNextID'

export function usePersonaAgainstSNSConnectStatus() {
const ui = activatedSocialNetworkUI
const platform = ui.configuration.nextIDConfig?.platform as NextIDPlatform
const lastState = useSetupGuideStatusState()
const lastRecognized = useLastRecognizedIdentity()
const username = useMemo(() => {
return lastState.username || lastRecognized.identifier?.userId
}, [lastState, lastRecognized])
const personas = useMyPersonas()
Comment thread
Jack-Works marked this conversation as resolved.

return useAsyncRetry(async () => {
const checkSNSConnectToCurrentPersona = (persona: PersonaInformation) =>
username ? persona.linkedProfiles.some((x) => x.identifier.userId === username) : false
const currentPersonaIdentifier = await Services.Settings.getCurrentPersonaIdentifier()
const currentPersona = (await Services.Identity.queryOwnedPersonaInformation(true)).find(
(x) => x.identifier === currentPersonaIdentifier,
)
const currentSNSConnectedPersona = personas.find(checkSNSConnectToCurrentPersona)
return {
isSNSConnectToCurrentPersona: currentPersona ? checkSNSConnectToCurrentPersona(currentPersona) : false,
currentPersonaPublicKey: currentPersona?.identifier.rawPublicKey,
currentSNSConnectedPersonaPublicKey: currentSNSConnectedPersona?.identifier.rawPublicKey,
}
}, [platform, username, ui, personas])
}
Loading