Commit 03f3f28f authored by dimitrisCBR's avatar dimitrisCBR
Browse files

Add Timber for logging

parent 9330de90
......@@ -58,8 +58,10 @@ dependencies {
testImplementation 'junit:junit:4.13'
androidTestImplementation 'androidx.test.ext:junit:1.1.2'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.3.0'
implementation 'com.google.firebase:firebase-core:18.0.3'
implementation 'com.google.firebase:firebase-messaging:21.1.0'
implementation platform('com.google.firebase:firebase-bom:29.0.1')
implementation 'com.google.firebase:firebase-messaging'
implementation 'com.jakewharton.timber:timber:5.0.1'
implementation('com.futurae.sdk:futuraekit:1.3.2')
......
......@@ -4,6 +4,8 @@ import android.app.Application;
import com.futurae.sdk.FuturaeClient;
import com.futurae.sdk.Kit;
import timber.log.Timber;
public class AppMain extends Application {
// overrides
......@@ -12,6 +14,8 @@ public class AppMain extends Application {
super.onCreate();
Timber.plant(new Timber.DebugTree());
FuturaeClient.launch(this, (Kit)null);
}
}
......@@ -4,7 +4,7 @@ import android.app.backup.BackupAgent
import android.app.backup.BackupDataInput
import android.app.backup.BackupDataOutput
import android.os.ParcelFileDescriptor
import android.util.Log
import timber.log.Timber
import java.io.*
import kotlin.random.Random
......@@ -25,10 +25,7 @@ class CustomBackupAgent : BackupAgent() {
sp.edit().putInt(PREF_RANDOM_STRING, randomInt).apply()
val preferenceValue = randomInt.toString()
Log.d(
TAG,
"Starting backup of the prefs configuration in $PREFS_BACKUP_KEY, store: $randomInt as $preferenceValue"
)
Timber.d("Starting backup of the prefs configuration in $PREFS_BACKUP_KEY, store: $randomInt as $preferenceValue")
val bufStream = ByteArrayOutputStream()
val outWriter = DataOutputStream(bufStream)
......@@ -38,7 +35,7 @@ class CustomBackupAgent : BackupAgent() {
data.writeEntityHeader(PREFS_BACKUP_KEY, len)
data.writeEntityData(buffer, len)
} catch (e: IOException) {
Log.e(TAG, e.message)
Timber.e("")
throw e
}
}
......@@ -57,17 +54,14 @@ class CustomBackupAgent : BackupAgent() {
if (storedValue.isBlank()) {
return
}
Log.d(
TAG,
"onRestore: Prefs restore from the backup completed. Value: ${storedValue}, calling SDK backup agent"
)
Timber.d("onRestore: Prefs restore from the backup completed. Value: $storedValue, calling SDK backup agent")
val sp = getSharedPreferences(PREFS_NAME, MODE_PRIVATE)
sp.edit().putInt(PREF_RANDOM_STRING, storedValue.toInt()).apply()
} catch (e: IOException) {
Log.e(TAG, e.message)
Timber.e(e)
throw e
} catch (e: Exception) {
Log.d(TAG, e.message)
Timber.e(e)
}
} else {
com.futurae.sdk.BackupAgent.onRestoreAccountsData(this, data)
......
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