|
@@ -1,5 +1,6 @@
|
|
|
package com.vpn.fastestvpnservice
|
|
|
|
|
|
+import android.content.Context
|
|
|
import android.content.Intent
|
|
|
import android.content.pm.PackageManager
|
|
|
import android.net.Uri
|
|
@@ -32,6 +33,7 @@ import androidx.lifecycle.ViewModelProvider
|
|
|
import androidx.lifecycle.get
|
|
|
import androidx.lifecycle.viewmodel.compose.viewModel
|
|
|
import androidx.navigation.compose.rememberNavController
|
|
|
+import com.vpn.fastestvpnservice.activities.SplashActivity
|
|
|
import de.blinkt.openvpn.core.App
|
|
|
import com.vpn.fastestvpnservice.beans.isDarkTheme
|
|
|
import com.vpn.fastestvpnservice.beans.selectedtheme
|
|
@@ -42,12 +44,13 @@ import com.vpn.fastestvpnservice.navigation.SetUpNavGraph
|
|
|
import com.vpn.fastestvpnservice.screens.helpScreensAll.fileChooserCallback
|
|
|
import com.vpn.fastestvpnservice.sealedClass.Screen
|
|
|
import com.vpn.fastestvpnservice.ui.theme.FastestVPNTheme
|
|
|
+import com.vpn.fastestvpnservice.utils.StaticMethods
|
|
|
import com.vpn.fastestvpnservice.viewmodels.BillingViewModel
|
|
|
import com.vpn.fastestvpnservice.viewmodels.LoginViewModel
|
|
|
import com.vpn.fastestvpnservice.viewmodels.SplashViewModel
|
|
|
import com.vpn.fastestvpnservice.viewmodels.SubscriptionViewModel
|
|
|
|
|
|
-class MainActivity : ComponentActivity() {
|
|
|
+open class MainActivity : ComponentActivity() {
|
|
|
val loginViewModel: LoginViewModel by viewModels()
|
|
|
|
|
|
|
|
@@ -83,26 +86,34 @@ class MainActivity : ComponentActivity() {
|
|
|
// )
|
|
|
// }
|
|
|
|
|
|
- setContent {
|
|
|
- val context = LocalContext.current
|
|
|
-
|
|
|
- val basePreferenceHelper = BasePreferenceHelper(context)
|
|
|
- val selectedTheme = basePreferenceHelper.getTheme()
|
|
|
-
|
|
|
- val isSystemInDarkTheme = isSystemInDarkTheme()
|
|
|
- val systemTheme by remember { mutableStateOf(isSystemInDarkTheme) }
|
|
|
- if (selectedTheme == themesList[0])
|
|
|
- {
|
|
|
- isDarkTheme.value = systemTheme
|
|
|
- }
|
|
|
- else {
|
|
|
- isDarkTheme.value = selectedTheme == themesList[2]
|
|
|
- }
|
|
|
+ if (StaticMethods.isTV(baseContext)) {
|
|
|
+ Log.d("test_platform_android", "TV")
|
|
|
+ val intent = Intent(this, SplashActivity::class.java)
|
|
|
+ startActivity(intent)
|
|
|
+ } else {
|
|
|
+ Log.d("test_platform_android", "Mobile")
|
|
|
+ setContent {
|
|
|
+ val context = LocalContext.current
|
|
|
+
|
|
|
+ val basePreferenceHelper = BasePreferenceHelper(context)
|
|
|
+ val selectedTheme = basePreferenceHelper.getTheme()
|
|
|
+
|
|
|
+ val isSystemInDarkTheme = isSystemInDarkTheme()
|
|
|
+ val systemTheme by remember { mutableStateOf(isSystemInDarkTheme) }
|
|
|
+ if (selectedTheme == themesList[0])
|
|
|
+ {
|
|
|
+ isDarkTheme.value = systemTheme
|
|
|
+ }
|
|
|
+ else {
|
|
|
+ isDarkTheme.value = selectedTheme == themesList[2]
|
|
|
+ }
|
|
|
+
|
|
|
+ FastestVPNTheme(isDarkTheme.value) {
|
|
|
+ window.statusBarColor = colorResource(id = R.color.blue_text).toArgb()
|
|
|
+ val navController = rememberNavController()
|
|
|
+ SetUpNavGraph(navHostController = navController, this)
|
|
|
+ }
|
|
|
|
|
|
- FastestVPNTheme(isDarkTheme.value) {
|
|
|
- window.statusBarColor = colorResource(id = R.color.blue_text).toArgb()
|
|
|
- val navController = rememberNavController()
|
|
|
- SetUpNavGraph(navHostController = navController, this)
|
|
|
}
|
|
|
|
|
|
}
|
|
@@ -130,6 +141,9 @@ class MainActivity : ComponentActivity() {
|
|
|
|
|
|
}
|
|
|
|
|
|
+ fun getCallingIntent(_context: Context?): Intent {
|
|
|
+ return Intent(_context, MainActivity::class.java)
|
|
|
+ }
|
|
|
companion object {
|
|
|
var isWGDown: Boolean = true
|
|
|
var isAutoEnabled: Boolean = false
|