Showing
12 changed files
with
46 additions
and
27 deletions
| ... | @@ -27,7 +27,8 @@ Pod::Spec.new do |spec| | ... | @@ -27,7 +27,8 @@ Pod::Spec.new do |spec| |
| 27 | # ==> NEW | 27 | # ==> NEW |
| 28 | # ONLY include code files in source_files | 28 | # ONLY include code files in source_files |
| 29 | # spec.source_files = "SwiftWarplyFramework/**/*.{h,m,swift}" | 29 | # spec.source_files = "SwiftWarplyFramework/**/*.{h,m,swift}" |
| 30 | - spec.source_files = "SwiftWarplyFramework/SwiftWarplyFramework/**/*.{h,m,swift}" | 30 | + # spec.source_files = "SwiftWarplyFramework/SwiftWarplyFramework/**/*.{h,m,swift}" |
| 31 | + spec.source_files = "SwiftWarplyFramework/SwiftWarplyFramework/**/*.{h,m,swift,xib,storyboard}" | ||
| 31 | # <== NEW | 32 | # <== NEW |
| 32 | 33 | ||
| 33 | # 'SwiftWarplyFramework/**/*', | 34 | # 'SwiftWarplyFramework/**/*', |
| ... | @@ -60,7 +61,8 @@ Pod::Spec.new do |spec| | ... | @@ -60,7 +61,8 @@ Pod::Spec.new do |spec| |
| 60 | # spec.resources = "SwiftWarplyFramework/**/*.{storyboard,xib,otf,ttf,xcassets,png}" | 61 | # spec.resources = "SwiftWarplyFramework/**/*.{storyboard,xib,otf,ttf,xcassets,png}" |
| 61 | spec.resource_bundles = { | 62 | spec.resource_bundles = { |
| 62 | 'ResourcesBundle' => [ | 63 | 'ResourcesBundle' => [ |
| 63 | - 'SwiftWarplyFramework/SwiftWarplyFramework/**/*.{storyboard,xib,xcassets}', | 64 | + # 'SwiftWarplyFramework/SwiftWarplyFramework/**/*.{storyboard,xib,xcassets}', |
| 65 | + 'SwiftWarplyFramework/SwiftWarplyFramework/**/*.xcassets', | ||
| 64 | 'SwiftWarplyFramework/SwiftWarplyFramework/fonts/*.{otf,ttf}' | 66 | 'SwiftWarplyFramework/SwiftWarplyFramework/fonts/*.{otf,ttf}' |
| 65 | ] | 67 | ] |
| 66 | } | 68 | } | ... | ... |
| ... | @@ -7,7 +7,7 @@ | ... | @@ -7,7 +7,7 @@ |
| 7 | <key>Pods-SwiftWarplyFramework.xcscheme_^#shared#^_</key> | 7 | <key>Pods-SwiftWarplyFramework.xcscheme_^#shared#^_</key> |
| 8 | <dict> | 8 | <dict> |
| 9 | <key>orderHint</key> | 9 | <key>orderHint</key> |
| 10 | - <integer>1</integer> | 10 | + <integer>0</integer> |
| 11 | </dict> | 11 | </dict> |
| 12 | </dict> | 12 | </dict> |
| 13 | </dict> | 13 | </dict> | ... | ... |
| ... | @@ -7,7 +7,7 @@ | ... | @@ -7,7 +7,7 @@ |
| 7 | <key>SwiftWarplyFramework.xcscheme_^#shared#^_</key> | 7 | <key>SwiftWarplyFramework.xcscheme_^#shared#^_</key> |
| 8 | <dict> | 8 | <dict> |
| 9 | <key>orderHint</key> | 9 | <key>orderHint</key> |
| 10 | - <integer>0</integer> | 10 | + <integer>1</integer> |
| 11 | </dict> | 11 | </dict> |
| 12 | </dict> | 12 | </dict> |
| 13 | </dict> | 13 | </dict> | ... | ... |
No preview for this file type
| ... | @@ -1405,7 +1405,6 @@ public final class WarplySDK { | ... | @@ -1405,7 +1405,6 @@ public final class WarplySDK { |
| 1405 | showDialog(controller, "Δεν υπάρχει σύνδεση", "Αυτή τη στιγμή βρίσκεσαι εκτός σύνδεσης. Παρακαλούμε βεβαιώσου ότι είσαι συνδεδεμένος στο διαδίκτυο και προσπάθησε ξανά.") | 1405 | showDialog(controller, "Δεν υπάρχει σύνδεση", "Αυτή τη στιγμή βρίσκεσαι εκτός σύνδεσης. Παρακαλούμε βεβαιώσου ότι είσαι συνδεδεμένος στο διαδίκτυο και προσπάθησε ξανά.") |
| 1406 | } else { | 1406 | } else { |
| 1407 | let tempCampaign = CampaignItemModel() | 1407 | let tempCampaign = CampaignItemModel() |
| 1408 | - // TODO: For consistency, consider changing to MyEmptyClass.resourceBundle() | ||
| 1409 | let storyboard = UIStoryboard(name: "Main", bundle: Bundle(for: MyEmptyClass.self)) | 1408 | let storyboard = UIStoryboard(name: "Main", bundle: Bundle(for: MyEmptyClass.self)) |
| 1410 | let vc = storyboard.instantiateViewController(withIdentifier: "CampaignViewController") as! SwiftWarplyFramework.CampaignViewController | 1409 | let vc = storyboard.instantiateViewController(withIdentifier: "CampaignViewController") as! SwiftWarplyFramework.CampaignViewController |
| 1411 | let url = getMarketPassMapUrl() | 1410 | let url = getMarketPassMapUrl() |
| ... | @@ -1432,7 +1431,6 @@ public final class WarplySDK { | ... | @@ -1432,7 +1431,6 @@ public final class WarplySDK { |
| 1432 | showDialog(controller, "Δεν υπάρχει σύνδεση", "Αυτή τη στιγμή βρίσκεσαι εκτός σύνδεσης. Παρακαλούμε βεβαιώσου ότι είσαι συνδεδεμένος στο διαδίκτυο και προσπάθησε ξανά.") | 1431 | showDialog(controller, "Δεν υπάρχει σύνδεση", "Αυτή τη στιγμή βρίσκεσαι εκτός σύνδεσης. Παρακαλούμε βεβαιώσου ότι είσαι συνδεδεμένος στο διαδίκτυο και προσπάθησε ξανά.") |
| 1433 | } else { | 1432 | } else { |
| 1434 | if let superMarketCampaign = getSupermarketCampaign() { | 1433 | if let superMarketCampaign = getSupermarketCampaign() { |
| 1435 | - // TODO: For consistency, consider changing to MyEmptyClass.resourceBundle() | ||
| 1436 | let storyboard = UIStoryboard(name: "Main", bundle: Bundle(for: MyEmptyClass.self)) | 1434 | let storyboard = UIStoryboard(name: "Main", bundle: Bundle(for: MyEmptyClass.self)) |
| 1437 | let vc = storyboard.instantiateViewController(withIdentifier: "CampaignViewController") as! SwiftWarplyFramework.CampaignViewController | 1435 | let vc = storyboard.instantiateViewController(withIdentifier: "CampaignViewController") as! SwiftWarplyFramework.CampaignViewController |
| 1438 | let url = constructCampaignUrl(superMarketCampaign) | 1436 | let url = constructCampaignUrl(superMarketCampaign) | ... | ... |
| ... | @@ -9,10 +9,30 @@ import Foundation | ... | @@ -9,10 +9,30 @@ import Foundation |
| 9 | 9 | ||
| 10 | public class MyEmptyClass { | 10 | public class MyEmptyClass { |
| 11 | 11 | ||
| 12 | - static func resourceBundle() -> Bundle? { | 12 | + // static func resourceBundle() -> Bundle? { |
| 13 | + // let frameworkBundle = Bundle(for: MyEmptyClass.self) | ||
| 14 | + // let bundleURL = frameworkBundle.resourceURL?.appendingPathComponent("ResourcesBundle.bundle") | ||
| 15 | + // let resourceBundle = Bundle(url: bundleURL!) | ||
| 16 | + // return resourceBundle | ||
| 17 | + // } | ||
| 18 | + | ||
| 19 | + public static func resourceBundle() -> Bundle? { | ||
| 13 | let frameworkBundle = Bundle(for: MyEmptyClass.self) | 20 | let frameworkBundle = Bundle(for: MyEmptyClass.self) |
| 14 | - let bundleURL = frameworkBundle.resourceURL?.appendingPathComponent("ResourcesBundle.bundle") | 21 | + |
| 15 | - let resourceBundle = Bundle(url: bundleURL!) | 22 | + // Try ResourcesBundle.bundle first (for local development) |
| 16 | - return resourceBundle | 23 | + if let bundleURL = frameworkBundle.resourceURL?.appendingPathComponent("ResourcesBundle.bundle"), |
| 24 | + let resourceBundle = Bundle(url: bundleURL) { | ||
| 25 | + return resourceBundle | ||
| 26 | + } | ||
| 27 | + | ||
| 28 | + // Fallback to Resources.bundle (for CocoaPods) | ||
| 29 | + if let bundleURL = frameworkBundle.resourceURL?.appendingPathComponent("Resources.bundle"), | ||
| 30 | + let resourceBundle = Bundle(url: bundleURL) { | ||
| 31 | + return resourceBundle | ||
| 32 | + } | ||
| 33 | + | ||
| 34 | + // Final fallback to framework bundle itself | ||
| 35 | + return frameworkBundle | ||
| 17 | } | 36 | } |
| 37 | + | ||
| 18 | } | 38 | } | ... | ... |
| ... | @@ -45,7 +45,7 @@ protocol MyRewardsBannerOffersScrollTableViewCellDelegate: AnyObject { | ... | @@ -45,7 +45,7 @@ protocol MyRewardsBannerOffersScrollTableViewCellDelegate: AnyObject { |
| 45 | 45 | ||
| 46 | 46 | ||
| 47 | // Register XIBs for collection view cells | 47 | // Register XIBs for collection view cells |
| 48 | - collectionView.register(UINib(nibName: "MyRewardsBannerOfferCollectionViewCell", bundle: MyEmptyClass.resourceBundle()), forCellWithReuseIdentifier: "MyRewardsBannerOfferCollectionViewCell") | 48 | + collectionView.register(UINib(nibName: "MyRewardsBannerOfferCollectionViewCell", bundle: Bundle(for: MyEmptyClass.self)), forCellWithReuseIdentifier: "MyRewardsBannerOfferCollectionViewCell") |
| 49 | 49 | ||
| 50 | // Fix background colors | 50 | // Fix background colors |
| 51 | collectionView.backgroundColor = UIColor.clear | 51 | collectionView.backgroundColor = UIColor.clear | ... | ... |
| ... | @@ -37,7 +37,7 @@ protocol MyRewardsOffersScrollTableViewCellDelegate: AnyObject { | ... | @@ -37,7 +37,7 @@ protocol MyRewardsOffersScrollTableViewCellDelegate: AnyObject { |
| 37 | allButtonLabel.frame.size.height = allButtonLabel.intrinsicContentSize.height | 37 | allButtonLabel.frame.size.height = allButtonLabel.intrinsicContentSize.height |
| 38 | 38 | ||
| 39 | // Register XIBs for collection view cells | 39 | // Register XIBs for collection view cells |
| 40 | - collectionView.register(UINib(nibName: "MyRewardsOfferCollectionViewCell", bundle: MyEmptyClass.resourceBundle()), forCellWithReuseIdentifier: "MyRewardsOfferCollectionViewCell") | 40 | + collectionView.register(UINib(nibName: "MyRewardsOfferCollectionViewCell", bundle: Bundle(for: MyEmptyClass.self)), forCellWithReuseIdentifier: "MyRewardsOfferCollectionViewCell") |
| 41 | 41 | ||
| 42 | // Fix background colors | 42 | // Fix background colors |
| 43 | collectionView.backgroundColor = UIColor.clear | 43 | collectionView.backgroundColor = UIColor.clear | ... | ... |
| ... | @@ -28,7 +28,7 @@ protocol ProfileCouponFiltersTableViewCellDelegate: AnyObject { | ... | @@ -28,7 +28,7 @@ protocol ProfileCouponFiltersTableViewCellDelegate: AnyObject { |
| 28 | titleLabel.text = "Τα κουπόνια μου" | 28 | titleLabel.text = "Τα κουπόνια μου" |
| 29 | 29 | ||
| 30 | // Register XIBs for collection view cells | 30 | // Register XIBs for collection view cells |
| 31 | - collectionView.register(UINib(nibName: "ProfileFilterCollectionViewCell", bundle: MyEmptyClass.resourceBundle()), forCellWithReuseIdentifier: "ProfileFilterCollectionViewCell") | 31 | + collectionView.register(UINib(nibName: "ProfileFilterCollectionViewCell", bundle: Bundle(for: MyEmptyClass.self)), forCellWithReuseIdentifier: "ProfileFilterCollectionViewCell") |
| 32 | 32 | ||
| 33 | // Fix background colors | 33 | // Fix background colors |
| 34 | // collectionView.backgroundColor = UIColor.clear | 34 | // collectionView.backgroundColor = UIColor.clear | ... | ... |
| ... | @@ -12,7 +12,7 @@ import UIKit | ... | @@ -12,7 +12,7 @@ import UIKit |
| 12 | 12 | ||
| 13 | // MARK: - Initializers | 13 | // MARK: - Initializers |
| 14 | public convenience init() { | 14 | public convenience init() { |
| 15 | - self.init(nibName: "CouponViewController", bundle: MyEmptyClass.resourceBundle()) | 15 | + self.init(nibName: "CouponViewController", bundle: Bundle(for: MyEmptyClass.self)) |
| 16 | } | 16 | } |
| 17 | 17 | ||
| 18 | public override init(nibName nibNameOrNil: String?, bundle nibBundleOrNil: Bundle?) { | 18 | public override init(nibName nibNameOrNil: String?, bundle nibBundleOrNil: Bundle?) { | ... | ... |
| ... | @@ -13,7 +13,7 @@ import UIKit | ... | @@ -13,7 +13,7 @@ import UIKit |
| 13 | 13 | ||
| 14 | // MARK: - Initializers | 14 | // MARK: - Initializers |
| 15 | public convenience init() { | 15 | public convenience init() { |
| 16 | - self.init(nibName: "MyRewardsViewController", bundle: MyEmptyClass.resourceBundle()) | 16 | + self.init(nibName: "MyRewardsViewController", bundle: Bundle(for: MyEmptyClass.self)) |
| 17 | } | 17 | } |
| 18 | 18 | ||
| 19 | public override init(nibName nibNameOrNil: String?, bundle nibBundleOrNil: Bundle?) { | 19 | public override init(nibName nibNameOrNil: String?, bundle nibBundleOrNil: Bundle?) { |
| ... | @@ -310,8 +310,8 @@ import UIKit | ... | @@ -310,8 +310,8 @@ import UIKit |
| 310 | // self.navigationController?.setNavigationBarHidden(true, animated: false) | 310 | // self.navigationController?.setNavigationBarHidden(true, animated: false) |
| 311 | 311 | ||
| 312 | // Register XIBs for table view cells | 312 | // Register XIBs for table view cells |
| 313 | - tableView.register(UINib(nibName: "MyRewardsBannerOffersScrollTableViewCell", bundle: MyEmptyClass.resourceBundle()), forCellReuseIdentifier: "MyRewardsBannerOffersScrollTableViewCell") | 313 | + tableView.register(UINib(nibName: "MyRewardsBannerOffersScrollTableViewCell", bundle: Bundle(for: MyEmptyClass.self)), forCellReuseIdentifier: "MyRewardsBannerOffersScrollTableViewCell") |
| 314 | - tableView.register(UINib(nibName: "MyRewardsOffersScrollTableViewCell", bundle: MyEmptyClass.resourceBundle()), forCellReuseIdentifier: "MyRewardsOffersScrollTableViewCell") | 314 | + tableView.register(UINib(nibName: "MyRewardsOffersScrollTableViewCell", bundle: Bundle(for: MyEmptyClass.self)), forCellReuseIdentifier: "MyRewardsOffersScrollTableViewCell") |
| 315 | 315 | ||
| 316 | // Set up table view | 316 | // Set up table view |
| 317 | tableView.delegate = self | 317 | tableView.delegate = self |
| ... | @@ -417,7 +417,6 @@ import UIKit | ... | @@ -417,7 +417,6 @@ import UIKit |
| 417 | 417 | ||
| 418 | private func openCampaignViewController(with index: Int) { | 418 | private func openCampaignViewController(with index: Int) { |
| 419 | 419 | ||
| 420 | - // TODO: For consistency, consider changing to MyEmptyClass.resourceBundle() | ||
| 421 | let storyboard = UIStoryboard(name: "Main", bundle: Bundle(for: MyEmptyClass.self)) | 420 | let storyboard = UIStoryboard(name: "Main", bundle: Bundle(for: MyEmptyClass.self)) |
| 422 | if let vc = storyboard.instantiateViewController(withIdentifier: "CampaignViewController") as? SwiftWarplyFramework.CampaignViewController { | 421 | if let vc = storyboard.instantiateViewController(withIdentifier: "CampaignViewController") as? SwiftWarplyFramework.CampaignViewController { |
| 423 | // vc.campaignUrl = "https://warply.s3.amazonaws.com/dei/campaigns/DehEasterContest_stage/index.html" | 422 | // vc.campaignUrl = "https://warply.s3.amazonaws.com/dei/campaigns/DehEasterContest_stage/index.html" |
| ... | @@ -429,14 +428,14 @@ import UIKit | ... | @@ -429,14 +428,14 @@ import UIKit |
| 429 | } | 428 | } |
| 430 | 429 | ||
| 431 | private func openCouponViewController(with offer: OfferModel) { | 430 | private func openCouponViewController(with offer: OfferModel) { |
| 432 | - let vc = SwiftWarplyFramework.CouponViewController(nibName: "CouponViewController", bundle: MyEmptyClass.resourceBundle()) | 431 | + let vc = SwiftWarplyFramework.CouponViewController(nibName: "CouponViewController", bundle: Bundle(for: MyEmptyClass.self)) |
| 433 | vc.coupon = offer | 432 | vc.coupon = offer |
| 434 | 433 | ||
| 435 | self.navigationController?.pushViewController(vc, animated: true) | 434 | self.navigationController?.pushViewController(vc, animated: true) |
| 436 | } | 435 | } |
| 437 | 436 | ||
| 438 | private func openProfileViewController() { | 437 | private func openProfileViewController() { |
| 439 | - let vc = SwiftWarplyFramework.ProfileViewController(nibName: "ProfileViewController", bundle: MyEmptyClass.resourceBundle()) | 438 | + let vc = SwiftWarplyFramework.ProfileViewController(nibName: "ProfileViewController", bundle: Bundle(for: MyEmptyClass.self)) |
| 440 | 439 | ||
| 441 | self.navigationController?.pushViewController(vc, animated: true) | 440 | self.navigationController?.pushViewController(vc, animated: true) |
| 442 | } | 441 | } | ... | ... |
| ... | @@ -12,7 +12,7 @@ import UIKit | ... | @@ -12,7 +12,7 @@ import UIKit |
| 12 | 12 | ||
| 13 | // MARK: - Initializers | 13 | // MARK: - Initializers |
| 14 | public convenience init() { | 14 | public convenience init() { |
| 15 | - self.init(nibName: "ProfileViewController", bundle: MyEmptyClass.resourceBundle()) | 15 | + self.init(nibName: "ProfileViewController", bundle: Bundle(for: MyEmptyClass.self)) |
| 16 | } | 16 | } |
| 17 | 17 | ||
| 18 | public override init(nibName nibNameOrNil: String?, bundle nibBundleOrNil: Bundle?) { | 18 | public override init(nibName nibNameOrNil: String?, bundle nibBundleOrNil: Bundle?) { |
| ... | @@ -208,11 +208,11 @@ import UIKit | ... | @@ -208,11 +208,11 @@ import UIKit |
| 208 | setNavigationTitle("Το προφίλ μου") | 208 | setNavigationTitle("Το προφίλ μου") |
| 209 | 209 | ||
| 210 | // Register XIBs for table view cells | 210 | // Register XIBs for table view cells |
| 211 | - tableView.register(UINib(nibName: "ProfileHeaderTableViewCell", bundle: MyEmptyClass.resourceBundle()), forCellReuseIdentifier: "ProfileHeaderTableViewCell") | 211 | + tableView.register(UINib(nibName: "ProfileHeaderTableViewCell", bundle: Bundle(for: MyEmptyClass.self)), forCellReuseIdentifier: "ProfileHeaderTableViewCell") |
| 212 | - tableView.register(UINib(nibName: "ProfileQuestionnaireTableViewCell", bundle: MyEmptyClass.resourceBundle()), forCellReuseIdentifier: "ProfileQuestionnaireTableViewCell") | 212 | + tableView.register(UINib(nibName: "ProfileQuestionnaireTableViewCell", bundle: Bundle(for: MyEmptyClass.self)), forCellReuseIdentifier: "ProfileQuestionnaireTableViewCell") |
| 213 | - tableView.register(UINib(nibName: "MyRewardsOffersScrollTableViewCell", bundle: MyEmptyClass.resourceBundle()), forCellReuseIdentifier: "MyRewardsOffersScrollTableViewCell") | 213 | + tableView.register(UINib(nibName: "MyRewardsOffersScrollTableViewCell", bundle: Bundle(for: MyEmptyClass.self)), forCellReuseIdentifier: "MyRewardsOffersScrollTableViewCell") |
| 214 | - tableView.register(UINib(nibName: "ProfileCouponFiltersTableViewCell", bundle: MyEmptyClass.resourceBundle()), forCellReuseIdentifier: "ProfileCouponFiltersTableViewCell") | 214 | + tableView.register(UINib(nibName: "ProfileCouponFiltersTableViewCell", bundle: Bundle(for: MyEmptyClass.self)), forCellReuseIdentifier: "ProfileCouponFiltersTableViewCell") |
| 215 | - tableView.register(UINib(nibName: "ProfileCouponTableViewCell", bundle: MyEmptyClass.resourceBundle()), forCellReuseIdentifier: "ProfileCouponTableViewCell") | 215 | + tableView.register(UINib(nibName: "ProfileCouponTableViewCell", bundle: Bundle(for: MyEmptyClass.self)), forCellReuseIdentifier: "ProfileCouponTableViewCell") |
| 216 | 216 | ||
| 217 | // Set up table view | 217 | // Set up table view |
| 218 | tableView.delegate = self | 218 | tableView.delegate = self |
| ... | @@ -264,7 +264,7 @@ import UIKit | ... | @@ -264,7 +264,7 @@ import UIKit |
| 264 | } | 264 | } |
| 265 | 265 | ||
| 266 | private func openCouponViewController(with offer: OfferModel) { | 266 | private func openCouponViewController(with offer: OfferModel) { |
| 267 | - let vc = SwiftWarplyFramework.CouponViewController(nibName: "CouponViewController", bundle: MyEmptyClass.resourceBundle()) | 267 | + let vc = SwiftWarplyFramework.CouponViewController(nibName: "CouponViewController", bundle: Bundle(for: MyEmptyClass.self)) |
| 268 | vc.coupon = offer | 268 | vc.coupon = offer |
| 269 | 269 | ||
| 270 | self.navigationController?.pushViewController(vc, animated: true) | 270 | self.navigationController?.pushViewController(vc, animated: true) | ... | ... |
-
Please register or login to post a comment