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-07-23 17:00:17 +0300
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
c8ea360ae869486f7ee78f2b516af0664ef4bbf9
c8ea360a
1 parent
f983acda
MyRewards dynamic profile info
Hide whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
376 additions
and
14 deletions
SwiftWarplyFramework/Pods/Pods.xcodeproj/xcuserdata/manos.xcuserdatad/xcschemes/xcschememanagement.plist
SwiftWarplyFramework/SwiftWarplyFramework.xcodeproj/project.pbxproj
SwiftWarplyFramework/SwiftWarplyFramework.xcodeproj/xcuserdata/manos.xcuserdatad/xcschemes/xcschememanagement.plist
SwiftWarplyFramework/SwiftWarplyFramework.xcworkspace/xcuserdata/manos.xcuserdatad/UserInterfaceState.xcuserstate
SwiftWarplyFramework/SwiftWarplyFramework/cells/MyRewardsBannerOffersScrollTableViewCell/MyRewardsBannerOffersScrollTableViewCell.swift
SwiftWarplyFramework/SwiftWarplyFramework/cells/MyRewardsBannerOffersScrollTableViewCell/MyRewardsBannerOffersScrollTableViewCell.xib
SwiftWarplyFramework/SwiftWarplyFramework/cells/MyRewardsProfileInfoTableViewCell/MyRewardsProfileInfoTableViewCell.swift
SwiftWarplyFramework/SwiftWarplyFramework/cells/MyRewardsProfileInfoTableViewCell/MyRewardsProfileInfoTableViewCell.xib
SwiftWarplyFramework/SwiftWarplyFramework/models/SectionModel.swift
SwiftWarplyFramework/SwiftWarplyFramework/screens/MyRewardsViewController/MyRewardsViewController.swift
SwiftWarplyFramework/Pods/Pods.xcodeproj/xcuserdata/manos.xcuserdatad/xcschemes/xcschememanagement.plist
View file @
c8ea360
...
...
@@ -7,7 +7,7 @@
<key>
Pods-SwiftWarplyFramework.xcscheme_^#shared#^_
</key>
<dict>
<key>
orderHint
</key>
<integer>
0
</integer>
<integer>
1
</integer>
</dict>
</dict>
</dict>
...
...
SwiftWarplyFramework/SwiftWarplyFramework.xcodeproj/project.pbxproj
View file @
c8ea360
...
...
@@ -40,6 +40,8 @@
1E4C4CFB2DE6014500279AAD /* CopyableLabel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1E4C4CFA2DE6014500279AAD /* CopyableLabel.swift */; };
1E64E1832DE48E0600543217 /* MyRewardsOfferCollectionViewCell.xib in Resources */ = {isa = PBXBuildFile; fileRef = 1E64E1822DE48E0600543217 /* MyRewardsOfferCollectionViewCell.xib */; };
1E64E1842DE48E0600543217 /* MyRewardsOfferCollectionViewCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1E64E1812DE48E0600543217 /* MyRewardsOfferCollectionViewCell.swift */; };
1E66E4972E30F9F200BCEF9D /* MyRewardsProfileInfoTableViewCell.xib in Resources */ = {isa = PBXBuildFile; fileRef = 1E66E4962E30F9F200BCEF9D /* MyRewardsProfileInfoTableViewCell.xib */; };
1E66E4982E30F9F200BCEF9D /* MyRewardsProfileInfoTableViewCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1E66E4952E30F9F200BCEF9D /* MyRewardsProfileInfoTableViewCell.swift */; };
1E917CD62DDF64B2002221D8 /* MyRewardsViewController.xib in Resources */ = {isa = PBXBuildFile; fileRef = 1E917CD52DDF64B2002221D8 /* MyRewardsViewController.xib */; };
1E917CD72DDF64B2002221D8 /* MyRewardsViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1E917CD42DDF64B2002221D8 /* MyRewardsViewController.swift */; };
1E917CDB2DDF68C7002221D8 /* CouponViewController.xib in Resources */ = {isa = PBXBuildFile; fileRef = 1E917CDA2DDF68C7002221D8 /* CouponViewController.xib */; };
...
...
@@ -116,6 +118,8 @@
1E4C4CFA2DE6014500279AAD /* CopyableLabel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CopyableLabel.swift; sourceTree = "<group>"; };
1E64E1812DE48E0600543217 /* MyRewardsOfferCollectionViewCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MyRewardsOfferCollectionViewCell.swift; sourceTree = "<group>"; };
1E64E1822DE48E0600543217 /* MyRewardsOfferCollectionViewCell.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; path = MyRewardsOfferCollectionViewCell.xib; sourceTree = "<group>"; };
1E66E4952E30F9F200BCEF9D /* MyRewardsProfileInfoTableViewCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MyRewardsProfileInfoTableViewCell.swift; sourceTree = "<group>"; };
1E66E4962E30F9F200BCEF9D /* MyRewardsProfileInfoTableViewCell.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; path = MyRewardsProfileInfoTableViewCell.xib; sourceTree = "<group>"; };
1E917CD42DDF64B2002221D8 /* MyRewardsViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MyRewardsViewController.swift; sourceTree = "<group>"; };
1E917CD52DDF64B2002221D8 /* MyRewardsViewController.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; path = MyRewardsViewController.xib; sourceTree = "<group>"; };
1E917CD92DDF68C7002221D8 /* CouponViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CouponViewController.swift; sourceTree = "<group>"; };
...
...
@@ -276,6 +280,15 @@
path = MyRewardsOfferCollectionViewCell;
sourceTree = "<group>";
};
1E66E4942E30F8C600BCEF9D /* MyRewardsProfileInfoTableViewCell */ = {
isa = PBXGroup;
children = (
1E66E4952E30F9F200BCEF9D /* MyRewardsProfileInfoTableViewCell.swift */,
1E66E4962E30F9F200BCEF9D /* MyRewardsProfileInfoTableViewCell.xib */,
);
path = MyRewardsProfileInfoTableViewCell;
sourceTree = "<group>";
};
1E917CD32DDF6472002221D8 /* MyRewardsViewController */ = {
isa = PBXGroup;
children = (
...
...
@@ -326,6 +339,7 @@
1ED41E492DE0C21800836ABA /* MyRewardsBannerOfferCollectionViewCell */,
1EB4F4282DE0A09500D934C0 /* MyRewardsOffersScrollTableViewCell */,
1EB4F4222DE09A4300D934C0 /* MyRewardsBannerOffersScrollTableViewCell */,
1E66E4942E30F8C600BCEF9D /* MyRewardsProfileInfoTableViewCell */,
);
path = cells;
sourceTree = "<group>";
...
...
@@ -588,6 +602,7 @@
1EA8E5C12DDF427A00CD3418 /* PingLCG-Light.otf in Resources */,
1EA8E5C22DDF427A00CD3418 /* PingLCG-Regular.otf in Resources */,
1EB4F42B2DE0A0AF00D934C0 /* MyRewardsOffersScrollTableViewCell.xib in Resources */,
1E66E4972E30F9F200BCEF9D /* MyRewardsProfileInfoTableViewCell.xib in Resources */,
1EDBAF102DE8443B00911E79 /* ProfileHeaderTableViewCell.xib in Resources */,
1E917CDB2DDF68C7002221D8 /* CouponViewController.xib in Resources */,
1E917CE02DDF6909002221D8 /* ProfileViewController.xib in Resources */,
...
...
@@ -668,6 +683,7 @@
E6A77853282933340045BBA8 /* SwiftWarplyFramework.docc in Sources */,
1EDBAF092DE843FB00911E79 /* ProfileCouponFiltersTableViewCell.swift in Sources */,
E6A778DF282933E60045BBA8 /* WarplyReactMethods.m in Sources */,
1E66E4982E30F9F200BCEF9D /* MyRewardsProfileInfoTableViewCell.swift in Sources */,
1E917CD72DDF64B2002221D8 /* MyRewardsViewController.swift in Sources */,
1E917CDC2DDF68C7002221D8 /* CouponViewController.swift in Sources */,
1E4C4CFB2DE6014500279AAD /* CopyableLabel.swift in Sources */,
...
...
SwiftWarplyFramework/SwiftWarplyFramework.xcodeproj/xcuserdata/manos.xcuserdatad/xcschemes/xcschememanagement.plist
View file @
c8ea360
...
...
@@ -7,7 +7,7 @@
<key>
SwiftWarplyFramework.xcscheme_^#shared#^_
</key>
<dict>
<key>
orderHint
</key>
<integer>
1
</integer>
<integer>
0
</integer>
</dict>
</dict>
</dict>
...
...
SwiftWarplyFramework/SwiftWarplyFramework.xcworkspace/xcuserdata/manos.xcuserdatad/UserInterfaceState.xcuserstate
View file @
c8ea360
No preview for this file type
SwiftWarplyFramework/SwiftWarplyFramework/cells/MyRewardsBannerOffersScrollTableViewCell/MyRewardsBannerOffersScrollTableViewCell.swift
View file @
c8ea360
...
...
@@ -9,7 +9,7 @@ import UIKit
protocol
MyRewardsBannerOffersScrollTableViewCellDelegate
:
AnyObject
{
func
didSelectBannerOffer
(
_
index
:
Int
)
func
didTapProfileButton
()
//
func didTapProfileButton()
}
@objc(MyRewardsBannerOffersScrollTableViewCell)
...
...
@@ -103,7 +103,7 @@ public class MyRewardsBannerOffersScrollTableViewCell: UITableViewCell {
@objc
private
func
profileButtonTapped
()
{
// TODO: UNCOMMENT
delegate
?
.
didTapProfileButton
()
//
delegate?.didTapProfileButton()
}
}
...
...
SwiftWarplyFramework/SwiftWarplyFramework/cells/MyRewardsBannerOffersScrollTableViewCell/MyRewardsBannerOffersScrollTableViewCell.xib
View file @
c8ea360
...
...
@@ -17,7 +17,7 @@
<autoresizingMask
key=
"autoresizingMask"
/>
<subviews>
<view
contentMode=
"scaleToFill"
translatesAutoresizingMaskIntoConstraints=
"NO"
id=
"VzF-dQ-3Wa"
userLabel=
"Parent View"
>
<rect
key=
"frame"
x=
"0.0"
y=
"0.0"
width=
"413"
height=
"
465
"
/>
<rect
key=
"frame"
x=
"0.0"
y=
"0.0"
width=
"413"
height=
"
349
"
/>
<subviews>
<view
contentMode=
"scaleToFill"
translatesAutoresizingMaskIntoConstraints=
"NO"
id=
"JTs-J5-DO2"
userLabel=
"Top View"
>
<rect
key=
"frame"
x=
"24"
y=
"36"
width=
"365"
height=
"35"
/>
...
...
@@ -106,7 +106,7 @@
</constraints>
</view>
<collectionView
clipsSubviews=
"YES"
multipleTouchEnabled=
"YES"
contentMode=
"scaleToFill"
showsHorizontalScrollIndicator=
"NO"
showsVerticalScrollIndicator=
"NO"
dataMode=
"none"
translatesAutoresizingMaskIntoConstraints=
"NO"
id=
"I7z-Fz-SNP"
>
<rect
key=
"frame"
x=
"0.0"
y=
"
91
"
width=
"413"
height=
"348"
/>
<rect
key=
"frame"
x=
"0.0"
y=
"
-25
"
width=
"413"
height=
"348"
/>
<color
key=
"backgroundColor"
white=
"1"
alpha=
"1"
colorSpace=
"custom"
customColorSpace=
"genericGamma22GrayColorSpace"
/>
<constraints>
<constraint
firstAttribute=
"height"
constant=
"348"
id=
"aEf-Xl-A2C"
/>
...
...
@@ -124,7 +124,7 @@
</connections>
</collectionView>
<pageControl
opaque=
"NO"
contentMode=
"scaleToFill"
contentHorizontalAlignment=
"center"
contentVerticalAlignment=
"center"
numberOfPages=
"3"
translatesAutoresizingMaskIntoConstraints=
"NO"
id=
"lOm-CZ-dVG"
>
<rect
key=
"frame"
x=
"170"
y=
"
439
"
width=
"73"
height=
"26"
/>
<rect
key=
"frame"
x=
"170"
y=
"
323
"
width=
"73"
height=
"26"
/>
</pageControl>
</subviews>
<color
key=
"backgroundColor"
white=
"0.0"
alpha=
"0.0"
colorSpace=
"custom"
customColorSpace=
"genericGamma22GrayColorSpace"
/>
...
...
@@ -136,9 +136,14 @@
<constraint
firstAttribute=
"trailing"
secondItem=
"JTs-J5-DO2"
secondAttribute=
"trailing"
constant=
"24"
id=
"Rdi-FK-2Ft"
/>
<constraint
firstAttribute=
"trailing"
secondItem=
"I7z-Fz-SNP"
secondAttribute=
"trailing"
id=
"avB-Gc-ttI"
/>
<constraint
firstItem=
"I7z-Fz-SNP"
firstAttribute=
"leading"
secondItem=
"VzF-dQ-3Wa"
secondAttribute=
"leading"
id=
"pTY-7d-s1S"
/>
<constraint
firstItem=
"I7z-Fz-SNP"
firstAttribute=
"top"
secondItem=
"
JTs-J5-DO2"
secondAttribute=
"bottom
"
constant=
"20"
id=
"vJF-jy-p83"
/>
<constraint
firstItem=
"I7z-Fz-SNP"
firstAttribute=
"top"
secondItem=
"
VzF-dQ-3Wa"
secondAttribute=
"top
"
constant=
"20"
id=
"vJF-jy-p83"
/>
<constraint
firstItem=
"lOm-CZ-dVG"
firstAttribute=
"centerX"
secondItem=
"VzF-dQ-3Wa"
secondAttribute=
"centerX"
id=
"xpw-tV-NcW"
/>
</constraints>
<variation
key=
"default"
>
<mask
key=
"subviews"
>
<exclude
reference=
"JTs-J5-DO2"
/>
</mask>
</variation>
</view>
</subviews>
<color
key=
"backgroundColor"
white=
"0.0"
alpha=
"0.0"
colorSpace=
"custom"
customColorSpace=
"genericGamma22GrayColorSpace"
/>
...
...
SwiftWarplyFramework/SwiftWarplyFramework/cells/MyRewardsProfileInfoTableViewCell/MyRewardsProfileInfoTableViewCell.swift
0 → 100644
View file @
c8ea360
//
// MyRewardsProfileInfoTableViewCell.swift
// SwiftWarplyFramework
//
// Created by Manos Chorianopoulos on 23/7/25.
//
import
UIKit
protocol
MyRewardsProfileInfoTableViewCellDelegate
:
AnyObject
{
func
didTapProfileButton
()
}
@objc(MyRewardsProfileInfoTableViewCell)
public
class
MyRewardsProfileInfoTableViewCell
:
UITableViewCell
{
@IBOutlet
weak
var
tagView1
:
UIView
!
@IBOutlet
weak
var
tagLabel1
:
UILabel
!
@IBOutlet
weak
var
tagView2
:
UIView
!
@IBOutlet
weak
var
tagLabel2
:
UILabel
!
@IBOutlet
weak
var
profileImage
:
UIImageView
!
@IBOutlet
weak
var
profileButton
:
UIButton
!
weak
var
delegate
:
MyRewardsProfileInfoTableViewCellDelegate
?
// MARK: - Properties
private
var
profileModel
:
ProfileModel
?
public
override
func
awakeFromNib
()
{
super
.
awakeFromNib
()
// Initialization code
profileImage
.
image
=
UIImage
(
named
:
"profile_pic_default"
,
in
:
Bundle
.
frameworkResourceBundle
,
compatibleWith
:
nil
)
profileButton
.
addTarget
(
self
,
action
:
#selector(
profileButtonTapped
)
,
for
:
.
touchUpInside
)
tagView1
.
backgroundColor
=
UIColor
(
rgb
:
0x09914E
)
tagView1
.
layer
.
cornerRadius
=
4.0
tagLabel1
.
font
=
UIFont
(
name
:
"PingLCG-Regular"
,
size
:
17
)
tagLabel1
.
textColor
=
UIColor
(
rgb
:
0xFFFFFF
)
tagView2
.
backgroundColor
=
UIColor
(
rgb
:
0xFC9F25
)
tagView2
.
layer
.
cornerRadius
=
4.0
tagLabel2
.
font
=
UIFont
(
name
:
"PingLCG-Regular"
,
size
:
17
)
tagLabel2
.
textColor
=
UIColor
(
rgb
:
0xFFFFFF
)
}
public
override
func
setSelected
(
_
selected
:
Bool
,
animated
:
Bool
)
{
super
.
setSelected
(
selected
,
animated
:
animated
)
// Configure the view for the selected state
}
@objc
private
func
profileButtonTapped
()
{
delegate
?
.
didTapProfileButton
()
}
// MARK: - Configuration Methods
public
func
configureCell
(
data
:
SectionModel
?)
{
guard
let
data
=
data
,
let
itemType
=
data
.
itemType
,
itemType
==
.
profile
else
{
configureDefaultState
()
return
}
// Check if we have real profile data
if
let
metadata
=
data
.
metadata
,
let
profile
=
metadata
[
"profile"
]
as?
ProfileModel
{
// Configure with real profile data
configureCell
(
profile
:
profile
)
}
else
{
// Configure with default state (no profile data)
configureDefaultState
()
}
}
public
func
configureCell
(
profile
:
ProfileModel
)
{
self
.
profileModel
=
profile
// TODO: Configure tag labels with profile data
// We need to determine what data should populate tagView1 and tagView2
// Possible options from ProfileModel:
// - _user_points (loyalty points)
// - _badge (user badge/tier)
// - _verified (verification status)
// - Custom business logic based on profile data
// For now, keep tags visible with current static styling
tagView1
.
isHidden
=
false
tagView2
.
isHidden
=
false
// Load profile image if available
if
!
profile
.
_image_url
.
isEmpty
{
loadProfileImage
(
from
:
profile
.
_image_url
)
}
else
{
profileImage
.
image
=
UIImage
(
named
:
"profile_pic_default"
,
in
:
Bundle
.
frameworkResourceBundle
,
compatibleWith
:
nil
)
}
}
private
func
configureDefaultState
()
{
// Default state: no profile data available
self
.
profileModel
=
nil
// Keep tags visible even in default state
tagView1
.
isHidden
=
false
tagView2
.
isHidden
=
false
profileImage
.
image
=
UIImage
(
named
:
"profile_pic_default"
,
in
:
Bundle
.
frameworkResourceBundle
,
compatibleWith
:
nil
)
}
private
func
loadProfileImage
(
from
urlString
:
String
)
{
// For now, use default image - can be enhanced later with URL loading
profileImage
.
image
=
UIImage
(
named
:
"profile_pic_default"
,
in
:
Bundle
.
frameworkResourceBundle
,
compatibleWith
:
nil
)
}
}
SwiftWarplyFramework/SwiftWarplyFramework/cells/MyRewardsProfileInfoTableViewCell/MyRewardsProfileInfoTableViewCell.xib
0 → 100644
View file @
c8ea360
<?xml version="1.0" encoding="UTF-8"?>
<document
type=
"com.apple.InterfaceBuilder3.CocoaTouch.XIB"
version=
"3.0"
toolsVersion=
"23094"
targetRuntime=
"iOS.CocoaTouch"
propertyAccessControl=
"none"
useAutolayout=
"YES"
useTraitCollections=
"YES"
useSafeAreas=
"YES"
colorMatched=
"YES"
>
<device
id=
"retina6_12"
orientation=
"portrait"
appearance=
"light"
/>
<dependencies>
<plugIn
identifier=
"com.apple.InterfaceBuilder.IBCocoaTouchPlugin"
version=
"23084"
/>
<capability
name=
"Safe area layout guides"
minToolsVersion=
"9.0"
/>
<capability
name=
"documents saved in the Xcode 8 format"
minToolsVersion=
"8.0"
/>
</dependencies>
<objects>
<placeholder
placeholderIdentifier=
"IBFilesOwner"
id=
"-1"
userLabel=
"File's Owner"
/>
<placeholder
placeholderIdentifier=
"IBFirstResponder"
id=
"-2"
customClass=
"UIResponder"
/>
<tableViewCell
contentMode=
"scaleToFill"
selectionStyle=
"default"
indentationWidth=
"10"
reuseIdentifier=
"MyRewardsProfileInfoTableViewCell"
rowHeight=
"141"
id=
"KGk-i7-Jjw"
customClass=
"MyRewardsProfileInfoTableViewCell"
>
<rect
key=
"frame"
x=
"0.0"
y=
"0.0"
width=
"318"
height=
"141"
/>
<autoresizingMask
key=
"autoresizingMask"
flexibleMaxX=
"YES"
flexibleMaxY=
"YES"
/>
<tableViewCellContentView
key=
"contentView"
opaque=
"NO"
clipsSubviews=
"YES"
multipleTouchEnabled=
"YES"
contentMode=
"center"
tableViewCell=
"KGk-i7-Jjw"
id=
"H2p-sc-9uM"
>
<rect
key=
"frame"
x=
"0.0"
y=
"0.0"
width=
"318"
height=
"141"
/>
<autoresizingMask
key=
"autoresizingMask"
/>
<subviews>
<view
contentMode=
"scaleToFill"
translatesAutoresizingMaskIntoConstraints=
"NO"
id=
"GrG-Na-dBF"
userLabel=
"Parent View"
>
<rect
key=
"frame"
x=
"0.0"
y=
"0.0"
width=
"318"
height=
"130.33333333333334"
/>
<subviews>
<view
contentMode=
"scaleToFill"
translatesAutoresizingMaskIntoConstraints=
"NO"
id=
"Uzq-sj-DeG"
userLabel=
"Top View"
>
<rect
key=
"frame"
x=
"24"
y=
"35.999999999999993"
width=
"270"
height=
"94.333333333333314"
/>
<subviews>
<view
contentMode=
"scaleToFill"
translatesAutoresizingMaskIntoConstraints=
"NO"
id=
"iZR-9I-qrq"
>
<rect
key=
"frame"
x=
"0.0"
y=
"34.333333333333329"
width=
"58"
height=
"26"
/>
<subviews>
<label
opaque=
"NO"
userInteractionEnabled=
"NO"
contentMode=
"left"
horizontalHuggingPriority=
"251"
verticalHuggingPriority=
"251"
text=
"Green"
textAlignment=
"natural"
lineBreakMode=
"tailTruncation"
baselineAdjustment=
"alignBaselines"
adjustsFontSizeToFit=
"NO"
translatesAutoresizingMaskIntoConstraints=
"NO"
id=
"HbR-qg-oZj"
>
<rect
key=
"frame"
x=
"6"
y=
"3"
width=
"46"
height=
"20"
/>
<color
key=
"backgroundColor"
white=
"0.0"
alpha=
"0.0"
colorSpace=
"custom"
customColorSpace=
"genericGamma22GrayColorSpace"
/>
<fontDescription
key=
"fontDescription"
name=
"HelveticaNeue"
family=
"Helvetica Neue"
pointSize=
"17"
/>
<nil
key=
"textColor"
/>
<nil
key=
"highlightedColor"
/>
</label>
</subviews>
<color
key=
"backgroundColor"
red=
"0.035294117649999998"
green=
"0.56862745100000001"
blue=
"0.30588235289999999"
alpha=
"1"
colorSpace=
"calibratedRGB"
/>
<constraints>
<constraint
firstAttribute=
"trailing"
secondItem=
"HbR-qg-oZj"
secondAttribute=
"trailing"
constant=
"6"
id=
"D5p-jO-24v"
/>
<constraint
firstItem=
"HbR-qg-oZj"
firstAttribute=
"leading"
secondItem=
"iZR-9I-qrq"
secondAttribute=
"leading"
constant=
"6"
id=
"LFh-ia-T2B"
/>
<constraint
firstItem=
"HbR-qg-oZj"
firstAttribute=
"top"
secondItem=
"iZR-9I-qrq"
secondAttribute=
"top"
constant=
"3"
id=
"RhN-3V-CNu"
/>
<constraint
firstAttribute=
"bottom"
secondItem=
"HbR-qg-oZj"
secondAttribute=
"bottom"
constant=
"3"
id=
"aPc-Uy-H9c"
/>
</constraints>
</view>
<view
contentMode=
"scaleToFill"
translatesAutoresizingMaskIntoConstraints=
"NO"
id=
"uq8-95-vyl"
>
<rect
key=
"frame"
x=
"66"
y=
"34.333333333333329"
width=
"61.666666666666657"
height=
"26"
/>
<subviews>
<label
opaque=
"NO"
userInteractionEnabled=
"NO"
contentMode=
"left"
horizontalHuggingPriority=
"251"
verticalHuggingPriority=
"251"
text=
"Family"
textAlignment=
"natural"
lineBreakMode=
"tailTruncation"
baselineAdjustment=
"alignBaselines"
adjustsFontSizeToFit=
"NO"
translatesAutoresizingMaskIntoConstraints=
"NO"
id=
"UDU-LU-kJf"
>
<rect
key=
"frame"
x=
"6"
y=
"3"
width=
"49.666666666666664"
height=
"20"
/>
<color
key=
"backgroundColor"
white=
"0.0"
alpha=
"0.0"
colorSpace=
"custom"
customColorSpace=
"genericGamma22GrayColorSpace"
/>
<fontDescription
key=
"fontDescription"
name=
"HelveticaNeue"
family=
"Helvetica Neue"
pointSize=
"17"
/>
<nil
key=
"textColor"
/>
<nil
key=
"highlightedColor"
/>
</label>
</subviews>
<color
key=
"backgroundColor"
red=
"0.98823529409999999"
green=
"0.62352941179999999"
blue=
"0.1450980392"
alpha=
"1"
colorSpace=
"calibratedRGB"
/>
<constraints>
<constraint
firstAttribute=
"trailing"
secondItem=
"UDU-LU-kJf"
secondAttribute=
"trailing"
constant=
"6"
id=
"Ann-r9-abe"
/>
<constraint
firstItem=
"UDU-LU-kJf"
firstAttribute=
"top"
secondItem=
"uq8-95-vyl"
secondAttribute=
"top"
constant=
"3"
id=
"cUu-IO-JNt"
/>
<constraint
firstAttribute=
"bottom"
secondItem=
"UDU-LU-kJf"
secondAttribute=
"bottom"
constant=
"3"
id=
"dIU-Z8-BrZ"
/>
<constraint
firstItem=
"UDU-LU-kJf"
firstAttribute=
"leading"
secondItem=
"uq8-95-vyl"
secondAttribute=
"leading"
constant=
"6"
id=
"vb0-4P-dZE"
/>
</constraints>
</view>
<view
contentMode=
"scaleToFill"
translatesAutoresizingMaskIntoConstraints=
"NO"
id=
"D1N-l1-zYb"
>
<rect
key=
"frame"
x=
"227"
y=
"0.0"
width=
"43"
height=
"94.333333333333329"
/>
<subviews>
<imageView
clipsSubviews=
"YES"
userInteractionEnabled=
"NO"
contentMode=
"scaleAspectFit"
horizontalHuggingPriority=
"251"
verticalHuggingPriority=
"251"
translatesAutoresizingMaskIntoConstraints=
"NO"
id=
"ksj-lM-RAp"
>
<rect
key=
"frame"
x=
"0.0"
y=
"0.0"
width=
"43"
height=
"43"
/>
<color
key=
"backgroundColor"
white=
"0.0"
alpha=
"0.0"
colorSpace=
"custom"
customColorSpace=
"genericGamma22GrayColorSpace"
/>
<constraints>
<constraint
firstAttribute=
"width"
constant=
"43"
id=
"MsB-3N-rp3"
/>
<constraint
firstAttribute=
"height"
constant=
"43"
id=
"UVr-zI-nCH"
/>
</constraints>
</imageView>
<button
opaque=
"NO"
contentMode=
"scaleToFill"
contentHorizontalAlignment=
"center"
contentVerticalAlignment=
"center"
buttonType=
"system"
lineBreakMode=
"middleTruncation"
translatesAutoresizingMaskIntoConstraints=
"NO"
id=
"PEZ-e6-PaN"
userLabel=
"ProfileButton"
>
<rect
key=
"frame"
x=
"0.0"
y=
"0.0"
width=
"43"
height=
"94.333333333333329"
/>
<color
key=
"backgroundColor"
white=
"0.0"
alpha=
"0.0"
colorSpace=
"custom"
customColorSpace=
"genericGamma22GrayColorSpace"
/>
<state
key=
"normal"
title=
"Button"
/>
<buttonConfiguration
key=
"configuration"
style=
"plain"
title=
"Button"
>
<color
key=
"baseForegroundColor"
white=
"0.0"
alpha=
"0.0"
colorSpace=
"custom"
customColorSpace=
"genericGamma22GrayColorSpace"
/>
</buttonConfiguration>
</button>
</subviews>
<color
key=
"backgroundColor"
white=
"0.0"
alpha=
"0.0"
colorSpace=
"custom"
customColorSpace=
"genericGamma22GrayColorSpace"
/>
<constraints>
<constraint
firstAttribute=
"trailing"
secondItem=
"PEZ-e6-PaN"
secondAttribute=
"trailing"
id=
"0Bs-BN-BYr"
/>
<constraint
firstItem=
"ksj-lM-RAp"
firstAttribute=
"top"
secondItem=
"D1N-l1-zYb"
secondAttribute=
"top"
id=
"72b-ae-wwu"
/>
<constraint
firstItem=
"PEZ-e6-PaN"
firstAttribute=
"leading"
secondItem=
"D1N-l1-zYb"
secondAttribute=
"leading"
id=
"JDf-Bc-agp"
/>
<constraint
firstAttribute=
"bottom"
secondItem=
"ksj-lM-RAp"
secondAttribute=
"bottom"
id=
"JVS-lc-V1a"
/>
<constraint
firstAttribute=
"bottom"
secondItem=
"PEZ-e6-PaN"
secondAttribute=
"bottom"
id=
"UsX-dl-5BF"
/>
<constraint
firstAttribute=
"trailing"
secondItem=
"ksj-lM-RAp"
secondAttribute=
"trailing"
id=
"VMk-Qb-GcZ"
/>
<constraint
firstItem=
"ksj-lM-RAp"
firstAttribute=
"leading"
secondItem=
"D1N-l1-zYb"
secondAttribute=
"leading"
id=
"noX-0V-w67"
/>
<constraint
firstItem=
"PEZ-e6-PaN"
firstAttribute=
"top"
secondItem=
"D1N-l1-zYb"
secondAttribute=
"top"
id=
"zU6-UR-WGM"
/>
</constraints>
</view>
</subviews>
<color
key=
"backgroundColor"
white=
"0.0"
alpha=
"0.0"
colorSpace=
"custom"
customColorSpace=
"genericGamma22GrayColorSpace"
/>
<constraints>
<constraint
firstItem=
"D1N-l1-zYb"
firstAttribute=
"top"
secondItem=
"Uzq-sj-DeG"
secondAttribute=
"top"
id=
"2Pg-pB-HXM"
/>
<constraint
firstAttribute=
"trailing"
secondItem=
"D1N-l1-zYb"
secondAttribute=
"trailing"
id=
"TIg-op-IhZ"
/>
<constraint
firstItem=
"iZR-9I-qrq"
firstAttribute=
"centerY"
secondItem=
"Uzq-sj-DeG"
secondAttribute=
"centerY"
id=
"Xj6-Va-Vu6"
/>
<constraint
firstItem=
"uq8-95-vyl"
firstAttribute=
"leading"
secondItem=
"iZR-9I-qrq"
secondAttribute=
"trailing"
constant=
"8"
id=
"cFB-Jw-8CI"
/>
<constraint
firstItem=
"uq8-95-vyl"
firstAttribute=
"centerY"
secondItem=
"Uzq-sj-DeG"
secondAttribute=
"centerY"
id=
"lpD-GB-qJb"
/>
<constraint
firstItem=
"iZR-9I-qrq"
firstAttribute=
"leading"
secondItem=
"Uzq-sj-DeG"
secondAttribute=
"leading"
id=
"nqO-fC-fCW"
/>
<constraint
firstItem=
"D1N-l1-zYb"
firstAttribute=
"leading"
relation=
"greaterThanOrEqual"
secondItem=
"uq8-95-vyl"
secondAttribute=
"trailing"
constant=
"8"
id=
"yWz-PS-7AW"
/>
<constraint
firstAttribute=
"bottom"
secondItem=
"D1N-l1-zYb"
secondAttribute=
"bottom"
id=
"zP0-l8-HZz"
/>
</constraints>
</view>
</subviews>
<color
key=
"backgroundColor"
white=
"0.0"
alpha=
"0.0"
colorSpace=
"custom"
customColorSpace=
"genericGamma22GrayColorSpace"
/>
<constraints>
<constraint
firstAttribute=
"trailing"
secondItem=
"Uzq-sj-DeG"
secondAttribute=
"trailing"
constant=
"24"
id=
"6Cb-JD-fEd"
/>
<constraint
firstItem=
"Uzq-sj-DeG"
firstAttribute=
"top"
secondItem=
"GrG-Na-dBF"
secondAttribute=
"top"
constant=
"36"
id=
"a4m-JH-bDa"
/>
<constraint
firstItem=
"Uzq-sj-DeG"
firstAttribute=
"leading"
secondItem=
"GrG-Na-dBF"
secondAttribute=
"leading"
constant=
"24"
id=
"bJt-81-pTc"
/>
<constraint
firstAttribute=
"bottom"
secondItem=
"Uzq-sj-DeG"
secondAttribute=
"bottom"
id=
"cjl-n6-BBf"
/>
</constraints>
</view>
</subviews>
<color
key=
"backgroundColor"
white=
"0.0"
alpha=
"0.0"
colorSpace=
"custom"
customColorSpace=
"genericGamma22GrayColorSpace"
/>
<constraints>
<constraint
firstItem=
"GrG-Na-dBF"
firstAttribute=
"leading"
secondItem=
"H2p-sc-9uM"
secondAttribute=
"leading"
id=
"6vh-eL-qMw"
/>
<constraint
firstAttribute=
"trailing"
secondItem=
"GrG-Na-dBF"
secondAttribute=
"trailing"
id=
"Mhv-wX-J42"
/>
<constraint
firstAttribute=
"bottom"
secondItem=
"GrG-Na-dBF"
secondAttribute=
"bottom"
id=
"WfG-lv-Uw7"
/>
<constraint
firstItem=
"GrG-Na-dBF"
firstAttribute=
"top"
secondItem=
"H2p-sc-9uM"
secondAttribute=
"top"
id=
"iSV-2N-pbv"
/>
</constraints>
</tableViewCellContentView>
<viewLayoutGuide
key=
"safeArea"
id=
"njF-e1-oar"
/>
<color
key=
"backgroundColor"
white=
"0.0"
alpha=
"0.0"
colorSpace=
"custom"
customColorSpace=
"genericGamma22GrayColorSpace"
/>
<connections>
<outlet
property=
"profileButton"
destination=
"PEZ-e6-PaN"
id=
"FBL-8U-9OZ"
/>
<outlet
property=
"profileImage"
destination=
"ksj-lM-RAp"
id=
"lwv-9G-Mmy"
/>
<outlet
property=
"tagLabel1"
destination=
"HbR-qg-oZj"
id=
"Ggl-NO-w2a"
/>
<outlet
property=
"tagLabel2"
destination=
"UDU-LU-kJf"
id=
"Tc6-yb-xi1"
/>
<outlet
property=
"tagView1"
destination=
"iZR-9I-qrq"
id=
"EtM-Q0-Ru9"
/>
<outlet
property=
"tagView2"
destination=
"uq8-95-vyl"
id=
"mP6-vQ-GY6"
/>
</connections>
<point
key=
"canvasLocation"
x=
"41.221374045801525"
y=
"29.929577464788736"
/>
</tableViewCell>
</objects>
</document>
SwiftWarplyFramework/SwiftWarplyFramework/models/SectionModel.swift
View file @
c8ea360
...
...
@@ -11,6 +11,7 @@ import Foundation
// MARK: - Section Types
enum
SectionType
{
case
myRewardsProfileInfo
// MyRewardsProfileInfoTableViewCell
case
myRewardsBannerOffers
// MyRewardsBannerOffersScrollTableViewCell
case
myRewardsHorizontalCouponsets
// MyRewardsOffersScrollTableViewCell
case
profileHeader
// ProfileHeaderTableViewCell (no items)
...
...
@@ -21,6 +22,7 @@ enum SectionType {
}
enum
ItemType
{
case
profile
// ProfileModel
case
campaigns
// [CampaignItemModel]
case
couponSets
// [CouponSetItemModel]
case
coupons
// [CouponItemModel]
...
...
SwiftWarplyFramework/SwiftWarplyFramework/screens/MyRewardsViewController/MyRewardsViewController.swift
View file @
c8ea360
...
...
@@ -40,6 +40,10 @@ import UIKit
// Campaign data for banners
var
bannerCampaigns
:
[
CampaignItemModel
]
=
[]
// Profile data
var
profileModel
:
ProfileModel
?
var
profileSection
:
SectionModel
?
public
override
func
viewDidLoad
()
{
super
.
viewDidLoad
()
...
...
@@ -56,13 +60,18 @@ import UIKit
tableView
.
estimatedRowHeight
=
200
tableView
.
rowHeight
=
UITableView
.
automaticDimension
// Start with empty sections - will be populated dynamically by API calls
loadCampaigns
()
// Always create profile section first (with default state)
createDefaultProfileSection
()
// Load data
loadProfile
()
// Try to populate profile with real data
loadCampaigns
()
// Load campaigns
}
// NEW: Safe XIB registration method
private
func
registerTableViewCells
()
{
let
cellConfigs
=
[
(
"MyRewardsProfileInfoTableViewCell"
,
"MyRewardsProfileInfoTableViewCell"
),
(
"MyRewardsBannerOffersScrollTableViewCell"
,
"MyRewardsBannerOffersScrollTableViewCell"
),
(
"MyRewardsOffersScrollTableViewCell"
,
"MyRewardsOffersScrollTableViewCell"
)
]
...
...
@@ -127,6 +136,66 @@ import UIKit
}
}
// MARK: - Profile Loading
public
func
loadProfile
()
{
// Always attempt to load profile, regardless of authentication status
// If not authenticated, the API call will fail gracefully and we keep the default state
WarplySDK
.
shared
.
getProfile
{
[
weak
self
]
profile
in
guard
let
self
=
self
else
{
return
}
if
let
profile
=
profile
{
// Success: Update with real profile data
self
.
profileModel
=
profile
self
.
updateProfileSectionWithData
(
profile
)
print
(
"✅ [MyRewardsViewController] Profile loaded successfully"
)
}
else
{
// No profile data: Keep default state
print
(
"ℹ️ [MyRewardsViewController] No profile data received - keeping default state"
)
}
}
failureCallback
:
{
[
weak
self
]
errorCode
in
print
(
"⚠️ [MyRewardsViewController] Profile loading failed with error:
\(
errorCode
)
- keeping default state"
)
// Don't remove section - just keep the default state
// The profile section remains visible with default profile pic
}
}
private
func
createDefaultProfileSection
()
{
// Create profile section with default/empty state
let
defaultProfileSection
=
SectionModel
(
sectionType
:
.
myRewardsProfileInfo
,
title
:
nil
,
count
:
1
,
metadata
:
[
"profile"
:
nil
]
// nil profile = default state
)
// Always insert at index 0 (top of the list)
sections
.
insert
(
defaultProfileSection
,
at
:
0
)
profileSection
=
defaultProfileSection
}
private
func
updateProfileSectionWithData
(
_
profile
:
ProfileModel
)
{
// Create updated profile section with real data
let
updatedProfileSection
=
SectionModel
(
sectionType
:
.
myRewardsProfileInfo
,
title
:
nil
,
count
:
1
,
metadata
:
[
"profile"
:
profile
]
)
// Find and update the profile section
if
let
profileIndex
=
sections
.
firstIndex
(
where
:
{
$0
.
sectionType
==
.
myRewardsProfileInfo
})
{
sections
[
profileIndex
]
=
updatedProfileSection
profileSection
=
updatedProfileSection
// Reload only the profile section
DispatchQueue
.
main
.
async
{
self
.
tableView
.
reloadSections
(
IndexSet
(
integer
:
profileIndex
),
with
:
.
none
)
}
}
}
private
func
openCampaignViewController
(
with
index
:
Int
)
{
// Validate index bounds
guard
index
<
bannerCampaigns
.
count
else
{
...
...
@@ -203,6 +272,12 @@ extension MyRewardsViewController: UITableViewDelegate, UITableViewDataSource{
let
sectionModel
=
sections
[
indexPath
.
section
]
switch
sectionModel
.
sectionType
{
case
.
myRewardsProfileInfo
:
let
cell
=
tableView
.
dequeueReusableCell
(
withIdentifier
:
"MyRewardsProfileInfoTableViewCell"
,
for
:
indexPath
)
as!
MyRewardsProfileInfoTableViewCell
cell
.
delegate
=
self
cell
.
configureCell
(
data
:
sectionModel
)
return
cell
case
.
myRewardsBannerOffers
:
let
cell
=
tableView
.
dequeueReusableCell
(
withIdentifier
:
"MyRewardsBannerOffersScrollTableViewCell"
,
for
:
indexPath
)
as!
MyRewardsBannerOffersScrollTableViewCell
cell
.
delegate
=
self
...
...
@@ -232,16 +307,24 @@ extension MyRewardsViewController: UITableViewDelegate, UITableViewDataSource{
}
// Add delegate conformance
extension
MyRewardsViewController
:
MyRewardsProfileInfoTableViewCellDelegate
{
func
didTapProfileButton
()
{
// Navigate to ProfileViewController
openProfileViewController
()
}
}
// Add delegate conformance
extension
MyRewardsViewController
:
MyRewardsBannerOffersScrollTableViewCellDelegate
{
func
didSelectBannerOffer
(
_
index
:
Int
)
{
// Navigate to CampaignViewController
openCampaignViewController
(
with
:
index
)
}
func
didTapProfileButton
()
{
// Navigate to ProfileViewController
openProfileViewController
()
}
//
func didTapProfileButton() {
//
// Navigate to ProfileViewController
//
openProfileViewController()
//
}
}
// Add delegate conformance
...
...
Please
register
or
login
to post a comment