-
Notifications
You must be signed in to change notification settings - Fork 306
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: bugfix for encrypted contacts (#10337)
* feat: add contacts page * refactor: change account render * fix: mf-4808 empty ens * fix: mf-4805 fix title * fix: mf-4805 fix title * fix: mf-4812 ui/ux * fix: mf-4825 change link * fix: mf-4809 search twitter handle * fix: keybase account * feat: upgrade to blocto v2 SDK (#10309) * chore: update blocto SDK * refactor: remove deprecated field * refactor: remove server side configuration fields * fix: Flow Balance * fix: platform type * fix: mf-4806 search lens/ens * fix: mf-4811 account sort * fix: rebase * fix: lock file * fix: merge error * fix: type * fix: type --------- Co-authored-by: guanbinrui <52657989+guanbinrui@users.noreply.github.com>
- Loading branch information
1 parent
5782792
commit 4262b33
Showing
21 changed files
with
416 additions
and
264 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
import { useAsyncRetry } from 'react-use' | ||
import type { AsyncStateRetry } from 'react-use/lib/useAsyncRetry.js' | ||
import { ECKeyIdentifier, NextIDPlatform } from '@masknet/shared-base' | ||
import { ENS, Lens } from '@masknet/web3-providers' | ||
|
||
export function useSearchValue(value: string, type?: NextIDPlatform): AsyncStateRetry<string> { | ||
return useAsyncRetry(async () => { | ||
if (!type) return '' | ||
if (value.length === 44) return new ECKeyIdentifier('secp256k1', value).publicKeyAsHex ?? value | ||
if (type === NextIDPlatform.Twitter) return value.replace(/^@/, '').toLowerCase() | ||
|
||
if (value.endsWith('.eth')) return (await ENS.lookup(value))?.toLowerCase() | ||
|
||
if (value.endsWith('.lens')) return (await Lens.getProfileByHandle(value)).ownedBy?.toLowerCase() | ||
|
||
return value.toLowerCase() | ||
}, [value]) | ||
} |
61 changes: 61 additions & 0 deletions
61
packages/mask/src/extension/popups/pages/Friends/AccountRender/index.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
import { memo } from 'react' | ||
import { type BindingProof, NextIDPlatform, EnhanceableSite } from '@masknet/shared-base' | ||
import { SocialAccount as DetailSocialAccount } from '../Detail/SocialAccount/index.js' | ||
import { Account as DetailAccount } from '../Detail/Account/index.js' | ||
import { SocialAccount } from '../ContactCard/SocialAccount/index.js' | ||
import { Account } from '../ContactCard/Account/index.js' | ||
import { safeUnreachable } from '@masknet/kit' | ||
|
||
interface AccountRenderProps { | ||
profile: BindingProof | ||
detail?: boolean | ||
} | ||
|
||
export const AccountRender = memo<AccountRenderProps>(function AccountRender({ profile, detail }) { | ||
return (function () { | ||
switch (profile.platform) { | ||
case NextIDPlatform.Twitter: | ||
return detail ? ( | ||
<DetailSocialAccount | ||
avatar={''} | ||
userId={profile.name ? profile.name : profile.identity} | ||
site={EnhanceableSite.Twitter} | ||
/> | ||
) : ( | ||
<SocialAccount | ||
avatar={''} | ||
userId={profile.name ? profile.name : profile.identity} | ||
site={EnhanceableSite.Twitter} | ||
/> | ||
) | ||
case NextIDPlatform.ENS: | ||
case NextIDPlatform.Ethereum: | ||
case NextIDPlatform.GitHub: | ||
case NextIDPlatform.SpaceId: | ||
case NextIDPlatform.LENS: | ||
case NextIDPlatform.Unstoppable: | ||
case NextIDPlatform.Farcaster: | ||
case NextIDPlatform.Keybase: | ||
const _userID = | ||
profile.platform === NextIDPlatform.ENS || profile.platform === NextIDPlatform.Keybase | ||
? profile.name | ||
: profile.identity | ||
return detail ? ( | ||
<DetailAccount userId={_userID} icon={profile.platform} /> | ||
) : ( | ||
<Account userId={_userID} icon={profile.platform} /> | ||
) | ||
case NextIDPlatform.CyberConnect: | ||
case NextIDPlatform.Bit: | ||
case NextIDPlatform.SYBIL: | ||
case NextIDPlatform.EthLeaderboard: | ||
case NextIDPlatform.REDDIT: | ||
case NextIDPlatform.RSS3: | ||
case NextIDPlatform.NextID: | ||
return null | ||
default: | ||
safeUnreachable(profile.platform) | ||
return null | ||
} | ||
})() | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.