Skip to content

Commit

Permalink
Fixed feedback email
Browse files Browse the repository at this point in the history
  • Loading branch information
PavloNetrebchuk committed Oct 31, 2023
1 parent dbdea15 commit c4dd89c
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ class FeedbackDialogFragment : BaseAppReviewDialogFragment() {
private fun sendEmail(feedback: String) {
EmailUtil.showFeedbackScreen(
context = requireContext(),
subject = feedback,
feedback = feedback,
appVersion = (requireActivity() as AppDataHolder).appData.versionName
)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,11 @@ import androidx.compose.ui.platform.ComposeView
import androidx.compose.ui.platform.ViewCompositionStrategy
import androidx.compose.ui.res.stringResource
import androidx.core.os.bundleOf
import androidx.lifecycle.lifecycleScope
import com.google.android.play.core.review.ReviewException
import com.google.android.play.core.review.ReviewManager
import kotlinx.coroutines.delay
import kotlinx.coroutines.launch
import org.koin.android.ext.android.inject
import org.openedx.core.R
import org.openedx.core.ui.theme.OpenEdXTheme
Expand Down Expand Up @@ -47,6 +50,17 @@ class ThankYouDialogFragment : BaseAppReviewDialogFragment() {
onNotNowClick = this@ThankYouDialogFragment::notNowClick,
onRateUsClick = this@ThankYouDialogFragment::openInAppReview
)

closeDialogDelay(isFeedbackPositive.value)
}
}
}

private fun closeDialogDelay(isFeedbackPositive: Boolean) {
if (!isFeedbackPositive) {
lifecycleScope.launch {
delay(3000)
dismiss()
}
}
}
Expand Down
5 changes: 3 additions & 2 deletions core/src/main/java/org/openedx/core/utils/EmailUtil.kt
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,8 @@ object EmailUtil {

fun showFeedbackScreen(
context: Context,
subject: String,
subject: String = context.getString(R.string.core_email_subject),
feedback: String = "",
appVersion: String
) {
val NEW_LINE = "\n"
Expand All @@ -25,7 +26,7 @@ object EmailUtil {
append("${context.getString(R.string.core_android_device_model)} ${Build.MODEL}")
append(NEW_LINE)
append(NEW_LINE)
append(context.getString(R.string.core_insert_feedback))
append("${context.getString(R.string.core_insert_feedback)} $feedback")
}
sendEmailIntent(context, to, subject, body.toString())
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -352,9 +352,8 @@ private fun SupportInfoSection(
onClick = {
onClick(SupportClickAction.SUPPORT)
EmailUtil.showFeedbackScreen(
context,
context.getString(R.string.core_email_subject),
appData.versionName
context = context,
appVersion = appData.versionName
)
}
)
Expand Down

0 comments on commit c4dd89c

Please sign in to comment.