Vasilis

changes for ui

......@@ -124,6 +124,8 @@
E6D8DF6027A9429E0006A3A9 /* MyApi.m in Sources */ = {isa = PBXBuildFile; fileRef = E6D8DF5C27A9429E0006A3A9 /* MyApi.m */; };
E6D8DF6127A9429E0006A3A9 /* ProfileView.swift in Sources */ = {isa = PBXBuildFile; fileRef = E6D8DF5D27A9429E0006A3A9 /* ProfileView.swift */; };
E6D8DF6227A9429E0006A3A9 /* MyApi.h in Headers */ = {isa = PBXBuildFile; fileRef = E6D8DF5E27A9429E0006A3A9 /* MyApi.h */; settings = {ATTRIBUTES = (Public, ); }; };
E6EA2F6E2806E32500EC4CF5 /* Coupons.xib in Resources */ = {isa = PBXBuildFile; fileRef = E6EA2F6D2806E32500EC4CF5 /* Coupons.xib */; };
E6EA2F702806E8C200EC4CF5 /* Coupons.swift in Sources */ = {isa = PBXBuildFile; fileRef = E6EA2F6F2806E8C200EC4CF5 /* Coupons.swift */; };
/* End PBXBuildFile section */
/* Begin PBXFileReference section */
......@@ -246,6 +248,8 @@
E6D8DF5C27A9429E0006A3A9 /* MyApi.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = MyApi.m; sourceTree = "<group>"; };
E6D8DF5D27A9429E0006A3A9 /* ProfileView.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ProfileView.swift; sourceTree = "<group>"; };
E6D8DF5E27A9429E0006A3A9 /* MyApi.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MyApi.h; sourceTree = "<group>"; };
E6EA2F6D2806E32500EC4CF5 /* Coupons.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; path = Coupons.xib; sourceTree = "<group>"; };
E6EA2F6F2806E8C200EC4CF5 /* Coupons.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Coupons.swift; sourceTree = "<group>"; };
F2447FDBC0B149DFB9DC6E40 /* Pods-WarplySDKFrameworkIOS.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-WarplySDKFrameworkIOS.debug.xcconfig"; path = "Target Support Files/Pods-WarplySDKFrameworkIOS/Pods-WarplySDKFrameworkIOS.debug.xcconfig"; sourceTree = "<group>"; };
/* End PBXFileReference section */
......@@ -309,6 +313,8 @@
E6D8DE6B27A942010006A3A9 /* WarplySDKFrameworkIOS.h */,
E6D8DE6C27A942010006A3A9 /* WarplySDKFrameworkIOS.docc */,
E655D05928058A72004F913C /* WarplySDKFrameworkIOS-Bridging-Header.h */,
E6EA2F6D2806E32500EC4CF5 /* Coupons.xib */,
E6EA2F6F2806E8C200EC4CF5 /* Coupons.swift */,
);
path = WarplySDKFrameworkIOS;
sourceTree = "<group>";
......@@ -654,6 +660,7 @@
E6D8DF0F27A942920006A3A9 /* warp_white_close_button@2x.png in Resources */,
E6D8DF0D27A942920006A3A9 /* warp_white_forward_button.png in Resources */,
E6D8DEFA27A942920006A3A9 /* WLNativeAdTableViewCell.xib in Resources */,
E6EA2F6E2806E32500EC4CF5 /* Coupons.xib in Resources */,
E6D8DF1027A942920006A3A9 /* warp_white_forward_button@2x.png in Resources */,
E6D8DEF127A942920006A3A9 /* WLNativeVideoTableViewCell.xib in Resources */,
E6D8DEFB27A942920006A3A9 /* WLNativeAdCollectionViewCell.xib in Resources */,
......@@ -704,6 +711,7 @@
E6D8DF0627A942920006A3A9 /* WLBeacon.m in Sources */,
E6D8DF2927A942920006A3A9 /* NSData+SSToolkitAdditions.m in Sources */,
E6D8DEFC27A942920006A3A9 /* WLCustomNativeAdTableViewCell.m in Sources */,
E6EA2F702806E8C200EC4CF5 /* Coupons.swift in Sources */,
E6D8DF5F27A9429E0006A3A9 /* ProfileViewInterface.swift in Sources */,
E6D8DF4A27A942920006A3A9 /* AFNetworkReachabilityManager.m in Sources */,
E6D8DF4B27A942920006A3A9 /* AFSecurityPolicy.m in Sources */,
......
//
// Coupons.swift
// WarplySDKFrameworkIOS
//
// Created by Βασιλης Σκουρας on 13/4/22.
//
import UIKit
class Coupons: UIViewController {
@IBOutlet weak var myScrollView: UIScrollView!
override func viewDidLoad() {
super.viewDidLoad()
let corners = UIRectCorner(arrayLiteral: [
UIRectCorner.topLeft,
])
let cornerRadii = CGSize(
width: 10,
height: 10
)
let maskPath = UIBezierPath(
roundedRect: view.bounds,
byRoundingCorners: corners,
cornerRadii: cornerRadii
)
let maskLayer = CAShapeLayer()
maskLayer.path = maskPath.cgPath
maskLayer.frame = view.bounds
myScrollView.layer.mask = maskLayer
// Do any additional setup after loading the view.
}
/*
// 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.
}
*/
}
<?xml version="1.0" encoding="UTF-8"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="19529" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES">
<device id="retina6_1" orientation="portrait" appearance="light"/>
<dependencies>
<deployment identifier="iOS"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="19519"/>
<capability name="Safe area layout guides" minToolsVersion="9.0"/>
<capability name="System colors in document resources" minToolsVersion="11.0"/>
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
</dependencies>
<objects>
<placeholder placeholderIdentifier="IBFilesOwner" id="-1" userLabel="File's Owner" customClass="Coupons" customModule="WarplySDKFrameworkIOS" customModuleProvider="target">
<connections>
<outlet property="myScrollView" destination="SHV-Vg-A8P" id="dzS-Na-cRH"/>
</connections>
</placeholder>
<placeholder placeholderIdentifier="IBFirstResponder" id="-2" customClass="UIResponder"/>
<view contentMode="scaleToFill" id="iN0-l3-epB">
<rect key="frame" x="0.0" y="0.0" width="414" height="896"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<subviews>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" ambiguous="YES" text="Όλα τα κουπόνια μου" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="sU1-BM-nPc">
<rect key="frame" x="126.5" y="63" width="161.5" height="21"/>
<fontDescription key="fontDescription" type="system" pointSize="17"/>
<nil key="textColor"/>
<nil key="highlightedColor"/>
</label>
<imageView clipsSubviews="YES" userInteractionEnabled="NO" contentMode="scaleAspectFit" horizontalHuggingPriority="251" verticalHuggingPriority="251" ambiguous="YES" image="ic_back" translatesAutoresizingMaskIntoConstraints="NO" id="DSk-ym-fZV">
<rect key="frame" x="20" y="63" width="24" height="21"/>
<accessibility key="accessibilityConfiguration" identifier="ic_back"/>
<constraints>
<constraint firstAttribute="height" constant="17" id="dvj-RN-g0D"/>
<constraint firstAttribute="width" constant="20" id="y3w-1z-hQx"/>
</constraints>
</imageView>
<scrollView clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="scaleToFill" fixedFrame="YES" translatesAutoresizingMaskIntoConstraints="NO" id="SHV-Vg-A8P">
<rect key="frame" x="0.0" y="113" width="414" height="783"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
<viewLayoutGuide key="contentLayoutGuide" id="Kj4-MW-egz"/>
<viewLayoutGuide key="frameLayoutGuide" id="KT3-60-7Kp"/>
</scrollView>
</subviews>
<viewLayoutGuide key="safeArea" id="vUN-kp-3ea"/>
<color key="backgroundColor" systemColor="systemBackgroundColor"/>
<constraints>
<constraint firstItem="sU1-BM-nPc" firstAttribute="centerX" secondItem="iN0-l3-epB" secondAttribute="centerX" id="RLg-Ad-dUB"/>
</constraints>
<point key="canvasLocation" x="137.68115942028987" y="95.758928571428569"/>
</view>
</objects>
<resources>
<image name="ic_back" width="16.5" height="13.5"/>
<systemColor name="systemBackgroundColor">
<color white="1" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
</systemColor>
</resources>
</document>
......@@ -15,6 +15,7 @@
- (void) setToStage;
- (void) setLang:(NSString*) lang;
- (UIViewController *) openProfile:(UIViewController*)controller :(UIWindow*) window;
- (UIViewController *) openCoupons:(UIViewController*)controller :(UIWindow*) window;
- (void) applicationDidEnterBackground:(UIApplication *)application;
- (void) applicationWillEnterForeground:(UIApplication *)application;
- (void) applicationDidBecomeActive:(UIApplication *)application;
......
......@@ -54,6 +54,12 @@ NSString *LANG;
return profileViewController;
}
- (UIViewController *) openCoupons:(UIViewController*)controller :(UIWindow*) window {
UIView *myCoupons = [[[NSBundle mainBundle] loadNibNamed:@"Coupons" owner:self options:nil] objectAtIndex:0];
return myCoupons;
}
///////////////////////////////////////////////////////////////////////////////////////////////////
- (void)applicationDidEnterBackground:(UIApplication *)application
{
......
......@@ -5,19 +5,42 @@
// Created by Βασιλης Σκουρας on 13/1/22.
//
#if canImport(SwiftUI)
import SwiftUI
import WarplySDKFrameworkIOS
@available(iOS 13.0.0, *)
class DataModel {
var data: AnyObject?
init() { //initializer method
let instanceOfMyApi = MyApi()
let couponSets = instanceOfMyApi.getCouponSets(withActive: true, andVisible: true, andUuids: nil)
let coupons = instanceOfMyApi.getCoupons() as AnyObject?
if let myDictionary = coupons as? [String : AnyObject] {
self.data = myDictionary["result"] as AnyObject
}
}
var getData: AnyObject? {
get { // getter
return data ?? nil
}
}
}
@available(iOS 11.0.0, *)
struct ProfileView: View {
let uiscreen = UIScreen.main.bounds
@State private var bottomRect: CGRect = .zero
var data:AnyObject? = DataModel().getData
var uiscreen = UIScreen.main.bounds
// @State private var bottomRect: CGRect = .zero
var body: some View {
ScrollView {
VStack {
let instanceOfMyApi = MyApi()
var myJson = instanceOfMyApi.getCoupons() as AnyObject?
ZStack {
Image("ic_back", bundle: Bundle(identifier:"framework.warp.ly.warplySDKFrameworkIOS"))
......@@ -29,32 +52,24 @@ struct ProfileView: View {
.offset( y: self.uiscreen.height * 0.04)
}
.frame(width: self.uiscreen.width)
// Rectangle()
//
// .foregroundStyle(
// .linearGradient(
// colors: [Color.init(UIColor(red: 82.0/255.0, green: 223.0/255.0, blue: 90.0/255.0, alpha: 1.0)), Color.init(UIColor(red: 29.0/255.0, green: 168.0/255.0, blue: 122.0/255.0, alpha: 1.0)), Color.init(UIColor(red: 4.0/255.0, green: 120.0/255.0, blue: 190.0/255.0, alpha: 1.0))],
// startPoint: .leading,
// endPoint: .trailing
// )
// )
//
// .frame(width: self.uiscreen.width * 0.9,
// height: self.uiscreen.height * 0.15,
// alignment: .topLeading)
// .cornerRadius(CGFloat(7))
// .offset(x: self.uiscreen.width * 0.0025, y: self.uiscreen.height * 0.08)
let dataArray:[NSDictionary] = (data as! NSArray).compactMap({ $0 as? NSDictionary })
ForEach(dataArray, id: \.self) { item in
ZStack {
Image("logo", bundle: Bundle(identifier:"framework.warp.ly.warplySDKFrameworkIOS"))
.resizable()
.frame(width: self.uiscreen.height * 0.04, height: self.uiscreen.height * 0.04, alignment: .topLeading)
.cornerRadius(CGFloat(self.uiscreen.height * 0.02))
.offset(x: -self.uiscreen.width / 2 + self.uiscreen.width * 0.14, y: -self.uiscreen.height * 0.07)
Image("logo", bundle: Bundle(identifier:"framework.warp.ly.warplySDKFrameworkIOS"))
}.background(
Image("Background")
.resizable()
.frame(width: self.uiscreen.width * 0.24, height: self.uiscreen.height * 0.038, alignment: .topLeading)
.cornerRadius(CGFloat(self.uiscreen.height * 0.02))
.offset(x: self.uiscreen.width / 2 - self.uiscreen.width * 0.2, y: -self.uiscreen.height * 0.07)
.edgesIgnoringSafeArea(.all)
.frame(width: UIScreen.main.bounds.width, height: UIScreen.main.bounds.height)
)
}
Text("Χριστίνα Γεωργίου")
.frame( width: self.uiscreen.width * 0.8, height: self.uiscreen.height * 0.04, alignment: .leading)
......@@ -69,7 +84,7 @@ struct ProfileView: View {
.frame(width:self.uiscreen.width, height:self.uiscreen.height )
}
}
#endif
//struct ProfileView_Previews: PreviewProvider {
// static var previews: some View {
// ProfileView()
......