This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
if (fileName.startsWith('thumb_')) { | |
console.log("the thumbnail is already created"); | |
return | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
exports.generateProfileThumbnail = functions.storage.object().onChange(event => { | |
const data = event.data; | |
const filePath = data.name; | |
const fileName = filePath.split("/").pop(); | |
const tmpFilePath = "/tmp/" + fileName; | |
const thumbFilePath = "/users/profileImages/thumb_" + fileName; | |
const metageneration = data.metageneration; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"name": "functions", | |
"description": "Cloud Functions for Firebase", | |
"dependencies": { | |
"@google-cloud/storage": "^1.2.0", | |
"child-process-promise": "^2.2.1", | |
"firebase-admin": "~4.2.1", | |
"firebase-functions": "^0.5" | |
}, | |
"private": true |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var functions = require('firebase-functions'); | |
const gcs = require('@google-cloud/storage')({ | |
keyFilename: "chatme-30a53-firebase-adminsdk-spbrj-95b05f5e2e-1.json" | |
}); | |
const spawn = require('child-process-promise').spawn; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var functions = require('firebase-functions'); | |
var admin = require('firebase-admin'); | |
admin.initializeApp(functions.config().firebase); | |
exports.createUserAccount = functions.auth.user().onCreate(event => { | |
const email = event.data.email; | |
const uid = event.data.uid; | |
const photoURL = event.data.photoURL || ""; | |
var username = event.data.displayName; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* a method to handle the state of the auth widgets, it displays a progress bar while the | |
* firebase authentication network process | |
* @param state if true the progress bar will be shown | |
* @param view holds the auth widget to hide or dispaly | |
*/ | |
private void showProgress(boolean state,View view){ | |
mProgressBarContainer =view.findViewById(R.id.progress_bar_container); | |
mEmailPasswordAuthContainer = view.findViewById(R.id.email_password_auth_container); | |
if(state) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* a public method to handel the facebook authentication | |
* | |
* @param token holds the user Facebook accessToken | |
*/ | |
public void handleFacebookAccessToken(AccessToken token) { | |
AuthCredential credential = FacebookAuthProvider.getCredential(token.getToken()); | |
FirebaseUtils.auth.signInWithCredential(credential) | |
.addOnCompleteListener(this, new OnCompleteListener<AuthResult>() { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* a public method to handel the user sign up event from the auth fragment | |
* | |
* @param email a string holds the user email address | |
* @param password a string holds the user text password | |
* @param view a view holds the auth widgets to hide | |
* | |
* | |
*/ | |
public void handleSignUp(String email, String password, final View view){ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* a public method to handel the user sign in event from the auth fragment | |
* | |
* @param email a string holds the user email address | |
* @param password a string holds the user text password | |
* @param view a view holds the auth widgets to hide | |
*/ | |
public void handleSignIn(String email, String password, final View view){ | |
showProgress(true,view); | |
FirebaseUtils.auth.signInWithEmailAndPassword(email, password).addOnCompleteListener( |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@Override | |
public void onAnimationStart(Animation animation) { | |
} | |
@Override | |
public void onAnimationEnd(Animation animation) { | |
new Handler().postDelayed(new Runnable() { | |
@Override | |
public void run() { |
NewerOlder