Sha256: 960ec371b9cb322dcbb9d2f08dd2bcd98303554032b337cddfc1ddf7833abbe7

Contents?: true

Size: 1.49 KB

Versions: 2

Compression:

Stored size: 1.49 KB

Contents

package <%= package_name %>.main

import androidx.appcompat.app.AppCompatActivity
import androidx.fragment.app.Fragment
import dev.hotwire.strada.Bridge
import dev.hotwire.turbo.config.TurboPathConfiguration
import <%= package_name %>.features.native.NumbersFragment
import <%= package_name %>.features.web.WebBottomSheetFragment
import <%= package_name %>.features.web.WebFragment
import <%= package_name %>.features.web.WebHomeFragment
import <%= package_name %>.features.web.WebModalFragment
import dev.hotwire.turbo.session.TurboSessionNavHostFragment
import <%= package_name %>.util.customUserAgent
import kotlin.reflect.KClass

abstract class BaseSessionNavHostFragment : TurboSessionNavHostFragment() {
    override val registeredActivities: List<KClass<out AppCompatActivity>>
        get() = listOf()

    override val registeredFragments: List<KClass<out Fragment>>
        get() = listOf(
            WebFragment::class,
            WebHomeFragment::class,
            WebModalFragment::class,
            WebBottomSheetFragment::class,
            NumbersFragment::class
        )

    override val pathConfigurationLocation: TurboPathConfiguration.Location
        get() = TurboPathConfiguration.Location(assetFilePath = "json/configuration.json")

    override fun onSessionCreated() {
        super.onSessionCreated()
        session.webView.settings.userAgentString = session.webView.customUserAgent

        // Initialize Strada bridge with new WebView instance
        Bridge.initialize(session.webView)
    }
}

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
turbo-native-initializer-0.0.19 lib/turbo_native_initializer/templates/android_tabs/app/src/main/java/dev/hotwire/turbo/turbonativeproject/main/BaseSessionNavHostFragment.kt.tt
turbo-native-initializer-0.0.18 lib/turbo_native_initializer/templates/android_tabs/app/src/main/java/dev/hotwire/turbo/turbonativeproject/main/BaseSessionNavHostFragment.kt.tt