Commit aebc1cc8 authored by Nihar Thakkar's avatar Nihar Thakkar
Browse files

Handle unavailable exodus permissions/trackers separately from no permissions/trackers

parent 1a2af130
......@@ -330,13 +330,14 @@ class ApplicationActivity : AppCompatActivity(), ApplicationStateListener,
app_permissions_container.setOnClickListener {
val alertDialog = AlertDialog.Builder(this).create()
alertDialog.setTitle(R.string.app_permissions_title)
if (fullData.getLastVersion() != null) {
if (fullData.getLastVersion()!!.exodusPermissions.isNotEmpty()) {
if (fullData.getLastVersion() != null &&
fullData.getLastVersion()!!.exodusPermissions != null) {
if (fullData.getLastVersion()!!.exodusPermissions!!.isNotEmpty()) {
var message = ""
var index = 0
fullData.getLastVersion()!!.exodusPermissions.forEach { permission ->
fullData.getLastVersion()!!.exodusPermissions!!.forEach { permission ->
message += permission
if (index != fullData.getLastVersion()!!.exodusPermissions.size - 1) {
if (index != fullData.getLastVersion()!!.exodusPermissions!!.size - 1) {
message += "\n"
}
index++
......@@ -359,13 +360,14 @@ class ApplicationActivity : AppCompatActivity(), ApplicationStateListener,
app_trackers_container.setOnClickListener {
val alertDialog = AlertDialog.Builder(this).create()
alertDialog.setTitle(R.string.app_trackers_title)
if (fullData.getLastVersion() != null) {
if (fullData.getLastVersion()!!.exodusTrackers.isNotEmpty()) {
if (fullData.getLastVersion() != null &&
fullData.getLastVersion()!!.exodusTrackers != null) {
if (fullData.getLastVersion()!!.exodusTrackers!!.isNotEmpty()) {
var message = ""
var index = 0
fullData.getLastVersion()!!.exodusTrackers.forEach { tracker ->
fullData.getLastVersion()!!.exodusTrackers!!.forEach { tracker ->
message += tracker
if (index != fullData.getLastVersion()!!.exodusTrackers.size - 1) {
if (index != fullData.getLastVersion()!!.exodusTrackers!!.size - 1) {
message += "\n"
}
index++
......
......@@ -13,5 +13,5 @@ class Version(val downloadFlag: String?,
val whatsNew: String?,
val updateName: String,
val privacyRating: Int?,
val exodusPermissions: ArrayList<String>,
val exodusTrackers: ArrayList<String>)
\ No newline at end of file
val exodusPermissions: ArrayList<String>?,
val exodusTrackers: ArrayList<String>?)
\ No newline at end of file
......@@ -77,19 +77,27 @@ constructor(
}
}
private fun getPermissions(rawPermissions: ArrayList<String>?): ArrayList<String> {
val permissions = ArrayList<String>()
rawPermissions?.forEach {
permissions.add(it.substring(it.lastIndexOf(".") + 1))
private fun getPermissions(rawPermissions: ArrayList<String>?): ArrayList<String>? {
return if (rawPermissions != null) {
val permissions = ArrayList<String>()
rawPermissions.forEach {
permissions.add(it.substring(it.lastIndexOf(".") + 1))
}
permissions
} else {
null
}
return permissions
}
private fun getTrackers(rawTrackers: ArrayList<LinkedHashMap<String, String>>?): ArrayList<String> {
val trackers = ArrayList<String>()
rawTrackers?.forEach {
trackers.add(it["name"]!!)
private fun getTrackers(rawTrackers: ArrayList<LinkedHashMap<String, String>>?): ArrayList<String>? {
return if (rawTrackers != null) {
val trackers = ArrayList<String>()
rawTrackers.forEach {
trackers.add(it["name"]!!)
}
trackers
} else {
null
}
return trackers
}
}
\ No newline at end of file
}
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