Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixes #4294 'added profile deleted message' #4560

Closed
wants to merge 26 commits into from
Closed
Show file tree
Hide file tree
Changes from 2 commits
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
69bbc79
added profile deleted message
mbobiosio Sep 6, 2022
b386cdb
fixed classes in alphabetical order
mbobiosio Sep 7, 2022
f1e3428
added kdoc
mbobiosio Sep 8, 2022
5ff1077
reviewed comments
mbobiosio Sep 9, 2022
a92c3ed
outside touch for dialog
mbobiosio Sep 9, 2022
1d634af
updated tag
mbobiosio Sep 13, 2022
7882cf7
set outside cancelable to true
mbobiosio Sep 13, 2022
5daf12d
updated tag id
mbobiosio Sep 15, 2022
c0f91a2
added new tests
mbobiosio Sep 16, 2022
3492144
added new tests
mbobiosio Sep 16, 2022
4793299
added new tests
mbobiosio Sep 16, 2022
047c6e0
updated KDoc for tag
mbobiosio Sep 20, 2022
c1274d4
excluded DeleteProfileSuccessDialogFragment in test_file_exemptions.t…
mbobiosio Sep 21, 2022
96d628d
completed unit testing
mbobiosio Sep 23, 2022
2508427
updated comment for new instance
mbobiosio Sep 29, 2022
fa4b79b
removed 'check' from name
mbobiosio Sep 30, 2022
80f8b48
removed unnecessary space
mbobiosio Sep 30, 2022
df71f74
injected AppLanguageResourceHandler for dialog
mbobiosio Sep 30, 2022
af3f9f0
closing dialog and validating activity is running
mbobiosio Oct 4, 2022
d4d176e
closing dialog and validating activity is running -fixed ktlint
mbobiosio Oct 4, 2022
67eca56
added activity state check after closing dialog
mbobiosio Oct 4, 2022
dc9cdb6
removed activitytestrule
mbobiosio Oct 5, 2022
958357d
Merge branch 'develop' into delete-profile-message
mbobiosio Oct 5, 2022
4f5947e
removed unnecessary checks
mbobiosio Oct 13, 2022
1c07fef
removed the test to verify intent
mbobiosio Oct 13, 2022
0e361e6
fixed unused imports
mbobiosio Oct 13, 2022
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
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ import org.oppia.android.app.profile.ResetPinDialogFragment
import org.oppia.android.app.profileprogress.ProfilePictureEditDialogFragment
import org.oppia.android.app.profileprogress.ProfileProgressFragment
import org.oppia.android.app.resumelesson.ResumeLessonFragment
import org.oppia.android.app.settings.profile.DeleteProfileSuccessDialogFragment
import org.oppia.android.app.settings.profile.ProfileEditDeletionDialogFragment
import org.oppia.android.app.settings.profile.ProfileEditFragment
import org.oppia.android.app.settings.profile.ProfileListFragment
Expand Down Expand Up @@ -109,6 +110,7 @@ interface FragmentComponentImpl : FragmentComponent, ViewComponentBuilderInjecto
fun inject(cellularAudioDialogFragment: CellularAudioDialogFragment)
fun inject(completedStoryListFragment: CompletedStoryListFragment)
fun inject(conceptCardFragment: ConceptCardFragment)
fun inject(deleteProfileSuccessDialogFragment: DeleteProfileSuccessDialogFragment)
fun inject(developerOptionsFragment: DeveloperOptionsFragment)
fun inject(downloadsTabFragment: DownloadsTabFragment)
fun inject(exitProfileDialogFragment: ExitProfileDialogFragment)
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
package org.oppia.android.app.settings.profile

import android.app.Dialog
import android.content.Context
import android.content.Intent
import android.os.Bundle
import androidx.appcompat.app.AlertDialog
import org.oppia.android.R
import org.oppia.android.app.administratorcontrols.AdministratorControlsActivity
import org.oppia.android.app.fragment.FragmentComponentImpl
import org.oppia.android.app.fragment.InjectableDialogFragment

class DeleteProfileSuccessDialogFragment : InjectableDialogFragment() {
rt4914 marked this conversation as resolved.
Show resolved Hide resolved

companion object {
const val TAG = "TAG_DELETE_DIALOG_FRAGMENT"
rt4914 marked this conversation as resolved.
Show resolved Hide resolved

fun newInstance(): DeleteProfileSuccessDialogFragment {
rt4914 marked this conversation as resolved.
Show resolved Hide resolved
BenHenning marked this conversation as resolved.
Show resolved Hide resolved
return DeleteProfileSuccessDialogFragment()
}
}

override fun onAttach(context: Context) {
super.onAttach(context)
(fragmentComponent as FragmentComponentImpl).inject(this)
}

override fun onCreateDialog(savedInstanceState: Bundle?): Dialog {
return AlertDialog.Builder(requireContext(), R.style.OppiaAlertDialogTheme)
.setMessage(R.string.profile_edit_delete_successful_message)
.setPositiveButton(R.string.log_out_dialog_okay_button) { _, _ ->
if (requireContext().resources.getBoolean(R.bool.isTablet)) {
val intent =
Intent(requireContext(), AdministratorControlsActivity::class.java)
intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP)
startActivity(intent)
} else {
val intent = Intent(requireContext(), ProfileListActivity::class.java)
intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP)
startActivity(intent)
}
}.create()
rt4914 marked this conversation as resolved.
Show resolved Hide resolved
}
}
Original file line number Diff line number Diff line change
@@ -1,13 +1,11 @@
package org.oppia.android.app.settings.profile

import android.content.Intent
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import androidx.appcompat.app.AppCompatActivity
import androidx.fragment.app.Fragment
import androidx.lifecycle.Observer
import org.oppia.android.R
import org.oppia.android.app.administratorcontrols.AdministratorControlsActivity
import org.oppia.android.app.administratorcontrols.ProfileEditDeletionDialogListener
import org.oppia.android.app.fragment.FragmentScope
Expand Down Expand Up @@ -133,18 +131,10 @@ class ProfileEditFragmentPresenter @Inject constructor(
.deleteProfile(ProfileId.newBuilder().setInternalId(internalProfileId).build()).toLiveData()
.observe(
fragment,
Observer {
{
if (it is AsyncResult.Success) {
if (fragment.requireContext().resources.getBoolean(R.bool.isTablet)) {
val intent =
Intent(fragment.requireContext(), AdministratorControlsActivity::class.java)
intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP)
fragment.startActivity(intent)
} else {
val intent = Intent(fragment.requireContext(), ProfileListActivity::class.java)
intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP)
fragment.startActivity(intent)
}
DeleteProfileSuccessDialogFragment.newInstance()
.showNow(fragment.childFragmentManager, DeleteProfileSuccessDialogFragment.TAG)
}
}
)
Expand Down
1 change: 1 addition & 0 deletions app/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -341,6 +341,7 @@
<string name="profile_edit_delete">Profile Deletion</string>
<string name="profile_edit_delete_dialog_title">Permanently delete this profile?</string>
<string name="profile_edit_delete_dialog_message">All progress will be deleted and cannot be recovered.</string>
<string name="profile_edit_delete_successful_message">Profile deleted successfully.</string>
<string name="profile_edit_delete_dialog_positive">Delete</string>
<string name="profile_edit_delete_dialog_negative">Cancel</string>
<string name="profile_edit_allow_download_heading">Allow Download Access</string>
Expand Down