Skip to content

Commit

Permalink
Merge pull request #19 from 1eeing/main
Browse files Browse the repository at this point in the history
v9.6.4 版本更新
  • Loading branch information
shine2008 authored Nov 27, 2023
2 parents b6c843e + 1d27eb0 commit 3825165
Show file tree
Hide file tree
Showing 13 changed files with 92 additions and 105 deletions.
4 changes: 2 additions & 2 deletions react/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"private": true,
"author": "chenxuting <chenxuting@corp.netease.com>",
"author": "netease",
"scripts": {
"dev": "umi dev",
"build": "umi build",
Expand All @@ -9,7 +9,7 @@
"dependencies": {
"@xkit-yx/call-kit": "^2.0.1",
"@xkit-yx/call-kit-react-ui": "^0.4.1",
"@xkit-yx/im-kit-ui": "^9.6.2",
"@xkit-yx/im-kit-ui": "^9.6.4",
"react-dom": "^16.8.0",
"umi": "^3.5.40"
},
Expand Down
88 changes: 29 additions & 59 deletions react/src/YXUIKit/im-kit-ui/package.json
Original file line number Diff line number Diff line change
@@ -1,45 +1,27 @@
{
"_from": "@xkit-yx/im-kit-ui@^9.6.2",
"_id": "@xkit-yx/[email protected]",
"_inBundle": false,
"_integrity": "sha512-vFleF0DzxDgYJQnOWQKU6gkOC7Okqk8X1xvADTHVSK7toL8lHPP2PL/qEnQWOa0lffdQOYFy3B3OJxS+It1/+Q==",
"_location": "/@xkit-yx/im-kit-ui",
"_phantomChildren": {
"axios": "0.27.2",
"eventemitter3": "4.0.7"
"name": "@xkit-yx/im-kit-ui",
"version": "9.6.4",
"description": "云信即时通讯组件",
"license": "MIT",
"main": "lib/index.js",
"module": "es/index.js",
"typings": "es/index.d.ts",
"publishConfig": {
"access": "public"
},
"_requested": {
"type": "range",
"registry": true,
"raw": "@xkit-yx/im-kit-ui@^9.6.2",
"name": "@xkit-yx/im-kit-ui",
"escapedName": "@xkit-yx%2fim-kit-ui",
"scope": "@xkit-yx",
"rawSpec": "^9.6.2",
"saveSpec": null,
"fetchSpec": "^9.6.2"
"scripts": {
"start": "rollup -cw --environment DEV",
"dev": "gulp watch",
"build": "gulp",
"p": "npm run build && npm publish"
},
"_requiredBy": [
"/"
"files": [
"src",
"lib",
"es",
"copySourceCode.js"
],
"_resolved": "https://registry.npmjs.org/@xkit-yx/im-kit-ui/-/im-kit-ui-9.6.2.tgz",
"_shasum": "e9dd04a9d359c36fa404900ec28aca70bc8ee022",
"_spec": "@xkit-yx/im-kit-ui@^9.6.2",
"_where": "/Users/leeing/Documents/yunxin-projects/nim-uikit-web/react",
"author": "",
"bundleDependencies": false,
"dependencies": {
"@ant-design/icons": "^5.0.1",
"@xkit-yx/core-kit": "^0.10.8",
"@xkit-yx/im-store": "^0.0.13",
"@xkit-yx/utils": "^0.5.6",
"antd": "^4.16.3",
"mobx": "^6.6.1",
"mobx-react": "^7.5.2",
"react-string-replace": "^1.1.0"
},
"deprecated": false,
"description": "云信即时通讯组件",
"devDependencies": {
"@rollup/plugin-commonjs": "^17.1.0",
"@rollup/plugin-json": "^4.1.0",
Expand All @@ -63,17 +45,6 @@
"sass": "^1.58.3",
"typescript": "^4.6.4"
},
"files": [
"src",
"lib",
"es",
"copySourceCode.js"
],
"gitHead": "3b90601cf3d29a01c3aa986043a84af0c04562d0",
"license": "MIT",
"main": "lib/index.js",
"module": "es/index.js",
"name": "@xkit-yx/im-kit-ui",
"peerDependencies": {
"@xkit-yx/core-kit": "^0.3.2",
"@xkit-yx/utils": "^0.4.3",
Expand All @@ -83,15 +54,14 @@
"react": ">=16.8.0",
"react-dom": ">=16.8.0"
},
"publishConfig": {
"access": "public"
},
"scripts": {
"build": "gulp",
"dev": "gulp watch",
"p": "npm run build && npm publish",
"start": "rollup -cw --environment DEV"
},
"typings": "es/index.d.ts",
"version": "9.6.2"
"dependencies": {
"@ant-design/icons": "^5.0.1",
"@xkit-yx/core-kit": "^0.10.8",
"@xkit-yx/im-store": "^0.0.15",
"@xkit-yx/utils": "^0.5.6",
"antd": "^4.16.3",
"mobx": "^6.6.1",
"mobx-react": "^7.5.2",
"react-string-replace": "^1.1.0"
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ const ChatP2pMessageList = observer(
<ArrowDownOutlined />
</div>
) : null}
{store.uiStore.getRelation(member.account) === 'stranger' ? (
{store.uiStore.getRelation(member.account).relation === 'stranger' ? (
<Alert
className={`${_prefix}-stranger-noti`}
banner
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -567,7 +567,7 @@ const P2pChatContainer: React.FC<P2pChatContainerProps> = observer(
avatar={
<ComplexAvatarContainer
account={to}
canClick={true}
canClick={to !== myUser.account}
prefix={commonPrefix}
/>
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ export const ComplexAvatarContainer: FC<ComplexAvatarContainerProps> = observer(

const [visible, setVisible] = useState(false)
// const [relation, setRelation] = useState<Relation>('stranger')
const relation = store.uiStore.getRelation(account)
const { relation, isInBlacklist } = store.uiStore.getRelation(account)

const userInfo = store.uiStore.getFriendWithUserNameCard(account)

Expand Down Expand Up @@ -72,6 +72,8 @@ export const ComplexAvatarContainer: FC<ComplexAvatarContainerProps> = observer(
await store.friendStore.addFriendActive(account)
message.success(t('addFriendSuccessText'))
}
// 发送申请或添加好友成功后解除黑名单
await store.relationStore.setBlackActive({ account, isAdd: false })
setVisible(false)
afterAddFriend?.(account)
} catch (error) {
Expand Down Expand Up @@ -154,6 +156,7 @@ export const ComplexAvatarContainer: FC<ComplexAvatarContainerProps> = observer(
return (
<ComplexAvatarUI
relation={relation}
isInBlacklist={isInBlacklist}
visible={visible}
onCancel={handleCancel}
onChangeAlias={handleChangeAlias}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,7 @@ export const MyAvatarContainer: FC<MyAvatarContainerProps> = observer(
<ComplexAvatarUI
relation="myself"
visible={visible}
isInBlacklist={false}
onCancel={handleCancel}
onSave={handleSave}
onAvatarClick={canClick ? handleOnAvatarClick : undefined}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,37 +50,37 @@ export const MyUserCard: FC<MyUserCardProps> = ({
const [signature, setSignature] = useState<string | undefined>(undefined)

useEffect(() => {
if (props.nick) {
if (props.nick !== void 0) {
setNick(props.nick)
}
}, [props.nick])

useEffect(() => {
if (props.avatar) {
if (props.avatar !== void 0) {
setAvatar(props.avatar)
}
}, [props.avatar])

useEffect(() => {
if (props.gender) {
if (props.gender !== void 0) {
setGender(props.gender)
}
}, [props.gender])

useEffect(() => {
if (props.tel) {
if (props.tel !== void 0) {
setTel(props.tel)
}
}, [props.tel])

useEffect(() => {
if (props.email) {
if (props.email !== void 0) {
setEmail(props.email)
}
}, [props.email])

useEffect(() => {
if (props.signature) {
if (props.signature !== void 0) {
setSignature(props.signature)
}
}, [props.signature])
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ export interface UserCardProps
alias?: string
visible: boolean
relation: Relation
isInBlacklist: boolean
onChangeAlias?: (alias: string) => void
onSendMsglick?: () => void
onAddFriendClick?: () => void
Expand All @@ -29,6 +30,7 @@ export interface UserCardProps
export const UserCard: FC<UserCardProps> = ({
visible,
relation,
isInBlacklist,
onChangeAlias,
onAddFriendClick,
onDeleteFriendClick,
Expand All @@ -55,24 +57,28 @@ export const UserCard: FC<UserCardProps> = ({
)

const controlsMenuRenderer = useMemo(() => {
const items = [
relation === 'friend'
? {
key: 'block',
label: t('blackText'),
icon: <UsergroupAddOutlined />,
}
: {
key: 'removeBlock',
label: t('removeBlackText'),
icon: <UsergroupDeleteOutlined />,
},
{
key: 'deleteFriend',
label: t('deleteFriendText'),
icon: <DeleteOutlined />,
},
] as any
const items = (
[
isInBlacklist
? {
key: 'removeBlock',
label: t('removeBlackText'),
icon: <UsergroupDeleteOutlined />,
}
: {
key: 'block',
label: t('blackText'),
icon: <UsergroupAddOutlined />,
},
relation === 'friend'
? {
key: 'deleteFriend',
label: t('deleteFriendText'),
icon: <DeleteOutlined />,
}
: null,
] as any
).filter((item) => !!item)

return (
<Menu
Expand All @@ -97,6 +103,7 @@ export const UserCard: FC<UserCardProps> = ({
}, [
t,
relation,
isInBlacklist,
onBlockFriendClick,
onRemoveBlockFriendClick,
onDeleteFriendClick,
Expand Down Expand Up @@ -124,18 +131,16 @@ export const UserCard: FC<UserCardProps> = ({
<span className={`${_prefix}-header-nick`}>
{props.alias || props.nick || props.account}
</span>
{relation !== 'stranger' ? (
<Dropdown overlay={controlsMenuRenderer}>
<Button
className={`${_prefix}-header-controls`}
type="text"
icon={<MoreOutlined />}
></Button>
</Dropdown>
) : null}
<Dropdown overlay={controlsMenuRenderer}>
<Button
className={`${_prefix}-header-controls`}
type="text"
icon={<MoreOutlined />}
></Button>
</Dropdown>
</div>
<div className={`${_prefix}-content`}>
{['friend', 'blacklist'].includes(relation) ? (
{relation === 'friend' ? (
<div className={`${_prefix}-content-form-item`}>
<label>{t('aliasText')}</label>
<Input
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ export const ContactListContainer: FC<ContactListContainerProps> = observer(
selectedContactType={store.uiStore.selectedContactType}
onItemClick={handleItemClick}
renderCustomContact={renderCustomContact}
systemMsgUnread={store.uiStore.systemMsgUnread}
systemMsgUnread={store.sysMsgStore.unreadSysMsgCount}
prefix={prefix}
/>
)
Expand Down
6 changes: 4 additions & 2 deletions react/src/YXUIKit/im-kit-ui/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,12 +42,14 @@ import RootStore from '@xkit-yx/im-store'
import { NIMInitializeOptions } from 'nim-web-sdk-ng/dist/NIM_BROWSER_SDK/NIMInterface'

export class IMUIKit {
context: {
get context(): {
nim: NimKitCoreTypes.INimKitCore
store: RootStore
initOptions: NIMInitializeOptions
} | void {
// @ts-ignore
} | void = window.__xkit_store__
return window.__xkit_store__
}
constructor(private providerProps: Omit<ProviderProps, 'children'>) {}

render<
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,11 @@ const AddFriendModal: React.FC<AddFriendModalProps> = observer(
await store.friendStore.addFriendActive(searchRes.account)
message.success(t('addFriendSuccessText'))
}
// 发送申请或添加好友成功后解除黑名单
await store.relationStore.setBlackActive({
account: searchRes.account,
isAdd: false,
})
}
setAdding(false)
} catch (error) {
Expand Down Expand Up @@ -143,7 +148,8 @@ const AddFriendModal: React.FC<AddFriendModalProps> = observer(
{searchRes.account}
</div>
</div>
{store.uiStore.getRelation(searchRes.account) !== 'stranger' ? (
{store.uiStore.getRelation(searchRes.account).relation !==
'stranger' ? (
<Button type="primary" onClick={handleChat}>
{t('chatButtonText')}
</Button>
Expand Down
4 changes: 2 additions & 2 deletions react/src/components/IMApp/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -305,7 +305,7 @@ const IMApp: React.FC<IMAppProps> = observer((props) => {
<div className="icon-label">{t('session')}</div>
</div>
</Badge>
<Badge dot={!!store.uiStore.systemMsgUnread}>
<Badge dot={!!store.sysMsgStore.unreadSysMsgCount}>
<div
className={classNames('contact-icon', {
active: model === 'contact',
Expand Down Expand Up @@ -386,7 +386,7 @@ const IMApp: React.FC<IMAppProps> = observer((props) => {
teamMsgReceiptVisible,
sdkVersion,
renderP2pCustomMessage,
store.uiStore.systemMsgUnread,
store.sysMsgStore.unreadSysMsgCount,
])
// IM elite(IM 2) sdk 没有信令, 无法初始化呼叫组件
return sdkVersion === 1 ? (
Expand Down
2 changes: 1 addition & 1 deletion vue/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
"lint": "eslint . --ext .vue,.js,.jsx,.cjs,.mjs,.ts,.tsx,.cts,.mts --fix --ignore-path .gitignore"
},
"dependencies": {
"@xkit-yx/im-kit-ui": "^9.6.2",
"@xkit-yx/im-kit-ui": "^9.6.4",
"react": "^16.8.0",
"react-dom": "^16.8.0",
"vue": "^3.2.45"
Expand Down

0 comments on commit 3825165

Please sign in to comment.