Skip to content

Commit

Permalink
Merge branch 'feature/update-0.8.0'
Browse files Browse the repository at this point in the history
  • Loading branch information
Sergey Lagner committed Mar 21, 2021
2 parents 22c8261 + 84fa856 commit daa368d
Show file tree
Hide file tree
Showing 29 changed files with 479 additions and 68 deletions.
46 changes: 43 additions & 3 deletions app.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,12 @@
4BBE80292526E22F00D7EBDB /* SearchResultViewModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4BBE80282526E22F00D7EBDB /* SearchResultViewModel.swift */; };
4BBE802D2526F8A600D7EBDB /* RootViewFactory.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4BBE802C2526F8A600D7EBDB /* RootViewFactory.swift */; };
4BBE80302526FB0D00D7EBDB /* Container.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4BBE802F2526FB0D00D7EBDB /* Container.swift */; };
B709913925F9CBCF00B2F1A5 /* MapObjectCardView.swift in Sources */ = {isa = PBXBuildFile; fileRef = B709913825F9CBCF00B2F1A5 /* MapObjectCardView.swift */; };
B709914C25FA11CD00B2F1A5 /* MapObjectCardViewModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = B709914B25FA11CD00B2F1A5 /* MapObjectCardViewModel.swift */; };
B709914F25FA6B6F00B2F1A5 /* RenderedObjectInfo+Helpers.swift in Sources */ = {isa = PBXBuildFile; fileRef = B709914E25FA6B6F00B2F1A5 /* RenderedObjectInfo+Helpers.swift */; };
B709915125FA6B9D00B2F1A5 /* GeoPoint+Helpers.swift in Sources */ = {isa = PBXBuildFile; fileRef = B709915025FA6B9D00B2F1A5 /* GeoPoint+Helpers.swift */; };
B709915325FA6BD300B2F1A5 /* TrafficRoute+Helpers.swift in Sources */ = {isa = PBXBuildFile; fileRef = B709915225FA6BD300B2F1A5 /* TrafficRoute+Helpers.swift */; };
B709915525FA72A600B2F1A5 /* Future+Helpers.swift in Sources */ = {isa = PBXBuildFile; fileRef = B709915425FA72A600B2F1A5 /* Future+Helpers.swift */; };
/* End PBXBuildFile section */

/* Begin PBXCopyFilesBuildPhase section */
Expand Down Expand Up @@ -107,6 +113,12 @@
4BBE80282526E22F00D7EBDB /* SearchResultViewModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SearchResultViewModel.swift; sourceTree = "<group>"; };
4BBE802C2526F8A600D7EBDB /* RootViewFactory.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = RootViewFactory.swift; sourceTree = "<group>"; };
4BBE802F2526FB0D00D7EBDB /* Container.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Container.swift; sourceTree = "<group>"; };
B709913825F9CBCF00B2F1A5 /* MapObjectCardView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MapObjectCardView.swift; sourceTree = "<group>"; };
B709914B25FA11CD00B2F1A5 /* MapObjectCardViewModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MapObjectCardViewModel.swift; sourceTree = "<group>"; };
B709914E25FA6B6F00B2F1A5 /* RenderedObjectInfo+Helpers.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "RenderedObjectInfo+Helpers.swift"; sourceTree = "<group>"; };
B709915025FA6B9D00B2F1A5 /* GeoPoint+Helpers.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "GeoPoint+Helpers.swift"; sourceTree = "<group>"; };
B709915225FA6BD300B2F1A5 /* TrafficRoute+Helpers.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "TrafficRoute+Helpers.swift"; sourceTree = "<group>"; };
B709915425FA72A600B2F1A5 /* Future+Helpers.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "Future+Helpers.swift"; sourceTree = "<group>"; };
/* End PBXFileReference section */

/* Begin PBXFrameworksBuildPhase section */
Expand Down Expand Up @@ -172,12 +184,12 @@
4B27063424A3F24C00F12B48 /* AppDelegate.swift */,
4B1354DB24BCCDC7004E8158 /* NativeApp.entitlements */,
4B27063624A3F24C00F12B48 /* SceneDelegate.swift */,
095BE97725B80EC800D09D75 /* View+Helpers.swift */,
0991909725B977CD00F4235B /* Channel+Helpers.swift */,
B709914D25FA6B1000B2F1A5 /* Extensions */,
4BBE822A252741EE00D7EBDB /* Root */,
4BBE822B2527420900D7EBDB /* Search */,
4BBE822C2527422000D7EBDB /* Map */,
4BBE802F2526FB0D00D7EBDB /* Container.swift */,
B709914A25FA0FD700B2F1A5 /* MapObjectCardView */,
09C834F925BFCD4800D347F4 /* Route */,
095BE97225B6FF3700D09D75 /* Marker */,
0938CA9F25B5BB8A00100316 /* LocationService */,
Expand Down Expand Up @@ -242,6 +254,28 @@
name = Frameworks;
sourceTree = "<group>";
};
B709914A25FA0FD700B2F1A5 /* MapObjectCardView */ = {
isa = PBXGroup;
children = (
B709913825F9CBCF00B2F1A5 /* MapObjectCardView.swift */,
B709914B25FA11CD00B2F1A5 /* MapObjectCardViewModel.swift */,
);
path = MapObjectCardView;
sourceTree = "<group>";
};
B709914D25FA6B1000B2F1A5 /* Extensions */ = {
isa = PBXGroup;
children = (
095BE97725B80EC800D09D75 /* View+Helpers.swift */,
0991909725B977CD00F4235B /* Channel+Helpers.swift */,
B709914E25FA6B6F00B2F1A5 /* RenderedObjectInfo+Helpers.swift */,
B709915025FA6B9D00B2F1A5 /* GeoPoint+Helpers.swift */,
B709915225FA6BD300B2F1A5 /* TrafficRoute+Helpers.swift */,
B709915425FA72A600B2F1A5 /* Future+Helpers.swift */,
);
path = Extensions;
sourceTree = "<group>";
};
/* End PBXGroup section */

/* Begin PBXNativeTarget section */
Expand Down Expand Up @@ -325,11 +359,15 @@
4BADDFCC2528016600FBF589 /* SuggestResultView.swift in Sources */,
0991909825B977CD00F4235B /* Channel+Helpers.swift in Sources */,
4BADDFEB2529AD9C00FBF589 /* SearchNavigation.swift in Sources */,
B709913925F9CBCF00B2F1A5 /* MapObjectCardView.swift in Sources */,
4B4291682527A4DB006E74BE /* SuggestViewModel.swift in Sources */,
4BBE80292526E22F00D7EBDB /* SearchResultViewModel.swift in Sources */,
0938CAA125B5BBA300100316 /* LocationService.swift in Sources */,
4BADDFD525282A2400FBF589 /* MarkedUpTextView.swift in Sources */,
095BE97625B7042500D09D75 /* MarkerViewModel.swift in Sources */,
B709915525FA72A600B2F1A5 /* Future+Helpers.swift in Sources */,
B709914C25FA11CD00B2F1A5 /* MapObjectCardViewModel.swift in Sources */,
B709915125FA6B9D00B2F1A5 /* GeoPoint+Helpers.swift in Sources */,
4BADDFCF252801BD00FBF589 /* SuggestResultViewModel.swift in Sources */,
4B27063524A3F24C00F12B48 /* AppDelegate.swift in Sources */,
4BADDFE12528941E00FBF589 /* DirectoryObjectViewModel.swift in Sources */,
Expand All @@ -342,6 +380,7 @@
09C834FD25BFCD8500D347F4 /* RouteViewModel.swift in Sources */,
4BBE802D2526F8A600D7EBDB /* RootViewFactory.swift in Sources */,
4BBE80222526DCA200D7EBDB /* SearchResultItemView.swift in Sources */,
B709915325FA6BD300B2F1A5 /* TrafficRoute+Helpers.swift in Sources */,
4BADDFFC252AD63800FBF589 /* SearchAction.swift in Sources */,
4BADDFE42528947F00FBF589 /* FormattedAddressView.swift in Sources */,
4BADDFDE25288F9D00FBF589 /* DirectoryObjectView.swift in Sources */,
Expand All @@ -352,6 +391,7 @@
0991909625B96E1C00F4235B /* MapControl.swift in Sources */,
4B4291652527A49C006E74BE /* SuggestView.swift in Sources */,
095BE97825B80EC800D09D75 /* View+Helpers.swift in Sources */,
B709914F25FA6B6F00B2F1A5 /* RenderedObjectInfo+Helpers.swift in Sources */,
4BBE80302526FB0D00D7EBDB /* Container.swift in Sources */,
4BADDFDB252866F700FBF589 /* SearchService.swift in Sources */,
4B27063724A3F24C00F12B48 /* SceneDelegate.swift in Sources */,
Expand Down Expand Up @@ -562,7 +602,7 @@
repositoryURL = "https://github.com/2gis/native-sdk-ios-swift-package.git";
requirement = {
kind = exactVersion;
version = 0.7.0;
version = 0.8.0;
};
};
/* End XCRemoteSwiftPackageReference section */
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@
"repositoryURL": "https://github.com/2gis/native-sdk-ios-swift-package.git",
"state": {
"branch": null,
"revision": "cc36422ceba49f519f23cde743124d35213a6b79",
"version": "0.7.0"
"revision": "6f770e55a6d65abfadb6fdfbbc364a6c26af3066",
"version": "0.8.0"
}
}
]
Expand Down
4 changes: 2 additions & 2 deletions app.xcodeproj/xcshareddata/xcschemes/app.xcscheme
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,8 @@
</TestAction>
<LaunchAction
buildConfiguration = "Release"
selectedDebuggerIdentifier = ""
selectedLauncherIdentifier = "Xcode.IDEFoundation.Launcher.PosixSpawn"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
launchStyle = "0"
useCustomWorkingDirectory = "NO"
ignoresPersistentStateOnLaunch = "NO"
Expand Down
6 changes: 6 additions & 0 deletions app/Assets.xcassets/Colors/Contents.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"info" : {
"author" : "xcode",
"version" : 1
}
}
20 changes: 20 additions & 0 deletions app/Assets.xcassets/Colors/dgs_green.colorset/Contents.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
{
"colors" : [
{
"color" : {
"color-space" : "srgb",
"components" : {
"alpha" : "1.000",
"blue" : "41",
"green" : "153",
"red" : "63"
}
},
"idiom" : "universal"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}
12 changes: 12 additions & 0 deletions app/Assets.xcassets/splash_logo.imageset/Contents.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{
"images" : [
{
"filename" : "splash_logo.pdf",
"idiom" : "universal"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}
Binary file not shown.
28 changes: 23 additions & 5 deletions app/Base.lproj/LaunchScreen.storyboard
Original file line number Diff line number Diff line change
@@ -1,8 +1,11 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="13122.16" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" launchScreen="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES" initialViewController="01J-lp-oVM">
<?xml version="1.0" encoding="UTF-8"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="17701" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" launchScreen="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES" initialViewController="01J-lp-oVM">
<device id="retina6_1" orientation="portrait" appearance="light"/>
<dependencies>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="13104.12"/>
<deployment identifier="iOS"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="17703"/>
<capability name="Safe area layout guides" minToolsVersion="9.0"/>
<capability name="System colors in document resources" minToolsVersion="11.0"/>
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
</dependencies>
<scenes>
Expand All @@ -11,15 +14,30 @@
<objects>
<viewController id="01J-lp-oVM" sceneMemberID="viewController">
<view key="view" contentMode="scaleToFill" id="Ze5-6b-2t3">
<rect key="frame" x="0.0" y="0.0" width="375" height="667"/>
<rect key="frame" x="0.0" y="0.0" width="414" height="896"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<color key="backgroundColor" xcode11CocoaTouchSystemColor="systemBackgroundColor" cocoaTouchSystemColor="whiteColor"/>
<subviews>
<imageView clipsSubviews="YES" userInteractionEnabled="NO" contentMode="scaleAspectFit" horizontalHuggingPriority="251" verticalHuggingPriority="251" image="splash_logo" translatesAutoresizingMaskIntoConstraints="NO" id="Cl7-U5-tK3">
<rect key="frame" x="129" y="429" width="156" height="48"/>
</imageView>
</subviews>
<viewLayoutGuide key="safeArea" id="6Tk-OE-BBY"/>
<color key="backgroundColor" systemColor="systemBackgroundColor"/>
<constraints>
<constraint firstItem="Cl7-U5-tK3" firstAttribute="centerY" secondItem="6Tk-OE-BBY" secondAttribute="centerY" id="ewG-YS-7Yb"/>
<constraint firstItem="Cl7-U5-tK3" firstAttribute="centerX" secondItem="6Tk-OE-BBY" secondAttribute="centerX" id="sXw-EB-PQt"/>
</constraints>
</view>
</viewController>
<placeholder placeholderIdentifier="IBFirstResponder" id="iYj-Kq-Ea1" userLabel="First Responder" sceneMemberID="firstResponder"/>
</objects>
<point key="canvasLocation" x="53" y="375"/>
</scene>
</scenes>
<resources>
<image name="splash_logo" width="156" height="48"/>
<systemColor name="systemBackgroundColor">
<color white="1" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
</systemColor>
</resources>
</document>
23 changes: 15 additions & 8 deletions app/Container.swift
Original file line number Diff line number Diff line change
Expand Up @@ -52,14 +52,21 @@ final class Container {
}

private func makeRootViewModel() -> RootViewModel {
let rootViewModel = RootViewModel(searchManagerFactory: { [sdk = self.sdk] in
return sdk.searchManagerFactory.makeOnlineManager()!
}, sourceFactory: { [sdk = self.sdk] in
return sdk.sourceFactory
}, locationManagerFactory: { [weak self] in
guard let self = self else { return nil }
return self.locationManager
}, map: self.sdk.map)
let rootViewModel = RootViewModel(
searchManagerFactory: { [sdk = self.sdk] in
sdk.searchManagerFactory.makeOnlineManager()!
},
sourceFactory: { [sdk = self.sdk] in
sdk.sourceFactory
},
imageFactory: { [sdk = self.sdk] in
sdk.imageFactory
},
locationManagerFactory: { [weak self] in
self?.locationManager
},
map: self.sdk.map
)
return rootViewModel
}
}
File renamed without changes.
20 changes: 20 additions & 0 deletions app/Extensions/Future+Helpers.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
import SwiftUI
import PlatformSDK

extension Future {

@inlinable public func sinkOnMainThread(
receiveValue: @escaping (Value) -> Void,
failure: @escaping (Error) -> Void
) -> PlatformSDK.Cancellable {
self.sink { value in
DispatchQueue.main.async {
receiveValue(value)
}
} failure: { error in
DispatchQueue.main.async {
failure(error)
}
}
}
}
15 changes: 15 additions & 0 deletions app/Extensions/GeoPoint+Helpers.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
import PlatformSDK

extension GeoPoint: CustomStringConvertible {

public var description: String {
"Latitude: \(self.latitude.value)\nLongitude: \(self.longitude.value)"
}
}

extension GeoPointWithElevation: CustomStringConvertible {

public var description: String {
"Latitude: \(self.latitude.value)\nLongitude: \(self.longitude.value)\nElevation: \(self.elevation.value)"
}
}
28 changes: 28 additions & 0 deletions app/Extensions/RenderedObjectInfo+Helpers.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
import PlatformSDK

extension RenderedObjectInfo: CustomStringConvertible {

public var description: String {
let pointDescription = self.closestMapPoint.description
switch self.item.item {
case let dgisMapObject as DgisMapObject:
return "Id: \(dgisMapObject.id.value)"
case let searchResult as SearchResultMarkerObject:
if let id = searchResult.id {
return "Id: \(id.value)"
} else {
return searchResult.markerPosition.description
}
case let cluster as ClusterObject:
return "Objects count: \(cluster.objectCount)"
case let route as RouteMapObject:
return route.route?.description ?? pointDescription
case let routePoint as RoutePointMapObject:
return routePoint.route?.description ?? pointDescription
case is MyLocationMapObject, is GeometryMapObject:
return pointDescription
default:
return pointDescription
}
}
}
8 changes: 8 additions & 0 deletions app/Extensions/TrafficRoute+Helpers.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
import PlatformSDK

extension TrafficRoute: CustomStringConvertible {

public var description: String {
"Distance: \(self.length.millimeters * 1000)m"
}
}
File renamed without changes.
46 changes: 46 additions & 0 deletions app/MapObjectCardView/MapObjectCardView.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
import SwiftUI

struct MapObjectCardView: View {

@ObservedObject private var viewModel: MapObjectCardViewModel

init(viewModel: MapObjectCardViewModel) {
self.viewModel = viewModel
}

var body: some View {
ZStack {
HStack(alignment: .top){
VStack(alignment: .leading) {
Text(self.viewModel.title)
.font(Font.system(size: 24, weight: .regular))
.foregroundColor(.black)
.padding([.top, .leading], 16)
Text(self.viewModel.description)
.font(Font.system(size: 12, weight: .regular))
.foregroundColor(.black)
.padding(.top, 2)
.padding([.bottom, .leading], 16)
}
Spacer()
VStack(alignment: .trailing) {
Button(action: {
self.viewModel.close()
}) {
Image(systemName: "xmark.circle.fill")
.resizable()
.frame(width: 20, height: 20)
}
.padding([.top, .trailing], 16)
}
.padding(.leading, 16)
}
}
.background(
RoundedRectangle(cornerRadius: 20, style: .circular)
.fill(Color.white)
.shadow(color: Color.black.opacity(0.2), radius: 3)
)
.padding([.leading, .bottom, .trailing], 16)
}
}
Loading

0 comments on commit daa368d

Please sign in to comment.