Added invalid_file_format toast on XML importing
This commit is contained in:
parent
e244fd5a53
commit
014ac2a4cf
1 changed files with 37 additions and 33 deletions
|
|
@ -94,6 +94,7 @@ class MessagesImporter(private val activity: SimpleActivity) {
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun InputStream.importXml() {
|
private fun InputStream.importXml() {
|
||||||
|
try {
|
||||||
bufferedReader().use { reader ->
|
bufferedReader().use { reader ->
|
||||||
val xmlParser = Xml.newPullParser().apply {
|
val xmlParser = Xml.newPullParser().apply {
|
||||||
setInput(reader)
|
setInput(reader)
|
||||||
|
|
@ -137,6 +138,9 @@ class MessagesImporter(private val activity: SimpleActivity) {
|
||||||
messagesFailed > 0 -> activity.toast(R.string.importing_failed)
|
messagesFailed > 0 -> activity.toast(R.string.importing_failed)
|
||||||
else -> activity.toast(R.string.importing_successful)
|
else -> activity.toast(R.string.importing_successful)
|
||||||
}
|
}
|
||||||
|
} catch (_: Exception) {
|
||||||
|
activity.toast(R.string.invalid_file_format)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun XmlPullParser.readSms(): SmsBackup {
|
private fun XmlPullParser.readSms(): SmsBackup {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue