Skip to content

Commit

Permalink
Merge pull request #71 from makeen-project/ALS-1805_Remove_Amplify
Browse files Browse the repository at this point in the history
ALS-1805 fixed PR feedback
  • Loading branch information
wadhawh authored Oct 14, 2024
2 parents e7b5939 + dc19bb7 commit a8e3bec
Show file tree
Hide file tree
Showing 29 changed files with 78 additions and 288 deletions.
6 changes: 1 addition & 5 deletions LocationServices/LocationServices.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,6 @@
8AFBAFE0296F19BC0022A7E3 /* AWSLocationTravelMode+Extension.swift in Sources */ = {isa = PBXBuildFile; fileRef = 8AFBAFDF296F19BC0022A7E3 /* AWSLocationTravelMode+Extension.swift */; };
8AFDA09429DDBB3600114BB7 /* VersionVC.swift in Sources */ = {isa = PBXBuildFile; fileRef = 8AFDA09329DDBB3600114BB7 /* VersionVC.swift */; };
8AFDA09629DDBC3800114BB7 /* VersionVCBuilder.swift in Sources */ = {isa = PBXBuildFile; fileRef = 8AFDA09529DDBC3800114BB7 /* VersionVCBuilder.swift */; };
960968A529A2C83D0026C05A /* AWSEndpoint+Extension.swift in Sources */ = {isa = PBXBuildFile; fileRef = 960968A429A2C83D0026C05A /* AWSEndpoint+Extension.swift */; };
963EBF5229AF92F7001961F2 /* LocationServicesTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 963EBF5129AF92F7001961F2 /* LocationServicesTests.swift */; };
9660600129A4F20100FB88D0 /* StringConstants.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9660600029A4F20100FB88D0 /* StringConstants.swift */; };
96E742AA2967381900D5C0BC /* Sequence+Extension.swift in Sources */ = {isa = PBXBuildFile; fileRef = 96E742A92967381800D5C0BC /* Sequence+Extension.swift */; };
Expand Down Expand Up @@ -536,7 +535,6 @@
8AFBAFDF296F19BC0022A7E3 /* AWSLocationTravelMode+Extension.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "AWSLocationTravelMode+Extension.swift"; sourceTree = "<group>"; };
8AFDA09329DDBB3600114BB7 /* VersionVC.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = VersionVC.swift; sourceTree = "<group>"; };
8AFDA09529DDBC3800114BB7 /* VersionVCBuilder.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = VersionVCBuilder.swift; sourceTree = "<group>"; };
960968A429A2C83D0026C05A /* AWSEndpoint+Extension.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "AWSEndpoint+Extension.swift"; sourceTree = "<group>"; };
963EBF4F29AF92F5001961F2 /* LocationServicesTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = LocationServicesTests.xctest; sourceTree = BUILT_PRODUCTS_DIR; };
963EBF5129AF92F7001961F2 /* LocationServicesTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = LocationServicesTests.swift; sourceTree = "<group>"; };
9660600029A4F20100FB88D0 /* StringConstants.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = StringConstants.swift; sourceTree = "<group>"; };
Expand Down Expand Up @@ -2895,7 +2893,6 @@
8A3471CB2975D30B00BAF374 /* Locale+Extension.swift */,
8A76327B297EAE270064D60F /* MGLMapViewDelegate+Extension.swift */,
ADB0B187299221A800282814 /* Date+Extension.swift */,
960968A429A2C83D0026C05A /* AWSEndpoint+Extension.swift */,
8A439F0729C0BA1B00B59D0B /* UIApplication+Extension.swift */,
8A6B834929DAD4960047AA17 /* UITapGestureRecognizer+Extensions.swift */,
8ACAAD7529F14B9D00523256 /* CLLocationManager+Extension.swift */,
Expand Down Expand Up @@ -3344,7 +3341,6 @@
ADD139902980A2590003F917 /* RouteOptionContracts.swift in Sources */,
AD625E9C293BEFAC00C67B44 /* SearchCell.swift in Sources */,
ADA85E752989A22300446788 /* SettingsDefaultValueHelper.swift in Sources */,
960968A529A2C83D0026C05A /* AWSEndpoint+Extension.swift in Sources */,
AD2AF099292EA8D600149904 /* GeofenceView.swift in Sources */,
AD2AF09B292EA8E000149904 /* GeofenceContracts.swift in Sources */,
ADC1249E2979BB8300B08C20 /* Notificaton+Extension.swift in Sources */,
Expand Down Expand Up @@ -4061,7 +4057,7 @@
repositoryURL = "https://github.com/awslabs/aws-sdk-swift";
requirement = {
kind = upToNextMajorVersion;
minimumVersion = 0.47.0;
minimumVersion = 1.0.18;
};
};
/* End XCRemoteSwiftPackageReference section */
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,16 +7,16 @@
"location" : "https://github.com/awslabs/aws-crt-swift",
"state" : {
"branch" : "mqtt_test_app",
"revision" : "c0e4aa6bddb7b54c6d07545fe55655f29ce1bc0d"
"revision" : "e7e603d3aadd1749b3e5cc554832ab337fdfd8f3"
}
},
{
"identity" : "aws-sdk-swift",
"kind" : "remoteSourceControl",
"location" : "https://github.com/awslabs/aws-sdk-swift",
"state" : {
"revision" : "6b4d5f7447dd8a76c6935fa3484491cd3203c888",
"version" : "0.62.0"
"revision" : "8ec5c0c820ca912a6bad1fc31c287d321385d698",
"version" : "1.0.18"
}
},
{
Expand All @@ -33,26 +33,26 @@
"kind" : "remoteSourceControl",
"location" : "https://github.com/maplibre/maplibre-gl-native-distribution",
"state" : {
"revision" : "039ef525064a685c291db5118f6b5f6e8b090bb0",
"version" : "6.5.2"
"revision" : "f23db791d7b6f0329e3c6788d8e4152c24c52b6b",
"version" : "6.7.1"
}
},
{
"identity" : "smithy-swift",
"kind" : "remoteSourceControl",
"location" : "https://github.com/smithy-lang/smithy-swift",
"state" : {
"revision" : "e7e71e9c128b6dfeb0349537d6fd4a7cbc358ae1",
"version" : "0.59.0"
"revision" : "bf096bf5c507e2c3f9ecc23c0c65dba2e1ffe3b2",
"version" : "0.79.0"
}
},
{
"identity" : "snapkit",
"kind" : "remoteSourceControl",
"location" : "https://github.com/SnapKit/SnapKit.git",
"state" : {
"revision" : "f222cbdf325885926566172f6f5f06af95473158",
"version" : "5.6.0"
"revision" : "2842e6e84e82eb9a8dac0100ca90d9444b0307f4",
"version" : "5.7.1"
}
},
{
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -29,21 +29,19 @@ extension Double {
}

func convertFormattedKMString() -> String {
let distanceInMeters = Int(convertKMToM())
return distanceInMeters.convertToKm()
let distanceInMeters = convertKMToMeters()
return distanceInMeters.fromatToKmString()
}

func convertKMToM() -> Double {
func convertKMToMeters() -> Double {
return self * 1000
}

func convertToKm() -> String {
let num: Double = Double(self)
if num > 1000 {
let result = Double(num * 1000 / 1000 / 1000)
return String(format: "%.2f", result) + " km"
func fromatToKmString() -> String {
if self >= 1000 {
return String(format: "%.2f km", self / 1000)
} else {
return "\(String(format: "%.0f", num)) m"
return String(format: "%.0f m", self)
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
import UIKit

extension Int {
func convertToKm() -> String {
func fromatToKmString() -> String {
let num: Double = Double(self)
if num > 1000 {
let result = Double(round(num * 1000 / 1000) / 1000)
Expand All @@ -20,7 +20,7 @@ extension Int {
}

extension Int64 {
func convertToKm() -> String {
func fromatToKmString() -> String {
let num: Double = Double(self)
if num > 1000 {
let result = Double(round(num * 1000 / 1000) / 1000)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ struct LocationService: AWSLocationSearchService, LocationServiceable {

func searchTextWithSuggestion(text: String, userLat: Double?, userLong: Double?) async -> Result<[SearchPresentation], Error> {
do {
let result = try await searchTextWithSuggesstionRequest(text: text, userLat: userLat, userLong: userLong)
let result = try await searchTextWithSuggestionRequest(text: text, userLat: userLat, userLong: userLong)
let model = try await result!.results!.asyncMap({ model in
guard let placeId = model.placeId else { return SearchPresentation(model: model) }

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import Foundation

protocol DirectionViewModelProtocol: AnyObject {
var delegate: DirectionViewModelOutputDelegate? { get set }
func searchWithSuggesstion(text: String, userLat: Double?, userLong: Double?) async
func searchWithSuggestion(text: String, userLat: Double?, userLong: Double?) async
func searchWith(text: String, userLat: Double?, userLong: Double?) async throws
func numberOfRowsInSection() -> Int
func getSearchCellModel() -> [SearchCellViewModel]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,7 @@ final class DirectionVC: UIViewController {
self?.directionView.isHidden = true
self?.tableView.isHidden = false
Task {
await self?.viewModel.searchWithSuggesstion(text: model.searchText,
await self?.viewModel.searchWithSuggestion(text: model.searchText,
userLat: self?.userLocation?.lat,
userLong: self?.userLocation?.long)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ final class DirectionViewModel: DirectionViewModelProtocol {
delegate?.reloadView()
}

func searchWithSuggesstion(text: String, userLat: Double?, userLong: Double?) async {
func searchWithSuggestion(text: String, userLat: Double?, userLong: Double?) async {

guard !text.isEmpty && text != "My Location" else {
presentation = []
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ final class POICardViewModel: POICardViewModelProcotol {
case .success(let direction):
guard !(self.datas.isEmpty) else { break }

self.datas[0].distance = direction.distance.convertKMToM()
self.datas[0].distance = direction.distance.convertKMToMeters()
self.datas[0].duration = direction.duration.convertSecondsToMinString()
case .failure(let error):
responseError = error
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ protocol SearchVCOutputDelegate: AnyObject {

protocol SearchViewModelProcotol: AnyObject {
var delegate: SearchViewModelOutputDelegate? { get set }
func searchWithSuggesstion(text: String, userLat: Double?, userLong: Double?) async throws
func searchWithSuggestion(text: String, userLat: Double?, userLong: Double?) async throws
func searchWith(text: String, userLat: Double?, userLong: Double?) async throws
func numberOfRowsInSection() -> Int
func getSearchCellModel() -> [SearchCellViewModel]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,7 @@ extension SearchVC: SearchViewModelOutputDelegate {
extension SearchVC: SearchBarViewOutputDelegate {
func searchText(_ text: String?) {
Task {
try await viewModel.searchWithSuggesstion(text: text ?? "", userLat: userLocation?.lat, userLong: userLocation?.long)
try await viewModel.searchWithSuggestion(text: text ?? "", userLat: userLocation?.lat, userLong: userLocation?.long)
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ final class SearchViewModel: SearchViewModelProcotol {
self.service = service
}

func searchWithSuggesstion(text: String, userLat: Double?, userLong: Double?) async throws {
func searchWithSuggestion(text: String, userLat: Double?, userLong: Double?) async throws {
guard !text.isEmpty else {
self.presentation = []
self.delegate?.searchResult(mapModel: [], shouldDismiss: false, showOnMap: false)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ final class SearchCell: UITableViewCell {
if model.searchType == .location {
self.locationDistance.isHidden = false
self.locationAddress.isHidden = false
self.locationDistance.text = model.locationDistance?.convertToKm()
self.locationDistance.text = model.locationDistance?.fromatToKmString()
locationAddress.snp.remakeConstraints {
$0.top.equalTo(locationTitle.snp.bottom).offset(5)
$0.leading.equalTo(locationTitle.snp.leading)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ protocol AddGeofenceViewModelProcotol: AnyObject {
func saveData(with id: String, lat: Double, long: Double, radius: Double) async throws -> Result<GeofenceDataModel, Error>
func deleteData(with model: GeofenceDataModel)
func searchWith(text: String, userLat: Double?, userLong: Double?) async throws
func searchWithSuggesstion(text: String, userLat: Double?, userLong: Double?) async throws
func searchWithSuggestion(text: String, userLat: Double?, userLong: Double?) async throws
func searchSelectedPlaceWith(_ indexPath: IndexPath, lat: Double?, long: Double?) async throws -> Bool
func numberOfRowsInSection() -> Int
func getSearchCellModel() -> [SearchCellViewModel]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -186,15 +186,15 @@ final class AddGeofenceVC: UIViewController {
searchView.searchTextValue = { [weak self] value in
self?.changeElementVisibility(state: true)
Task {
try await self?.viewModel.searchWithSuggesstion(text: value,
try await self?.viewModel.searchWithSuggestion(text: value,
userLat: self?.userLocation?.lat,
userLong: self?.userLocation?.long)
}
}

searchView.searchTextClose = {[weak self] in
Task {
try await self?.viewModel.searchWithSuggesstion(text: "",
try await self?.viewModel.searchWithSuggestion(text: "",
userLat: nil,
userLong: nil)
self?.changeElementVisibility(state: false)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ final class AddGeofenceViewModel: AddGeofenceViewModelProcotol {
}


func searchWithSuggesstion(text: String, userLat: Double?, userLong: Double?) async throws {
func searchWithSuggestion(text: String, userLat: Double?, userLong: Double?) async throws {
guard !text.isEmpty else {
self.delegate?.searchResult(mapModel: [])
return
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ final class AddGeofenceSearchView: UIView {
@objc private func geofenceRadiusDragged(_ notification: Notification){
let radius = notification.userInfo?["radius"] as! Double
radiusSlider.value = Float(radius)
radiusSliderValue.text = Int(radius).convertToKm()
radiusSliderValue.text = Int(radius).fromatToKmString()
radiusValueHander?(radius)
}

Expand Down Expand Up @@ -119,8 +119,8 @@ final class AddGeofenceSearchView: UIView {

if let radius = model.radius {
self?.radiusSlider.value = Float(radius)
self?.radiusSliderValue.text = radius.convertToKm()
}
self?.radiusSliderValue.text = radius.fromatToKmString()
}
}
}

Expand Down Expand Up @@ -183,7 +183,7 @@ final class AddGeofenceSearchView: UIView {
extension AddGeofenceSearchView {
@objc func radiusSliderValuChanged(sender: UISlider) {
let value = Double(radiusSlider.value)
self.radiusSliderValue.text = value.convertToKm()
self.radiusSliderValue.text = value.fromatToKmString()
radiusValueHander?(value)
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ enum LocationServiceConstant {

protocol AWSLocationSearchService {
func searchTextRequest(text: String, userLat: Double?, userLong: Double?) async throws -> SearchPlaceIndexForTextOutput?
func searchTextWithSuggesstionRequest(text: String,
func searchTextWithSuggestionRequest(text: String,
userLat: Double?,
userLong: Double?) async throws -> SearchPlaceIndexForSuggestionsOutput?
func getPlaceRequest(with placeId: String) async throws -> GetPlaceOutput?
Expand All @@ -41,7 +41,7 @@ extension AWSLocationSearchService {
}
}

func searchTextWithSuggesstionRequest(text: String,
func searchTextWithSuggestionRequest(text: String,
userLat: Double?,
userLong: Double?) async throws -> SearchPlaceIndexForSuggestionsOutput? {
var biasPosition: [Double]? = nil
Expand Down
Loading

0 comments on commit a8e3bec

Please sign in to comment.