Commit 0eda354a authored by Aayush Gupta's avatar Aayush Gupta
Browse files

application: ApplicationInfo: Switch to PackageInfoCompat for fetching version code

- Current method has been deprecated and alternative is limited to API 28

References:
- [1]: https://developer.android.com/reference/android/content/pm/PackageInfo#versionCode
- [2]: https://developer.android.com/reference/androidx/core/content/pm/PackageInfoCompat#getLongVersionCode(android.content.pm.PackageInfo)

Signed-off-by: Aayush Gupta's avatarAayush Gupta <theimpulson@e.email>
parent 7f9673cf
......@@ -21,6 +21,7 @@ import android.content.Context
import android.content.pm.PackageInfo
import android.content.pm.PackageManager
import android.os.Environment
import androidx.core.content.pm.PackageInfoCompat
import foundation.e.apps.application.model.data.BasicData
import foundation.e.apps.application.model.data.FullData
import foundation.e.apps.utils.Common
......@@ -62,7 +63,7 @@ class ApplicationInfo(private val packageName: String) {
val updateVersionCode = matcher.group()
.replace("(", "")
.replace(")", "")
return (updateVersionCode.toInt() <= packageInfo.versionCode)
return updateVersionCode.toLong() <= PackageInfoCompat.getLongVersionCode(packageInfo)
} catch (exception: Exception) {
}
}
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment