Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

added the update details screen and the profile screen along with client side code for stream #66

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .firebaserc
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"projects": {
"default": "chateo-72766"
}
}
1 change: 1 addition & 0 deletions .flutter-plugins-dependencies
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{"info":"This is a generated file; do not edit or check into version control.","plugins":{"ios":[{"name":"cloud_firestore","path":"/Users/meesumabbas/.pub-cache/hosted/pub.dev/cloud_firestore-5.2.1/","native_build":true,"dependencies":["firebase_core"]},{"name":"cloud_functions","path":"/Users/meesumabbas/.pub-cache/hosted/pub.dev/cloud_functions-5.0.4/","native_build":true,"dependencies":["firebase_core"]},{"name":"connectivity_plus","path":"/Users/meesumabbas/.pub-cache/hosted/pub.dev/connectivity_plus-6.0.5/","shared_darwin_source":true,"native_build":true,"dependencies":[]},{"name":"firebase_auth","path":"/Users/meesumabbas/.pub-cache/hosted/pub.dev/firebase_auth-5.1.4/","native_build":true,"dependencies":["firebase_core"]},{"name":"firebase_core","path":"/Users/meesumabbas/.pub-cache/hosted/pub.dev/firebase_core-3.3.0/","native_build":true,"dependencies":[]},{"name":"firebase_database","path":"/Users/meesumabbas/.pub-cache/hosted/pub.dev/firebase_database-11.0.4/","native_build":true,"dependencies":["firebase_core"]},{"name":"firebase_messaging","path":"/Users/meesumabbas/.pub-cache/hosted/pub.dev/firebase_messaging-15.0.4/","native_build":true,"dependencies":["firebase_core"]},{"name":"firebase_storage","path":"/Users/meesumabbas/.pub-cache/hosted/pub.dev/firebase_storage-12.1.3/","native_build":true,"dependencies":["firebase_core"]},{"name":"google_sign_in_ios","path":"/Users/meesumabbas/.pub-cache/hosted/pub.dev/google_sign_in_ios-5.7.6/","shared_darwin_source":true,"native_build":true,"dependencies":[]},{"name":"image_picker_ios","path":"/Users/meesumabbas/.pub-cache/hosted/pub.dev/image_picker_ios-0.8.12/","native_build":true,"dependencies":[]},{"name":"path_provider_foundation","path":"/Users/meesumabbas/.pub-cache/hosted/pub.dev/path_provider_foundation-2.4.0/","shared_darwin_source":true,"native_build":true,"dependencies":[]},{"name":"sqflite","path":"/Users/meesumabbas/.pub-cache/hosted/pub.dev/sqflite-2.3.3+1/","shared_darwin_source":true,"native_build":true,"dependencies":[]}],"android":[{"name":"cloud_firestore","path":"/Users/meesumabbas/.pub-cache/hosted/pub.dev/cloud_firestore-5.2.1/","native_build":true,"dependencies":["firebase_core"]},{"name":"cloud_functions","path":"/Users/meesumabbas/.pub-cache/hosted/pub.dev/cloud_functions-5.0.4/","native_build":true,"dependencies":["firebase_core"]},{"name":"connectivity_plus","path":"/Users/meesumabbas/.pub-cache/hosted/pub.dev/connectivity_plus-6.0.5/","native_build":true,"dependencies":[]},{"name":"firebase_auth","path":"/Users/meesumabbas/.pub-cache/hosted/pub.dev/firebase_auth-5.1.4/","native_build":true,"dependencies":["firebase_core"]},{"name":"firebase_core","path":"/Users/meesumabbas/.pub-cache/hosted/pub.dev/firebase_core-3.3.0/","native_build":true,"dependencies":[]},{"name":"firebase_database","path":"/Users/meesumabbas/.pub-cache/hosted/pub.dev/firebase_database-11.0.4/","native_build":true,"dependencies":["firebase_core"]},{"name":"firebase_messaging","path":"/Users/meesumabbas/.pub-cache/hosted/pub.dev/firebase_messaging-15.0.4/","native_build":true,"dependencies":["firebase_core"]},{"name":"firebase_storage","path":"/Users/meesumabbas/.pub-cache/hosted/pub.dev/firebase_storage-12.1.3/","native_build":true,"dependencies":["firebase_core"]},{"name":"flutter_plugin_android_lifecycle","path":"/Users/meesumabbas/.pub-cache/hosted/pub.dev/flutter_plugin_android_lifecycle-2.0.21/","native_build":true,"dependencies":[]},{"name":"google_sign_in_android","path":"/Users/meesumabbas/.pub-cache/hosted/pub.dev/google_sign_in_android-6.1.28/","native_build":true,"dependencies":[]},{"name":"image_picker_android","path":"/Users/meesumabbas/.pub-cache/hosted/pub.dev/image_picker_android-0.8.12+12/","native_build":true,"dependencies":["flutter_plugin_android_lifecycle"]},{"name":"path_provider_android","path":"/Users/meesumabbas/.pub-cache/hosted/pub.dev/path_provider_android-2.2.10/","native_build":true,"dependencies":[]},{"name":"sqflite","path":"/Users/meesumabbas/.pub-cache/hosted/pub.dev/sqflite-2.3.3+1/","native_build":true,"dependencies":[]}],"macos":[{"name":"cloud_firestore","path":"/Users/meesumabbas/.pub-cache/hosted/pub.dev/cloud_firestore-5.2.1/","native_build":true,"dependencies":["firebase_core"]},{"name":"cloud_functions","path":"/Users/meesumabbas/.pub-cache/hosted/pub.dev/cloud_functions-5.0.4/","native_build":true,"dependencies":["firebase_core"]},{"name":"connectivity_plus","path":"/Users/meesumabbas/.pub-cache/hosted/pub.dev/connectivity_plus-6.0.5/","shared_darwin_source":true,"native_build":true,"dependencies":[]},{"name":"file_selector_macos","path":"/Users/meesumabbas/.pub-cache/hosted/pub.dev/file_selector_macos-0.9.4/","native_build":true,"dependencies":[]},{"name":"firebase_auth","path":"/Users/meesumabbas/.pub-cache/hosted/pub.dev/firebase_auth-5.1.4/","native_build":true,"dependencies":["firebase_core"]},{"name":"firebase_core","path":"/Users/meesumabbas/.pub-cache/hosted/pub.dev/firebase_core-3.3.0/","native_build":true,"dependencies":[]},{"name":"firebase_database","path":"/Users/meesumabbas/.pub-cache/hosted/pub.dev/firebase_database-11.0.4/","native_build":true,"dependencies":["firebase_core"]},{"name":"firebase_messaging","path":"/Users/meesumabbas/.pub-cache/hosted/pub.dev/firebase_messaging-15.0.4/","native_build":true,"dependencies":["firebase_core"]},{"name":"firebase_storage","path":"/Users/meesumabbas/.pub-cache/hosted/pub.dev/firebase_storage-12.1.3/","native_build":true,"dependencies":["firebase_core"]},{"name":"google_sign_in_ios","path":"/Users/meesumabbas/.pub-cache/hosted/pub.dev/google_sign_in_ios-5.7.6/","shared_darwin_source":true,"native_build":true,"dependencies":[]},{"name":"image_picker_macos","path":"/Users/meesumabbas/.pub-cache/hosted/pub.dev/image_picker_macos-0.2.1+1/","native_build":false,"dependencies":["file_selector_macos"]},{"name":"path_provider_foundation","path":"/Users/meesumabbas/.pub-cache/hosted/pub.dev/path_provider_foundation-2.4.0/","shared_darwin_source":true,"native_build":true,"dependencies":[]},{"name":"sqflite","path":"/Users/meesumabbas/.pub-cache/hosted/pub.dev/sqflite-2.3.3+1/","shared_darwin_source":true,"native_build":true,"dependencies":[]}],"linux":[{"name":"connectivity_plus","path":"/Users/meesumabbas/.pub-cache/hosted/pub.dev/connectivity_plus-6.0.5/","native_build":false,"dependencies":[]},{"name":"file_selector_linux","path":"/Users/meesumabbas/.pub-cache/hosted/pub.dev/file_selector_linux-0.9.2+1/","native_build":true,"dependencies":[]},{"name":"image_picker_linux","path":"/Users/meesumabbas/.pub-cache/hosted/pub.dev/image_picker_linux-0.2.1+1/","native_build":false,"dependencies":["file_selector_linux"]},{"name":"path_provider_linux","path":"/Users/meesumabbas/.pub-cache/hosted/pub.dev/path_provider_linux-2.2.1/","native_build":false,"dependencies":[]}],"windows":[{"name":"cloud_firestore","path":"/Users/meesumabbas/.pub-cache/hosted/pub.dev/cloud_firestore-5.2.1/","native_build":true,"dependencies":["firebase_core"]},{"name":"connectivity_plus","path":"/Users/meesumabbas/.pub-cache/hosted/pub.dev/connectivity_plus-6.0.5/","native_build":true,"dependencies":[]},{"name":"file_selector_windows","path":"/Users/meesumabbas/.pub-cache/hosted/pub.dev/file_selector_windows-0.9.3+2/","native_build":true,"dependencies":[]},{"name":"firebase_auth","path":"/Users/meesumabbas/.pub-cache/hosted/pub.dev/firebase_auth-5.1.4/","native_build":true,"dependencies":["firebase_core"]},{"name":"firebase_core","path":"/Users/meesumabbas/.pub-cache/hosted/pub.dev/firebase_core-3.3.0/","native_build":true,"dependencies":[]},{"name":"firebase_storage","path":"/Users/meesumabbas/.pub-cache/hosted/pub.dev/firebase_storage-12.1.3/","native_build":true,"dependencies":["firebase_core"]},{"name":"image_picker_windows","path":"/Users/meesumabbas/.pub-cache/hosted/pub.dev/image_picker_windows-0.2.1+1/","native_build":false,"dependencies":["file_selector_windows"]},{"name":"path_provider_windows","path":"/Users/meesumabbas/.pub-cache/hosted/pub.dev/path_provider_windows-2.3.0/","native_build":false,"dependencies":[]}],"web":[{"name":"cloud_firestore_web","path":"/Users/meesumabbas/.pub-cache/hosted/pub.dev/cloud_firestore_web-4.1.1/","dependencies":["firebase_core_web"]},{"name":"cloud_functions_web","path":"/Users/meesumabbas/.pub-cache/hosted/pub.dev/cloud_functions_web-4.9.11/","dependencies":["firebase_core_web"]},{"name":"connectivity_plus","path":"/Users/meesumabbas/.pub-cache/hosted/pub.dev/connectivity_plus-6.0.5/","dependencies":[]},{"name":"firebase_auth_web","path":"/Users/meesumabbas/.pub-cache/hosted/pub.dev/firebase_auth_web-5.12.5/","dependencies":["firebase_core_web"]},{"name":"firebase_core_web","path":"/Users/meesumabbas/.pub-cache/hosted/pub.dev/firebase_core_web-2.17.4/","dependencies":[]},{"name":"firebase_database_web","path":"/Users/meesumabbas/.pub-cache/hosted/pub.dev/firebase_database_web-0.2.5+12/","dependencies":["firebase_core_web"]},{"name":"firebase_messaging_web","path":"/Users/meesumabbas/.pub-cache/hosted/pub.dev/firebase_messaging_web-3.8.12/","dependencies":["firebase_core_web"]},{"name":"firebase_storage_web","path":"/Users/meesumabbas/.pub-cache/hosted/pub.dev/firebase_storage_web-3.9.12/","dependencies":["firebase_core_web"]},{"name":"google_sign_in_web","path":"/Users/meesumabbas/.pub-cache/hosted/pub.dev/google_sign_in_web-0.12.4+2/","dependencies":[]},{"name":"image_picker_for_web","path":"/Users/meesumabbas/.pub-cache/hosted/pub.dev/image_picker_for_web-3.0.5/","dependencies":[]}]},"dependencyGraph":[{"name":"cloud_firestore","dependencies":["cloud_firestore_web","firebase_core"]},{"name":"cloud_firestore_web","dependencies":["firebase_core","firebase_core_web"]},{"name":"cloud_functions","dependencies":["cloud_functions_web","firebase_core"]},{"name":"cloud_functions_web","dependencies":["firebase_core","firebase_core_web"]},{"name":"connectivity_plus","dependencies":[]},{"name":"file_selector_linux","dependencies":[]},{"name":"file_selector_macos","dependencies":[]},{"name":"file_selector_windows","dependencies":[]},{"name":"firebase_auth","dependencies":["firebase_auth_web","firebase_core"]},{"name":"firebase_auth_web","dependencies":["firebase_core","firebase_core_web"]},{"name":"firebase_core","dependencies":["firebase_core_web"]},{"name":"firebase_core_web","dependencies":[]},{"name":"firebase_database","dependencies":["firebase_core","firebase_database_web"]},{"name":"firebase_database_web","dependencies":["firebase_core","firebase_core_web"]},{"name":"firebase_messaging","dependencies":["firebase_core","firebase_messaging_web"]},{"name":"firebase_messaging_web","dependencies":["firebase_core","firebase_core_web"]},{"name":"firebase_storage","dependencies":["firebase_core","firebase_storage_web"]},{"name":"firebase_storage_web","dependencies":["firebase_core","firebase_core_web"]},{"name":"flutter_plugin_android_lifecycle","dependencies":[]},{"name":"google_sign_in","dependencies":["google_sign_in_android","google_sign_in_ios","google_sign_in_web"]},{"name":"google_sign_in_android","dependencies":[]},{"name":"google_sign_in_ios","dependencies":[]},{"name":"google_sign_in_web","dependencies":[]},{"name":"image_picker","dependencies":["image_picker_android","image_picker_for_web","image_picker_ios","image_picker_linux","image_picker_macos","image_picker_windows"]},{"name":"image_picker_android","dependencies":["flutter_plugin_android_lifecycle"]},{"name":"image_picker_for_web","dependencies":[]},{"name":"image_picker_ios","dependencies":[]},{"name":"image_picker_linux","dependencies":["file_selector_linux"]},{"name":"image_picker_macos","dependencies":["file_selector_macos"]},{"name":"image_picker_windows","dependencies":["file_selector_windows"]},{"name":"path_provider","dependencies":["path_provider_android","path_provider_foundation","path_provider_linux","path_provider_windows"]},{"name":"path_provider_android","dependencies":[]},{"name":"path_provider_foundation","dependencies":[]},{"name":"path_provider_linux","dependencies":[]},{"name":"path_provider_windows","dependencies":[]},{"name":"sqflite","dependencies":[]}],"date_created":"2024-08-21 14:08:29.960398","version":"3.22.2"}
28 changes: 28 additions & 0 deletions analysis_options.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
# This file configures the analyzer, which statically analyzes Dart code to
# check for errors, warnings, and lints.
#
# The issues identified by the analyzer are surfaced in the UI of Dart-enabled
# IDEs (https://dart.dev/tools#ides-and-editors). The analyzer can also be
# invoked from the command line by running `flutter analyze`.

# The following line activates a set of recommended lints for Flutter apps,
# packages, and plugins designed to encourage good coding practices.
include: package:flutter_lints/flutter.yaml

linter:
# The lint rules applied to this project can be customized in the
# section below to disable rules from the `package:flutter_lints/flutter.yaml`
# included above or to enable additional rules. A list of all available lints
# and their documentation is published at https://dart.dev/lints.
#
# Instead of disabling a lint rule for the entire project in the
# section below, it can also be suppressed for a single line of code
# or a specific dart file by using the `// ignore: name_of_lint` and
# `// ignore_for_file: name_of_lint` syntax on the line or in the file
# producing the lint.
rules:
# avoid_print: false # Uncomment to disable the `avoid_print` rule
# prefer_single_quotes: true # Uncomment to enable the `prefer_single_quotes` rule

# Additional information about this file can be found at
# https://dart.dev/guides/language/analysis-options
19 changes: 19 additions & 0 deletions firebase.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
{
"firestore": {
"rules": "firestore.rules",
"indexes": "firestore.indexes.json"
},
"functions": [
{
"source": "functions",
"codebase": "default",
"ignore": [
"node_modules",
".git",
"firebase-debug.log",
"firebase-debug.*.log",
"*.local"
]
}
]
}
4 changes: 4 additions & 0 deletions firestore.indexes.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"indexes": [],
"fieldOverrides": []
}
19 changes: 19 additions & 0 deletions firestore.rules
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
rules_version = '2';

service cloud.firestore {
match /databases/{database}/documents {

// This rule allows anyone with your Firestore database reference to view, edit,
// and delete all data in your Firestore database. It is useful for getting
// started, but it is configured to expire after 30 days because it
// leaves your app open to attackers. At that time, all client
// requests to your Firestore database will be denied.
//
// Make sure to write security rules for your app before that time, or else
// all client requests to your Firestore database will be denied until you Update
// your rules
match /{document=**} {
allow read, write: if request.time < timestamp.date(2024, 8, 31);
}
}
}
7 changes: 7 additions & 0 deletions functions/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
.env
node_modules/
<<<<<<< Updated upstream
*.local
=======
*.local
>>>>>>> Stashed changes
99 changes: 99 additions & 0 deletions functions/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,99 @@
/**
* Import function triggers from their respective submodules:
*
* const {onCall} = require("firebase-functions/v2/https");
* const {onDocumentWritten} = require("firebase-functions/v2/firestore");
*
* See a full list of supported triggers at https://firebase.google.com/docs/functions
*/


if (process.env.NODE_ENV !== 'production') {
require('dotenv').config();
}
const StreamChat = require('stream-chat').StreamChat;
const functions = require("firebase-functions");
const admin = require("firebase-admin");

admin.initializeApp();

const serverClient = StreamChat.getInstance(process.env.STREAM_KEY, process.env.STREAM_SECRET);


// When a user is deleted from Firebase their associated Stream account is also deleted.
exports.deleteStreamUser = functions.auth.user().onDelete((user, context) => {
console.log(user.uid);
return serverClient.deleteUser(user.uid);
});

// Create a Stream user and return auth token.
exports.createStreamUserAndGetToken = functions.https.onCall(async (data, context) => {
// Checking that the user is authenticated.
if (!context.auth) {
// Throwing an HttpsError so that the client gets the error details.
throw new functions.https.HttpsError('failed-precondition', 'The function must be called ' +
'while authenticated.');
} else {
try {
// Create user using the serverClient.
await serverClient.upsertUser({
id: context.auth.uid,
name: context.auth.token.name,
email: context.auth.token.email,
image: context.auth.token.picture,
});

/// Create and return user auth token.
return serverClient.createToken(context.auth.uid);
} catch (err) {
console.error(`Unable to create user with ID ${context.auth.uid} on Stream. Error ${err}`);
// Throwing an HttpsError so that the client gets the error details.
throw new functions.https.HttpsError('aborted', "Could not create Stream user");
}
}
});

// Get Stream user token.
exports.getStreamUserToken = functions.https.onCall((data, context) => {
// Checking that the user is authenticated.
if (!context.auth) {
// Throwing an HttpsError so that the client gets the error details.
throw new functions.https.HttpsError('failed-precondition', 'The function must be called ' +
'while authenticated.');
} else {
try {
return serverClient.createToken(context.auth.uid);
} catch (err) {
console.error(`Unable to get user token with ID ${context.auth.uid} on Stream. Error ${err}`);
// Throwing an HttpsError so that the client gets the error details.
throw new functions.https.HttpsError('aborted', "Could not get Stream user");
}
}
});

// Revoke the authenticated user's Stream chat token.
exports.revokeStreamUserToken = functions.https.onCall((data, context) => {
// Checking that the user is authenticated.
if (!context.auth) {
// Throwing an HttpsError so that the client gets the error details.
throw new functions.https.HttpsError('failed-precondition', 'The function must be called ' +
'while authenticated.');
} else {
try {
return serverClient.revokeUserToken(context.auth.uid);
} catch (err) {
console.error(`Unable to revoke user token with ID ${context.auth.uid} on Stream. Error ${err}`);
// Throwing an HttpsError so that the client gets the error details.
throw new functions.https.HttpsError('aborted', "Could not get Stream user");
}
}
});


// Create and deploy your first functions
// https://firebase.google.com/docs/functions/get-started

// exports.helloWorld = onRequest((request, response) => {
// logger.info("Hello logs!", {structuredData: true});
// response.send("Hello from Firebase!");
// });
Binary file added images/Generic Image.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions ios/Flutter/Debug.xcconfig
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
#include? "Pods/Target Support Files/Pods-Runner/Pods-Runner.debug.xcconfig"
#include "Generated.xcconfig"
18 changes: 18 additions & 0 deletions ios/Flutter/Flutter.podspec
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
#
# This podspec is NOT to be published. It is only used as a local source!
# This is a generated file; do not edit or check into version control.
#

Pod::Spec.new do |s|
s.name = 'Flutter'
s.version = '1.0.0'
s.summary = 'A UI toolkit for beautiful and fast apps.'
s.homepage = 'https://flutter.dev'
s.license = { :type => 'BSD' }
s.author = { 'Flutter Dev Team' => '[email protected]' }
s.source = { :git => 'https://github.com/flutter/engine', :tag => s.version.to_s }
s.ios.deployment_target = '12.0'
# Framework linking is handled by Flutter tooling, not CocoaPods.
# Add a placeholder to satisfy `s.dependency 'Flutter'` plugin podspecs.
s.vendored_frameworks = 'path/to/nothing'
end
1 change: 1 addition & 0 deletions ios/Flutter/Release.xcconfig
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
#include? "Pods/Target Support Files/Pods-Runner/Pods-Runner.release.xcconfig"
#include "Generated.xcconfig"
Loading