use of com.example.c4q.capstone.utils.currentuser.CurrentUserUtility in project Grupp by tmoronta1208.
the class LoginActivity method onCreate.
@Override
protected void onCreate(@Nullable Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
// button views
signInButton = findViewById(R.id.google_button);
emailLogInButton = findViewById(R.id.btn_login);
// publicUserDatabaseReference = firebaseDatabase.getReference().child(Constants.PUBLIC_USER);
// getUserData();
emailLogInButton.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
signIn();
}
});
signInButton.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
signIn();
}
});
mAuthListner = new FirebaseAuth.AuthStateListener() {
@Override
public void onAuthStateChanged(@NonNull FirebaseAuth firebaseAuth) {
if (firebaseAuth.getCurrentUser() != null) {
CurrentUserUtility currentUserUtility = new CurrentUserUtility();
currentUserUtility.getCurrentPublicUser(new PublicUserListener() {
@Override
public void publicUserExists(Boolean userExists) {
Log.w("TAG", "login user exist" + userExists);
if (userExists) {
Log.w("TAG", "login user has profile" + userExists);
startActivity(new Intent(LoginActivity.this, UserProfileActivity.class));
} else {
Log.w("TAG", "login user does not have profile " + userExists);
startActivity(new Intent(LoginActivity.this, OnBoardActivity.class));
}
}
});
startActivity(new Intent(LoginActivity.this, OnBoardActivity.class));
}
}
};
GoogleSignInOptions gso = new GoogleSignInOptions.Builder(GoogleSignInOptions.DEFAULT_SIGN_IN).requestIdToken(getString(R.string.default_web_client_id)).requestEmail().build();
// Build a GoogleSignInClient with the options specified by gso.
mGoogleSignInClient = GoogleSignIn.getClient(this, gso);
}
use of com.example.c4q.capstone.utils.currentuser.CurrentUserUtility in project Grupp by tmoronta1208.
the class UserProfileActivity method pushEventInviteNotifications.
public void pushEventInviteNotifications() {
final Context mContext = getApplicationContext();
CurrentUserUtility currentUserUtility = new CurrentUserUtility();
currentUserUtility.getSingleEventInviteList(CurrentUser.userID, new UserEventListener() {
@Override
public void getUserEventList(Map<String, UserEvent> userEventMap) {
if (userEventMap != null) {
Log.d(TAG, "notifications not null");
for (String s : userEventMap.keySet()) {
String eventName = userEventMap.get(s).getEvent_name();
String userName = userEventMap.get(s).getEvent_organizer_full_name();
String title = userName;
String desc = "You're invited to " + eventName + "!";
new InviteNotifications(title, desc, getApplicationContext(), userEventMap.get(s).getEvent_id());
}
} else {
Log.d(TAG, "notifications null");
}
}
});
//
}
Aggregations