Version Catalog & Spotless (#92)
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
plugins {
|
||||
id 'com.android.application'
|
||||
id 'org.jetbrains.kotlin.android'
|
||||
alias libs.plugins.android.application
|
||||
alias libs.plugins.kotlin.android
|
||||
}
|
||||
|
||||
android {
|
||||
@@ -41,15 +41,20 @@ android {
|
||||
}
|
||||
|
||||
dependencies {
|
||||
implementation 'androidx.appcompat:appcompat:1.4.0'
|
||||
implementation 'androidx.core:core-ktx:1.8.0'
|
||||
implementation 'com.google.android.material:material:1.8.0'
|
||||
implementation 'androidx.lifecycle:lifecycle-viewmodel-ktx:2.4.0'
|
||||
implementation 'com.google.code.gson:gson:2.10.1'
|
||||
implementation project(path: ':navi-alfred')
|
||||
implementation "com.github.anrwatchdog:anrwatchdog:1.4.0"
|
||||
implementation project(':navi-alfred')
|
||||
|
||||
testImplementation "junit:junit:4.13.2"
|
||||
androidTestImplementation "androidx.test.ext:junit:1.1.4"
|
||||
androidTestImplementation 'androidx.test.espresso:espresso-core:3.5.1'
|
||||
}
|
||||
implementation libs.android.material
|
||||
|
||||
implementation libs.androidx.appcompat
|
||||
implementation libs.androidx.core.ktx
|
||||
implementation libs.androidx.lifecycle.viewmodel.ktx
|
||||
|
||||
implementation libs.anrwatchdog
|
||||
|
||||
implementation libs.gson
|
||||
|
||||
androidTestImplementation libs.androidx.test.espresso.core
|
||||
androidTestImplementation libs.androidx.test.junit
|
||||
|
||||
testImplementation libs.junit
|
||||
}
|
||||
|
||||
@@ -1,4 +1,12 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
|
||||
<!--
|
||||
~
|
||||
~ * Copyright © 2024 by Navi Technologies Limited
|
||||
~ * All rights reserved. Strictly confidential
|
||||
~
|
||||
-->
|
||||
|
||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:tools="http://schemas.android.com/tools">
|
||||
|
||||
|
||||
@@ -1,3 +1,10 @@
|
||||
/*
|
||||
*
|
||||
* * Copyright © 2023 by Navi Technologies Limited
|
||||
* * All rights reserved. Strictly confidential
|
||||
*
|
||||
*/
|
||||
|
||||
package com.alfred.demo
|
||||
|
||||
import android.content.BroadcastReceiver
|
||||
@@ -10,7 +17,6 @@ import com.navi.alfred.utils.AlfredConstants.BROADCAST_ACTION_TYPE
|
||||
import com.navi.alfred.utils.AlfredConstants.BROADCAST_ERROR_MESSAGE
|
||||
import com.navi.alfred.utils.AlfredConstants.BROADCAST_EXCEPTION
|
||||
import com.navi.alfred.utils.AlfredConstants.BROADCAST_REQUEST
|
||||
import android.widget.Toast
|
||||
import com.navi.alfred.utils.log
|
||||
import kotlinx.coroutines.CoroutineScope
|
||||
import kotlinx.coroutines.Dispatchers
|
||||
|
||||
@@ -1,3 +1,10 @@
|
||||
/*
|
||||
*
|
||||
* * Copyright © 2023 by Navi Technologies Limited
|
||||
* * All rights reserved. Strictly confidential
|
||||
*
|
||||
*/
|
||||
|
||||
package com.alfred.demo
|
||||
|
||||
import android.app.Activity
|
||||
@@ -5,18 +12,18 @@ import android.app.Application
|
||||
import android.content.IntentFilter
|
||||
import android.os.Bundle
|
||||
import android.util.Log
|
||||
import com.alfred.demo.activity.SWWActivity
|
||||
import com.alfred.demo.activity.MainActivity
|
||||
import com.alfred.demo.activity.SWWActivity
|
||||
import com.github.anrwatchdog.ANRWatchDog
|
||||
import com.navi.alfred.AlfredConfig
|
||||
import com.navi.alfred.AlfredManager
|
||||
import com.navi.alfred.AlfredManager.isAlfredRecordingEnabled
|
||||
import com.navi.alfred.utils.AlfredConstants
|
||||
import com.navi.alfred.utils.AlfredConstants.BROADCAST_ACTION_TYPE
|
||||
import com.navi.alfred.utils.log
|
||||
import kotlinx.coroutines.CoroutineScope
|
||||
import kotlinx.coroutines.Dispatchers
|
||||
import kotlinx.coroutines.launch
|
||||
import com.github.anrwatchdog.ANRWatchDog
|
||||
import com.navi.alfred.AlfredManager.isAlfredRecordingEnabled
|
||||
import com.navi.alfred.utils.AlfredConstants.BROADCAST_ACTION_TYPE
|
||||
|
||||
class MainApplication : Application(), Application.ActivityLifecycleCallbacks {
|
||||
private var appForegroundCounter: Int = 0
|
||||
@@ -25,32 +32,37 @@ class MainApplication : Application(), Application.ActivityLifecycleCallbacks {
|
||||
super.onCreate()
|
||||
registerActivityLifecycleCallbacks(this)
|
||||
|
||||
val alfredConfig = AlfredConfig(
|
||||
"Alfred Demo App",
|
||||
"1000",
|
||||
"1.0.0",
|
||||
"qa",
|
||||
"oMv77fgpBg9NFGom0Psizbf7lbrdBVJz"
|
||||
)
|
||||
val alfredConfig =
|
||||
AlfredConfig(
|
||||
"Alfred Demo App",
|
||||
"1000",
|
||||
"1.0.0",
|
||||
"qa",
|
||||
"oMv77fgpBg9NFGom0Psizbf7lbrdBVJz"
|
||||
)
|
||||
AlfredManager.init(alfredConfig, this)
|
||||
getAlfredCruiseInfo()
|
||||
|
||||
|
||||
// Dumping anr data to click stream
|
||||
ANRWatchDog().setIgnoreDebugger(true).setReportMainThreadOnly().setANRListener {
|
||||
if (it.cause?.stackTrace.isNullOrEmpty()) {
|
||||
return@setANRListener
|
||||
ANRWatchDog()
|
||||
.setIgnoreDebugger(true)
|
||||
.setReportMainThreadOnly()
|
||||
.setANRListener {
|
||||
if (it.cause?.stackTrace.isNullOrEmpty()) {
|
||||
return@setANRListener
|
||||
}
|
||||
val className = it.cause?.stackTrace?.get(0)?.className.orEmpty()
|
||||
val anrEventProperties =
|
||||
mutableMapOf(
|
||||
"SCREEN_NAME" to ("Alfred Demo App"),
|
||||
"METHOD_NAME" to it.cause?.stackTrace?.get(0)?.methodName.orEmpty(),
|
||||
"LINE_NUMBER" to it.cause?.stackTrace?.get(0)?.lineNumber.toString(),
|
||||
"APP_IN_FOREGROUND" to isAppInForeground().toString()
|
||||
)
|
||||
anrEventProperties["STACK_TRACE"] = it.cause?.stackTrace?.get(0).toString()
|
||||
AlfredManager.handleAnrEvent(anrEventProperties)
|
||||
}
|
||||
val className = it.cause?.stackTrace?.get(0)?.className.orEmpty()
|
||||
val anrEventProperties = mutableMapOf(
|
||||
"SCREEN_NAME" to ("Alfred Demo App"),
|
||||
"METHOD_NAME" to it.cause?.stackTrace?.get(0)?.methodName.orEmpty(),
|
||||
"LINE_NUMBER" to it.cause?.stackTrace?.get(0)?.lineNumber.toString(),
|
||||
"APP_IN_FOREGROUND" to isAppInForeground().toString()
|
||||
)
|
||||
anrEventProperties["STACK_TRACE"] = it.cause?.stackTrace?.get(0).toString()
|
||||
AlfredManager.handleAnrEvent(anrEventProperties)
|
||||
}.start()
|
||||
.start()
|
||||
|
||||
// Crash Reporting to backend
|
||||
val defaultHandler = Thread.getDefaultUncaughtExceptionHandler()
|
||||
@@ -60,12 +72,13 @@ class MainApplication : Application(), Application.ActivityLifecycleCallbacks {
|
||||
return@setDefaultUncaughtExceptionHandler
|
||||
}
|
||||
try {
|
||||
val crashEventProperties = mutableMapOf(
|
||||
"SCREEN_NAME" to ("Alfred Demo App"),
|
||||
"METHOD_NAME" to exception.stackTrace[0]?.methodName.orEmpty(),
|
||||
"LINE_NUMBER" to exception.stackTrace[0]?.lineNumber.toString(),
|
||||
"APP_IN_FOREGROUND" to isAppInForeground().toString()
|
||||
)
|
||||
val crashEventProperties =
|
||||
mutableMapOf(
|
||||
"SCREEN_NAME" to ("Alfred Demo App"),
|
||||
"METHOD_NAME" to exception.stackTrace[0]?.methodName.orEmpty(),
|
||||
"LINE_NUMBER" to exception.stackTrace[0]?.lineNumber.toString(),
|
||||
"APP_IN_FOREGROUND" to isAppInForeground().toString()
|
||||
)
|
||||
exception.stackTrace[0]?.let { stackTraceElement ->
|
||||
crashEventProperties["STACK_TRACE"] = stackTraceElement.toString()
|
||||
}
|
||||
@@ -76,8 +89,7 @@ class MainApplication : Application(), Application.ActivityLifecycleCallbacks {
|
||||
}
|
||||
}
|
||||
|
||||
override fun onActivityCreated(activity: Activity, savedInstanceState: Bundle?) {
|
||||
}
|
||||
override fun onActivityCreated(activity: Activity, savedInstanceState: Bundle?) {}
|
||||
|
||||
override fun onActivityStarted(activity: Activity) {
|
||||
appForegroundCounter++
|
||||
@@ -89,8 +101,7 @@ class MainApplication : Application(), Application.ActivityLifecycleCallbacks {
|
||||
}
|
||||
}
|
||||
|
||||
override fun onActivityPaused(activity: Activity) {
|
||||
}
|
||||
override fun onActivityPaused(activity: Activity) {}
|
||||
|
||||
override fun onActivityStopped(activity: Activity) {
|
||||
appForegroundCounter--
|
||||
@@ -99,11 +110,9 @@ class MainApplication : Application(), Application.ActivityLifecycleCallbacks {
|
||||
}
|
||||
}
|
||||
|
||||
override fun onActivitySaveInstanceState(activity: Activity, outState: Bundle) {
|
||||
}
|
||||
override fun onActivitySaveInstanceState(activity: Activity, outState: Bundle) {}
|
||||
|
||||
override fun onActivityDestroyed(activity: Activity) {
|
||||
}
|
||||
override fun onActivityDestroyed(activity: Activity) {}
|
||||
|
||||
private fun startAlfredRecording(activity: Activity) {
|
||||
if (isAlfredRecordingEnabled()) {
|
||||
@@ -114,12 +123,10 @@ class MainApplication : Application(), Application.ActivityLifecycleCallbacks {
|
||||
screenName = "MainActivity"
|
||||
moduleName = "Demo App"
|
||||
}
|
||||
|
||||
is SWWActivity -> {
|
||||
screenName = "SWWActivity"
|
||||
moduleName = "Demo App"
|
||||
}
|
||||
|
||||
else -> {
|
||||
screenName = AlfredConstants.THIRD_PARTY_SCREEN
|
||||
moduleName = AlfredConstants.THIRD_PARTY_MODULE
|
||||
@@ -156,16 +163,18 @@ class MainApplication : Application(), Application.ActivityLifecycleCallbacks {
|
||||
"Alfred",
|
||||
"Alfred - getAlfredCruiseInfo started inside try thread = ${Thread.currentThread().name}"
|
||||
)
|
||||
AlfredManager.getAlfredCruiseInfo(cruiseApiSuccessful = { response ->
|
||||
Log.d(
|
||||
"Alfred",
|
||||
"Alfred - getAlfredCruiseInfo cruiseApiSuccessful h response = $response"
|
||||
)
|
||||
})
|
||||
AlfredManager.getAlfredCruiseInfo(
|
||||
cruiseApiSuccessful = { response ->
|
||||
Log.d(
|
||||
"Alfred",
|
||||
"Alfred - getAlfredCruiseInfo cruiseApiSuccessful h response = $response"
|
||||
)
|
||||
}
|
||||
)
|
||||
} catch (e: Exception) {
|
||||
Log.d("Alfred", "Alfred - getAlfredCruiseInfo catch e = $e")
|
||||
e.log()
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,3 +1,10 @@
|
||||
/*
|
||||
*
|
||||
* * Copyright © 2023 by Navi Technologies Limited
|
||||
* * All rights reserved. Strictly confidential
|
||||
*
|
||||
*/
|
||||
|
||||
package com.alfred.demo.activity
|
||||
|
||||
import android.content.Intent
|
||||
@@ -29,4 +36,4 @@ class MainActivity : AppCompatActivity() {
|
||||
)
|
||||
return super.dispatchTouchEvent(ev)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,3 +1,10 @@
|
||||
/*
|
||||
*
|
||||
* * Copyright © 2023 by Navi Technologies Limited
|
||||
* * All rights reserved. Strictly confidential
|
||||
*
|
||||
*/
|
||||
|
||||
package com.alfred.demo.activity
|
||||
|
||||
import android.os.Bundle
|
||||
@@ -14,15 +21,7 @@ class SWWActivity : AppCompatActivity() {
|
||||
|
||||
val button = findViewById<Button>(R.id.sww_button)
|
||||
button.setOnClickListener {
|
||||
onSSWError(
|
||||
"SWW Button Clicked",
|
||||
"400",
|
||||
"SWW Activity",
|
||||
"Alfred Demo App",
|
||||
400,
|
||||
"WIFI"
|
||||
|
||||
)
|
||||
onSSWError("SWW Button Clicked", "400", "SWW Activity", "Alfred Demo App", 400, "WIFI")
|
||||
}
|
||||
}
|
||||
|
||||
@@ -54,4 +53,4 @@ class SWWActivity : AppCompatActivity() {
|
||||
)
|
||||
AlfredManager.handleSWWEvent(swwEventProperties)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,3 +1,11 @@
|
||||
|
||||
<!--
|
||||
~
|
||||
~ * Copyright © 2024 by Navi Technologies Limited
|
||||
~ * All rights reserved. Strictly confidential
|
||||
~
|
||||
-->
|
||||
|
||||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:aapt="http://schemas.android.com/aapt"
|
||||
android:width="108dp"
|
||||
|
||||
@@ -1,4 +1,12 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
|
||||
<!--
|
||||
~
|
||||
~ * Copyright © 2024 by Navi Technologies Limited
|
||||
~ * All rights reserved. Strictly confidential
|
||||
~
|
||||
-->
|
||||
|
||||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:width="108dp"
|
||||
android:height="108dp"
|
||||
|
||||
@@ -1,4 +1,12 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
|
||||
<!--
|
||||
~
|
||||
~ * Copyright © 2024 by Navi Technologies Limited
|
||||
~ * All rights reserved. Strictly confidential
|
||||
~
|
||||
-->
|
||||
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
|
||||
@@ -1,4 +1,12 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
|
||||
<!--
|
||||
~
|
||||
~ * Copyright © 2024 by Navi Technologies Limited
|
||||
~ * All rights reserved. Strictly confidential
|
||||
~
|
||||
-->
|
||||
|
||||
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
android:layout_width="match_parent"
|
||||
|
||||
@@ -1,4 +1,12 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
|
||||
<!--
|
||||
~
|
||||
~ * Copyright © 2024 by Navi Technologies Limited
|
||||
~ * All rights reserved. Strictly confidential
|
||||
~
|
||||
-->
|
||||
|
||||
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
android:layout_width="match_parent"
|
||||
|
||||
@@ -1,4 +1,12 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
|
||||
<!--
|
||||
~
|
||||
~ * Copyright © 2024 by Navi Technologies Limited
|
||||
~ * All rights reserved. Strictly confidential
|
||||
~
|
||||
-->
|
||||
|
||||
<androidx.constraintlayout.widget.ConstraintLayout android:id="@+id/root_view"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
|
||||
@@ -1,4 +1,12 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
|
||||
<!--
|
||||
~
|
||||
~ * Copyright © 2024 by Navi Technologies Limited
|
||||
~ * All rights reserved. Strictly confidential
|
||||
~
|
||||
-->
|
||||
|
||||
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
android:layout_width="match_parent"
|
||||
|
||||
@@ -1,4 +1,12 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
|
||||
<!--
|
||||
~
|
||||
~ * Copyright © 2024 by Navi Technologies Limited
|
||||
~ * All rights reserved. Strictly confidential
|
||||
~
|
||||
-->
|
||||
|
||||
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
|
||||
@@ -1,4 +1,12 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
|
||||
<!--
|
||||
~
|
||||
~ * Copyright © 2024 by Navi Technologies Limited
|
||||
~ * All rights reserved. Strictly confidential
|
||||
~
|
||||
-->
|
||||
|
||||
<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<background android:drawable="@drawable/ic_launcher_background" />
|
||||
<foreground android:drawable="@drawable/ic_launcher_foreground" />
|
||||
|
||||
@@ -1,4 +1,12 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
|
||||
<!--
|
||||
~
|
||||
~ * Copyright © 2024 by Navi Technologies Limited
|
||||
~ * All rights reserved. Strictly confidential
|
||||
~
|
||||
-->
|
||||
|
||||
<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<background android:drawable="@drawable/ic_launcher_background" />
|
||||
<foreground android:drawable="@drawable/ic_launcher_foreground" />
|
||||
|
||||
@@ -1,4 +1,12 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
|
||||
<!--
|
||||
~
|
||||
~ * Copyright © 2024 by Navi Technologies Limited
|
||||
~ * All rights reserved. Strictly confidential
|
||||
~
|
||||
-->
|
||||
|
||||
<resources>
|
||||
<color name="purple_200">#FFBB86FC</color>
|
||||
<color name="purple_500">#FF6200EE</color>
|
||||
|
||||
@@ -1,3 +1,11 @@
|
||||
|
||||
<!--
|
||||
~
|
||||
~ * Copyright © 2024 by Navi Technologies Limited
|
||||
~ * All rights reserved. Strictly confidential
|
||||
~
|
||||
-->
|
||||
|
||||
<resources>
|
||||
<string name="app_name">Alfred Android</string>
|
||||
<string name="crash">Crash Occurred</string>
|
||||
|
||||
@@ -1,4 +1,12 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
|
||||
<!--
|
||||
~
|
||||
~ * Copyright © 2024 by Navi Technologies Limited
|
||||
~ * All rights reserved. Strictly confidential
|
||||
~
|
||||
-->
|
||||
|
||||
<resources>
|
||||
|
||||
<style name="Theme.AlfredAndroid" parent="android:Theme.Material.Light.NoActionBar" />
|
||||
|
||||
Reference in New Issue
Block a user