Skip to content

Commit

Permalink
Mark username megaphone completion after hitting continue.
Browse files Browse the repository at this point in the history
  • Loading branch information
alex-signal authored and nicholas-signal committed Feb 2, 2023
1 parent 93387ec commit fb07e89
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package org.thoughtcrime.securesms.dependencies;

import android.annotation.SuppressLint;
import android.app.Application;
import android.os.Handler;
import android.os.HandlerThread;
Expand Down Expand Up @@ -191,6 +192,7 @@ public ApplicationDependencyProvider(@NonNull Application context) {
return new FrameRateTracker(context);
}

@SuppressLint("DiscouragedApi")
public @NonNull MegaphoneRepository provideMegaphoneRepository() {
return new MegaphoneRepository(context);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import android.app.Application;

import androidx.annotation.AnyThread;
import androidx.annotation.Discouraged;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.annotation.WorkerThread;
Expand Down Expand Up @@ -34,6 +35,7 @@ public class MegaphoneRepository {

private boolean enabled;

@Discouraged(message = "Instances of MegaphoneRepository should be accessed via ApplicationDependencies.")
public MegaphoneRepository(@NonNull Application context) {
this.context = context;
this.executor = SignalExecutors.SERIAL;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,9 @@ import androidx.navigation.fragment.findNavController
import org.thoughtcrime.securesms.R
import org.thoughtcrime.securesms.components.ViewBinderDelegate
import org.thoughtcrime.securesms.databinding.UsernameEducationFragmentBinding
import org.thoughtcrime.securesms.dependencies.ApplicationDependencies
import org.thoughtcrime.securesms.keyvalue.SignalStore
import org.thoughtcrime.securesms.megaphone.Megaphones
import org.thoughtcrime.securesms.util.navigation.safeNavigate

/**
Expand All @@ -28,6 +30,7 @@ class UsernameEducationFragment : Fragment(R.layout.username_education_fragment)

binding.continueButton.setOnClickListener {
SignalStore.uiHints().markHasSeenUsernameEducation()
ApplicationDependencies.getMegaphoneRepository().markFinished(Megaphones.Event.SET_UP_YOUR_USERNAME)
findNavController().safeNavigate(UsernameEducationFragmentDirections.actionUsernameEducationFragmentToUsernameManageFragment())
}
}
Expand Down

0 comments on commit fb07e89

Please sign in to comment.