diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml index 53fb306..ca52f83 100644 --- a/app/src/main/AndroidManifest.xml +++ b/app/src/main/AndroidManifest.xml @@ -24,6 +24,13 @@ + + + + + + (AuthState.UNKNOWN) @@ -43,8 +44,8 @@ class AuthUseCaseImpl( override suspend fun invoke() { val preferences = dataStoreManager.readFromDataStore().first() - val userid = preferences[github.owlmail.core.DataStoreManager.USER_ID] - val password = preferences[github.owlmail.core.DataStoreManager.PASSWORD] + val userid = preferences[DataStoreManager.USER_ID] + val password = preferences[DataStoreManager.PASSWORD] if (userid.isNullOrEmpty() || password.isNullOrEmpty()) { loginState.value = AuthState.NON_AUTHENTICATED } else { diff --git a/auth/src/main/kotlin/github/owlmail/auth/LogoutUseCaseImpl.kt b/auth/src/main/kotlin/github/owlmail/auth/LogoutUseCaseImpl.kt index 0b63d2f..30ae806 100644 --- a/auth/src/main/kotlin/github/owlmail/auth/LogoutUseCaseImpl.kt +++ b/auth/src/main/kotlin/github/owlmail/auth/LogoutUseCaseImpl.kt @@ -30,4 +30,4 @@ class LogoutUseCaseImpl( ) Unit } -} +} \ No newline at end of file diff --git a/contacts/src/main/kotlin/github/owlmail/contacts/ContactDAO.kt b/contacts/src/main/kotlin/github/owlmail/contacts/ContactDAO.kt index 2fc71d7..f2266fc 100644 --- a/contacts/src/main/kotlin/github/owlmail/contacts/ContactDAO.kt +++ b/contacts/src/main/kotlin/github/owlmail/contacts/ContactDAO.kt @@ -10,12 +10,12 @@ import github.owlmail.contacts.model.ContactResponse interface ContactDAO { @Query( - "select * from contact where fileAsStr like '%' || :query || '%' order by fileAsStr asc limit :limit offset :offset" + "select * from contact where fileAsStr like '%' || :query || '%' order by fileAsStr asc limit :limit offset :offset", ) suspend fun getAllContacts( limit: Int, offset: Int, - query: String + query: String, ): List @Insert(onConflict = OnConflictStrategy.REPLACE) diff --git a/mail/src/main/kotlin/github/owlmail/mail/HtmlTextView.kt b/mail/src/main/kotlin/github/owlmail/mail/HtmlTextView.kt index 232621d..80051f5 100644 --- a/mail/src/main/kotlin/github/owlmail/mail/HtmlTextView.kt +++ b/mail/src/main/kotlin/github/owlmail/mail/HtmlTextView.kt @@ -13,7 +13,7 @@ class HtmlTextView @JvmOverloads constructor( context: Context, attributeSet: AttributeSet? = null, defStyleAttr: Int = 0, - defStyleRes: Int = 0 + defStyleRes: Int = 0, ) : MaterialTextView(context, attributeSet, defStyleAttr, defStyleRes) { @Inject lateinit var imageLoader: ImageLoader @@ -24,7 +24,7 @@ class HtmlTextView @JvmOverloads constructor( html, HtmlCompat.FROM_HTML_MODE_LEGACY, HtmlCoilImageLoader(this, imageLoader), - null + null, ) } } diff --git a/mail/src/main/kotlin/github/owlmail/mail/MailDatabaseDeleteUseCaseImpl.kt b/mail/src/main/kotlin/github/owlmail/mail/MailDatabaseDeleteUseCaseImpl.kt index 475a4a7..ded3d13 100644 --- a/mail/src/main/kotlin/github/owlmail/mail/MailDatabaseDeleteUseCaseImpl.kt +++ b/mail/src/main/kotlin/github/owlmail/mail/MailDatabaseDeleteUseCaseImpl.kt @@ -12,4 +12,4 @@ class MailDatabaseDeleteUseCaseImpl( mailDAO.deleteAllMails() detailDAO.deleteAllMessage() } -} +} \ No newline at end of file diff --git a/mail/src/main/kotlin/github/owlmail/mail/inbox/MailFragment.kt b/mail/src/main/kotlin/github/owlmail/mail/inbox/MailFragment.kt index e583872..1c70852 100644 --- a/mail/src/main/kotlin/github/owlmail/mail/inbox/MailFragment.kt +++ b/mail/src/main/kotlin/github/owlmail/mail/inbox/MailFragment.kt @@ -12,9 +12,9 @@ import androidx.navigation.fragment.findNavController import dagger.hilt.android.AndroidEntryPoint import github.owlmail.mail.MailBoxHostFragmentDirections import github.owlmail.mail.databinding.FragmentMailBinding -import javax.inject.Inject import kotlinx.coroutines.flow.collectLatest import kotlinx.coroutines.launch +import javax.inject.Inject @AndroidEntryPoint class MailFragment : Fragment(), OnMailClick { @@ -26,7 +26,7 @@ class MailFragment : Fragment(), OnMailClick { override fun onCreateView( inflater: LayoutInflater, container: ViewGroup?, - savedInstanceState: Bundle? + savedInstanceState: Bundle?, ): View? { binding = FragmentMailBinding.inflate(inflater) return binding?.root @@ -81,8 +81,8 @@ class MailFragment : Fragment(), OnMailClick { override fun invoke(conversationUID: String?) { findNavController().navigate( MailBoxHostFragmentDirections.actionMailBoxHostFragmentToMailDetailFragment( - conversationUID - ) + conversationUID, + ), ) } } diff --git a/mail/src/main/kotlin/github/owlmail/mail/manager/NotificationManager.kt b/mail/src/main/kotlin/github/owlmail/mail/manager/NotificationManager.kt index 207ecd6..bdde462 100644 --- a/mail/src/main/kotlin/github/owlmail/mail/manager/NotificationManager.kt +++ b/mail/src/main/kotlin/github/owlmail/mail/manager/NotificationManager.kt @@ -2,26 +2,40 @@ package github.owlmail.mail.manager import android.app.Notification import android.app.NotificationChannel +import android.app.PendingIntent import android.content.Context import android.content.Context.NOTIFICATION_SERVICE +import android.content.Intent import android.graphics.Color import android.os.Build import androidx.core.app.NotificationManagerCompat +import androidx.core.net.toUri class NotificationManager(private val context: Context) { init { registerNotificationChannel() - createPendingIntent() } private val notificationManager = NotificationManagerCompat.from(context) fun showNotification(notificationId: Int, notification: Notification) { + notification.contentIntent = getPendingIntent() notificationManager.notify(notificationId, notification) } - private fun createPendingIntent() { -// Intent(context,) + private fun getPendingIntent(): PendingIntent { + val intent = Intent(Intent.ACTION_VIEW) + + intent.setData("https://mail.nitrkl.ac.in/".toUri()) +// Create the TaskStackBuilder + val pendingIntent = + PendingIntent.getActivity( + context, + 0, + intent, + PendingIntent.FLAG_UPDATE_CURRENT or PendingIntent.FLAG_IMMUTABLE, + ) + return pendingIntent } private fun registerNotificationChannel() { @@ -29,7 +43,7 @@ class NotificationManager(private val context: Context) { val channel = NotificationChannel( "owlmail_notification_id", "owlmail_notification_channel", - android.app.NotificationManager.IMPORTANCE_DEFAULT + android.app.NotificationManager.IMPORTANCE_DEFAULT, ).apply { lightColor = Color.BLUE enableLights(true)