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
2022-09-02 12:32:52 +0300
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
85ae6e33e164a34e1a285717570dc54cf58795cf
85ae6e33
1 parent
ca48e0f8
add ContextualViewController
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
196 additions
and
2 deletions
SwiftWarplyFramework/SwiftWarplyFramework.xcodeproj/project.pbxproj
SwiftWarplyFramework/SwiftWarplyFramework.xcworkspace/xcuserdata/manos.xcuserdatad/UserInterfaceState.xcuserstate
SwiftWarplyFramework/SwiftWarplyFramework/ContextualViewController.swift
SwiftWarplyFramework/SwiftWarplyFramework/GiftsViewController.swift
SwiftWarplyFramework/SwiftWarplyFramework/MFYViewController.swift
SwiftWarplyFramework/SwiftWarplyFramework/Main.storyboard
SwiftWarplyFramework/SwiftWarplyFramework.xcodeproj/project.pbxproj
View file @
85ae6e3
...
...
@@ -14,6 +14,7 @@
1E108A9628A3F9280008B8E7 /* pf_square_sans_pro_bold.ttf in Resources */ = {isa = PBXBuildFile; fileRef = 1E108A9128A3F9280008B8E7 /* pf_square_sans_pro_bold.ttf */; };
1E2966EA2837A21D00F83FAC /* RSBarcodes_Swift in Frameworks */ = {isa = PBXBuildFile; productRef = 1E2966E92837A21D00F83FAC /* RSBarcodes_Swift */; };
1E74838D28378AF40042A589 /* CouponBarcodeViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1E74838C28378AF40042A589 /* CouponBarcodeViewController.swift */; };
1E87A9EF28C2021200C79F90 /* ContextualViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1E87A9EE28C2021200C79F90 /* ContextualViewController.swift */; };
1EA1AF0A2835346A008998AA /* CouponsTableViewCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1EA1AF092835346A008998AA /* CouponsTableViewCell.swift */; };
1EA2BB792865BFE8003F2AB0 /* InboxTableViewCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1EA2BB782865BFE8003F2AB0 /* InboxTableViewCell.swift */; };
1EB236AB28816B680063777A /* ShareViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1EB236AA28816B680063777A /* ShareViewController.swift */; };
...
...
@@ -169,6 +170,7 @@
1E108A9128A3F9280008B8E7 /* pf_square_sans_pro_bold.ttf */ = {isa = PBXFileReference; lastKnownFileType = file; path = pf_square_sans_pro_bold.ttf; sourceTree = "<group>"; };
1E108A9728A3FA9B0008B8E7 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist; path = Info.plist; sourceTree = "<group>"; };
1E74838C28378AF40042A589 /* CouponBarcodeViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CouponBarcodeViewController.swift; sourceTree = "<group>"; };
1E87A9EE28C2021200C79F90 /* ContextualViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ContextualViewController.swift; sourceTree = "<group>"; };
1EA1AF092835346A008998AA /* CouponsTableViewCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CouponsTableViewCell.swift; sourceTree = "<group>"; };
1EA2BB782865BFE8003F2AB0 /* InboxTableViewCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = InboxTableViewCell.swift; sourceTree = "<group>"; };
1EB236AA28816B680063777A /* ShareViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ShareViewController.swift; sourceTree = "<group>"; };
...
...
@@ -449,6 +451,7 @@
E6A77A35282BB4CB0045BBA8 /* MakeItAPresentViewController.swift */,
E6A7785A282933E40045BBA8 /* Helpers */,
E6A77861282933E50045BBA8 /* Main.storyboard */,
1E87A9EE28C2021200C79F90 /* ContextualViewController.swift */,
1EB236AA28816B680063777A /* ShareViewController.swift */,
1EB236AC28816C560063777A /* NumberPopupViewController.swift */,
1EB236AE28816CAB0063777A /* NumbersTableViewCell.swift */,
...
...
@@ -874,6 +877,7 @@
E6A778E2282933E60045BBA8 /* CouponsViewController.swift in Sources */,
E6A77930282933E70045BBA8 /* UIImageView+AFNetworking.m in Sources */,
E6A77900282933E60045BBA8 /* WLInboxItemViewController.m in Sources */,
1E87A9EF28C2021200C79F90 /* ContextualViewController.swift in Sources */,
E6A7793E282933E70045BBA8 /* AFHTTPSessionManager.m in Sources */,
E6A77933282933E70045BBA8 /* UIButton+AFNetworking.m in Sources */,
E6A77919282933E60045BBA8 /* Warply.m in Sources */,
...
...
SwiftWarplyFramework/SwiftWarplyFramework.xcworkspace/xcuserdata/manos.xcuserdatad/UserInterfaceState.xcuserstate
View file @
85ae6e3
No preview for this file type
SwiftWarplyFramework/SwiftWarplyFramework/ContextualViewController.swift
0 → 100644
View file @
85ae6e3
//
// ContextualViewController.swift
// SwiftWarplyFramework
//
// Created by Manos Chorianopoulos on 2/9/22.
//
import
UIKit
@objc
public
class
ContextualViewController
:
UIViewController
,
UIPopoverControllerDelegate
{
@IBOutlet
weak
var
mainView
:
UIView
!
@IBOutlet
weak
var
backgroundImage
:
UIImageView
!
@IBOutlet
weak
var
scrollView
:
UIScrollView
!
@IBOutlet
weak
var
scrollContentView
:
UIView
!
@IBOutlet
weak
var
couponImage
:
UIImageView
!
@IBOutlet
weak
var
couponImageHeight
:
NSLayoutConstraint
!
@IBOutlet
weak
var
nameLabel
:
UILabel
!
@IBOutlet
weak
var
descriptionLabel
:
UILabel
!
@IBOutlet
weak
var
redeemButton
:
UIButton
!
public
var
ccms
:
swiftApi
.
LoyaltyContextualOfferModel
?
var
selectedNumber
:
String
=
""
public
var
numbersList
:
Array
<
String
>
=
[]
let
uiscreen
:
CGRect
=
UIScreen
.
main
.
bounds
public
override
func
viewDidLoad
()
{
super
.
viewDidLoad
()
self
.
hidesBottomBarWhenPushed
=
true
// Do any additional setup after loading the view.
getProfileRequest
()
setBackButton
()
// setNavigationTitle("")
backgroundImage
.
image
=
UIImage
(
named
:
"coupons_scrollview_white"
,
in
:
Bundle
(
for
:
MyEmptyClass
.
self
),
compatibleWith
:
nil
)
scrollView
.
clipsToBounds
=
true
scrollView
.
layer
.
cornerRadius
=
30
scrollView
.
layer
.
maskedCorners
=
[
.
layerMinXMinYCorner
]
// Top left corner radius
couponImage
.
load
(
link
:
ccms
?
.
_imageUrl
??
""
,
placeholder
:
UIImage
(),
cache
:
URLCache
())
couponImage
.
contentMode
=
.
scaleAspectFill
couponImageHeight
.
constant
=
self
.
uiscreen
.
height
*
0.25
nameLabel
.
text
=
ccms
?
.
_title
??
""
descriptionLabel
.
text
=
ccms
?
.
_subtitle
??
""
redeemButton
.
titleLabel
?
.
font
=
UIFont
(
name
:
"PFSquareSansPro-Medium"
,
size
:
16
)
redeemButton
.
setTitle
(
"Ενεργοποίηση"
,
for
:
.
normal
)
redeemButton
.
setTitleColor
(
.
white
,
for
:
.
normal
)
redeemButton
.
backgroundColor
=
UIColor
(
red
:
0.47
,
green
:
0.75
,
blue
:
0.08
,
alpha
:
1.00
)
redeemButton
.
layer
.
cornerRadius
=
12.0
}
// MARK: - Functions
func
showConfirmDialog
()
->
Void
{
let
alert
=
UIAlertController
(
title
:
"Ενεργοποίηση υπηρεσίας"
,
message
:
"Θέλετε να γίνει ενεργοποίηση στο Κινητό μου;"
,
preferredStyle
:
.
alert
)
alert
.
addAction
(
UIAlertAction
(
title
:
"Ενεργοποίηση"
,
style
:
.
default
,
handler
:
{
action
in
switch
action
.
style
{
case
.
default
:
self
.
submitOrderRequest
()
case
.
cancel
:
print
(
"cancel"
)
case
.
destructive
:
print
(
"destructive"
)
}
}))
alert
.
addAction
(
UIAlertAction
(
title
:
"Άκυρο"
,
style
:
.
default
,
handler
:
{
action
in
switch
action
.
style
{
case
.
default
:
print
(
"default"
)
case
.
cancel
:
print
(
"cancel"
)
case
.
destructive
:
print
(
"destructive"
)
}
}))
self
.
present
(
alert
,
animated
:
true
,
completion
:
nil
)
}
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"
)
}
}))
self
.
present
(
alert
,
animated
:
true
,
completion
:
nil
)
}
// MARK: - API CALLS
func
getProfileRequest
()
{
swiftApi
()
.
getProfileAsync
(
getProfileCallback
)
}
func
getProfileCallback
(
_
profileData
:
swiftApi
.
ProfileModel
?)
->
Void
{
if
(
profileData
!=
nil
)
{
DispatchQueue
.
main
.
async
{
self
.
numbersList
=
profileData
?
.
_msisdnList
??
[]
}
}
else
{
}
}
func
submitOrderRequest
()
{
swiftApi
()
.
submitOrderAsync
(
campaign_session_uuid
:
""
,
user_msisdn
:
self
.
selectedNumber
,
businessService
:
(
ccms
?
.
_businessService
??
""
),
offerName
:
(
ccms
?
.
_offerName
??
""
),
productType
:
(
ccms
?
.
_productType
??
""
),
provDuration
:
(
ccms
?
.
_provDuration
??
""
),
noOfRecurrance
:
(
ccms
?
.
_noOfRecurrance
??
""
),
price
:
(
ccms
?
.
_price
??
""
),
discount
:
(
ccms
?
.
_discount
??
""
),
voiceCategory
:
(
ccms
?
.
_voiceCategory
??
""
),
dataCategory
:
(
ccms
?
.
_dataCategory
??
""
),
minsValue
:
(
ccms
?
.
_minsValue
??
""
),
dataValue
:
(
ccms
?
.
_dataValue
??
""
),
provStepValueMins
:
(
ccms
?
.
_provStepValueMins
??
""
),
OfferAudienceLevel
:
(
ccms
?
.
_offerAudienceLevel
??
""
),
UACIOfferTrackingCode
:
(
ccms
?
.
_uaciOfferTrackingCode
??
""
),
OFFERCODE1
:
(
ccms
?
.
_offerCode1
??
""
),
SCORE
:
(
ccms
?
.
_score
??
""
),
ZONE
:
(
ccms
?
.
_zone
??
""
),
WAVE
:
(
ccms
?
.
_wave
??
""
),
VALIDITY
:
(
ccms
?
.
_validity
??
""
),
TREATMENT_CODE
:
(
ccms
?
.
_treatmentCode
??
""
),
submitOrderCallback
)
}
func
submitOrderCallback
(
_
response
:
swiftApi
.
GenericResponseModel
?)
->
Void
{
if
(
response
!=
nil
)
{
DispatchQueue
.
main
.
async
{
if
(
response
?
.
getStatus
==
1
)
{
self
.
showDialog
(
"Το αίτημά σου ολοκληρώθηκε επιτυχώς!"
,
"Θα ενημερωθείς άμεσα για την ενεργοποίηση του πακέτου σου."
)
// self.postEventRequest()
}
else
{
self
.
showDialog
(
"Αποτυχία"
,
"Κάτι πήγε στραβά"
)
}
}
}
else
{
self
.
showDialog
(
"Αποτυχία"
,
"Κάτι πήγε στραβά"
)
}
}
// MARK: - Actions
@IBAction
func
redeemButtomAction
(
_
sender
:
Any
)
{
self
.
numbersPopupTapped
(
sender
)
}
}
// MARK: NumbersPopup
extension
ContextualViewController
:
NumbersPopupDelegate
{
@objc
func
numbersPopupTapped
(
_
sender
:
Any
)
{
let
storyboard
=
UIStoryboard
(
name
:
"Main"
,
bundle
:
Bundle
(
for
:
MyEmptyClass
.
self
))
let
pp
=
storyboard
.
instantiateViewController
(
withIdentifier
:
"NumberPopupViewController"
)
as!
SwiftWarplyFramework
.
NumberPopupViewController
pp
.
InitWithController
(
controller
:
self
,
numbersList
:
self
.
numbersList
,
sender
:
sender
,
delegate
:
self
)
}
func
presentedPopup
()
{
// Code for when popup is presented
}
func
dismissedPopup
()
{
// Code for when popup is dismissed
}
func
optionSelected
(
_
option
:
String
)
{
// Code for when option is selected
self
.
selectedNumber
=
option
DispatchQueue
.
main
.
async
{
self
.
showConfirmDialog
()
}
}
}
SwiftWarplyFramework/SwiftWarplyFramework/GiftsViewController.swift
View file @
85ae6e3
...
...
@@ -160,7 +160,10 @@ extension GiftsViewController: UITableViewDelegate, UITableViewDataSource{
public
func
tableView
(
_
tableView
:
UITableView
,
didSelectRowAt
indexPath
:
IndexPath
)
{
if
(
campaigns
[
indexPath
.
row
]
.
_ccms
!=
nil
)
{
// TODO: open new screen with param campaigns[indexPath.row]._ccms
let
storyboard
=
UIStoryboard
(
name
:
"Main"
,
bundle
:
Bundle
(
for
:
MyEmptyClass
.
self
))
let
vc
=
storyboard
.
instantiateViewController
(
withIdentifier
:
"ContextualViewController"
)
as!
SwiftWarplyFramework
.
ContextualViewController
vc
.
ccms
=
campaigns
[
indexPath
.
row
]
.
_ccms
self
.
navigationController
?
.
pushViewController
(
vc
,
animated
:
true
)
}
else
if
(
campaigns
[
indexPath
.
row
]
.
_type
!=
nil
&&
campaigns
[
indexPath
.
row
]
.
_type
==
"telco"
)
{
let
ccmsCampaigns
=
swiftApi
()
.
getCCMSLoyaltyCampaigns
()
...
...
SwiftWarplyFramework/SwiftWarplyFramework/MFYViewController.swift
View file @
85ae6e3
...
...
@@ -110,7 +110,10 @@ extension MFYViewController: UITableViewDelegate, UITableViewDataSource{
public
func
tableView
(
_
tableView
:
UITableView
,
didSelectRowAt
indexPath
:
IndexPath
)
{
if
(
campaigns
[
indexPath
.
row
]
.
_ccms
!=
nil
)
{
// TODO: open new screen with param campaigns[indexPath.row]._ccms
let
storyboard
=
UIStoryboard
(
name
:
"Main"
,
bundle
:
Bundle
(
for
:
MyEmptyClass
.
self
))
let
vc
=
storyboard
.
instantiateViewController
(
withIdentifier
:
"ContextualViewController"
)
as!
SwiftWarplyFramework
.
ContextualViewController
vc
.
ccms
=
campaigns
[
indexPath
.
row
]
.
_ccms
self
.
navigationController
?
.
pushViewController
(
vc
,
animated
:
true
)
}
else
if
(
campaigns
[
indexPath
.
row
]
.
_type
!=
nil
&&
campaigns
[
indexPath
.
row
]
.
_type
==
"telco"
)
{
let
ccmsCampaigns
=
swiftApi
()
.
getCCMSLoyaltyCampaigns
()
...
...
SwiftWarplyFramework/SwiftWarplyFramework/Main.storyboard
View file @
85ae6e3
This diff is collapsed. Click to expand it.
Please
register
or
login
to post a comment