Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix koin context not being set #222

Merged
merged 2 commits into from
Jan 31, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 15 additions & 12 deletions app/src/main/java/com/mensinator/app/MainActivity.kt
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import androidx.activity.enableEdgeToEdge
import androidx.appcompat.app.AppCompatActivity
import com.mensinator.app.ui.navigation.MensinatorApp
import com.mensinator.app.ui.theme.MensinatorTheme
import org.koin.androidx.compose.KoinAndroidContext

class MainActivity : AppCompatActivity() {
override fun onCreate(savedInstanceState: Bundle?) {
Expand All @@ -18,17 +19,19 @@ class MainActivity : AppCompatActivity() {

setContent {
MensinatorTheme {
MensinatorApp { isScreenProtectionEnabled ->
// Sets the flags for screen protection if
// isScreenProtectionEnabled == true
// If isScreenProtectionEnabled == false it removes the flags
if (isScreenProtectionEnabled) {
window?.setFlags(
WindowManager.LayoutParams.FLAG_SECURE,
WindowManager.LayoutParams.FLAG_SECURE
)
} else {
window?.clearFlags(WindowManager.LayoutParams.FLAG_SECURE)
KoinAndroidContext {
MensinatorApp { isScreenProtectionEnabled ->
// Sets the flags for screen protection if
// isScreenProtectionEnabled == true
// If isScreenProtectionEnabled == false it removes the flags
if (isScreenProtectionEnabled) {
window?.setFlags(
WindowManager.LayoutParams.FLAG_SECURE,
WindowManager.LayoutParams.FLAG_SECURE
)
} else {
window?.clearFlags(WindowManager.LayoutParams.FLAG_SECURE)
}
}
}
}
Expand All @@ -45,7 +48,7 @@ class MainActivity : AppCompatActivity() {
description = channelDescription
}

val notificationManager = context.getSystemService(Context.NOTIFICATION_SERVICE) as NotificationManager
val notificationManager = context.getSystemService(NOTIFICATION_SERVICE) as NotificationManager
notificationManager.createNotificationChannel(notificationChannel)
}
}