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
2025-05-27 14:49:58 +0300
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
2e3234eacb6850062050c5751460de8558eb53c2
2e3234ea
1 parent
db0f7952
MyRewardsOffer delegate
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
37 additions
and
14 deletions
SwiftWarplyFramework/SwiftWarplyFramework.xcworkspace/xcuserdata/manos.xcuserdatad/UserInterfaceState.xcuserstate
SwiftWarplyFramework/SwiftWarplyFramework/cells/MyRewardsOffersScrollTableViewCell/MyRewardsOffersScrollTableViewCell.swift
SwiftWarplyFramework/SwiftWarplyFramework/screens/CouponViewController/CouponViewController.swift
SwiftWarplyFramework/SwiftWarplyFramework/screens/MyRewardsViewController/MyRewardsViewController.swift
SwiftWarplyFramework/SwiftWarplyFramework.xcworkspace/xcuserdata/manos.xcuserdatad/UserInterfaceState.xcuserstate
View file @
2e3234e
No preview for this file type
SwiftWarplyFramework/SwiftWarplyFramework/cells/MyRewardsOffersScrollTableViewCell/MyRewardsOffersScrollTableViewCell.swift
View file @
2e3234e
...
...
@@ -7,6 +7,10 @@
import
UIKit
protocol
MyRewardsOffersScrollTableViewCellDelegate
:
AnyObject
{
func
didSelectOffer
(
_
offer
:
OfferModel
)
}
@objc
public
class
MyRewardsOffersScrollTableViewCell
:
UITableViewCell
{
@IBOutlet
weak
var
categoryLabel
:
UILabel
!
@IBOutlet
weak
var
allButtonView
:
UIView
!
...
...
@@ -14,6 +18,7 @@ import UIKit
@IBOutlet
weak
var
collectionView
:
UICollectionView
!
@IBOutlet
weak
var
collectionViewHeightConstraint
:
NSLayoutConstraint
!
weak
var
delegate
:
MyRewardsOffersScrollTableViewCellDelegate
?
var
data
:
SectionModel
?
public
override
func
awakeFromNib
()
{
...
...
@@ -106,7 +111,7 @@ import UIKit
}
}
extension
MyRewardsOffersScrollTableViewCell
:
UICollectionViewDataSource
,
UICollectionViewDelegate
,
UICollectionViewDelegateFlowLayout
{
extension
MyRewardsOffersScrollTableViewCell
:
UICollectionViewDataSource
,
UICollectionViewDelegate
,
UICollectionViewDelegateFlowLayout
{
public
func
numberOfSections
(
in
collectionView
:
UICollectionView
)
->
Int
{
...
...
@@ -127,7 +132,9 @@ extension MyRewardsOffersScrollTableViewCell: UICollectionViewDataSource, UICol
}
public
func
collectionView
(
_
collectionView
:
UICollectionView
,
didSelectItemAt
indexPath
:
IndexPath
)
{
// TODO: open offer
if
let
offer
=
self
.
data
?
.
offers
[
indexPath
.
row
]
{
delegate
?
.
didSelectOffer
(
offer
)
}
}
// MARK: - UICollectionViewDelegateFlowLayout
...
...
SwiftWarplyFramework/SwiftWarplyFramework/screens/CouponViewController/CouponViewController.swift
View file @
2e3234e
...
...
@@ -8,22 +8,22 @@
import
UIKit
@objc
public
class
CouponViewController
:
UIViewController
{
var
coupon
:
OfferModel
?
public
override
func
viewDidLoad
()
{
super
.
viewDidLoad
()
// Do any additional setup after loading the view.
// Show navigation bar for this screen (with back button)
self
.
navigationController
?
.
setNavigationBarHidden
(
false
,
animated
:
false
)
// Configure the view with offer data
if
let
offer
=
coupon
{
setupUI
(
with
:
offer
)
}
}
/*
// MARK: - Navigation
// In a storyboard-based application, you will often want to do a little preparation before navigation
override func prepare(for segue: UIStoryboardSegue, sender: Any?) {
// Get the new view controller using segue.destination.
// Pass the selected object to the new view controller.
private
func
setupUI
(
with
coupon
:
OfferModel
)
{
// Set up the UI based on the offer data
}
*/
}
...
...
SwiftWarplyFramework/SwiftWarplyFramework/screens/MyRewardsViewController/MyRewardsViewController.swift
View file @
2e3234e
...
...
@@ -423,7 +423,6 @@ struct OfferModel {
self
.
tableView
.
reloadData
()
}
// Add navigation method
private
func
openCampaignViewController
(
with
offer
:
OfferModel
)
{
let
storyboard
=
UIStoryboard
(
name
:
"Main"
,
bundle
:
Bundle
(
for
:
MyEmptyClass
.
self
))
...
...
@@ -434,6 +433,13 @@ struct OfferModel {
// self.present(vc, animated: true)
}
}
private
func
openCouponViewController
(
with
offer
:
OfferModel
)
{
let
vc
=
SwiftWarplyFramework
.
CouponViewController
(
nibName
:
"CouponViewController"
,
bundle
:
Bundle
(
for
:
MyEmptyClass
.
self
))
vc
.
coupon
=
offer
self
.
navigationController
?
.
pushViewController
(
vc
,
animated
:
true
)
}
}
// MARK: - TableView
...
...
@@ -471,7 +477,7 @@ extension MyRewardsViewController: UITableViewDelegate, UITableViewDataSource{
public
func
tableView
(
_
tableView
:
UITableView
,
cellForRowAt
indexPath
:
IndexPath
)
->
UITableViewCell
{
if
(
indexPath
.
section
==
0
)
{
let
cell
=
tableView
.
dequeueReusableCell
(
withIdentifier
:
"MyRewardsBannerOffersScrollTableViewCell"
,
for
:
indexPath
)
as!
MyRewardsBannerOffersScrollTableViewCell
cell
.
delegate
=
self
cell
.
delegate
=
self
// Set the banner offers delegate
cell
.
configureCell
(
data
:
self
.
bannerOffersSection
)
// cell.parent = self
return
cell
...
...
@@ -479,6 +485,8 @@ extension MyRewardsViewController: UITableViewDelegate, UITableViewDataSource{
}
else
{
let
cell
=
tableView
.
dequeueReusableCell
(
withIdentifier
:
"MyRewardsOffersScrollTableViewCell"
,
for
:
indexPath
)
as!
MyRewardsOffersScrollTableViewCell
cell
.
delegate
=
self
// Set the offers delegate
if
(
indexPath
.
section
==
1
)
{
cell
.
configureCell
(
data
:
self
.
topOffersSection
)
}
else
if
(
indexPath
.
section
==
2
)
{
...
...
@@ -533,3 +541,11 @@ extension MyRewardsViewController: MyRewardsBannerOffersScrollTableViewCellDeleg
openCampaignViewController
(
with
:
offer
)
}
}
// Add delegate conformance
extension
MyRewardsViewController
:
MyRewardsOffersScrollTableViewCellDelegate
{
func
didSelectOffer
(
_
offer
:
OfferModel
)
{
// Navigate to CouponViewController
openCouponViewController
(
with
:
offer
)
}
}
...
...
Please
register
or
login
to post a comment