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
Manos Chorianopoulos
2026-03-18 12:11:01 +0200
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
f1adb8ee78253a8afa04d576bd46645f27d66813
f1adb8ee
1 parent
e566dedc
MapViewController part2
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
332 additions
and
234 deletions
SwiftWarplyFramework/SwiftWarplyFramework/screens/CouponViewController/CouponViewController.swift
SwiftWarplyFramework/SwiftWarplyFramework/screens/MapViewController/MapViewController.swift
SwiftWarplyFramework/SwiftWarplyFramework/screens/MapViewController/MapViewController.xib
SwiftWarplyFramework/SwiftWarplyFramework/screens/CouponViewController/CouponViewController.swift
View file @
f1adb8e
...
...
@@ -125,6 +125,7 @@ import UIKit
mapButton
.
setTitleColor
(
UIColor
(
rgb
:
0xFFFFFF
),
for
:
.
highlighted
)
mapButton
.
layer
.
cornerRadius
=
mapButton
.
bounds
.
height
/
2
mapButton
.
backgroundColor
=
UIColor
(
rgb
:
0x00A3E0
)
mapButton
.
addTarget
(
self
,
action
:
#selector(
mapButtonTapped
)
,
for
:
.
touchUpInside
)
websiteButton
.
titleLabel
?
.
font
=
UIFont
(
name
:
"PingLCG-Regular"
,
size
:
16
)
// websiteButton.setTitle("Δες το website", for: .normal)
...
...
@@ -133,12 +134,24 @@ import UIKit
websiteButton
.
setTitleColor
(
UIColor
(
rgb
:
0x002430
),
for
:
.
highlighted
)
websiteButton
.
backgroundColor
=
UIColor
(
rgb
:
0xDDEFFB
)
websiteButton
.
layer
.
cornerRadius
=
websiteButton
.
bounds
.
height
/
2
websiteButton
.
addTarget
(
self
,
action
:
#selector(
websiteButtonTapped
)
,
for
:
.
touchUpInside
)
// Configure the view with coupon data
if
let
couponData
=
coupon
{
setupUI
(
with
:
couponData
)
}
}
@objc
private
func
mapButtonTapped
()
{
let
vc
=
SwiftWarplyFramework
.
MapViewController
(
nibName
:
"MapViewController"
,
bundle
:
Bundle
.
frameworkBundle
)
vc
.
coupon
=
coupon
self
.
navigationController
?
.
pushViewController
(
vc
,
animated
:
true
)
}
@objc
private
func
websiteButtonTapped
()
{
// TODO
}
public
override
func
viewDidLayoutSubviews
()
{
super
.
viewDidLayoutSubviews
()
...
...
SwiftWarplyFramework/SwiftWarplyFramework/screens/MapViewController/MapViewController.swift
View file @
f1adb8e
...
...
@@ -11,21 +11,27 @@ import MapKit
@objc
public
class
MapViewController
:
UIViewController
,
MKMapViewDelegate
{
// ui
@IBOutlet
weak
var
mainView
:
UIView
!
@IBOutlet
weak
var
backgroundImage
:
UIImageView
!
@IBOutlet
private
var
mapView
:
MKMapView
!
@IBOutlet
weak
var
closeButton
:
UIButton
!
@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
!
@IBOutlet
weak
var
topBorderLine
:
UIImageView
!
@IBOutlet
weak
var
phoneImageView
:
UIImageView
!
@IBOutlet
weak
var
addressImageView
:
UIImageView
!
// HeaderView
@IBOutlet
weak
var
headerLabel
:
UILabel
!
@IBOutlet
weak
var
filtersView
:
UIView
!
@IBOutlet
weak
var
filtersLabel
:
UILabel
!
@IBOutlet
weak
var
filtersImage
:
UIImageView
!
// TODO: UNCOMMENT
// DetailsView
// @IBOutlet weak var closeButton: UIButton!
// @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!
// @IBOutlet weak var phoneImageView: UIImageView!
// @IBOutlet weak var addressImageView: UIImageView!
// public
public
var
coupon
:
CouponItemModel
?
...
...
@@ -45,73 +51,72 @@ import MapKit
self
.
hidesBottomBarWhenPushed
=
true
self
.
infoTopConstraint
.
constant
=
0
// TODO: UNCOMMENT
// self.infoTopConstraint.constant = 0
setBackButton
()
setNavigationTitle
(
"Καταστήματα"
)
//
setNavigationTitle("Καταστήματα")
backgroundImage
.
image
=
UIImage
(
named
:
"coupons_scrollview_white"
,
in
:
MyEmptyClass
.
resourceBundle
(),
compatibleWith
:
nil
)
phoneImageView
.
image
=
UIImage
(
named
:
"ic_phone"
,
in
:
MyEmptyClass
.
resourceBundle
(),
compatibleWith
:
nil
)
addressImageView
.
image
=
UIImage
(
named
:
"ic_address"
,
in
:
MyEmptyClass
.
resourceBundle
(),
compatibleWith
:
nil
)
// TODO: UNCOMMENT
//
phoneImageView.image = UIImage(named: "ic_phone", in: MyEmptyClass.resourceBundle(), compatibleWith: nil)
//
addressImageView.image = UIImage(named: "ic_address", in: MyEmptyClass.resourceBundle(), compatibleWith: nil)
mapView
.
delegate
=
self
mapView
.
centerToLocation
(
initialLocation
,
regionRadius
:
1000000
)
// mapView.clipsToBounds = true
// mapView.layer.cornerRadius = 30
// mapView.layer.maskedCorners = [ .layerMinXMinYCorner] // Top left corner radius
// let image = UIImage(named: "top_border_line", in: MyEmptyClass.resourceBundle(), compatibleWith: nil)!
// var aspectR: CGFloat = 0.0
//
// aspectR = image.size.width/image.size.height
// topBorderLine.translatesAutoresizingMaskIntoConstraints = false
// topBorderLine.image = image
// topBorderLine.contentMode = .scaleAspectFill
//
// NSLayoutConstraint.activate([
// topBorderLine.topAnchor.constraint(equalTo: mainView.topAnchor, constant: 0),
// topBorderLine.leadingAnchor.constraint(equalTo: mainView.leadingAnchor, constant: 0),
// topBorderLine.trailingAnchor.constraint(equalTo: mainView.trailingAnchor, constant: 0),
// topBorderLine.widthAnchor.constraint(equalToConstant: UIScreen.main.bounds.width),
// topBorderLine.heightAnchor.constraint(equalTo: topBorderLine.widthAnchor, multiplier: 1/aspectR)
// ])
// Hader Styles
self
.
headerLabel
.
text
=
"Partner businesses"
self
.
headerLabel
.
font
=
UIFont
(
name
:
"PingLCG-Bold"
,
size
:
24
)
self
.
headerLabel
.
textColor
=
UIColor
(
rgb
:
0x0D1B29
)
self
.
headerLabel
.
frame
.
size
.
width
=
self
.
headerLabel
.
intrinsicContentSize
.
width
self
.
headerLabel
.
frame
.
size
.
height
=
self
.
headerLabel
.
intrinsicContentSize
.
height
self
.
filtersView
.
backgroundColor
=
UIColor
(
rgb
:
0xF1F2F4
)
self
.
filtersView
.
layer
.
cornerRadius
=
self
.
filtersView
.
bounds
.
height
/
2
self
.
filtersView
.
layer
.
masksToBounds
=
true
self
.
filtersLabel
.
text
=
"Αναζήτηση"
self
.
filtersLabel
.
font
=
UIFont
(
name
:
"PingLCG-Regular"
,
size
:
16
)
self
.
filtersLabel
.
textColor
=
UIColor
(
rgb
:
0x000F1E
)
self
.
filtersLabel
.
frame
.
size
.
width
=
self
.
filtersLabel
.
intrinsicContentSize
.
width
self
.
filtersLabel
.
frame
.
size
.
height
=
self
.
filtersLabel
.
intrinsicContentSize
.
height
self
.
filtersImage
.
image
=
UIImage
(
named
:
"filter"
,
in
:
MyEmptyClass
.
resourceBundle
(),
compatibleWith
:
nil
)
closeButton
.
imageView
?
.
layer
.
transform
=
CATransform3DMakeScale
(
1.5
,
1.5
,
1.5
)
closeButton
.
setImage
(
UIImage
(
named
:
"ic_close_3"
,
in
:
MyEmptyClass
.
resourceBundle
(),
compatibleWith
:
nil
),
for
:
.
normal
)
// TODO: UNCOMMENT
// closeButton.imageView?.layer.transform = CATransform3DMakeScale(1.5, 1.5, 1.5)
// closeButton.setImage(UIImage(named: "ic_close_3", in: MyEmptyClass.resourceBundle(), compatibleWith: nil), for: .normal)
titleView
.
font
=
UIFont
(
name
:
"PFSquareSansPro-Bold"
,
size
:
19
)
titleView
.
textColor
=
UIColor
(
rgb
:
0x757575
)
//
titleView.font = UIFont(name: "PFSquareSansPro-Bold", size: 19)
//
titleView.textColor = UIColor(rgb: 0x757575)
nameView
.
font
=
UIFont
(
name
:
"PFSquareSansPro-Medium"
,
size
:
18
)
nameView
.
textColor
=
UIColor
(
rgb
:
0x415564
)
//
nameView.font = UIFont(name: "PFSquareSansPro-Medium", size: 18)
//
nameView.textColor = UIColor(rgb: 0x415564)
hoursView
.
font
=
UIFont
(
name
:
"PFSquareSansPro-Regular"
,
size
:
18
)
hoursView
.
textColor
=
UIColor
(
rgb
:
0xAEAEAE
)
//
hoursView.font = UIFont(name: "PFSquareSansPro-Regular", size: 18)
//
hoursView.textColor = UIColor(rgb: 0xAEAEAE)
hoursView
.
font
=
UIFont
(
name
:
"PFSquareSansPro-Medium"
,
size
:
18
)
hoursView
.
textColor
=
UIColor
(
rgb
:
0x415564
)
//
hoursView.font = UIFont(name: "PFSquareSansPro-Medium", size: 18)
//
hoursView.textColor = UIColor(rgb: 0x415564)
addressView
.
font
=
UIFont
(
name
:
"PFSquareSansPro-Medium"
,
size
:
18
)
addressView
.
textColor
=
UIColor
(
rgb
:
0x415564
)
//
addressView.font = UIFont(name: "PFSquareSansPro-Medium", size: 18)
//
addressView.textColor = UIColor(rgb: 0x415564)
//directionsButton.titleLabel?.font = UIFont(name: "PFSquareSansPro-Medium", size: 16)
directionsButton
.
setTitle
(
"Οδηγίες"
,
for
:
.
normal
)
directionsButton
.
setImage
(
UIImage
(
named
:
"ic_directions"
,
in
:
MyEmptyClass
.
resourceBundle
(),
compatibleWith
:
nil
),
for
:
.
normal
)
//
//directionsButton.titleLabel?.font = UIFont(name: "PFSquareSansPro-Medium", size: 16)
//
directionsButton.setTitle("Οδηγίες", for: .normal)
//
directionsButton.setImage(UIImage(named: "ic_directions", in: MyEmptyClass.resourceBundle(), compatibleWith: nil), for: .normal)
// directionsButton.sizeToFit()
directionsButton
.
titleLabel
?
.
font
=
UIFont
(
name
:
"PFSquareSansPro-Medium"
,
size
:
18
)
directionsButton
.
setTitleColor
(
.
white
,
for
:
.
normal
)
directionsButton
.
tintColor
=
.
white
directionsButton
.
backgroundColor
=
UIColor
(
rgb
:
0x0E8103
)
directionsButton
.
layer
.
cornerRadius
=
16.0
// directionsButton.imageEdgeInsets = UIEdgeInsets(top: 0, left: 0, bottom: 0, right: 5);
// directionsButton.titleEdgeInsets = UIEdgeInsets(top: 0, left: 5, bottom: 0, right: 0);
directionsButton
.
frame
=
CGRect
(
x
:
0.0
,
y
:
0.0
,
width
:
directionsButton
.
intrinsicContentSize
.
width
+
10
,
height
:
50
)
// directionsButton.contentEdgeInsets = UIEdgeInsets(top: 0, left: 15, bottom: 0, right: 15)
directionsButton
.
setInsets
(
forContentPadding
:
UIEdgeInsets
(
top
:
0
,
left
:
15
,
bottom
:
0
,
right
:
15
),
imageTitlePadding
:
10
)
//
//
directionsButton.sizeToFit()
//
directionsButton.titleLabel?.font = UIFont(name: "PFSquareSansPro-Medium", size: 18)
//
directionsButton.setTitleColor(.white, for: .normal)
//
directionsButton.tintColor = .white
//
directionsButton.backgroundColor = UIColor(rgb: 0x0E8103)
//
directionsButton.layer.cornerRadius = 16.0
//
//
directionsButton.imageEdgeInsets = UIEdgeInsets(top: 0, left: 0, bottom: 0, right: 5);
//
//
directionsButton.titleEdgeInsets = UIEdgeInsets(top: 0, left: 5, bottom: 0, right: 0);
//
directionsButton.frame = CGRect(x: 0.0, y: 0.0, width: directionsButton.intrinsicContentSize.width+10, height: 50)
//
//
directionsButton.contentEdgeInsets = UIEdgeInsets(top: 0, left: 15, bottom: 0, right: 15)
//
directionsButton.setInsets(forContentPadding: UIEdgeInsets(top: 0, left: 15, bottom: 0, right: 15), imageTitlePadding: 10)
load
()
}
...
...
@@ -134,24 +139,37 @@ import MapKit
if
(
coupon
!=
nil
)
{
if
let
merchantUuid
:
String
=
coupon
?
.
merchant_uuid
{
getMultilingualMerchantsAsync
([],
false
,
0.0
,
[],
""
,
0
,
[
merchantUuid
],
getMerchantsCallback
)
WarplySDK
.
shared
.
getStores
(
merchantUuid
:
merchantUuid
)
{
[
weak
self
]
merchants
in
guard
let
self
=
self
,
let
merchants
=
merchants
else
{
return
}
self
.
getMerchantsCallback
(
merchants
)
print
(
"✅ [MapViewController] Loaded
\(
merchants
.
count
)
merchants"
)
}
failureCallback
:
{
[
weak
self
]
errorCode
in
print
(
"Failed to load merchants:
\(
errorCode
)
"
)
}
showContent
()
}
}
else
{
let
appUuid
=
getAppUuid
()
// 2a6adade35f1484994a3d4c8f006b909 category is for SM only
var
categoryUuids
=
[
""
]
if
(
self
.
isMarket
==
true
)
{
categoryUuids
=
appUuid
==
"0086a2088301440792091b9f814c2267"
?
[
"2a6adade35f1484994a3d4c8f006b909"
]
:
[
"adcace6cab6049c7b7271bc85bc2b26d"
]
}
else
{
categoryUuids
=
appUuid
==
"0086a2088301440792091b9f814c2267"
?
[
""
]
:
[
"adcace6cab6049c7b7271bc85bc2b26d"
]
WarplySDK
.
shared
.
getStores
()
{
[
weak
self
]
merchants
in
guard
let
self
=
self
,
let
merchants
=
merchants
else
{
return
}
self
.
getMerchantsCallback
(
merchants
)
print
(
"✅ [MapViewController] Loaded
\(
merchants
.
count
)
merchants"
)
}
failureCallback
:
{
[
weak
self
]
errorCode
in
print
(
"Failed to load merchants:
\(
errorCode
)
"
)
}
getMultilingualMerchantsAsync
(
categoryUuids
,
false
,
0.0
,
[],
""
,
0
,
[],
getMerchantsCallback
)
showContent
()
}
}
func
getMerchantsCallback
(
_
merchantsData
:
Array
<
MerchantModel
>
?)
->
Void
{
...
...
@@ -177,7 +195,8 @@ import MapKit
// let filteredMerchants = self.merchantsArray.filter({ return (($0._latitude != 0.0) && ($0._longitude != 0.0)) })
if
(
filteredMerchants
.
count
==
0
)
{
self
.
showDialog
(
"Καταστήματα συνεργάτη"
,
"Ο συνεργάτης διαθέτει μόνο ηλεκτρονικό κατάστημα για ηλεκτρονικές παραγγελίες."
)
// self.showDialog("Καταστήματα συνεργάτη", "Ο συνεργάτης διαθέτει μόνο ηλεκτρονικό κατάστημα για ηλεκτρονικές παραγγελίες.")
self
.
showDialog
(
"Καταστήματα συνεργάτη"
,
"Δεν υπάρχουν καταστήματα συνεργάτη."
)
}
}
...
...
@@ -185,107 +204,124 @@ import MapKit
}
}
func
showDialog
(
_
alertTitle
:
String
,
_
alertSubTitle
:
String
)
->
Void
{
func
showDialog
(
_
alertTitle
:
String
,
_
alertSubTitle
:
String
)
->
Void
{
let
alert
=
UIAlertController
(
title
:
alertTitle
,
message
:
alertSubTitle
,
preferredStyle
:
.
alert
)
alert
.
addAction
(
UIAlertAction
(
title
:
"OK"
,
style
:
.
default
,
handler
:
{
action
in
switch
action
.
style
{
case
.
default
:
print
(
"default"
)
case
.
cancel
:
print
(
"cancel"
)
case
.
destructive
:
print
(
"destructive"
)
@unknown
default
:
break
}
}))
self
.
present
(
alert
,
animated
:
true
,
completion
:
nil
)
}
// func showDialog(_ alertTitle: String, _ alertSubTitle: String) -> Void {
// let alert = UIAlertController(title: alertTitle, message: alertSubTitle, preferredStyle: .alert)
let
cancelButton
=
UIAlertAction
(
title
:
"Άκυρο"
,
style
:
.
default
,
handler
:
{
action
in
switch
action
.
style
{
case
.
default
:
self
.
navigationController
?
.
popViewController
(
animated
:
true
)
// self.dismiss(animated: true, completion: {})
//
let cancelButton = UIAlertAction(title: "Άκυρο", style: .default, handler: { action in
//
switch action.style{
//
case .default:
//
self.navigationController?.popViewController(animated: true)
//
// self.dismiss(animated: true, completion: {})
case
.
cancel
:
print
(
"cancel"
)
//
case .cancel:
//
print("cancel")
case
.
destructive
:
print
(
"destructive"
)
//
case .destructive:
//
print("destructive")
}
})
// cancelButton.setValue(UIColor(rgb: 0xFC5757), forKey: "titleTextColor")
alert
.
addAction
(
cancelButton
)
alert
.
addAction
(
UIAlertAction
(
title
:
"Δες το eshop"
,
style
:
.
default
,
handler
:
{
action
in
switch
action
.
style
{
case
.
default
:
if
(
self
.
coupon
!=
nil
)
{
// if let merchantUuid: String = self.coupon?.merchant_uuid {
// for item in swiftApi().getMerchantList() {
// if (item._uuid == merchantUuid) {
//
}
//
})
//
// cancelButton.setValue(UIColor(rgb: 0xFC5757), forKey: "titleTextColor")
//
alert.addAction(cancelButton)
//
alert.addAction(UIAlertAction(title: "Δες το eshop", style: .default, handler: { action in
//
switch action.style{
//
case .default:
//
if (self.coupon != nil) {
//
// if let merchantUuid: String = self.coupon?.merchant_uuid {
//
// for item in swiftApi().getMerchantList() {
//
// if (item._uuid == merchantUuid) {
// let eshopWebsite = item._website
// if (eshopWebsite != "") {
// guard let websiteUrl = URL(string: eshopWebsite) else {
// print("Error creating URL")
// return
// }
// // check if link can be opened.
// guard UIApplication.shared.canOpenURL(websiteUrl) else {
// return
// }
// swiftApi().logTrackersEvent("click", "SeeShopWebsite")
// UIApplication.shared.open(websiteUrl, options: [:], completionHandler: nil)
// break;
// }
// }
// }
// }
let
merchantDetails
:
MerchantModel
?
=
self
.
coupon
?
.
merchant_details
let
eshopWebsite
=
merchantDetails
?
.
_website
??
""
if
(
eshopWebsite
!=
""
)
{
guard
let
websiteUrl
=
URL
(
string
:
eshopWebsite
)
else
{
print
(
"Error creating URL"
)
return
}
// check if link can be opened.
guard
UIApplication
.
shared
.
canOpenURL
(
websiteUrl
)
else
{
return
}
// logTrackersEvent("click", "SeeShopWebsite")
UIApplication
.
shared
.
open
(
websiteUrl
,
options
:
[:],
completionHandler
:
nil
)
break
;
}
}
// if (self.merchantsArray.count > 0) {
// for item in self.merchantsArray {
// let eshopWebsite = item._website
//
// if (eshopWebsite != "") {
// guard let websiteUrl = URL(string: eshopWebsite) else {
// print("Error creating URL")
// return
// }
//
// // check if link can be opened.
// guard UIApplication.shared.canOpenURL(websiteUrl) else {
// return
// }
//
// swiftApi().logTrackersEvent("click", "SeeShopWebsite")
// UIApplication.shared.open(websiteUrl, options: [:], completionHandler: nil)
// break;
// }
// }
// }
//
// let eshopWebsite = item._website
//
// if (eshopWebsite != "") {
//
// guard let websiteUrl = URL(string: eshopWebsite) else {
//
// print("Error creating URL")
//
// return
//
// }
//
// // check if link can be opened.
//
// guard UIApplication.shared.canOpenURL(websiteUrl) else {
//
// return
//
// }
//
// swiftApi().logTrackersEvent("click", "SeeShopWebsite")
//
// UIApplication.shared.open(websiteUrl, options: [:], completionHandler: nil)
//
// break;
//
// }
//
// }
//
// }
//
// }
//
let merchantDetails: MerchantModel? = self.coupon?.merchant_details
//
let eshopWebsite = merchantDetails?._website ?? ""
//
if (eshopWebsite != "") {
//
guard let websiteUrl = URL(string: eshopWebsite) else {
//
print("Error creating URL")
//
return
//
}
//
// check if link can be opened.
//
guard UIApplication.shared.canOpenURL(websiteUrl) else {
//
return
//
}
//
//
logTrackersEvent("click", "SeeShopWebsite")
//
UIApplication.shared.open(websiteUrl, options: [:], completionHandler: nil)
//
break;
//
}
//
}
//
//
if (self.merchantsArray.count > 0) {
//
//
for item in self.merchantsArray {
//
//
let eshopWebsite = item._website
//
//
//
//
if (eshopWebsite != "") {
//
//
guard let websiteUrl = URL(string: eshopWebsite) else {
//
//
print("Error creating URL")
//
//
return
//
//
}
//
//
//
//
// check if link can be opened.
//
//
guard UIApplication.shared.canOpenURL(websiteUrl) else {
//
//
return
//
//
}
//
//
//
//
swiftApi().logTrackersEvent("click", "SeeShopWebsite")
//
//
UIApplication.shared.open(websiteUrl, options: [:], completionHandler: nil)
//
//
break;
//
//
}
//
//
}
//
//
}
case
.
cancel
:
print
(
"cancel"
)
//
case .cancel:
//
print("cancel")
case
.
destructive
:
print
(
"destructive"
)
//
case .destructive:
//
print("destructive")
}
}))
self
.
present
(
alert
,
animated
:
true
,
completion
:
nil
)
}
//
}
//
}))
//
self.present(alert, animated: true, completion: nil)
//
}
private
func
showLoading
()
{
...
...
@@ -303,7 +339,8 @@ import MapKit
// private
@IBAction
func
closeButtonAction
(
_
sender
:
Any
)
{
print
(
"closeButton Pressed!!!"
)
hidePinDetailsView
()
// TODO: UNCOMMENT
// hidePinDetailsView()
let
selectedAnnotations
=
mapView
.
selectedAnnotations
for
annotation
in
selectedAnnotations
{
...
...
@@ -374,44 +411,47 @@ import MapKit
// mapView.showAnnotations(mapView.annotations, animated: true)
}
private
func
loadPinDetailsView
(
_
annotation
:
MerchantAnnotation
)
{
self
.
selectedMerchant
=
annotation
.
model
if
let
parent
=
self
.
parentMerchantsArray
.
first
(
where
:
{(
$0
.
_uuid
==
self
.
selectedMerchant
?
.
_parent
)})
{
self
.
parentMerchant
=
parent
}
// self.titleView.text = self.selectedMerchant?._admin_name
self
.
titleView
.
text
=
self
.
parentMerchant
?
.
_admin_name
if
(
self
.
isMarket
==
true
)
{
self
.
nameImageView
.
load
(
link
:
self
.
parentMerchant
?
.
_img_preview
??
""
,
placeholder
:
UIImage
(),
cache
:
URLCache
())
}
else
{
self
.
nameImageView
.
load
(
link
:
self
.
selectedMerchant
?
.
_img_preview
??
""
,
placeholder
:
UIImage
(),
cache
:
URLCache
())
}
self
.
nameView
.
text
=
self
.
selectedMerchant
?
.
_name
// TODO: Make dynamic
self
.
hoursView
.
text
=
""
self
.
phoneView
.
text
=
self
.
selectedMerchant
?
.
_telephone
self
.
addressView
.
text
=
self
.
selectedMerchant
?
.
_address
}
// TODO: UNCOMMENT
// private func loadPinDetailsView(_ annotation: MerchantAnnotation) {
// self.selectedMerchant = annotation.model
//
// if let parent = self.parentMerchantsArray.first(where: {($0._uuid == self.selectedMerchant?._parent)}) {
// self.parentMerchant = parent
// }
//
//// self.titleView.text = self.selectedMerchant?._admin_name
// self.titleView.text = self.parentMerchant?._admin_name
//
// if (self.isMarket == true) {
// self.nameImageView.load(link: self.parentMerchant?._img_preview ?? "", placeholder: UIImage(), cache: URLCache())
// } else {
// self.nameImageView.load(link: self.selectedMerchant?._img_preview ?? "", placeholder: UIImage(), cache: URLCache())
// }
//
// self.nameView.text = self.selectedMerchant?._name
// // TODO: Make dynamic
// self.hoursView.text = ""
// self.phoneView.text = self.selectedMerchant?._telephone
// self.addressView.text = self.selectedMerchant?._address
// }
private
func
showPinDetailsView
()
{
self
.
infoTopConstraint
.
constant
=
-
320
UIView
.
animate
(
withDuration
:
1.0
)
{
self
.
view
.
layoutIfNeeded
()
}
}
// TODO: UNCOMMENT
// private func showPinDetailsView() {
// self.infoTopConstraint.constant = -320
// UIView.animate(withDuration: 1.0) {
// self.view.layoutIfNeeded()
// }
// }
private
func
hidePinDetailsView
()
{
self
.
selectedMerchant
=
nil
self
.
infoTopConstraint
.
constant
=
0
UIView
.
animate
(
withDuration
:
1.0
)
{
self
.
view
.
layoutIfNeeded
()
}
}
// TODO: UNCOMMENT
// private func hidePinDetailsView() {
// self.selectedMerchant = nil
//
// self.infoTopConstraint.constant = 0
// UIView.animate(withDuration: 1.0) {
// self.view.layoutIfNeeded()
// }
// }
// map view delegate
// public func mapView(_ mapView: MKMapView, viewFor annotation: MKAnnotation) -> MKAnnotationView? {
...
...
@@ -469,6 +509,8 @@ import MapKit
let
logoImageView
=
UIImageView
(
frame
:
CGRect
(
x
:
5
,
y
:
5
,
width
:
35
,
height
:
35
))
logoImageView
.
contentMode
=
.
scaleAspectFit
logoImageView
.
layer
.
cornerRadius
=
logoImageView
.
frame
.
width
/
2
// 17.5 // 35 / 2
logoImageView
.
clipsToBounds
=
true
let
merchant
=
annotation
as?
MerchantAnnotation
if
let
merchantModel
=
merchant
?
.
model
{
...
...
@@ -508,12 +550,14 @@ import MapKit
let
merchantModel
=
merchant
!.
model
// logTrackersEvent("click", ("ShopsScreenMarker:" + (merchantModel._uuid)))
loadPinDetailsView
(
merchant
!
)
showPinDetailsView
()
// TODO: UNCOMMENT
// loadPinDetailsView(merchant!)
// showPinDetailsView()
}
public
func
mapView
(
_
mapView
:
MKMapView
,
didDeselect
view
:
MKAnnotationView
)
{
hidePinDetailsView
()
// TODO: UNCOMMENT
// hidePinDetailsView()
}
}
...
...
SwiftWarplyFramework/SwiftWarplyFramework/screens/MapViewController/MapViewController.xib
View file @
f1adb8e
...
...
@@ -10,6 +10,12 @@
<objects>
<placeholder
placeholderIdentifier=
"IBFilesOwner"
id=
"-1"
userLabel=
"File's Owner"
customClass=
"MapViewController"
customModule=
"SwiftWarplyFramework"
customModuleProvider=
"target"
>
<connections>
<outlet
property=
"filtersImage"
destination=
"h5m-Ai-mxP"
id=
"PxL-fq-f8P"
/>
<outlet
property=
"filtersLabel"
destination=
"fve-ha-nql"
id=
"A0I-n9-Vrm"
/>
<outlet
property=
"filtersView"
destination=
"Fhh-Lz-Her"
id=
"7Fz-Bo-jJG"
/>
<outlet
property=
"headerLabel"
destination=
"zl6-zo-ETD"
id=
"LQm-EV-BE5"
/>
<outlet
property=
"mainView"
destination=
"hCU-aG-ygY"
id=
"jJC-9b-4rL"
/>
<outlet
property=
"mapView"
destination=
"YL5-4p-PKK"
id=
"Lk7-cv-ev7"
/>
<outlet
property=
"view"
destination=
"i5M-Pr-FkT"
id=
"sfx-zR-JGt"
/>
</connections>
</placeholder>
...
...
@@ -21,38 +27,69 @@
<view
contentMode=
"scaleToFill"
translatesAutoresizingMaskIntoConstraints=
"NO"
id=
"hCU-aG-ygY"
userLabel=
"Main View"
>
<rect
key=
"frame"
x=
"0.0"
y=
"118"
width=
"393"
height=
"734"
/>
<subviews>
<imageView
clipsSubviews=
"YES"
userInteractionEnabled=
"NO"
contentMode=
"scaleToFill"
horizontalHuggingPriority=
"251"
verticalHuggingPriority=
"251"
image=
"coupons_scrollview_white"
translatesAutoresizingMaskIntoConstraints=
"NO"
id=
"9Ss-50-8lb"
>
<rect
key=
"frame"
x=
"0.0"
y=
"0.0"
width=
"414"
height=
"852"
/>
</imageView>
<view
contentMode=
"scaleToFill"
translatesAutoresizingMaskIntoConstraints=
"NO"
id=
"gfZ-ow-vhw"
userLabel=
"HeaderView"
>
<rect
key=
"frame"
x=
"0.0"
y=
"0.0"
width=
"393"
height=
"89"
/>
<subviews>
<label
opaque=
"NO"
userInteractionEnabled=
"NO"
contentMode=
"left"
horizontalHuggingPriority=
"251"
verticalHuggingPriority=
"251"
text=
"Label"
textAlignment=
"natural"
lineBreakMode=
"tailTruncation"
baselineAdjustment=
"alignBaselines"
adjustsFontSizeToFit=
"NO"
translatesAutoresizingMaskIntoConstraints=
"NO"
id=
"zl6-zo-ETD"
userLabel=
"HeaderLabel"
>
<rect
key=
"frame"
x=
"18"
y=
"0.0"
width=
"357"
height=
"21"
/>
<fontDescription
key=
"fontDescription"
type=
"system"
pointSize=
"17"
/>
<nil
key=
"textColor"
/>
<nil
key=
"highlightedColor"
/>
</label>
<view
contentMode=
"scaleToFill"
translatesAutoresizingMaskIntoConstraints=
"NO"
id=
"Fhh-Lz-Her"
userLabel=
"FiltersView"
>
<rect
key=
"frame"
x=
"18"
y=
"33"
width=
"105"
height=
"44"
/>
<subviews>
<label
opaque=
"NO"
userInteractionEnabled=
"NO"
contentMode=
"left"
horizontalHuggingPriority=
"251"
verticalHuggingPriority=
"251"
text=
"Label"
textAlignment=
"natural"
lineBreakMode=
"tailTruncation"
baselineAdjustment=
"alignBaselines"
adjustsFontSizeToFit=
"NO"
translatesAutoresizingMaskIntoConstraints=
"NO"
id=
"fve-ha-nql"
userLabel=
"FiltersLabel"
>
<rect
key=
"frame"
x=
"19"
y=
"11.666666666666657"
width=
"42"
height=
"21"
/>
<fontDescription
key=
"fontDescription"
type=
"system"
pointSize=
"17"
/>
<nil
key=
"textColor"
/>
<nil
key=
"highlightedColor"
/>
</label>
<imageView
clipsSubviews=
"YES"
userInteractionEnabled=
"NO"
contentMode=
"scaleAspectFit"
horizontalHuggingPriority=
"251"
verticalHuggingPriority=
"251"
translatesAutoresizingMaskIntoConstraints=
"NO"
id=
"h5m-Ai-mxP"
userLabel=
"Filters Image View"
>
<rect
key=
"frame"
x=
"75"
y=
"14"
width=
"16"
height=
"16"
/>
<constraints>
<constraint
firstAttribute=
"height"
constant=
"16"
id=
"R9w-eV-kjy"
/>
<constraint
firstAttribute=
"width"
constant=
"16"
id=
"cpg-C4-oVL"
/>
</constraints>
</imageView>
</subviews>
<color
key=
"backgroundColor"
systemColor=
"systemBackgroundColor"
/>
<constraints>
<constraint
firstAttribute=
"height"
constant=
"44"
id=
"0FE-97-MT3"
/>
<constraint
firstAttribute=
"trailing"
secondItem=
"h5m-Ai-mxP"
secondAttribute=
"trailing"
constant=
"14"
id=
"7TZ-U6-Oe6"
/>
<constraint
firstItem=
"h5m-Ai-mxP"
firstAttribute=
"leading"
secondItem=
"fve-ha-nql"
secondAttribute=
"trailing"
constant=
"14"
id=
"Ykt-kZ-SCd"
/>
<constraint
firstItem=
"h5m-Ai-mxP"
firstAttribute=
"centerY"
secondItem=
"Fhh-Lz-Her"
secondAttribute=
"centerY"
id=
"ffd-ln-2Rn"
/>
<constraint
firstItem=
"fve-ha-nql"
firstAttribute=
"leading"
secondItem=
"Fhh-Lz-Her"
secondAttribute=
"leading"
constant=
"19"
id=
"gpM-zt-97Q"
/>
<constraint
firstItem=
"fve-ha-nql"
firstAttribute=
"centerY"
secondItem=
"Fhh-Lz-Her"
secondAttribute=
"centerY"
id=
"nKc-Oy-o9r"
/>
</constraints>
</view>
</subviews>
<color
key=
"backgroundColor"
white=
"1"
alpha=
"1"
colorSpace=
"custom"
customColorSpace=
"genericGamma22GrayColorSpace"
/>
<constraints>
<constraint
firstItem=
"zl6-zo-ETD"
firstAttribute=
"top"
secondItem=
"gfZ-ow-vhw"
secondAttribute=
"top"
id=
"1LE-ZD-h9c"
/>
<constraint
firstItem=
"Fhh-Lz-Her"
firstAttribute=
"leading"
secondItem=
"gfZ-ow-vhw"
secondAttribute=
"leading"
constant=
"18"
id=
"9o1-gX-HVH"
/>
<constraint
firstAttribute=
"bottom"
secondItem=
"Fhh-Lz-Her"
secondAttribute=
"bottom"
constant=
"12"
id=
"B0X-8d-LAN"
/>
<constraint
firstAttribute=
"trailing"
secondItem=
"zl6-zo-ETD"
secondAttribute=
"trailing"
constant=
"18"
id=
"XHZ-7i-bUV"
/>
<constraint
firstItem=
"zl6-zo-ETD"
firstAttribute=
"leading"
secondItem=
"gfZ-ow-vhw"
secondAttribute=
"leading"
constant=
"18"
id=
"ZUp-F3-KR2"
/>
<constraint
firstItem=
"Fhh-Lz-Her"
firstAttribute=
"top"
secondItem=
"zl6-zo-ETD"
secondAttribute=
"bottom"
constant=
"12"
id=
"h2l-5a-FZk"
/>
</constraints>
</view>
<mapView
clipsSubviews=
"YES"
multipleTouchEnabled=
"YES"
contentMode=
"scaleToFill"
mapType=
"standard"
translatesAutoresizingMaskIntoConstraints=
"NO"
id=
"YL5-4p-PKK"
>
<rect
key=
"frame"
x=
"0.0"
y=
"
0.0"
width=
"393"
height=
"734
"
/>
<rect
key=
"frame"
x=
"0.0"
y=
"
89"
width=
"393"
height=
"645
"
/>
</mapView>
<imageView
clipsSubviews=
"YES"
userInteractionEnabled=
"NO"
contentMode=
"scaleAspectFill"
horizontalHuggingPriority=
"251"
verticalHuggingPriority=
"251"
translatesAutoresizingMaskIntoConstraints=
"NO"
id=
"wO4-b0-Lbj"
>
<rect
key=
"frame"
x=
"0.0"
y=
"420"
width=
"414"
height=
"11.5"
/>
</imageView>
</subviews>
<color
key=
"backgroundColor"
systemColor=
"systemBackgroundColor
"
/>
<color
key=
"backgroundColor"
white=
"1"
alpha=
"1"
colorSpace=
"custom"
customColorSpace=
"genericGamma22GrayColorSpace
"
/>
<constraints>
<constraint
firstItem=
"
wO4-b0-Lbj"
firstAttribute=
"top"
secondItem=
"hCU-aG-ygY"
secondAttribute=
"top"
id=
"7Sp-xV-6LO
"
/>
<constraint
firstItem=
"
YL5-4p-PKK"
firstAttribute=
"top"
secondItem=
"gfZ-ow-vhw"
secondAttribute=
"bottom"
id=
"4LY-VU-KPk
"
/>
<constraint
firstAttribute=
"bottom"
secondItem=
"YL5-4p-PKK"
secondAttribute=
"bottom"
id=
"AXy-Mh-nYV"
/>
<constraint
firstItem=
"wO4-b0-Lbj"
firstAttribute=
"leading"
secondItem=
"hCU-aG-ygY"
secondAttribute=
"leading"
id=
"Gfx-j2-M85"
/>
<constraint
firstAttribute=
"bottom"
secondItem=
"9Ss-50-8lb"
secondAttribute=
"bottom"
id=
"Ou1-x0-kmw"
/>
<constraint
firstAttribute=
"trailing"
secondItem=
"9Ss-50-8lb"
secondAttribute=
"trailing"
id=
"WVl-E8-L8A"
/>
<constraint
firstItem=
"gfZ-ow-vhw"
firstAttribute=
"leading"
secondItem=
"hCU-aG-ygY"
secondAttribute=
"leading"
id=
"Ffi-wk-Gwj"
/>
<constraint
firstItem=
"YL5-4p-PKK"
firstAttribute=
"leading"
secondItem=
"hCU-aG-ygY"
secondAttribute=
"leading"
id=
"Zit-4v-Yuu"
/>
<constraint
firstItem=
"9Ss-50-8lb"
firstAttribute=
"leading"
secondItem=
"hCU-aG-ygY"
secondAttribute=
"leading"
id=
"miC-Sr-KkR"
/>
<constraint
firstAttribute=
"trailing"
secondItem=
"YL5-4p-PKK"
secondAttribute=
"trailing"
id=
"nif-Bx-zgh"
/>
<constraint
firstItem=
"YL5-4p-PKK"
firstAttribute=
"top"
secondItem=
"hCU-aG-ygY"
secondAttribute=
"top"
id=
"pyA-tM-UhQ"
/>
<constraint
firstItem=
"9Ss-50-8lb"
firstAttribute=
"top"
secondItem=
"hCU-aG-ygY"
secondAttribute=
"top"
id=
"qVD-4w-XZ6"
/>
<constraint
firstAttribute=
"trailing"
secondItem=
"wO4-b0-Lbj"
secondAttribute=
"trailing"
id=
"urK-JF-3MF"
/>
<constraint
firstAttribute=
"trailing"
secondItem=
"gfZ-ow-vhw"
secondAttribute=
"trailing"
id=
"qDt-sW-etJ"
/>
<constraint
firstItem=
"gfZ-ow-vhw"
firstAttribute=
"top"
secondItem=
"hCU-aG-ygY"
secondAttribute=
"top"
id=
"srO-Ke-wyK"
/>
</constraints>
<variation
key=
"default"
>
<mask
key=
"subviews"
>
<exclude
reference=
"9Ss-50-8lb"
/>
<exclude
reference=
"wO4-b0-Lbj"
/>
</mask>
</variation>
</view>
<view
contentMode=
"scaleToFill"
translatesAutoresizingMaskIntoConstraints=
"NO"
id=
"PAK-cJ-dw4"
>
<view
contentMode=
"scaleToFill"
translatesAutoresizingMaskIntoConstraints=
"NO"
id=
"PAK-cJ-dw4"
userLabel=
"DetailsView"
>
<rect
key=
"frame"
x=
"0.0"
y=
"532"
width=
"383"
height=
"320"
/>
<subviews>
<label
opaque=
"NO"
userInteractionEnabled=
"NO"
contentMode=
"left"
horizontalHuggingPriority=
"251"
verticalHuggingPriority=
"251"
text=
"INTERSPORT"
textAlignment=
"natural"
lineBreakMode=
"tailTruncation"
baselineAdjustment=
"alignBaselines"
adjustsFontSizeToFit=
"NO"
translatesAutoresizingMaskIntoConstraints=
"NO"
id=
"1JT-2j-Bcy"
userLabel=
"Title"
>
...
...
@@ -204,11 +241,15 @@
<constraint
firstItem=
"PAK-cJ-dw4"
firstAttribute=
"leading"
secondItem=
"i5M-Pr-FkT"
secondAttribute=
"leading"
id=
"RpT-Pg-Mld"
/>
<constraint
firstItem=
"hCU-aG-ygY"
firstAttribute=
"leading"
secondItem=
"i5M-Pr-FkT"
secondAttribute=
"leading"
id=
"Tgj-nb-Tww"
/>
</constraints>
<variation
key=
"default"
>
<mask
key=
"subviews"
>
<exclude
reference=
"PAK-cJ-dw4"
/>
</mask>
</variation>
<point
key=
"canvasLocation"
x=
"65"
y=
"154"
/>
</view>
</objects>
<resources>
<image
name=
"coupons_scrollview_white"
width=
"214"
height=
"462"
/>
<image
name=
"ic_address"
width=
"12.5"
height=
"17"
/>
<image
name=
"ic_close_3"
width=
"11.333333015441895"
height=
"11.666666984558105"
/>
<image
name=
"ic_phone"
width=
"15.5"
height=
"15.5"
/>
...
...
Please
register
or
login
to post a comment