Skip to content

Commit

Permalink
Fixed emoji in strings crash, fixed IOException handling during apk e…
Browse files Browse the repository at this point in the history
…xtraction
  • Loading branch information
glodanif committed Feb 6, 2018
1 parent 8d3ca08 commit 4ef2ab0
Show file tree
Hide file tree
Showing 7 changed files with 19 additions and 10 deletions.
4 changes: 2 additions & 2 deletions app/build.gradle
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
def final VERSION_CODE = 10
def final VERSION_NAME = '1.0.0-beta5'
def final VERSION_CODE = 11
def final VERSION_NAME = '1.0.0-beta6'

apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,9 @@ import java.util.zip.ZipEntry
import java.util.zip.ZipOutputStream
import kotlin.concurrent.thread
import android.support.v4.content.FileProvider
import com.crashlytics.android.Crashlytics
import com.glodanif.bluetoothchat.R
import io.fabric.sdk.android.Fabric
import org.apache.commons.io.FilenameUtils

class FileManagerImpl(private val context: Context) : FileManager {
Expand All @@ -25,9 +27,10 @@ class FileManagerImpl(private val context: Context) : FileManager {

val application = context.packageManager
.getPackageInfo(BuildConfig.APPLICATION_ID, PackageManager.GET_SHARED_LIBRARY_FILES)
val directory = File(Environment.getExternalStorageDirectory(), context.getString(R.string.app_name))
val directory = if (context.externalCacheDir != null) context.externalCacheDir else
File(Environment.getExternalStorageDirectory(), context.getString(R.string.app_name))

if (application != null) {
if (application != null && directory != null) {

val file = File(application.applicationInfo.publicSourceDir)

Expand All @@ -49,7 +52,13 @@ class FileManagerImpl(private val context: Context) : FileManager {
onExtracted.invoke(archiveUri)
}
} catch (e: IOException) {
onFailed.invoke()
handler.post {
if (Fabric.isInitialized()) {
val ex = IOException("${e.message} (file: $file)")
Crashlytics.getInstance().core.logException(ex)
}
onFailed.invoke()
}
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -324,7 +324,7 @@ class BluetoothConnectionService : Service() {
receivedMessage.filePath = filePath

if (messageListener == null || application.currentChat == null || !application.currentChat.equals(device.address)) {
notificationView.showNewMessageNotification(getString(R.string.chat__image_message), currentConversation?.displayName,
notificationView.showNewMessageNotification(getString(R.string.chat__image_message, "\uD83D\uDCCE"), currentConversation?.displayName,
device.name, device.address, preferences.getSettings())
} else {
receivedMessage.seenHere = true
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ class ConversationsAdapter(private val context: Context) : RecyclerView.Adapter<

holder.lastMessage.text =
if (conversation.messageType != MessageType.IMAGE)
conversation.lastMessage else context.getString(R.string.chat__image_message)
conversation.lastMessage else context.getString(R.string.chat__image_message, "\uD83D\uDCCE")

holder.time.text = conversation.lastActivity?.getRelativeTime(context)

Expand Down
2 changes: 1 addition & 1 deletion app/src/main/res/values-ru/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@
<string name="chat__sending_image">Отправка изображения</string>
<string name="chat__receiving_images">Прием изображения</string>
<string name="chat__partner_unable_to_receive_images">Ваш партнер изпользует старую версию Bluetooth Chat, которая не может принимать изображения.</string>
<string name="chat__image_message">📎 [Изображение]</string>
<string name="chat__image_message">%s [Изображение]</string>

<string name="conversations__no_conversations">У вас пока что нет ни одного разговора\nНачните сканирование чтобы найти вашего партнера</string>
<string name="conversations__scan">Сканировать</string>
Expand Down
2 changes: 1 addition & 1 deletion app/src/main/res/values-uk/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@
<string name="chat__sending_image">Відправлення зображення</string>
<string name="chat__receiving_images">Прийом зображення</string>
<string name="chat__partner_unable_to_receive_images">Ваш партнер використовує стару версію Bluetooth Chat, яка не може приймати зображення.</string>
<string name="chat__image_message">📎 [Зображення]</string>
<string name="chat__image_message">%s [Зображення]</string>

<string name="conversations__no_conversations">У вас пока что нет ни одного разговора\nНачните сканирование чтобы найти вашего партнера</string>
<string name="conversations__scan">Сканувати</string>
Expand Down
2 changes: 1 addition & 1 deletion app/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@
<string name="chat__sending_image">Sending image</string>
<string name="chat__receiving_images">Receiving image</string>
<string name="chat__partner_unable_to_receive_images">Your partner uses an old version of Bluetooth Chat which is not able to receive images.</string>
<string name="chat__image_message">📎 [Image]</string>
<string name="chat__image_message">%s [Image]</string>

<string name="conversations__no_conversations">You don\'t have any conversationsStorage yet\nScan for devices to find your partner</string>
<string name="conversations__scan">Scan</string>
Expand Down

0 comments on commit 4ef2ab0

Please sign in to comment.