Vasilis

pasting of SwiftWarplyFramework

Showing 197 changed files with 1500 additions and 50 deletions
No preview for this file type
framework module SwiftWarplyFramework {
umbrella header "SwiftWarplyFramework.h"
export *
module * { export * }
}
module SwiftWarplyFramework.Swift {
header "SwiftWarplyFramework-Swift.h"
requires objc
}
Pod::Spec.new do |spec|
spec.name = "SwiftWarplyFramework"
spec.version = "0.0.32"
spec.summary = "A framework used for several functionalities."
spec.description = "This is the Warply framework used for react native or swift apps for analytics, push notifications and the functionality of the app."
spec.homepage = "https://git.warp.ly/open-source/warply_sdk_framework.git"
spec.license = {
:type => 'MIT',
# :file => 'WarplySDKFrameworkIOS/LICENSE.txt'
}
spec.author = { "billy" => "skourasbl@gmail.com" }
spec.platform = :ios, "11.0"
spec.source = { :git => "https://git.warp.ly/open-source/warply_sdk_framework.git", :tag => "0.0.32" }
spec.public_header_files = "SwiftWarplyFramework.framework/Headers/*.h"
spec.source_files = "SwiftWarplyFramework.framework/headers/*.h"
spec.vendored_frameworks = "SwiftWarplyFramework.framework"
spec.exclude_files = "Classes/Exclude"
# spec.resource_bundles = {
# 'Resources' => ['WarplySDKFrameworkIOS/*.xcassets', 'WarplySDKFrameworkIOS/WarplySDKFrameworkIOS/*.xcassets']
# }
# spec.preserve_paths = 'WarplySDKFrameworkIOS/myApi.h', 'WarplySDKFrameworkIOS/swiftApi.swift'
# spec.vendored_libraries = 'WarplySDKFrameworkIOS/myApi.h', 'WarplySDKFrameworkIOS/swiftApi.swift'
# spec.ios.deployment_target = '11.0'
# spec.frameworks = 'UIKit', 'Foundation'
# spec.requires_arc = true
# spec.subspec 'WarplySDKFrameworkIOS' do |mylib|
# mylib.source_files = 'WarplySDKFrameworkIOS/*.xcassets', 'WarplySDKFrameworkIOS/WarplySDKFrameworkIOS/*.xcassets', "WarplySDKFrameworkIOS/*.png", "WarplySDKFrameworkIOS/*.xcassets", "WarplySDKFrameworkIOS/WarplySDKFrameworkIOS/*.xcassets","WarplySDKFrameworkIOS/*.xib", "WarplySDKFrameworkIOS/WarplySDKFrameworkIOS/*.xib", "WarplySDKFrameworkIOS/*.{h,m}", "WarplySDKFrameworkIOS/*.{h,m}", "WarplySDKFrameworkIOS/**/*.{h,m}", "WarplySDKFrameworkIOS/**/**/*.{h,m}", "WarplySDKFrameworkIOS/**/**/**/*.{h,m}", "WarplySDKFrameworkIOS/*.swift", "*.swift", "WarplySDKFrameworkIOS/WarplySDKFrameworkIOS/*.swift", "WarplySDKFrameworkIOS/WarplySDKFrameworkIOS/WarplySDKFrameworkIOS/*.swift"
# mylib.vendored_frameworks = 'WarplySDKFrameworkIOS/Frameworks/WarplySDKFrameworkIOS.framework'
# end
end
# Uncomment the next line to define a global platform for your project
# platform :ios, '9.0'
target 'SwiftWarplyFramework' do
# Comment the next line if you don't want to use dynamic frameworks
use_frameworks!
# Pods for SwiftWarplyFramework
end
PODFILE CHECKSUM: 54752dc113f1a895fde22654f99199950788b81a
COCOAPODS: 1.11.3
PODFILE CHECKSUM: 54752dc113f1a895fde22654f99199950788b81a
COCOAPODS: 1.11.3
This diff is collapsed. Click to expand it.
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "1240"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"
buildImplicitDependencies = "YES">
<BuildActionEntries>
<BuildActionEntry
buildForTesting = "YES"
buildForRunning = "YES"
buildForProfiling = "YES"
buildForArchiving = "YES"
buildForAnalyzing = "YES">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "0779DA8BF8CD56EC67C289108B77221C"
BuildableName = "Pods_SwiftWarplyFramework.framework"
BlueprintName = "Pods-SwiftWarplyFramework"
ReferencedContainer = "container:Pods.xcodeproj">
</BuildableReference>
</BuildActionEntry>
</BuildActionEntries>
</BuildAction>
<TestAction
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
shouldUseLaunchSchemeArgsEnv = "YES">
<Testables>
</Testables>
</TestAction>
<LaunchAction
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
launchStyle = "0"
useCustomWorkingDirectory = "NO"
ignoresPersistentStateOnLaunch = "NO"
debugDocumentVersioning = "YES"
debugServiceExtension = "internal"
allowLocationSimulation = "YES">
</LaunchAction>
<ProfileAction
buildConfiguration = "Release"
shouldUseLaunchSchemeArgsEnv = "YES"
savedToolIdentifier = ""
useCustomWorkingDirectory = "NO"
debugDocumentVersioning = "YES">
</ProfileAction>
<AnalyzeAction
buildConfiguration = "Debug">
</AnalyzeAction>
<ArchiveAction
buildConfiguration = "Release"
revealArchiveInOrganizer = "YES">
</ArchiveAction>
</Scheme>
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>SchemeUserState</key>
<dict>
<key>Pods-SwiftWarplyFramework.xcscheme</key>
<dict>
<key>isShown</key>
<false/>
<key>orderHint</key>
<integer>0</integer>
</dict>
</dict>
<key>SuppressBuildableAutocreation</key>
<dict/>
</dict>
</plist>
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>CFBundleDevelopmentRegion</key>
<string>en</string>
<key>CFBundleExecutable</key>
<string>${EXECUTABLE_NAME}</string>
<key>CFBundleIdentifier</key>
<string>${PRODUCT_BUNDLE_IDENTIFIER}</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundleName</key>
<string>${PRODUCT_NAME}</string>
<key>CFBundlePackageType</key>
<string>FMWK</string>
<key>CFBundleShortVersionString</key>
<string>1.0.0</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleVersion</key>
<string>${CURRENT_PROJECT_VERSION}</string>
<key>NSPrincipalClass</key>
<string></string>
</dict>
</plist>
# Acknowledgements
This application makes use of the following third party libraries:
Generated by CocoaPods - https://cocoapods.org
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>PreferenceSpecifiers</key>
<array>
<dict>
<key>FooterText</key>
<string>This application makes use of the following third party libraries:</string>
<key>Title</key>
<string>Acknowledgements</string>
<key>Type</key>
<string>PSGroupSpecifier</string>
</dict>
<dict>
<key>FooterText</key>
<string>Generated by CocoaPods - https://cocoapods.org</string>
<key>Title</key>
<string></string>
<key>Type</key>
<string>PSGroupSpecifier</string>
</dict>
</array>
<key>StringsTable</key>
<string>Acknowledgements</string>
<key>Title</key>
<string>Acknowledgements</string>
</dict>
</plist>
#import <Foundation/Foundation.h>
@interface PodsDummy_Pods_SwiftWarplyFramework : NSObject
@end
@implementation PodsDummy_Pods_SwiftWarplyFramework
@end
#ifdef __OBJC__
#import <UIKit/UIKit.h>
#else
#ifndef FOUNDATION_EXPORT
#if defined(__cplusplus)
#define FOUNDATION_EXPORT extern "C"
#else
#define FOUNDATION_EXPORT extern
#endif
#endif
#endif
FOUNDATION_EXPORT double Pods_SwiftWarplyFrameworkVersionNumber;
FOUNDATION_EXPORT const unsigned char Pods_SwiftWarplyFrameworkVersionString[];
CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = NO
GCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1
PODS_BUILD_DIR = ${BUILD_DIR}
PODS_CONFIGURATION_BUILD_DIR = ${PODS_BUILD_DIR}/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME)
PODS_PODFILE_DIR_PATH = ${SRCROOT}/.
PODS_ROOT = ${SRCROOT}/Pods
PODS_XCFRAMEWORKS_BUILD_DIR = $(PODS_CONFIGURATION_BUILD_DIR)/XCFrameworkIntermediates
USE_RECURSIVE_SCRIPT_INPUTS_IN_SCRIPT_PHASES = YES
framework module Pods_SwiftWarplyFramework {
umbrella header "Pods-SwiftWarplyFramework-umbrella.h"
export *
module * { export * }
}
CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = NO
GCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1
PODS_BUILD_DIR = ${BUILD_DIR}
PODS_CONFIGURATION_BUILD_DIR = ${PODS_BUILD_DIR}/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME)
PODS_PODFILE_DIR_PATH = ${SRCROOT}/.
PODS_ROOT = ${SRCROOT}/Pods
PODS_XCFRAMEWORKS_BUILD_DIR = $(PODS_CONFIGURATION_BUILD_DIR)/XCFrameworkIntermediates
USE_RECURSIVE_SCRIPT_INPUTS_IN_SCRIPT_PHASES = YES
<?xml version="1.0" encoding="UTF-8"?>
<Workspace
version = "1.0">
<FileRef
location = "self:">
</FileRef>
</Workspace>
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>IDEDidComputeMac32BitWarning</key>
<true/>
</dict>
</plist>
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>SchemeUserState</key>
<dict>
<key>SwiftWarplyFramework.xcscheme_^#shared#^_</key>
<dict>
<key>orderHint</key>
<integer>1</integer>
</dict>
</dict>
</dict>
</plist>
<?xml version="1.0" encoding="UTF-8"?>
<Workspace
version = "1.0">
<FileRef
location = "group:SwiftWarplyFramework.xcodeproj">
</FileRef>
<FileRef
location = "group:Pods/Pods.xcodeproj">
</FileRef>
</Workspace>
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>IDEDidComputeMac32BitWarning</key>
<true/>
</dict>
</plist>
<?xml version="1.0" encoding="UTF-8"?>
<Bucket
uuid = "345EC41C-58C4-464B-B27A-86C325D23C62"
type = "0"
version = "2.0">
<Breakpoints>
<BreakpointProxy
BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
<BreakpointContent
uuid = "CC62D99B-5AEB-4572-83B5-75E063946307"
shouldBeEnabled = "Yes"
ignoreCount = "0"
continueAfterRunningActions = "No"
filePath = "SwiftWarplyFramework/Warply/Warply.m"
startingColumnNumber = "9223372036854775807"
endingColumnNumber = "9223372036854775807"
startingLineNumber = "1149"
endingLineNumber = "1149"
landmarkName = "-verifyTicketWithSuccessBlock:::failureBlock:"
landmarkType = "7">
</BreakpointContent>
</BreakpointProxy>
</Breakpoints>
</Bucket>
//
// ActiveGiftsViewController.swift
// SwiftWarplyFramework
//
// Created by Βασιλης Σκουρας on 11/5/22.
//
import Foundation
import UIKit
@objc public class ActiveGiftsViewController: UIViewController {
@IBOutlet weak var couponButton: UIButton!
public override func viewWillAppear(_ animated: Bool) {
super.viewWillAppear(animated)
setBackButton()
setNavigationTitle("Ενεργά δώρα")
}
@IBAction func navigateToCoupon(_ sender: Any) {
let storyboard = UIStoryboard(name: "Main", bundle: Bundle(for: MyEmptyClass.self))
let vc = storyboard.instantiateViewController(withIdentifier: "CouponViewController") as UIViewController
self.navigationController?.pushViewController(vc, animated: true)
}
}
//
// CampaignViewController.swift
// SwiftWarplyFramework
//
// Created by Βασιλης Σκουρας on 11/5/22.
//
import Foundation
import UIKit
@objc public class CampaignViewController: UIViewController {
public override func viewWillAppear(_ animated: Bool) {
super.viewWillAppear(animated)
setBackButton()
setNavigationTitle("Καμπάνια")
}
}
//
// CouponViewController.swift
// WarplySDKFrameworkIOS
//
// Created by Manos Chorianopoulos on 5/5/22.
//
import UIKit
class CouponViewController: UIViewController {
@IBOutlet weak var mainView: UIView!
@IBOutlet weak var scrollContentView: UIView!
@IBOutlet weak var couponImageHeight: NSLayoutConstraint!
@IBOutlet weak var redeemButton: UIButton!
@IBOutlet weak var termsLabel: UILabel!
let uiscreen: CGRect = UIScreen.main.bounds
override func viewDidLoad() {
super.viewDidLoad()
// Do any additional setup after loading the view.
setBackButton()
setNavigationTitle("Εκπτωτικό κουπόνι")
mainView.clipsToBounds = true
mainView.layer.cornerRadius = 30
mainView.layer.maskedCorners = [ .layerMinXMinYCorner] // Top left corner radius
couponImageHeight.constant = self.uiscreen.height * 0.25
redeemButton.titleLabel?.font = UIFont.systemFont(ofSize: 15, weight: .medium)
termsLabel.font = UIFont.systemFont(ofSize: 14, weight: UIFont.Weight.medium)
let tap = UITapGestureRecognizer(target: self, action: #selector(CouponViewController.termsTapFunction))
termsLabel.isUserInteractionEnabled = true
termsLabel.addGestureRecognizer(tap)
}
// MARK: - Actions
@objc func termsTapFunction(sender:UITapGestureRecognizer) {
print("Terms tapped!")
}
@IBAction func redeemButtomAction(_ sender: Any) {
let storyboard = UIStoryboard(name: "Main", bundle: Bundle(for: MyEmptyClass.self))
let vc = storyboard.instantiateViewController(withIdentifier: "MakeItAPresentViewController") as UIViewController
self.navigationController?.pushViewController(vc, animated: true)
}
}
//
// CouponsViewController.swift
// WarplySDKFrameworkIOS
//
// Created by Βασιλης Σκουρας on 4/5/22.
//
import Foundation
import UIKit
@objc public class CouponsViewController: UIViewController {
@IBOutlet weak var couponButton: UIButton!
public override func viewWillAppear(_ animated: Bool) {
super.viewWillAppear(animated)
setBackButton()
setNavigationTitle("Εκπτωτικό κουπόνι")
}
@IBAction func navigateToCoupon(_ sender: Any) {
let storyboard = UIStoryboard(name: "Main", bundle: Bundle(for: MyEmptyClass.self))
let vc = storyboard.instantiateViewController(withIdentifier: "CouponViewController") as UIViewController
self.navigationController?.pushViewController(vc, animated: true)
}
}
//
// DetailsViewController.swift
// WarplySDKFrameworkIOS
//
// Created by Βασιλης Σκουρας on 5/5/22.
//
import Foundation
import UIKit
@objc public class DetailsViewController: UIViewController {
public override func viewWillAppear(_ animated: Bool) {
super.viewWillAppear(animated)
setBackButton()
setNavigationTitle("Ανάλυση")
}
}
//
// GiftsViewController.swift
// WarplySDKFrameworkIOS
//
// Created by Βασιλης Σκουρας on 5/5/22.
//
import Foundation
import UIKit
@objc public class GiftsViewController: UIViewController {
@IBOutlet weak var campaignButton: UIButton!
@IBOutlet weak var couponButton: UIButton!
public override func viewWillAppear(_ animated: Bool) {
super.viewWillAppear(animated)
setBackButton()
setNavigationTitle("Gifts for You")
}
@IBAction func navigateToCampaign(_ sender: Any) {
let storyboard = UIStoryboard(name: "Main", bundle: Bundle(for: MyEmptyClass.self))
let vc = storyboard.instantiateViewController(withIdentifier: "CampaignViewController") as UIViewController
self.navigationController?.pushViewController(vc, animated: true)
}
@IBAction func navigateToCoupon(_ sender: Any) {
let storyboard = UIStoryboard(name: "Main", bundle: Bundle(for: MyEmptyClass.self))
let vc = storyboard.instantiateViewController(withIdentifier: "CouponViewController") as UIViewController
self.navigationController?.pushViewController(vc, animated: true)
}
}
//
// WarplyEvents.h
// App
//
// Created by Fotios Kalaitzidis on 23/10/2018.
// Copyright © 2018 Facebook. All rights reserved.
//
#import <Foundation/Foundation.h>
@interface WarplyReactMethods : NSObject
@end
//
// WarplyEvents.m
// App
//
// Created by Fotios Kalaitzidis on 23/10/2018.
// Copyright © 2018 Facebook. All rights reserved.
//
#import "WarplyReactMethods.h"
#import "WLUserManager.h"
#import "WLAnalyticsManager.h"
#import "Warply.h"
#import <AdSupport/AdSupport.h>
@implementation WarplyReactMethods
- (void) sendEvent: (NSString *) eventName priority: (BOOL) priority {
NSString *event_Name = eventName;
NSNumber *time_submitted = [NSNumber numberWithDouble:[[NSDate date] timeIntervalSince1970]];
NSDictionary *inapp_event = [NSDictionary dictionaryWithObjectsAndKeys:event_Name, @"event_id", nil, @"page_id", time_submitted, @"time_submitted", nil, @"action_metadata", nil];
NSDictionary *eventContext = [NSDictionary dictionaryWithObject:inapp_event forKey:@"inapp_analytics"];
WLEventSimple *simpleEvent = [[WLEventSimple alloc] initWithType:@"inapp_analytics" andContext:eventContext];
[[Warply sharedService] addEvent:simpleEvent priority:priority];
}
- (NSString *) getUniqueId {
return [[[UIDevice currentDevice] identifierForVendor] UUIDString];
}
- (NSString *) getAdvertisementId {
return [[ASIdentifierManager sharedManager].advertisingIdentifier UUIDString];
}
@end
//
// MFYViewController.swift
// WarplySDKFrameworkIOS
//
// Created by Βασιλης Σκουρας on 5/5/22.
//
import Foundation
import UIKit
@objc public class MFYViewController: UIViewController {
public override func viewWillAppear(_ animated: Bool) {
super.viewWillAppear(animated)
setBackButton()
setNavigationTitle("More for you")
}
}
This diff is collapsed. Click to expand it.
//
// MakeItAPresentViewController.swift
// SwiftWarplyFramework
//
// Created by Βασιλης Σκουρας on 11/5/22.
//
import Foundation
import UIKit
@objc public class MakeItAPresentViewController: UIViewController {
public override func viewWillAppear(_ animated: Bool) {
super.viewWillAppear(animated)
setBackButton()
setNavigationTitle("Κάντο δώρο!")
}
}
{
"info" : {
"author" : "xcode",
"version" : 1
}
}
{
"images" : [
{
"filename" : "ic_back.png",
"idiom" : "universal",
"scale" : "1x"
},
{
"filename" : "ic_back-1.png",
"idiom" : "universal",
"scale" : "2x"
},
{
"filename" : "ic_back-2.png",
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}
This diff is collapsed. Click to expand it.
//
// MyEmptyClass.swift
// WarplySDKFrameworkIOS
//
// Created by Βασιλης Σκουρας on 14/4/22.
//
import Foundation
public class MyEmptyClass {
}
# ``SwiftWarplyFramework``
<!--@START_MENU_TOKEN@-->Summary<!--@END_MENU_TOKEN@-->
## Overview
<!--@START_MENU_TOKEN@-->Text<!--@END_MENU_TOKEN@-->
## Topics
### <!--@START_MENU_TOKEN@-->Group<!--@END_MENU_TOKEN@-->
- <!--@START_MENU_TOKEN@-->``Symbol``<!--@END_MENU_TOKEN@-->
\ No newline at end of file
//
// ViewControllerExtensions.swift
// WarplySDKFrameworkIOS
//
// Created by Manos Chorianopoulos on 5/5/22.
//
import UIKit
extension UIViewController {
func setBackButton() {
let uiscreen: CGRect = UIScreen.main.bounds
let backButton = UIButton(type: UIButton.ButtonType.custom) as UIButton
backButton.frame = CGRect(x: 0, y: 0, width: uiscreen.height * 0.025, height: uiscreen.height * 0.02)
backButton.imageView!.contentMode = .scaleAspectFit
//backButton.setBackgroundImage(UIImage(named:Assets.Navigation.backButton), for: UIControlState())
backButton.setImage(UIImage(named: "ic_back", in: Bundle(for: MyEmptyClass.self), compatibleWith: nil), for: .normal)
// backButton.imageEdgeInsets = UIEdgeInsets(top: 0, left: -20, bottom: 0, right: 0)
backButton.addTarget(self, action: #selector(moveToBack(_:)), for: .touchUpInside)
backButton.translatesAutoresizingMaskIntoConstraints = false
// Add width, height constraints
let widthContraints = NSLayoutConstraint(item: backButton, attribute: NSLayoutConstraint.Attribute.width, relatedBy: NSLayoutConstraint.Relation.equal, toItem: nil, attribute: NSLayoutConstraint.Attribute.notAnAttribute, multiplier: 1, constant: uiscreen.height * 0.025)
let heightContraints = NSLayoutConstraint(item: backButton, attribute: NSLayoutConstraint.Attribute.height, relatedBy: NSLayoutConstraint.Relation.equal, toItem: nil, attribute: NSLayoutConstraint.Attribute.notAnAttribute, multiplier: 1, constant: uiscreen.height * 0.02)
NSLayoutConstraint.activate([heightContraints,widthContraints])
let leftBarButtonItem: UIBarButtonItem = UIBarButtonItem(customView: backButton)
self.navigationItem.setLeftBarButton(leftBarButtonItem, animated: false)
self.navigationItem.title = ""
}
@objc func moveToBack(_ sender:UIButton){
self.navigationController?.popViewController(animated: true)
}
func setNavigationTitle(_ title: String) {
let uiscreen: CGRect = UIScreen.main.bounds
let titleLabel = UILabel(frame: CGRect(x: 0, y: 0, width: uiscreen.width * 0.7, height: uiscreen.height * 0.03))
titleLabel.text = title
titleLabel.textColor = UIColor(red: 0.21, green: 0.32, blue: 0.41, alpha: 1.00)
titleLabel.font = UIFont.systemFont(ofSize: 16, weight: UIFont.Weight.medium)
titleLabel.adjustsFontSizeToFitWidth = true
titleLabel.textAlignment = .center
self.navigationItem.titleView = titleLabel
}
}
//
// WalletViewController.swift
// WarplySDKFrameworkIOS
//
// Created by Βασιλης Σκουρας on 5/5/22.
//
import Foundation
import UIKit
@objc public class WalletViewController: UIViewController {
@IBOutlet weak var activeGiftsButton: UIButton!
public override func viewWillAppear(_ animated: Bool) {
super.viewWillAppear(animated)
setBackButton()
setNavigationTitle("My loyalty wallet")
}
@IBAction func navigateToActiveGifts(_ sender: Any) {
let storyboard = UIStoryboard(name: "Main", bundle: Bundle(for: MyEmptyClass.self))
let vc = storyboard.instantiateViewController(withIdentifier: "ActiveGiftsViewController") as UIViewController
self.navigationController?.pushViewController(vc, animated: true)
}
}
/*
Copyright 2010-2016 Warply Inc. All rights reserved.
Redistribution and use in source and binary forms, without modification,
are permitted provided that the following conditions are met:
1. Redistributions of source code must retain the above copyright notice, this
list of conditions and the following disclaimer.
2. Redistributions in binaryform must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.
THIS SOFTWARE IS PROVIDED BY THE WARPLY LTD ``AS IS'' AND ANY EXPRESS OR
IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO
EVENT SHALL WARPLY LTD OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
/*!
@header WLEvent.h
The WLEvent provides a functional interface for Warply events.
Use the methods declared here to initialise and create events with arbitrary
context and type.
@copyright Warply Inc.
*/
#import <Foundation/Foundation.h>
/*!
@class WLEvent
@discussion This class provides methods for creating an event with arbitrary
context.
*/
@interface WLEvent : NSObject
{
@protected
NSString *_time;
NSMutableDictionary *_data;
}
/*!
@methodgroup Class Methods
@discussion Convinience class methods for initialising an event.
*/
/*!
@abstract Creates an event.
@discussion Initializes and returns a newly allocated WLEvent object.
Initializes and returns a newly allocated WLEvent object.
@return Returns WLEvent object.
*/
+ (id)event;
/*!
@abstract Creates an event with arbitrary context.
@discussion Initializes and returns a newly allocated WLEvent object with the
arbitrary context.
@param context A dictionary object with arbitrary key-value entries.
@return Returns WLEvent object.
*/
+ (id)eventWithContext:(NSDictionary*)context;
/*!
@property time
@abstract A string with event created time in epoch format. Read only property.
*/
@property (nonatomic, readonly) NSString *time;
/*!
@property data
@abstract A dictionary with event context. Read only property.
*/
@property (nonatomic, readonly) NSMutableDictionary *data;
/*!
@methodgroup Initialising Event
*/
/*!
@abstract Initialise an WLevent object.
@discussion Initializes and returns a newly allocated WLEvent object with the
arbitrary context.
@param context A dictionary object with arbitrary key-value entries.
@return Returns WLEvent object.
*/
- (id)initWithContext:(NSDictionary*)context;
/*!
@methodgroup Getting Event Type
*/
/*!
@abstract Get event type.
@discussion This method returns the type of the event.
@return Returns a string object with event type.
*/
- (NSString *)getType;
/*!
@methodgroup Adding Context to Event
*/
/*!
@abstract Add context to event.
@discussion This method adds a key-value pair to existing context of an event.
@param value An id object with the value of the key.
@param key A string object with the key of the value.
*/
- (void)addDataWithValue:(id)value forKey:(NSString*)key;
@end
/*!
@class WLEventSimple
@discussion This class provides methods for creating an event with arbitrary
context and type.
*/
@interface WLEventSimple : WLEvent
{
@private
NSString *_type;
}
/*!
@methodgroup Class Methods
@discussion Convinience class methods for initialising an event.
*/
/*!
@abstract Creates an event with arbitrary type.
@discussion Initializes and returns a newly allocated WLEventSimple object
with arbitrary type.
@param aType A string object with the event type.
@return Returns WLEvent object.
*/
+ (id)eventWithType:(NSString*)aType;
/*!
@abstract Creates an event with arbitrary type and context.
@discussion Initializes and returns a newly allocated WLEventSimple object
with arbitrary type and context.
@param aType A string object with the event type.
@param context A dictionary with arbitrary context.
@return Returns WLEvent object.
*/
+ (id)eventWithType:(NSString*)aType andContext:(NSDictionary*)context;
/*!
@methodgroup Initialising Event
*/
/*!
@abstract Initialise an event with arbitrary type.
@discussion Initializes and returns a newly allocated WLEvent object with the
arbitrary type.
@param aType A string object with the event type.
@return Returns WLEvent object.
*/
- (id)initWithType:(NSString*)aType;
/*!
@abstract Initialise an event with arbitrary type and context.
@discussion Initializes and returns a newly allocated WLEvent object with the
arbitrary type and context.
@param aType A string object with the event type.
@param context A dictionary with arbitrary context.
@return Returns WLEvent object.
*/
- (id)initWithType:(NSString*)aType andContext:(NSDictionary*)context;
@end
/*
Copyright 2010-2016 Warply Inc. All rights reserved.
Redistribution and use in source and binary forms, without modification,
are permitted provided that the following conditions are met:
1. Redistributions of source code must retain the above copyright notice, this
list of conditions and the following disclaimer.
2. Redistributions in binaryform must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.
THIS SOFTWARE IS PROVIDED BY THE WARPLY LTD ``AS IS'' AND ANY EXPRESS OR
IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO
EVENT SHALL WARPLY LTD OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#import "WLEvent.h"
#import "WLGlobals.h"
@interface WLEvent()
- (void)gatherIndividualData:(NSDictionary*)context;
- (void)gatherData:(NSDictionary*)context;
@end
@implementation WLEvent
@synthesize time = _time;
@synthesize data = _data;
#pragma mark - Static Methods
///////////////////////////////////////////////////////////////////////////////////////////////////
+ (id)event
{
#if ! __has_feature(objc_arc)
return [[[self alloc] init] autorelease];
#else
return [[self alloc] init];
#endif
}
///////////////////////////////////////////////////////////////////////////////////////////////////
+ (id)eventWithContext:(NSDictionary*)context
{
#if ! __has_feature(objc_arc)
return [[[self alloc] initWithContext:context] autorelease];
#else
return [[self alloc] initWithContext:context];
#endif
}
#pragma mark - Initialization
///////////////////////////////////////////////////////////////////////////////////////////////////
- (id)init
{
self = [super init];
if (self) {
_data = [NSMutableDictionary new];
}
return self;
}
///////////////////////////////////////////////////////////////////////////////////////////////////
- (id)initWithContext:(NSDictionary*)context
{
self = [self init];
if (self) {
[self gatherData:context];
}
return self;
}
#pragma mark - Public Methods
///////////////////////////////////////////////////////////////////////////////////////////////////
- (NSString*)getType
{
return @"base";
}
///////////////////////////////////////////////////////////////////////////////////////////////////
- (void)addDataWithValue:(id)value forKey:(NSString*)key
{
if (value && key)
[_data setObject:value forKey:key];
}
#pragma mark - Private Methods
///////////////////////////////////////////////////////////////////////////////////////////////////
- (void)gatherIndividualData:(NSDictionary*)context { }
///////////////////////////////////////////////////////////////////////////////////////////////////
- (void)gatherData:(NSDictionary*)context {
// in case we re-use a event object
_time = [NSString stringWithFormat:@"%f",[[NSDate date] timeIntervalSince1970]];
[_data removeAllObjects];
// gather individual data
[self gatherIndividualData:context];
}
@end
///////////////////////////////////////////////////////////////////////////////////////////////////
@implementation WLEventSimple
#pragma mark - Static Methods
///////////////////////////////////////////////////////////////////////////////////////////////////
+ (id)eventWithType:(NSString*)aType
{
return [[self alloc] initWithType:aType];
}
///////////////////////////////////////////////////////////////////////////////////////////////////
+ (id)eventWithType:(NSString*)aType andContext:(NSDictionary*)context
{
return [[self alloc] initWithType:aType andContext:context];
}
#pragma mark - Initialization
///////////////////////////////////////////////////////////////////////////////////////////////////
- (id)initWithType:(NSString*)aType
{
self=[super init];
if (self) {
_type = aType;
}
return self;
}
///////////////////////////////////////////////////////////////////////////////////////////////////
- (id)initWithType:(NSString*)aType andContext:(NSDictionary*)context
{
self = [super initWithContext:context];
if (self) {
_type = aType;
}
return self;
}
#pragma mark - Public Methods
///////////////////////////////////////////////////////////////////////////////////////////////////
- (NSString*)getType
{
return _type;
}
#pragma mark - Override Methods
///////////////////////////////////////////////////////////////////////////////////////////////////
- (void)gatherIndividualData:(NSDictionary*)context
{
WLLOG(@"WLEvent Context: %@", context);
[_data addEntriesFromDictionary:context];
}
@end
/*
Copyright 2010-2016 Warply Inc. All rights reserved.
Redistribution and use in source and binary forms, without modification,
are permitted provided that the following conditions are met:
1. Redistributions of source code must retain the above copyright notice, this
list of conditions and the following disclaimer.
2. Redistributions in binaryform must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.
THIS SOFTWARE IS PROVIDED BY THE WARPLY LTD ``AS IS'' AND ANY EXPRESS OR
IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO
EVENT SHALL WARPLY LTD OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
///////////////////////////////////////////////////////////////////////////////
// Base URL
//#define WARP_PRODUCTION_BASE_URL @"https://engage-stage.warp.ly"
//#define WARP_HOST @"engage-stage.warp.ly"
//#define WARP_ERROR_DOMAIN @"engage-stage.warp.ly"
extern NSString* WARP_PRODUCTION_BASE_URL;
extern NSString* WARP_HOST;
extern NSString* WARP_ERROR_DOMAIN;
extern NSString* MERCHANT_ID;
extern NSString* LANG;
#define WARP_PAGE_URL_FORMAT @"%@/api/session/%@"
#define WARP_IMAGE_URL_FORMAT @"%@/api/session/logo/%@"
///////////////////////////////////////////////////////////////////////////////
// Settings
#ifdef _WL_VERSION
#define WL_VERSION @ _WL_VERSION
#else
#define WL_VERSION @ "3.2.0a"
#endif
#define GEOFENCING_POIS_ENABLED @"GEOFENCING_POIS_ENABLED"
#define WL_IOS_LOCATION_FOREGROUND_MODE @"IOS_LOCATION_FOREGROUND_MODE"
#define WL_IOS_LOCATION_BACKGROUND_MODE @"IOS_LOCATION_BACKGROUND_MODE"
#define WL_IOS_GEOFENCING_ENABLED @"IOS_GEOFENCING_ENABLED"
#define WL_IOS_FOREGROUND_DISTANCE_FILTER @"IOS_FOREGROUND_DISTANCE_FILTER"
#define WL_IOS_BACKGROUND_DISTANCE_FILTER @"IOS_BACKGROUND_DISTANCE_FILTER"
#define WL_DEVICE_INFO_ENABLED @"DEVICE_INFO_ENABLED"
#define WL_OFFERS_ENABLED @"OFFERS_ENABLED"
#define WL_CONSUMER_DATA_ENABLED @"CONSUMER_DATA_ENABLED"
#define WL_USER_SESSION_ENABLED @"USER_SESSION_ENABLED"
#define WL_CUSTOM_ANALYTICS_ENABLED @"CUSTOM_ANALYTICS_ENABLED"
#define WL_USER_TAGGING_ENABLED @"USER_TAGGING_ENABLED"
#define WL_APPLICATION_DATA_ENABLED @"APPLICATION_DATA_ENABLED"
#define WL_WARPLY_ENABLED @"WARPLY_ENABLED"
#define WL_FEATURES_CHECK_INTERVAL @"FEATURES_CHECK_INTERVAL"
#define WL_LIFECYCLE_ANALYTICS_ENABLED @"LIFECYCLE_ANALYTICS_ENABLED"
#define WL_IOS_LOCATION_FOREGROUND_DESIRED_ACCURACY @"IOS_LOCATION_FOREGROUND_DESIRED_ACCURACY"
#define WL_IOS_LOCATION_BACKGROUND_DESIRED_ACCURACY @"IOS_LOCATION_BACKGROUND_DESIRED_ACCURACY"
#define WL_IOS_DEVICE_IS_WARPED @"is_warped"
#define WL_IOS_DEVICE_HAS_DEVICE_INFO @"has_device_info"
#define WL_IOS_DEVICE_HAS_APPLICATION_INFO @"has_application_info"
#define WL_FEATURE_IS_DISABLED_WITH_KEY(KEY) \
([[NSUserDefaults standardUserDefaults] boolForKey:KEY] == NO \
&& [[NSUserDefaults standardUserDefaults] objectForKey:KEY] != nil) \
#define WL_WARP_NOTIFICATIONS_ENABLED @"warp_enabled"
#define WL_APPLICATION_DATA @"application_data"
#define WL_DEVICE_STATUS @"device_status"
#define WL_BEACON_ENABLED @"BEACON_ENABLED"
#define WL_BEACON_TIME_INTERVAL_TO_RESEND @"BEACON_TIME_INTERVAL_TO_RESEND"
///////////////////////////////////////////////////////////////////////////////
// Logging
#ifdef DEBUG
#define WLLOG(xx, ...) NSLog(@"%s(%d): " xx, __PRETTY_FUNCTION__, __LINE__, ##__VA_ARGS__)
#else
#define WLLOG(xx, ...) ((void)0)
#endif // #ifdef DEBUG
///////////////////////////////////////////////////////////////////////////////
// Version Interface
#define WL_VERSION_INTERFACE() \
+ (NSString *)get;
#define WL_VERSION_IMPLEMENTATION(VERSION_STR) \
+ (NSString *)get { \
return VERSION_STR; \
} \
///////////////////////////////////////////////////////////////////////////////
// System Versioning
#define SYSTEM_VERSION_EQUAL_TO(v) ([[[UIDevice currentDevice] systemVersion] compare:v options:NSNumericSearch] == NSOrderedSame)
#define SYSTEM_VERSION_GREATER_THAN(v) ([[[UIDevice currentDevice] systemVersion] compare:v options:NSNumericSearch] == NSOrderedDescending)
#define SYSTEM_VERSION_GREATER_THAN_OR_EQUAL_TO(v) ([[[UIDevice currentDevice] systemVersion] compare:v options:NSNumericSearch] != NSOrderedAscending)
#define SYSTEM_VERSION_LESS_THAN(v) ([[[UIDevice currentDevice] systemVersion] compare:v options:NSNumericSearch] == NSOrderedAscending)
#define SYSTEM_VERSION_LESS_THAN_OR_EQUAL_TO(v) ([[[UIDevice currentDevice] systemVersion] compare:v options:NSNumericSearch] != NSOrderedDescending)
///////////////////////////////////////////////////////////////////////////////
// Enum Versioning
#ifdef __IPHONE_6_0 // iOS6 and later
# define WLTextAlignmentCenter NSTextAlignmentCenter
# define WLTextAlignmentLeft NSTextAlignmentLeft
# define WLTextAlignmentRight NSTextAlignmentRight
# define WLTextTruncationTail NSLineBreakByTruncatingTail
# define WLTextTruncationMiddle NSLineBreakByWordWrapping
# define WLLineBreakByWordWrapping NSLineBreakByWordWrapping
#else // older versions
# define WLTextAlignmentCenter UITextAlignmentCenter
# define WLTextAlignmentLeft UITextAlignmentLeft
# define WLTextAlignmentRight UITextAlignmentRight
# define WLTextTruncationTail UILineBreakModeTailTruncation
# define WLTextTruncationMiddle UILineBreakModeMiddleTruncation
# define WLLineBreakByWordWrapping UILineBreakModeWordWrap
#endif
This diff is collapsed. Click to expand it.
This diff could not be displayed because it is too large.
/*
Copyright 2010-2016 Warply Inc. All rights reserved.
Redistribution and use in source and binary forms, without modification,
are permitted provided that the following conditions are met:
1. Redistributions of source code must retain the above copyright notice, this
list of conditions and the following disclaimer.
2. Redistributions in binaryform must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.
THIS SOFTWARE IS PROVIDED BY THE WARPLY LTD ``AS IS'' AND ANY EXPRESS OR
IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO
EVENT SHALL WARPLY LTD OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#import <Foundation/Foundation.h>
#import <StoreKit/StoreKit.h>
#import "Warply.h"
@interface WLAPPActionHandler : NSObject <WLActionHandler,SKStoreProductViewControllerDelegate>
@end
/*
Copyright 2010-2016 Warply Inc. All rights reserved.
Redistribution and use in source and binary forms, without modification,
are permitted provided that the following conditions are met:
1. Redistributions of source code must retain the above copyright notice, this
list of conditions and the following disclaimer.
2. Redistributions in binaryform must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.
THIS SOFTWARE IS PROVIDED BY THE WARPLY LTD ``AS IS'' AND ANY EXPRESS OR
IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO
EVENT SHALL WARPLY LTD OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#import "WLAPPActionHandler.h"
#import "WLAnalyticsManager.h"
#import "WLInboxItemViewController.h"
#import "NSString+SSToolkitAdditions.h"
#import "UIViewController+WLAdditions.h"
@interface WLAPPActionHandler ()
@property (nonatomic, assign) WLInboxItemViewController *inboxVC;
@property (nonatomic) BOOL *loadingProduct;
@end
@implementation WLAPPActionHandler
#pragma mark - Static Methods
////////////////////////////////////////////////////////////////////////////////
- (BOOL)canHandleActionUrl:(NSURL *)url
{
return [url.scheme isEqualToString: @"itms-apps"];
}
#pragma mark - Override Methods
////////////////////////////////////////////////////////////////////////////////
- (void)handleActionUrl:(NSURL *)url
{
UINavigationController *inboxNavCon = (UINavigationController *)[([UIApplication sharedApplication].delegate).window.rootViewController topModalViewController];
self.inboxVC = [inboxNavCon.viewControllers objectAtIndex:0];
NSString *appID = nil;
if ([SKStoreProductViewController class]) {
__block SKStoreProductViewController *storeViewController = [[SKStoreProductViewController alloc] init];
storeViewController.delegate = self;
NSString *escapedResourceSpecifier = [url.resourceSpecifier stringByReplacingPercentEscapesUsingEncoding:NSUTF8StringEncoding];
NSRange appIDRange = [escapedResourceSpecifier rangeOfString:@"id"];
NSRange appQuestionMarkRange = [escapedResourceSpecifier rangeOfString:@"?"];
if (appIDRange.location != NSNotFound && appQuestionMarkRange.location != NSNotFound) {
appID = [escapedResourceSpecifier substringWithRange:NSMakeRange(appIDRange.location + 2, appQuestionMarkRange.location - (appIDRange.location + 2))];
}
NSDictionary *parameters = @{SKStoreProductParameterITunesItemIdentifier:[NSNumber numberWithInteger:[appID intValue]]};
[storeViewController loadProductWithParameters:parameters
completionBlock:^(BOOL result, NSError *error) {
if (result) {
[self.inboxVC presentViewController:storeViewController animated:YES completion:nil];
}
}];
} else {
[[UIApplication sharedApplication] openURL:url];
}
[WLAnalyticsManager logUrgentEventWithEventId:@"NB_CUSTOM_ACTION" pageId:@"APP_DOWNLOAD" actionMetadata:@{@"result":@[@"APPSTORE"], @"session_uuid":self.inboxVC.session_uuid, @"url": [url absoluteString]}];
}
#pragma mark - SKStoreProductViewControllerDelegate
////////////////////////////////////////////////////////////////////////////////
-(void)productViewControllerDidFinish:(SKStoreProductViewController *)viewController
{
[viewController dismissViewControllerAnimated:YES completion:nil];
}
@end
/*
Copyright 2010-2016 Warply Inc. All rights reserved.
Redistribution and use in source and binary forms, without modification,
are permitted provided that the following conditions are met:
1. Redistributions of source code must retain the above copyright notice, this
list of conditions and the following disclaimer.
2. Redistributions in binaryform must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.
THIS SOFTWARE IS PROVIDED BY THE WARPLY LTD ``AS IS'' AND ANY EXPRESS OR
IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO
EVENT SHALL WARPLY LTD OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#import <MessageUI/MessageUI.h>
#import "Warply.h"
@interface WLSMSActionHandlerDeprecated : NSObject <MFMessageComposeViewControllerDelegate, WLActionHandler>
@end
/*
Copyright 2010-2016 Warply Inc. All rights reserved.
Redistribution and use in source and binary forms, without modification,
are permitted provided that the following conditions are met:
1. Redistributions of source code must retain the above copyright notice, this
list of conditions and the following disclaimer.
2. Redistributions in binaryform must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.
THIS SOFTWARE IS PROVIDED BY THE WARPLY LTD ``AS IS'' AND ANY EXPRESS OR
IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO
EVENT SHALL WARPLY LTD OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#import "WLSMSActionHandlerDeprecated.h"
#import "WLGlobals.h"
#import "WLInboxItemViewController.h"
#import "UIViewController+WLAdditions.h"
@interface WLSMSActionHandlerDeprecated ()
@property (nonatomic , weak) WLInboxItemViewController *inboxVC;
@end
@implementation WLSMSActionHandlerDeprecated
#pragma mark - Static Methods
///////////////////////////////////////////////////////////////////////////////////////////////////
- (BOOL)canHandleActionUrl:(NSURL *)url
{
return [[url scheme] isEqualToString: @"rsms"];
}
#pragma mark - Override Methods
///////////////////////////////////////////////////////////////////////////////////////////////////
- (void)handleActionUrl:(NSURL *)url
{
self.inboxVC = (WLInboxItemViewController *)[([UIApplication sharedApplication].delegate).window.rootViewController topModalViewController];
NSArray *args = [url.resourceSpecifier componentsSeparatedByString:@"/"];
if (args == nil)
return;
if ([args count] < 4)
return;
MFMessageComposeViewController *smsController = [[MFMessageComposeViewController alloc] init];
@try {
[smsController setRecipients:[NSArray arrayWithObject:[args objectAtIndex:4]]];
//[smsController setBody:[NSString stringWithFormat:@"Hello from %@", BRAND_NAME]];
if ([args count] > 4) {
NSString *body = [[args objectAtIndex:5] stringByReplacingPercentEscapesUsingEncoding:NSUTF8StringEncoding];
[smsController setBody:body];
}
[smsController setMessageComposeDelegate:self];
[_inboxVC presentViewController:smsController animated:YES completion:nil];
}
@finally {
}
}
#pragma mark - MFMessageComposeViewControllerDelegate
///////////////////////////////////////////////////////////////////////////////////////////////////
- (void)messageComposeViewController:(MFMessageComposeViewController *)controller didFinishWithResult:(MessageComposeResult)result
{
WLInboxItemViewController *inboxItemViewController = (WLInboxItemViewController *)[([UIApplication sharedApplication].delegate).window.rootViewController topModalViewController];
NSString *resultString;
switch (result) {
case MessageComposeResultCancelled:
resultString = @"sms_cancelled";
break;
case MessageComposeResultFailed:
resultString = @"sms_failed";
break;
case MessageComposeResultSent:
resultString = @"sms_sent";
}
[WLAnalyticsManager logEventWithEventId:@"NB_ACTION" pageId:inboxItemViewController.session_uuid actionMetadata:[NSDictionary dictionaryWithObjectsAndKeys:resultString, @"sms_result", self.inboxVC.requestedUrl.absoluteString, @"action_url", nil]];
[controller dismissViewControllerAnimated:YES completion:nil];
}
@end
/*
Copyright 2010-2016 Warply Inc. All rights reserved.
Redistribution and use in source and binary forms, without modification,
are permitted provided that the following conditions are met:
1. Redistributions of source code must retain the above copyright notice, this
list of conditions and the following disclaimer.
2. Redistributions in binaryform must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.
THIS SOFTWARE IS PROVIDED BY THE WARPLY LTD ``AS IS'' AND ANY EXPRESS OR
IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO
EVENT SHALL WARPLY LTD OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#import <MessageUI/MessageUI.h>
#import "Warply.h"
@interface WLSMSActionHanlder : NSObject <MFMessageComposeViewControllerDelegate, WLActionHandler>
@end
\ No newline at end of file
/*
Copyright 2010-2016 Warply Inc. All rights reserved.
Redistribution and use in source and binary forms, without modification,
are permitted provided that the following conditions are met:
1. Redistributions of source code must retain the above copyright notice, this
list of conditions and the following disclaimer.
2. Redistributions in binaryform must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.
THIS SOFTWARE IS PROVIDED BY THE WARPLY LTD ``AS IS'' AND ANY EXPRESS OR
IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO
EVENT SHALL WARPLY LTD OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#import "WLSMSActionHanlder.h"
#import "WLGlobals.h"
#import "WLAnalyticsManager.h"
#import "WLInboxItemViewController.h"
#import "WLBaseItem.h"
#import "UIViewController+WLAdditions.h"
@interface WLSMSActionHanlder ()
@property (nonatomic, weak) WLInboxItemViewController *inboxVC;
@end
@implementation WLSMSActionHanlder
#pragma mark - Static Methods
///////////////////////////////////////////////////////////////////////////////////////////////////
- (BOOL)canHandleActionUrl:(NSURL *)url
{
return [url.scheme isEqualToString: @"sms"];
}
#pragma mark - Override Methods
///////////////////////////////////////////////////////////////////////////////////////////////////
- (void)handleActionUrl:(NSURL *)url
{
UINavigationController *inboxNavCon = (UINavigationController *)[([UIApplication sharedApplication].delegate).window.rootViewController topModalViewController];
self.inboxVC = [inboxNavCon.viewControllers objectAtIndex:0];
if (![MFMessageComposeViewController canSendText]) {
UIAlertView *alert = [[UIAlertView alloc] initWithTitle:NSLocalizedString(@"This device does not support text messages", @"Warply") message:nil delegate:nil cancelButtonTitle:NSLocalizedString(@"OK", @"Warply") otherButtonTitles:nil];
[alert show];
return;
}
WLLOG(@"SMS URI: %@", url.absoluteString);
if (url.resourceSpecifier == nil) {
return;
}
NSString *escapedResourceSpecifier = [url.resourceSpecifier stringByReplacingPercentEscapesUsingEncoding:NSUTF8StringEncoding];
NSArray *args = [escapedResourceSpecifier componentsSeparatedByCharactersInSet:[NSCharacterSet characterSetWithCharactersInString:@"?&"]];
NSString *recipientsString = [args objectAtIndex:0];
NSArray *recipients = [recipientsString componentsSeparatedByString:@","];
NSString *bodyString = nil;
for (NSString *argument in args) {
if ([argument isEqualToString:recipientsString]) {
continue;
}
NSRange bodyKeyRange = [argument rangeOfString:@"body="];
if (bodyKeyRange.location != NSNotFound) {
bodyString = [argument substringFromIndex:bodyKeyRange.length];
}
}
MFMessageComposeViewController *smsController = [[MFMessageComposeViewController alloc] init];
[smsController setRecipients:recipients];
[smsController setBody:bodyString];
[smsController setMessageComposeDelegate:self];
[_inboxVC presentViewController:smsController animated:YES completion:nil];
}
#pragma mark - MFMessageComposeViewControllerDelegate
///////////////////////////////////////////////////////////////////////////////////////////////////
- (void)messageComposeViewController:(MFMessageComposeViewController *)controller didFinishWithResult:(MessageComposeResult)result
{
NSArray *results;
switch (result) {
case MessageComposeResultCancelled:
results = @[@"sms_prompt_clicked", @"sms_cancelled"];
break;
case MessageComposeResultFailed:
results = @[@"sms_prompt_clicked", @"sms_failed"];
break;
case MessageComposeResultSent:
results = @[@"sms_prompt_clicked", @"sms_sent"];
}
[WLAnalyticsManager logUrgentEventWithEventId:@"NB_CUSTOM_ACTION" pageId:@"SMS" actionMetadata:@{@"session_uuid": self.inboxVC.session_uuid, @"result":results}];
[controller dismissViewControllerAnimated:YES completion:nil];
}
@end
This diff is collapsed. Click to expand it.