Manos Chorianopoulos
......@@ -282,6 +282,14 @@ WL_VERSION_INTERFACE()
@discussion This method gets the inbox with campaigns from Warply service. The
method returns an array with WLInboxItem objects (campaigns). The caller will probably want to use the return parameter and a timer to update the UI or do any other operation after a certain amount of time that the app remains unregistered and thus, cannot make the call.
*/
- (NSString*)getAccessToken;
- (NSString*)getRefreshToken;
- (NSString*)getClientId;
- (NSString*)getClientSecret;
- (BOOL)getInboxWithSuccessBlock:(void (^)(NSArray *list))success failureBlock:(void (^)(NSError *error))failure;
- (BOOL)getInbox2WithSuccessBlock:(void (^)(NSArray *list))success failureBlock:(void (^)(NSError *error))failure;
......
......@@ -453,6 +453,57 @@ WL_VERSION_IMPLEMENTATION(WL_VERSION)
return [self isRegistrationValid];
}
- (NSString*)getAccessToken {
[self createDBIfNeeded];
[self initDBIfNeeded];
[self restore];
NSString *accessToken = [NSString alloc];
if ([_db tableExists:@"requestVariables"] == YES) {
FMResultSet *accessTokenSet = [_db executeQuery:@"SELECT access_token FROM requestVariables WHERE id = 1;"];
while ([accessTokenSet next]) {
accessToken = [[accessTokenSet resultDictionary][@"access_token"] stringValue];
}
return accessToken;
}
return @"";
};
- (NSString*)getRefreshToken {
NSString *refreshToken = [NSString alloc];
if ([_db tableExists:@"requestVariables"] == YES) {
FMResultSet *refreshTokenSet = [_db executeQuery:@"SELECT refresh_token FROM requestVariables WHERE id = 1;"];
while ([refreshTokenSet next]) {
refreshToken = [[refreshTokenSet resultDictionary][@"refresh_token"] stringValue];
}
return refreshToken;
}
return @"";
}
- (NSString*)getClientId {
NSString *clientId = [NSString alloc];
if ([_db tableExists:@"requestVariables"] == YES) {
FMResultSet *clientIdSet = [_db executeQuery:@"SELECT access_token FROM requestVariables WHERE id = 1;"];
while ([clientIdSet next]) {
clientId = [[clientIdSet resultDictionary][@"client_id"] stringValue];
}
return clientId;
}
return @"";
}
- (NSString*)getClientSecret {
NSString *clientSecret = [NSString alloc];
if ([_db tableExists:@"requestVariables"] == YES) {
FMResultSet *clientSecretSet = [_db executeQuery:@"SELECT client_secret FROM requestVariables WHERE id = 1;"];
while ([clientSecretSet next]) {
clientSecret = [[clientSecretSet resultDictionary][@"client_secret"] stringValue];
}
return clientSecret;
}
return @"";
}
- (void)getProductsWithSuccessBlock:(NSString*)filter :(void(^)(NSMutableArray *params)) success failureBlock:(void(^)(NSError *error))failure
{
if (filter == nil) {
......
......@@ -23,6 +23,7 @@
E67D1EC02810579F00940F01 /* MoreForYouView.swift in Sources */ = {isa = PBXBuildFile; fileRef = E67D1EBF2810579F00940F01 /* MoreForYouView.swift */; };
E67D1EC228113EED00940F01 /* CouponView.swift in Sources */ = {isa = PBXBuildFile; fileRef = E67D1EC128113EED00940F01 /* CouponView.swift */; };
E67D1EC428113EFD00940F01 /* CouponViewInterface.swift in Sources */ = {isa = PBXBuildFile; fileRef = E67D1EC328113EFD00940F01 /* CouponViewInterface.swift */; };
E67D1EC628117F2400940F01 /* swiftApi.swift in Sources */ = {isa = PBXBuildFile; fileRef = E67D1EC528117F2400940F01 /* swiftApi.swift */; };
E6D8DE6D27A942010006A3A9 /* WarplySDKFrameworkIOS.docc in Sources */ = {isa = PBXBuildFile; fileRef = E6D8DE6C27A942010006A3A9 /* WarplySDKFrameworkIOS.docc */; };
E6D8DE6E27A942010006A3A9 /* WarplySDKFrameworkIOS.h in Headers */ = {isa = PBXBuildFile; fileRef = E6D8DE6B27A942010006A3A9 /* WarplySDKFrameworkIOS.h */; settings = {ATTRIBUTES = (Public, ); }; };
E6D8DEEE27A942920006A3A9 /* WarplyReactMethods.m in Sources */ = {isa = PBXBuildFile; fileRef = E6D8DE7527A942910006A3A9 /* WarplyReactMethods.m */; };
......@@ -136,8 +137,6 @@
E6D8DF5A27A942920006A3A9 /* Media.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = E6D8DEED27A942920006A3A9 /* Media.xcassets */; };
E6D8DF6027A9429E0006A3A9 /* MyApi.m in Sources */ = {isa = PBXBuildFile; fileRef = E6D8DF5C27A9429E0006A3A9 /* MyApi.m */; };
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 */
......@@ -158,6 +157,7 @@
E67D1EBF2810579F00940F01 /* MoreForYouView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MoreForYouView.swift; sourceTree = "<group>"; };
E67D1EC128113EED00940F01 /* CouponView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CouponView.swift; sourceTree = "<group>"; };
E67D1EC328113EFD00940F01 /* CouponViewInterface.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CouponViewInterface.swift; sourceTree = "<group>"; };
E67D1EC528117F2400940F01 /* swiftApi.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = swiftApi.swift; sourceTree = "<group>"; };
E6D8DE6827A942010006A3A9 /* WarplySDKFrameworkIOS.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = WarplySDKFrameworkIOS.framework; sourceTree = BUILT_PRODUCTS_DIR; };
E6D8DE6B27A942010006A3A9 /* WarplySDKFrameworkIOS.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = WarplySDKFrameworkIOS.h; sourceTree = "<group>"; };
E6D8DE6C27A942010006A3A9 /* WarplySDKFrameworkIOS.docc */ = {isa = PBXFileReference; lastKnownFileType = folder.documentationcatalog; path = WarplySDKFrameworkIOS.docc; sourceTree = "<group>"; };
......@@ -272,8 +272,6 @@
E6D8DEED27A942920006A3A9 /* Media.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Media.xcassets; sourceTree = SOURCE_ROOT; };
E6D8DF5C27A9429E0006A3A9 /* MyApi.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = MyApi.m; 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 */
......@@ -356,9 +354,8 @@
E6D8DE6B27A942010006A3A9 /* WarplySDKFrameworkIOS.h */,
E6D8DE6C27A942010006A3A9 /* WarplySDKFrameworkIOS.docc */,
E655D05928058A72004F913C /* WarplySDKFrameworkIOS-Bridging-Header.h */,
E6EA2F6D2806E32500EC4CF5 /* Coupons.xib */,
E6EA2F6F2806E8C200EC4CF5 /* Coupons.swift */,
E639EFA42808244E00B9DD94 /* MyEmptyClass.swift */,
E67D1EC528117F2400940F01 /* swiftApi.swift */,
);
path = WarplySDKFrameworkIOS;
sourceTree = "<group>";
......@@ -705,7 +702,6 @@
E6D8DF0D27A942920006A3A9 /* warp_white_forward_button.png in Resources */,
E6D8DEFA27A942920006A3A9 /* WLNativeAdTableViewCell.xib in Resources */,
E639EFAB2808347700B9DD94 /* ic_back.png 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 */,
......@@ -762,7 +758,6 @@
1EBEB02D280D69D800BF802C /* GiftsView.swift in Sources */,
E67D1EC02810579F00940F01 /* MoreForYouView.swift in Sources */,
E6D8DEFC27A942920006A3A9 /* WLCustomNativeAdTableViewCell.m in Sources */,
E6EA2F702806E8C200EC4CF5 /* Coupons.swift in Sources */,
1E735FF42810681E0050A298 /* CampaignWebviewInterface.swift in Sources */,
E639EFA3280810E300B9DD94 /* CouponsViewInterface.swift in Sources */,
1EBEB02F280D6AA500BF802C /* GiftsViewInterface.swift in Sources */,
......@@ -793,6 +788,7 @@
E6D8DF4727A942920006A3A9 /* AFURLSessionManager.m in Sources */,
E6D8DF1927A942920006A3A9 /* WLAnalyticsManager.m in Sources */,
E6D8DF5227A942920006A3A9 /* FMDatabase.m in Sources */,
E67D1EC628117F2400940F01 /* swiftApi.swift in Sources */,
E6D8DF1227A942920006A3A9 /* WLPushManager.m in Sources */,
E6D8DEF827A942920006A3A9 /* WLNativeAdTableViewCell.m in Sources */,
E6D8DE6D27A942010006A3A9 /* WarplySDKFrameworkIOS.docc in Sources */,
......
......@@ -3,4 +3,38 @@
uuid = "91478161-56E8-4654-93F2-7756A39480EE"
type = "0"
version = "2.0">
<Breakpoints>
<BreakpointProxy
BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
<BreakpointContent
uuid = "30B1F0C3-FB6C-4F67-936F-5E2FE28C8D28"
shouldBeEnabled = "No"
ignoreCount = "0"
continueAfterRunningActions = "No"
filePath = "Warply/Warply.m"
startingColumnNumber = "9223372036854775807"
endingColumnNumber = "9223372036854775807"
startingLineNumber = "1166"
endingLineNumber = "1166"
landmarkName = "-verifyTicketWithSuccessBlock:::failureBlock:"
landmarkType = "7">
</BreakpointContent>
</BreakpointProxy>
<BreakpointProxy
BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
<BreakpointContent
uuid = "624123AE-FD55-4FBC-8B32-A1449A16F8F7"
shouldBeEnabled = "Yes"
ignoreCount = "0"
continueAfterRunningActions = "No"
filePath = "WarplySDKFrameworkIOS/CouponsView.swift"
startingColumnNumber = "9223372036854775807"
endingColumnNumber = "9223372036854775807"
startingLineNumber = "212"
endingLineNumber = "212"
landmarkName = "goBack()"
landmarkType = "7">
</BreakpointContent>
</BreakpointProxy>
</Breakpoints>
</Bucket>
......
......@@ -11,6 +11,7 @@ import SwiftUI
import Combine
import Foundation
import UIKit
import WebKit
extension CampaignWebview {
......
//
// Coupons.swift
// WarplySDKFrameworkIOS
//
// Created by Βασιλης Σκουρας on 13/4/22.
//
import UIKit
extension UIViewController {
class func loadController() -> Self {
return Self(nibName: String(describing: self), bundle: nil)
//Or You can use this as well
//Self.init(nibName: String(describing: self), bundle: nil)
}
}
public class Coupons: UIViewController {
@IBOutlet weak var myScrollView: UIScrollView!
public 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"/>
<outlet property="view" destination="iN0-l3-epB" id="wLC-JN-Nyj"/>
</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>
......@@ -113,7 +113,7 @@ extension CouponsView {
HStack {
Image("ic_back", bundle: Bundle(for: MyEmptyClass.self))
.resizable()
.frame(width: self.uiscreen.height * 0.022, height: self.uiscreen.height * 0.02)
.frame(width: self.uiscreen.height * 0.022, height: self.uiscreen.height * 0.04)
.offset(y: self.uiscreen.height * 0.015)
}
}
......
......@@ -8,10 +8,12 @@
#ifndef MyApi_h
#define MyApi_h
#import <UIKit/UIKit.h>
@class Coupons;
@class Warply;
@interface MyApi : NSObject
@property (nonatomic, weak) Warply *warply;
+ (void)init:(NSDictionary *)launchOptions uuid:(NSString*)uuid merchantId:(NSString*)merchantId lang:(NSString*)lang;
- (void) setToStage;
- (void) setLang:(NSString*) lang;
......@@ -21,6 +23,7 @@
- (UIViewController *) openWallet:(UIView*) parentView;
- (UIViewController *) openMoreForYou:(UIView*) parentView;
- (UIViewController *) openCampaign:(UIView*) parentView campaign:(NSString*) campaign;
- (NSDictionary *) provideInfoForCampaign;
- (void) applicationDidEnterBackground:(UIApplication *)application;
- (void) applicationWillEnterForeground:(UIApplication *)application;
- (void) applicationDidBecomeActive:(UIApplication *)application;
......
......@@ -8,6 +8,7 @@
#import <Foundation/Foundation.h>
#import "MyApi.h"
#import "Warply.h"
#import "WLUtils.h"
#import <WarplySDKFrameworkIOS/WarplySDKFrameworkIOS-Swift.h>
......@@ -80,6 +81,19 @@ NSString *LANG;
return campaignViewController;
}
- (NSDictionary *) provideInfoForCampaign {
NSMutableDictionary* info = [[NSMutableDictionary alloc] init];
info[@"web_id"] = [Warply sharedService].webId;
info[@"app_uuid"] = [WLKeychain getStringForKey:@"NBAPPUuid"];
info[@"api_key"] = self.warply.apiKey;
Warply* warplyInstance = [[Warply alloc] init];
info[@"access_token"] = [warplyInstance getAccessToken];
info[@"refresh_token"] = [warplyInstance getRefreshToken];
info[@"client_id"] = [warplyInstance getClientId];
info[@"client_secret"] = [warplyInstance getClientSecret];
return info;
}
///////////////////////////////////////////////////////////////////////////////////////////////////
- (void)applicationDidEnterBackground:(UIApplication *)application
{
......
//
// swiftApi.swift
// WarplySDKFrameworkIOS
//
// Created by Βασιλης Σκουρας on 21/4/22.
//
import Foundation
import WarplySDKFrameworkIOS
open class swiftApi {
public func getUserTag() -> String {
return "1"
}
public func setDFY(couponCode: String, merchantId: String) {
}
public func setActiveDFYCoupons(campaignIds: Array<String>) {
}
public func setCCMSLoyaltyCampaigns(campaigns: Array<Dictionary<String, String>>) {
}
}