package app.closer.core.navigation

import android.content.Context
import android.content.Intent
import android.net.Uri
import android.widget.Toast

object ExternalLinks {
    // TODO: Update placeholder URL before production.
    const val PRIVACY_POLICY = "https://closer.app/privacy"
    // TODO: Update placeholder URL before production.
    const val TERMS_OF_SERVICE = "https://closer.app/terms"
    // TODO: Update placeholder URL before production.
    const val SUBSCRIPTION_TERMS = "https://closer.app/subscription-terms"
    const val SUPPORT = "https://closer.app/support"
    const val MANAGE_SUBSCRIPTION = "https://play.google.com/store/account/subscriptions?package=app.closer"

    fun openUrl(context: Context, url: String) {
        val intent = Intent(Intent.ACTION_VIEW, Uri.parse(url))
        val resolved = intent.resolveActivity(context.packageManager)
        if (resolved != null) {
            context.startActivity(intent)
        } else {
            Toast.makeText(context, "No browser app found", Toast.LENGTH_SHORT).show()
        }
    }
}
