Showing
1 changed file
with
13 additions
and
4 deletions
... | @@ -11,6 +11,7 @@ import SwiftUI | ... | @@ -11,6 +11,7 @@ import SwiftUI |
11 | import Combine | 11 | import Combine |
12 | import Foundation | 12 | import Foundation |
13 | import UIKit | 13 | import UIKit |
14 | +import WarplySDKFrameworkIOS | ||
14 | 15 | ||
15 | 16 | ||
16 | class CouponSetItemModel { | 17 | class CouponSetItemModel { |
... | @@ -304,13 +305,20 @@ extension GiftsView { | ... | @@ -304,13 +305,20 @@ extension GiftsView { |
304 | var item: CampaignItemModel | 305 | var item: CampaignItemModel |
305 | var isFirst: Bool | 306 | var isFirst: Bool |
306 | var isLast: Bool | 307 | var isLast: Bool |
308 | + var parentView: UIView | ||
307 | 309 | ||
308 | var uiscreen = UIScreen.main.bounds | 310 | var uiscreen = UIScreen.main.bounds |
309 | 311 | ||
310 | var body: some View { | 312 | var body: some View { |
311 | Button { | 313 | Button { |
312 | // GiftItem Action | 314 | // GiftItem Action |
313 | - print("GiftItem tapped!") | 315 | + let instanceOfMyApi = MyApi() |
316 | + let campaignViewController = instanceOfMyApi.openCampaign(parentView, campaign: item.index_url)! | ||
317 | + campaignViewController.view.tag = 6 | ||
318 | +// addChild(couponsViewController) | ||
319 | + campaignViewController.view.frame = parentView.frame | ||
320 | + parentView.addSubview(campaignViewController.view) | ||
321 | + campaignViewController.didMove(toParent: UIHostingController(rootView: self)) | ||
314 | } label: { | 322 | } label: { |
315 | HStack(alignment: .center) { | 323 | HStack(alignment: .center) { |
316 | 324 | ||
... | @@ -338,6 +346,7 @@ extension GiftsView { | ... | @@ -338,6 +346,7 @@ extension GiftsView { |
338 | struct giftsContainer: View { | 346 | struct giftsContainer: View { |
339 | @State var gifts:Array<CampaignItemModel> = [] | 347 | @State var gifts:Array<CampaignItemModel> = [] |
340 | @State var title:String = "" | 348 | @State var title:String = "" |
349 | + @State var parentView:UIView | ||
341 | 350 | ||
342 | var uiscreen = UIScreen.main.bounds | 351 | var uiscreen = UIScreen.main.bounds |
343 | 352 | ||
... | @@ -357,7 +366,7 @@ extension GiftsView { | ... | @@ -357,7 +366,7 @@ extension GiftsView { |
357 | HStack(alignment: .center) { | 366 | HStack(alignment: .center) { |
358 | ForEach(Array(gifts.enumerated()), id: \.offset) { index, item in | 367 | ForEach(Array(gifts.enumerated()), id: \.offset) { index, item in |
359 | 368 | ||
360 | - giftItemView(item: item, isFirst: index == 0, isLast: index == (gifts.count-1)) | 369 | + giftItemView(item: item, isFirst: index == 0, isLast: index == (gifts.count-1), parentView: parentView) |
361 | } | 370 | } |
362 | 371 | ||
363 | } | 372 | } |
... | @@ -529,12 +538,12 @@ struct GiftsView: View { | ... | @@ -529,12 +538,12 @@ struct GiftsView: View { |
529 | ScrollView(showsIndicators: false) { | 538 | ScrollView(showsIndicators: false) { |
530 | VStack { | 539 | VStack { |
531 | if (campains.filter { $0.subcategory == "gifts" }.count) > 0 { | 540 | if (campains.filter { $0.subcategory == "gifts" }.count) > 0 { |
532 | - giftsContainer(gifts: campains.filter { $0.subcategory == "gifts" }, title: "ΔΩΡΑ") | 541 | + giftsContainer(gifts: campains.filter { $0.subcategory == "gifts" }, title: "ΔΩΡΑ", parentView: parentView) |
533 | } | 542 | } |
534 | 543 | ||
535 | 544 | ||
536 | if (campains.filter { $0.subcategory == "rewards" }.count) > 0 { | 545 | if (campains.filter { $0.subcategory == "rewards" }.count) > 0 { |
537 | - giftsContainer(gifts: campains.filter { $0.subcategory == "rewards"}, title: "ΕΠΙΒΡΑΒΕΥΣΕΙΣ" ) | 546 | + giftsContainer(gifts: campains.filter { $0.subcategory == "rewards"}, title: "ΕΠΙΒΡΑΒΕΥΣΕΙΣ", parentView: parentView ) |
538 | } | 547 | } |
539 | 548 | ||
540 | if (coupons.count) > 0 { | 549 | if (coupons.count) > 0 { | ... | ... |
-
Please register or login to post a comment