npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

@praveenptl71/chatbox

v1.1.1

Published

A firebase chatbox package for ionic 4 using realtime database

Downloads

14

Readme

Chatbox

Chatbox is a npm module for ionic (version >= 4) to integrate in existing Ionic 4 projects.

In this module firebase realtime database is used for chatting, There are 2 tabs, one is inbox tab and another is contacts tab, where all firebase users are displayed. By using this chat module you can send text & image message.

Installation

Run following command to install Chatbox in your project.

npm i @praveenptl71/chatbox --save

Documentation

Basic Usage

Ionic/Angular apps

To use this package, import and add the module to your @NgModule, and then inject it where you wish to use it.

// app.module.ts
import { ChatModule } from '@praveenptl71/chatbox';

...

@NgModule({
  ...

  imports: [
    ...
    ChatModule
    ...
  ]
  ...
})
export class AppModule { }

Add firebase app

Import package

import * as firebase from 'firebase';

Initialize app (if you are already initialized firebase app in your projects, do not initialize this again)

let firebaseConfig = { 
	/* 
	* firebase config 
	*/ 
	};
firebase.initializeApp(firebaseConfig);

Import service to load users and chats

import { UserService, RoomService } from '@praveenptl71/chatbox';

add in constructor

constructor( ..., public userService:UserService, public roomService:RoomService, ...)

Signup to firebase app

create new account (if don't have account)

firebase.auth().createUserWithEmailAndPassword('[email protected]', '123456').then(data=>{
     // update user profile after sign up
     this.userService.updateUserProfile({descriptions:'', name:'',pictureURL:''});

     // load all users and chats
	this.userService.getUsers(); 
	this.roomService.getAllRooms();

	// navigate to this url
	this.navCtrl.navigateForward('/chatbox/tabs/inbox'); 
})
.catch(error=>{
  
})

Login to firebase app

(if already have account)

Login with email and password

firebase.auth().signInWithEmailAndPassword('[email protected]', '123456').then(user=>{ 
	// load all users and chats
	this.userService.getUsers(); 
	this.roomService.getAllRooms();

	// navigate to this url
	this.navCtrl.navigateRoot('/chatbox/tabs/inbox'); 
}) 
.catch(error=>{ 
	console.error(error); 
})

Theming

Apply your theme color add these code (you can change color code)

// theme/variable.scss

:root {
	...
	/** chatboxPrimary **/
    --ion-color-chatboxPrimary: #1798d2;
    --ion-color-chatboxPrimary-rgb: 23, 152, 210;
    --ion-color-chatboxPrimary-contrast: #ffffff;
    --ion-color-chatboxPrimary-contrast-rgb: 255, 255, 255;
    --ion-color-chatboxPrimary-shade: #1486b9;
    --ion-color-chatboxPrimary-tint: #2ea2d7;
    /** chatboxLight **/
    --ion-color-chatboxLight: #f4f5f8;
    --ion-color-chatboxLight-rgb: 244, 244, 244;
    --ion-color-chatboxLight-contrast: #000000;
    --ion-color-chatboxLight-contrast-rgb: 0, 0, 0;
    --ion-color-chatboxLight-shade: #d7d8da;
    --ion-color-chatboxLight-tint: #f5f6f9;
    ...
}

.ion-color-chatboxPrimary {
    --ion-color-base: var(--ion-color-chatboxPrimary) !important;
    --ion-color-base-rgb: var(--ion-color-chatboxPrimary-rgb) !important;
    --ion-color-contrast: var(--ion-color-chatboxPrimary-contrast) !important;
    --ion-color-contrast-rgb: var(--ion-color-chatboxPrimary-contrast-rgb) !important;
    --ion-color-shade: var(--ion-color-chatboxPrimary-shade) !important;
    --ion-color-tint: var(--ion-color-chatboxPrimary-tint) !important;
}

.ion-color-chatboxLight {
    --ion-color-base: var(--ion-color-chatboxLight) !important;
    --ion-color-base-rgb: var(--ion-color-chatboxLight-rgb) !important;
    --ion-color-contrast: var(--ion-color-chatboxLight-contrast) !important;
    --ion-color-contrast-rgb: var(--ion-color-chatboxLight-contrast-rgb) !important;
    --ion-color-shade: var(--ion-color-chatboxLight-shade) !important;
    --ion-color-tint: var(--ion-color-chatboxLight-tint) !important;
}

Credits

Praveen Patel - @praveenptl71