Manos Chorianopoulos

bundle and podspec fixes

......@@ -27,7 +27,8 @@ Pod::Spec.new do |spec|
# ==> NEW
# ONLY include code files in source_files
# spec.source_files = "SwiftWarplyFramework/**/*.{h,m,swift}"
spec.source_files = "SwiftWarplyFramework/SwiftWarplyFramework/**/*.{h,m,swift}"
# spec.source_files = "SwiftWarplyFramework/SwiftWarplyFramework/**/*.{h,m,swift}"
spec.source_files = "SwiftWarplyFramework/SwiftWarplyFramework/**/*.{h,m,swift,xib,storyboard}"
# <== NEW
# 'SwiftWarplyFramework/**/*',
......@@ -60,7 +61,8 @@ Pod::Spec.new do |spec|
# spec.resources = "SwiftWarplyFramework/**/*.{storyboard,xib,otf,ttf,xcassets,png}"
spec.resource_bundles = {
'ResourcesBundle' => [
'SwiftWarplyFramework/SwiftWarplyFramework/**/*.{storyboard,xib,xcassets}',
# 'SwiftWarplyFramework/SwiftWarplyFramework/**/*.{storyboard,xib,xcassets}',
'SwiftWarplyFramework/SwiftWarplyFramework/**/*.xcassets',
'SwiftWarplyFramework/SwiftWarplyFramework/fonts/*.{otf,ttf}'
]
}
......
......@@ -7,7 +7,7 @@
<key>Pods-SwiftWarplyFramework.xcscheme_^#shared#^_</key>
<dict>
<key>orderHint</key>
<integer>1</integer>
<integer>0</integer>
</dict>
</dict>
</dict>
......
......@@ -7,7 +7,7 @@
<key>SwiftWarplyFramework.xcscheme_^#shared#^_</key>
<dict>
<key>orderHint</key>
<integer>0</integer>
<integer>1</integer>
</dict>
</dict>
</dict>
......
......@@ -1405,7 +1405,6 @@ public final class WarplySDK {
showDialog(controller, "Δεν υπάρχει σύνδεση", "Αυτή τη στιγμή βρίσκεσαι εκτός σύνδεσης. Παρακαλούμε βεβαιώσου ότι είσαι συνδεδεμένος στο διαδίκτυο και προσπάθησε ξανά.")
} else {
let tempCampaign = CampaignItemModel()
// TODO: For consistency, consider changing to MyEmptyClass.resourceBundle()
let storyboard = UIStoryboard(name: "Main", bundle: Bundle(for: MyEmptyClass.self))
let vc = storyboard.instantiateViewController(withIdentifier: "CampaignViewController") as! SwiftWarplyFramework.CampaignViewController
let url = getMarketPassMapUrl()
......@@ -1432,7 +1431,6 @@ public final class WarplySDK {
showDialog(controller, "Δεν υπάρχει σύνδεση", "Αυτή τη στιγμή βρίσκεσαι εκτός σύνδεσης. Παρακαλούμε βεβαιώσου ότι είσαι συνδεδεμένος στο διαδίκτυο και προσπάθησε ξανά.")
} else {
if let superMarketCampaign = getSupermarketCampaign() {
// TODO: For consistency, consider changing to MyEmptyClass.resourceBundle()
let storyboard = UIStoryboard(name: "Main", bundle: Bundle(for: MyEmptyClass.self))
let vc = storyboard.instantiateViewController(withIdentifier: "CampaignViewController") as! SwiftWarplyFramework.CampaignViewController
let url = constructCampaignUrl(superMarketCampaign)
......
......@@ -9,10 +9,30 @@ import Foundation
public class MyEmptyClass {
static func resourceBundle() -> Bundle? {
// static func resourceBundle() -> Bundle? {
// let frameworkBundle = Bundle(for: MyEmptyClass.self)
// let bundleURL = frameworkBundle.resourceURL?.appendingPathComponent("ResourcesBundle.bundle")
// let resourceBundle = Bundle(url: bundleURL!)
// return resourceBundle
// }
public static func resourceBundle() -> Bundle? {
let frameworkBundle = Bundle(for: MyEmptyClass.self)
let bundleURL = frameworkBundle.resourceURL?.appendingPathComponent("ResourcesBundle.bundle")
let resourceBundle = Bundle(url: bundleURL!)
// Try ResourcesBundle.bundle first (for local development)
if let bundleURL = frameworkBundle.resourceURL?.appendingPathComponent("ResourcesBundle.bundle"),
let resourceBundle = Bundle(url: bundleURL) {
return resourceBundle
}
// Fallback to Resources.bundle (for CocoaPods)
if let bundleURL = frameworkBundle.resourceURL?.appendingPathComponent("Resources.bundle"),
let resourceBundle = Bundle(url: bundleURL) {
return resourceBundle
}
// Final fallback to framework bundle itself
return frameworkBundle
}
}
......
......@@ -45,7 +45,7 @@ protocol MyRewardsBannerOffersScrollTableViewCellDelegate: AnyObject {
// Register XIBs for collection view cells
collectionView.register(UINib(nibName: "MyRewardsBannerOfferCollectionViewCell", bundle: MyEmptyClass.resourceBundle()), forCellWithReuseIdentifier: "MyRewardsBannerOfferCollectionViewCell")
collectionView.register(UINib(nibName: "MyRewardsBannerOfferCollectionViewCell", bundle: Bundle(for: MyEmptyClass.self)), forCellWithReuseIdentifier: "MyRewardsBannerOfferCollectionViewCell")
// Fix background colors
collectionView.backgroundColor = UIColor.clear
......
......@@ -37,7 +37,7 @@ protocol MyRewardsOffersScrollTableViewCellDelegate: AnyObject {
allButtonLabel.frame.size.height = allButtonLabel.intrinsicContentSize.height
// Register XIBs for collection view cells
collectionView.register(UINib(nibName: "MyRewardsOfferCollectionViewCell", bundle: MyEmptyClass.resourceBundle()), forCellWithReuseIdentifier: "MyRewardsOfferCollectionViewCell")
collectionView.register(UINib(nibName: "MyRewardsOfferCollectionViewCell", bundle: Bundle(for: MyEmptyClass.self)), forCellWithReuseIdentifier: "MyRewardsOfferCollectionViewCell")
// Fix background colors
collectionView.backgroundColor = UIColor.clear
......
......@@ -28,7 +28,7 @@ protocol ProfileCouponFiltersTableViewCellDelegate: AnyObject {
titleLabel.text = "Τα κουπόνια μου"
// Register XIBs for collection view cells
collectionView.register(UINib(nibName: "ProfileFilterCollectionViewCell", bundle: MyEmptyClass.resourceBundle()), forCellWithReuseIdentifier: "ProfileFilterCollectionViewCell")
collectionView.register(UINib(nibName: "ProfileFilterCollectionViewCell", bundle: Bundle(for: MyEmptyClass.self)), forCellWithReuseIdentifier: "ProfileFilterCollectionViewCell")
// Fix background colors
// collectionView.backgroundColor = UIColor.clear
......
......@@ -12,7 +12,7 @@ import UIKit
// MARK: - Initializers
public convenience init() {
self.init(nibName: "CouponViewController", bundle: MyEmptyClass.resourceBundle())
self.init(nibName: "CouponViewController", bundle: Bundle(for: MyEmptyClass.self))
}
public override init(nibName nibNameOrNil: String?, bundle nibBundleOrNil: Bundle?) {
......
......@@ -13,7 +13,7 @@ import UIKit
// MARK: - Initializers
public convenience init() {
self.init(nibName: "MyRewardsViewController", bundle: MyEmptyClass.resourceBundle())
self.init(nibName: "MyRewardsViewController", bundle: Bundle(for: MyEmptyClass.self))
}
public override init(nibName nibNameOrNil: String?, bundle nibBundleOrNil: Bundle?) {
......@@ -310,8 +310,8 @@ import UIKit
// self.navigationController?.setNavigationBarHidden(true, animated: false)
// Register XIBs for table view cells
tableView.register(UINib(nibName: "MyRewardsBannerOffersScrollTableViewCell", bundle: MyEmptyClass.resourceBundle()), forCellReuseIdentifier: "MyRewardsBannerOffersScrollTableViewCell")
tableView.register(UINib(nibName: "MyRewardsOffersScrollTableViewCell", bundle: MyEmptyClass.resourceBundle()), forCellReuseIdentifier: "MyRewardsOffersScrollTableViewCell")
tableView.register(UINib(nibName: "MyRewardsBannerOffersScrollTableViewCell", bundle: Bundle(for: MyEmptyClass.self)), forCellReuseIdentifier: "MyRewardsBannerOffersScrollTableViewCell")
tableView.register(UINib(nibName: "MyRewardsOffersScrollTableViewCell", bundle: Bundle(for: MyEmptyClass.self)), forCellReuseIdentifier: "MyRewardsOffersScrollTableViewCell")
// Set up table view
tableView.delegate = self
......@@ -417,7 +417,6 @@ import UIKit
private func openCampaignViewController(with index: Int) {
// TODO: For consistency, consider changing to MyEmptyClass.resourceBundle()
let storyboard = UIStoryboard(name: "Main", bundle: Bundle(for: MyEmptyClass.self))
if let vc = storyboard.instantiateViewController(withIdentifier: "CampaignViewController") as? SwiftWarplyFramework.CampaignViewController {
// vc.campaignUrl = "https://warply.s3.amazonaws.com/dei/campaigns/DehEasterContest_stage/index.html"
......@@ -429,14 +428,14 @@ import UIKit
}
private func openCouponViewController(with offer: OfferModel) {
let vc = SwiftWarplyFramework.CouponViewController(nibName: "CouponViewController", bundle: MyEmptyClass.resourceBundle())
let vc = SwiftWarplyFramework.CouponViewController(nibName: "CouponViewController", bundle: Bundle(for: MyEmptyClass.self))
vc.coupon = offer
self.navigationController?.pushViewController(vc, animated: true)
}
private func openProfileViewController() {
let vc = SwiftWarplyFramework.ProfileViewController(nibName: "ProfileViewController", bundle: MyEmptyClass.resourceBundle())
let vc = SwiftWarplyFramework.ProfileViewController(nibName: "ProfileViewController", bundle: Bundle(for: MyEmptyClass.self))
self.navigationController?.pushViewController(vc, animated: true)
}
......
......@@ -12,7 +12,7 @@ import UIKit
// MARK: - Initializers
public convenience init() {
self.init(nibName: "ProfileViewController", bundle: MyEmptyClass.resourceBundle())
self.init(nibName: "ProfileViewController", bundle: Bundle(for: MyEmptyClass.self))
}
public override init(nibName nibNameOrNil: String?, bundle nibBundleOrNil: Bundle?) {
......@@ -208,11 +208,11 @@ import UIKit
setNavigationTitle("Το προφίλ μου")
// Register XIBs for table view cells
tableView.register(UINib(nibName: "ProfileHeaderTableViewCell", bundle: MyEmptyClass.resourceBundle()), forCellReuseIdentifier: "ProfileHeaderTableViewCell")
tableView.register(UINib(nibName: "ProfileQuestionnaireTableViewCell", bundle: MyEmptyClass.resourceBundle()), forCellReuseIdentifier: "ProfileQuestionnaireTableViewCell")
tableView.register(UINib(nibName: "MyRewardsOffersScrollTableViewCell", bundle: MyEmptyClass.resourceBundle()), forCellReuseIdentifier: "MyRewardsOffersScrollTableViewCell")
tableView.register(UINib(nibName: "ProfileCouponFiltersTableViewCell", bundle: MyEmptyClass.resourceBundle()), forCellReuseIdentifier: "ProfileCouponFiltersTableViewCell")
tableView.register(UINib(nibName: "ProfileCouponTableViewCell", bundle: MyEmptyClass.resourceBundle()), forCellReuseIdentifier: "ProfileCouponTableViewCell")
tableView.register(UINib(nibName: "ProfileHeaderTableViewCell", bundle: Bundle(for: MyEmptyClass.self)), forCellReuseIdentifier: "ProfileHeaderTableViewCell")
tableView.register(UINib(nibName: "ProfileQuestionnaireTableViewCell", bundle: Bundle(for: MyEmptyClass.self)), forCellReuseIdentifier: "ProfileQuestionnaireTableViewCell")
tableView.register(UINib(nibName: "MyRewardsOffersScrollTableViewCell", bundle: Bundle(for: MyEmptyClass.self)), forCellReuseIdentifier: "MyRewardsOffersScrollTableViewCell")
tableView.register(UINib(nibName: "ProfileCouponFiltersTableViewCell", bundle: Bundle(for: MyEmptyClass.self)), forCellReuseIdentifier: "ProfileCouponFiltersTableViewCell")
tableView.register(UINib(nibName: "ProfileCouponTableViewCell", bundle: Bundle(for: MyEmptyClass.self)), forCellReuseIdentifier: "ProfileCouponTableViewCell")
// Set up table view
tableView.delegate = self
......@@ -264,7 +264,7 @@ import UIKit
}
private func openCouponViewController(with offer: OfferModel) {
let vc = SwiftWarplyFramework.CouponViewController(nibName: "CouponViewController", bundle: MyEmptyClass.resourceBundle())
let vc = SwiftWarplyFramework.CouponViewController(nibName: "CouponViewController", bundle: Bundle(for: MyEmptyClass.self))
vc.coupon = offer
self.navigationController?.pushViewController(vc, animated: true)
......