Skip to content

Commit

Permalink
Add debug logs for lifecycle methods in LatteFragment
Browse files Browse the repository at this point in the history
  • Loading branch information
louischan-oursky committed Oct 25, 2024
1 parent 4424890 commit d92dd00
Showing 1 changed file with 6 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import android.graphics.Color
import android.net.Uri
import android.os.Build
import android.os.Bundle
import android.util.Log
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
Expand All @@ -30,6 +31,7 @@ import kotlin.coroutines.suspendCoroutine

internal class LatteFragment() : Fragment() {
companion object {
private const val TAG = "LatteFragment"
private const val KEY_ID = "id"
private const val KEY_URL = "url"
private const val KEY_REDIRECT_URI = "redirect_uri"
Expand Down Expand Up @@ -306,6 +308,7 @@ internal class LatteFragment() : Fragment() {
}

override fun onCreate(savedInstanceState: Bundle?) {
Log.d(TAG, "onCreate $this")
super.onCreate(savedInstanceState)

val backDispatcher = requireActivity().onBackPressedDispatcher
Expand All @@ -317,6 +320,7 @@ internal class LatteFragment() : Fragment() {
container: ViewGroup?,
savedInstanceState: Bundle?
): View {
Log.d(TAG, "onCreateView $this")
val webViewStateBundle = savedInstanceState?.getBundle(KEY_WEBVIEW_STATE)
val ctx = requireContext()
constructWebViewIfNeeded(ctx, webViewStateBundle)
Expand All @@ -342,6 +346,7 @@ internal class LatteFragment() : Fragment() {
}

override fun onDestroyView() {
Log.d(TAG, "onDestroyView $this")
super.onDestroyView()

// This lifecycle ended.
Expand All @@ -355,6 +360,7 @@ internal class LatteFragment() : Fragment() {
}

override fun onSaveInstanceState(outState: Bundle) {
Log.d(TAG, "onSaveInstanceState $this")
super.onSaveInstanceState(outState)
val webView = mutWebView ?: return
val webViewState = Bundle()
Expand Down

0 comments on commit d92dd00

Please sign in to comment.