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
2024-10-16 17:10:52 +0300
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
e651e1f3e8eea559ae121130e5bd1915143fea34
e651e1f3
1 parent
245e7719
add PopupInfoViewController
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
168 additions
and
0 deletions
SwiftWarplyFramework/SwiftWarplyFramework.xcodeproj/project.pbxproj
SwiftWarplyFramework/SwiftWarplyFramework.xcworkspace/xcuserdata/manos.xcuserdatad/UserInterfaceState.xcuserstate
SwiftWarplyFramework/SwiftWarplyFramework/Main.storyboard
SwiftWarplyFramework/SwiftWarplyFramework/PopupInfoViewController.swift
SwiftWarplyFramework/SwiftWarplyFramework/UnifiedCouponsViewController.swift
SwiftWarplyFramework/SwiftWarplyFramework/ViewControllerExtensions.swift
SwiftWarplyFramework/SwiftWarplyFramework.xcodeproj/project.pbxproj
View file @
e651e1f
...
...
@@ -19,6 +19,7 @@
1E15B9A229DDCF02000A408D /* MarketSharingHistoryViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1E15B9A129DDCF02000A408D /* MarketSharingHistoryViewController.swift */; };
1E15B9A429DDD211000A408D /* MarketHistoryViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1E15B9A329DDD211000A408D /* MarketHistoryViewController.swift */; };
1E2966EA2837A21D00F83FAC /* RSBarcodes_Swift in Frameworks */ = {isa = PBXBuildFile; productRef = 1E2966E92837A21D00F83FAC /* RSBarcodes_Swift */; };
1E36E43D2CBFDD5100A60198 /* PopupInfoViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1E36E43C2CBFDD5100A60198 /* PopupInfoViewController.swift */; };
1E4195FB2AE691D20094DADE /* WalletActiveCouponsTableViewCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1E4195FA2AE691D20094DADE /* WalletActiveCouponsTableViewCell.swift */; };
1E4410B128F5855000859F92 /* CampaignCategory.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1E4410B028F5855000859F92 /* CampaignCategory.swift */; };
1E46B4BF2BEBB68800D5B488 /* WalletActiveCouponsScrollTableViewCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1E46B4BE2BEBB68800D5B488 /* WalletActiveCouponsScrollTableViewCell.swift */; };
...
...
@@ -212,6 +213,7 @@
1E151F1929DAE4D500951FA0 /* ActiveCodeTableViewCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ActiveCodeTableViewCell.swift; sourceTree = "<group>"; };
1E15B9A129DDCF02000A408D /* MarketSharingHistoryViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MarketSharingHistoryViewController.swift; sourceTree = "<group>"; };
1E15B9A329DDD211000A408D /* MarketHistoryViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MarketHistoryViewController.swift; sourceTree = "<group>"; };
1E36E43C2CBFDD5100A60198 /* PopupInfoViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PopupInfoViewController.swift; sourceTree = "<group>"; };
1E4195FA2AE691D20094DADE /* WalletActiveCouponsTableViewCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = WalletActiveCouponsTableViewCell.swift; sourceTree = "<group>"; };
1E4410B028F5855000859F92 /* CampaignCategory.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CampaignCategory.swift; sourceTree = "<group>"; };
1E46B4BE2BEBB68800D5B488 /* WalletActiveCouponsScrollTableViewCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = WalletActiveCouponsScrollTableViewCell.swift; sourceTree = "<group>"; };
...
...
@@ -564,6 +566,7 @@
1EB236AC28816C560063777A /* NumberPopupViewController.swift */,
1EB236AE28816CAB0063777A /* NumbersTableViewCell.swift */,
1EB5F4C728536FD60016F36E /* StepsViewController.swift */,
1E36E43C2CBFDD5100A60198 /* PopupInfoViewController.swift */,
E6A77860282933E40045BBA8 /* MyApi.h */,
E6A778DC282933E60045BBA8 /* MyApi.m */,
E6A77862282933E50045BBA8 /* MyEmptyClass.swift */,
...
...
@@ -1070,6 +1073,7 @@
1E15B9A229DDCF02000A408D /* MarketSharingHistoryViewController.swift in Sources */,
A079366E2885D07700064122 /* AnalysisChildViewController.swift in Sources */,
E6A77950282933E70045BBA8 /* FMResultSet.m in Sources */,
1E36E43D2CBFDD5100A60198 /* PopupInfoViewController.swift in Sources */,
1E151F1A29DAE4D500951FA0 /* ActiveCodeTableViewCell.swift in Sources */,
E6A77936282933E70045BBA8 /* AFAutoPurgingImageCache.m in Sources */,
A079367E2885F60A00064122 /* AnalysisHeaderMessageViewCell.swift in Sources */,
...
...
SwiftWarplyFramework/SwiftWarplyFramework.xcworkspace/xcuserdata/manos.xcuserdatad/UserInterfaceState.xcuserstate
View file @
e651e1f
No preview for this file type
SwiftWarplyFramework/SwiftWarplyFramework/Main.storyboard
View file @
e651e1f
This diff is collapsed. Click to expand it.
SwiftWarplyFramework/SwiftWarplyFramework/PopupInfoViewController.swift
0 → 100644
View file @
e651e1f
//
// PopupInfoViewController.swift
// SwiftWarplyFramework
//
// Created by Manos Chorianopoulos on 16/10/24.
//
import
UIKit
class
PopupInfoViewController
:
UIViewController
{
@IBOutlet
weak
var
popupView
:
UIView
!
@IBOutlet
weak
var
headerLabel
:
UILabel
!
@IBOutlet
weak
var
headerCloseButton
:
UIButton
!
@IBOutlet
weak
var
infoLabel
:
UILabel
!
@IBOutlet
weak
var
submitButton
:
UIButton
!
override
func
viewDidLoad
()
{
super
.
viewDidLoad
()
// Add arrow programmatically
let
arrowSize
=
CGSize
(
width
:
30
,
height
:
15
)
// Width and height of the arrow
let
arrowView
=
ArrowView
(
frame
:
CGRect
(
x
:
(
self
.
view
.
frame
.
width
-
arrowSize
.
width
)
/
2
,
y
:
popupView
.
frame
.
minY
-
arrowSize
.
height
,
width
:
arrowSize
.
width
,
height
:
arrowSize
.
height
))
self
.
view
.
addSubview
(
arrowView
)
self
.
view
.
bringSubviewToFront
(
popupView
)
popupView
.
backgroundColor
=
UIColor
(
rgb
:
0xE6E6E6
)
popupView
.
layer
.
cornerRadius
=
14
// Add shadow
popupView
.
layer
.
shadowColor
=
UIColor
(
red
:
0.00
,
green
:
0.00
,
blue
:
0.00
,
alpha
:
0.57
)
.
cgColor
popupView
.
layer
.
shadowOffset
=
CGSize
(
width
:
0.0
,
height
:
3.0
)
popupView
.
layer
.
shadowOpacity
=
1.0
popupView
.
layer
.
shadowRadius
=
20.0
headerLabel
.
font
=
UIFont
(
name
:
"BTCosmo-Bold"
,
size
:
17
)
headerLabel
.
textColor
=
UIColor
(
rgb
:
0x212121
)
headerLabel
.
text
=
"SUPERMARKET DEALS"
headerCloseButton
.
setImage
(
UIImage
(
named
:
"ic_close_3.png"
,
in
:
MyEmptyClass
.
resourceBundle
(),
compatibleWith
:
nil
),
for
:
.
normal
)
headerCloseButton
.
imageView
?
.
layer
.
transform
=
CATransform3DMakeScale
(
1.5
,
1.5
,
1.5
)
infoLabel
.
font
=
UIFont
(
name
:
"PeridotPE-Regular"
,
size
:
16.0
)
infoLabel
.
textColor
=
UIColor
(
rgb
:
0x212121
)
infoLabel
.
text
=
"Δημιούργησε το δικό σου ενιαίο κουπόνι προσφορών, και εξαργύρωσέ το στα supermarket της επιλογής σου γρήγορα και εύκολα με ένα μόνο κωδικό κουπονιού!"
submitButton
.
titleLabel
?
.
font
=
UIFont
(
name
:
"PeridotPE-Bold"
,
size
:
14
)
submitButton
.
setTitle
(
"Τέλος"
,
for
:
.
normal
)
submitButton
.
setTitleColor
(
UIColor
(
rgb
:
0x212121
),
for
:
.
normal
)
submitButton
.
frame
.
size
.
width
=
submitButton
.
intrinsicContentSize
.
width
}
func
adaptivePresentationStyle
(
for
controller
:
UIPresentationController
)
->
UIModalPresentationStyle
{
return
UIModalPresentationStyle
.
none
}
func
adaptivePresentationStyle
(
for
controller
:
UIPresentationController
,
traitCollection
:
UITraitCollection
)
->
UIModalPresentationStyle
{
// return UIModalPresentationStyle.FullScreen
return
UIModalPresentationStyle
.
none
}
// MARK: - Actions
@IBAction
func
headerCloseButtonAction
(
_
sender
:
Any
)
{
self
.
dismiss
(
animated
:
true
,
completion
:
{})
}
@IBAction
func
submitButtonAction
(
_
sender
:
Any
)
{
self
.
dismiss
(
animated
:
true
,
completion
:
{})
}
}
class
ArrowView
:
UIView
{
override
init
(
frame
:
CGRect
)
{
super
.
init
(
frame
:
frame
)
self
.
backgroundColor
=
.
clear
}
required
init
?(
coder
:
NSCoder
)
{
super
.
init
(
coder
:
coder
)
self
.
backgroundColor
=
.
clear
}
override
func
draw
(
_
rect
:
CGRect
)
{
// Set up the context
guard
let
context
=
UIGraphicsGetCurrentContext
()
else
{
return
}
// Set the arrow color (can adjust as needed)
context
.
setFillColor
(
UIColor
(
rgb
:
0xE6E6E6
)
.
cgColor
)
// Create the arrow's path (a triangle)
let
path
=
UIBezierPath
()
path
.
move
(
to
:
CGPoint
(
x
:
rect
.
width
/
2
,
y
:
0
))
// Arrow top
path
.
addLine
(
to
:
CGPoint
(
x
:
rect
.
width
,
y
:
rect
.
height
))
// Bottom right
path
.
addLine
(
to
:
CGPoint
(
x
:
0
,
y
:
rect
.
height
))
// Bottom left
path
.
close
()
// Close the triangle
// Fill the arrow shape
context
.
addPath
(
path
.
cgPath
)
context
.
fillPath
()
}
}
SwiftWarplyFramework/SwiftWarplyFramework/UnifiedCouponsViewController.swift
View file @
e651e1f
...
...
@@ -71,6 +71,11 @@ import SwiftEventBus
setBackButton
()
setNavigationTitle
(
"SUPERMARKET DEALS"
)
// Setup the info button with an action
setNavBarRightInfoButton
()
{
// This closure is the action that will be executed when the info button is tapped
self
.
presentInfoPopup
()
}
// backgroundImage.image = UIImage(named: "coupons_scrollview_dark", in: MyEmptyClass.resourceBundle(), compatibleWith: nil)
...
...
@@ -175,6 +180,14 @@ import SwiftEventBus
handleSubmitButtonUI
()
}
private
func
presentInfoPopup
()
{
let
storyboard
=
UIStoryboard
(
name
:
"Main"
,
bundle
:
nil
)
if
let
popupVC
=
storyboard
.
instantiateViewController
(
withIdentifier
:
"PopupInfoViewController"
)
as?
PopupInfoViewController
{
popupVC
.
modalPresentationStyle
=
.
overCurrentContext
popupVC
.
modalTransitionStyle
=
.
crossDissolve
self
.
present
(
popupVC
,
animated
:
true
,
completion
:
nil
)
}
}
func
handleSubmitButtonUI
()
{
if
(
self
.
smCouponsSelected
.
count
>
0
)
{
...
...
SwiftWarplyFramework/SwiftWarplyFramework/ViewControllerExtensions.swift
View file @
e651e1f
...
...
@@ -93,6 +93,53 @@ extension UIViewController {
// self.dismiss(animated: true, completion: {})
}
// Define a typealias for the action closure
typealias
InfoButtonAction
=
()
->
Void
// Store the action closure
private
struct
AssociatedKeys
{
static
var
infoButtonAction
=
"infoButtonAction"
}
var
infoButtonAction
:
InfoButtonAction
?
{
get
{
return
objc_getAssociatedObject
(
self
,
&
AssociatedKeys
.
infoButtonAction
)
as?
InfoButtonAction
}
set
{
objc_setAssociatedObject
(
self
,
&
AssociatedKeys
.
infoButtonAction
,
newValue
,
.
OBJC_ASSOCIATION_RETAIN_NONATOMIC
)
}
}
func
setNavBarRightInfoButton
(
action
:
@escaping
InfoButtonAction
)
{
// Create a UIView for the custom info button
let
customInfoView
=
UIView
(
frame
:
CGRect
(
x
:
0
,
y
:
0
,
width
:
24
,
height
:
24
))
// Create the UIImageView for the custom info image
let
infoImageView
=
UIImageView
(
image
:
UIImage
(
named
:
"info_icon"
,
in
:
MyEmptyClass
.
resourceBundle
(),
compatibleWith
:
nil
))
// Your custom image
infoImageView
.
contentMode
=
.
scaleAspectFit
// Adjust to fit the image correctly
infoImageView
.
frame
=
customInfoView
.
bounds
// Set the image to fill the view
// Add the image view to the custom view
customInfoView
.
addSubview
(
infoImageView
)
// Set the action closure
self
.
infoButtonAction
=
action
// Add a tap gesture recognizer to handle the tap on the custom view
let
tapGesture
=
UITapGestureRecognizer
(
target
:
self
,
action
:
#selector(
infoButtonTapped
)
)
customInfoView
.
addGestureRecognizer
(
tapGesture
)
// Add the custom view to the navigation bar as a UIBarButtonItem
let
infoBarButtonItem
=
UIBarButtonItem
(
customView
:
customInfoView
)
self
.
navigationItem
.
rightBarButtonItem
=
infoBarButtonItem
}
// Action for the info button tap
@objc
private
func
infoButtonTapped
()
{
// Call the action closure if it's set
infoButtonAction
?()
}
func
addNavShadow
()
{
// Add shadow
self
.
navigationController
?
.
navigationBar
.
layer
.
masksToBounds
=
false
...
...
Please
register
or
login
to post a comment