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

mylife: smoother mysubmission prompt (fixes #5058) #5061

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
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 @@ -26,8 +26,11 @@ import org.ole.planet.myplanet.model.RealmStepExam
import org.ole.planet.myplanet.model.RealmSubmission
import org.ole.planet.myplanet.model.RealmSubmitPhotos
import org.ole.planet.myplanet.model.RealmUserModel
import org.ole.planet.myplanet.ui.courses.TakeCourseFragment.Companion.userModel
import org.ole.planet.myplanet.ui.submission.MySubmissionFragment
import org.ole.planet.myplanet.ui.survey.SurveyFragment
import org.ole.planet.myplanet.utilities.CameraUtils.ImageCaptureCallback
import org.ole.planet.myplanet.utilities.DialogUtils
import org.ole.planet.myplanet.utilities.NetworkUtils.getUniqueIdentifier
import org.ole.planet.myplanet.utilities.Utilities
import java.util.Date
Expand Down Expand Up @@ -117,14 +120,28 @@ abstract class BaseExamFragment : Fragment(), ImageCaptureCallback {
showUserInfoDialog()
} else {
saveCourseProgress()
AlertDialog.Builder(requireActivity(), R.style.AlertDialogTheme)
AlertDialog.Builder(requireActivity(), R.style.CustomAlertDialog)
.setTitle(getString(R.string.thank_you_for_taking_this) + type + getString(R.string.we_wish_you_all_the_best))
.setPositiveButton("Finish") { _: DialogInterface?, _: Int ->
.setNegativeButton("Finish") { _: DialogInterface?, _: Int ->
parentFragmentManager.popBackStack()
}
.setPositiveButton(R.string.view_your_mySubmissions) { dialog: DialogInterface, _: Int ->
if (userModel?.id?.startsWith("guest") == true) {
DialogUtils.guestDialog(requireContext())
} else {
redirectToMySubmissions();
}
}.show()
}
}
private fun redirectToMySubmissions(){
val fragment = MySubmissionFragment.newInstance("exam")

parentFragmentManager.beginTransaction()
.replace(R.id.fragment_container, fragment)
.addToBackStack(null)
.commit()
}
private fun saveCourseProgress() {
val progress = mRealm.where(RealmCourseProgress::class.java)
.equalTo("courseId", exam?.courseId)
Expand Down
1 change: 1 addition & 0 deletions app/src/main/res/values-ar/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -713,6 +713,7 @@
<string name="date_is_required">التاريخ مطلوب</string>
<string name="transaction_added">تمت إضافة المعاملة</string>
<string name="thank_you_for_taking_this">"شكرًا لك على إجراء هذا "</string>
<string name="view_your_mySubmissions">عرض تقديماتك</string>
<string name="we_wish_you_all_the_best">. نتمنى لك كل التوفيق</string>
<string name="thank_you_for_taking_this_survey">شكرًا لك على إجراء هذا الاستبيان.</string>
<string name="complete">اكتمل</string>
Expand Down
1 change: 1 addition & 0 deletions app/src/main/res/values-es/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -713,6 +713,7 @@
<string name="date_is_required">Se requiere una fecha</string>
<string name="transaction_added">Transacción agregada</string>
<string name="thank_you_for_taking_this">"Gracias por realizar este "</string>
<string name="view_your_mySubmissions">Ver tus envíos</string>
<string name="we_wish_you_all_the_best">. Te deseamos lo mejor</string>
<string name="thank_you_for_taking_this_survey">Gracias por completar esta encuesta.</string>
<string name="complete">completa</string>
Expand Down
1 change: 1 addition & 0 deletions app/src/main/res/values-fr/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -713,6 +713,7 @@
<string name="date_is_required">La date est requise</string>
<string name="transaction_added">Transaction ajoutée</string>
<string name="thank_you_for_taking_this">Merci d\'avoir pris ce(s) "</string>
<string name="view_your_mySubmissions">Voir vos soumissions</string>
<string name="we_wish_you_all_the_best">. Nous vous souhaitons tout le meilleur</string>
<string name="thank_you_for_taking_this_survey">Merci d\'avoir participé à cette enquête.</string>
<string name="complete">complète</string>
Expand Down
1 change: 1 addition & 0 deletions app/src/main/res/values-ne/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -713,6 +713,7 @@
<string name="date_is_required">मिति आवश्यक छ</string>
<string name="transaction_added">लेखा थपियो</string>
<string name="thank_you_for_taking_this">"यो लिनुको लागि धन्यवाद "</string>
<string name="view_your_mySubmissions">तपाईंका पेशाहरू हेर्नुहोस्</string>
<string name="we_wish_you_all_the_best">। हामीले तपाईंलाई सबै भन्दा राम्रो शुभकामना दिन्छौं</string>
<string name="thank_you_for_taking_this_survey">यो सर्वेक्षण लिनको लागि धन्यवाद।</string>
<string name="complete">समाप्त</string>
Expand Down
1 change: 1 addition & 0 deletions app/src/main/res/values-so/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -713,6 +713,7 @@
<string name="date_is_required">Taariikhdu waa loo baahan yahay</string>
<string name="transaction_added">Hawlasha lagu daray</string>
<string name="thank_you_for_taking_this">"Mahadsanid in aad la qaato "</string>
<string name="view_your_mySubmissions">Eeg soo gudbintaada</string>
<string name="we_wish_you_all_the_best">. Waxaan kugu rajaynaynaa dhammaan khayrka</string>
<string name="thank_you_for_taking_this_survey">Mahadsanid in aad iska soo qaatay suuragal</string>
<string name="complete">Buuxi</string>
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 @@ -713,6 +713,7 @@
<string name="date_is_required">Date is required</string>
<string name="transaction_added">Transaction added</string>
<string name="thank_you_for_taking_this">"Thank you for taking this "</string>
<string name="view_your_mySubmissions">View your Submissions</string>
<string name="we_wish_you_all_the_best">. We wish you all the best</string>
<string name="thank_you_for_taking_this_survey">Thank you for taking this survey.</string>
<string name="complete">complete</string>
Expand Down
Loading