TP-12345 | Refactor | Publishing | Spotless (#152)
This commit is contained in:
2
.github/pull_request_template.md
vendored
Normal file
2
.github/pull_request_template.md
vendored
Normal file
@@ -0,0 +1,2 @@
|
||||
## Summary
|
||||
Please include a summary of the change, relevant motivation, and context here.
|
||||
41
.github/workflows/branch_cut.yml
vendored
Normal file
41
.github/workflows/branch_cut.yml
vendored
Normal file
@@ -0,0 +1,41 @@
|
||||
name: Branch Cut CI
|
||||
|
||||
on:
|
||||
workflow_dispatch:
|
||||
inputs:
|
||||
version:
|
||||
description: Version (e.g., 1.0.0)
|
||||
required: true
|
||||
type: string
|
||||
|
||||
jobs:
|
||||
print-inputs:
|
||||
runs-on: [ default ]
|
||||
steps:
|
||||
- name: Print Inputs
|
||||
run: |
|
||||
echo "| Input Key | Input Value |" >> $GITHUB_STEP_SUMMARY
|
||||
echo "| :---: | :---: |" >> $GITHUB_STEP_SUMMARY
|
||||
echo "| Version | ${{ inputs.version }} |" >> $GITHUB_STEP_SUMMARY
|
||||
branch-cut:
|
||||
runs-on: [ default ]
|
||||
needs: [ print-inputs ]
|
||||
environment: RELEASE_BRANCH_CUT
|
||||
steps:
|
||||
- name: Checkout Repository
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
token: ${{ secrets.GH_PAT }}
|
||||
- name: Setup Git Credentials for @${{ github.actor }}
|
||||
run: |
|
||||
export GITHUB_EMAIL=$(echo "$GITHUB_ACTOR@navi.com" | sed 's/-/./g' | sed 's/_navi//g')
|
||||
git config --global user.email "$GITHUB_EMAIL"
|
||||
git config --global user.name "$GITHUB_ACTOR"
|
||||
- name: Checkout release-${{ inputs.version }} from ${{ github.ref_name }}
|
||||
run: git checkout -b release-${{ inputs.version }}
|
||||
- name: Update Version (${{ inputs.version }})
|
||||
run: sed -i 's/def VERSION = "[0-9].*"/def VERSION = "${{ inputs.version }}"/g' navi-alfred/build.gradle
|
||||
- name: Commit Version Changes
|
||||
run: git commit navi-alfred/build.gradle -m "TP-52887 | Bump Project Version to ${{ inputs.version }}"
|
||||
- name: Push release-${{ inputs.version }} Branch
|
||||
run: git push -u origin release-${{ inputs.version }}
|
||||
25
.github/workflows/build.yml
vendored
Normal file
25
.github/workflows/build.yml
vendored
Normal file
@@ -0,0 +1,25 @@
|
||||
name: Build CI
|
||||
|
||||
on:
|
||||
push:
|
||||
branches: [ master, release-* ]
|
||||
pull_request:
|
||||
branches: [ master, release-* ]
|
||||
merge_group:
|
||||
|
||||
concurrency:
|
||||
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
|
||||
cancel-in-progress: true
|
||||
|
||||
jobs:
|
||||
build-debug:
|
||||
uses: ./.github/workflows/generate_aar.yml
|
||||
with:
|
||||
type: debug
|
||||
destination: github
|
||||
build-release:
|
||||
if: github.event_name == 'push'
|
||||
uses: ./.github/workflows/generate_aar.yml
|
||||
with:
|
||||
type: release
|
||||
destination: github
|
||||
85
.github/workflows/generate_aar.yml
vendored
Normal file
85
.github/workflows/generate_aar.yml
vendored
Normal file
@@ -0,0 +1,85 @@
|
||||
name: Generate AAR CI
|
||||
|
||||
on:
|
||||
workflow_dispatch:
|
||||
inputs:
|
||||
type:
|
||||
description: Build Type
|
||||
required: true
|
||||
type: choice
|
||||
options:
|
||||
- debug
|
||||
- release
|
||||
destination:
|
||||
description: Upload Destination
|
||||
required: true
|
||||
type: choice
|
||||
options:
|
||||
- github
|
||||
- nexus
|
||||
nexus_path:
|
||||
description: Nexus Path (if destination is nexus)
|
||||
required: false
|
||||
type: choice
|
||||
options:
|
||||
- maven-snapshots
|
||||
- maven-releases
|
||||
version:
|
||||
description: Version (e.g., 1.0.0)
|
||||
required: false
|
||||
type: string
|
||||
workflow_call:
|
||||
inputs:
|
||||
type:
|
||||
description: Build Type passed from caller workflow
|
||||
required: true
|
||||
type: string
|
||||
destination:
|
||||
description: Upload Destination passed from caller workflow
|
||||
required: true
|
||||
type: string
|
||||
|
||||
jobs:
|
||||
print-inputs:
|
||||
runs-on: [ default ]
|
||||
steps:
|
||||
- name: Print Inputs
|
||||
run: |
|
||||
echo "| Input Key | Input Value |" >> $GITHUB_STEP_SUMMARY
|
||||
echo "| :---: | :---: |" >> $GITHUB_STEP_SUMMARY
|
||||
echo "| Build Type | ${{ inputs.type }} |" >> $GITHUB_STEP_SUMMARY
|
||||
echo "| Upload Destination | ${{ inputs.destination }} |" >> $GITHUB_STEP_SUMMARY
|
||||
echo "| Nexus Path | ${{ inputs.nexus_path || '🚫' }} |" >> $GITHUB_STEP_SUMMARY
|
||||
echo "| Version | ${{ inputs.version || '🚫' }} |" >> $GITHUB_STEP_SUMMARY
|
||||
generate:
|
||||
runs-on: [ default ]
|
||||
needs: [ print-inputs ]
|
||||
steps:
|
||||
- name: Checkout Repository
|
||||
uses: actions/checkout@v4
|
||||
- name: Override Version
|
||||
if: github.event_name == 'workflow_dispatch' && inputs.version != ''
|
||||
run: sed -i 's/def VERSION = "[0-9].*"/def VERSION = "${{ inputs.version }}"/g' navi-alfred/build.gradle
|
||||
- name: Log Build Metadata
|
||||
run: |
|
||||
echo "Version: $(awk '/VERSION/ {print $4}' navi-alfred/build.gradle | tr -d '"')"
|
||||
- name: Set up JDK 17
|
||||
uses: actions/setup-java@v4
|
||||
with:
|
||||
java-version: 17
|
||||
distribution: temurin
|
||||
- name: Set up Android SDK
|
||||
uses: navi-synced-actions/setup-android@v3
|
||||
- name: Grant Execute Permission for Gradle Wrapper
|
||||
run: chmod +x gradlew
|
||||
- name: Build - AAR - ${{ inputs.type }}
|
||||
run: ./gradlew :navi-alfred:assemble${{ inputs.type }} --stacktrace
|
||||
- name: Upload - AAR - ${{ inputs.type }} - GitHub
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: aar-${{ inputs.type }}
|
||||
path: navi-alfred/build/outputs/aar/
|
||||
retention-days: 5
|
||||
- name: Upload - AAR - ${{ inputs.type }} - Nexus
|
||||
if: inputs.destination == 'nexus' && inputs.nexus_path != ''
|
||||
run: ./gradlew publish -PNEXUS_URL=https://nexus.cmd.navi-tech.in/repository/${{ inputs.nexus_path }} -PNEXUS_USERNAME=${{ secrets.NEXUS_USERNAME }} -PNEXUS_PASSWORD=${{ secrets.NEXUS_PASSWORD }} -PBUILD_TYPE=${{ inputs.type }}
|
||||
31
.github/workflows/master_pull_request.yml
vendored
31
.github/workflows/master_pull_request.yml
vendored
@@ -1,31 +0,0 @@
|
||||
name: Master pull request CI
|
||||
|
||||
on:
|
||||
pull_request:
|
||||
branches: [ master ]
|
||||
merge_group:
|
||||
|
||||
concurrency:
|
||||
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
|
||||
cancel-in-progress: true
|
||||
|
||||
jobs:
|
||||
build-qa-debug:
|
||||
runs-on: [ default ]
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v4
|
||||
- name: Log Build Metadata
|
||||
run: |
|
||||
echo "Commit SHA: ${{ github.sha }}"
|
||||
- name: Set up JDK 17
|
||||
uses: actions/setup-java@v4
|
||||
with:
|
||||
java-version: 17
|
||||
distribution: adopt
|
||||
- name: Setup Android SDK
|
||||
uses: navi-synced-actions/setup-android@v2
|
||||
- name: Grant execute permission for gradlew
|
||||
run: chmod +x gradlew
|
||||
- name: Assemble with Stacktrace
|
||||
run: ./gradlew assembleDebug --stacktrace
|
||||
32
.github/workflows/master_push.yml
vendored
32
.github/workflows/master_push.yml
vendored
@@ -1,32 +0,0 @@
|
||||
name: Master push CI
|
||||
|
||||
on:
|
||||
push:
|
||||
branches: [ master ]
|
||||
|
||||
concurrency:
|
||||
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
|
||||
cancel-in-progress: true
|
||||
|
||||
jobs:
|
||||
build-qa-debug:
|
||||
runs-on: [ default ]
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v4
|
||||
- name: Log Build Metadata
|
||||
run: |
|
||||
echo "Commit SHA: ${{ github.sha }}"
|
||||
- name: Set up JDK 17
|
||||
uses: actions/setup-java@v4
|
||||
with:
|
||||
java-version: 17
|
||||
distribution: adopt
|
||||
- name: Setup Android SDK
|
||||
uses: navi-synced-actions/setup-android@v2
|
||||
- name: Grant execute permission for gradlew
|
||||
run: chmod +x gradlew
|
||||
- name: Assemble with Stacktrace
|
||||
run: ./gradlew assembleRelease --stacktrace
|
||||
- name: Upload to nexus
|
||||
run: ./gradlew publish -PIS_SNAPSHOT=false -PNEXUS_URL=https://nexus.cmd.navi-tech.in/repository/maven-releases -PNEXUS_USERNAME=${{ secrets.NEXUS_USERNAME }} -PNEXUS_PASSWORD=${{ secrets.NEXUS_PASSWORD }}
|
||||
31
.github/workflows/publish_aar.yml
vendored
31
.github/workflows/publish_aar.yml
vendored
@@ -1,31 +0,0 @@
|
||||
name: Publish AAR CI
|
||||
|
||||
on:
|
||||
workflow_dispatch:
|
||||
|
||||
concurrency:
|
||||
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
|
||||
cancel-in-progress: true
|
||||
|
||||
jobs:
|
||||
build-qa-debug:
|
||||
runs-on: [ default ]
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v4
|
||||
- name: Log Build Metadata
|
||||
run: |
|
||||
echo "Commit SHA: ${{ github.sha }}"
|
||||
- name: Set up JDK 17
|
||||
uses: actions/setup-java@v4
|
||||
with:
|
||||
java-version: 17
|
||||
distribution: temurin
|
||||
- name: Setup Android SDK
|
||||
uses: navi-synced-actions/setup-android@v2
|
||||
- name: Grant execute permission for gradlew
|
||||
run: chmod +x gradlew
|
||||
- name: Assemble with Stacktrace
|
||||
run: ./gradlew :navi-alfred:assembleRelease --stacktrace
|
||||
- name: Upload to nexus
|
||||
run: ./gradlew publish -PIS_SNAPSHOT=true -PNEXUS_URL=https://nexus.cmd.navi-tech.in/repository/maven-snapshots -PNEXUS_USERNAME=${{ secrets.NEXUS_USERNAME }} -PNEXUS_PASSWORD=${{ secrets.NEXUS_PASSWORD }}
|
||||
28
.github/workflows/spotless.yml
vendored
Normal file
28
.github/workflows/spotless.yml
vendored
Normal file
@@ -0,0 +1,28 @@
|
||||
name: Spotless CI
|
||||
|
||||
on:
|
||||
pull_request:
|
||||
branches: [ master ]
|
||||
merge_group:
|
||||
|
||||
concurrency:
|
||||
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
|
||||
cancel-in-progress: true
|
||||
|
||||
jobs:
|
||||
spotless:
|
||||
runs-on: [ default ]
|
||||
steps:
|
||||
- name: Checkout Repository
|
||||
uses: actions/checkout@v4
|
||||
- name: Set up JDK 17
|
||||
uses: actions/setup-java@v4
|
||||
with:
|
||||
java-version: 17
|
||||
distribution: temurin
|
||||
- name: Set up Android SDK
|
||||
uses: navi-synced-actions/setup-android@v3
|
||||
- name: Grant Execute Permission for Gradle Wrapper
|
||||
run: chmod +x gradlew
|
||||
- name: Run Spotless Check
|
||||
run: ./gradlew spotlessCheck
|
||||
9
app/.gitignore
vendored
9
app/.gitignore
vendored
@@ -1,10 +1 @@
|
||||
/.idea/
|
||||
/build
|
||||
/captures
|
||||
/local.properties
|
||||
*.iml
|
||||
.externalNativeBuild
|
||||
.cxx
|
||||
.gradle
|
||||
.DS_Store
|
||||
local.properties
|
||||
|
||||
@@ -3,27 +3,47 @@ plugins {
|
||||
alias libs.plugins.kotlin.android
|
||||
}
|
||||
|
||||
def VERSION_CODE = 1
|
||||
def VERSION_NAME = "1.0.0"
|
||||
|
||||
android {
|
||||
namespace 'com.alfred.demo'
|
||||
namespace 'com.navi.alfred.demo'
|
||||
compileSdk 34
|
||||
|
||||
defaultConfig {
|
||||
applicationId 'com.navi.alfred.demo'
|
||||
minSdk 21
|
||||
targetSdk 33
|
||||
versionCode VERSION_CODE
|
||||
versionName VERSION_NAME
|
||||
|
||||
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
|
||||
vectorDrawables {
|
||||
useSupportLibrary true
|
||||
}
|
||||
}
|
||||
|
||||
signingConfigs {
|
||||
debug {
|
||||
storeFile file('../keystore/navi-debug-key.jks')
|
||||
storePassword "android"
|
||||
keyAlias "androiddebugkey"
|
||||
keyPassword "android"
|
||||
}
|
||||
release {
|
||||
storeFile file('../keystore/navi-non-prod-release-key.jks')
|
||||
storePassword "android"
|
||||
keyAlias "navi"
|
||||
keyPassword "android"
|
||||
}
|
||||
}
|
||||
buildFeatures {
|
||||
buildConfig true
|
||||
}
|
||||
buildTypes {
|
||||
release {
|
||||
minifyEnabled false
|
||||
debuggable false
|
||||
minifyEnabled true
|
||||
shrinkResources true
|
||||
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
|
||||
signingConfig signingConfigs.release
|
||||
}
|
||||
}
|
||||
compileOptions {
|
||||
@@ -31,30 +51,22 @@ android {
|
||||
targetCompatibility JavaVersion.VERSION_17
|
||||
}
|
||||
kotlinOptions {
|
||||
freeCompilerArgs += ["-Xstring-concat=inline"]
|
||||
jvmTarget = '17'
|
||||
}
|
||||
packagingOptions {
|
||||
resources {
|
||||
excludes += '/META-INF/{AL2.0,LGPL2.1}'
|
||||
excludes += "/META-INF/{AL2.0,LGPL2.1}"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
dependencies {
|
||||
implementation project(':navi-alfred')
|
||||
|
||||
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
|
||||
}
|
||||
|
||||
@@ -11,12 +11,13 @@
|
||||
xmlns:tools="http://schemas.android.com/tools">
|
||||
|
||||
<application
|
||||
android:name=".MainApplication"
|
||||
android:name=".AlfredDemoApplication"
|
||||
android:allowBackup="true"
|
||||
android:dataExtractionRules="@xml/data_extraction_rules"
|
||||
android:fullBackupContent="@xml/backup_rules"
|
||||
android:icon="@mipmap/ic_launcher"
|
||||
android:label="@string/app_name"
|
||||
android:networkSecurityConfig="@xml/network_security_config"
|
||||
android:roundIcon="@mipmap/ic_launcher_round"
|
||||
android:supportsRtl="true"
|
||||
android:theme="@style/Theme.AppCompat.Light"
|
||||
@@ -24,10 +25,10 @@
|
||||
<activity
|
||||
android:name=".activity.MainActivity"
|
||||
android:exported="true"
|
||||
android:label="@string/app_name"
|
||||
android:theme="@style/Theme.AppCompat.Light">
|
||||
<intent-filter>
|
||||
<action android:name="android.intent.action.MAIN" />
|
||||
|
||||
<category android:name="android.intent.category.LAUNCHER" />
|
||||
</intent-filter>
|
||||
</activity>
|
||||
|
||||
@@ -1,23 +1,23 @@
|
||||
/*
|
||||
*
|
||||
* * Copyright © 2023 by Navi Technologies Limited
|
||||
* * Copyright © 2023-2024 by Navi Technologies Limited
|
||||
* * All rights reserved. Strictly confidential
|
||||
*
|
||||
*/
|
||||
|
||||
package com.alfred.demo
|
||||
package com.navi.alfred.demo
|
||||
|
||||
import android.app.Activity
|
||||
import android.app.Application
|
||||
import android.content.IntentFilter
|
||||
import android.os.Bundle
|
||||
import android.util.Log
|
||||
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.demo.activity.MainActivity
|
||||
import com.navi.alfred.demo.activity.SWWActivity
|
||||
import com.navi.alfred.utils.AlfredConstants
|
||||
import com.navi.alfred.utils.AlfredConstants.BROADCAST_ACTION_TYPE
|
||||
import com.navi.alfred.utils.log
|
||||
@@ -25,7 +25,7 @@ import kotlinx.coroutines.CoroutineScope
|
||||
import kotlinx.coroutines.Dispatchers
|
||||
import kotlinx.coroutines.launch
|
||||
|
||||
class MainApplication : Application(), Application.ActivityLifecycleCallbacks {
|
||||
class AlfredDemoApplication : Application(), Application.ActivityLifecycleCallbacks {
|
||||
private var appForegroundCounter: Int = 0
|
||||
|
||||
override fun onCreate() {
|
||||
@@ -5,7 +5,7 @@
|
||||
*
|
||||
*/
|
||||
|
||||
package com.alfred.demo
|
||||
package com.navi.alfred.demo
|
||||
|
||||
import android.content.BroadcastReceiver
|
||||
import android.content.Context
|
||||
@@ -1,19 +1,19 @@
|
||||
/*
|
||||
*
|
||||
* * Copyright © 2023 by Navi Technologies Limited
|
||||
* * Copyright © 2023-2024 by Navi Technologies Limited
|
||||
* * All rights reserved. Strictly confidential
|
||||
*
|
||||
*/
|
||||
|
||||
package com.alfred.demo.activity
|
||||
package com.navi.alfred.demo.activity
|
||||
|
||||
import android.content.Intent
|
||||
import android.os.Bundle
|
||||
import android.view.MotionEvent
|
||||
import android.widget.Button
|
||||
import androidx.appcompat.app.AppCompatActivity
|
||||
import com.alfred.demo.R
|
||||
import com.navi.alfred.AlfredManager
|
||||
import com.navi.alfred.demo.R
|
||||
|
||||
class MainActivity : AppCompatActivity() {
|
||||
|
||||
@@ -1,18 +1,18 @@
|
||||
/*
|
||||
*
|
||||
* * Copyright © 2023 by Navi Technologies Limited
|
||||
* * Copyright © 2023-2024 by Navi Technologies Limited
|
||||
* * All rights reserved. Strictly confidential
|
||||
*
|
||||
*/
|
||||
|
||||
package com.alfred.demo.activity
|
||||
package com.navi.alfred.demo.activity
|
||||
|
||||
import android.os.Bundle
|
||||
import android.view.MotionEvent
|
||||
import android.widget.Button
|
||||
import androidx.appcompat.app.AppCompatActivity
|
||||
import com.alfred.demo.R
|
||||
import com.navi.alfred.AlfredManager
|
||||
import com.navi.alfred.demo.R
|
||||
|
||||
class SWWActivity : AppCompatActivity() {
|
||||
override fun onCreate(savedInstanceState: Bundle?) {
|
||||
@@ -21,13 +21,20 @@ 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(
|
||||
reason = "SWW Button Clicked",
|
||||
code = "400",
|
||||
screenName = "SWW Activity",
|
||||
moduleName = "Alfred Demo App",
|
||||
statusCode = 400,
|
||||
networkType = "WIFI"
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
override fun dispatchTouchEvent(ev: MotionEvent?): Boolean {
|
||||
AlfredManager.handleTouchEvent(
|
||||
ev,
|
||||
currentTouchEvent = ev,
|
||||
screenName = "Demo Activity",
|
||||
moduleName = "Alfred Demo App",
|
||||
)
|
||||
@@ -7,7 +7,7 @@
|
||||
-->
|
||||
|
||||
<resources>
|
||||
<string name="app_name">Alfred Android</string>
|
||||
<string name="app_name">Alfred</string>
|
||||
<string name="crash">Crash Occurred</string>
|
||||
<string name="anr">Anr Occurred</string>
|
||||
<string name="app_background">App In Background</string>
|
||||
|
||||
19
app/src/main/res/xml/network_security_config.xml
Normal file
19
app/src/main/res/xml/network_security_config.xml
Normal file
@@ -0,0 +1,19 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
|
||||
<!--
|
||||
~
|
||||
~ * Copyright © 2024 by Navi Technologies Limited
|
||||
~ * All rights reserved. Strictly confidential
|
||||
~
|
||||
-->
|
||||
|
||||
<network-security-config>
|
||||
<debug-overrides>
|
||||
<trust-anchors>
|
||||
<certificates src="system" />
|
||||
<certificates
|
||||
overridePins="true"
|
||||
src="user" />
|
||||
</trust-anchors>
|
||||
</debug-overrides>
|
||||
</network-security-config>
|
||||
22
build.gradle
22
build.gradle
@@ -10,3 +10,25 @@ plugins {
|
||||
|
||||
apply from: 'spotless.gradle'
|
||||
apply from: 'projectDependencyGraph.gradle'
|
||||
|
||||
allprojects {
|
||||
repositories {
|
||||
google()
|
||||
mavenCentral()
|
||||
gradlePluginPortal()
|
||||
maven {
|
||||
url 'https://nexus.cmd.navi-tech.in/repository/maven-snapshots'
|
||||
credentials {
|
||||
username 'nexus-user'
|
||||
password 'nexus-user'
|
||||
}
|
||||
}
|
||||
maven {
|
||||
url 'https://nexus.cmd.navi-tech.in/repository/maven-releases'
|
||||
credentials {
|
||||
username 'nexus-user'
|
||||
password 'nexus-user'
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4,8 +4,6 @@ androidGradlePlugin = "8.4.0"
|
||||
androidx-appcompat = "1.6.1"
|
||||
androidx-core-ktx = "1.8.0"
|
||||
androidx-lifecycle = "2.6.1"
|
||||
androidx-test-espresso = "3.5.1"
|
||||
androidx-test-junit = "1.1.5"
|
||||
androidx-workRuntimeKtx = "2.8.1"
|
||||
anrwatchdog = "1.4.0"
|
||||
chucker = "4.0.0"
|
||||
@@ -13,7 +11,6 @@ firebase-bom = "32.8.1"
|
||||
firebase-crashlytics = "2.9.9"
|
||||
gson = "2.10.1"
|
||||
jakewharton-timber = "5.0.1"
|
||||
junit = "4.13.2"
|
||||
kotlin = "1.9.23"
|
||||
ksp = "1.9.23-1.0.20"
|
||||
loggingInterceptor = "4.12.0"
|
||||
@@ -33,10 +30,6 @@ androidx-lifecycle-viewmodel-ktx = { module = "androidx.lifecycle:lifecycle-view
|
||||
androidx-room-compiler = { module = "androidx.room:room-compiler", version.ref = "room" }
|
||||
androidx-room-ktx = { module = "androidx.room:room-ktx", version.ref = "room" }
|
||||
androidx-room-runtime = { module = "androidx.room:room-runtime", version.ref = "room" }
|
||||
androidx-room-testing = { module = "androidx.room:room-testing", version.ref = "room" }
|
||||
|
||||
androidx-test-espresso-core = { module = "androidx.test.espresso:espresso-core", version.ref = "androidx-test-espresso" }
|
||||
androidx-test-junit = { module = "androidx.test.ext:junit", version.ref = "androidx-test-junit" }
|
||||
|
||||
androidx-workRuntime-ktx = { module = "androidx.work:work-runtime-ktx", version.ref = "androidx-workRuntimeKtx" }
|
||||
|
||||
@@ -53,8 +46,6 @@ gson = { module = "com.google.code.gson:gson", version.ref = "gson" }
|
||||
|
||||
jakewharton-timber = { module = "com.jakewharton.timber:timber", version.ref = "jakewharton-timber" }
|
||||
|
||||
junit = { module = "junit:junit", version.ref = "junit" }
|
||||
|
||||
logging-interceptor = { module = "com.squareup.okhttp3:logging-interceptor", version.ref = "loggingInterceptor" }
|
||||
|
||||
retrofit-converter-gson = { module = "com.squareup.retrofit2:converter-gson", version.ref = "retrofit" }
|
||||
|
||||
BIN
keystore/navi-debug-key.jks
Normal file
BIN
keystore/navi-debug-key.jks
Normal file
Binary file not shown.
BIN
keystore/navi-non-prod-release-key.jks
Normal file
BIN
keystore/navi-non-prod-release-key.jks
Normal file
Binary file not shown.
2
navi-alfred/.gitignore
vendored
2
navi-alfred/.gitignore
vendored
@@ -1 +1 @@
|
||||
/build
|
||||
/build
|
||||
|
||||
@@ -16,8 +16,8 @@ android {
|
||||
minSdk 21
|
||||
targetSdk 33
|
||||
|
||||
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
|
||||
consumerProguardFiles "consumer-rules.pro"
|
||||
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
|
||||
}
|
||||
|
||||
buildFeatures {
|
||||
@@ -34,6 +34,7 @@ android {
|
||||
targetCompatibility JavaVersion.VERSION_17
|
||||
}
|
||||
kotlinOptions {
|
||||
freeCompilerArgs += ["-Xstring-concat=inline"]
|
||||
jvmTarget = '17'
|
||||
}
|
||||
}
|
||||
@@ -55,18 +56,15 @@ publishing {
|
||||
publications {
|
||||
if (project.hasProperty('NEXUS_URL')) {
|
||||
maven(MavenPublication) {
|
||||
if ("$NEXUS_URL".contains("maven-releases")) {
|
||||
version = "$VERSION"
|
||||
} else {
|
||||
version = "$VERSION-SNAPSHOT"
|
||||
}
|
||||
artifactId = "alfred"
|
||||
groupId = "com.navi.android"
|
||||
|
||||
if ("$IS_SNAPSHOT" == "false") {
|
||||
version = "$VERSION"
|
||||
println("https://nexus.cmd.navi-tech.in/#browse/browse:maven-releases:com%2Fnavi%2Fandroid%2Falfred%2F$version")
|
||||
} else {
|
||||
version = "$VERSION-SNAPSHOT"
|
||||
println("https://nexus.cmd.navi-tech.in/#browse/browse:maven-snapshots:com%2Fnavi%2Fandroid%2Falfred%2F$version")
|
||||
}
|
||||
|
||||
artifact("build/outputs/aar/navi-alfred-release.aar")
|
||||
artifact("build/outputs/aar/navi-alfred-${BUILD_TYPE}.aar")
|
||||
|
||||
pom.withXml {
|
||||
def dependenciesNode = asNode().appendNode('dependencies')
|
||||
@@ -84,35 +82,24 @@ publishing {
|
||||
|
||||
dependencies {
|
||||
api platform(libs.firebase.bom)
|
||||
api libs.firebase.analytics
|
||||
api libs.firebase.crashlytics
|
||||
api libs.logging.interceptor
|
||||
api libs.retrofit.converter.gson
|
||||
api libs.retrofit.retrofit
|
||||
|
||||
implementation libs.android.material
|
||||
|
||||
implementation libs.androidx.appcompat
|
||||
implementation libs.androidx.core.ktx
|
||||
implementation libs.androidx.room.ktx
|
||||
implementation libs.androidx.room.runtime
|
||||
implementation libs.androidx.workRuntime.ktx
|
||||
|
||||
implementation libs.gson
|
||||
|
||||
implementation libs.jakewharton.timber
|
||||
|
||||
debugImplementation libs.chucker.library
|
||||
|
||||
releaseImplementation libs.chucker.libraryNoOp
|
||||
|
||||
api libs.firebase.analytics
|
||||
api libs.firebase.crashlytics
|
||||
|
||||
api libs.logging.interceptor
|
||||
|
||||
api libs.retrofit.converter.gson
|
||||
api libs.retrofit.retrofit
|
||||
|
||||
ksp libs.androidx.room.compiler
|
||||
|
||||
androidTestImplementation libs.androidx.test.espresso.core
|
||||
androidTestImplementation libs.androidx.test.junit
|
||||
|
||||
testImplementation libs.androidx.room.testing
|
||||
testImplementation libs.junit
|
||||
}
|
||||
|
||||
@@ -1,3 +1,10 @@
|
||||
/*
|
||||
*
|
||||
* * Copyright © 2024 by Navi Technologies Limited
|
||||
* * All rights reserved. Strictly confidential
|
||||
*
|
||||
*/
|
||||
|
||||
package com.navi.alfred.network
|
||||
|
||||
object AlfredApiLogsManager {
|
||||
@@ -14,4 +21,4 @@ object AlfredApiLogsManager {
|
||||
null
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,3 +1,10 @@
|
||||
/*
|
||||
*
|
||||
* * Copyright © 2024 by Navi Technologies Limited
|
||||
* * All rights reserved. Strictly confidential
|
||||
*
|
||||
*/
|
||||
|
||||
package com.navi.alfred.network
|
||||
|
||||
import okhttp3.Request
|
||||
@@ -5,4 +12,4 @@ import okhttp3.Response
|
||||
|
||||
interface AlfredApiLogsProvider {
|
||||
fun sendApiLog(request: Request, response: Response)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -68,7 +68,8 @@ object AlfredFailureRetrofitProvider {
|
||||
.message(errorMessage.message.orEmpty())
|
||||
.build()
|
||||
}
|
||||
AlfredApiLogsManager.getAlfredApiLogsProvider()?.sendApiLog(request = request, response = response)
|
||||
AlfredApiLogsManager.getAlfredApiLogsProvider()
|
||||
?.sendApiLog(request = request, response = response)
|
||||
response
|
||||
}
|
||||
|
||||
|
||||
@@ -78,7 +78,8 @@ object AlfredRetrofitProvider {
|
||||
.message(errorMessage.message.orEmpty())
|
||||
.build()
|
||||
}
|
||||
AlfredApiLogsManager.getAlfredApiLogsProvider()?.sendApiLog(request = request, response = response)
|
||||
AlfredApiLogsManager.getAlfredApiLogsProvider()
|
||||
?.sendApiLog(request = request, response = response)
|
||||
response
|
||||
}
|
||||
|
||||
|
||||
@@ -51,10 +51,10 @@ internal suspend fun getCruiseConfig(cruiseApiSuccessful: (response: CruiseRespo
|
||||
AlfredConstants.DEFAULT_SEND_FAILURE_POST_URL,
|
||||
AlfredManager.config.getApiKey(),
|
||||
failureRequest =
|
||||
FailureRequest(
|
||||
failureAttributes = FailureAttributes(),
|
||||
events = listOf(cruiseFailure)
|
||||
)
|
||||
FailureRequest(
|
||||
failureAttributes = FailureAttributes(),
|
||||
events = listOf(cruiseFailure)
|
||||
)
|
||||
)
|
||||
} catch (e: Exception) {
|
||||
e.log()
|
||||
|
||||
@@ -282,7 +282,7 @@ internal suspend fun sendFailureEventsToServer(workManagerFlow: Boolean? = false
|
||||
(response.isSuccessful &&
|
||||
response.code() == AlfredConstants.CODE_API_SUCCESS) or
|
||||
(response.code() == AlfredConstants.CODE_API_BAD_REQUEST) or
|
||||
(isNoInternetResponse(response.code()))
|
||||
(isNoInternetResponse(response.code()))
|
||||
) {
|
||||
AlfredManager.failureEventDao.deleteFailureEvents(
|
||||
failureEvents.map { it.eventId }
|
||||
@@ -408,7 +408,8 @@ internal fun sendAlfredSessionEvent(
|
||||
errorType = API_ERROR,
|
||||
requestUrl = DEFAULT_SEND_SESSION_POST_URL,
|
||||
requestMethod = POST_METHOD,
|
||||
zipName = request.session_upload_event_attributes.eventId?.let { listOf(it) },
|
||||
zipName =
|
||||
request.session_upload_event_attributes.eventId?.let { listOf(it) },
|
||||
errorStatusCode = response.code().toLong(),
|
||||
errorMessage = response.message(),
|
||||
errorName = INGEST_SESSION_FAILURE,
|
||||
|
||||
@@ -43,7 +43,8 @@ internal fun handleException(e: Throwable): ErrorMessage {
|
||||
internal fun isNetworkAvailable(): Boolean {
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
|
||||
val connectivityManager =
|
||||
AlfredManager.applicationContext.getSystemService(Context.CONNECTIVITY_SERVICE) as ConnectivityManager
|
||||
AlfredManager.applicationContext.getSystemService(Context.CONNECTIVITY_SERVICE)
|
||||
as ConnectivityManager
|
||||
val network = connectivityManager.activeNetwork ?: return false
|
||||
val activeNetwork = connectivityManager.getNetworkCapabilities(network) ?: return false
|
||||
return when {
|
||||
@@ -53,7 +54,8 @@ internal fun isNetworkAvailable(): Boolean {
|
||||
}
|
||||
} else {
|
||||
val connectivityManager =
|
||||
AlfredManager.applicationContext.getSystemService(Context.CONNECTIVITY_SERVICE) as ConnectivityManager
|
||||
AlfredManager.applicationContext.getSystemService(Context.CONNECTIVITY_SERVICE)
|
||||
as ConnectivityManager
|
||||
val networkInfo = connectivityManager.activeNetworkInfo
|
||||
return networkInfo != null && networkInfo.isConnected
|
||||
}
|
||||
|
||||
@@ -212,10 +212,7 @@ internal suspend fun captureScreen(
|
||||
} else {
|
||||
if (rootView != null) {
|
||||
withContext(Dispatchers.Main) {
|
||||
captureComposeViewWithMasking(
|
||||
canvas,
|
||||
rootView
|
||||
)
|
||||
captureComposeViewWithMasking(canvas, rootView)
|
||||
}
|
||||
} else {
|
||||
withContext(Dispatchers.Main) { v.draw(canvas) }
|
||||
@@ -319,14 +316,10 @@ internal suspend fun captureBottomSheet(
|
||||
}
|
||||
}
|
||||
|
||||
internal fun captureComposeViewWithMasking(
|
||||
canvas: Canvas,
|
||||
rootView: View
|
||||
) {
|
||||
internal fun captureComposeViewWithMasking(canvas: Canvas, rootView: View) {
|
||||
rootView.draw(canvas)
|
||||
|
||||
val sensitiveCoordinates =
|
||||
AlfredManager.sensitiveComposeRepository.sensitiveCoordinates
|
||||
val sensitiveCoordinates = AlfredManager.sensitiveComposeRepository.sensitiveCoordinates
|
||||
|
||||
val paint = Paint()
|
||||
paint.color = Color.BLACK
|
||||
|
||||
@@ -8,13 +8,5 @@ pluginManagement {
|
||||
|
||||
rootProject.name = "alfred"
|
||||
|
||||
dependencyResolutionManagement {
|
||||
repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)
|
||||
repositories {
|
||||
google()
|
||||
mavenCentral()
|
||||
}
|
||||
}
|
||||
|
||||
include ':app'
|
||||
include ':navi-alfred'
|
||||
|
||||
@@ -1,6 +1,4 @@
|
||||
spotless {
|
||||
ratchetFrom 'origin/master'
|
||||
|
||||
format 'misc', {
|
||||
target '**/*.gradle', '**/*.md', '**/.gitignore'
|
||||
|
||||
|
||||
Reference in New Issue
Block a user