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-07-19 13:41:26 +0300
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
a4e9b758c7822d7acea52c6e32bc5b51ed148f7c
a4e9b758
1 parent
8664a39d
add TelcoViewController functionality
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
116 additions
and
6 deletions
SwiftWarplyFramework/SwiftWarplyFramework/TelcoViewController.swift
SwiftWarplyFramework/SwiftWarplyFramework/TelcoViewController.swift
View file @
a4e9b75
...
...
@@ -7,7 +7,7 @@
import
UIKit
@objc
public
class
TelcoViewController
:
UIViewController
{
@objc
public
class
TelcoViewController
:
UIViewController
,
UIPopoverControllerDelegate
{
@IBOutlet
weak
var
mainView
:
UIView
!
@IBOutlet
weak
var
scrollView
:
UIScrollView
!
@IBOutlet
weak
var
scrollContentView
:
UIView
!
...
...
@@ -21,6 +21,8 @@ import UIKit
public
var
ccms
:
swiftApi
.
LoyaltyContextualOfferModel
?
public
var
campaign
:
swiftApi
.
CampaignItemModel
?
var
selectedNumber
:
String
=
""
public
var
numbersList
:
Array
<
String
>
=
[]
public
override
func
viewDidLoad
()
{
...
...
@@ -29,6 +31,8 @@ import UIKit
self
.
hidesBottomBarWhenPushed
=
true
// Do any additional setup after loading the view.
getProfileRequest
()
setBackButton
()
setNavigationTitle
(
"Ενεργοποίηση"
)
...
...
@@ -50,16 +54,122 @@ import UIKit
}
// MARK: - Functions
func
activateSetRequest
(
uuid
:
String
)
{
assertionFailure
(
"to be implemented"
)
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
{
func
activateSetCallback
(
_
response
:
swiftApi
.
GenericResponseModel
?)
->
Void
{
assertionFailure
(
"to be implemented"
)
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
:
(
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
??
""
),
submitOrderCallback
)
}
func
submitOrderCallback
(
_
response
:
swiftApi
.
GenericResponseModel
?)
->
Void
{
if
(
response
!=
nil
)
{
DispatchQueue
.
main
.
async
{
if
(
response
?
.
getStatus
==
1
)
{
self
.
showDialog
(
"Το αίτημά σου ολοκληρώθηκε επιτυχώς!"
,
"Θα ενημερωθείς άμεσα για την ενεργοποίηση του πακέτου σου."
)
}
else
{
self
.
showDialog
(
"Αποτυχία"
,
"Κάτι πήγε στραβά"
)
}
}
}
else
{
self
.
showDialog
(
"Αποτυχία"
,
"Κάτι πήγε στραβά"
)
}
}
// MARK: - Actions
@IBAction
func
activateButtomAction
(
_
sender
:
Any
)
{
// activateSetRequest(uuid: couponset?.uuid ?? "")
self
.
numbersPopupTapped
(
sender
)
}
}
// MARK: NumbersPopup
extension
TelcoViewController
:
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
()
}
}
}
...
...
Please
register
or
login
to post a comment