Skip to content

Commit

Permalink
Update demo app to latest APIs (#74)
Browse files Browse the repository at this point in the history
* fixed ALS-1665 added collapse option on directions bottomsheet view

* removed amplify and map styles

* implemented oauth2 sign in

* Implementation of sign in and removal of auth sdk

* added iot device v2 sdk

* added iot device package

* Implemented Geodence batch evaluate and refresh mechanism

* fixed navigation and direction issues

* Update AWSLoginService.swift

* Update AWSLoginService.swift

* Implemented tracking geofence notification IoT

* fix IoT connection

* refactoring of IoT mqtt client

* fixed unit test cases

* Updated E2E test cases

* Updated E2E test cases

* Update Package.resolved

* updating macos github runner

* Update test-ios-e2e.yml

* Update test-ios-e2e.yml

* Update test-ios-e2e.yml

* Update test-ios-e2e.yml

* Update test-ios-e2e.yml

* Update test-ios-e2e.yml

* Update test-ios-e2e.yml

* Update test-ios-e2e.yml

* Update test-ios-e2e.yml

* update E2E test cases and workflow

* Update Gemfile.lock

* optimized test cases

* Update MapUITests.swift

* Update test-ios-e2e.yml

* Implemented disconnect and logout on settings screen

* Update build-ios.yml

* Update build-ios.yml

* Update build-ios.yml

* Bug Fixes

* Update SearchVC.swift

* Update SearchViewModel.swift

* Implemented refresh credentials

* updated workflows

* Update build-ios.yml

* Update build-ios.yml

* Update build-ios.yml

* Update build-ios.yml

* Update project.pbxproj

* Update test-ios.yml

* Update AWSSignatureDelegate.swift

* Revert "Update AWSSignatureDelegate.swift"

This reverts commit 5ed2352.

* renamed AWSSignatureV4Delegate

* Update test-ios.yml

* Update DateExtensionTests.swift

* Update test-ios-e2e.yml

* Restricted xcovergage to target projects only

* Update test-ios-e2e.yml

* Update UITestGeofenceScreen.swift

* Update UITestGeofenceScreen.swift

* refactoring and removed warnings

* Update LocationServices.xctestplan

* Removed warnings and reverted back to mac 14 runner

* Update CLLocationCoordinate2D+Extension.swift

* Update UITestSettingsScreen.swift

* updated simulator

* Update Fastfile

* updated checkout version

* Revert "Removed warnings and reverted back to mac 14 runner"

This reverts commit c92b75b.

* Update LocationServices.xctestplan

* refactoring

* fixes

* Update LocationServices.xctestplan

* fix

* add tableview identifier

* Update UITestSettingsScreen.swift

* increase simulator versions

* added a dummy test case

* test case fix

* Update test-ios-e2e.yml

* Update SettingsUITests.swift

* Update test-ios-e2e.yml

* updated test case

* fix

* fix

* Update test-ios-e2e.yml

* Update Fastfile

* Update Fastfile

* Update Fastfile

* Update SettingsUITests.swift

* Update SettingsUITests.swift

* Update SettingsUITests.swift

* Update SettingsVC.swift

* Update SettingsVC.swift

* Update SettingsVC.swift

* Update SettingsVC.swift

* Update SettingsVC.swift

* fix

* Update SettingsVC.swift

* Update SettingsVC.swift

* Refactor settings button for disconnect and logout

* re enabled test cases

* Update Fastfile

* fixed test cases

* Removed unecessary code

* downgraded macos runner tier

* Update Fastfile

* Update Fastfile

* Update UITestTrackingScreen.swift

* Update LocationServices.xctestplan

* Update TrackingUITests.swift

* Re-enabled test cases

* Update Fastfile

* Update LocationServices.xctestplan

* Update LocationServices.xctestplan

* Update test-ios-e2e.yml

* Update LocationServices.xctestplan

* ALS-1805 fixed PR feedback

* Fixed PR feedback

* Create .gitignore

* Implemented Map new Style and new API SDK for places, routes and other bug fixes

* Update ConfigTestTemplate.xcconfig

* Implemented Political View E2E test case

* Removed pak political view

* Refactoring of auth helper files and removed unused codes

* Fixed ipad settings map style UI

* Update MapStyleVC.swift

* Update SettingsVC.swift

* removed blurstatusbar

* Update ExploreVC.swift

* Update LocationSearchService.swift

* Fixed PR Feedback

* Renamed destionation typo to destination

* reverted the bundle identifier

* disable bottomsheet grab on tracking and geofences for mapstyles

* removed commented code

* Implemented multi route leg details

* Fixed post login api Key issue and dismiss login screen after login

* Update AWSLoginServiceMock.swift

* Fixed coordinates search by replacing nearby with reverse geocode

* Implemented lat, long and long, lat in reverse geocode

* Update SearchCell.swift

* Implemented new version of Swift sdks such as places & routes

* refactoring

* removed local AWSGeoservices package

* Optimization and Show loader

* added loader on sign in button

---------

Co-authored-by: Zeeshan Sheikh <[email protected]>
Co-authored-by: Zeeshan Sheikh <[email protected]>
Co-authored-by: wadhawh <[email protected]>
  • Loading branch information
4 people authored Nov 6, 2024
1 parent 025633e commit ba22ed4
Show file tree
Hide file tree
Showing 126 changed files with 2,129 additions and 2,437 deletions.
16 changes: 14 additions & 2 deletions LocationServices/.xcovignore
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,19 @@
- DataProviderViewModel.swift
- NavigationViewModel.swift

# Commenting partial code coverage files due to some code is not able to covered in unit test cases. Need refactoring
# Commenting partial code coverage files due to some code is not able to covered in unit test cases.
- GeofenceDashboardViewModel.swift
- TrackingViewModel.swift
- ExploreViewModel.swift
- ExploreViewModel.swift

# Ignoring AuthHelper files as it will be accessed via Auth SDK when it is available
- AuthHelper.swift
- ApiAuthHelper.swift
- CognitoAuthHelper.swift
- LocationCredentialsProvider.swift
- CognitoCredentialsProvider.swift
- AmazonLocationCognitoCredentialsProvider.swift
- AmazonLocationApiCredentialsProvider.swift
- AmazonLocationClient.swift
- ApiKeyAuthScheme.swift
- KeyChainHelper.swift
1 change: 1 addition & 0 deletions LocationServices/ConfigTemplate.xcconfig
Original file line number Diff line number Diff line change
Expand Up @@ -10,3 +10,4 @@

IDENTITY_POOL_ID = REGION:XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
AWS_REGION = REGION
API_KEY = XXXX
1 change: 1 addition & 0 deletions LocationServices/ConfigTestTemplate.xcconfig
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@

IDENTITY_POOL_ID = REGION:XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
AWS_REGION = REGION
API_KEY = XXXX

TEST_IDENTITY_POOL_ID = REGION:XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
TEST_USER_POOL_CLIENT_ID = USER_POOL_CLIENT_ID
Expand Down
229 changes: 119 additions & 110 deletions LocationServices/LocationServices.xcodeproj/project.pbxproj

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
@@ -1,31 +1,40 @@
{
"originHash" : "33fa476c44ec13ba9dfb107bc55a239c88b17c3ebefc9a581f9498da82ded5fd",
"originHash" : "37fc4666dc940bc2b2a2f41d16bb81b2d1c617bbb6ce9c52d9cf2662479f17b0",
"pins" : [
{
"identity" : "amazon-location-mobile-auth-sdk-ios",
"kind" : "remoteSourceControl",
"location" : "https://github.com/aws-geospatial/amazon-location-mobile-auth-sdk-ios.git",
"state" : {
"revision" : "787edfff4d6cc7573dc351d3bc851675114838e6",
"version" : "1.0.0"
}
},
{
"identity" : "aws-crt-swift",
"kind" : "remoteSourceControl",
"location" : "https://github.com/awslabs/aws-crt-swift",
"state" : {
"branch" : "mqtt_test_app",
"revision" : "e7e603d3aadd1749b3e5cc554832ab337fdfd8f3"
"revision" : "599ce744efbba6cc992bf0c59de2c6e4077bb04d"
}
},
{
"identity" : "aws-sdk-swift",
"kind" : "remoteSourceControl",
"location" : "https://github.com/awslabs/aws-sdk-swift",
"state" : {
"revision" : "8ec5c0c820ca912a6bad1fc31c287d321385d698",
"version" : "1.0.18"
"revision" : "54a459ed4d9af2cb2d8e6fdcd96b72543bebb88a",
"version" : "1.0.33"
}
},
{
"identity" : "keychain-swift",
"kind" : "remoteSourceControl",
"location" : "https://github.com/evgenyneu/keychain-swift.git",
"state" : {
"revision" : "5e1b02b6a9dac2a759a1d5dbc175c86bd192a608",
"version" : "24.0.0"
"revision" : "d108a1fa6189e661f91560548ef48651ed8d93b9",
"version" : "20.0.0"
}
},
{
Expand All @@ -42,8 +51,8 @@
"kind" : "remoteSourceControl",
"location" : "https://github.com/smithy-lang/smithy-swift",
"state" : {
"revision" : "bf096bf5c507e2c3f9ecc23c0c65dba2e1ffe3b2",
"version" : "0.79.0"
"revision" : "0d4d3eae8cfb04f3e0cbc4e7740e7344cc9fac55",
"version" : "0.87.0"
}
},
{
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
{
"colors" : [
{
"color" : {
"color-space" : "srgb",
"components" : {
"alpha" : "1.000",
"blue" : "0x98",
"green" : "0x84",
"red" : "0x01"
}
},
"idiom" : "universal"
},
{
"appearances" : [
{
"appearance" : "luminosity",
"value" : "dark"
}
],
"color" : {
"color-space" : "srgb",
"components" : {
"alpha" : "1.000",
"blue" : "0x98",
"green" : "0x84",
"red" : "0x01"
}
},
"idiom" : "universal"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
{
"colors" : [
{
"color" : {
"color-space" : "srgb",
"components" : {
"alpha" : "1.000",
"blue" : "0xF0",
"green" : "0xF2",
"red" : "0xF2"
}
},
"idiom" : "universal"
},
{
"appearances" : [
{
"appearance" : "luminosity",
"value" : "dark"
}
],
"color" : {
"color-space" : "srgb",
"components" : {
"alpha" : "1.000",
"blue" : "0xF0",
"green" : "0xF2",
"red" : "0xF2"
}
},
"idiom" : "universal"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@ extension UIColor {
//Map Colors
static let mapDarkBlackColor = UIColor(named: "mapdarkblackcolor")!
static let maplightGrayColor = UIColor(named: "maplightGrayColor")!
static let mapStyleTintColor = UIColor(named: "mapStyleTintColor")!
static let politicalListViewBackgroundColor = UIColor(named: "politicalListViewBackgroundColor")!
static let mapElementDiverColor = UIColor(named: "dividerColor")!
static let closeButtonBackgroundColor = UIColor(named: "closeButtonBackgroundColor")!
static let closeButtonTintColor = UIColor(named: "closeButtonTintColor")!
Expand Down
79 changes: 33 additions & 46 deletions LocationServices/LocationServices/Constants/AppConstants.swift
Original file line number Diff line number Diff line change
Expand Up @@ -8,62 +8,49 @@
import Foundation

final class DefaultUserSettings {
static let mapStyle = MapStyleModel(title: "Light" ,
imageType: .light,
type: .esri,
isSelected: true)
static let mapHereStyle = MapStyleModel(title: "Explore",
imageType: .explore,
type: .here,
static let mapStyle = MapStyleModel(title: "Standard" ,
imageType: .standard,
isSelected: true)
static let mapStyleColorType = MapStyleColorType.light
static let unitValue = "Metric"
}

final class DefaultMapStyles {

static func getMapStyleUrl() -> URL? {
if let apiKey = AmazonLocationClient.getApiKey(), let regionName = AmazonLocationClient.getApiKeyRegion() {
var colorType = UserDefaultsHelper.getObject(value: MapStyleColorType.self, key: .mapStyleColorType) ?? MapStyleColorType.light
let style = UserDefaultsHelper.getObject(value: MapStyleModel.self, key: .mapStyle) ?? mapStyles.first!
if style.imageType == .hybrid || style.imageType == .satellite {
colorType = .light
}

let politicalView = UserDefaultsHelper.getObject(value: PoliticalViewType.self, key: .politicalView)
let urlString = "https://maps.geo.\(regionName).amazonaws.com/v2/styles/\(style.title)/descriptor?key=\(apiKey)&color-scheme=\(colorType.colorName)\(politicalView != nil ? "&political-view=\(politicalView!.countryCode)" : "")"

return URL(string: urlString)
}
else {
return nil
}
}

static let mapStyles: [MapStyleModel] = [
MapStyleModel(title: "Light" ,
imageType: .light ,
type: .esri,
MapStyleModel(title: "Standard" ,
imageType: .standard ,
isSelected: true),
MapStyleModel(title: "Streets" ,
imageType: .street ,
type: .esri,
isSelected: false),
MapStyleModel(title: "Navigation" ,
imageType: .navigation ,
type: .esri,
isSelected: false),
MapStyleModel(title: "Dark Gray" ,
imageType: .darkGray ,
type: .esri,
isSelected: false),
MapStyleModel(title: "Light Gray" ,
imageType: .lightGray ,
type: .esri,
isSelected: false),
MapStyleModel(title: "Imagery" ,
imageType: .Imagery ,
type: .esri,
isSelected: false),
MapStyleModel(title: "Explore" ,
imageType: .explore ,
type: .here,
isSelected: false),
MapStyleModel(title: "Contrast" ,
imageType: .contrast ,
type: .here,
isSelected: false),
MapStyleModel(title: "ExploreTruck" ,
imageType: .exploreTruck ,
type: .here,
isSelected: false),
MapStyleModel(title: "Imagery" ,
imageType: .hereImagery ,
type: .here,
MapStyleModel(title: "Monochrome" ,
imageType: .monochrome ,
isSelected: false),
MapStyleModel(title: "Hybrid" ,
imageType: .hybrid ,
type: .here,
isSelected: false),
MapStyleModel(title: "Satellite" ,
imageType: .satellite ,
isSelected: false),
]
}

enum AppConstants {
static let amazonHqMapPosition = (latitude: 47.61506909519956, longitude: -122.33826750882835)
}
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,12 @@ struct ViewsIdentifiers {
static let imageAnnotationView = "ImageAnnotationView"
static let bottomGrabberView = "BottomGrabberView"
static let sideBarTableView = "SideBarTableView"
static let mapStyleRow = "MapStyleRow"
static let politicalViewButton = "politicalViewButton"
static let politicalViewTable = "politicalViewTable"
static let politicalViewCell = "politicalViewCell"
static let politicalViewSubtitle = "politicalViewSubtitle"
static let politicalViewCloseButton = "politicalViewCloseButton"
}

struct Explore {
Expand Down Expand Up @@ -59,7 +65,7 @@ struct ViewsIdentifiers {
static let routeTypesContainer = "RouteTypesContainer"

static let carContainer = "CarContainer"
static let walkContainer = "WalkContainer"
static let pedestrianContainer = "pedestrianContainer"
static let truckContainer = "TruckContainer"

static let routeEstimatedTime = "RouteEstimatedTime"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,13 +44,13 @@ extension ExploreCoordinator: ExploreNavigationDelegate {
}
currentBottomSheet?.dismissBottomSheet()
controller.presentBottomSheet(parentController: ExploreCoordinator.exploreController!)
controller.enableBottomSheetGrab()
controller.setBottomSheetHeight(to: controller.getLargeDetentHeight())
currentBottomSheet = controller
}

func showDirections(isRouteOptionEnabled: Bool?,
firstDestionation: MapModel?,
secondDestionation: MapModel?,
firstDestination: MapModel?,
secondDestination: MapModel?,
lat: Double?,
long: Double?
) {
Expand All @@ -63,22 +63,22 @@ extension ExploreCoordinator: ExploreNavigationDelegate {

NotificationCenter.default.post(name: Notification.Name("DirectionViewDismissed"), object: nil, userInfo: nil)
NotificationCenter.default.post(name: Notification.Name("updateMapViewButtons"), object: nil, userInfo: nil)
guard let secondDestionation, firstDestionation == nil else { return }
let userInfo = ["place" : secondDestionation]
guard let secondDestination, firstDestination == nil else { return }
let userInfo = ["place" : secondDestination]
NotificationCenter.default.post(name: Notification.selectedPlace, object: nil, userInfo: userInfo)
}

if let firstDestionation {
controller.firstDestionation = DirectionTextFieldModel(placeName: firstDestionation.placeName ?? "", placeAddress: firstDestionation.placeAddress, lat: firstDestionation.placeLat, long: firstDestionation.placeLong)
if let firstDestination {
controller.firstDestination = DirectionTextFieldModel(placeName: firstDestination.placeName ?? "", placeAddress: firstDestination.placeAddress, lat: firstDestination.placeLat, long: firstDestination.placeLong)
}

// first location as my current location
if controller.firstDestionation == nil, let lat, let long {
controller.firstDestionation = DirectionTextFieldModel(placeName: "My Location", placeAddress: nil, lat: lat, long: long)
if controller.firstDestination == nil, let lat, let long {
controller.firstDestination = DirectionTextFieldModel(placeName: "My Location", placeAddress: nil, lat: lat, long: long)
}

if let secondDestionation {
controller.secondDestionation = DirectionTextFieldModel(placeName: secondDestionation.placeName ?? "", placeAddress: secondDestionation.placeAddress, lat: secondDestionation.placeLat, long: secondDestionation.placeLong)
if let secondDestination {
controller.secondDestination = DirectionTextFieldModel(placeName: secondDestination.placeName ?? "", placeAddress: secondDestination.placeAddress, lat: secondDestination.placeLat, long: secondDestination.placeLong)
}

controller.userLocation = (lat, long)
Expand Down Expand Up @@ -127,8 +127,8 @@ extension ExploreCoordinator: ExploreNavigationDelegate {

}

func showNavigationview(steps: [NavigationSteps], summaryData: (totalDistance: Double, totalDuration: Double), firstDestionation: MapModel?, secondDestionation: MapModel?) {
let controller = NavigationBuilder.create(steps: steps, summaryData: summaryData, firstDestionation: firstDestionation, secondDestionation: secondDestionation)
func showNavigationview(routeLegDetails: [RouteLegDetails], summaryData: (totalDistance: Double, totalDuration: Double), firstDestination: MapModel?, secondDestination: MapModel?) {
let controller = NavigationBuilder.create(routeLegDetails: routeLegDetails, summaryData: summaryData, firstDestination: firstDestination, secondDestination: secondDestination)
controller.delegate = self

currentBottomSheet?.dismissBottomSheet()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ extension GeofenceCoordinator: GeofenceNavigationDelegate {
self.userLocation = (lat: lat, long: long)
}
let controller = GeofenceDashboardBuilder.create(lat: lat ?? self.userLocation.lat, long: long ?? self.userLocation.long, geofences: geofences)

controller.delegate = self
controller.addGeofence = { [weak self] parameters in
self?.showAddGeofenceFlow(activeGeofencesLists: parameters.activeGeofences,
isEditingSceneEnabled: parameters.isEditingSceneEnabled,
Expand Down Expand Up @@ -116,7 +116,7 @@ extension GeofenceCoordinator: GeofenceNavigationDelegate {

currentBottomSheet?.dismissBottomSheet()
controller.presentBottomSheet(parentController: geofenceController!)
controller.enableBottomSheetGrab()
controller.setBottomSheetHeight(to: controller.getLargeDetentHeight())
currentBottomSheet = controller
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,9 @@ extension SettingsCoordinator: SettingsNavigationDelegate {

private func showAwsCloudFormationscene() {
let controller = LoginVCBuilder.create(from: true)
controller.dismissHandler = { [weak self] in
self?.navigationController.popViewController(animated: true)
}
controller.isFromSettingScene = true
navigationController.pushViewController(controller, animated: true)
}
Expand Down
Loading

0 comments on commit ba22ed4

Please sign in to comment.