Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
protected class SelfChallengeCanceller implements Transaction.Handler {
private final SelfChallengeManager mChallenger;
private SelfChallengeCanceller(SelfChallengeManager challenger) {
Log.d("MatchMaker.Cancel", "Opened cancel request");
mChallenger = challenger;
public Transaction.Result doTransaction(@NonNull MutableData mutableData) {
final String challengeKey = mChallenger.mChallengeRef.getKey();
for (MutableData challengeNode : mutableData.getChildren()) {
if (challengeNode.getKey().contentEquals(challengeKey)) {
return Transaction.success(mutableData);
public void onComplete(@Nullable DatabaseError databaseError, boolean b,
@Nullable DataSnapshot dataSnapshot) {
mChallenger.mChallengeRef = null;
final DatabaseReference gameRecordRef = mChallenger.mGameRecordRef;
if (gameRecordRef != null) {
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.