Manos Chorianopoulos

add DetailsView

Showing 40 changed files with 751 additions and 2 deletions
{
"images" : [
{
"filename" : "ic_cart.png",
"idiom" : "universal",
"scale" : "1x"
},
{
"filename" : "ic_cart-1.png",
"idiom" : "universal",
"scale" : "2x"
},
{
"filename" : "ic_cart-2.png",
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}
{
"images" : [
{
"filename" : "ic_cosmote_logo.png",
"idiom" : "universal",
"scale" : "1x"
},
{
"filename" : "ic_cosmote_logo-1.png",
"idiom" : "universal",
"scale" : "2x"
},
{
"filename" : "ic_cosmote_logo-2.png",
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}
{
"images" : [
{
"filename" : "ic_down.png",
"idiom" : "universal",
"scale" : "1x"
},
{
"filename" : "ic_down-1.png",
"idiom" : "universal",
"scale" : "2x"
},
{
"filename" : "ic_down-2.png",
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}
{
"images" : [
{
"filename" : "ic_gift.png",
"idiom" : "universal",
"scale" : "1x"
},
{
"filename" : "ic_gift-1.png",
"idiom" : "universal",
"scale" : "2x"
},
{
"filename" : "ic_gift-2.png",
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}
{
"images" : [
{
"filename" : "ic_plane.png",
"idiom" : "universal",
"scale" : "1x"
},
{
"filename" : "ic_plane-1.png",
"idiom" : "universal",
"scale" : "2x"
},
{
"filename" : "ic_plane-2.png",
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}
{
"images" : [
{
"filename" : "ic_smile.png",
"idiom" : "universal",
"scale" : "1x"
},
{
"filename" : "ic_smile-1.png",
"idiom" : "universal",
"scale" : "2x"
},
{
"filename" : "ic_smile-2.png",
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}
{
"images" : [
{
"filename" : "ic_steering_wheel.png",
"idiom" : "universal",
"scale" : "1x"
},
{
"filename" : "ic_steering_wheel-1.png",
"idiom" : "universal",
"scale" : "2x"
},
{
"filename" : "ic_steering_wheel-2.png",
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}
{
"images" : [
{
"filename" : "ic_up.png",
"idiom" : "universal",
"scale" : "1x"
},
{
"filename" : "ic_up-1.png",
"idiom" : "universal",
"scale" : "2x"
},
{
"filename" : "ic_up-2.png",
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}
......@@ -7,7 +7,7 @@
<key>Pods-WarplySDKFrameworkIOS.xcscheme_^#shared#^_</key>
<dict>
<key>orderHint</key>
<integer>1</integer>
<integer>0</integer>
</dict>
</dict>
</dict>
......
......@@ -11,6 +11,8 @@
1E7086672811A96E00704CA8 /* CouponBarcodeViewInterface.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1E7086662811A96E00704CA8 /* CouponBarcodeViewInterface.swift */; };
1E735FF2281067320050A298 /* CampaignWebview.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1E735FF1281067320050A298 /* CampaignWebview.swift */; };
1E735FF42810681E0050A298 /* CampaignWebviewInterface.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1E735FF32810681E0050A298 /* CampaignWebviewInterface.swift */; };
1E7536732822B72500149CC9 /* DetailsViewInterface.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1E7536722822B72500149CC9 /* DetailsViewInterface.swift */; };
1E7536752822B76000149CC9 /* DetailsView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1E7536742822B76000149CC9 /* DetailsView.swift */; };
1E879E25281AC96A0089F489 /* OldCouponsView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1E879E24281AC96A0089F489 /* OldCouponsView.swift */; };
1E879E27281AC99F0089F489 /* OldCouponsViewInterface.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1E879E26281AC99F0089F489 /* OldCouponsViewInterface.swift */; };
1E98EC1428199C4F007524A0 /* AllGiftsView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1E98EC1328199C4F007524A0 /* AllGiftsView.swift */; };
......@@ -156,6 +158,8 @@
1E7086662811A96E00704CA8 /* CouponBarcodeViewInterface.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CouponBarcodeViewInterface.swift; sourceTree = "<group>"; };
1E735FF1281067320050A298 /* CampaignWebview.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CampaignWebview.swift; sourceTree = "<group>"; };
1E735FF32810681E0050A298 /* CampaignWebviewInterface.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CampaignWebviewInterface.swift; sourceTree = "<group>"; };
1E7536722822B72500149CC9 /* DetailsViewInterface.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DetailsViewInterface.swift; sourceTree = "<group>"; };
1E7536742822B76000149CC9 /* DetailsView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DetailsView.swift; sourceTree = "<group>"; };
1E879E24281AC96A0089F489 /* OldCouponsView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = OldCouponsView.swift; sourceTree = "<group>"; };
1E879E26281AC99F0089F489 /* OldCouponsViewInterface.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = OldCouponsViewInterface.swift; sourceTree = "<group>"; };
1E98EC1328199C4F007524A0 /* AllGiftsView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AllGiftsView.swift; sourceTree = "<group>"; };
......@@ -359,6 +363,8 @@
E639EFA0280810E300B9DD94 /* CouponsView.swift */,
E639EFA1280810E300B9DD94 /* CouponsViewInterface.swift */,
1EBEB02C280D69D800BF802C /* GiftsView.swift */,
1E7536722822B72500149CC9 /* DetailsViewInterface.swift */,
1E7536742822B76000149CC9 /* DetailsView.swift */,
1E98EC1328199C4F007524A0 /* AllGiftsView.swift */,
1E879E24281AC96A0089F489 /* OldCouponsView.swift */,
1E879E26281AC99F0089F489 /* OldCouponsViewInterface.swift */,
......@@ -827,6 +833,7 @@
1E98EC1628199C86007524A0 /* AllGiftsViewInterface.swift in Sources */,
E6D8DF1427A942920006A3A9 /* WLLocationManager.m in Sources */,
E6D8DF6027A9429E0006A3A9 /* MyApi.m in Sources */,
1E7536752822B76000149CC9 /* DetailsView.swift in Sources */,
E6D8DF3F27A942920006A3A9 /* AFImageDownloader.m in Sources */,
E6D8DEF727A942920006A3A9 /* WLNativeAdsCollectionMode.m in Sources */,
E6D8DEF427A942920006A3A9 /* WLCustomNativeCollectionViewCell.m in Sources */,
......@@ -849,6 +856,7 @@
E6D8DEEE27A942920006A3A9 /* WarplyReactMethods.m in Sources */,
E6D8DEF927A942920006A3A9 /* WLNativeAdCollectionViewCell.m in Sources */,
E634A36B2822999B0069DE27 /* CouponsViewController.swift in Sources */,
1E7536732822B72500149CC9 /* DetailsViewInterface.swift in Sources */,
E6D8DF4E27A942920006A3A9 /* FMDatabaseQueue.m in Sources */,
E6D8DF0827A942920006A3A9 /* WLBaseItem.m in Sources */,
E6D8DF0727A942920006A3A9 /* WLInboxItemViewController.m in Sources */,
......
......@@ -7,7 +7,7 @@
<key>WarplySDKFrameworkIOS.xcscheme_^#shared#^_</key>
<dict>
<key>orderHint</key>
<integer>0</integer>
<integer>1</integer>
</dict>
</dict>
</dict>
......
//
// DetailsView.swift
// WarplySDKFrameworkIOS
//
// Created by Manos Chorianopoulos on 3/5/22.
//
#if canImport(SwiftUI)
import SwiftUI
import Combine
import Foundation
import UIKit
extension DetailsView {
struct headerView: View {
var goBack: () -> ()
var uiscreen = UIScreen.main.bounds
var body: some View {
HStack(alignment: .center) {
Button {
// Button Action
print("Back Button tapped!")
goBack()
} label: {
Image("ic_back", bundle: Bundle(for: MyEmptyClass.self))
.resizable()
.aspectRatio(contentMode: .fit)
.frame(width: self.uiscreen.height * 0.025, height: self.uiscreen.height * 0.02)
}
Text("Ανάλυση")
.fontWeight(.medium)
.font(.system(size: 16))
.foregroundColor(Color(red: 0.20784313725490197, green: 0.3176470588235294, blue: 0.40784313725490196))
.multilineTextAlignment(.center)
.frame(maxWidth: .infinity)
.padding(.horizontal)
.offset(x: -self.uiscreen.height * 0.025)
}
.frame(maxWidth: .infinity)
.padding(.horizontal)
.padding(.vertical, 10)
}
}
struct Tabs: View {
@Binding var tabs: [String] // The tab titles
@Binding var selection: Int // Currently selected tab
let uiscreen = UIScreen.main.bounds
var body: some View {
// Pack the tabs horizontally and allow them to be scrolled
// GeometryReader { geometry in
// ScrollView(.horizontal, showsIndicators: false) {
HStack(alignment: .center, spacing: self.uiscreen.width * 0.05) {
ForEach(tabs, id: \.self) {
self.tab(title: $0)
}
}
.padding(.horizontal, self.uiscreen.width * 0.1)
.frame(maxWidth: .infinity)
.padding(.vertical, 5)
// .frame(minWidth: geometry.size.width)
// }
// .frame(maxWidth: .infinity)
// }
// .frame(maxWidth: .infinity)
// }
}
private func tab(title: String) -> some View {
let index = self.tabs.firstIndex(of: title)!
let isSelected = index == selection
return Button (action: {
// // Allows for animated transitions of the underline,
// // as well as other views on the same screen
withAnimation {
self.selection = index
}
}) {
VStack(alignment: .center, spacing: 5.0) {
Text(title)
.font(.system(size: 16))
.fontWeight(.medium)
.foregroundColor(isSelected ? Color(red: 0.1803921568627451, green: 0.6980392156862745, blue: 0.7254901960784313) : Color(red: 0.20784313725490197, green: 0.3176470588235294, blue: 0.40784313725490196))
.multilineTextAlignment(.center)
.frame(maxWidth: .infinity)
VStack {}
.frame(height: 3)
.frame(width: uiscreen.width * 0.2)
.foregroundColor(.clear)
.background(isSelected ?
LinearGradient(gradient: Gradient(colors: [Color(red: 0.06, green: 0.67, blue: 0.84), Color(red: 0.47, green: 0.75, blue: 0.43)]), startPoint: .leading, endPoint: .trailing)
: LinearGradient(gradient: Gradient(colors: [.clear, .clear]), startPoint: .leading, endPoint: .trailing)
)
.cornerRadius(20)
}
.frame(maxWidth: .infinity)
}
.frame(maxWidth: .infinity)
}
}
struct ImageView: View {
@ObservedObject var imageLoader:UrlImageModel
@State var width:CGFloat
@State var isFill:Bool
var uiscreen = UIScreen.main.bounds
init(withURL url:String , width:CGFloat, isFill:Bool) {
imageLoader = UrlImageModel(urlString:url)
self.width = width
self.isFill = isFill
}
var body: some View {
Image(uiImage: imageLoader.image ?? UIImage())
.resizable()
.aspectRatio(contentMode: isFill ? .fill : .fit)
.frame(width: self.width)
.frame(maxHeight: .infinity)
}
}
struct DropdownOption: Hashable {
let key: String
let value: String
public static func == (lhs: DropdownOption, rhs: DropdownOption) -> Bool {
return lhs.key == rhs.key
}
}
struct DropdownRow: View {
var option: DropdownOption
var onOptionSelected: ((_ option: DropdownOption) -> Void)?
var body: some View {
Button(action: {
if let onOptionSelected = self.onOptionSelected {
onOptionSelected(self.option)
}
}) {
HStack {
Text(self.option.value)
.font(.system(size: 14))
.fontWeight(.regular)
.foregroundColor(Color(red: 0.23529411764705882, green: 0.23137254901960785, blue: 0.2823529411764706))
Spacer()
}
}
.padding(.horizontal, 16)
.padding(.vertical, 5)
}
}
struct Dropdown: View {
var options: [DropdownOption]
var onOptionSelected: ((_ option: DropdownOption) -> Void)?
var backColor: Color
var body: some View {
ScrollView {
VStack(alignment: .leading, spacing: 0) {
ForEach(self.options, id: \.self) { option in
DropdownRow(option: option, onOptionSelected: self.onOptionSelected)
}
}
}
.frame(minHeight: CGFloat(options.count) * 30, maxHeight: 250)
.padding(.vertical, 5)
.background(self.backColor)
.cornerRadius(8)
}
}
struct DropdownSelector: View {
@State private var shouldShowDropdown = false
@State private var selectedOption: DropdownOption? = nil
// var placeholder: String
var options: [DropdownOption]
var onOptionSelected: ((_ option: DropdownOption) -> Void)?
var backColor: Color
private let buttonHeight: CGFloat = 50
init(options: [DropdownOption], onOptionSelected: ((_ option: DropdownOption) -> Void)?, backColor: Color) {
self.selectedOption = options[0]
self.options = options
self.onOptionSelected = onOptionSelected
self.backColor = backColor
}
var body: some View {
Button(action: {
self.shouldShowDropdown.toggle()
}) {
HStack {
// Text(selectedOption == nil ? placeholder : selectedOption!.value)
Text(selectedOption?.value ?? "")
.font(.system(size: 14))
.fontWeight(.bold)
.foregroundColor(Color(red: 0.23529411764705882, green: 0.23137254901960785, blue: 0.2823529411764706))
// .foregroundColor(selectedOption == nil ? Color.gray: Color.black)
Spacer()
Image((self.shouldShowDropdown ? "ic_up" : "ic_down"), bundle: Bundle(for: MyEmptyClass.self))
.resizable()
.aspectRatio(contentMode: .fit)
.frame(width: 15, height: 10)
}
}
.padding(.horizontal)
.cornerRadius(5)
.frame(height: self.buttonHeight)
.frame(maxWidth: .infinity)
.overlay(
VStack {
if self.shouldShowDropdown {
Spacer(minLength: buttonHeight + 10)
Dropdown(
options: self.options,
onOptionSelected: { option in
shouldShowDropdown = false
selectedOption = option
self.onOptionSelected?(option)
},
backColor: self.backColor
)
}
}, alignment: .topLeading
)
.background(
RoundedRectangle(cornerRadius: 8).fill(self.backColor)
)
}
}
//MARK:- Chart Data
struct ChartData: Identifiable {
var id = UUID()
var color : Color
var percent : CGFloat
var value : CGFloat
var title : String
var image : String
}
class ChartDataContainer : ObservableObject {
@Published var chartData: Array<ChartData>
init(chartData: Array<ChartData>) {
self.chartData = chartData
calc()
}
func calc(){
var value : CGFloat = 0
for i in 0..<chartData.count {
value += chartData[i].percent
chartData[i].value = value
}
}
}
//MARK:- Donut Graph
struct DonutChart : View {
@ObservedObject var charDataObj: ChartDataContainer
// @State var indexOfTappedSlice = -1
var uiscreen = UIScreen.main.bounds
init (charDataObj: ChartDataContainer) {
self.charDataObj = charDataObj
}
var body: some View {
VStack {
ZStack {
ForEach(Array(charDataObj.chartData.enumerated()), id: \.offset) { index, item in
Circle()
.trim(from: index == 0 ? 0.0 : charDataObj.chartData[index-1].value/100,
to: charDataObj.chartData[index].value/100)
.stroke(charDataObj.chartData[index].color,lineWidth: 12)
// .onTapGesture {
// indexOfTappedSlice = indexOfTappedSlice == index ? -1 : index
// }
// .scaleEffect(index == indexOfTappedSlice ? 1.1 : 1.0)
.animation(.spring())
}
Image("ic_cosmote_logo", bundle: Bundle(for: MyEmptyClass.self))
.resizable()
.aspectRatio(contentMode: .fit)
.frame(width: self.uiscreen.width * 0.3, height: self.uiscreen.height * 0.04)
// if indexOfTappedSlice != -1 {
// Text(String(format: "%.2f", Double(charDataObj.chartData[indexOfTappedSlice].percent))+"%")
// .font(.title)
// }
}
.frame(width: self.uiscreen.width * 0.5, height: self.uiscreen.width * 0.5)
.padding()
.onAppear() {
self.charDataObj.calc()
}
}
}
}
}
@available(iOS 13.0.0, *)
struct DetailsView: View {
var parentView: UIView
var coupons:Array<swiftApi.CouponItemModel> = []
var uiscreen = UIScreen.main.bounds
@State private var selectedTab = 0
@State private var selectedCouponOption: DropdownOption? = couponOptions[0]
@State private var selectedRedeemOption: DropdownOption? = redeemOptions[0]
let couponsChartData: Array<ChartData> = [
ChartData(color: Color(red: 0.57, green: 0.82, blue: 0.02), percent: 60, value: 0, title: "Διασκέδαση", image: "ic_smile"),
ChartData(color: Color(red: 0.24, green: 0.32, blue: 0.40), percent: 22, value: 0, title: "Supermarket", image: "ic_cart"),
ChartData(color: Color(red: 0.14, green: 0.66, blue: 0.71), percent: 18, value: 0, title: "Ταξίδια", image: "ic_plane")
]
let giftsChartData: Array<ChartData> = [
ChartData(color: Color(red: 0.57, green: 0.82, blue: 0.02), percent: 50, value: 0, title: "Δώρο Γενεθλίων", image: "ic_gift"),
ChartData(color: Color(red: 0.24, green: 0.32, blue: 0.40), percent: 50, value: 0, title: "Safe driving", image: "ic_steering_wheel")
]
@State var charDataObj: ChartDataContainer
static var uniqueKey: String {
UUID().uuidString
}
static let couponOptions: [DropdownOption] = [
DropdownOption(key: uniqueKey, value: "Κουπόνια"),
DropdownOption(key: uniqueKey, value: "Δώρα"),
]
static let redeemOptions: [DropdownOption] = [
DropdownOption(key: uniqueKey, value: "Εξαργύρωση"),
DropdownOption(key: uniqueKey, value: "Συλλογή"),
]
init(parentView: UIView) { //initializer method
let instanceOfMySwiftApi = swiftApi()
let couponsData = instanceOfMySwiftApi.getCoupons()
self.coupons = couponsData
self.parentView = parentView
self.charDataObj = ChartDataContainer(chartData: couponsChartData)
}
func goBack(){
for subview in parentView.subviews {
if(subview.tag == 10) {
subview.removeFromSuperview()
}
}
}
var body: some View {
VStack {
headerView(goBack: goBack)
Tabs(tabs: .constant(["Μηνιαία", "6Μηνο", "12Μηνο"]),
selection: $selectedTab)
VStack {
GeometryReader { geometry in
ScrollView(showsIndicators: false) {
VStack {
VStack {
DropdownSelector(
// placeholder: "Δώρα",
options: DetailsView.couponOptions,
onOptionSelected: { option in
print(option)
selectedCouponOption = option
if (option == DetailsView.couponOptions[0]) {
self.charDataObj = ChartDataContainer(chartData: couponsChartData)
} else {
self.charDataObj = ChartDataContainer(chartData: giftsChartData)
}
},
backColor: Color(red: 0.9607843137254902, green: 0.9607843137254902, blue: 0.9607843137254902)
)
.padding(.horizontal, 25)
.padding(.top, self.uiscreen.height * 0.02)
.zIndex(2)
DonutChart(charDataObj: self.charDataObj)
.padding(.vertical, self.uiscreen.height * 0.03)
DropdownSelector(
// placeholder: "Δώρα",
options: DetailsView.redeemOptions,
onOptionSelected: { option in
selectedRedeemOption = option
},
backColor: Color(red: 0.9333333333333333, green: 0.9686274509803922, blue: 1.0)
)
.padding(.horizontal, 25)
.zIndex(1)
VStack {
VStack(spacing: self.uiscreen.width * 0.06) {
ForEach(Array(charDataObj.chartData.enumerated()), id: \.offset) { index, item in
HStack {
Image(charDataObj.chartData[index].image, bundle: Bundle(for: MyEmptyClass.self))
.resizable()
.aspectRatio(contentMode: .fit)
.frame(width: self.uiscreen.height * 0.02, height: self.uiscreen.height * 0.02)
Text(charDataObj.chartData[index].title)
.fontWeight(.medium)
.font(.system(size: 14))
.foregroundColor(Color(red: 0.30196078431372547, green: 0.2980392156862745, blue: 0.34509803921568627))
.padding(.horizontal)
Spacer()
// Text(String(format: "%.2f", Double(charDataObj.chartData[index].percent))+"%")
Text(String(format: "%.0f", Double(charDataObj.chartData[index].percent))+"%")
.fontWeight(.medium)
.font(.system(size: 16))
.foregroundColor(charDataObj.chartData[index].color)
}
.frame(maxWidth: .infinity)
}
}
.padding(.all, self.uiscreen.width * 0.06)
.frame(maxWidth: .infinity)
}
.frame(width:self.uiscreen.width * 0.86)
// .frame(maxHeight: .infinity)
.background(Color(red: 0.9490196078431372, green: 0.9490196078431372, blue: 0.9490196078431372, opacity: 0.49))
.cornerRadius(10)
.padding(.top, self.uiscreen.height * 0.04)
Spacer()
VStack(alignment: .center) {
Button {
// Button Action
print("More Details Button tapped!")
} label: {
HStack {
Text("Αναλυτικά")
.fontWeight(.medium)
.font(.system(size: 16))
.foregroundColor(Color.white)
.multilineTextAlignment(.center)
.padding(.all)
}
.frame(maxWidth: .infinity)
}
.frame(width: self.uiscreen.width * 0.8)
.background(Color(red: 0.4745098039215686, green: 0.7490196078431373, blue: 0.0784313725490196))
.cornerRadius(7)
}
.frame(maxWidth: .infinity)
.padding(.top, self.uiscreen.height * 0.04)
.padding(.bottom, self.uiscreen.height * 0.02)
// .padding(.horizontal, 25)
}
.frame(width:self.uiscreen.width * 0.93)
.frame(maxHeight: .infinity)
.background(Color.white)
.cornerRadius(10)
}
.padding(.vertical, self.uiscreen.height * 0.02)
.frame(minHeight: geometry.size.height)
// .frame(maxHeight: .infinity)
}
.cornerRadius(10, corners: [.topLeft])
.frame(width:self.uiscreen.width)
.frame(maxHeight: .infinity)
}
.frame(width:self.uiscreen.width)
.frame(maxHeight: .infinity)
}
.frame(width:self.uiscreen.width)
.frame(maxHeight: .infinity)
.padding(.top, 5)
.background(
Image("coupons_scrollview", bundle: Bundle(for: MyEmptyClass.self))
.resizable()
)
}
.edgesIgnoringSafeArea([.bottom])
.frame(width:self.uiscreen.width)
.frame(maxHeight: .infinity)
}
}
#endif
//struct DetailsView_Previews: PreviewProvider {
// static var previews: some View {
// DetailsView()
// }
//}
//
// DetailsViewInterface.swift
// WarplySDKFrameworkIOS
//
// Created by Manos Chorianopoulos on 3/5/22.
//
import Foundation
import SwiftUI
@available(iOS 13.0.0, *)
@objc public class DetailsViewInterface : NSObject {
@objc(detailsViewController:) static public func detailsViewController(parentView: UIView?) -> UIViewController {
return UIHostingController(rootView: DetailsView(parentView: parentView!))
}
}
......@@ -29,6 +29,7 @@
- (UIViewController *) openMoreForYou:(UIView*) parentView;
- (UIViewController *) openCampaign:(UIView*) parentView campaign:(NSString*) campaign;
- (UIViewController *) openSteps:(UIView*) parentView;
- (UIViewController *) openDetails:(UIView*) parentView;
- (NSDictionary *) provideInfoForCampaign;
- (void) applicationDidEnterBackground:(UIApplication *)application;
- (void) applicationWillEnterForeground:(UIApplication *)application;
......
......@@ -150,6 +150,12 @@ CMPedometer *pedometer;
return stepsViewController;
}
- (UIViewController *) openDetails:(UIView*) parentView{
UIViewController *detailsViewController = [DetailsViewInterface detailsViewController:parentView];
return detailsViewController;
}
- (NSDictionary *) provideInfoForCampaign {
NSMutableDictionary* info = [[NSMutableDictionary alloc] init];
info[@"web_id"] = [Warply sharedService].webId;
......