Toggle navigation
Toggle navigation
This project
Loading...
Sign in
open-source
/
warply_sdk_framework
Go to a project
Toggle navigation
Toggle navigation pinning
Projects
Groups
Snippets
Help
Project
Activity
Repository
Graphs
Network
Create a new issue
Commits
Issue Boards
Authored by
Dimitris Togias
2022-09-14 06:53:31 +0300
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
7133d30b9572519db23b6e49733bb065933a1dfd
7133d30b
1 parent
152ef55c
add initial map view controller
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
184 additions
and
0 deletions
SwiftWarplyFramework/SwiftWarplyFramework.xcodeproj/project.pbxproj
SwiftWarplyFramework/SwiftWarplyFramework/MapsViewController.swift
SwiftWarplyFramework/SwiftWarplyFramework/MapsViewController.xib
SwiftWarplyFramework/SwiftWarplyFramework.xcodeproj/project.pbxproj
View file @
7133d30
...
...
@@ -33,6 +33,8 @@
A07936762885E9CC00064122 /* UIColorExtensions.swift in Sources */ = {isa = PBXBuildFile; fileRef = A07936752885E9CC00064122 /* UIColorExtensions.swift */; };
A079367C2885F2F500064122 /* AnalysisHeaderViewCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = A079367B2885F2F500064122 /* AnalysisHeaderViewCell.swift */; };
A079367E2885F60A00064122 /* AnalysisHeaderMessageViewCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = A079367D2885F60A00064122 /* AnalysisHeaderMessageViewCell.swift */; };
A080CFD628D170A20045A315 /* MapsViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = A080CFD428D170A20045A315 /* MapsViewController.swift */; };
A080CFD728D170A20045A315 /* MapsViewController.xib in Resources */ = {isa = PBXBuildFile; fileRef = A080CFD528D170A20045A315 /* MapsViewController.xib */; };
A09DBCAE2888BA8100DD50B0 /* SharingHistoryViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = A09DBCAD2888BA8100DD50B0 /* SharingHistoryViewController.swift */; };
E6A77853282933340045BBA8 /* SwiftWarplyFramework.docc in Sources */ = {isa = PBXBuildFile; fileRef = E6A77852282933340045BBA8 /* SwiftWarplyFramework.docc */; };
E6A77854282933340045BBA8 /* SwiftWarplyFramework.h in Headers */ = {isa = PBXBuildFile; fileRef = E6A77851282933340045BBA8 /* SwiftWarplyFramework.h */; settings = {ATTRIBUTES = (Public, ); }; };
...
...
@@ -187,6 +189,8 @@
A07936752885E9CC00064122 /* UIColorExtensions.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = UIColorExtensions.swift; sourceTree = "<group>"; };
A079367B2885F2F500064122 /* AnalysisHeaderViewCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AnalysisHeaderViewCell.swift; sourceTree = "<group>"; };
A079367D2885F60A00064122 /* AnalysisHeaderMessageViewCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AnalysisHeaderMessageViewCell.swift; sourceTree = "<group>"; };
A080CFD428D170A20045A315 /* MapsViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MapsViewController.swift; sourceTree = "<group>"; };
A080CFD528D170A20045A315 /* MapsViewController.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; path = MapsViewController.xib; sourceTree = "<group>"; };
A09DBCAD2888BA8100DD50B0 /* SharingHistoryViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = SharingHistoryViewController.swift; sourceTree = "<group>"; };
A9B7BE01A4E812DE49866EF8 /* Pods-SwiftWarplyFramework.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-SwiftWarplyFramework.debug.xcconfig"; path = "Target Support Files/Pods-SwiftWarplyFramework/Pods-SwiftWarplyFramework.debug.xcconfig"; sourceTree = "<group>"; };
B9EB8A451EF0C5AD75094EEE /* Pods-SwiftWarplyFramework.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-SwiftWarplyFramework.release.xcconfig"; path = "Target Support Files/Pods-SwiftWarplyFramework/Pods-SwiftWarplyFramework.release.xcconfig"; sourceTree = "<group>"; };
...
...
@@ -400,6 +404,13 @@
name = cells;
sourceTree = "<group>";
};
A080CFD828D17F7A0045A315 /* controls */ = {
isa = PBXGroup;
children = (
);
name = controls;
sourceTree = "<group>";
};
C049E0423E2B72D796B777A3 /* Pods */ = {
isa = PBXGroup;
children = (
...
...
@@ -433,9 +444,12 @@
1E108A9728A3FA9B0008B8E7 /* Info.plist */,
1E108A8B28A3F8FF0008B8E7 /* Resources */,
A02F34042882B6E60086465F /* TelcoViewController.swift */,
A080CFD828D17F7A0045A315 /* controls */,
A07936712885E65C00064122 /* models */,
A079366A2885CDDC00064122 /* analysis */,
A07936742885E96A00064122 /* utilities */,
A080CFD428D170A20045A315 /* MapsViewController.swift */,
A080CFD528D170A20045A315 /* MapsViewController.xib */,
E6A7785E282933E40045BBA8 /* CouponsViewController.swift */,
1EA1AF092835346A008998AA /* CouponsTableViewCell.swift */,
E6A7785D282933E40045BBA8 /* CouponViewController.swift */,
...
...
@@ -814,6 +828,7 @@
E6A778E5282933E60045BBA8 /* Main.storyboard in Resources */,
1E108A9628A3F9280008B8E7 /* pf_square_sans_pro_bold.ttf in Resources */,
1E108A9228A3F9280008B8E7 /* pf_square_sans_pro_regular.ttf in Resources */,
A080CFD728D170A20045A315 /* MapsViewController.xib in Resources */,
E6A778EA282933E60045BBA8 /* WLNativeVideoTableViewCell.xib in Resources */,
1E108A9528A3F9280008B8E7 /* pf_square_sans_pro_bold_italic.ttf in Resources */,
E6A7790A282933E60045BBA8 /* warp_white_close_button.png in Resources */,
...
...
@@ -925,6 +940,7 @@
E6A7794A282933E70045BBA8 /* FMDatabaseAdditions.m in Sources */,
E6A77903282933E60045BBA8 /* WLAPSItem.m in Sources */,
E6A7790B282933E60045BBA8 /* WLPushManager.m in Sources */,
A080CFD628D170A20045A315 /* MapsViewController.swift in Sources */,
A079366E2885D07700064122 /* AnalysisChildViewController.swift in Sources */,
E6A77950282933E70045BBA8 /* FMResultSet.m in Sources */,
E6A77936282933E70045BBA8 /* AFAutoPurgingImageCache.m in Sources */,
...
...
SwiftWarplyFramework/SwiftWarplyFramework/MapsViewController.swift
0 → 100644
View file @
7133d30
//
// MapsViewController.swift
// SwiftWarplyFramework
//
// Created by Βασιλης Σκουρας on 14/9/22.
//
import
UIKit
import
MapKit
class
MapsViewController
:
UIViewController
,
MKMapViewDelegate
{
// ui
@IBOutlet
private
var
mapView
:
MKMapView
!
@IBOutlet
private
var
titleView
:
UILabel
!
@IBOutlet
private
var
nameImageView
:
UIImageView
!
@IBOutlet
private
var
nameView
:
UILabel
!
@IBOutlet
private
var
hoursView
:
UILabel
!
@IBOutlet
private
var
phoneView
:
UILabel
!
@IBOutlet
private
var
addressView
:
UILabel
!
@IBOutlet
private
var
directionsButton
:
UIButton
!
@IBOutlet
private
var
infoTopConstraint
:
NSLayoutConstraint
!
// public
public
var
couponSet
:
swiftApi
.
CouponSetItemModel
?
var
merchantsArray
:
Array
<
swiftApi
.
MerchantModel
>
=
[]
//
var
loading
:
Bool
=
false
let
initialLocation
=
CLLocation
(
latitude
:
38.0689416
,
longitude
:
19.9906012
)
// greece
//
override
func
viewDidLoad
()
{
super
.
viewDidLoad
()
self
.
hidesBottomBarWhenPushed
=
true
self
.
infoTopConstraint
.
constant
=
0
setBackButton
(
"ic_close"
)
//setNavigationTitle(ccms?._titleOffer ?? "")
mapView
.
delegate
=
self
mapView
.
centerToLocation
(
initialLocation
)
//directionsButton.titleLabel?.font = UIFont(name: "PFSquareSansPro-Medium", size: 16)
directionsButton
.
setTitle
(
"Οδηγίες"
,
for
:
.
normal
)
directionsButton
.
setTitleColor
(
.
white
,
for
:
.
normal
)
directionsButton
.
backgroundColor
=
UIColor
(
red
:
0.47
,
green
:
0.75
,
blue
:
0.08
,
alpha
:
1.00
)
directionsButton
.
layer
.
cornerRadius
=
12.0
}
// mvp
@objc
func
load
()
{
if
(
loading
)
{
return
;
}
showLoading
()
// TODO: adapt params
let
merchantUuid
:
String
=
couponSet
!.
merchant_uuid
!
swiftApi
()
.
getMultilingualMerchantsAsync
([],
false
,
0.0
,
[],
""
,
0
,
[
merchantUuid
],
getMerchantsCallback
)
showContent
()
}
func
getMerchantsCallback
(
_
merchantsData
:
Array
<
swiftApi
.
MerchantModel
>
?)
->
Void
{
if
(
merchantsData
!=
nil
)
{
DispatchQueue
.
main
.
async
{
self
.
merchantsArray
=
merchantsData
!
self
.
loadMapPins
()
}
return
}
}
private
func
showLoading
()
{
loading
=
true
}
private
func
showError
()
{
}
private
func
showContent
()
{
loading
=
false
}
// private
@IBAction
func
closeButtomAction
(
_
sender
:
Any
)
{
hidePinDetailsView
()
}
private
func
loadMapPins
()
{
for
item
in
merchantsArray
{
let
pin
=
MKPointAnnotation
()
pin
.
coordinate
=
CLLocationCoordinate2D
(
latitude
:
item
.
_latitude
,
longitude
:
item
.
_longitude
)
mapView
.
addAnnotation
(
pin
)
}
}
private
func
loadPinDetailsView
()
{
self
.
titleView
.
text
=
"INTERSPORT"
self
.
nameImageView
.
image
=
UIImage
(
named
:
"intersport"
)
self
.
nameView
.
text
=
"Intersport Χαλάνδρι"
self
.
hoursView
.
text
=
"Δευτέρα - Τετάρτη"
self
.
phoneView
.
text
=
"210-6230453"
self
.
addressView
.
text
=
"ΕΘΝΙΚΗΣ ΑΝΤΙΣΤΑΣΕΩΝ 4 41"
}
private
func
showPinDetailsView
()
{
self
.
infoTopConstraint
.
constant
=
-
320
UIView
.
animate
(
withDuration
:
2.0
)
{
self
.
view
.
layoutIfNeeded
()
}
}
private
func
hidePinDetailsView
()
{
self
.
infoTopConstraint
.
constant
=
0
UIView
.
animate
(
withDuration
:
2.0
)
{
self
.
view
.
layoutIfNeeded
()
}
}
// map view delegate
func
mapView
(
_
mapView
:
MKMapView
,
viewFor
annotation
:
MKAnnotation
)
->
MKAnnotationView
?
{
guard
!
(
annotation
is
MKUserLocation
)
else
{
return
nil
}
var
annotationView
=
mapView
.
dequeueReusableAnnotationView
(
withIdentifier
:
"warply_custom"
)
if
(
annotationView
==
nil
)
{
annotationView
=
MKAnnotationView
(
annotation
:
annotation
,
reuseIdentifier
:
"warply_custom"
)
annotationView
?
.
canShowCallout
=
false
}
else
{
annotationView
?
.
annotation
=
annotation
}
// TODO: add custom pin image?
annotationView
?
.
image
=
UIImage
(
named
:
"custom"
)
return
annotationView
}
func
mapView
(
_
mapView
:
MKMapView
,
didSelect
view
:
MKAnnotationView
)
{
loadPinDetailsView
()
showPinDetailsView
()
}
func
mapView
(
_
mapView
:
MKMapView
,
didDeselect
view
:
MKAnnotationView
)
{
hidePinDetailsView
()
}
}
private
extension
MKMapView
{
func
centerToLocation
(
_
location
:
CLLocation
,
regionRadius
:
CLLocationDistance
=
1000
)
{
let
coordinateRegion
=
MKCoordinateRegion
(
center
:
location
.
coordinate
,
latitudinalMeters
:
regionRadius
,
longitudinalMeters
:
regionRadius
)
setRegion
(
coordinateRegion
,
animated
:
true
)
}
}
SwiftWarplyFramework/SwiftWarplyFramework/MapsViewController.xib
0 → 100644
View file @
7133d30
This diff is collapsed. Click to expand it.
Please
register
or
login
to post a comment