Skip to content

Instantly share code, notes, and snippets.

View hieptl's full-sized avatar
🎯
Focusing

Hiep Le hieptl

🎯
Focusing
View GitHub Profile
@hieptl
hieptl / index.js
Created September 28, 2021 13:01
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")
@hieptl
hieptl / index.js
Last active October 13, 2021 06:59
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) {
@hieptl
hieptl / index.js
Last active September 28, 2021 16:55
index.js - Create a New Matching Request - Client Side - Tinder Clone
window.addEventListener("DOMContentLoaded", function () {
...
const authenticatedUser = JSON.parse(localStorage.getItem("auth"));
if (authenticatedUser) {
...
// main card item.
const mainCardEmptyMessage = document.getElementById("main__card-empty");
const mainCardItemContainer = document.getElementById("main__card-item-container");
// main card actions.
@hieptl
hieptl / index.js
Created September 28, 2021 13:25
index.js - Show the List of Matching Requests - Client Side - Tinder Clone
window.addEventListener("DOMContentLoaded", function () {
...
const authenticatedUser = JSON.parse(localStorage.getItem("auth"));
if (authenticatedUser) {
...
// match requests dialog
const requestsEmpty = document.getElementById("requests__empty");
const requestsBtn = document.getElementById("requests-trigger");
const requestsCloseBtn = document.getElementById("requests__close");
const requestsContainer = document.getElementById("requests");
@hieptl
hieptl / index.js
Created September 28, 2021 13:32
index.js - Update the Match Request Status - Client Side - Tinder Clone
window.addEventListener("DOMContentLoaded", function () {
...
const authenticatedUser = JSON.parse(localStorage.getItem("auth"));
if (authenticatedUser) {
...
const addFriend = (matchRequestFrom, matchRequestTo) => {
if (matchRequestFrom && matchRequestTo) {
const url = `https://${config.CometChatAppId}.api-${config.CometChatRegion}.cometchat.io/v3.0/users/${matchRequestTo}/friends`;
axios.post(url, { accepted: [matchRequestFrom] }, {headers: {
Accept: "application/json",
@hieptl
hieptl / index.js
Created September 28, 2021 13:44
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) => {
@hieptl
hieptl / index.js
Last active October 13, 2021 07:01
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");
@hieptl
hieptl / login.js
Created September 28, 2021 14:15
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.
@hieptl
hieptl / index.js
Created September 28, 2021 16:49
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");
@hieptl
hieptl / LoginActivity.java
Last active October 26, 2021 13:53
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;