Skip to content

Commit

Permalink
[23074]
Browse files Browse the repository at this point in the history
- [TripGov5] update configs.xml to add default resource string for terms_of_use_file_name
- [TripGov5] update HomeFragment to change initialization of TermsOfUseDialogFragment to include asset name
- [TripKitUI] update config.xml to remove terms_of_use_file_name to remove tou asset dependency on TripKitUI
- [TripKitUI] remove MockToU file
- [TripKitUI] update TermsOfUseDialogFragment to accept and use assetName for loading TOU file
  • Loading branch information
MichaelReyes committed Dec 27, 2024
1 parent 313ec16 commit d310e51
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 4 deletions.
Binary file removed TripKitAndroidUI/src/main/assets/MockToU.pdf
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,14 @@ import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import android.view.Window
import android.widget.Toast
import androidx.fragment.app.DialogFragment
import com.skedgo.tripkit.ui.R
import com.skedgo.tripkit.ui.databinding.DialogPdfDisplayBinding

class TermsOfUseDialogFragment(private val listener: Listener) : DialogFragment() {
class TermsOfUseDialogFragment(
private val assetName: String,
private val listener: Listener
) : DialogFragment() {

private lateinit var binding: DialogPdfDisplayBinding

Expand Down Expand Up @@ -48,7 +51,14 @@ class TermsOfUseDialogFragment(private val listener: Listener) : DialogFragment(
}

private fun setupWebView() {
binding.pdfView.fromAsset(getString(R.string.terms_of_use_file_name))
binding.pdfView.fromAsset(assetName)
.onError {
Toast.makeText(
requireContext(),
"Error loading Terms of Use, Please restart the app to try again.",
Toast.LENGTH_LONG
).show()
}
.onPageScroll { _, positionOffset ->
if (positionOffset >= 1) {
binding.btnAccept.isEnabled = true
Expand Down
1 change: 0 additions & 1 deletion TripKitAndroidUI/src/main/res/values/config.xml
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<bool name="trip_kit_use_service_color">false</bool>
<string name="terms_of_use_file_name">MockToU.pdf</string>
<string name="share_url">http://tripgo.me/stop/</string>
</resources>

0 comments on commit d310e51

Please sign in to comment.