Skip to content

Commit

Permalink
Update Vue Sample App for version v4.3.1
Browse files Browse the repository at this point in the history
  • Loading branch information
nakul-cometchat committed Mar 26, 2024
1 parent b7ef3f3 commit 45ab8a1
Show file tree
Hide file tree
Showing 12 changed files with 50 additions and 35 deletions.
16 changes: 8 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ This is a reference application showcasing the integration of [**CometChat's Vue
## Prerequisites

- Ensure that you have Node.js and npm installed:

```sh
npm install npm@latest -g
```
Expand All @@ -26,19 +26,19 @@ This is a reference application showcasing the integration of [**CometChat's Vue
```
npm install
```
4. Enter your CometChat _`App ID`_, _`Region`_, and _`Auth Key`_ in the [src/CONSTS.ts](https://github.com/cometchat/cometchat-sample-app-vue/blob/v4/src/consts.ts) file:
4. Enter your CometChat _`App ID`_, _`Region`_, and _`Auth Key`_ in the [src/AppConstants.ts](https://github.com/cometchat/cometchat-sample-app-vue/blob/v4/src/AppConstants.ts) file:
```typescript
export const COMETCHAT_CONSTANTS = {
APP_ID: "APP_ID",
REGION: "REGION",
AUTH_KEY: "AUTH_KEY",
};
export const AppConstants = {
APP_ID: "APP_ID",
REGION: "REGION",
AUTH_KEY: "AUTH_KEY",
};
```
5. Run the project locally to see all CometChat features in action:
```
npm run serve
```
![Screenshot 2024-03-15 at 11 37 17 PM](https://github.com/cometchat/cometchat-sample-app-vue/assets/2210730/ac51c426-e7ed-4761-b21a-9f892064aca8)
![HomeScreen](./Screenshots/HomeScreen.png)


## Help and Support
Expand Down
Binary file added Screenshots/HomeScreen.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file removed Screenshots/constants.png
Binary file not shown.
13 changes: 9 additions & 4 deletions main.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
/* eslint-disable no-console */
import "@cometchat/chat-uikit-vue/dist/style.css";

import { CometChatTheme, CometChatUIKit } from "@cometchat/chat-uikit-vue";
Expand All @@ -6,11 +7,11 @@ import { createApp, ref } from "vue";
import App from "./App.vue";
import { COMETCHAT_CONSTANTS } from "./consts";
import CardComponent from "../src/Card/index.vue";
import { CometChat } from "@cometchat/chat-sdk-javascript";
import { CometChatConversations } from "@cometchat/chat-uikit-vue";
import { UIKitSettingsBuilder } from "@cometchat/uikit-shared";
import { Utils } from "./utils/Utils";
import getRouter from "./router";
import {CometChat} from '@cometchat/chat-sdk-javascript'
import { metaInfo } from "./metaInfo";

const uiKitSettings = new UIKitSettingsBuilder()
Expand All @@ -20,9 +21,13 @@ const uiKitSettings = new UIKitSettingsBuilder()
.subscribePresenceForFriends()
.build();

CometChatUIKit.init(uiKitSettings)!
.then(() => {
try{CometChat.setDemoMetaInfo(metaInfo)}catch(err){}
CometChatUIKit.init(uiKitSettings)
?.then(() => {
try {
CometChat.setDemoMetaInfo(metaInfo);
} catch (err) {
console.log(err);
}
const app = createApp(App);
app.component("CometChatConversations", CometChatConversations);
//global registration of vue component
Expand Down
10 changes: 5 additions & 5 deletions metaInfo.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
export const metaInfo = {
name:"cometchat-chat-sample-app-vue",
version:"4.0.1",
type:"sample",
platform:"Vue"
}
name: "cometchat-chat-sample-app-vue",
version: "4.3.1",
type: "sample",
platform: "Vue",
};
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "cometchat-chat-sample-app-vue",
"version": "4.0.1",
"version": "4.3.1",
"license": "SEE LICENSE IN LICENSE.md",
"private": true,
"scripts": {
Expand All @@ -9,7 +9,7 @@
"lint": "vue-cli-service lint"
},
"dependencies": {
"@cometchat/chat-uikit-vue": "4.2.0",
"@cometchat/chat-uikit-vue": "4.3.1",
"@cometchat/calls-sdk-javascript": "4.0.6",
"core-js": "^3.8.3",
"file-loader": "^6.2.0",
Expand Down
5 changes: 5 additions & 0 deletions src/App.vue
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,16 @@
<router-view />
</div>
</Suspense>
<CometChatIncomingCall />
</template>
<script lang="ts">
import { CometChatIncomingCall } from "@cometchat/chat-uikit-vue";
import { computed, defineComponent, inject, onBeforeMount } from "vue";
export default defineComponent({
components: {
CometChatIncomingCall,
},
setup() {
let { theme }: any = inject("theme");
let { switchView }: any = inject("isMobileView");
Expand Down
2 changes: 1 addition & 1 deletion src/consts.ts → src/AppConstants.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
export const COMETCHAT_CONSTANTS = {
export const AppConstants = {
APP_ID: "APP_ID",
REGION: "REGION",
AUTH_KEY: "AUTH_KEY",
Expand Down
12 changes: 6 additions & 6 deletions src/Login/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
comet<b>chat</b>
</div>
<div class="release-tag" :style="styles.headerSubtitleStyle()">
4.0.0
<p v-text="`v${metaInfo.version}`"></p>
</div>
</div>
<div class="content__section">
Expand Down Expand Up @@ -99,9 +99,7 @@
</div>
</div>
</div>
<div class="footer__section" :style="styles.footerStyle()">
<footer>2022 &copy; CometChat</footer>
</div>
<div class="footer__section" :style="styles.footerStyle()"></div>
<!-- loading banner -->
<div class="spinner__wheel" v-if="inProgress">
<div class="spinner__content">
Expand All @@ -125,7 +123,7 @@ import { defineComponent, inject, ref } from "vue";
import "@cometchat/uikit-elements";
import { fontHelper } from "@cometchat/uikit-resources";
import { CometChat } from "@cometchat/chat-sdk-javascript";
import { COMETCHAT_CONSTANTS } from "../consts";
import { AppConstants } from "../AppConstants";
import { useRouter } from "vue-router";
import { AvatarStyle } from "@cometchat/uikit-elements";
import {
Expand All @@ -134,6 +132,7 @@ import {
CometChatLogo,
} from "../assets";
import { CometChatUIKit } from "@cometchat/chat-uikit-vue";
import { metaInfo } from "../../metaInfo";
let buttonImage = "assets/button-opc.png";
export default defineComponent({
Expand Down Expand Up @@ -199,7 +198,7 @@ export default defineComponent({
user.setName(userName);
}
inProgress.value = true;
await CometChat.createUser(user, COMETCHAT_CONSTANTS.AUTH_KEY).then(
await CometChat.createUser(user, AppConstants.AUTH_KEY).then(
(user) => {
console.log("user created", user);
},
Expand Down Expand Up @@ -402,6 +401,7 @@ export default defineComponent({
inProgress,
SpinnerSvg,
CometChatLogo,
metaInfo,
};
},
});
Expand Down
7 changes: 6 additions & 1 deletion src/OptionsList/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,10 @@
</CometChatList>
</div>
</div>
<footer :style="computedFooterStyle">3.0.10-pluto.beta.2</footer>
<footer
:style="computedFooterStyle"
v-text="`v${metaInfo.version}`"
></footer>
</div>
</template>
Expand All @@ -64,6 +67,7 @@ import {
States,
fontHelper,
} from "@cometchat/chat-uikit-vue";
import { metaInfo } from "../../metaInfo";
export default defineComponent({
name: "OptionsListComponent",
Expand Down Expand Up @@ -153,6 +157,7 @@ export default defineComponent({
computedOptionWrapperStyles,
computedHeaderStyle,
computedFooterStyle,
metaInfo,
};
},
});
Expand Down
8 changes: 4 additions & 4 deletions src/Signup/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
comet<b>chat</b>
</div>
<div class="release-tag" :style="styles.headerSubtitleStyle()">
4.0.0
<p v-text="`v${metaInfo.version}`"></p>
</div>
</div>
<div class="content__section">
Expand Down Expand Up @@ -68,9 +68,7 @@
</div>
<div class="right__content" :style="styles.sectionImageStyle()"></div>
</div>
<div class="footer__section">
<footer :style="styles.footerStyle()">2022 &copy; CometChat</footer>
</div>
<div class="footer__section"></div>
</div>
</div>
<div class="spinner__wheel" v-if="inProgress">
Expand Down Expand Up @@ -103,6 +101,7 @@ import {
CometChatLogo,
} from "../assets";
import { CometChatUIKit } from "@cometchat/chat-uikit-vue";
import { metaInfo } from "../../metaInfo";
export default defineComponent({
name: "SignupComponent",
Expand Down Expand Up @@ -278,6 +277,7 @@ export default defineComponent({
CometChatLogo,
SpinnerSvg,
inProgress,
metaInfo,
};
},
});
Expand Down
8 changes: 4 additions & 4 deletions src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { CometChatTheme, CometChatUIKit } from "@cometchat/chat-uikit-vue";
import { createApp, ref } from "vue";

import App from "./App.vue";
import { COMETCHAT_CONSTANTS } from "./consts";
import { AppConstants } from "./AppConstants";
import CardComponent from "../src/Card/index.vue";
import { CometChat } from "@cometchat/chat-sdk-javascript";
import { CometChatConversations } from "@cometchat/chat-uikit-vue";
Expand All @@ -14,9 +14,9 @@ import getRouter from "./router";
import { metaInfo } from "./metaInfo";

const uiKitSettings = new UIKitSettingsBuilder()
.setAppId(COMETCHAT_CONSTANTS.APP_ID)
.setRegion(COMETCHAT_CONSTANTS.REGION)
.setAuthKey(COMETCHAT_CONSTANTS.AUTH_KEY)
.setAppId(AppConstants.APP_ID)
.setRegion(AppConstants.REGION)
.setAuthKey(AppConstants.AUTH_KEY)
.subscribePresenceForFriends()
.build();

Expand Down

0 comments on commit 45ab8a1

Please sign in to comment.