Skip to content
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
8 changes: 8 additions & 0 deletions ios/Flutter/flutter_export_environment.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
#!/bin/sh
# This is a generated file; do not edit or check into version control.
export "FLUTTER_ROOT=C:\Users\samar\flutter"
export "FLUTTER_APPLICATION_PATH=C:\Flutter Projects\HacktoberFest 2019\flutter-chat-app"
export "FLUTTER_TARGET=lib\main.dart"
export "FLUTTER_BUILD_DIR=build"
export "SYMROOT=${SOURCE_ROOT}/../build\ios"
export "FLUTTER_FRAMEWORK_DIR=C:\Users\samar\flutter\bin\cache\artifacts\engine\ios"
30 changes: 20 additions & 10 deletions lib/ChatScreen.dart
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ class ChatScreenState extends State<ChatScreen> {
sort: (a, b) => b.key.compareTo(a.key),
//comparing timestamp of messages to check which one would appear first
itemBuilder: (_, DataSnapshot messageSnapshot,
Animation<double> animation) {
Animation<double> animation, int i) {
return new ChatMessageListItem(
messageSnapshot: messageSnapshot,
animation: animation,
Expand Down Expand Up @@ -128,9 +128,11 @@ class ChatScreenState extends State<ChatScreen> {
.instance
.ref()
.child("img_" + timestamp.toString() + ".jpg");

StorageUploadTask uploadTask =
storageReference.put(imageFile);
Uri downloadUrl = (await uploadTask.future).downloadUrl;
storageReference.putFile(imageFile);
var downloadUrl =
uploadTask.lastSnapshot.ref.getDownloadURL();
_sendMessage(
messageText: null, imageUrl: downloadUrl.toString());
}),
Expand Down Expand Up @@ -194,18 +196,26 @@ class ChatScreenState extends State<ChatScreen> {
currentUserEmail = googleSignIn.currentUser.email;

if (await auth.currentUser() == null) {
GoogleSignInAuthentication credentials =
await googleSignIn.currentUser.authentication;
await auth.signInWithGoogle(
idToken: credentials.idToken, accessToken: credentials.accessToken);
final GoogleSignInAccount googleSignInAccount =
await googleSignIn.signIn();
final GoogleSignInAuthentication googleSignInAuthentication =
await googleSignInAccount.authentication;

final AuthCredential credential = GoogleAuthProvider.getCredential(
accessToken: googleSignInAuthentication.accessToken,
idToken: googleSignInAuthentication.idToken,
);

final AuthResult authResult =
await FirebaseAuth.instance.signInWithCredential(credential);
final FirebaseUser user = authResult.user;
}
}

Future _signOut() async {
await auth.signOut();
googleSignIn.signOut();
Scaffold
.of(_scaffoldContext)
Scaffold.of(_scaffoldContext)
.showSnackBar(new SnackBar(content: new Text('User logged out')));
}
}
}
Loading