mirror of
https://github.com/etesync/android
synced 2025-01-11 08:10:58 +00:00
Add a helper function for checking if a package is installed.
This commit is contained in:
parent
0cda396d20
commit
bbbfbffe59
@ -19,15 +19,7 @@ import java.text.SimpleDateFormat
|
||||
import java.util.*
|
||||
|
||||
fun emailSupportsAttachments(context: Context): Boolean {
|
||||
var supportsAttachments = false
|
||||
|
||||
try {
|
||||
context.packageManager.getPackageInfo("ch.protonmail.android", 0)
|
||||
} catch (e: PackageManager.NameNotFoundException) {
|
||||
supportsAttachments = true
|
||||
}
|
||||
|
||||
return supportsAttachments
|
||||
return !packageInstalled(context, "ch.protonmail.android")
|
||||
}
|
||||
|
||||
class EventEmailInvitation constructor(val context: Context, val account: Account) {
|
||||
|
@ -0,0 +1,15 @@
|
||||
package com.etesync.syncadapter.utils
|
||||
|
||||
import android.content.Context
|
||||
import android.content.pm.PackageManager
|
||||
|
||||
|
||||
fun packageInstalled(context: Context, packageName: String): Boolean {
|
||||
try {
|
||||
context.packageManager.getPackageInfo(packageName, 0)
|
||||
} catch (e: PackageManager.NameNotFoundException) {
|
||||
return false
|
||||
}
|
||||
|
||||
return true
|
||||
}
|
Loading…
Reference in New Issue
Block a user