Skip to content

Commit

Permalink
Merge pull request #86 from makeen-project/ALS-1806
Browse files Browse the repository at this point in the history
[ALS-1806] code optimization
  • Loading branch information
wadhawh authored Oct 16, 2024
2 parents 25b40e3 + 293f3de commit 76e7914
Show file tree
Hide file tree
Showing 97 changed files with 165 additions and 262 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/test-android-e2e.yml
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,8 @@ jobs:
adb emu geo fix 72.58727 23.02579
./gradlew app:connectedDebugAndroidTest -i -Pandroid.testInstrumentationRunnerArguments.class=com.aws.amazonlocation.ui.DefaultConnectionFlowSuite
./gradlew app:connectedDebugAndroidTest -i -Pandroid.testInstrumentationRunnerArguments.class=com.aws.amazonlocation.ui.DefaultConnectionFlowSuite2
./gradlew app:connectedDebugAndroidTest -i -Pandroid.testInstrumentationRunnerArguments.class=com.aws.amazonlocation.ui.AWSConnectionSuite
./gradlew app:connectedDebugAndroidTest -i -Pandroid.testInstrumentationRunnerArguments.class=com.aws.amazonlocation.ui.AWSConnectionSuite2
./gradlew app:connectedDebugAndroidTest -i -Pandroid.testInstrumentationRunnerArguments.class=com.aws.amazonlocation.ui.AWSTrackingAndConnectionTestSuite
./gradlew app:connectedDebugAndroidTest -i -Pandroid.testInstrumentationRunnerArguments.class=com.aws.amazonlocation.ui.AWSGeofenceAndConnectionTestSuite
- name: Upload test results
uses: actions/upload-artifact@v4
Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -133,8 +133,8 @@ Note:

./gradlew app:connectedDebugAndroidTest -Pandroid.testInstrumentationRunnerArguments.class=com.aws.amazonlocation.ui.DefaultConnectionFlowSuite
./gradlew app:connectedDebugAndroidTest -Pandroid.testInstrumentationRunnerArguments.class=com.aws.amazonlocation.ui.DefaultConnectionFlowSuite2
./gradlew app:connectedDebugAndroidTest -Pandroid.testInstrumentationRunnerArguments.class=com.aws.amazonlocation.ui.AWSConnectionSuite
./gradlew app:connectedDebugAndroidTest -Pandroid.testInstrumentationRunnerArguments.class=com.aws.amazonlocation.ui.AWSConnectionSuite2
./gradlew app:connectedDebugAndroidTest -Pandroid.testInstrumentationRunnerArguments.class=com.aws.amazonlocation.ui.AWSTrackingAndConnectionTestSuite
./gradlew app:connectedDebugAndroidTest -Pandroid.testInstrumentationRunnerArguments.class=com.aws.amazonlocation.ui.AWSGeofenceAndConnectionTestSuite

## Resources
> Maps (Name - Style)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package com.aws.amazonlocation.ui

import com.aws.amazonlocation.ui.main.ConnectToAWSTest
import com.aws.amazonlocation.ui.main.GeofenceAddTest
import com.aws.amazonlocation.ui.main.GeofenceDeleteTest
import com.aws.amazonlocation.ui.main.GeofenceEditTest
import com.aws.amazonlocation.ui.main.SettingAWSDisconnectingTest
Expand All @@ -16,6 +17,7 @@ import org.junit.runners.Suite
@Suite.SuiteClasses(
ConnectToAWSTest::class,
SettingSignInTest::class,
GeofenceAddTest::class,
TrackingGeofenceEnterTest::class,
TrackingGeofenceExitTest::class,
TrackingDeleteTrackingHistoryTest::class,
Expand All @@ -24,4 +26,4 @@ import org.junit.runners.Suite
SettingSignOutTest::class,
SettingAWSDisconnectingTest::class,
)
class AWSConnectionSuite2
class AWSGeofenceAndConnectionTestSuite
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
package com.aws.amazonlocation.ui

import com.aws.amazonlocation.ui.main.GeofenceAddTest
import com.aws.amazonlocation.ui.main.SettingAWSDisconnectingTest
import com.aws.amazonlocation.ui.main.SettingSignOutTest
import com.aws.amazonlocation.ui.main.TrackingAwsConnectTest
Expand All @@ -23,8 +22,7 @@ import org.junit.runners.Suite
TrackingStartTrackingHistoryLoggedTest::class,
TrackingStartTrackingMapDisplayTest::class,
TrackingDeleteTrackingHistoryTest::class,
GeofenceAddTest::class,
SettingSignOutTest::class,
SettingAWSDisconnectingTest::class,
)
class AWSConnectionSuite
class AWSTrackingAndConnectionTestSuite
Original file line number Diff line number Diff line change
Expand Up @@ -7,17 +7,13 @@ import androidx.test.core.app.ApplicationProvider
import androidx.test.espresso.Espresso.onView
import androidx.test.espresso.action.ViewActions.click
import androidx.test.espresso.action.ViewActions.replaceText
import androidx.test.espresso.action.ViewActions.typeText
import androidx.test.espresso.assertion.ViewAssertions.matches
import androidx.test.espresso.matcher.ViewMatchers.* // ktlint-disable no-wildcard-imports
import androidx.test.espresso.matcher.ViewMatchers.isDisplayed
import androidx.test.espresso.matcher.ViewMatchers.withId
import androidx.test.platform.app.InstrumentationRegistry.getInstrumentation
import androidx.test.rule.ActivityTestRule
import androidx.test.rule.GrantPermissionRule
import androidx.test.uiautomator.By
import androidx.test.uiautomator.UiDevice
import androidx.test.uiautomator.Until
import com.aws.amazonlocation.ACCESS_COARSE_LOCATION
import com.aws.amazonlocation.ACCESS_FINE_LOCATION
import com.aws.amazonlocation.AMAZON_MAP_READY
import com.aws.amazonlocation.BaseTestMainActivity
import com.aws.amazonlocation.BuildConfig
Expand All @@ -37,11 +33,9 @@ import com.aws.amazonlocation.failTest
import com.google.android.material.bottomsheet.BottomSheetBehavior
import com.google.android.material.card.MaterialCardView
import com.google.android.material.textfield.TextInputEditText
import dagger.hilt.android.testing.HiltAndroidRule
import dagger.hilt.android.testing.HiltAndroidTest
import dagger.hilt.android.testing.UninstallModules
import org.junit.Assert
import org.junit.Rule
import org.junit.Test

@UninstallModules(AppModule::class)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import androidx.test.espresso.action.ViewActions.click
import androidx.test.espresso.action.ViewActions.replaceText
import androidx.test.espresso.assertion.ViewAssertions.matches
import androidx.test.espresso.contrib.RecyclerViewActions
import androidx.test.espresso.matcher.ViewMatchers.* // ktlint-disable no-wildcard-imports
import androidx.test.espresso.matcher.ViewMatchers.*
import androidx.test.platform.app.InstrumentationRegistry.getInstrumentation
import androidx.test.uiautomator.By
import androidx.test.uiautomator.UiDevice
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import androidx.test.espresso.action.ViewActions
import androidx.test.espresso.action.ViewActions.click
import androidx.test.espresso.assertion.ViewAssertions.matches
import androidx.test.espresso.contrib.RecyclerViewActions
import androidx.test.espresso.matcher.ViewMatchers.* // ktlint-disable no-wildcard-imports
import androidx.test.espresso.matcher.ViewMatchers.*
import androidx.test.platform.app.InstrumentationRegistry.getInstrumentation
import androidx.test.uiautomator.By
import androidx.test.uiautomator.UiDevice
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,14 @@ import androidx.recyclerview.widget.RecyclerView.ViewHolder
import androidx.test.core.app.ApplicationProvider
import androidx.test.espresso.action.ViewActions.click
import androidx.test.espresso.contrib.RecyclerViewActions.actionOnItemAtPosition
import androidx.test.espresso.matcher.ViewMatchers.* // ktlint-disable no-wildcard-imports
import androidx.test.espresso.matcher.ViewMatchers.*
import androidx.test.platform.app.InstrumentationRegistry.getInstrumentation
import androidx.test.uiautomator.By
import androidx.test.uiautomator.UiDevice
import androidx.test.uiautomator.Until
import com.aws.amazonlocation.* // ktlint-disable no-wildcard-imports
import com.aws.amazonlocation.*
import com.aws.amazonlocation.di.AppModule
import com.aws.amazonlocation.utils.* // ktlint-disable no-wildcard-imports
import com.aws.amazonlocation.utils.*
import com.google.android.material.bottomsheet.BottomSheetBehavior
import dagger.hilt.android.testing.HiltAndroidTest
import dagger.hilt.android.testing.UninstallModules
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
package com.aws.amazonlocation.ui.main

import androidx.test.core.app.ApplicationProvider
import androidx.test.espresso.matcher.ViewMatchers.* // ktlint-disable no-wildcard-imports
import androidx.test.platform.app.InstrumentationRegistry.getInstrumentation
import androidx.test.uiautomator.By
import androidx.test.uiautomator.UiDevice
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import androidx.test.espresso.Espresso
import androidx.test.espresso.action.ViewActions.click
import androidx.test.espresso.action.ViewActions.replaceText
import androidx.test.espresso.contrib.RecyclerViewActions
import androidx.test.espresso.matcher.ViewMatchers.* // ktlint-disable no-wildcard-imports
import androidx.test.espresso.matcher.ViewMatchers.*
import androidx.test.platform.app.InstrumentationRegistry.getInstrumentation
import androidx.test.uiautomator.By
import androidx.test.uiautomator.UiDevice
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
package com.aws.amazonlocation.ui.main

import androidx.test.core.app.ApplicationProvider
import androidx.test.espresso.matcher.ViewMatchers.* // ktlint-disable no-wildcard-imports
import androidx.test.platform.app.InstrumentationRegistry.getInstrumentation
import androidx.test.uiautomator.By
import androidx.test.uiautomator.UiDevice
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ package com.aws.amazonlocation.ui.main

import androidx.test.core.app.ApplicationProvider
import androidx.test.espresso.Espresso.onView
import androidx.test.espresso.matcher.ViewMatchers.* // ktlint-disable no-wildcard-imports
import androidx.test.espresso.matcher.ViewMatchers.*
import androidx.test.platform.app.InstrumentationRegistry.getInstrumentation
import androidx.test.uiautomator.By
import androidx.test.uiautomator.UiDevice
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,14 @@ import androidx.appcompat.widget.AppCompatTextView
import androidx.core.view.isVisible
import androidx.recyclerview.widget.RecyclerView
import androidx.test.espresso.Espresso.onView
import androidx.test.espresso.action.ViewActions.* // ktlint-disable no-wildcard-imports
import androidx.test.espresso.action.ViewActions.*
import androidx.test.espresso.assertion.ViewAssertions.matches
import androidx.test.espresso.contrib.RecyclerViewActions
import androidx.test.espresso.matcher.ViewMatchers.* // ktlint-disable no-wildcard-imports
import androidx.test.espresso.matcher.ViewMatchers.*
import androidx.test.platform.app.InstrumentationRegistry.getInstrumentation
import androidx.test.rule.ActivityTestRule
import androidx.test.rule.GrantPermissionRule
import androidx.test.uiautomator.* // ktlint-disable no-wildcard-imports
import androidx.test.uiautomator.*
import com.aws.amazonlocation.AMAZON_MAP_READY
import com.aws.amazonlocation.BaseTestMainActivity
import com.aws.amazonlocation.BuildConfig
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,13 @@ import androidx.appcompat.widget.AppCompatTextView
import androidx.core.view.isVisible
import androidx.recyclerview.widget.RecyclerView
import androidx.test.espresso.Espresso.onView
import androidx.test.espresso.action.ViewActions.* // ktlint-disable no-wildcard-imports
import androidx.test.espresso.action.ViewActions.*
import androidx.test.espresso.contrib.RecyclerViewActions
import androidx.test.espresso.matcher.ViewMatchers.* // ktlint-disable no-wildcard-imports
import androidx.test.espresso.matcher.ViewMatchers.*
import androidx.test.platform.app.InstrumentationRegistry.getInstrumentation
import androidx.test.rule.ActivityTestRule
import androidx.test.rule.GrantPermissionRule
import androidx.test.uiautomator.* // ktlint-disable no-wildcard-imports
import androidx.test.uiautomator.*
import com.aws.amazonlocation.AMAZON_MAP_READY
import com.aws.amazonlocation.BaseTestMainActivity
import com.aws.amazonlocation.BuildConfig
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import androidx.test.espresso.action.ViewActions
import androidx.test.espresso.action.ViewActions.click
import androidx.test.espresso.assertion.ViewAssertions.matches
import androidx.test.espresso.contrib.RecyclerViewActions
import androidx.test.espresso.matcher.ViewMatchers.* // ktlint-disable no-wildcard-imports
import androidx.test.espresso.matcher.ViewMatchers.*
import androidx.test.platform.app.InstrumentationRegistry.getInstrumentation
import androidx.test.uiautomator.By
import androidx.test.uiautomator.UiDevice
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,19 +10,19 @@ import androidx.test.espresso.action.ViewActions.replaceText
import androidx.test.espresso.action.ViewActions.typeText
import androidx.test.espresso.assertion.ViewAssertions
import androidx.test.espresso.contrib.RecyclerViewActions
import androidx.test.espresso.matcher.ViewMatchers.* // ktlint-disable no-wildcard-imports
import androidx.test.espresso.matcher.ViewMatchers.*
import androidx.test.platform.app.InstrumentationRegistry.getInstrumentation
import androidx.test.uiautomator.By
import androidx.test.uiautomator.UiDevice
import androidx.test.uiautomator.Until
import com.aws.amazonlocation.* // ktlint-disable no-wildcard-imports
import com.aws.amazonlocation.*
import com.aws.amazonlocation.di.AppModule
import com.aws.amazonlocation.utils.* // ktlint-disable no-wildcard-imports
import com.aws.amazonlocation.utils.*
import dagger.hilt.android.testing.HiltAndroidTest
import dagger.hilt.android.testing.UninstallModules
import org.hamcrest.CoreMatchers
import org.hamcrest.core.AllOf.allOf
import org.junit.* // ktlint-disable no-wildcard-imports
import org.junit.*

@UninstallModules(AppModule::class)
@HiltAndroidTest
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import androidx.test.espresso.action.ViewActions.click
import androidx.test.espresso.action.ViewActions.replaceText
import androidx.test.espresso.assertion.ViewAssertions.matches
import androidx.test.espresso.contrib.RecyclerViewActions
import androidx.test.espresso.matcher.ViewMatchers.* // ktlint-disable no-wildcard-imports
import androidx.test.espresso.matcher.ViewMatchers.*
import androidx.test.platform.app.InstrumentationRegistry.getInstrumentation
import androidx.test.uiautomator.By
import androidx.test.uiautomator.UiDevice
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.aws.amazonlocation.utils.retry_rule // ktlint-disable package-name
package com.aws.amazonlocation.utils.retry_rule

@Retention(AnnotationRetention.RUNTIME)
annotation class Retry
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.aws.amazonlocation.utils.screenshot_rule // ktlint-disable package-name
package com.aws.amazonlocation.utils.screenshot_rule

import android.os.Environment.DIRECTORY_PICTURES
import android.os.Environment.getExternalStoragePublicDirectory
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.aws.amazonlocation.utils.screenshot_rule // ktlint-disable package-name
package com.aws.amazonlocation.utils.screenshot_rule

import android.util.Log
import androidx.test.runner.screenshot.Screenshot
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.aws.amazonlocation.utils.screenshot_rule // ktlint-disable package-name
package com.aws.amazonlocation.utils.screenshot_rule

import org.junit.rules.TestWatcher
import org.junit.runner.Description
Expand Down
11 changes: 0 additions & 11 deletions app/src/main/java/com/aws/amazonlocation/data/response/BusData.kt

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.aws.amazonlocation.data.response // ktlint-disable filename
package com.aws.amazonlocation.data.response

data class MapStyleData(
var styleNameDisplay: String? = null,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.aws.amazonlocation.data.response // ktlint-disable filename
package com.aws.amazonlocation.data.response

data class MapStyleInnerData(
var mapName: String? = null,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,10 @@ class NavigationData(
var country: String? = null,
var isDataSuccess: Boolean = false
) {
fun getRegions(): String {
var mRegion = ""
fun getAddress(): String {
var mAddress = ""
if (isDataSuccess) {
mRegion += if (!destinationAddress.isNullOrEmpty()) {
mAddress += if (!destinationAddress.isNullOrEmpty()) {
destinationAddress
} else if (!subRegion.isNullOrEmpty() && !region.isNullOrEmpty()) {
"$subRegion, $region"
Expand All @@ -43,8 +43,8 @@ class NavigationData(
""
}
} else {
mRegion = destinationAddress.toString()
mAddress = destinationAddress.toString()
}
return mRegion
return mAddress
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -513,7 +513,7 @@ class MainActivity :
}
}

fun openSingIn() {
fun openSignIn() {
showProgress()
mBottomSheetDialog?.hide()
showViews(mBinding.signInWebView, mBinding.ivBackMain, mBinding.viewBottom)
Expand Down Expand Up @@ -1139,7 +1139,7 @@ class MainActivity :
SignInConnectInterface {
override fun signIn(dialog: Dialog?) {
mBottomSheetDialog = dialog
openSingIn()
openSignIn()
}

override fun continueToExplore(dialog: Dialog?) {
Expand All @@ -1152,7 +1152,7 @@ class MainActivity :
object : SignInRequiredInterface {
override fun signInClick(dialog: Dialog?) {
mBottomSheetDialog = dialog
openSingIn()
openSignIn()
}

override fun mayBeLaterClick(dialog: Dialog?) {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.aws.amazonlocation.ui.main.data_provider // ktlint-disable package-name
package com.aws.amazonlocation.ui.main.data_provider

import android.content.DialogInterface
import android.content.Intent
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1163,7 +1163,7 @@ class ExploreFragment :
it.navigationList[0].distance?.let { distance ->
setNavigationTimeDialog(
distance,
it.navigationList[0].getRegions(),
it.navigationList[0].getAddress(),
)
}
}
Expand Down Expand Up @@ -1985,7 +1985,7 @@ class ExploreFragment :
it.distance?.let { distance ->
setNavigationTimeDialog(
distance,
it.getRegions(),
it.getAddress(),
)
}
}.onError {
Expand Down Expand Up @@ -4942,7 +4942,7 @@ class ExploreFragment :
mMapHelper.moveCameraToLocation(it1)
}
mBaseActivity?.isTablet?.let {
if (mBaseActivity?.mSimulationUtils?.isSimulationBottomSheetVisible() == true && mBaseActivity?.mTrackingUtils?.isChangeDataProviderClicked == true && mBaseActivity?.mGeofenceUtils?.isChangeDataProviderClicked == true) {
if (mBaseActivity?.mSimulationUtils?.isSimulationBottomSheetVisible() == true || mBaseActivity?.mTrackingUtils?.isChangeDataProviderClicked == true || mBaseActivity?.mGeofenceUtils?.isChangeDataProviderClicked == true) {
return@let
}
if (it) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ class NavigationAdapter(
RecyclerView.ViewHolder(binding.root) {
fun bind(data: NavigationData) {
binding.apply {
tvNavigationAddress.text = data.getRegions()
tvNavigationAddress.text = data.getAddress()

data.distance?.let { distance ->
tvNavigationDistance.text = preferenceManager.getValue(KEY_UNIT_SYSTEM, "").let { unitSystem ->
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.aws.amazonlocation.ui.main.language // ktlint-disable package-name
package com.aws.amazonlocation.ui.main.language

import android.os.Bundle
import android.view.LayoutInflater
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.aws.amazonlocation.ui.main.map_style // ktlint-disable package-name
package com.aws.amazonlocation.ui.main.map_style

import android.annotation.SuppressLint
import android.app.Dialog
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.aws.amazonlocation.ui.main.map_style // ktlint-disable package-name
package com.aws.amazonlocation.ui.main.map_style

import android.annotation.SuppressLint
import android.content.DialogInterface
Expand Down
Loading

0 comments on commit 76e7914

Please sign in to comment.