Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 9 additions & 11 deletions Example/Pods/Pods.xcodeproj/project.pbxproj

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

30 changes: 15 additions & 15 deletions GLInAppPurchase/Classes/GLInAppPurchaseUI.swift
Original file line number Diff line number Diff line change
Expand Up @@ -281,7 +281,7 @@ class ContainerView:UIView{
// content.autoresizingMask = [.FlexibleHeight, .FlexibleWidth]
self.addSubview(content)

NotificationCenter.default.addObserver(self, selector: #selector(orientationChange(_:)), name: NSNotification.Name.UIDeviceOrientationDidChange, object: nil)
NotificationCenter.default.addObserver(self, selector: #selector(orientationChange(_:)), name: UIDevice.orientationDidChangeNotification, object: nil)
}

///Setup all the UI Components
Expand All @@ -295,18 +295,18 @@ class ContainerView:UIView{
var index = 0
var width = imageScrollView.frame.size.width
for image in fullVersionFeatures_ImageSet {
let height = image.1.characters.count != 0 ? imageScrollView.frame.size.height - 45 : imageScrollView.frame.size.height
let height = image.1.count != 0 ? imageScrollView.frame.size.height - 45 : imageScrollView.frame.size.height

let imageView = UIImageView(frame: CGRect(x: x,y: 0,width: width,height: height))
imageView.contentMode = UIViewContentMode.scaleAspectFit
imageView.contentMode = UIView.ContentMode.scaleAspectFit
imageView.image = image.0

if image.1.characters.count != 0 {
if image.1.count != 0 {
let tempContainer = image.1.components(separatedBy: "##")

let attributeDescription = NSMutableAttributedString(string: String("\(tempContainer[0])\n\(tempContainer[1])"))
attributeDescription.addAttributes([NSFontAttributeName:UIFont.imageDescriptionBig(),NSForegroundColorAttributeName:UIColor.black], range: NSRange(location: 0, length: tempContainer[0].characters.count))
attributeDescription.addAttributes([NSFontAttributeName:UIFont.imageDescriptionSmall(),NSForegroundColorAttributeName:UIColor.lightGray], range: NSRange(location: tempContainer[0].characters.count, length: tempContainer[1].characters.count + 1))
attributeDescription.addAttributes([NSAttributedString.Key.font:UIFont.imageDescriptionBig(),NSAttributedString.Key.foregroundColor:UIColor.black], range: NSRange(location: 0, length: tempContainer[0].count))
attributeDescription.addAttributes([NSAttributedString.Key.font:UIFont.imageDescriptionSmall(),NSAttributedString.Key.foregroundColor:UIColor.lightGray], range: NSRange(location: tempContainer[0].count, length: tempContainer[1].count + 1))

let description = UILabel(frame: CGRect(x: x,y: imageView.frame.size.height,width: width,height: 45))
description.attributedText = attributeDescription
Expand Down Expand Up @@ -347,8 +347,8 @@ class ContainerView:UIView{


let attributeOffers = NSMutableAttributedString(string: String("\(offer.actionTitle!)\n\(offer.actionSubTitle!)"))
attributeOffers.addAttributes([NSFontAttributeName:UIFont.priceListBoldFont(),NSForegroundColorAttributeName:UIColor.darkGray], range: NSRange(location: 0, length: offer.actionTitle.characters.count))
attributeOffers.addAttributes([NSFontAttributeName:UIFont.priceListThinFont(),NSForegroundColorAttributeName:UIColor.gray], range: NSRange(location: offer.actionTitle!.characters.count, length: offer.actionSubTitle!.characters.count + 1))
attributeOffers.addAttributes([NSAttributedString.Key.font:UIFont.priceListBoldFont(),NSAttributedString.Key.foregroundColor:UIColor.darkGray], range: NSRange(location: 0, length: offer.actionTitle.count))
attributeOffers.addAttributes([NSAttributedString.Key.font:UIFont.priceListThinFont(),NSAttributedString.Key.foregroundColor:UIColor.gray], range: NSRange(location: offer.actionTitle!.count, length: offer.actionSubTitle!.count + 1))

let label = UILabel(frame: CGRect(x: 2,y: 2,width: width - 4,height: height-20))
label.attributedText = attributeOffers
Expand Down Expand Up @@ -414,7 +414,7 @@ class ContainerView:UIView{
case .transparentStyle:
viewContainer.layer.cornerRadius = 12.0
viewContainer.clipsToBounds = true
mainView.backgroundColor = UIColor(colorLiteralRed: 0, green: 0, blue: 0, alpha: 0.5)
mainView.backgroundColor = UIColor(red: 0, green: 0, blue: 0, alpha: 0.5)
break

default:
Expand All @@ -430,7 +430,7 @@ class ContainerView:UIView{
///Sets up user UI
func setUpOtherUI() {
let attributeString = NSMutableAttributedString(string: String("\(bannerTitle!)\n\(bannerSubTitle!)"))
attributeString.addAttributes([NSFontAttributeName:UIFont.titleFont()], range: NSRange(location: 0, length: bannerTitle.characters.count))
attributeString.addAttributes([NSAttributedString.Key.font:UIFont.titleFont()], range: NSRange(location: 0, length: bannerTitle.count))
headerLabel.attributedText = attributeString
headerLabel.textColor = bannerTitleColor
titlContainer.applyGradient(bannerTheme, locations: [0,0.1], startPoint:nil, endPoint:nil)
Expand All @@ -440,11 +440,11 @@ class ContainerView:UIView{
func setUpButtonUI(){
purchaseButton.layer.cornerRadius = 14.0
purchaseButton.clipsToBounds = true
purchaseButton.setTitle(purchaseButtonName, for: UIControlState())
purchaseButton.setTitleColor(buttonTitleColor, for: UIControlState())
purchaseButton.setTitle(purchaseButtonName, for: UIControl.State())
purchaseButton.setTitleColor(buttonTitleColor, for: UIControl.State())
purchaseButton.applyGradient(buttonTheme, locations: nil, startPoint: CGPoint(x: 0.0, y: 0.5), endPoint: CGPoint(x: 1.0, y: 0.5))

cancelButton.setTitle(cancelButtonName, for: UIControlState())
cancelButton.setTitle(cancelButtonName, for: UIControl.State())
}

///Button action that used to detect tap on banner options
Expand All @@ -456,7 +456,7 @@ class ContainerView:UIView{
}


func tapGesture(_ sender:UITapGestureRecognizer) {
@objc func tapGesture(_ sender:UITapGestureRecognizer) {

let action:GLInAppAction = actionArray[(sender.view?.tag)!]
guard let didselectHandler = action.didSelectAction else{
Expand Down Expand Up @@ -489,7 +489,7 @@ class ContainerView:UIView{
}
}

func orientationChange(_ sender:Notification){
@objc func orientationChange(_ sender:Notification){
self.layoutIfNeeded()
}

Expand Down
Loading