/algo_chat

Social App based Off Algorand blockchain

Primary LanguageDartApache License 2.0Apache-2.0

Algorand Social Network Application (SNT)

Apache License

SOLANA ALGO SND INVEST

AlgoChat is a Cross-Platform(Android & iOS) Mobile Application using the Algorand blockchain written in Dart and built on Flutter and others. It actualizes many functionalities viz; chatting with friends, Posting of polls, posting of products/listings(ads), payment for purchases using Algocoins,sending and receiving Algocoins, direct messaging, video chatting, voice chatting, live stream of events and many others.

Architecture

The AlgoChat Wallet built upon the wallet-core SDK, which provides a set of API's for the AlgoChat platform and its auxiliary services. Those services include:

Demo

Download the release APK to try out AlgoChat

Features

  • Post photo posts from camera or gallery

    • Like posts
    • Comment on posts
    • View all comments on a post
  • Profile Pages

    • Follow / Unfollow Users
    • Change image view from grid layout to feed layout
    • Add your own bio
    • Copy user public address
    • Send Algocoins to user, Etc.
  • Activity Feed showing recent likes / comments of your posts + new followers

  • Direct Messaging

  • Video Calls (using Agora functions)

    • Custom Camera Implementation
  • Firebase Security Rules

  • Voice Calls (using Agora functions)

  • Live Video Streaming

  • Stories

  • And others here

Screenshots

Dependencies

Download the App

You can download the beta version of our app from the Google Play or the App Store

Getting Started

As a developer

If you have any issue cloning this project Chat me upYou can click here

Configuring the environment

  1. Make a copy of .env_example named .env - cd environment && cp .env_example .env
  • For Android development, create a file at ./android/key.properties, as described here, containing the keystore path and passwords, as set up earlier.
  • Run flutter doctor to check which tools are installed on the local machine and which tools need to be configured. Make sure all of them are checked and enabled.
  • Then Run the app.

    flutter run
    

If you have some issues running the sample project, make sure Flutter is enabled and active:

  1. Open plugin preferences (File > Settings > Plugins).
  2. Select Marketplace, select the Flutter plugin and click Install.
  3. Restart the IDE

3. Setup the firebase app

  1. You'll need to create a Firebase instance. Follow the instructions at https://console.firebase.google.com.
  2. Once your Firebase instance is created, you'll need to enable Google authentication.
  • Go to the Firebase Console for your new instance.
  • Click "Authentication" in the left-hand menu
  • Click the "sign-in method" tab
  • Click "Google" and enable it
  1. Create Cloud Functions (to make the Feed work)
  • Create a new firebase project with firebase init
  • Copy this project's functions/lib/index.js to your firebase project's functions/index.js
  • Push the function getFeed with firebase deploy --only functions In the output, you'll see the getFeed URL, copy that.
  • Replace the url in the _getFeed function in feed.dart with your cloud function url from the previous step.

If you are getting no errors, but an empty feed You must post photos or follow users with posts as the getFeed function only returns your own posts & posts from people you follow.

  1. Enable the Firebase Database
  • Go to the Firebase Console
  • Click "Database" in the left-hand menu
  • Click the Cloudstore "Create Database" button
  • Select "Start in test mode" and "Enable"
  1. (skip if not running on Android)
  • Create an app within your Firebase instance for Android, with package name com.yourcompany.news
  • Run the following command to get your SHA-1 key:
keytool -exportcert -list -v \
-alias androiddebugkey -keystore ~/.android/debug.keystore
  • In the Firebase console, in the settings of your Android app, add your SHA-1 key by clicking "Add Fingerprint, if you want to include that to your login access".
  • Follow instructions to download google-services.json
  • place google-services.json into /android/app/.
  1. (skip if not running on iOS)
  • Create an app within your Firebase instance for iOS, with your app package name
  • Follow instructions to download GoogleService-Info.plist
  • Open XCode, right click the Runner folder, select the "Add Files to 'Runner'" menu, and select the GoogleService-Info.plist file to add it to /ios/Runner in XCode
  • Open /ios/Runner/Info.plist in a text editor. Locate the CFBundleURLSchemes key. The second item in the array value of this key is specific to the Firebase instance. Replace it with the value for REVERSED_CLIENT_ID from GoogleService-Info.plist

Double check install instructions for both

Application Structure

If you opened this file in Vs code, you should have a file structure similar to the image below:

Algorand Wallet


  final algodClient = AlgodClient(
    apiUrl: PureStake.TESTNET_ALGOD_API_URL,
    apiKey: apiKey,
    tokenKey: PureStake.API_TOKEN_HEADER,
  );

  final indexerClient = IndexerClient(
    
  );

  final algorand = Algorand(
    algodClient: algodClient,
    indexerClient: indexerClient,
  );
  • Algorand

  • Algorand Accoun Fetch

	final accountInformation = await algorand.getAccountByAddress(account.publicAddress);
	final amount = information.amountWithoutPendingRewards;
	final pendingRewards = information.pendingRewards;

	AlgorandBalance(
   	 balance: Algo.fromMicroAlgos(amount).toString(),
	),
	algoSendDialog(context, {String uid}) {
  	return showDialog(
    	  context: context,
     	 builder: (context) {
     	   return Container(
          height: MediaQuery.of(context).size.height * 0.4,
          margin: EdgeInsets.all(35),

Voice and Video call

Agora.io provides building blocks for you to add real-time voice and video communications through a simple and powerful SDK. You can integrate the Agora SDK to enable real-time communications in your own application quickly. Agora Video SDK requires camera and microphone permission to start video call.

  • Android Open the AndroidManifest.xml file and add the required device permissions to the file.

    <uses-permission android:name="android.permission.READ_PHONE_STATE"/>
    <uses-permission android:name="android.permission.INTERNET" />
    <uses-permission android:name="android.permission.RECORD_AUDIO" />
    <uses-permission android:name="android.permission.CAMERA" />
    <uses-permission android:name="android.permission.MODIFY_AUDIO_SETTINGS" />
    <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
    
    <!-- The Agora SDK requires Bluetooth permissions in case users are using Bluetooth devices.-->
    <uses-permission android:name="android.permission.BLUETOOTH" />
    
  • iOS Open the Info.plist and add:

Privacy - Microphone Usage Description, and add a note in the Value column. Privacy - Camera Usage Description, and add a note in the Value column.

Chat, Call & Video Messaging

class CallMethods {
  final CollectionReference callCollection =
      FirebaseFirestore.instance.collection(CALL_COLLECTION);

  Stream<DocumentSnapshot> callStream({String uid}) =>
      callCollection.doc(uid).snapshots();

  Future<bool> makeCall({Call call}) async {
    try {
      call.hasDialled = true;
      Map<String, dynamic> hasDialledMap = call.toMap(call);

      call.hasDialled = false;
      Map<String, dynamic> hasNotDialledMap = call.toMap(call);

      await callCollection.doc(call.callerId).set(hasDialledMap);
      await callCollection.doc(call.receiverId).set(hasNotDialledMap);
      return true;
    } catch (e) {
      print(e);
      return false;

Many Others Fuctionalities were discussed and displayed in this app Download and enjoy the App. Thanks