1
0
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:
Tom Hacohen 2019-02-20 16:13:13 +00:00
parent 0cda396d20
commit bbbfbffe59
2 changed files with 16 additions and 9 deletions

View File

@ -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) {

View File

@ -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
}