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-04-18 17:19:15 +0300
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
651b0201fd82a4609416306aeca20ec669532c94
651b0201
1 parent
7594d0ed
add inbox request
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
208 additions
and
1 deletions
WarplySDKFrameworkIOS/WarplySDKFrameworkIOS.xcworkspace/xcuserdata/manos.xcuserdatad/UserInterfaceState.xcuserstate
WarplySDKFrameworkIOS/WarplySDKFrameworkIOS/GiftsView.swift
WarplySDKFrameworkIOS/WarplySDKFrameworkIOS/GiftsViewInterface.swift
WarplySDKFrameworkIOS/WarplySDKFrameworkIOS/MyApi.h
WarplySDKFrameworkIOS/WarplySDKFrameworkIOS/MyApi.m
WarplySDKFrameworkIOS/WarplySDKFrameworkIOS.xcworkspace/xcuserdata/manos.xcuserdatad/UserInterfaceState.xcuserstate
View file @
651b020
No preview for this file type
WarplySDKFrameworkIOS/WarplySDKFrameworkIOS/GiftsView.swift
View file @
651b020
...
...
@@ -5,4 +5,191 @@
// Created by Manos Chorianopoulos on 18/4/22.
//
import
Foundation
#if canImport(SwiftUI)
import
SwiftUI
class
CouponDataModel
{
var
data
:
Array
<
NSDictionary
>
=
[]
init
()
{
//initializer method
let
instanceOfMyApi
=
MyApi
()
let
couponSets
=
instanceOfMyApi
.
getCouponSets
(
withActive
:
true
,
andVisible
:
true
,
andUuids
:
nil
)
let
coupons
=
instanceOfMyApi
.
getCoupons
()
as
AnyObject
?
if
let
myCouponsSetsDictionary
=
couponSets
as?
[
String
:
AnyObject
]
{
let
couponSetsData
=
(
myCouponsSetsDictionary
[
"MAPP_COUPON"
]
as!
Array
<
NSMutableDictionary
>
)
if
let
myCouponsDictionary
=
coupons
as?
[
String
:
AnyObject
]
{
let
couponsData
=
(
myCouponsDictionary
[
"result"
]
as!
Array
<
NSMutableDictionary
>
)
if
let
sets
=
couponSetsData
as?
NSArray
{
for
set
in
sets
{
let
s
=
set
as!
NSDictionary
if
let
cpns
=
couponsData
as?
NSArray
{
for
coupon
in
cpns
{
var
c
=
coupon
as!
NSDictionary
// var temp = NSMutableDictionary(dictionary: s);
if
c
[
"couponset_uuid"
]
as!
String
==
s
[
"uuid"
]
as!
String
{
var
temp
=
NSMutableDictionary
(
dictionary
:
s
);
temp
.
addEntries
(
from
:
c
as!
[
AnyHashable
:
Any
])
self
.
data
.
append
(
temp
as
NSDictionary
)
}
}
}
}
}
}
}
}
var
getData
:
Array
<
NSDictionary
>
{
get
{
// getter
return
data
}
}
}
class
CampaignDataModel
{
var
data
:
Array
<
NSDictionary
>
=
[]
init
()
{
//initializer method
let
instanceOfMyApi
=
MyApi
()
let
products
=
instanceOfMyApi
.
getInbox
()
print
(
"======== Inbox print ========="
)
print
(
products
?[
0
])
print
(
"======== Inbox dump ========="
)
dump
(
products
?[
0
])
print
(
"======== Inbox ========="
)
// let couponSets = instanceOfMyApi.getCouponSets(withActive: true, andVisible: true, andUuids: nil)
// let coupons = instanceOfMyApi.getCoupons() as AnyObject?
// if let myCouponsSetsDictionary = couponSets as? [String : AnyObject] {
// let couponSetsData = (myCouponsSetsDictionary["MAPP_COUPON"] as! Array<NSMutableDictionary>)
// if let myCouponsDictionary = coupons as? [String : AnyObject] {
// let couponsData = (myCouponsDictionary["result"] as! Array<NSMutableDictionary>)
// if let sets = couponSetsData as? NSArray {
// for set in sets {
// let s = set as! NSDictionary
// if let cpns = couponsData as? NSArray {
// for coupon in cpns {
// var c = coupon as! NSDictionary
// // var temp = NSMutableDictionary(dictionary: s);
// if c["couponset_uuid"] as! String == s["uuid"] as! String {
// var temp = NSMutableDictionary(dictionary: s);
// temp.addEntries(from: c as! [AnyHashable : Any])
// self.data.append(temp as NSDictionary)
// }
// }
// }
// }
// }
// }
// }
}
var
getData
:
Array
<
NSDictionary
>
{
get
{
// getter
return
data
}
}
}
extension
GiftsView
{
struct
headerView
:
View
{
var
uiscreen
=
UIScreen
.
main
.
bounds
var
body
:
some
View
{
ZStack
{
Image
(
"ic_back"
,
bundle
:
Bundle
(
for
:
MyEmptyClass
.
self
))
.
resizable
()
.
frame
(
width
:
self
.
uiscreen
.
height
*
0.025
,
height
:
self
.
uiscreen
.
height
*
0.02
)
.
offset
(
x
:
-
self
.
uiscreen
.
width
/
2
+
self
.
uiscreen
.
width
*
0.05
,
y
:
self
.
uiscreen
.
height
*
0.07
)
Text
(
"Όλα τα κουπόνια μου"
)
.
frame
(
width
:
self
.
uiscreen
.
width
*
0.8
,
height
:
self
.
uiscreen
.
height
*
0.025
,
alignment
:
.
center
)
.
offset
(
y
:
self
.
uiscreen
.
height
*
0.07
)
.
frame
(
width
:
self
.
uiscreen
.
width
)
}
}
}
struct
giftView
:
View
{
// @Binding var result: NSDictionary
var
uiscreen
=
UIScreen
.
main
.
bounds
var
body
:
some
View
{
ZStack
{
// URLImage(url: URL(string: result["img_preview"] as! String? ?? ""))
// .resizable()
// .frame(width: self.uiscreen.height * 0.04, height: self.uiscreen.height * 0.04)
// .cornerRadius(CGFloat(self.uiscreen.height * 0.02))
// .offset(x: -self.uiscreen.width / 2 + self.uiscreen.width * 0.14, y: -self.uiscreen.height * 0.07)
}
// .background(
// Image("coupons_container", bundle: Bundle(for: MyEmptyClass.self))
// .resizable()
//// .edgesIgnoringSafeArea(.all)
// .frame(width: UIScreen.main.bounds.width * 0.8, height: UIScreen.main.bounds.height * 0.17)
// )
}
}
}
@available(iOS 13.0.0, *)
struct
GiftsView
:
View
{
var
data
:
Array
<
NSDictionary
>
=
CouponDataModel
()
.
getData
var
campains
:
Any
=
CampaignDataModel
()
var
uiscreen
=
UIScreen
.
main
.
bounds
var
body
:
some
View
{
VStack
{
headerView
()
// ScrollView {
// VStack {
// if (data.count) > 0 {
// ForEach(data, id: \.self) { result in
// couponView(result: result)
// }
// }
// }
// .frame(width:self.uiscreen.width, height:self.uiscreen.height )
// }
}
}
}
#endif
//struct ProfileView_Previews: PreviewProvider {
// static var previews: some View {
// ProfileView()
// }
//}
@available(iOS 13.0.0, *)
struct
Previews_GiftsView_Previews
:
PreviewProvider
{
static
var
uiscreen
=
UIScreen
.
main
.
bounds
static
var
previews
:
some
View
{
ZStack
{
Image
(
"ic_back"
,
bundle
:
Bundle
(
for
:
MyEmptyClass
.
self
))
.
resizable
()
.
frame
(
width
:
self
.
uiscreen
.
height
*
0.025
,
height
:
self
.
uiscreen
.
height
*
0.02
)
.
offset
(
x
:
-
self
.
uiscreen
.
width
/
2
+
self
.
uiscreen
.
width
*
0.05
,
y
:
self
.
uiscreen
.
height
*
0.07
)
Text
(
"Όλα τα κουπόνια μου"
)
.
frame
(
width
:
self
.
uiscreen
.
width
*
0.8
,
height
:
self
.
uiscreen
.
height
*
0.025
,
alignment
:
.
center
)
.
offset
(
y
:
self
.
uiscreen
.
height
*
0.07
)
}
}
}
...
...
WarplySDKFrameworkIOS/WarplySDKFrameworkIOS/GiftsViewInterface.swift
View file @
651b020
...
...
@@ -6,3 +6,13 @@
//
import
Foundation
import
SwiftUI
@available(iOS 13.0.0, *)
@objc
public
class
GiftsViewInterface
:
NSObject
{
@objc
static
public
func
giftsViewController
()
->
UIViewController
{
return
UIHostingController
(
rootView
:
GiftsView
())
}
}
...
...
WarplySDKFrameworkIOS/WarplySDKFrameworkIOS/MyApi.h
View file @
651b020
...
...
@@ -16,6 +16,7 @@
-
(
void
)
setToStage
;
-
(
void
)
setLang
:(
NSString
*
)
lang
;
-
(
UIViewController
*
)
openCoupons
;
-
(
UIViewController
*
)
openGifts
;
-
(
void
)
applicationDidEnterBackground
:(
UIApplication
*
)
application
;
-
(
void
)
applicationWillEnterForeground
:(
UIApplication
*
)
application
;
-
(
void
)
applicationDidBecomeActive
:(
UIApplication
*
)
application
;
...
...
WarplySDKFrameworkIOS/WarplySDKFrameworkIOS/MyApi.m
View file @
651b020
...
...
@@ -55,6 +55,15 @@ NSString *LANG;
return
couponsViewController
;
}
-
(
UIViewController
*
)
openGifts
{
UIViewController
*
giftsViewController
=
[
GiftsViewInterface
giftsViewController
];
// controller = [[UINavigationController alloc]initWithRootViewController:profileViewController];
// [window makeKeyAndVisible];
return
giftsViewController
;
}
//- (UIViewController *) openCoupons {
//// NSString* const frameworkBundleID = @"framework.warp.ly.WarplySDKFrameworkIOS";
//// NSBundle* bundle = [NSBundle bundleWithIdentifier:frameworkBundleID];
...
...
Please
register
or
login
to post a comment