Skip to content

Instantly share code, notes, and snippets.

@kushalcc
kushalcc / LoginActivity.java
Created October 26, 2021 13:53 — forked from hieptl/LoginActivity.java
LoginActivity.java - Voice and Video Chat App - Android App
package com.cometchat.chatapp;
import android.app.ProgressDialog;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;
import android.widget.TextView;
import android.widget.Toast;
@kushalcc
kushalcc / login.js
Created October 13, 2021 07:05 — forked from hieptl/login.js
login.js - Logout - Client Side - Tinder Clone
...
logoutButon.addEventListener("click", function () {
const isLeaved = confirm("Do you want to log out?");
if (isLeaved) {
// logout from cometchat and then clear storage.
CometChat.logout().then((response) => {
// User successfully logged out.
// Perform any clean up if required.
localStorage.removeItem("auth");
// redirect to login page.
@kushalcc
kushalcc / index.js
Created October 13, 2021 07:05 — forked from hieptl/index.js
index.js - Audio / Video Calling - Client Side - Tinder Clone
window.addEventListener("DOMContentLoaded", function () {
...
const authenticatedUser = JSON.parse(localStorage.getItem("auth"));
if (authenticatedUser) {
...
// call
const callingDialog = document.getElementById("calling");
const acceptCallBtn = document.getElementById("accept-call");
const rejectCallBtn = document.getElementById("reject-call");
const audioCallBtn = document.getElementById("audio-call");
@kushalcc
kushalcc / index.js
Created October 13, 2021 07:01 — forked from hieptl/index.js
index.js - Chatbox - Client Side - Tinder Clone
window.addEventListener("DOMContentLoaded", function () {
...
// set header information
const authenticatedUser = JSON.parse(localStorage.getItem("auth"));
if (authenticatedUser) {
...
// chatbox
const chatBox = document.getElementById("chatbox");
const chatBoxUserAvatar = document.getElementById("chatbox__user-avatar");
const chatBoxUserName = document.getElementById("chatbox__user-name");
@kushalcc
kushalcc / index.js
Created October 13, 2021 07:00 — forked from hieptl/index.js
index.js - Load Matched Users - Client Side - Tinder Clone
window.addEventListener("DOMContentLoaded", function () {
...
const authenticatedUser = JSON.parse(localStorage.getItem("auth"));
if (authenticatedUser) {
...
// main left messages
const mainLeftMessagesContainer = document.getElementById("main__left-messages");
const mainLeftEmpty = document.getElementById("main__left-empty");
...
const renderFriends = (userList) => {
@kushalcc
kushalcc / index.js
Created October 13, 2021 06:59 — forked from hieptl/index.js
index.js - Show the List of Recommended Users - Swipe Effects - Client Side - Tinder Clone
window.addEventListener("DOMContentLoaded", function () {
...
if (authenticatedUser) {
// main card item.
const mainCardEmptyMessage = document.getElementById("main__card-empty");
const mainCardItemContainer = document.getElementById("main__card-item-container");
let notificationListenerID = authenticatedUser.uid;
...
const addFriend = (matchRequestFrom, matchRequestTo, matchRequestReceiver) => {
if (matchRequestFrom && matchRequestTo) {
@kushalcc
kushalcc / index.js
Created October 13, 2021 06:59 — forked from hieptl/index.js
index.js - Show the List of Recommended Users - Tinder Clone
window.addEventListener("DOMContentLoaded", function () {
...
if (authenticatedUser) {
...
// main card item.
const mainCardEmptyMessage = document.getElementById("main__card-empty");
const mainCardItemContainer = document.getElementById("main__card-item-container");
// main card actions.
const mainCardActions = document.getElementById("main__card-actions")
@kushalcc
kushalcc / index.js
Created October 13, 2021 06:58 — forked from hieptl/index.js
index.js - Client Side - Header - Tinder Clone
window.addEventListener("DOMContentLoaded", function () {
...
// set header information
const authenticatedUser = JSON.parse(localStorage.getItem("auth"));
if (authenticatedUser) {
...
// show authenticated user on the header.
const headerRight = document.getElementById("header__right");
const userImage = document.getElementById("user__image");
const userName = document.getElementById("user__name");
@kushalcc
kushalcc / login.js
Created October 13, 2021 06:56 — forked from hieptl/login.js
login.js - Register New Account - Tinder Clone
const registerNewAccount = ({ avatar, email, password, fullname, age, gender }) => {
showLoading();
const userUuid = uuid.v4();
const form = new FormData();
form.append("avatar", avatar);
form.append("email", email);
form.append("password", password);
form.append("age", age);
form.append("gender", gender);
form.append("ccUid", userUuid);
@kushalcc
kushalcc / util.js
Created October 13, 2021 06:55 — forked from hieptl/util.js
Util.js - Javascript Chat App
const loading = document.getElementById('loading');
function hideLoading() {
loading.classList.add('loading--hide');
}
function showLoading() {
loading.classList.remove('loading--hide');
loading.classList.add('loading--active');
}