Showing
25 changed files
with
14 additions
and
3595 deletions
| ... | @@ -7,35 +7,13 @@ | ... | @@ -7,35 +7,13 @@ |
| 7 | objects = { | 7 | objects = { |
| 8 | 8 | ||
| 9 | /* Begin PBXBuildFile section */ | 9 | /* Begin PBXBuildFile section */ |
| 10 | - 1E7086652811A93F00704CA8 /* CouponBarcodeView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1E7086642811A93F00704CA8 /* CouponBarcodeView.swift */; }; | ||
| 11 | - 1E7086672811A96E00704CA8 /* CouponBarcodeViewInterface.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1E7086662811A96E00704CA8 /* CouponBarcodeViewInterface.swift */; }; | ||
| 12 | - 1E735FF2281067320050A298 /* CampaignWebview.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1E735FF1281067320050A298 /* CampaignWebview.swift */; }; | ||
| 13 | - 1E735FF42810681E0050A298 /* CampaignWebviewInterface.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1E735FF32810681E0050A298 /* CampaignWebviewInterface.swift */; }; | ||
| 14 | - 1E7536732822B72500149CC9 /* DetailsViewInterface.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1E7536722822B72500149CC9 /* DetailsViewInterface.swift */; }; | ||
| 15 | - 1E7536752822B76000149CC9 /* DetailsView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1E7536742822B76000149CC9 /* DetailsView.swift */; }; | ||
| 16 | - 1E879E25281AC96A0089F489 /* OldCouponsView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1E879E24281AC96A0089F489 /* OldCouponsView.swift */; }; | ||
| 17 | - 1E879E27281AC99F0089F489 /* OldCouponsViewInterface.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1E879E26281AC99F0089F489 /* OldCouponsViewInterface.swift */; }; | ||
| 18 | - 1E98EC1428199C4F007524A0 /* AllGiftsView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1E98EC1328199C4F007524A0 /* AllGiftsView.swift */; }; | ||
| 19 | - 1E98EC1628199C86007524A0 /* AllGiftsViewInterface.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1E98EC1528199C86007524A0 /* AllGiftsViewInterface.swift */; }; | ||
| 20 | 1EBB036F281BE3610062F663 /* RSBarcodes_Swift in Frameworks */ = {isa = PBXBuildFile; productRef = 1EBB036E281BE3610062F663 /* RSBarcodes_Swift */; }; | 10 | 1EBB036F281BE3610062F663 /* RSBarcodes_Swift in Frameworks */ = {isa = PBXBuildFile; productRef = 1EBB036E281BE3610062F663 /* RSBarcodes_Swift */; }; |
| 21 | - 1EBEB02D280D69D800BF802C /* GiftsView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1EBEB02C280D69D800BF802C /* GiftsView.swift */; }; | ||
| 22 | - 1EBEB02F280D6AA500BF802C /* GiftsViewInterface.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1EBEB02E280D6AA500BF802C /* GiftsViewInterface.swift */; }; | ||
| 23 | 260C6A1AFF7560C32E212F20 /* Pods_WarplySDKFrameworkIOS.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 1353B8C484CC0649CAC2EB74 /* Pods_WarplySDKFrameworkIOS.framework */; }; | 11 | 260C6A1AFF7560C32E212F20 /* Pods_WarplySDKFrameworkIOS.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 1353B8C484CC0649CAC2EB74 /* Pods_WarplySDKFrameworkIOS.framework */; }; |
| 24 | - E634A362282151E30069DE27 /* StepsView.swift in Sources */ = {isa = PBXBuildFile; fileRef = E634A361282151E30069DE27 /* StepsView.swift */; }; | ||
| 25 | - E634A364282168550069DE27 /* StepsViewInterface.swift in Sources */ = {isa = PBXBuildFile; fileRef = E634A363282168550069DE27 /* StepsViewInterface.swift */; }; | ||
| 26 | E634A369282299770069DE27 /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = E634A368282299760069DE27 /* Main.storyboard */; }; | 12 | E634A369282299770069DE27 /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = E634A368282299760069DE27 /* Main.storyboard */; }; |
| 27 | E634A36B2822999B0069DE27 /* CouponsViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = E634A36A2822999B0069DE27 /* CouponsViewController.swift */; }; | 13 | E634A36B2822999B0069DE27 /* CouponsViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = E634A36A2822999B0069DE27 /* CouponsViewController.swift */; }; |
| 28 | - E639EFA2280810E300B9DD94 /* CouponsView.swift in Sources */ = {isa = PBXBuildFile; fileRef = E639EFA0280810E300B9DD94 /* CouponsView.swift */; }; | ||
| 29 | - E639EFA3280810E300B9DD94 /* CouponsViewInterface.swift in Sources */ = {isa = PBXBuildFile; fileRef = E639EFA1280810E300B9DD94 /* CouponsViewInterface.swift */; }; | ||
| 30 | E639EFA52808244E00B9DD94 /* MyEmptyClass.swift in Sources */ = {isa = PBXBuildFile; fileRef = E639EFA42808244E00B9DD94 /* MyEmptyClass.swift */; }; | 14 | E639EFA52808244E00B9DD94 /* MyEmptyClass.swift in Sources */ = {isa = PBXBuildFile; fileRef = E639EFA42808244E00B9DD94 /* MyEmptyClass.swift */; }; |
| 31 | E639EFAB2808347700B9DD94 /* ic_back.png in Resources */ = {isa = PBXBuildFile; fileRef = E639EFAA2808347700B9DD94 /* ic_back.png */; }; | 15 | E639EFAB2808347700B9DD94 /* ic_back.png in Resources */ = {isa = PBXBuildFile; fileRef = E639EFAA2808347700B9DD94 /* ic_back.png */; }; |
| 32 | E655D05A280590AD004F913C /* WarplySDKFrameworkIOS-Bridging-Header.h in Headers */ = {isa = PBXBuildFile; fileRef = E655D05928058A72004F913C /* WarplySDKFrameworkIOS-Bridging-Header.h */; }; | 16 | E655D05A280590AD004F913C /* WarplySDKFrameworkIOS-Bridging-Header.h in Headers */ = {isa = PBXBuildFile; fileRef = E655D05928058A72004F913C /* WarplySDKFrameworkIOS-Bridging-Header.h */; }; |
| 33 | - E67D1EB8281055D900940F01 /* WalletViewInterface.swift in Sources */ = {isa = PBXBuildFile; fileRef = E67D1EB7281055D900940F01 /* WalletViewInterface.swift */; }; | ||
| 34 | - E67D1EBA281055F800940F01 /* MoreForYouViewInterface.swift in Sources */ = {isa = PBXBuildFile; fileRef = E67D1EB9281055F800940F01 /* MoreForYouViewInterface.swift */; }; | ||
| 35 | - E67D1EBE2810573900940F01 /* WalletView.swift in Sources */ = {isa = PBXBuildFile; fileRef = E67D1EBD2810573900940F01 /* WalletView.swift */; }; | ||
| 36 | - E67D1EC02810579F00940F01 /* MoreForYouView.swift in Sources */ = {isa = PBXBuildFile; fileRef = E67D1EBF2810579F00940F01 /* MoreForYouView.swift */; }; | ||
| 37 | - E67D1EC228113EED00940F01 /* CouponView.swift in Sources */ = {isa = PBXBuildFile; fileRef = E67D1EC128113EED00940F01 /* CouponView.swift */; }; | ||
| 38 | - E67D1EC428113EFD00940F01 /* CouponViewInterface.swift in Sources */ = {isa = PBXBuildFile; fileRef = E67D1EC328113EFD00940F01 /* CouponViewInterface.swift */; }; | ||
| 39 | E67D1EC828119ED300940F01 /* swiftApi.swift in Sources */ = {isa = PBXBuildFile; fileRef = E67D1EC528117F2400940F01 /* swiftApi.swift */; }; | 17 | E67D1EC828119ED300940F01 /* swiftApi.swift in Sources */ = {isa = PBXBuildFile; fileRef = E67D1EC528117F2400940F01 /* swiftApi.swift */; }; |
| 40 | E6D8DE6D27A942010006A3A9 /* WarplySDKFrameworkIOS.docc in Sources */ = {isa = PBXBuildFile; fileRef = E6D8DE6C27A942010006A3A9 /* WarplySDKFrameworkIOS.docc */; }; | 18 | E6D8DE6D27A942010006A3A9 /* WarplySDKFrameworkIOS.docc in Sources */ = {isa = PBXBuildFile; fileRef = E6D8DE6C27A942010006A3A9 /* WarplySDKFrameworkIOS.docc */; }; |
| 41 | E6D8DE6E27A942010006A3A9 /* WarplySDKFrameworkIOS.h in Headers */ = {isa = PBXBuildFile; fileRef = E6D8DE6B27A942010006A3A9 /* WarplySDKFrameworkIOS.h */; settings = {ATTRIBUTES = (Public, ); }; }; | 19 | E6D8DE6E27A942010006A3A9 /* WarplySDKFrameworkIOS.h in Headers */ = {isa = PBXBuildFile; fileRef = E6D8DE6B27A942010006A3A9 /* WarplySDKFrameworkIOS.h */; settings = {ATTRIBUTES = (Public, ); }; }; |
| ... | @@ -154,34 +132,12 @@ | ... | @@ -154,34 +132,12 @@ |
| 154 | 132 | ||
| 155 | /* Begin PBXFileReference section */ | 133 | /* Begin PBXFileReference section */ |
| 156 | 1353B8C484CC0649CAC2EB74 /* Pods_WarplySDKFrameworkIOS.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_WarplySDKFrameworkIOS.framework; sourceTree = BUILT_PRODUCTS_DIR; }; | 134 | 1353B8C484CC0649CAC2EB74 /* Pods_WarplySDKFrameworkIOS.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_WarplySDKFrameworkIOS.framework; sourceTree = BUILT_PRODUCTS_DIR; }; |
| 157 | - 1E7086642811A93F00704CA8 /* CouponBarcodeView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CouponBarcodeView.swift; sourceTree = "<group>"; }; | ||
| 158 | - 1E7086662811A96E00704CA8 /* CouponBarcodeViewInterface.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CouponBarcodeViewInterface.swift; sourceTree = "<group>"; }; | ||
| 159 | - 1E735FF1281067320050A298 /* CampaignWebview.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CampaignWebview.swift; sourceTree = "<group>"; }; | ||
| 160 | - 1E735FF32810681E0050A298 /* CampaignWebviewInterface.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CampaignWebviewInterface.swift; sourceTree = "<group>"; }; | ||
| 161 | - 1E7536722822B72500149CC9 /* DetailsViewInterface.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DetailsViewInterface.swift; sourceTree = "<group>"; }; | ||
| 162 | - 1E7536742822B76000149CC9 /* DetailsView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DetailsView.swift; sourceTree = "<group>"; }; | ||
| 163 | - 1E879E24281AC96A0089F489 /* OldCouponsView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = OldCouponsView.swift; sourceTree = "<group>"; }; | ||
| 164 | - 1E879E26281AC99F0089F489 /* OldCouponsViewInterface.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = OldCouponsViewInterface.swift; sourceTree = "<group>"; }; | ||
| 165 | - 1E98EC1328199C4F007524A0 /* AllGiftsView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AllGiftsView.swift; sourceTree = "<group>"; }; | ||
| 166 | - 1E98EC1528199C86007524A0 /* AllGiftsViewInterface.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AllGiftsViewInterface.swift; sourceTree = "<group>"; }; | ||
| 167 | - 1EBEB02C280D69D800BF802C /* GiftsView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = GiftsView.swift; sourceTree = "<group>"; }; | ||
| 168 | - 1EBEB02E280D6AA500BF802C /* GiftsViewInterface.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = GiftsViewInterface.swift; sourceTree = "<group>"; }; | ||
| 169 | B9413513157AD76ECE896B81 /* Pods-WarplySDKFrameworkIOS.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-WarplySDKFrameworkIOS.release.xcconfig"; path = "Target Support Files/Pods-WarplySDKFrameworkIOS/Pods-WarplySDKFrameworkIOS.release.xcconfig"; sourceTree = "<group>"; }; | 135 | B9413513157AD76ECE896B81 /* Pods-WarplySDKFrameworkIOS.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-WarplySDKFrameworkIOS.release.xcconfig"; path = "Target Support Files/Pods-WarplySDKFrameworkIOS/Pods-WarplySDKFrameworkIOS.release.xcconfig"; sourceTree = "<group>"; }; |
| 170 | - E634A361282151E30069DE27 /* StepsView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = StepsView.swift; sourceTree = "<group>"; }; | ||
| 171 | - E634A363282168550069DE27 /* StepsViewInterface.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = StepsViewInterface.swift; sourceTree = "<group>"; }; | ||
| 172 | E634A368282299760069DE27 /* Main.storyboard */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; path = Main.storyboard; sourceTree = "<group>"; }; | 136 | E634A368282299760069DE27 /* Main.storyboard */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; path = Main.storyboard; sourceTree = "<group>"; }; |
| 173 | E634A36A2822999B0069DE27 /* CouponsViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CouponsViewController.swift; sourceTree = "<group>"; }; | 137 | E634A36A2822999B0069DE27 /* CouponsViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CouponsViewController.swift; sourceTree = "<group>"; }; |
| 174 | - E639EFA0280810E300B9DD94 /* CouponsView.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = CouponsView.swift; sourceTree = "<group>"; }; | ||
| 175 | - E639EFA1280810E300B9DD94 /* CouponsViewInterface.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = CouponsViewInterface.swift; sourceTree = "<group>"; }; | ||
| 176 | E639EFA42808244E00B9DD94 /* MyEmptyClass.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MyEmptyClass.swift; sourceTree = "<group>"; }; | 138 | E639EFA42808244E00B9DD94 /* MyEmptyClass.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MyEmptyClass.swift; sourceTree = "<group>"; }; |
| 177 | E639EFAA2808347700B9DD94 /* ic_back.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = ic_back.png; sourceTree = "<group>"; }; | 139 | E639EFAA2808347700B9DD94 /* ic_back.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = ic_back.png; sourceTree = "<group>"; }; |
| 178 | E655D05928058A72004F913C /* WarplySDKFrameworkIOS-Bridging-Header.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "WarplySDKFrameworkIOS-Bridging-Header.h"; sourceTree = "<group>"; }; | 140 | E655D05928058A72004F913C /* WarplySDKFrameworkIOS-Bridging-Header.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "WarplySDKFrameworkIOS-Bridging-Header.h"; sourceTree = "<group>"; }; |
| 179 | - E67D1EB7281055D900940F01 /* WalletViewInterface.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = WalletViewInterface.swift; sourceTree = "<group>"; }; | ||
| 180 | - E67D1EB9281055F800940F01 /* MoreForYouViewInterface.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MoreForYouViewInterface.swift; sourceTree = "<group>"; }; | ||
| 181 | - E67D1EBD2810573900940F01 /* WalletView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = WalletView.swift; sourceTree = "<group>"; }; | ||
| 182 | - E67D1EBF2810579F00940F01 /* MoreForYouView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MoreForYouView.swift; sourceTree = "<group>"; }; | ||
| 183 | - E67D1EC128113EED00940F01 /* CouponView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CouponView.swift; sourceTree = "<group>"; }; | ||
| 184 | - E67D1EC328113EFD00940F01 /* CouponViewInterface.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CouponViewInterface.swift; sourceTree = "<group>"; }; | ||
| 185 | E67D1EC528117F2400940F01 /* swiftApi.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = swiftApi.swift; sourceTree = "<group>"; }; | 141 | E67D1EC528117F2400940F01 /* swiftApi.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = swiftApi.swift; sourceTree = "<group>"; }; |
| 186 | E6D8DE6827A942010006A3A9 /* WarplySDKFrameworkIOS.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = WarplySDKFrameworkIOS.framework; sourceTree = BUILT_PRODUCTS_DIR; }; | 142 | E6D8DE6827A942010006A3A9 /* WarplySDKFrameworkIOS.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = WarplySDKFrameworkIOS.framework; sourceTree = BUILT_PRODUCTS_DIR; }; |
| 187 | E6D8DE6B27A942010006A3A9 /* WarplySDKFrameworkIOS.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = WarplySDKFrameworkIOS.h; sourceTree = "<group>"; }; | 143 | E6D8DE6B27A942010006A3A9 /* WarplySDKFrameworkIOS.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = WarplySDKFrameworkIOS.h; sourceTree = "<group>"; }; |
| ... | @@ -360,26 +316,6 @@ | ... | @@ -360,26 +316,6 @@ |
| 360 | isa = PBXGroup; | 316 | isa = PBXGroup; |
| 361 | children = ( | 317 | children = ( |
| 362 | E639EFA92808347700B9DD94 /* UIResources */, | 318 | E639EFA92808347700B9DD94 /* UIResources */, |
| 363 | - E639EFA0280810E300B9DD94 /* CouponsView.swift */, | ||
| 364 | - E639EFA1280810E300B9DD94 /* CouponsViewInterface.swift */, | ||
| 365 | - 1EBEB02C280D69D800BF802C /* GiftsView.swift */, | ||
| 366 | - 1E7536722822B72500149CC9 /* DetailsViewInterface.swift */, | ||
| 367 | - 1E7536742822B76000149CC9 /* DetailsView.swift */, | ||
| 368 | - 1E98EC1328199C4F007524A0 /* AllGiftsView.swift */, | ||
| 369 | - 1E879E24281AC96A0089F489 /* OldCouponsView.swift */, | ||
| 370 | - 1E879E26281AC99F0089F489 /* OldCouponsViewInterface.swift */, | ||
| 371 | - 1E98EC1528199C86007524A0 /* AllGiftsViewInterface.swift */, | ||
| 372 | - 1E735FF1281067320050A298 /* CampaignWebview.swift */, | ||
| 373 | - 1E735FF32810681E0050A298 /* CampaignWebviewInterface.swift */, | ||
| 374 | - 1EBEB02E280D6AA500BF802C /* GiftsViewInterface.swift */, | ||
| 375 | - E67D1EB7281055D900940F01 /* WalletViewInterface.swift */, | ||
| 376 | - E67D1EBD2810573900940F01 /* WalletView.swift */, | ||
| 377 | - E67D1EB9281055F800940F01 /* MoreForYouViewInterface.swift */, | ||
| 378 | - E67D1EBF2810579F00940F01 /* MoreForYouView.swift */, | ||
| 379 | - E67D1EC128113EED00940F01 /* CouponView.swift */, | ||
| 380 | - 1E7086642811A93F00704CA8 /* CouponBarcodeView.swift */, | ||
| 381 | - 1E7086662811A96E00704CA8 /* CouponBarcodeViewInterface.swift */, | ||
| 382 | - E67D1EC328113EFD00940F01 /* CouponViewInterface.swift */, | ||
| 383 | E6D8DF5E27A9429E0006A3A9 /* MyApi.h */, | 319 | E6D8DF5E27A9429E0006A3A9 /* MyApi.h */, |
| 384 | E6D8DF5C27A9429E0006A3A9 /* MyApi.m */, | 320 | E6D8DF5C27A9429E0006A3A9 /* MyApi.m */, |
| 385 | E6D8DE7427A942910006A3A9 /* Helpers */, | 321 | E6D8DE7427A942910006A3A9 /* Helpers */, |
| ... | @@ -390,8 +326,6 @@ | ... | @@ -390,8 +326,6 @@ |
| 390 | E655D05928058A72004F913C /* WarplySDKFrameworkIOS-Bridging-Header.h */, | 326 | E655D05928058A72004F913C /* WarplySDKFrameworkIOS-Bridging-Header.h */, |
| 391 | E639EFA42808244E00B9DD94 /* MyEmptyClass.swift */, | 327 | E639EFA42808244E00B9DD94 /* MyEmptyClass.swift */, |
| 392 | E67D1EC528117F2400940F01 /* swiftApi.swift */, | 328 | E67D1EC528117F2400940F01 /* swiftApi.swift */, |
| 393 | - E634A361282151E30069DE27 /* StepsView.swift */, | ||
| 394 | - E634A363282168550069DE27 /* StepsViewInterface.swift */, | ||
| 395 | E634A368282299760069DE27 /* Main.storyboard */, | 329 | E634A368282299760069DE27 /* Main.storyboard */, |
| 396 | E634A36A2822999B0069DE27 /* CouponsViewController.swift */, | 330 | E634A36A2822999B0069DE27 /* CouponsViewController.swift */, |
| 397 | ); | 331 | ); |
| ... | @@ -786,54 +720,34 @@ | ... | @@ -786,54 +720,34 @@ |
| 786 | isa = PBXSourcesBuildPhase; | 720 | isa = PBXSourcesBuildPhase; |
| 787 | buildActionMask = 2147483647; | 721 | buildActionMask = 2147483647; |
| 788 | files = ( | 722 | files = ( |
| 789 | - 1E879E27281AC99F0089F489 /* OldCouponsViewInterface.swift in Sources */, | ||
| 790 | - E634A364282168550069DE27 /* StepsViewInterface.swift in Sources */, | ||
| 791 | E6D8DF0B27A942920006A3A9 /* WLEvent.m in Sources */, | 723 | E6D8DF0B27A942920006A3A9 /* WLEvent.m in Sources */, |
| 792 | E6D8DF1E27A942920006A3A9 /* UIViewController+WLAdditions.m in Sources */, | 724 | E6D8DF1E27A942920006A3A9 /* UIViewController+WLAdditions.m in Sources */, |
| 793 | E6D8DF2E27A942920006A3A9 /* UIRefreshControl+AFNetworking.m in Sources */, | 725 | E6D8DF2E27A942920006A3A9 /* UIRefreshControl+AFNetworking.m in Sources */, |
| 794 | E6D8DF4827A942920006A3A9 /* AFURLRequestSerialization.m in Sources */, | 726 | E6D8DF4827A942920006A3A9 /* AFURLRequestSerialization.m in Sources */, |
| 795 | - E67D1EC228113EED00940F01 /* CouponView.swift in Sources */, | ||
| 796 | - 1E7086672811A96E00704CA8 /* CouponBarcodeViewInterface.swift in Sources */, | ||
| 797 | - 1E98EC1428199C4F007524A0 /* AllGiftsView.swift in Sources */, | ||
| 798 | E6D8DEF327A942920006A3A9 /* WLNativeVideoTableViewCell.m in Sources */, | 727 | E6D8DEF327A942920006A3A9 /* WLNativeVideoTableViewCell.m in Sources */, |
| 799 | E6D8DF2527A942920006A3A9 /* WLSMSActionHanlder.m in Sources */, | 728 | E6D8DF2527A942920006A3A9 /* WLSMSActionHanlder.m in Sources */, |
| 800 | - E67D1EBE2810573900940F01 /* WalletView.swift in Sources */, | ||
| 801 | E6D8DF5727A942920006A3A9 /* FMResultSet.m in Sources */, | 729 | E6D8DF5727A942920006A3A9 /* FMResultSet.m in Sources */, |
| 802 | - E67D1EC428113EFD00940F01 /* CouponViewInterface.swift in Sources */, | ||
| 803 | E6D8DF3A27A942920006A3A9 /* UIButton+AFNetworking.m in Sources */, | 730 | E6D8DF3A27A942920006A3A9 /* UIButton+AFNetworking.m in Sources */, |
| 804 | E6D8DF0627A942920006A3A9 /* WLBeacon.m in Sources */, | 731 | E6D8DF0627A942920006A3A9 /* WLBeacon.m in Sources */, |
| 805 | - 1E735FF2281067320050A298 /* CampaignWebview.swift in Sources */, | ||
| 806 | E6D8DF2927A942920006A3A9 /* NSData+SSToolkitAdditions.m in Sources */, | 732 | E6D8DF2927A942920006A3A9 /* NSData+SSToolkitAdditions.m in Sources */, |
| 807 | - 1EBEB02D280D69D800BF802C /* GiftsView.swift in Sources */, | ||
| 808 | - E67D1EC02810579F00940F01 /* MoreForYouView.swift in Sources */, | ||
| 809 | E6D8DEFC27A942920006A3A9 /* WLCustomNativeAdTableViewCell.m in Sources */, | 733 | E6D8DEFC27A942920006A3A9 /* WLCustomNativeAdTableViewCell.m in Sources */, |
| 810 | - 1E735FF42810681E0050A298 /* CampaignWebviewInterface.swift in Sources */, | ||
| 811 | - E639EFA3280810E300B9DD94 /* CouponsViewInterface.swift in Sources */, | ||
| 812 | - 1EBEB02F280D6AA500BF802C /* GiftsViewInterface.swift in Sources */, | ||
| 813 | - E67D1EBA281055F800940F01 /* MoreForYouViewInterface.swift in Sources */, | ||
| 814 | E6D8DF4A27A942920006A3A9 /* AFNetworkReachabilityManager.m in Sources */, | 734 | E6D8DF4A27A942920006A3A9 /* AFNetworkReachabilityManager.m in Sources */, |
| 815 | E6D8DF4B27A942920006A3A9 /* AFSecurityPolicy.m in Sources */, | 735 | E6D8DF4B27A942920006A3A9 /* AFSecurityPolicy.m in Sources */, |
| 816 | E6D8DF1327A942920006A3A9 /* WLBeaconManager.m in Sources */, | 736 | E6D8DF1327A942920006A3A9 /* WLBeaconManager.m in Sources */, |
| 817 | E6D8DF0427A942920006A3A9 /* WLInboxItem.m in Sources */, | 737 | E6D8DF0427A942920006A3A9 /* WLInboxItem.m in Sources */, |
| 818 | E6D8DF5127A942920006A3A9 /* FMDatabaseAdditions.m in Sources */, | 738 | E6D8DF5127A942920006A3A9 /* FMDatabaseAdditions.m in Sources */, |
| 819 | - 1E879E25281AC96A0089F489 /* OldCouponsView.swift in Sources */, | ||
| 820 | E6D8DF2127A942920006A3A9 /* WLAPPActionHandler.m in Sources */, | 739 | E6D8DF2127A942920006A3A9 /* WLAPPActionHandler.m in Sources */, |
| 821 | E6D8DF5627A942920006A3A9 /* FMDatabasePool.m in Sources */, | 740 | E6D8DF5627A942920006A3A9 /* FMDatabasePool.m in Sources */, |
| 822 | E6D8DF4527A942920006A3A9 /* AFHTTPSessionManager.m in Sources */, | 741 | E6D8DF4527A942920006A3A9 /* AFHTTPSessionManager.m in Sources */, |
| 823 | E6D8DF3B27A942920006A3A9 /* UIActivityIndicatorView+AFNetworking.m in Sources */, | 742 | E6D8DF3B27A942920006A3A9 /* UIActivityIndicatorView+AFNetworking.m in Sources */, |
| 824 | E6D8DF3727A942920006A3A9 /* UIImageView+AFNetworking.m in Sources */, | 743 | E6D8DF3727A942920006A3A9 /* UIImageView+AFNetworking.m in Sources */, |
| 825 | - E67D1EB8281055D900940F01 /* WalletViewInterface.swift in Sources */, | ||
| 826 | E6D8DF3127A942920006A3A9 /* AFNetworkActivityIndicatorManager.m in Sources */, | 744 | E6D8DF3127A942920006A3A9 /* AFNetworkActivityIndicatorManager.m in Sources */, |
| 827 | E6D8DF3D27A942920006A3A9 /* AFAutoPurgingImageCache.m in Sources */, | 745 | E6D8DF3D27A942920006A3A9 /* AFAutoPurgingImageCache.m in Sources */, |
| 828 | - E634A362282151E30069DE27 /* StepsView.swift in Sources */, | ||
| 829 | E6D8DF0A27A942920006A3A9 /* WLAPSItem.m in Sources */, | 746 | E6D8DF0A27A942920006A3A9 /* WLAPSItem.m in Sources */, |
| 830 | E6D8DF2C27A942920006A3A9 /* UIProgressView+AFNetworking.m in Sources */, | 747 | E6D8DF2C27A942920006A3A9 /* UIProgressView+AFNetworking.m in Sources */, |
| 831 | E6D8DF3C27A942920006A3A9 /* UIWebView+AFNetworking.m in Sources */, | 748 | E6D8DF3C27A942920006A3A9 /* UIWebView+AFNetworking.m in Sources */, |
| 832 | - E639EFA2280810E300B9DD94 /* CouponsView.swift in Sources */, | ||
| 833 | - 1E98EC1628199C86007524A0 /* AllGiftsViewInterface.swift in Sources */, | ||
| 834 | E6D8DF1427A942920006A3A9 /* WLLocationManager.m in Sources */, | 749 | E6D8DF1427A942920006A3A9 /* WLLocationManager.m in Sources */, |
| 835 | E6D8DF6027A9429E0006A3A9 /* MyApi.m in Sources */, | 750 | E6D8DF6027A9429E0006A3A9 /* MyApi.m in Sources */, |
| 836 | - 1E7536752822B76000149CC9 /* DetailsView.swift in Sources */, | ||
| 837 | E6D8DF3F27A942920006A3A9 /* AFImageDownloader.m in Sources */, | 751 | E6D8DF3F27A942920006A3A9 /* AFImageDownloader.m in Sources */, |
| 838 | E6D8DEF727A942920006A3A9 /* WLNativeAdsCollectionMode.m in Sources */, | 752 | E6D8DEF727A942920006A3A9 /* WLNativeAdsCollectionMode.m in Sources */, |
| 839 | E6D8DEF427A942920006A3A9 /* WLCustomNativeCollectionViewCell.m in Sources */, | 753 | E6D8DEF427A942920006A3A9 /* WLCustomNativeCollectionViewCell.m in Sources */, |
| ... | @@ -843,7 +757,6 @@ | ... | @@ -843,7 +757,6 @@ |
| 843 | E67D1EC828119ED300940F01 /* swiftApi.swift in Sources */, | 757 | E67D1EC828119ED300940F01 /* swiftApi.swift in Sources */, |
| 844 | E6D8DF5227A942920006A3A9 /* FMDatabase.m in Sources */, | 758 | E6D8DF5227A942920006A3A9 /* FMDatabase.m in Sources */, |
| 845 | E6D8DF1227A942920006A3A9 /* WLPushManager.m in Sources */, | 759 | E6D8DF1227A942920006A3A9 /* WLPushManager.m in Sources */, |
| 846 | - 1E7086652811A93F00704CA8 /* CouponBarcodeView.swift in Sources */, | ||
| 847 | E6D8DEF827A942920006A3A9 /* WLNativeAdTableViewCell.m in Sources */, | 760 | E6D8DEF827A942920006A3A9 /* WLNativeAdTableViewCell.m in Sources */, |
| 848 | E6D8DE6D27A942010006A3A9 /* WarplySDKFrameworkIOS.docc in Sources */, | 761 | E6D8DE6D27A942010006A3A9 /* WarplySDKFrameworkIOS.docc in Sources */, |
| 849 | E6D8DF4427A942920006A3A9 /* AFURLResponseSerialization.m in Sources */, | 762 | E6D8DF4427A942920006A3A9 /* AFURLResponseSerialization.m in Sources */, |
| ... | @@ -856,7 +769,6 @@ | ... | @@ -856,7 +769,6 @@ |
| 856 | E6D8DEEE27A942920006A3A9 /* WarplyReactMethods.m in Sources */, | 769 | E6D8DEEE27A942920006A3A9 /* WarplyReactMethods.m in Sources */, |
| 857 | E6D8DEF927A942920006A3A9 /* WLNativeAdCollectionViewCell.m in Sources */, | 770 | E6D8DEF927A942920006A3A9 /* WLNativeAdCollectionViewCell.m in Sources */, |
| 858 | E634A36B2822999B0069DE27 /* CouponsViewController.swift in Sources */, | 771 | E634A36B2822999B0069DE27 /* CouponsViewController.swift in Sources */, |
| 859 | - 1E7536732822B72500149CC9 /* DetailsViewInterface.swift in Sources */, | ||
| 860 | E6D8DF4E27A942920006A3A9 /* FMDatabaseQueue.m in Sources */, | 772 | E6D8DF4E27A942920006A3A9 /* FMDatabaseQueue.m in Sources */, |
| 861 | E6D8DF0827A942920006A3A9 /* WLBaseItem.m in Sources */, | 773 | E6D8DF0827A942920006A3A9 /* WLBaseItem.m in Sources */, |
| 862 | E6D8DF0727A942920006A3A9 /* WLInboxItemViewController.m in Sources */, | 774 | E6D8DF0727A942920006A3A9 /* WLInboxItemViewController.m in Sources */, |
| ... | @@ -989,6 +901,7 @@ | ... | @@ -989,6 +901,7 @@ |
| 989 | baseConfigurationReference = F2447FDBC0B149DFB9DC6E40 /* Pods-WarplySDKFrameworkIOS.debug.xcconfig */; | 901 | baseConfigurationReference = F2447FDBC0B149DFB9DC6E40 /* Pods-WarplySDKFrameworkIOS.debug.xcconfig */; |
| 990 | buildSettings = { | 902 | buildSettings = { |
| 991 | ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES; | 903 | ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES; |
| 904 | + APPLICATION_EXTENSION_API_ONLY = NO; | ||
| 992 | CLANG_ENABLE_MODULES = YES; | 905 | CLANG_ENABLE_MODULES = YES; |
| 993 | CODE_SIGN_STYLE = Automatic; | 906 | CODE_SIGN_STYLE = Automatic; |
| 994 | CURRENT_PROJECT_VERSION = 1; | 907 | CURRENT_PROJECT_VERSION = 1; |
| ... | @@ -1025,6 +938,7 @@ | ... | @@ -1025,6 +938,7 @@ |
| 1025 | baseConfigurationReference = B9413513157AD76ECE896B81 /* Pods-WarplySDKFrameworkIOS.release.xcconfig */; | 938 | baseConfigurationReference = B9413513157AD76ECE896B81 /* Pods-WarplySDKFrameworkIOS.release.xcconfig */; |
| 1026 | buildSettings = { | 939 | buildSettings = { |
| 1027 | ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES; | 940 | ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES; |
| 941 | + APPLICATION_EXTENSION_API_ONLY = NO; | ||
| 1028 | CLANG_ENABLE_MODULES = YES; | 942 | CLANG_ENABLE_MODULES = YES; |
| 1029 | CODE_SIGN_STYLE = Automatic; | 943 | CODE_SIGN_STYLE = Automatic; |
| 1030 | CURRENT_PROJECT_VERSION = 1; | 944 | CURRENT_PROJECT_VERSION = 1; | ... | ... |
No preview for this file type
| 1 | -// | ||
| 2 | -// AllGiftsView.swift | ||
| 3 | -// WarplySDKFrameworkIOS | ||
| 4 | -// | ||
| 5 | -// Created by Manos Chorianopoulos on 27/4/22. | ||
| 6 | -// | ||
| 7 | - | ||
| 8 | - | ||
| 9 | -#if canImport(SwiftUI) | ||
| 10 | -import SwiftUI | ||
| 11 | -import Combine | ||
| 12 | -import Foundation | ||
| 13 | -import UIKit | ||
| 14 | - | ||
| 15 | - | ||
| 16 | -extension AllGiftsView { | ||
| 17 | - struct headerView: View { | ||
| 18 | - var goBack: () -> () | ||
| 19 | - | ||
| 20 | - var uiscreen = UIScreen.main.bounds | ||
| 21 | - | ||
| 22 | - var body: some View { | ||
| 23 | - HStack(alignment: .center) { | ||
| 24 | - Button { | ||
| 25 | - // Button Action | ||
| 26 | - print("Back Button tapped!") | ||
| 27 | - goBack() | ||
| 28 | - } label: { | ||
| 29 | - Image("ic_back", bundle: Bundle(for: MyEmptyClass.self)) | ||
| 30 | - .resizable() | ||
| 31 | - .aspectRatio(contentMode: .fit) | ||
| 32 | - .frame(width: self.uiscreen.height * 0.025, height: self.uiscreen.height * 0.02) | ||
| 33 | - } | ||
| 34 | - Spacer().frame(width: 0) | ||
| 35 | - Text("Όλα τα δώρα μου") | ||
| 36 | - .fontWeight(.medium) | ||
| 37 | - .font(.system(size: 16)) | ||
| 38 | - .foregroundColor(Color(red: 0.20784313725490197, green: 0.3176470588235294, blue: 0.40784313725490196)) | ||
| 39 | - .multilineTextAlignment(.center) | ||
| 40 | - .frame(maxWidth: .infinity) | ||
| 41 | - .padding(.horizontal) | ||
| 42 | - .offset(x: -self.uiscreen.height * 0.0125) | ||
| 43 | - } | ||
| 44 | - .frame(maxWidth: .infinity) | ||
| 45 | - .padding(.horizontal) | ||
| 46 | - .padding(.vertical, 10) | ||
| 47 | - } | ||
| 48 | - } | ||
| 49 | - | ||
| 50 | - struct ImageView: View { | ||
| 51 | - @ObservedObject var imageLoader:UrlImageModel | ||
| 52 | - @State var width:CGFloat | ||
| 53 | - @State var isFill:Bool | ||
| 54 | - | ||
| 55 | - var uiscreen = UIScreen.main.bounds | ||
| 56 | - | ||
| 57 | - init(withURL url:String , width:CGFloat, isFill:Bool) { | ||
| 58 | - imageLoader = UrlImageModel(urlString:url) | ||
| 59 | - self.width = width | ||
| 60 | - self.isFill = isFill | ||
| 61 | - } | ||
| 62 | - | ||
| 63 | - var body: some View { | ||
| 64 | - | ||
| 65 | - Image(uiImage: imageLoader.image ?? UIImage()) | ||
| 66 | - .resizable() | ||
| 67 | - .aspectRatio(contentMode: isFill ? .fill : .fit) | ||
| 68 | - .frame(width: self.width) | ||
| 69 | - .frame(maxHeight: .infinity) | ||
| 70 | - } | ||
| 71 | - } | ||
| 72 | - | ||
| 73 | - | ||
| 74 | - struct giftItemView: View { | ||
| 75 | - var item: swiftApi.CouponItemModel | ||
| 76 | - var parentView: UIView | ||
| 77 | - | ||
| 78 | - var uiscreen = UIScreen.main.bounds | ||
| 79 | - | ||
| 80 | - var body: some View { | ||
| 81 | - let couponSetData = item.couponset_data | ||
| 82 | - | ||
| 83 | - Button { | ||
| 84 | - // GiftItem Action | ||
| 85 | - let instanceOfMySwiftApi = swiftApi() | ||
| 86 | - let couponBarcodeViewController = instanceOfMySwiftApi.openCouponBarcode(parent: parentView, coupon: item) | ||
| 87 | - couponBarcodeViewController.view.tag = 7 | ||
| 88 | -// addChild(couponsViewController) | ||
| 89 | - couponBarcodeViewController.view.frame = parentView.frame | ||
| 90 | - parentView.addSubview(couponBarcodeViewController.view) | ||
| 91 | -// couponBarcodeViewController.didMove(toParent: UIHostingController(rootView: self)) | ||
| 92 | - } label: { | ||
| 93 | - HStack(alignment: .center, spacing: 0.0) { | ||
| 94 | - | ||
| 95 | - ImageView(withURL: couponSetData?.img_preview ?? "", width: self.uiscreen.width * 0.5, isFill: true) | ||
| 96 | - | ||
| 97 | - VStack(alignment: .leading, spacing: 5.0) { | ||
| 98 | - Text(couponSetData?.name ?? "") | ||
| 99 | - .fontWeight(.bold) | ||
| 100 | - .font(.system(size: 16)) | ||
| 101 | - .foregroundColor(Color(red: 0.2549019607843137, green: 0.3333333333333333, blue: 0.39215686274509803)) | ||
| 102 | - .multilineTextAlignment(.leading) | ||
| 103 | - .padding([.top,.horizontal], 15) | ||
| 104 | - .background(Color.white) | ||
| 105 | - | ||
| 106 | - Text(couponSetData?.short_description ?? "") | ||
| 107 | - .fontWeight(.regular) | ||
| 108 | - .font(.system(size: 16)) | ||
| 109 | - .foregroundColor(Color(red: 0.2549019607843137, green: 0.3333333333333333, blue: 0.39215686274509803)) | ||
| 110 | - .multilineTextAlignment(.leading) | ||
| 111 | - .padding([.bottom,.horizontal], 15) | ||
| 112 | - .background(Color.white) | ||
| 113 | - .frame(maxWidth: .infinity, maxHeight: .infinity) | ||
| 114 | - } | ||
| 115 | - .background(Color.white) | ||
| 116 | - .frame(maxWidth: .infinity, maxHeight: .infinity) | ||
| 117 | - } | ||
| 118 | - .background(Color.white) | ||
| 119 | - .frame(maxWidth: .infinity, maxHeight: .infinity) | ||
| 120 | - } | ||
| 121 | - .frame(width: self.uiscreen.width * 0.95, height: self.uiscreen.height * 0.17) | ||
| 122 | - .background(Color.white) | ||
| 123 | - .cornerRadius(5) | ||
| 124 | - .shadow(color: Color(red: 0, green: 0, blue: 0, opacity: 0.16), radius: 6, x: 0, y: 3) | ||
| 125 | - } | ||
| 126 | - } | ||
| 127 | - | ||
| 128 | - struct couponsContainer: View { | ||
| 129 | - @State var coupons:Array<swiftApi.CouponItemModel> = [] | ||
| 130 | - @State var parentView:UIView | ||
| 131 | - | ||
| 132 | - var uiscreen = UIScreen.main.bounds | ||
| 133 | - | ||
| 134 | - var body: some View { | ||
| 135 | - VStack(alignment: .center, spacing: self.uiscreen.height * 0.03) { | ||
| 136 | - | ||
| 137 | - ForEach(Array(coupons.enumerated()), id: \.offset) { index, item in | ||
| 138 | - | ||
| 139 | - giftItemView(item: item, parentView: parentView) | ||
| 140 | - } | ||
| 141 | - } | ||
| 142 | - .frame(maxWidth: .infinity) | ||
| 143 | - .padding(.top, self.uiscreen.height * 0.05) | ||
| 144 | - .padding(.bottom, self.uiscreen.height * 0.1) | ||
| 145 | - } | ||
| 146 | - } | ||
| 147 | - | ||
| 148 | -} | ||
| 149 | - | ||
| 150 | -@available(iOS 13.0.0, *) | ||
| 151 | -struct AllGiftsView: View { | ||
| 152 | - var parentView: UIView | ||
| 153 | - | ||
| 154 | - var coupons:Array<swiftApi.CouponItemModel> = [] | ||
| 155 | - | ||
| 156 | - var uiscreen = UIScreen.main.bounds | ||
| 157 | - | ||
| 158 | - init(parentView: UIView) { //initializer method | ||
| 159 | - | ||
| 160 | - let instanceOfMySwiftApi = swiftApi() | ||
| 161 | - let couponsData = instanceOfMySwiftApi.getCoupons() | ||
| 162 | - | ||
| 163 | - self.coupons = couponsData | ||
| 164 | - self.parentView = parentView | ||
| 165 | - } | ||
| 166 | - | ||
| 167 | - func goBack(){ | ||
| 168 | - for subview in parentView.subviews { | ||
| 169 | - if(subview.tag == 8) { | ||
| 170 | - subview.removeFromSuperview() | ||
| 171 | - } | ||
| 172 | - } | ||
| 173 | - } | ||
| 174 | - | ||
| 175 | - var body: some View { | ||
| 176 | - VStack { | ||
| 177 | - headerView(goBack: goBack) | ||
| 178 | - | ||
| 179 | - VStack { | ||
| 180 | - ScrollView(showsIndicators: false) { | ||
| 181 | - VStack { | ||
| 182 | - | ||
| 183 | - if (coupons.count) > 0 { | ||
| 184 | - couponsContainer(coupons: coupons, parentView: parentView ) | ||
| 185 | - } | ||
| 186 | - | ||
| 187 | - } | ||
| 188 | - .frame(width:self.uiscreen.width) | ||
| 189 | - } | ||
| 190 | - .cornerRadius(30, corners: [.topLeft]) | ||
| 191 | - .frame(width:self.uiscreen.width) | ||
| 192 | - .frame(maxHeight: .infinity) | ||
| 193 | - } | ||
| 194 | - .frame(width:self.uiscreen.width) | ||
| 195 | - .frame(maxHeight: .infinity) | ||
| 196 | - .padding(.top, 5) | ||
| 197 | - .background( | ||
| 198 | - Image("coupons_scrollview", bundle: Bundle(for: MyEmptyClass.self)) | ||
| 199 | - .resizable() | ||
| 200 | - ) | ||
| 201 | - | ||
| 202 | - } | ||
| 203 | - .edgesIgnoringSafeArea([.bottom]) | ||
| 204 | - .frame(width:self.uiscreen.width) | ||
| 205 | - .frame(maxHeight: .infinity) | ||
| 206 | - } | ||
| 207 | -} | ||
| 208 | -#endif | ||
| 209 | - | ||
| 210 | -//struct AllGiftsView_Previews: PreviewProvider { | ||
| 211 | -// static var previews: some View { | ||
| 212 | -// AllGiftsView() | ||
| 213 | -// } | ||
| 214 | -//} |
| 1 | -// | ||
| 2 | -// AllGiftsViewInterface.swift | ||
| 3 | -// WarplySDKFrameworkIOS | ||
| 4 | -// | ||
| 5 | -// Created by Manos Chorianopoulos on 27/4/22. | ||
| 6 | -// | ||
| 7 | - | ||
| 8 | -import Foundation | ||
| 9 | -import SwiftUI | ||
| 10 | - | ||
| 11 | -@available(iOS 13.0.0, *) | ||
| 12 | -@objc public class AllGiftsViewInterface : NSObject { | ||
| 13 | - | ||
| 14 | - @objc(allGiftsViewController:) static public func allGiftsViewController(parentView: UIView?) -> UIViewController { | ||
| 15 | - return UIHostingController(rootView: AllGiftsView(parentView: parentView!)) | ||
| 16 | - } | ||
| 17 | - | ||
| 18 | -} |
| 1 | -// | ||
| 2 | -// CampaignWebview.swift | ||
| 3 | -// WarplySDKFrameworkIOS | ||
| 4 | -// | ||
| 5 | -// Created by Manos Chorianopoulos on 20/4/22. | ||
| 6 | -// | ||
| 7 | - | ||
| 8 | - | ||
| 9 | -#if canImport(SwiftUI) | ||
| 10 | -import SwiftUI | ||
| 11 | -import Combine | ||
| 12 | -import Foundation | ||
| 13 | -import UIKit | ||
| 14 | -import WebKit | ||
| 15 | - | ||
| 16 | - | ||
| 17 | -extension CampaignWebview { | ||
| 18 | - struct headerView: View { | ||
| 19 | - var goBack: () -> () | ||
| 20 | - | ||
| 21 | - var uiscreen = UIScreen.main.bounds | ||
| 22 | - | ||
| 23 | - var body: some View { | ||
| 24 | - HStack(alignment: .center) { | ||
| 25 | - Button { | ||
| 26 | - // Button Action | ||
| 27 | - print("Back Button tapped!") | ||
| 28 | - goBack() | ||
| 29 | - } label: { | ||
| 30 | - Image("ic_back", bundle: Bundle(for: MyEmptyClass.self)) | ||
| 31 | - .resizable() | ||
| 32 | - .aspectRatio(contentMode: .fit) | ||
| 33 | - .frame(width: self.uiscreen.height * 0.025, height: self.uiscreen.height * 0.02) | ||
| 34 | - } | ||
| 35 | - Spacer().frame(width: 0) | ||
| 36 | - Text("") | ||
| 37 | - .fontWeight(.medium) | ||
| 38 | - .font(.system(size: 16)) | ||
| 39 | - .foregroundColor(Color(red: 0.20784313725490197, green: 0.3176470588235294, blue: 0.40784313725490196)) | ||
| 40 | - .multilineTextAlignment(.center) | ||
| 41 | - .frame(maxWidth: .infinity) | ||
| 42 | - .padding(.horizontal) | ||
| 43 | - .offset(x: -self.uiscreen.height * 0.0125) | ||
| 44 | - } | ||
| 45 | - .frame(maxWidth: .infinity) | ||
| 46 | - .padding(.horizontal) | ||
| 47 | - .padding(.vertical, 10) | ||
| 48 | - } | ||
| 49 | - } | ||
| 50 | - | ||
| 51 | - struct WebView: UIViewRepresentable { | ||
| 52 | - | ||
| 53 | - var url: String | ||
| 54 | - | ||
| 55 | - func makeUIView(context: Context) -> WKWebView { | ||
| 56 | - return WKWebView() | ||
| 57 | - } | ||
| 58 | - | ||
| 59 | - func updateUIView(_ webView: WKWebView, context: Context) { | ||
| 60 | - var request = URLRequest(url: URL(string: url)!) | ||
| 61 | - request.cachePolicy = .reloadRevalidatingCacheData | ||
| 62 | - webView.load(request) | ||
| 63 | - } | ||
| 64 | - } | ||
| 65 | - | ||
| 66 | -} | ||
| 67 | - | ||
| 68 | -@available(iOS 13.0.0, *) | ||
| 69 | -struct CampaignWebview: View { | ||
| 70 | - var parentView: UIView | ||
| 71 | - var campaign: String | ||
| 72 | - | ||
| 73 | - var uiscreen = UIScreen.main.bounds | ||
| 74 | - | ||
| 75 | - func goBack(){ | ||
| 76 | - for subview in parentView.subviews { | ||
| 77 | - if(subview.tag == 6) { | ||
| 78 | - subview.removeFromSuperview() | ||
| 79 | - } | ||
| 80 | - } | ||
| 81 | - } | ||
| 82 | - | ||
| 83 | - var body: some View { | ||
| 84 | - VStack { | ||
| 85 | - headerView(goBack: goBack) | ||
| 86 | - | ||
| 87 | - VStack { | ||
| 88 | - WebView(url: campaign) | ||
| 89 | - } | ||
| 90 | - .background( | ||
| 91 | - 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: .top, endPoint: .bottom) | ||
| 92 | - ) | ||
| 93 | - .cornerRadius(30, corners: [.topLeft]) | ||
| 94 | - .frame(width:self.uiscreen.width) | ||
| 95 | - .frame(maxHeight: .infinity) | ||
| 96 | - } | ||
| 97 | - .edgesIgnoringSafeArea([.bottom]) | ||
| 98 | - .frame(width:self.uiscreen.width) | ||
| 99 | - .frame(maxHeight: .infinity) | ||
| 100 | - } | ||
| 101 | -} | ||
| 102 | -#endif | ||
| 103 | - | ||
| 104 | -//@available(iOS 13.0.0, *) | ||
| 105 | -//struct CampaignWebview_Previews: PreviewProvider { | ||
| 106 | -// static var previews: some View { | ||
| 107 | -// | ||
| 108 | -// CampaignWebview() | ||
| 109 | -// | ||
| 110 | -// } | ||
| 111 | -//} |
| 1 | -// | ||
| 2 | -// CampaignWebviewInterface.swift | ||
| 3 | -// WarplySDKFrameworkIOS | ||
| 4 | -// | ||
| 5 | -// Created by Manos Chorianopoulos on 20/4/22. | ||
| 6 | -// | ||
| 7 | - | ||
| 8 | -import Foundation | ||
| 9 | -import SwiftUI | ||
| 10 | - | ||
| 11 | -@available(iOS 13.0.0, *) | ||
| 12 | -@objc public class CampaignViewInterface : NSObject { | ||
| 13 | - | ||
| 14 | - @objc(campaignViewController::) static public func campaignViewController(parentView: UIView?, campaign: String?) -> UIViewController { | ||
| 15 | - return UIHostingController(rootView: CampaignWebview(parentView: parentView!, campaign: campaign ?? "")) | ||
| 16 | - } | ||
| 17 | - | ||
| 18 | -} |
| 1 | -// | ||
| 2 | -// CouponBarcodeView.swift | ||
| 3 | -// WarplySDKFrameworkIOS | ||
| 4 | -// | ||
| 5 | -// Created by Manos Chorianopoulos on 21/4/22. | ||
| 6 | -// | ||
| 7 | - | ||
| 8 | -#if canImport(SwiftUI) | ||
| 9 | -import SwiftUI | ||
| 10 | -import Combine | ||
| 11 | -import Foundation | ||
| 12 | -import UIKit | ||
| 13 | -// TODO: Uncomment for barcode | ||
| 14 | -import RSBarcodes_Swift | ||
| 15 | -import AVFoundation | ||
| 16 | - | ||
| 17 | - | ||
| 18 | - | ||
| 19 | -extension String { | ||
| 20 | - | ||
| 21 | - var length: Int { | ||
| 22 | - return count | ||
| 23 | - } | ||
| 24 | - | ||
| 25 | - subscript (i: Int) -> String { | ||
| 26 | - return self[i ..< i + 1] | ||
| 27 | - } | ||
| 28 | - | ||
| 29 | - func substring(fromIndex: Int) -> String { | ||
| 30 | - return self[min(fromIndex, length) ..< length] | ||
| 31 | - } | ||
| 32 | - | ||
| 33 | - func substring(toIndex: Int) -> String { | ||
| 34 | - return self[0 ..< max(0, toIndex)] | ||
| 35 | - } | ||
| 36 | - | ||
| 37 | - subscript (r: Range<Int>) -> String { | ||
| 38 | - let range = Range(uncheckedBounds: (lower: max(0, min(length, r.lowerBound)), | ||
| 39 | - upper: min(length, max(0, r.upperBound)))) | ||
| 40 | - let start = index(startIndex, offsetBy: range.lowerBound) | ||
| 41 | - let end = index(start, offsetBy: range.upperBound - range.lowerBound) | ||
| 42 | - return String(self[start ..< end]) | ||
| 43 | - } | ||
| 44 | -} | ||
| 45 | - | ||
| 46 | -extension CouponBarcodeView { | ||
| 47 | - struct headerView: View { | ||
| 48 | - var goBack: () -> () | ||
| 49 | - | ||
| 50 | - var uiscreen = UIScreen.main.bounds | ||
| 51 | - | ||
| 52 | - var body: some View { | ||
| 53 | - HStack(alignment: .center) { | ||
| 54 | - Button { | ||
| 55 | - // Button Action | ||
| 56 | - goBack() | ||
| 57 | - } label: { | ||
| 58 | - Image("ic_back", bundle: Bundle(for: MyEmptyClass.self)) | ||
| 59 | - .resizable() | ||
| 60 | - .aspectRatio(contentMode: .fit) | ||
| 61 | - .frame(width: self.uiscreen.height * 0.025, height: self.uiscreen.height * 0.02) | ||
| 62 | - } | ||
| 63 | - Spacer().frame(width: 0) | ||
| 64 | - Text("Εκπτωτικό κουπόνι") | ||
| 65 | - .fontWeight(.medium) | ||
| 66 | - .font(.system(size: 16)) | ||
| 67 | - .foregroundColor(Color(red: 0.20784313725490197, green: 0.3176470588235294, blue: 0.40784313725490196)) | ||
| 68 | - .multilineTextAlignment(.center) | ||
| 69 | - .frame(maxWidth: .infinity) | ||
| 70 | - .padding(.horizontal) | ||
| 71 | - .offset(x: -self.uiscreen.height * 0.0125) | ||
| 72 | - } | ||
| 73 | - .frame(maxWidth: .infinity) | ||
| 74 | - .padding(.horizontal) | ||
| 75 | - .padding(.vertical, 10) | ||
| 76 | - } | ||
| 77 | - } | ||
| 78 | - | ||
| 79 | - struct couponContainer: View { | ||
| 80 | - @State var coupon: swiftApi.CouponItemModel | ||
| 81 | -// @State var couponset:CouponSetItemModel | ||
| 82 | - | ||
| 83 | - var uiscreen = UIScreen.main.bounds | ||
| 84 | - | ||
| 85 | - | ||
| 86 | - static func convertDateFormat(inputDate: String) -> String { | ||
| 87 | - let dateFormatter = DateFormatter() | ||
| 88 | - dateFormatter.dateFormat = "yyyy-MM-dd hh:mm:ss" | ||
| 89 | - if let date = dateFormatter.date(from: inputDate) { | ||
| 90 | - dateFormatter.dateFormat = "dd/MM/yyyy" | ||
| 91 | - let resultString = dateFormatter.string(from: date) | ||
| 92 | - return resultString | ||
| 93 | - } else { | ||
| 94 | - return "" | ||
| 95 | - } | ||
| 96 | - } | ||
| 97 | - | ||
| 98 | - | ||
| 99 | - func constructBarcode() -> String? { | ||
| 100 | - // EAN 13 barcode construction | ||
| 101 | - let couponData = coupon.couponset_data | ||
| 102 | - let couponString = coupon.coupon ?? "" | ||
| 103 | - | ||
| 104 | - if (!couponString.isEmpty) { | ||
| 105 | - var checkDigit = 0; | ||
| 106 | - var result = 0; | ||
| 107 | - | ||
| 108 | - var fixedCouponCode = couponString; | ||
| 109 | - if (fixedCouponCode.count < 12) { | ||
| 110 | - let loops = 12 - fixedCouponCode.count; | ||
| 111 | - var zerosStr = ""; | ||
| 112 | - for i in 0 ..< loops { | ||
| 113 | - zerosStr += "0" | ||
| 114 | - } | ||
| 115 | - fixedCouponCode = zerosStr + fixedCouponCode; | ||
| 116 | - } | ||
| 117 | - | ||
| 118 | - var multiplier = 3; | ||
| 119 | - for idx in (0 ... (fixedCouponCode.count - 1)).reversed() { | ||
| 120 | - let curChar = fixedCouponCode[idx]; | ||
| 121 | - result += (Int(curChar) ?? 0) * multiplier; | ||
| 122 | - multiplier = multiplier == 3 ? 1 : 3; | ||
| 123 | - } | ||
| 124 | - checkDigit = 10 - (result % 10); | ||
| 125 | - | ||
| 126 | - let barcodeStr = fixedCouponCode + String(checkDigit); | ||
| 127 | - return barcodeStr; | ||
| 128 | - } | ||
| 129 | - | ||
| 130 | - return "" | ||
| 131 | - } | ||
| 132 | - | ||
| 133 | - | ||
| 134 | - var body: some View { | ||
| 135 | - let couponData = coupon.couponset_data | ||
| 136 | - let barcodeString = constructBarcode() ?? "" | ||
| 137 | - | ||
| 138 | - GeometryReader { geometry in | ||
| 139 | - ScrollView(showsIndicators: false) { | ||
| 140 | - VStack(alignment: .leading) { | ||
| 141 | - | ||
| 142 | - ImageView(withURL: couponData?.img_preview ?? "") | ||
| 143 | - | ||
| 144 | - VStack(alignment: .leading) { | ||
| 145 | - Text(coupon.name!) | ||
| 146 | - .fontWeight(.bold) | ||
| 147 | - .font(.system(size: 16)) | ||
| 148 | - .foregroundColor(Color(red: 0.2549019607843137, green: 0.3333333333333333, blue: 0.39215686274509803)) | ||
| 149 | - .multilineTextAlignment(.leading) | ||
| 150 | - .padding(.horizontal) | ||
| 151 | - .padding(.top, self.uiscreen.height * 0.04) | ||
| 152 | - .frame(maxHeight: .infinity) | ||
| 153 | - | ||
| 154 | - Text(couponData?.short_description! ?? "") | ||
| 155 | - .fontWeight(.regular) | ||
| 156 | - .font(.system(size: 14)) | ||
| 157 | - .foregroundColor(Color(red: 0.2549019607843137, green: 0.3333333333333333, blue: 0.39215686274509803)) | ||
| 158 | - .multilineTextAlignment(.leading) | ||
| 159 | - .padding(.horizontal) | ||
| 160 | - .padding(.top, self.uiscreen.height * 0.02) | ||
| 161 | - | ||
| 162 | - Text("Κωδικός Κουπονιού") | ||
| 163 | - .fontWeight(.medium) | ||
| 164 | - .font(.system(size: 16)) | ||
| 165 | - .foregroundColor(Color(red: 0.2549019607843137, green: 0.3333333333333333, blue: 0.39215686274509803)) | ||
| 166 | - .multilineTextAlignment(.center) | ||
| 167 | - .padding(.top, self.uiscreen.height * 0.05) | ||
| 168 | - .padding(.horizontal) | ||
| 169 | - .frame(maxWidth: .infinity) | ||
| 170 | - | ||
| 171 | - VStack(alignment: .center) { | ||
| 172 | - VStack { | ||
| 173 | - Text(coupon.coupon!) | ||
| 174 | - .fontWeight(.bold) | ||
| 175 | - .font(.system(size: 27)) | ||
| 176 | - .foregroundColor(Color(red: 0.2549019607843137, green: 0.3333333333333333, blue: 0.39215686274509803)) | ||
| 177 | - .multilineTextAlignment(.center) | ||
| 178 | - .padding(.horizontal) | ||
| 179 | - .padding(.vertical, 10) | ||
| 180 | -// .padding(.all) | ||
| 181 | - } | ||
| 182 | - .frame(width: self.uiscreen.width * 0.8) | ||
| 183 | - .background(Color(red: 0.9333333333333333, green: 0.9686274509803922, blue: 1.0)) | ||
| 184 | - .cornerRadius(10) | ||
| 185 | - } | ||
| 186 | - .frame(maxWidth: .infinity) | ||
| 187 | - | ||
| 188 | - if (CharacterSet.decimalDigits.isSuperset(of: CharacterSet(charactersIn: coupon.coupon ?? ""))) { | ||
| 189 | - VStack(alignment: .center) { | ||
| 190 | - VStack {} | ||
| 191 | - .frame(height: 1) | ||
| 192 | - .frame(width: self.uiscreen.width * 0.9) | ||
| 193 | - .background(Color(red: 0.9019607843137255, green: 0.9019607843137255, blue: 0.9019607843137255)) | ||
| 194 | - } | ||
| 195 | - .frame(maxWidth: .infinity) | ||
| 196 | - .padding(.top, self.uiscreen.height * 0.015) | ||
| 197 | - | ||
| 198 | -// let isValid = RSUnifiedCodeValidator.shared.isValid(barcodeString, machineReadableCodeObjectType: AVMetadataObject.ObjectType.ean13.rawValue) | ||
| 199 | - | ||
| 200 | - // TODO: Uncomment for barcode | ||
| 201 | - if let barcodeImage = RSUnifiedCodeGenerator.shared.generateCode(barcodeString, machineReadableCodeObjectType: AVMetadataObject.ObjectType.ean13.rawValue, targetSize: CGSize(width: self.uiscreen.width * 0.8, height: self.uiscreen.height * 0.1)) { | ||
| 202 | - | ||
| 203 | -// | ||
| 204 | - VStack(alignment: .center) { | ||
| 205 | - Image(uiImage: barcodeImage) | ||
| 206 | - .resizable() | ||
| 207 | - .aspectRatio(contentMode: .fit) | ||
| 208 | - .frame(width: self.uiscreen.width * 0.8, height: self.uiscreen.height * 0.1) | ||
| 209 | - } | ||
| 210 | - .frame(maxWidth: .infinity) | ||
| 211 | - .padding(.top, self.uiscreen.height * 0.01) | ||
| 212 | - } | ||
| 213 | - | ||
| 214 | - | ||
| 215 | - Text(barcodeString) | ||
| 216 | - .fontWeight(.regular) | ||
| 217 | - .font(.system(size: 22)) | ||
| 218 | - .foregroundColor(Color(red: 0.2549019607843137, green: 0.3333333333333333, blue: 0.39215686274509803)) | ||
| 219 | - .multilineTextAlignment(.center) | ||
| 220 | - .padding(.vertical, self.uiscreen.height * 0.01) | ||
| 221 | - .padding(.horizontal) | ||
| 222 | - .frame(maxWidth: .infinity) | ||
| 223 | - | ||
| 224 | - | ||
| 225 | - VStack(alignment: .center) { | ||
| 226 | - VStack {} | ||
| 227 | - .frame(height: 1) | ||
| 228 | - .frame(width: self.uiscreen.width * 0.9) | ||
| 229 | - .background(Color(red: 0.9019607843137255, green: 0.9019607843137255, blue: 0.9019607843137255)) | ||
| 230 | - } | ||
| 231 | - .frame(maxWidth: .infinity) | ||
| 232 | - } | ||
| 233 | - | ||
| 234 | - | ||
| 235 | - | ||
| 236 | - Text("Το κουπόνι ισχύει έως " + CouponBarcodeView.couponContainer.convertDateFormat(inputDate: couponData?.expiration ?? "")) | ||
| 237 | - .fontWeight(.medium) | ||
| 238 | - .font(.system(size: 14)) | ||
| 239 | - .foregroundColor(Color(red: 0.2549019607843137, green: 0.3333333333333333, blue: 0.39215686274509803)) | ||
| 240 | - .multilineTextAlignment(.center) | ||
| 241 | - .padding(.top, self.uiscreen.height * 0.03) | ||
| 242 | - .padding(.horizontal) | ||
| 243 | - .frame(maxWidth: .infinity) | ||
| 244 | - } | ||
| 245 | - .frame(width:self.uiscreen.width) | ||
| 246 | - | ||
| 247 | - | ||
| 248 | - | ||
| 249 | - Spacer() | ||
| 250 | - | ||
| 251 | - VStack(alignment: .center) { | ||
| 252 | - Button { | ||
| 253 | - // Button Action | ||
| 254 | - print("Send Gift Button tapped!") | ||
| 255 | - } label: { | ||
| 256 | - HStack { | ||
| 257 | - Text("Κάντο δώρο!") | ||
| 258 | - .fontWeight(.medium) | ||
| 259 | - .font(.system(size: 16)) | ||
| 260 | - .foregroundColor(Color(red: 0.3137254901960784, green: 0.6196078431372549, blue: 0.1843137254901961)) | ||
| 261 | - .multilineTextAlignment(.center) | ||
| 262 | - .padding(.all) | ||
| 263 | - | ||
| 264 | - // TODO: Add gift icon | ||
| 265 | - } | ||
| 266 | - .frame(maxWidth: .infinity) | ||
| 267 | - } | ||
| 268 | - .frame(width: self.uiscreen.width * 0.8) | ||
| 269 | - .background(Color(red: 0.9019607843137255, green: 0.9019607843137255, blue: 0.9019607843137255)) | ||
| 270 | - .cornerRadius(7) | ||
| 271 | - } | ||
| 272 | - .frame(maxWidth: .infinity) | ||
| 273 | - .padding(.top, self.uiscreen.height * 0.05) | ||
| 274 | - | ||
| 275 | -// VStack(alignment: .center) { | ||
| 276 | -// Button { | ||
| 277 | -// // Button Action | ||
| 278 | -// print("Shops Map Button tapped!") | ||
| 279 | -// } label: { | ||
| 280 | -// HStack { | ||
| 281 | -// Text("Χάρτης Καταστημάτων") | ||
| 282 | -// .fontWeight(.medium) | ||
| 283 | -// .font(.system(size: 16)) | ||
| 284 | -// .foregroundColor(Color.white) | ||
| 285 | -// .multilineTextAlignment(.center) | ||
| 286 | -// .padding(.all) | ||
| 287 | -// } | ||
| 288 | -// .frame(maxWidth: .infinity) | ||
| 289 | -// } | ||
| 290 | -// .frame(width: self.uiscreen.width * 0.8) | ||
| 291 | -// .background(Color(red: 0.4745098039215686, green: 0.7490196078431373, blue: 0.0784313725490196)) | ||
| 292 | -// .cornerRadius(7) | ||
| 293 | -// } | ||
| 294 | -// .frame(maxWidth: .infinity) | ||
| 295 | -// .padding(.top, self.uiscreen.height * 0.015) | ||
| 296 | - | ||
| 297 | - Button { | ||
| 298 | - // Button Action | ||
| 299 | - print("Terms Button tapped!") | ||
| 300 | - } label: { | ||
| 301 | - Text("Όροι χρήσης") | ||
| 302 | - .fontWeight(.medium) | ||
| 303 | - .font(.system(size: 14)) | ||
| 304 | - .foregroundColor(Color(red: 0.2549019607843137, green: 0.3333333333333333, blue: 0.39215686274509803)) | ||
| 305 | - .underline() | ||
| 306 | - .multilineTextAlignment(.center) | ||
| 307 | - .padding(.top, self.uiscreen.height * 0.025) | ||
| 308 | - .padding(.bottom, self.uiscreen.height * 0.03) | ||
| 309 | - .padding(.horizontal) | ||
| 310 | - .frame(maxWidth: .infinity) | ||
| 311 | - } | ||
| 312 | - .frame(maxWidth: .infinity) | ||
| 313 | - | ||
| 314 | - | ||
| 315 | - } | ||
| 316 | - .frame(width:self.uiscreen.width) | ||
| 317 | -// .frame(minHeight: geometry.size.height) | ||
| 318 | - .padding(.bottom, self.uiscreen.height * 0.03) | ||
| 319 | - } | ||
| 320 | - .frame(width:self.uiscreen.width) | ||
| 321 | - .frame(maxHeight: .infinity) | ||
| 322 | - } | ||
| 323 | - .frame(width:self.uiscreen.width) | ||
| 324 | - .frame(maxHeight: .infinity) | ||
| 325 | - } | ||
| 326 | - } | ||
| 327 | - | ||
| 328 | - struct ImageView: View { | ||
| 329 | - @ObservedObject var imageLoader:UrlImageModel | ||
| 330 | - | ||
| 331 | - var uiscreen = UIScreen.main.bounds | ||
| 332 | - | ||
| 333 | - init(withURL url:String) { | ||
| 334 | - imageLoader = UrlImageModel(urlString:url) | ||
| 335 | - } | ||
| 336 | - | ||
| 337 | - var body: some View { | ||
| 338 | - | ||
| 339 | - Image(uiImage: imageLoader.image ?? UIImage()) | ||
| 340 | - .resizable() | ||
| 341 | - .aspectRatio(contentMode: .fill) | ||
| 342 | - .frame(width: self.uiscreen.width, height: self.uiscreen.height * 0.25) | ||
| 343 | - } | ||
| 344 | - } | ||
| 345 | - | ||
| 346 | -} | ||
| 347 | - | ||
| 348 | -@available(iOS 13.0.0, *) | ||
| 349 | -struct CouponBarcodeView: View { | ||
| 350 | - var parentView: UIView | ||
| 351 | - var coupon: swiftApi.CouponItemModel | ||
| 352 | - @State var couponset: swiftApi.CouponSetItemModel? | ||
| 353 | - | ||
| 354 | - var uiscreen = UIScreen.main.bounds | ||
| 355 | - | ||
| 356 | - func goBack() { | ||
| 357 | - for subview in parentView.subviews { | ||
| 358 | - if(subview.tag == 7) { | ||
| 359 | - subview.removeFromSuperview() | ||
| 360 | - } | ||
| 361 | - } | ||
| 362 | - } | ||
| 363 | - | ||
| 364 | - | ||
| 365 | - var body: some View { | ||
| 366 | - VStack { | ||
| 367 | - headerView(goBack: goBack) | ||
| 368 | - | ||
| 369 | - VStack { | ||
| 370 | - couponContainer(coupon: coupon) | ||
| 371 | - } | ||
| 372 | - .background(Color.white) | ||
| 373 | - .cornerRadius(30, corners: [.topLeft]) | ||
| 374 | - .frame(width:self.uiscreen.width) | ||
| 375 | - .frame(maxHeight: .infinity) | ||
| 376 | - } | ||
| 377 | - .edgesIgnoringSafeArea([.bottom]) | ||
| 378 | - .frame(width:self.uiscreen.width) | ||
| 379 | - .frame(maxHeight: .infinity) | ||
| 380 | -// .onAppear { | ||
| 381 | -// // If you want to setup data with model | ||
| 382 | -// couponset = CouponSetItemModel(dictionary: coupon) | ||
| 383 | -// | ||
| 384 | -// } | ||
| 385 | - } | ||
| 386 | -} | ||
| 387 | -#endif | ||
| 388 | - | ||
| 389 | -//struct CouponBarcodeView_Previews: PreviewProvider { | ||
| 390 | -// static var previews: some View { | ||
| 391 | -// CouponBarcodeView() | ||
| 392 | -// } | ||
| 393 | -//} |
| 1 | -// | ||
| 2 | -// CouponBarcodeViewInterface.swift | ||
| 3 | -// WarplySDKFrameworkIOS | ||
| 4 | -// | ||
| 5 | -// Created by Manos Chorianopoulos on 21/4/22. | ||
| 6 | -// | ||
| 7 | - | ||
| 8 | -import Foundation | ||
| 9 | -import SwiftUI | ||
| 10 | - | ||
| 11 | -@available(iOS 13.0.0, *) | ||
| 12 | -@objc public class CouponBarcodeViewInterface : NSObject { | ||
| 13 | - | ||
| 14 | -// @objc(couponBarcodeViewController::) static public func couponBarcodeViewController(parentView: UIView?, coupon: Dictionary<String, Any>) -> UIViewController { | ||
| 15 | -// return UIHostingController(rootView: CouponBarcodeView(parentView: parentView!, coupon: coupon)) | ||
| 16 | -// } | ||
| 17 | - | ||
| 18 | -} | ||
| 19 | - |
| 1 | -// | ||
| 2 | -// CouponView.swift | ||
| 3 | -// WarplySDKFrameworkIOS | ||
| 4 | -// | ||
| 5 | -// Created by Βασιλης Σκουρας on 21/4/22. | ||
| 6 | -// | ||
| 7 | - | ||
| 8 | - | ||
| 9 | -#if canImport(SwiftUI) | ||
| 10 | -import SwiftUI | ||
| 11 | -import Combine | ||
| 12 | -import Foundation | ||
| 13 | -import UIKit | ||
| 14 | - | ||
| 15 | - | ||
| 16 | - | ||
| 17 | -extension CouponView { | ||
| 18 | - struct headerView: View { | ||
| 19 | - var goBack: () -> () | ||
| 20 | - | ||
| 21 | - var uiscreen = UIScreen.main.bounds | ||
| 22 | - | ||
| 23 | - var body: some View { | ||
| 24 | - HStack(alignment: .center) { | ||
| 25 | - Button { | ||
| 26 | - // Button Action | ||
| 27 | - goBack() | ||
| 28 | - } label: { | ||
| 29 | - Image("ic_back", bundle: Bundle(for: MyEmptyClass.self)) | ||
| 30 | - .resizable() | ||
| 31 | - .aspectRatio(contentMode: .fit) | ||
| 32 | - .frame(width: self.uiscreen.height * 0.025, height: self.uiscreen.height * 0.02) | ||
| 33 | - } | ||
| 34 | - Spacer().frame(width: 0) | ||
| 35 | - Text("Εκπτωτικό κουπόνι") | ||
| 36 | - .fontWeight(.medium) | ||
| 37 | - .font(.system(size: 16)) | ||
| 38 | - .foregroundColor(Color(red: 0.20784313725490197, green: 0.3176470588235294, blue: 0.40784313725490196)) | ||
| 39 | - .multilineTextAlignment(.center) | ||
| 40 | - .frame(maxWidth: .infinity) | ||
| 41 | - .padding(.horizontal) | ||
| 42 | - .offset(x: -self.uiscreen.height * 0.0125) | ||
| 43 | - } | ||
| 44 | - .frame(maxWidth: .infinity) | ||
| 45 | - .padding(.horizontal) | ||
| 46 | - .padding(.vertical, 10) | ||
| 47 | - } | ||
| 48 | - } | ||
| 49 | - | ||
| 50 | - struct couponContainer: View { | ||
| 51 | - @State var coupon: swiftApi.CouponSetItemModel | ||
| 52 | -// @State var couponset:CouponSetItemModel | ||
| 53 | - | ||
| 54 | - var uiscreen = UIScreen.main.bounds | ||
| 55 | - | ||
| 56 | - var body: some View { | ||
| 57 | - GeometryReader { geometry in | ||
| 58 | - ScrollView(showsIndicators: false) { | ||
| 59 | - VStack(alignment: .leading) { | ||
| 60 | - | ||
| 61 | - ImageView(withURL: coupon.img_preview as? String ?? "") | ||
| 62 | - | ||
| 63 | - Text(coupon.name as? String ?? "") | ||
| 64 | - .fontWeight(.bold) | ||
| 65 | - .font(.system(size: 16)) | ||
| 66 | - .foregroundColor(Color(red: 0.2549019607843137, green: 0.3333333333333333, blue: 0.39215686274509803)) | ||
| 67 | - .multilineTextAlignment(.leading) | ||
| 68 | - .padding(.horizontal) | ||
| 69 | - .padding(.top, self.uiscreen.height * 0.04) | ||
| 70 | - | ||
| 71 | - Text(coupon.short_description as? String ?? "") | ||
| 72 | - .fontWeight(.regular) | ||
| 73 | - .font(.system(size: 14)) | ||
| 74 | - .foregroundColor(Color(red: 0.2549019607843137, green: 0.3333333333333333, blue: 0.39215686274509803)) | ||
| 75 | - .multilineTextAlignment(.leading) | ||
| 76 | - .padding(.horizontal) | ||
| 77 | - .padding(.top, self.uiscreen.height * 0.02) | ||
| 78 | - | ||
| 79 | - Spacer() | ||
| 80 | - | ||
| 81 | - VStack(alignment: .center) { | ||
| 82 | - Button { | ||
| 83 | - // Button Action | ||
| 84 | - print("Back Button tapped!") | ||
| 85 | - } label: { | ||
| 86 | - HStack { | ||
| 87 | - Text("Απόκτησέ το") | ||
| 88 | - .fontWeight(.medium) | ||
| 89 | - .font(.system(size: 16)) | ||
| 90 | - .foregroundColor(Color.white) | ||
| 91 | - .multilineTextAlignment(.center) | ||
| 92 | - .padding(.all) | ||
| 93 | - } | ||
| 94 | - } | ||
| 95 | - .frame(width: self.uiscreen.width * 0.8) | ||
| 96 | - .background(Color(red: 0.4745098039215686, green: 0.7490196078431373, blue: 0.0784313725490196)) | ||
| 97 | - .cornerRadius(7) | ||
| 98 | - } | ||
| 99 | - .frame(maxWidth: .infinity) | ||
| 100 | - .padding(.top, self.uiscreen.height * 0.06) | ||
| 101 | - | ||
| 102 | - Button { | ||
| 103 | - // Button Action | ||
| 104 | - print("Terms Button tapped!") | ||
| 105 | - } label: { | ||
| 106 | - Text("Όροι χρήσης") | ||
| 107 | - .fontWeight(.medium) | ||
| 108 | - .font(.system(size: 14)) | ||
| 109 | - .foregroundColor(Color(red: 0.2549019607843137, green: 0.3333333333333333, blue: 0.39215686274509803)) | ||
| 110 | - .underline() | ||
| 111 | - .multilineTextAlignment(.center) | ||
| 112 | - .padding(.vertical, self.uiscreen.height * 0.03) | ||
| 113 | - .padding(.horizontal) | ||
| 114 | - .frame(maxWidth: .infinity) | ||
| 115 | - } | ||
| 116 | - .frame(maxWidth: .infinity) | ||
| 117 | - | ||
| 118 | - | ||
| 119 | - } | ||
| 120 | - .frame(width:self.uiscreen.width) | ||
| 121 | - .frame(minHeight: geometry.size.height) | ||
| 122 | - .padding(.bottom, self.uiscreen.height * 0.03) | ||
| 123 | - } | ||
| 124 | - .frame(width:self.uiscreen.width) | ||
| 125 | - .frame(maxHeight: .infinity) | ||
| 126 | - } | ||
| 127 | - .frame(width:self.uiscreen.width) | ||
| 128 | - .frame(maxHeight: .infinity) | ||
| 129 | - } | ||
| 130 | - } | ||
| 131 | - | ||
| 132 | - struct ImageView: View { | ||
| 133 | - @ObservedObject var imageLoader:UrlImageModel | ||
| 134 | - | ||
| 135 | - var uiscreen = UIScreen.main.bounds | ||
| 136 | - | ||
| 137 | - init(withURL url:String) { | ||
| 138 | - imageLoader = UrlImageModel(urlString:url) | ||
| 139 | - } | ||
| 140 | - | ||
| 141 | - var body: some View { | ||
| 142 | - | ||
| 143 | - Image(uiImage: imageLoader.image ?? UIImage()) | ||
| 144 | - .resizable() | ||
| 145 | - .aspectRatio(contentMode: .fill) | ||
| 146 | - .frame(width: self.uiscreen.width, height: self.uiscreen.height * 0.25) | ||
| 147 | - } | ||
| 148 | - } | ||
| 149 | - | ||
| 150 | -} | ||
| 151 | - | ||
| 152 | -@available(iOS 13.0.0, *) | ||
| 153 | -struct CouponView: View { | ||
| 154 | - var parentView: UIView | ||
| 155 | - var coupon: swiftApi.CouponSetItemModel | ||
| 156 | - @State var couponset: swiftApi.CouponSetItemModel? | ||
| 157 | - | ||
| 158 | - var uiscreen = UIScreen.main.bounds | ||
| 159 | - | ||
| 160 | - func goBack() { | ||
| 161 | - for subview in parentView.subviews { | ||
| 162 | - if(subview.tag == 2) { | ||
| 163 | - subview.removeFromSuperview() | ||
| 164 | - } | ||
| 165 | - } | ||
| 166 | - } | ||
| 167 | - | ||
| 168 | - | ||
| 169 | - var body: some View { | ||
| 170 | - VStack { | ||
| 171 | - headerView(goBack: goBack) | ||
| 172 | - | ||
| 173 | - VStack { | ||
| 174 | - couponContainer(coupon: coupon) | ||
| 175 | - } | ||
| 176 | - .background(Color.white) | ||
| 177 | - .cornerRadius(30, corners: [.topLeft]) | ||
| 178 | - .frame(width:self.uiscreen.width) | ||
| 179 | - .frame(maxHeight: .infinity) | ||
| 180 | - } | ||
| 181 | - .edgesIgnoringSafeArea([.bottom]) | ||
| 182 | - .frame(width:self.uiscreen.width) | ||
| 183 | - .frame(maxHeight: .infinity) | ||
| 184 | -// .onAppear { | ||
| 185 | -// // If you want to setup data with model | ||
| 186 | -// couponset = CouponSetItemModel(dictionary: coupon) | ||
| 187 | -// | ||
| 188 | -// } | ||
| 189 | - } | ||
| 190 | -} | ||
| 191 | -#endif | ||
| 192 | - | ||
| 193 | -//struct CouponView_Previews: PreviewProvider { | ||
| 194 | -// static var previews: some View { | ||
| 195 | -// CouponView() | ||
| 196 | -// } | ||
| 197 | -//} |
| 1 | -// | ||
| 2 | -// CouponViewInterface.swift | ||
| 3 | -// WarplySDKFrameworkIOS | ||
| 4 | -// | ||
| 5 | -// Created by Βασιλης Σκουρας on 21/4/22. | ||
| 6 | -// | ||
| 7 | - | ||
| 8 | -import Foundation | ||
| 9 | -import SwiftUI | ||
| 10 | - | ||
| 11 | -@available(iOS 13.0.0, *) | ||
| 12 | -@objc public class CouponViewInterface : NSObject { | ||
| 13 | - | ||
| 14 | -// @objc(couponViewController::) static public func couponViewController(parentView: UIView?, coupon: Dictionary<String, Any>) -> UIViewController { | ||
| 15 | -// return UIHostingController(rootView: CouponView(parentView: parentView!, coupon: coupon)) | ||
| 16 | -// } | ||
| 17 | - | ||
| 18 | -} |
| 1 | -// | ||
| 2 | -// ProfileView.swift | ||
| 3 | -// warplyFramework | ||
| 4 | -// | ||
| 5 | -// Created by Βασιλης Σκουρας on 13/1/22. | ||
| 6 | -// | ||
| 7 | - | ||
| 8 | -#if canImport(SwiftUI) | ||
| 9 | -import SwiftUI | ||
| 10 | -import Combine | ||
| 11 | -import Foundation | ||
| 12 | -import UIKit | ||
| 13 | - | ||
| 14 | -class DataModel { | ||
| 15 | - var data: Array<NSDictionary> = [] | ||
| 16 | - var data2: Array<swiftApi.CouponItemModel> = [] | ||
| 17 | - | ||
| 18 | - init() { //initializer method | ||
| 19 | - | ||
| 20 | - let instanceOfMySwiftApi = swiftApi() | ||
| 21 | - let couponsData = instanceOfMySwiftApi.getCoupons() | ||
| 22 | - | ||
| 23 | - self.data2 = couponsData | ||
| 24 | - | ||
| 25 | - | ||
| 26 | - let instanceOfMyApi = MyApi() | ||
| 27 | - let couponSets = instanceOfMyApi.getCouponSets(withActive: true, andVisible: true, andUuids: nil) | ||
| 28 | - let coupons = instanceOfMyApi.getCoupons() as AnyObject? | ||
| 29 | - | ||
| 30 | - if let myCouponsSetsDictionary = couponSets as? [String : AnyObject] { | ||
| 31 | - let couponSetsData = (myCouponsSetsDictionary["MAPP_COUPON"] as! Array<NSMutableDictionary>) | ||
| 32 | - if let myCouponsDictionary = coupons as? [String : AnyObject] { | ||
| 33 | - let couponsData = (myCouponsDictionary["result"] as! Array<NSMutableDictionary>) | ||
| 34 | - if let sets = couponSetsData as? NSArray { | ||
| 35 | - for set in sets { | ||
| 36 | - let s = set as! NSDictionary | ||
| 37 | - if let cpns = couponsData as? NSArray { | ||
| 38 | - for coupon in cpns { | ||
| 39 | - var c = coupon as! NSDictionary | ||
| 40 | -// var temp = NSMutableDictionary(dictionary: s); | ||
| 41 | - if c["couponset_uuid"] as! String == s["uuid"] as! String { | ||
| 42 | - var temp = NSMutableDictionary(dictionary: s); | ||
| 43 | -// temp.addEntries(from: c as! [AnyHashable : Any]) | ||
| 44 | - | ||
| 45 | - temp.setValue(c as! [AnyHashable : Any],forKey: "coupon_data") | ||
| 46 | - | ||
| 47 | - self.data.append(temp as NSDictionary) | ||
| 48 | - } | ||
| 49 | - | ||
| 50 | - } | ||
| 51 | - } | ||
| 52 | - | ||
| 53 | - } | ||
| 54 | - } | ||
| 55 | - } | ||
| 56 | - } | ||
| 57 | - } | ||
| 58 | - | ||
| 59 | - var getData2: Array<swiftApi.CouponItemModel> { | ||
| 60 | - get { // getter | ||
| 61 | - return data2 | ||
| 62 | - } | ||
| 63 | - } | ||
| 64 | - | ||
| 65 | - var getData: Array<NSDictionary> { | ||
| 66 | - get { // getter | ||
| 67 | - return data.filter({ | ||
| 68 | - let couponData = $0["coupon_data"] as? [String: Any] ?? ["":""] | ||
| 69 | - return couponData["status"] as? Int == 1 | ||
| 70 | - }) | ||
| 71 | - } | ||
| 72 | - } | ||
| 73 | - | ||
| 74 | - var getOldCoupons: Array<NSDictionary> { | ||
| 75 | - get { // getter | ||
| 76 | - return data.filter({ | ||
| 77 | - let couponData = $0["coupon_data"] as? [String: Any] ?? ["":""] | ||
| 78 | - return couponData["status"] as? Int != 1 | ||
| 79 | - }) | ||
| 80 | - } | ||
| 81 | - } | ||
| 82 | -} | ||
| 83 | - | ||
| 84 | -class ImageLoader: ObservableObject { | ||
| 85 | - var didChange = PassthroughSubject<Data, Never>() | ||
| 86 | - var data = Data() { | ||
| 87 | - didSet { | ||
| 88 | - didChange.send(data) | ||
| 89 | - } | ||
| 90 | - } | ||
| 91 | - | ||
| 92 | - init(urlString:String) { | ||
| 93 | - guard let url = URL(string: urlString) else { return } | ||
| 94 | - let task = URLSession.shared.dataTask(with: url) { data, response, error in | ||
| 95 | - guard let data = data else { return } | ||
| 96 | - DispatchQueue.main.async { | ||
| 97 | - self.data = data | ||
| 98 | - } | ||
| 99 | - } | ||
| 100 | - task.resume() | ||
| 101 | - } | ||
| 102 | -} | ||
| 103 | - | ||
| 104 | -struct ImageView: View { | ||
| 105 | - @ObservedObject var imageLoader:ImageLoader | ||
| 106 | - @State var image:UIImage = UIImage() | ||
| 107 | - | ||
| 108 | - init(withURL url:String) { | ||
| 109 | - imageLoader = ImageLoader(urlString:url) | ||
| 110 | - } | ||
| 111 | - | ||
| 112 | - var body: some View { | ||
| 113 | - | ||
| 114 | - Image(uiImage: image) | ||
| 115 | - .resizable() | ||
| 116 | - .aspectRatio(contentMode: .fit) | ||
| 117 | - .onReceive(imageLoader.didChange) { data in | ||
| 118 | - self.image = UIImage(data: data) ?? UIImage() | ||
| 119 | - } | ||
| 120 | - } | ||
| 121 | -} | ||
| 122 | - | ||
| 123 | -struct VLine: Shape { | ||
| 124 | - func path(in rect: CGRect) -> Path { | ||
| 125 | - Path { path in | ||
| 126 | - path.move(to: CGPoint(x: rect.midX, y: rect.minY)) | ||
| 127 | - path.addLine(to: CGPoint(x: rect.midX, y: rect.maxY)) | ||
| 128 | - } | ||
| 129 | - } | ||
| 130 | -} | ||
| 131 | - | ||
| 132 | -extension CouponsView { | ||
| 133 | - struct headerView: View { | ||
| 134 | - var goBack: () -> () | ||
| 135 | - var uiscreen = UIScreen.main.bounds | ||
| 136 | - | ||
| 137 | - | ||
| 138 | - var body: some View { | ||
| 139 | - HStack(alignment: .center) { | ||
| 140 | - Button { | ||
| 141 | - // Button Action | ||
| 142 | - goBack() | ||
| 143 | - } label: { | ||
| 144 | - Image("ic_back", bundle: Bundle(for: MyEmptyClass.self)) | ||
| 145 | - .resizable() | ||
| 146 | - .aspectRatio(contentMode: .fit) | ||
| 147 | - .frame(width: self.uiscreen.height * 0.025, height: self.uiscreen.height * 0.02) | ||
| 148 | - } | ||
| 149 | - Spacer().frame(width: 0) | ||
| 150 | - Text("Όλα τα κουπόνια μου") | ||
| 151 | - .fontWeight(.medium) | ||
| 152 | - .font(.system(size: 16)) | ||
| 153 | - .foregroundColor(Color(red: 0.20784313725490197, green: 0.3176470588235294, blue: 0.40784313725490196)) | ||
| 154 | - .multilineTextAlignment(.center) | ||
| 155 | - .frame(maxWidth: .infinity) | ||
| 156 | - .padding(.horizontal) | ||
| 157 | - .offset(x: -self.uiscreen.height * 0.0125) | ||
| 158 | - } | ||
| 159 | - .frame(maxWidth: .infinity) | ||
| 160 | - .padding(.horizontal) | ||
| 161 | - .padding(.vertical, 10) | ||
| 162 | - } | ||
| 163 | - } | ||
| 164 | - | ||
| 165 | - struct couponView: View { | ||
| 166 | - var result: swiftApi.CouponItemModel | ||
| 167 | - var index: Int | ||
| 168 | - var parentView: UIView | ||
| 169 | - | ||
| 170 | - var uiscreen = UIScreen.main.bounds | ||
| 171 | - | ||
| 172 | - static func localizedWithParameter(parameter: String) -> LocalizedStringKey { | ||
| 173 | - return "\(parameter)" | ||
| 174 | - } | ||
| 175 | - | ||
| 176 | - static func convertDateFormat(inputDate: String) -> String { | ||
| 177 | - let dateFormatter = DateFormatter() | ||
| 178 | - dateFormatter.dateFormat = "yyyy-MM-dd hh:mm:ss" | ||
| 179 | - if let date = dateFormatter.date(from: inputDate) { | ||
| 180 | - dateFormatter.dateFormat = "dd/MM/yyyy" | ||
| 181 | - let resultString = dateFormatter.string(from: date) | ||
| 182 | - return resultString | ||
| 183 | - } else { | ||
| 184 | - return "" | ||
| 185 | - } | ||
| 186 | - } | ||
| 187 | - | ||
| 188 | - var body: some View { | ||
| 189 | -// let couponData = result["coupon_data"] as? [String: Any] ?? ["":""] | ||
| 190 | - let couponSetData = result.couponset_data | ||
| 191 | - | ||
| 192 | - | ||
| 193 | - VStack(alignment: .leading) { | ||
| 194 | - Button { | ||
| 195 | - // GiftItem Action | ||
| 196 | - let instanceOfMySwiftApi = swiftApi() | ||
| 197 | - let couponBarcodeViewController = instanceOfMySwiftApi.openCouponBarcode(parent: parentView, coupon: result) | ||
| 198 | - couponBarcodeViewController.view.tag = 7 | ||
| 199 | - // addChild(couponsViewController) | ||
| 200 | - couponBarcodeViewController.view.frame = parentView.frame | ||
| 201 | - parentView.addSubview(couponBarcodeViewController.view) | ||
| 202 | -// couponBarcodeViewController.didMove(toParent: UIHostingController(rootView: self)) | ||
| 203 | - } label: { | ||
| 204 | - HStack(alignment: .center) { | ||
| 205 | - ImageView(withURL: couponSetData?.img_preview ?? "") | ||
| 206 | - .frame(maxWidth: self.uiscreen.width * 0.15) | ||
| 207 | - .padding(.leading , self.uiscreen.width * 0.055) | ||
| 208 | - VLine() | ||
| 209 | - .stroke(style: StrokeStyle(lineWidth: 1, dash: [5])) | ||
| 210 | - .foregroundColor(Color(red: 0.4392156862745098, green: 0.4392156862745098, blue: 0.4392156862745098)) | ||
| 211 | - .frame(width: 1) | ||
| 212 | - .padding(.leading, self.uiscreen.width * 0.01) | ||
| 213 | - .padding(.top, self.uiscreen.height * 0.01) | ||
| 214 | - .padding(.bottom, self.uiscreen.height * 0.0075) | ||
| 215 | - Spacer() | ||
| 216 | - VStack { | ||
| 217 | - Text(CouponsView.couponView.localizedWithParameter(parameter: couponSetData?.name ?? "")) | ||
| 218 | - .fontWeight(.medium) | ||
| 219 | - .foregroundColor(Color(red: 0.22745098039215686, green: 0.3215686274509804, blue: 0.4)) | ||
| 220 | - .frame(maxWidth: self.uiscreen.width * 0.35, maxHeight: .infinity, alignment: .leading) | ||
| 221 | - .font(.system(size: 15)) | ||
| 222 | - Text(CouponsView.couponView.localizedWithParameter(parameter: result.discount ?? "")) | ||
| 223 | - .fontWeight(.bold) | ||
| 224 | - .foregroundColor(Color(red: 0.22745098039215686, green: 0.3215686274509804, blue: 0.4)) | ||
| 225 | - .frame(maxWidth: self.uiscreen.width * 0.35, maxHeight: self.uiscreen.height * 0.05, alignment: .leading) | ||
| 226 | - .font(.system(size: 47)) | ||
| 227 | - Text(CouponsView.couponView.localizedWithParameter(parameter: "Ισχύει εώς " + (result.expiration ?? ""))) | ||
| 228 | - .fontWeight(.medium) | ||
| 229 | - .foregroundColor(Color(red: 0.3803921568627451, green: 0.44313725490196076, blue: 0.5058823529411764)) | ||
| 230 | - .frame(maxWidth: self.uiscreen.width * 0.35, maxHeight: .infinity, alignment: .leading) | ||
| 231 | - .font(.system(size: 10)) | ||
| 232 | - } | ||
| 233 | - .frame(maxHeight: .infinity) | ||
| 234 | - .padding(.top, self.uiscreen.height * 0.03) | ||
| 235 | - .padding(.bottom, self.uiscreen.height * 0.03) | ||
| 236 | - VStack { | ||
| 237 | - Text(CouponsView.couponView.localizedWithParameter(parameter: couponSetData?.short_description ?? "")) | ||
| 238 | - .fontWeight(.medium) | ||
| 239 | - .foregroundColor(Color(red: 0.3803921568627451, green: 0.44313725490196076, blue: 0.5058823529411764)) | ||
| 240 | - .frame(maxWidth: self.uiscreen.width * 0.22, maxHeight: self.uiscreen.height * 0.10) | ||
| 241 | - .font(.system(size: 10)) | ||
| 242 | - } | ||
| 243 | - .frame(maxWidth: self.uiscreen.width * 0.25, maxHeight: .infinity) | ||
| 244 | - Spacer() | ||
| 245 | - } | ||
| 246 | - } | ||
| 247 | - } | ||
| 248 | - .frame(width: self.uiscreen.width * 0.95, height: self.uiscreen.height * 0.13) | ||
| 249 | - .background( | ||
| 250 | - Image("coupons_container", bundle: Bundle(for: MyEmptyClass.self)) | ||
| 251 | - .resizable() | ||
| 252 | - ) | ||
| 253 | - .padding(.bottom, self.uiscreen.height * 0.03) | ||
| 254 | - | ||
| 255 | - } | ||
| 256 | - } | ||
| 257 | - | ||
| 258 | -} | ||
| 259 | - | ||
| 260 | -@available(iOS 13.0.0, *) | ||
| 261 | -struct CouponsView: View { | ||
| 262 | - | ||
| 263 | - var data:Array<swiftApi.CouponItemModel> = [] | ||
| 264 | - | ||
| 265 | -// var data:Array<swiftApi.CouponItemModel> = DataModel().getData2 | ||
| 266 | - | ||
| 267 | - var parentView: UIView | ||
| 268 | - | ||
| 269 | - var uiscreen = UIScreen.main.bounds | ||
| 270 | - | ||
| 271 | - init(parentView: UIView) { //initializer method | ||
| 272 | - | ||
| 273 | - let instanceOfMySwiftApi = swiftApi() | ||
| 274 | - let couponsData = instanceOfMySwiftApi.getCoupons() | ||
| 275 | - | ||
| 276 | - self.data = couponsData | ||
| 277 | - self.parentView = parentView | ||
| 278 | - } | ||
| 279 | - | ||
| 280 | - func goBack(){ | ||
| 281 | - for subview in parentView.subviews { | ||
| 282 | - if(subview.tag == 1) { | ||
| 283 | - subview.removeFromSuperview() | ||
| 284 | - } | ||
| 285 | - } | ||
| 286 | - } | ||
| 287 | - | ||
| 288 | - var body: some View { | ||
| 289 | - VStack { | ||
| 290 | - headerView(goBack: goBack) | ||
| 291 | - ScrollView(showsIndicators: false) { | ||
| 292 | - VStack { | ||
| 293 | - if (data.count) > 0 { | ||
| 294 | - ForEach(Array(zip(data.indices, data)), id: \.0) { index, result in | ||
| 295 | - couponView(result: result, index: index, parentView: parentView) | ||
| 296 | - } | ||
| 297 | - } | ||
| 298 | - } | ||
| 299 | - .padding(.top, self.uiscreen.height * 0.05) | ||
| 300 | - } | ||
| 301 | - .frame(maxWidth: .infinity, maxHeight: .infinity ) | ||
| 302 | - .background( | ||
| 303 | - Image("coupons_scrollview", bundle: Bundle(for: MyEmptyClass.self)) | ||
| 304 | - .resizable() | ||
| 305 | - ) | ||
| 306 | - | ||
| 307 | - } | ||
| 308 | - .frame(maxWidth: .infinity, maxHeight: .infinity ) | ||
| 309 | -// .frame(width:self.uiscreen.width, height:self.uiscreen.height ) | ||
| 310 | - } | ||
| 311 | -} | ||
| 312 | -#endif | ||
| 313 | - | ||
| 314 | -@available(iOS 13.0.0, *) | ||
| 315 | -struct Previews_CouponsView_Previews: PreviewProvider { | ||
| 316 | - static var uiscreen = UIScreen.main.bounds | ||
| 317 | - static var previews: some View { | ||
| 318 | - ZStack { | ||
| 319 | - Image("ic_back", bundle: Bundle(for: MyEmptyClass.self)) | ||
| 320 | - .resizable() | ||
| 321 | - .frame(width: self.uiscreen.height * 0.025, height: self.uiscreen.height * 0.02) | ||
| 322 | - .offset(x: -self.uiscreen.width / 2 + self.uiscreen.width * 0.05, y: self.uiscreen.height * 0.07) | ||
| 323 | - Text("Όλα τα κουπόνια μου") | ||
| 324 | - .frame(width: self.uiscreen.width * 0.8, height: self.uiscreen.height * 0.025, alignment: .center) | ||
| 325 | - .offset( y: self.uiscreen.height * 0.07) | ||
| 326 | - } | ||
| 327 | - | ||
| 328 | - } | ||
| 329 | -} |
| 1 | -// | ||
| 2 | -// ProfileViewController.swift | ||
| 3 | -// warplyFramework | ||
| 4 | -// | ||
| 5 | -// Created by Βασιλης Σκουρας on 14/1/22. | ||
| 6 | -// | ||
| 7 | - | ||
| 8 | -import Foundation | ||
| 9 | -import SwiftUI | ||
| 10 | - | ||
| 11 | -@available(iOS 13.0.0, *) | ||
| 12 | -@objc public class CouponsViewInterface : NSObject { | ||
| 13 | - | ||
| 14 | - @objc(couponsViewController:) static public func couponsViewController(parentView: UIView?) -> UIViewController { | ||
| 15 | - return UIHostingController(rootView: CouponsView(parentView: parentView!)) | ||
| 16 | - } | ||
| 17 | - | ||
| 18 | -} |
| 1 | -// | ||
| 2 | -// DetailsView.swift | ||
| 3 | -// WarplySDKFrameworkIOS | ||
| 4 | -// | ||
| 5 | -// Created by Manos Chorianopoulos on 3/5/22. | ||
| 6 | -// | ||
| 7 | - | ||
| 8 | - | ||
| 9 | -#if canImport(SwiftUI) | ||
| 10 | -import SwiftUI | ||
| 11 | -import Combine | ||
| 12 | -import Foundation | ||
| 13 | -import UIKit | ||
| 14 | - | ||
| 15 | - | ||
| 16 | -extension DetailsView { | ||
| 17 | - struct headerView: View { | ||
| 18 | - var goBack: () -> () | ||
| 19 | - | ||
| 20 | - var uiscreen = UIScreen.main.bounds | ||
| 21 | - | ||
| 22 | - var body: some View { | ||
| 23 | - HStack(alignment: .center) { | ||
| 24 | - Button { | ||
| 25 | - // Button Action | ||
| 26 | - print("Back Button tapped!") | ||
| 27 | - goBack() | ||
| 28 | - } label: { | ||
| 29 | - Image("ic_back", bundle: Bundle(for: MyEmptyClass.self)) | ||
| 30 | - .resizable() | ||
| 31 | - .aspectRatio(contentMode: .fit) | ||
| 32 | - .frame(width: self.uiscreen.height * 0.025, height: self.uiscreen.height * 0.02) | ||
| 33 | - } | ||
| 34 | - | ||
| 35 | - Text("Ανάλυση") | ||
| 36 | - .fontWeight(.medium) | ||
| 37 | - .font(.system(size: 16)) | ||
| 38 | - .foregroundColor(Color(red: 0.20784313725490197, green: 0.3176470588235294, blue: 0.40784313725490196)) | ||
| 39 | - .multilineTextAlignment(.center) | ||
| 40 | - .frame(maxWidth: .infinity) | ||
| 41 | - .padding(.horizontal) | ||
| 42 | - .offset(x: -self.uiscreen.height * 0.025) | ||
| 43 | - } | ||
| 44 | - .frame(maxWidth: .infinity) | ||
| 45 | - .padding(.horizontal) | ||
| 46 | - .padding(.vertical, 10) | ||
| 47 | - } | ||
| 48 | - } | ||
| 49 | - | ||
| 50 | - struct Tabs: View { | ||
| 51 | - @Binding var tabs: [String] // The tab titles | ||
| 52 | - @Binding var selection: Int // Currently selected tab | ||
| 53 | - | ||
| 54 | - let uiscreen = UIScreen.main.bounds | ||
| 55 | - | ||
| 56 | - var body: some View { | ||
| 57 | - // Pack the tabs horizontally and allow them to be scrolled | ||
| 58 | -// GeometryReader { geometry in | ||
| 59 | -// ScrollView(.horizontal, showsIndicators: false) { | ||
| 60 | - HStack(alignment: .center, spacing: self.uiscreen.width * 0.05) { | ||
| 61 | - ForEach(tabs, id: \.self) { | ||
| 62 | - self.tab(title: $0) | ||
| 63 | - } | ||
| 64 | - } | ||
| 65 | - .padding(.horizontal, self.uiscreen.width * 0.1) | ||
| 66 | - .frame(maxWidth: .infinity) | ||
| 67 | - .padding(.vertical, 5) | ||
| 68 | -// .frame(minWidth: geometry.size.width) | ||
| 69 | -// } | ||
| 70 | -// .frame(maxWidth: .infinity) | ||
| 71 | -// } | ||
| 72 | -// .frame(maxWidth: .infinity) | ||
| 73 | -// } | ||
| 74 | - } | ||
| 75 | - | ||
| 76 | - private func tab(title: String) -> some View { | ||
| 77 | - let index = self.tabs.firstIndex(of: title)! | ||
| 78 | - let isSelected = index == selection | ||
| 79 | - | ||
| 80 | - return Button (action: { | ||
| 81 | - // // Allows for animated transitions of the underline, | ||
| 82 | - // // as well as other views on the same screen | ||
| 83 | - withAnimation { | ||
| 84 | - self.selection = index | ||
| 85 | - } | ||
| 86 | - }) { | ||
| 87 | - VStack(alignment: .center, spacing: 5.0) { | ||
| 88 | - Text(title) | ||
| 89 | - .font(.system(size: 16)) | ||
| 90 | - .fontWeight(.medium) | ||
| 91 | - .foregroundColor(isSelected ? Color(red: 0.1803921568627451, green: 0.6980392156862745, blue: 0.7254901960784313) : Color(red: 0.20784313725490197, green: 0.3176470588235294, blue: 0.40784313725490196)) | ||
| 92 | - .multilineTextAlignment(.center) | ||
| 93 | - .frame(maxWidth: .infinity) | ||
| 94 | - | ||
| 95 | - VStack {} | ||
| 96 | - .frame(height: 3) | ||
| 97 | - .frame(width: uiscreen.width * 0.2) | ||
| 98 | - .foregroundColor(.clear) | ||
| 99 | - .background(isSelected ? | ||
| 100 | - 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) | ||
| 101 | - : LinearGradient(gradient: Gradient(colors: [.clear, .clear]), startPoint: .leading, endPoint: .trailing) | ||
| 102 | - ) | ||
| 103 | - .cornerRadius(20) | ||
| 104 | - } | ||
| 105 | - .frame(maxWidth: .infinity) | ||
| 106 | - } | ||
| 107 | - .frame(maxWidth: .infinity) | ||
| 108 | - | ||
| 109 | - } | ||
| 110 | - } | ||
| 111 | - | ||
| 112 | - struct ImageView: View { | ||
| 113 | - @ObservedObject var imageLoader:UrlImageModel | ||
| 114 | - @State var width:CGFloat | ||
| 115 | - @State var isFill:Bool | ||
| 116 | - | ||
| 117 | - var uiscreen = UIScreen.main.bounds | ||
| 118 | - | ||
| 119 | - init(withURL url:String , width:CGFloat, isFill:Bool) { | ||
| 120 | - imageLoader = UrlImageModel(urlString:url) | ||
| 121 | - self.width = width | ||
| 122 | - self.isFill = isFill | ||
| 123 | - } | ||
| 124 | - | ||
| 125 | - var body: some View { | ||
| 126 | - | ||
| 127 | - Image(uiImage: imageLoader.image ?? UIImage()) | ||
| 128 | - .resizable() | ||
| 129 | - .aspectRatio(contentMode: isFill ? .fill : .fit) | ||
| 130 | - .frame(width: self.width) | ||
| 131 | - .frame(maxHeight: .infinity) | ||
| 132 | - } | ||
| 133 | - } | ||
| 134 | - | ||
| 135 | - | ||
| 136 | - | ||
| 137 | - struct DropdownOption: Hashable { | ||
| 138 | - let key: String | ||
| 139 | - let value: String | ||
| 140 | - | ||
| 141 | - public static func == (lhs: DropdownOption, rhs: DropdownOption) -> Bool { | ||
| 142 | - return lhs.key == rhs.key | ||
| 143 | - } | ||
| 144 | - } | ||
| 145 | - | ||
| 146 | - struct DropdownRow: View { | ||
| 147 | - var option: DropdownOption | ||
| 148 | - var onOptionSelected: ((_ option: DropdownOption) -> Void)? | ||
| 149 | - | ||
| 150 | - var body: some View { | ||
| 151 | - Button(action: { | ||
| 152 | - if let onOptionSelected = self.onOptionSelected { | ||
| 153 | - onOptionSelected(self.option) | ||
| 154 | - } | ||
| 155 | - }) { | ||
| 156 | - HStack { | ||
| 157 | - Text(self.option.value) | ||
| 158 | - .font(.system(size: 14)) | ||
| 159 | - .fontWeight(.regular) | ||
| 160 | - .foregroundColor(Color(red: 0.23529411764705882, green: 0.23137254901960785, blue: 0.2823529411764706)) | ||
| 161 | - Spacer() | ||
| 162 | - } | ||
| 163 | - } | ||
| 164 | - .padding(.horizontal, 16) | ||
| 165 | - .padding(.vertical, 5) | ||
| 166 | - } | ||
| 167 | - } | ||
| 168 | - | ||
| 169 | - struct Dropdown: View { | ||
| 170 | - var options: [DropdownOption] | ||
| 171 | - var onOptionSelected: ((_ option: DropdownOption) -> Void)? | ||
| 172 | - var backColor: Color | ||
| 173 | - | ||
| 174 | - var body: some View { | ||
| 175 | - ScrollView { | ||
| 176 | - VStack(alignment: .leading, spacing: 0) { | ||
| 177 | - ForEach(self.options, id: \.self) { option in | ||
| 178 | - DropdownRow(option: option, onOptionSelected: self.onOptionSelected) | ||
| 179 | - } | ||
| 180 | - } | ||
| 181 | - } | ||
| 182 | - .frame(minHeight: CGFloat(options.count) * 30, maxHeight: 250) | ||
| 183 | - .padding(.vertical, 5) | ||
| 184 | - .background(self.backColor) | ||
| 185 | - .cornerRadius(8) | ||
| 186 | - } | ||
| 187 | - } | ||
| 188 | - | ||
| 189 | - struct DropdownSelector: View { | ||
| 190 | - @State private var shouldShowDropdown = false | ||
| 191 | - @State private var selectedOption: DropdownOption? = nil | ||
| 192 | -// var placeholder: String | ||
| 193 | - var options: [DropdownOption] | ||
| 194 | - var onOptionSelected: ((_ option: DropdownOption) -> Void)? | ||
| 195 | - var backColor: Color | ||
| 196 | - private let buttonHeight: CGFloat = 50 | ||
| 197 | - | ||
| 198 | - init(options: [DropdownOption], onOptionSelected: ((_ option: DropdownOption) -> Void)?, backColor: Color) { | ||
| 199 | - self.selectedOption = options[0] | ||
| 200 | - self.options = options | ||
| 201 | - self.onOptionSelected = onOptionSelected | ||
| 202 | - self.backColor = backColor | ||
| 203 | - } | ||
| 204 | - | ||
| 205 | - var body: some View { | ||
| 206 | - Button(action: { | ||
| 207 | - self.shouldShowDropdown.toggle() | ||
| 208 | - }) { | ||
| 209 | - HStack { | ||
| 210 | -// Text(selectedOption == nil ? placeholder : selectedOption!.value) | ||
| 211 | - Text(selectedOption?.value ?? "") | ||
| 212 | - .font(.system(size: 14)) | ||
| 213 | - .fontWeight(.bold) | ||
| 214 | - .foregroundColor(Color(red: 0.23529411764705882, green: 0.23137254901960785, blue: 0.2823529411764706)) | ||
| 215 | -// .foregroundColor(selectedOption == nil ? Color.gray: Color.black) | ||
| 216 | - | ||
| 217 | - Spacer() | ||
| 218 | - | ||
| 219 | - Image((self.shouldShowDropdown ? "ic_up" : "ic_down"), bundle: Bundle(for: MyEmptyClass.self)) | ||
| 220 | - .resizable() | ||
| 221 | - .aspectRatio(contentMode: .fit) | ||
| 222 | - .frame(width: 15, height: 10) | ||
| 223 | - | ||
| 224 | - } | ||
| 225 | - } | ||
| 226 | - .padding(.horizontal) | ||
| 227 | - .cornerRadius(5) | ||
| 228 | - .frame(height: self.buttonHeight) | ||
| 229 | - .frame(maxWidth: .infinity) | ||
| 230 | - .overlay( | ||
| 231 | - VStack { | ||
| 232 | - if self.shouldShowDropdown { | ||
| 233 | - Spacer(minLength: buttonHeight + 10) | ||
| 234 | - Dropdown( | ||
| 235 | - options: self.options, | ||
| 236 | - onOptionSelected: { option in | ||
| 237 | - shouldShowDropdown = false | ||
| 238 | - selectedOption = option | ||
| 239 | - self.onOptionSelected?(option) | ||
| 240 | - }, | ||
| 241 | - backColor: self.backColor | ||
| 242 | - ) | ||
| 243 | - } | ||
| 244 | - }, alignment: .topLeading | ||
| 245 | - ) | ||
| 246 | - .background( | ||
| 247 | - RoundedRectangle(cornerRadius: 8).fill(self.backColor) | ||
| 248 | - ) | ||
| 249 | - } | ||
| 250 | - } | ||
| 251 | - | ||
| 252 | - //MARK:- Chart Data | ||
| 253 | - struct ChartData: Identifiable { | ||
| 254 | - var id = UUID() | ||
| 255 | - var color : Color | ||
| 256 | - var percent : CGFloat | ||
| 257 | - var value : CGFloat | ||
| 258 | - var title : String | ||
| 259 | - var image : String | ||
| 260 | - } | ||
| 261 | - | ||
| 262 | - class ChartDataContainer : ObservableObject { | ||
| 263 | - @Published var chartData: Array<ChartData> | ||
| 264 | - | ||
| 265 | - | ||
| 266 | - init(chartData: Array<ChartData>) { | ||
| 267 | - self.chartData = chartData | ||
| 268 | - calc() | ||
| 269 | - } | ||
| 270 | - | ||
| 271 | - func calc(){ | ||
| 272 | - var value : CGFloat = 0 | ||
| 273 | - | ||
| 274 | - for i in 0..<chartData.count { | ||
| 275 | - value += chartData[i].percent | ||
| 276 | - chartData[i].value = value | ||
| 277 | - } | ||
| 278 | - } | ||
| 279 | - } | ||
| 280 | - | ||
| 281 | - //MARK:- Donut Graph | ||
| 282 | - struct DonutChart : View { | ||
| 283 | - @ObservedObject var charDataObj: ChartDataContainer | ||
| 284 | -// @State var indexOfTappedSlice = -1 | ||
| 285 | - | ||
| 286 | - var uiscreen = UIScreen.main.bounds | ||
| 287 | - | ||
| 288 | - init (charDataObj: ChartDataContainer) { | ||
| 289 | - self.charDataObj = charDataObj | ||
| 290 | - } | ||
| 291 | - | ||
| 292 | - var body: some View { | ||
| 293 | - VStack { | ||
| 294 | - ZStack { | ||
| 295 | - ForEach(Array(charDataObj.chartData.enumerated()), id: \.offset) { index, item in | ||
| 296 | - Circle() | ||
| 297 | - .trim(from: index == 0 ? 0.0 : charDataObj.chartData[index-1].value/100, | ||
| 298 | - to: charDataObj.chartData[index].value/100) | ||
| 299 | - .stroke(charDataObj.chartData[index].color,lineWidth: 12) | ||
| 300 | -// .onTapGesture { | ||
| 301 | -// indexOfTappedSlice = indexOfTappedSlice == index ? -1 : index | ||
| 302 | -// } | ||
| 303 | -// .scaleEffect(index == indexOfTappedSlice ? 1.1 : 1.0) | ||
| 304 | - .animation(.spring()) | ||
| 305 | - } | ||
| 306 | - Image("ic_cosmote_logo", bundle: Bundle(for: MyEmptyClass.self)) | ||
| 307 | - .resizable() | ||
| 308 | - .aspectRatio(contentMode: .fit) | ||
| 309 | - .frame(width: self.uiscreen.width * 0.3, height: self.uiscreen.height * 0.04) | ||
| 310 | - | ||
| 311 | -// if indexOfTappedSlice != -1 { | ||
| 312 | -// Text(String(format: "%.2f", Double(charDataObj.chartData[indexOfTappedSlice].percent))+"%") | ||
| 313 | -// .font(.title) | ||
| 314 | -// } | ||
| 315 | - } | ||
| 316 | - .frame(width: self.uiscreen.width * 0.5, height: self.uiscreen.width * 0.5) | ||
| 317 | - .padding() | ||
| 318 | - .onAppear() { | ||
| 319 | - self.charDataObj.calc() | ||
| 320 | - } | ||
| 321 | - } | ||
| 322 | - } | ||
| 323 | - } | ||
| 324 | - | ||
| 325 | -} | ||
| 326 | - | ||
| 327 | -@available(iOS 13.0.0, *) | ||
| 328 | -struct DetailsView: View { | ||
| 329 | - var parentView: UIView | ||
| 330 | - | ||
| 331 | - var coupons:Array<swiftApi.CouponItemModel> = [] | ||
| 332 | - | ||
| 333 | - var uiscreen = UIScreen.main.bounds | ||
| 334 | - | ||
| 335 | - @State private var selectedTab = 0 | ||
| 336 | - @State private var selectedCouponOption: DropdownOption? = couponOptions[0] | ||
| 337 | - @State private var selectedRedeemOption: DropdownOption? = redeemOptions[0] | ||
| 338 | - | ||
| 339 | - let couponsChartData: Array<ChartData> = [ | ||
| 340 | - ChartData(color: Color(red: 0.57, green: 0.82, blue: 0.02), percent: 60, value: 0, title: "Διασκέδαση", image: "ic_smile"), | ||
| 341 | - ChartData(color: Color(red: 0.24, green: 0.32, blue: 0.40), percent: 22, value: 0, title: "Supermarket", image: "ic_cart"), | ||
| 342 | - ChartData(color: Color(red: 0.14, green: 0.66, blue: 0.71), percent: 18, value: 0, title: "Ταξίδια", image: "ic_plane") | ||
| 343 | - ] | ||
| 344 | - | ||
| 345 | - | ||
| 346 | - let giftsChartData: Array<ChartData> = [ | ||
| 347 | - ChartData(color: Color(red: 0.57, green: 0.82, blue: 0.02), percent: 50, value: 0, title: "Δώρο Γενεθλίων", image: "ic_gift"), | ||
| 348 | - ChartData(color: Color(red: 0.24, green: 0.32, blue: 0.40), percent: 50, value: 0, title: "Safe driving", image: "ic_steering_wheel") | ||
| 349 | - ] | ||
| 350 | - | ||
| 351 | - @State var charDataObj: ChartDataContainer | ||
| 352 | - | ||
| 353 | - static var uniqueKey: String { | ||
| 354 | - UUID().uuidString | ||
| 355 | - } | ||
| 356 | - | ||
| 357 | - static let couponOptions: [DropdownOption] = [ | ||
| 358 | - DropdownOption(key: uniqueKey, value: "Κουπόνια"), | ||
| 359 | - DropdownOption(key: uniqueKey, value: "Δώρα"), | ||
| 360 | - ] | ||
| 361 | - | ||
| 362 | - static let redeemOptions: [DropdownOption] = [ | ||
| 363 | - DropdownOption(key: uniqueKey, value: "Εξαργύρωση"), | ||
| 364 | - DropdownOption(key: uniqueKey, value: "Συλλογή"), | ||
| 365 | - ] | ||
| 366 | - | ||
| 367 | - init(parentView: UIView) { //initializer method | ||
| 368 | - | ||
| 369 | - let instanceOfMySwiftApi = swiftApi() | ||
| 370 | - let couponsData = instanceOfMySwiftApi.getCoupons() | ||
| 371 | - | ||
| 372 | - self.coupons = couponsData | ||
| 373 | - self.parentView = parentView | ||
| 374 | - | ||
| 375 | - self.charDataObj = ChartDataContainer(chartData: couponsChartData) | ||
| 376 | - } | ||
| 377 | - | ||
| 378 | - func goBack(){ | ||
| 379 | - for subview in parentView.subviews { | ||
| 380 | - if(subview.tag == 10) { | ||
| 381 | - subview.removeFromSuperview() | ||
| 382 | - } | ||
| 383 | - } | ||
| 384 | - } | ||
| 385 | - | ||
| 386 | - var body: some View { | ||
| 387 | - | ||
| 388 | - VStack { | ||
| 389 | - headerView(goBack: goBack) | ||
| 390 | - | ||
| 391 | - Tabs(tabs: .constant(["Μηνιαία", "6Μηνο", "12Μηνο"]), | ||
| 392 | - selection: $selectedTab) | ||
| 393 | - | ||
| 394 | - VStack { | ||
| 395 | - GeometryReader { geometry in | ||
| 396 | - ScrollView(showsIndicators: false) { | ||
| 397 | - VStack { | ||
| 398 | - VStack { | ||
| 399 | - | ||
| 400 | - DropdownSelector( | ||
| 401 | - // placeholder: "Δώρα", | ||
| 402 | - options: DetailsView.couponOptions, | ||
| 403 | - onOptionSelected: { option in | ||
| 404 | - print(option) | ||
| 405 | - selectedCouponOption = option | ||
| 406 | - | ||
| 407 | - if (option == DetailsView.couponOptions[0]) { | ||
| 408 | - self.charDataObj = ChartDataContainer(chartData: couponsChartData) | ||
| 409 | - } else { | ||
| 410 | - self.charDataObj = ChartDataContainer(chartData: giftsChartData) | ||
| 411 | - } | ||
| 412 | - }, | ||
| 413 | - backColor: Color(red: 0.9607843137254902, green: 0.9607843137254902, blue: 0.9607843137254902) | ||
| 414 | - ) | ||
| 415 | - .padding(.horizontal, 25) | ||
| 416 | - .padding(.top, self.uiscreen.height * 0.02) | ||
| 417 | - .zIndex(2) | ||
| 418 | - | ||
| 419 | - DonutChart(charDataObj: self.charDataObj) | ||
| 420 | - .padding(.vertical, self.uiscreen.height * 0.03) | ||
| 421 | - | ||
| 422 | - DropdownSelector( | ||
| 423 | - // placeholder: "Δώρα", | ||
| 424 | - options: DetailsView.redeemOptions, | ||
| 425 | - onOptionSelected: { option in | ||
| 426 | - selectedRedeemOption = option | ||
| 427 | - }, | ||
| 428 | - backColor: Color(red: 0.9333333333333333, green: 0.9686274509803922, blue: 1.0) | ||
| 429 | - ) | ||
| 430 | - .padding(.horizontal, 25) | ||
| 431 | - .zIndex(1) | ||
| 432 | - | ||
| 433 | - VStack { | ||
| 434 | - VStack(spacing: self.uiscreen.width * 0.06) { | ||
| 435 | - ForEach(Array(charDataObj.chartData.enumerated()), id: \.offset) { index, item in | ||
| 436 | - HStack { | ||
| 437 | - Image(charDataObj.chartData[index].image, bundle: Bundle(for: MyEmptyClass.self)) | ||
| 438 | - .resizable() | ||
| 439 | - .aspectRatio(contentMode: .fit) | ||
| 440 | - .frame(width: self.uiscreen.height * 0.02, height: self.uiscreen.height * 0.02) | ||
| 441 | - | ||
| 442 | - Text(charDataObj.chartData[index].title) | ||
| 443 | - .fontWeight(.medium) | ||
| 444 | - .font(.system(size: 14)) | ||
| 445 | - .foregroundColor(Color(red: 0.30196078431372547, green: 0.2980392156862745, blue: 0.34509803921568627)) | ||
| 446 | - .padding(.horizontal) | ||
| 447 | - | ||
| 448 | - Spacer() | ||
| 449 | - | ||
| 450 | -// Text(String(format: "%.2f", Double(charDataObj.chartData[index].percent))+"%") | ||
| 451 | - Text(String(format: "%.0f", Double(charDataObj.chartData[index].percent))+"%") | ||
| 452 | - .fontWeight(.medium) | ||
| 453 | - .font(.system(size: 16)) | ||
| 454 | - .foregroundColor(charDataObj.chartData[index].color) | ||
| 455 | - } | ||
| 456 | - .frame(maxWidth: .infinity) | ||
| 457 | - } | ||
| 458 | - } | ||
| 459 | - .padding(.all, self.uiscreen.width * 0.06) | ||
| 460 | - .frame(maxWidth: .infinity) | ||
| 461 | - } | ||
| 462 | - .frame(width:self.uiscreen.width * 0.86) | ||
| 463 | -// .frame(maxHeight: .infinity) | ||
| 464 | - .background(Color(red: 0.9490196078431372, green: 0.9490196078431372, blue: 0.9490196078431372, opacity: 0.49)) | ||
| 465 | - .cornerRadius(10) | ||
| 466 | - .padding(.top, self.uiscreen.height * 0.04) | ||
| 467 | - | ||
| 468 | - Spacer() | ||
| 469 | - | ||
| 470 | - VStack(alignment: .center) { | ||
| 471 | - Button { | ||
| 472 | - // Button Action | ||
| 473 | - print("More Details Button tapped!") | ||
| 474 | - } label: { | ||
| 475 | - HStack { | ||
| 476 | - Text("Αναλυτικά") | ||
| 477 | - .fontWeight(.medium) | ||
| 478 | - .font(.system(size: 16)) | ||
| 479 | - .foregroundColor(Color.white) | ||
| 480 | - .multilineTextAlignment(.center) | ||
| 481 | - .padding(.all) | ||
| 482 | - } | ||
| 483 | - .frame(maxWidth: .infinity) | ||
| 484 | - } | ||
| 485 | - .frame(width: self.uiscreen.width * 0.8) | ||
| 486 | - .background(Color(red: 0.4745098039215686, green: 0.7490196078431373, blue: 0.0784313725490196)) | ||
| 487 | - .cornerRadius(7) | ||
| 488 | - } | ||
| 489 | - .frame(maxWidth: .infinity) | ||
| 490 | - .padding(.top, self.uiscreen.height * 0.04) | ||
| 491 | - .padding(.bottom, self.uiscreen.height * 0.02) | ||
| 492 | -// .padding(.horizontal, 25) | ||
| 493 | - | ||
| 494 | - } | ||
| 495 | - .frame(width:self.uiscreen.width * 0.93) | ||
| 496 | - .frame(maxHeight: .infinity) | ||
| 497 | - .background(Color.white) | ||
| 498 | - .cornerRadius(10) | ||
| 499 | - } | ||
| 500 | - .padding(.vertical, self.uiscreen.height * 0.02) | ||
| 501 | - .frame(minHeight: geometry.size.height) | ||
| 502 | -// .frame(maxHeight: .infinity) | ||
| 503 | - | ||
| 504 | - } | ||
| 505 | - .cornerRadius(10, corners: [.topLeft]) | ||
| 506 | - .frame(width:self.uiscreen.width) | ||
| 507 | - .frame(maxHeight: .infinity) | ||
| 508 | - } | ||
| 509 | - .frame(width:self.uiscreen.width) | ||
| 510 | - .frame(maxHeight: .infinity) | ||
| 511 | - } | ||
| 512 | - .frame(width:self.uiscreen.width) | ||
| 513 | - .frame(maxHeight: .infinity) | ||
| 514 | - .padding(.top, 5) | ||
| 515 | - .background( | ||
| 516 | - Image("coupons_scrollview", bundle: Bundle(for: MyEmptyClass.self)) | ||
| 517 | - .resizable() | ||
| 518 | - ) | ||
| 519 | - | ||
| 520 | - } | ||
| 521 | - .edgesIgnoringSafeArea([.bottom]) | ||
| 522 | - .frame(width:self.uiscreen.width) | ||
| 523 | - .frame(maxHeight: .infinity) | ||
| 524 | - } | ||
| 525 | -} | ||
| 526 | -#endif | ||
| 527 | - | ||
| 528 | -//struct DetailsView_Previews: PreviewProvider { | ||
| 529 | -// static var previews: some View { | ||
| 530 | -// DetailsView() | ||
| 531 | -// } | ||
| 532 | -//} |
| 1 | -// | ||
| 2 | -// DetailsViewInterface.swift | ||
| 3 | -// WarplySDKFrameworkIOS | ||
| 4 | -// | ||
| 5 | -// Created by Manos Chorianopoulos on 3/5/22. | ||
| 6 | -// | ||
| 7 | - | ||
| 8 | -import Foundation | ||
| 9 | -import SwiftUI | ||
| 10 | - | ||
| 11 | -@available(iOS 13.0.0, *) | ||
| 12 | -@objc public class DetailsViewInterface : NSObject { | ||
| 13 | - | ||
| 14 | - @objc(detailsViewController:) static public func detailsViewController(parentView: UIView?) -> UIViewController { | ||
| 15 | - return UIHostingController(rootView: DetailsView(parentView: parentView!)) | ||
| 16 | - } | ||
| 17 | - | ||
| 18 | -} |
| 1 | -// | ||
| 2 | -// GiftsView.swift | ||
| 3 | -// WarplySDKFrameworkIOS | ||
| 4 | -// | ||
| 5 | -// Created by Manos Chorianopoulos on 18/4/22. | ||
| 6 | -// | ||
| 7 | - | ||
| 8 | - | ||
| 9 | -#if canImport(SwiftUI) | ||
| 10 | -import SwiftUI | ||
| 11 | -import Combine | ||
| 12 | -import Foundation | ||
| 13 | -import UIKit | ||
| 14 | - | ||
| 15 | - | ||
| 16 | - | ||
| 17 | -extension String { | ||
| 18 | - func htmlToString() -> String { | ||
| 19 | - return try! NSAttributedString(data: self.data(using: .utf8)!, | ||
| 20 | - options: [.documentType: NSAttributedString.DocumentType.html], | ||
| 21 | - documentAttributes: nil).string | ||
| 22 | - } | ||
| 23 | -} | ||
| 24 | - | ||
| 25 | -extension View { | ||
| 26 | - func cornerRadius(_ radius: CGFloat, corners: UIRectCorner) -> some View { | ||
| 27 | - clipShape( RoundedCorner(radius: radius, corners: corners) ) | ||
| 28 | - } | ||
| 29 | -} | ||
| 30 | - | ||
| 31 | -struct RoundedCorner: Shape { | ||
| 32 | - | ||
| 33 | - var radius: CGFloat = .infinity | ||
| 34 | - var corners: UIRectCorner = .allCorners | ||
| 35 | - | ||
| 36 | - func path(in rect: CGRect) -> Path { | ||
| 37 | - let path = UIBezierPath(roundedRect: rect, byRoundingCorners: corners, cornerRadii: CGSize(width: radius, height: radius)) | ||
| 38 | - return Path(path.cgPath) | ||
| 39 | - } | ||
| 40 | -} | ||
| 41 | - | ||
| 42 | -class UrlImageModel: ObservableObject { | ||
| 43 | - @Published var image: UIImage? | ||
| 44 | - var urlString: String? | ||
| 45 | - var imageCache = ImageCache.getImageCache() | ||
| 46 | - | ||
| 47 | - | ||
| 48 | - func loadImage() { | ||
| 49 | - if loadImageFromCache() { | ||
| 50 | - print("Cache hit") | ||
| 51 | - return | ||
| 52 | - } | ||
| 53 | - | ||
| 54 | - print("Cache miss, loading from url") | ||
| 55 | - loadImageFromUrl() | ||
| 56 | - } | ||
| 57 | - | ||
| 58 | - func loadImageFromCache() -> Bool { | ||
| 59 | - guard let urlString = urlString else { | ||
| 60 | - return false | ||
| 61 | - } | ||
| 62 | - | ||
| 63 | - guard let cacheImage = imageCache.get(forKey: urlString) else { | ||
| 64 | - return false | ||
| 65 | - } | ||
| 66 | - | ||
| 67 | - image = cacheImage | ||
| 68 | - return true | ||
| 69 | - } | ||
| 70 | - | ||
| 71 | - func loadImageFromUrl() { | ||
| 72 | - guard let urlString = urlString else { | ||
| 73 | - return | ||
| 74 | - } | ||
| 75 | - | ||
| 76 | - let url = URL(string: urlString)! | ||
| 77 | - let task = URLSession.shared.dataTask(with: url, completionHandler: getImageFromResponse(data:response:error:)) | ||
| 78 | - task.resume() | ||
| 79 | - } | ||
| 80 | - | ||
| 81 | - func getImageFromResponse(data: Data?, response: URLResponse?, error: Error?) { | ||
| 82 | - guard error == nil else { | ||
| 83 | - print("Error: \(error!)") | ||
| 84 | - return | ||
| 85 | - } | ||
| 86 | - guard let data = data else { | ||
| 87 | - print("No data found") | ||
| 88 | - return | ||
| 89 | - } | ||
| 90 | - | ||
| 91 | - DispatchQueue.main.async { | ||
| 92 | - guard let loadedImage = UIImage(data: data) else { | ||
| 93 | - return | ||
| 94 | - } | ||
| 95 | - | ||
| 96 | - self.imageCache.set(forKey: self.urlString!, image: loadedImage) | ||
| 97 | - self.image = loadedImage | ||
| 98 | - } | ||
| 99 | - } | ||
| 100 | - | ||
| 101 | - init(urlString:String) { | ||
| 102 | - self.urlString = urlString | ||
| 103 | - loadImage() | ||
| 104 | - } | ||
| 105 | -} | ||
| 106 | - | ||
| 107 | -class ImageCache { | ||
| 108 | - var cache = NSCache<NSString, UIImage>() | ||
| 109 | - | ||
| 110 | - func get(forKey: String) -> UIImage? { | ||
| 111 | - return cache.object(forKey: NSString(string: forKey)) | ||
| 112 | - } | ||
| 113 | - | ||
| 114 | - func set(forKey: String, image: UIImage) { | ||
| 115 | - cache.setObject(image, forKey: NSString(string: forKey)) | ||
| 116 | - } | ||
| 117 | -} | ||
| 118 | - | ||
| 119 | -extension ImageCache { | ||
| 120 | - private static var imageCache = ImageCache() | ||
| 121 | - static func getImageCache() -> ImageCache { | ||
| 122 | - return imageCache | ||
| 123 | - } | ||
| 124 | -} | ||
| 125 | - | ||
| 126 | - | ||
| 127 | -extension GiftsView { | ||
| 128 | - struct headerView: View { | ||
| 129 | - var goBack: () -> () | ||
| 130 | - | ||
| 131 | - var uiscreen = UIScreen.main.bounds | ||
| 132 | - | ||
| 133 | - var body: some View { | ||
| 134 | - HStack(alignment: .center) { | ||
| 135 | - Button { | ||
| 136 | - // Button Action | ||
| 137 | - print("Back Button tapped!") | ||
| 138 | - goBack() | ||
| 139 | - } label: { | ||
| 140 | - Image("ic_back", bundle: Bundle(for: MyEmptyClass.self)) | ||
| 141 | - .resizable() | ||
| 142 | - .aspectRatio(contentMode: .fit) | ||
| 143 | - .frame(width: self.uiscreen.height * 0.025, height: self.uiscreen.height * 0.02) | ||
| 144 | - } | ||
| 145 | - | ||
| 146 | - Text("Gifts for You") | ||
| 147 | - .fontWeight(.medium) | ||
| 148 | - .font(.system(size: 16)) | ||
| 149 | - .foregroundColor(Color(red: 0.20784313725490197, green: 0.3176470588235294, blue: 0.40784313725490196)) | ||
| 150 | - .multilineTextAlignment(.center) | ||
| 151 | - .frame(maxWidth: .infinity) | ||
| 152 | - .padding(.horizontal) | ||
| 153 | - | ||
| 154 | - Button { | ||
| 155 | - // Button Action | ||
| 156 | - print("Location tapped!") | ||
| 157 | - } label: { | ||
| 158 | - Image("location_icon", bundle: Bundle(for: MyEmptyClass.self)) | ||
| 159 | - .resizable() | ||
| 160 | - .aspectRatio(contentMode: .fit) | ||
| 161 | - .frame(width: self.uiscreen.height * 0.04, height: self.uiscreen.height * 0.04) | ||
| 162 | - } | ||
| 163 | - | ||
| 164 | - } | ||
| 165 | - .frame(maxWidth: .infinity) | ||
| 166 | - .padding(.horizontal) | ||
| 167 | - .padding(.vertical, 10) | ||
| 168 | - } | ||
| 169 | - } | ||
| 170 | - | ||
| 171 | - struct searchView: View { | ||
| 172 | - @State var searchText: String = "" | ||
| 173 | - | ||
| 174 | - var uiscreen = UIScreen.main.bounds | ||
| 175 | - | ||
| 176 | - var body: some View { | ||
| 177 | - HStack(alignment: .center) { | ||
| 178 | - HStack(alignment: .center) { | ||
| 179 | - Image("search_icon", bundle: Bundle(for: MyEmptyClass.self)) | ||
| 180 | - .resizable() | ||
| 181 | - .aspectRatio(contentMode: .fit) | ||
| 182 | - .frame(width: self.uiscreen.height * 0.025, height: self.uiscreen.height * 0.025) | ||
| 183 | - .padding([.top, .leading, .bottom], 10) | ||
| 184 | - TextField("Βρες το gift που σε ενδιαφέρει", text: $searchText) | ||
| 185 | - .frame(maxWidth: .infinity) | ||
| 186 | - .padding(.all, 10) | ||
| 187 | - .foregroundColor(Color(red: 0.48627450980392156, green: 0.48627450980392156, blue: 0.48627450980392156)) | ||
| 188 | - .font(.system(size: 16, weight: .regular, design: .default)) | ||
| 189 | - } | ||
| 190 | - .overlay( | ||
| 191 | - RoundedRectangle(cornerRadius: 9) | ||
| 192 | - .stroke(Color(red: 0.8235294117647058, green: 0.8235294117647058, blue: 0.8235294117647058), lineWidth: 1) | ||
| 193 | - ) | ||
| 194 | - | ||
| 195 | - Button { | ||
| 196 | - // Button Action | ||
| 197 | - print("Filters tapped!") | ||
| 198 | - } label: { | ||
| 199 | - Image("filters_btn", bundle: Bundle(for: MyEmptyClass.self)) | ||
| 200 | - .resizable() | ||
| 201 | - .aspectRatio(contentMode: .fit) | ||
| 202 | - .frame(width: self.uiscreen.height * 0.06, height: self.uiscreen.height * 0.04) | ||
| 203 | - .padding(.leading, 5) | ||
| 204 | - } | ||
| 205 | - } | ||
| 206 | - .frame(maxWidth: .infinity) | ||
| 207 | - .padding(.horizontal, 20) | ||
| 208 | - .padding(.vertical, 5) | ||
| 209 | - } | ||
| 210 | - } | ||
| 211 | - | ||
| 212 | - struct ImageView: View { | ||
| 213 | - @ObservedObject var imageLoader:UrlImageModel | ||
| 214 | - @State var width:CGFloat | ||
| 215 | - @State var isFill:Bool | ||
| 216 | - | ||
| 217 | - var uiscreen = UIScreen.main.bounds | ||
| 218 | - | ||
| 219 | - init(withURL url:String , width:CGFloat, isFill:Bool) { | ||
| 220 | - imageLoader = UrlImageModel(urlString:url) | ||
| 221 | - self.width = width | ||
| 222 | - self.isFill = isFill | ||
| 223 | - } | ||
| 224 | - | ||
| 225 | - var body: some View { | ||
| 226 | - | ||
| 227 | - Image(uiImage: imageLoader.image ?? UIImage()) | ||
| 228 | - .resizable() | ||
| 229 | - .aspectRatio(contentMode: isFill ? .fill : .fit) | ||
| 230 | - .frame(width: self.width) | ||
| 231 | - .frame(maxHeight: .infinity) | ||
| 232 | - } | ||
| 233 | - } | ||
| 234 | - | ||
| 235 | - | ||
| 236 | - struct giftItemView: View { | ||
| 237 | - var item: swiftApi.CampaignItemModel | ||
| 238 | - var isFirst: Bool | ||
| 239 | - var isLast: Bool | ||
| 240 | - var parentView: UIView | ||
| 241 | - | ||
| 242 | - var uiscreen = UIScreen.main.bounds | ||
| 243 | - | ||
| 244 | - var body: some View { | ||
| 245 | - Button { | ||
| 246 | - // GiftItem Action | ||
| 247 | - let instanceOfMyApi = MyApi() | ||
| 248 | - let campaignViewController = instanceOfMyApi.openCampaign(parentView, campaign: item.index_url)! | ||
| 249 | - campaignViewController.view.tag = 6 | ||
| 250 | -// addChild(couponsViewController) | ||
| 251 | - campaignViewController.view.frame = parentView.frame | ||
| 252 | - parentView.addSubview(campaignViewController.view) | ||
| 253 | -// campaignViewController.didMove(toParent: UIHostingController(rootView: self)) | ||
| 254 | - } label: { | ||
| 255 | - HStack(alignment: .center) { | ||
| 256 | - | ||
| 257 | - ImageView(withURL: item.logo_url ?? "", width: self.uiscreen.width * 0.5, isFill: true) | ||
| 258 | - | ||
| 259 | - Text(item.title ?? "") | ||
| 260 | - .fontWeight(.regular) | ||
| 261 | - .font(.system(size: 16)) | ||
| 262 | - .foregroundColor(Color(red: 0.22745098039215686, green: 0.3215686274509804, blue: 0.4)) | ||
| 263 | - .multilineTextAlignment(.center) | ||
| 264 | - .frame(maxWidth: .infinity, maxHeight: .infinity) | ||
| 265 | - .padding(.all, 10) | ||
| 266 | - .background(Color.white) | ||
| 267 | - } | ||
| 268 | - } | ||
| 269 | - .frame(width: self.uiscreen.width * 0.9, height: self.uiscreen.height * 0.16) | ||
| 270 | - .background(Color.white) | ||
| 271 | - .cornerRadius(5) | ||
| 272 | - .shadow(color: Color(red: 0, green: 0, blue: 0, opacity: 0.16), radius: 30, x: 0, y: 3) | ||
| 273 | - .padding(.leading, isFirst ? 18 : 0) | ||
| 274 | - .padding(.trailing, isLast ? 18 : 0) | ||
| 275 | - } | ||
| 276 | - } | ||
| 277 | - | ||
| 278 | - struct giftsContainer: View { | ||
| 279 | - @State var gifts:Array<swiftApi.CampaignItemModel> = [] | ||
| 280 | - @State var title:String = "" | ||
| 281 | - @State var parentView:UIView | ||
| 282 | - | ||
| 283 | - var uiscreen = UIScreen.main.bounds | ||
| 284 | - | ||
| 285 | - var body: some View { | ||
| 286 | - VStack(alignment: .leading) { | ||
| 287 | - | ||
| 288 | - Text(title) | ||
| 289 | - .fontWeight(.bold) | ||
| 290 | - .font(.system(size: 17)) | ||
| 291 | - .foregroundColor(Color.white) | ||
| 292 | - .multilineTextAlignment(.leading) | ||
| 293 | - .padding(.horizontal) | ||
| 294 | - .padding(.top, self.uiscreen.height * 0.05) | ||
| 295 | - .padding(.bottom, self.uiscreen.height * 0.015) | ||
| 296 | - | ||
| 297 | - ScrollView(.horizontal, showsIndicators: false) { | ||
| 298 | - HStack(alignment: .center) { | ||
| 299 | - ForEach(Array(gifts.enumerated()), id: \.offset) { index, item in | ||
| 300 | - | ||
| 301 | - giftItemView(item: item, isFirst: index == 0, isLast: index == (gifts.count-1), parentView: parentView) | ||
| 302 | - } | ||
| 303 | - | ||
| 304 | - } | ||
| 305 | - .frame(maxWidth: .infinity) | ||
| 306 | - } | ||
| 307 | - .frame(maxWidth: .infinity) | ||
| 308 | - | ||
| 309 | - } | ||
| 310 | - .frame(maxWidth: .infinity) | ||
| 311 | - } | ||
| 312 | - } | ||
| 313 | - | ||
| 314 | - struct couponsContainer: View { | ||
| 315 | - @State var coupons:Array<swiftApi.CouponSetItemModel> = [] | ||
| 316 | - @State var title:String = "" | ||
| 317 | - @State var parentView:UIView | ||
| 318 | - | ||
| 319 | - var uiscreen = UIScreen.main.bounds | ||
| 320 | - | ||
| 321 | - var body: some View { | ||
| 322 | - VStack(alignment: .leading) { | ||
| 323 | - | ||
| 324 | - Text(title) | ||
| 325 | - .fontWeight(.bold) | ||
| 326 | - .font(.system(size: 17)) | ||
| 327 | - .foregroundColor(Color.white) | ||
| 328 | - .multilineTextAlignment(.leading) | ||
| 329 | - .padding(.horizontal) | ||
| 330 | - .padding(.top, self.uiscreen.height * 0.05) | ||
| 331 | - .padding(.bottom, self.uiscreen.height * 0.015) | ||
| 332 | - | ||
| 333 | - ScrollView(.horizontal, showsIndicators: false) { | ||
| 334 | - HStack(alignment: .center) { | ||
| 335 | - ForEach(Array(coupons.enumerated()), id: \.offset) { index, item in | ||
| 336 | - | ||
| 337 | - couponItemView(item: item, isFirst: index == 0, isLast: index == (coupons.count-1), parentView: parentView) | ||
| 338 | - } | ||
| 339 | - | ||
| 340 | - } | ||
| 341 | - .frame(maxWidth: .infinity) | ||
| 342 | - } | ||
| 343 | - .frame(maxWidth: .infinity) | ||
| 344 | - | ||
| 345 | - } | ||
| 346 | - .frame(maxWidth: .infinity) | ||
| 347 | - .padding(.bottom, self.uiscreen.height * 0.1) | ||
| 348 | - } | ||
| 349 | - } | ||
| 350 | - | ||
| 351 | - struct couponItemView: View { | ||
| 352 | - var item: swiftApi.CouponSetItemModel | ||
| 353 | - var isFirst: Bool | ||
| 354 | - var isLast: Bool | ||
| 355 | - var parentView: UIView | ||
| 356 | - | ||
| 357 | - var uiscreen = UIScreen.main.bounds | ||
| 358 | - | ||
| 359 | - var body: some View { | ||
| 360 | - Button { | ||
| 361 | - // GiftItem Action | ||
| 362 | -// let tempItem = item.asDictionary | ||
| 363 | - let instanceOfMySwiftApi = swiftApi() | ||
| 364 | - let couponViewController = instanceOfMySwiftApi.openCoupon(parent: parentView, coupon: item) | ||
| 365 | - couponViewController.view.tag = 2 | ||
| 366 | -// addChild(couponsViewController) | ||
| 367 | - couponViewController.view.frame = parentView.frame | ||
| 368 | - parentView.addSubview(couponViewController.view) | ||
| 369 | -// couponViewController.didMove(toParent: UIHostingController(rootView: self)) | ||
| 370 | - } label: { | ||
| 371 | - | ||
| 372 | - HStack(alignment: .center) { | ||
| 373 | - | ||
| 374 | - ImageView(withURL: item.img_preview ?? "", width: self.uiscreen.width * 0.15, isFill: false) | ||
| 375 | - | ||
| 376 | - VLine() | ||
| 377 | - .stroke(style: StrokeStyle(lineWidth: 1, dash: [5])) | ||
| 378 | - .foregroundColor(Color(red: 0.4392156862745098, green: 0.4392156862745098, blue: 0.4392156862745098)) | ||
| 379 | - .frame(width: 1) | ||
| 380 | - .padding(.leading, 10) | ||
| 381 | - | ||
| 382 | - VStack(alignment: .leading, spacing: 8.0) { | ||
| 383 | - Text(item.name ?? "") | ||
| 384 | - .fontWeight(.medium) | ||
| 385 | - .font(.system(size: 16)) | ||
| 386 | - .foregroundColor(Color(red: 0.22745098039215686, green: 0.3215686274509804, blue: 0.4)) | ||
| 387 | - .multilineTextAlignment(.leading) | ||
| 388 | - .lineLimit(1) | ||
| 389 | -// .frame(maxWidth: .infinity) | ||
| 390 | - | ||
| 391 | - HStack(alignment: .center) { | ||
| 392 | - Text((item.discount ?? "")+"€") | ||
| 393 | - .fontWeight(.bold) | ||
| 394 | - .font(.system(size: 25)) | ||
| 395 | - .foregroundColor(Color(red: 0.22745098039215686, green: 0.3215686274509804, blue: 0.4)) | ||
| 396 | - .multilineTextAlignment(.leading) | ||
| 397 | - .lineLimit(1) | ||
| 398 | -// .frame(width: self.uiscreen.width * 0.3) | ||
| 399 | -// .frame(maxWidth: .infinity, maxHeight: .infinity) | ||
| 400 | - | ||
| 401 | - Text(item.short_description ?? "") | ||
| 402 | - .fontWeight(.medium) | ||
| 403 | - .font(.system(size: 11)) | ||
| 404 | - .foregroundColor(Color(red: 0.3803921568627451, green: 0.44313725490196076, blue: 0.5058823529411764)) | ||
| 405 | - .multilineTextAlignment(.leading) | ||
| 406 | - .lineLimit(3) | ||
| 407 | -// .frame(maxWidth: .infinity) | ||
| 408 | -// .padding(.leading, 10) | ||
| 409 | - } | ||
| 410 | -// .padding(.vertical, 5) | ||
| 411 | - // .frame(maxHeight: .infinity) | ||
| 412 | - | ||
| 413 | - Text("Ισχύει έως "+(item.expiration ?? "")) | ||
| 414 | - .fontWeight(.medium) | ||
| 415 | - .font(.system(size: 11)) | ||
| 416 | - .foregroundColor(Color(red: 0.3803921568627451, green: 0.44313725490196076, blue: 0.5058823529411764)) | ||
| 417 | - .multilineTextAlignment(.leading) | ||
| 418 | -// .frame(maxWidth: .infinity) | ||
| 419 | -// .frame(maxWidth: .infinity, maxHeight: .infinity) | ||
| 420 | -// .padding(.all, 10) | ||
| 421 | - } | ||
| 422 | - .padding(.all, 10) | ||
| 423 | -// .frame(maxWidth: .infinity, maxHeight: .infinity) | ||
| 424 | - | ||
| 425 | - Spacer() | ||
| 426 | - | ||
| 427 | - } | ||
| 428 | - .padding(.leading, 28) | ||
| 429 | - .padding(.trailing) | ||
| 430 | - } | ||
| 431 | - .frame(width: self.uiscreen.width * 0.9, height: self.uiscreen.height * 0.14) | ||
| 432 | - .cornerRadius(5) | ||
| 433 | - .shadow(color: Color(red: 0, green: 0, blue: 0, opacity: 0.16), radius: 30, x: 0, y: 3) | ||
| 434 | - .padding(.leading, isFirst ? 18 : 0) | ||
| 435 | - .padding(.trailing, isLast ? 18 : 0) | ||
| 436 | - .background( | ||
| 437 | - Image("coupon_bg", bundle: Bundle(for: MyEmptyClass.self)) | ||
| 438 | - .resizable(resizingMode: .stretch) | ||
| 439 | - .frame(maxWidth: .infinity, maxHeight: .infinity) | ||
| 440 | - .padding(.leading, isFirst ? 18 : 0) | ||
| 441 | - .padding(.trailing, isLast ? 18 : 0) | ||
| 442 | - ) | ||
| 443 | - } | ||
| 444 | - } | ||
| 445 | - | ||
| 446 | - struct VLine: Shape { | ||
| 447 | - func path(in rect: CGRect) -> Path { | ||
| 448 | - Path { path in | ||
| 449 | - path.move(to: CGPoint(x: rect.midX, y: rect.minY)) | ||
| 450 | - path.addLine(to: CGPoint(x: rect.midX, y: rect.maxY)) | ||
| 451 | - } | ||
| 452 | - } | ||
| 453 | - } | ||
| 454 | - | ||
| 455 | -} | ||
| 456 | - | ||
| 457 | -@available(iOS 13.0.0, *) | ||
| 458 | -struct GiftsView: View { | ||
| 459 | - var parentView: UIView | ||
| 460 | - | ||
| 461 | -// var coupons:Array<CouponSetItemModel> = CouponDataModel().getData | ||
| 462 | -// var campains:Array<CampaignItemModel> = CampaignDataModel().getData.filter { $0.offer_category == "gifts_for_you" } | ||
| 463 | - | ||
| 464 | - | ||
| 465 | - var coupons:Array<swiftApi.CouponSetItemModel> = [] | ||
| 466 | - var campains:Array<swiftApi.CampaignItemModel> = [] | ||
| 467 | - | ||
| 468 | - var uiscreen = UIScreen.main.bounds | ||
| 469 | - | ||
| 470 | - init(parentView: UIView) { //initializer method | ||
| 471 | - | ||
| 472 | - let instanceOfMySwiftApi = swiftApi() | ||
| 473 | - let couponsData = instanceOfMySwiftApi.getCouponSets() | ||
| 474 | - let campaignsData = instanceOfMySwiftApi.getCampaigns() | ||
| 475 | - | ||
| 476 | - self.coupons = couponsData | ||
| 477 | - self.campains = campaignsData.filter { $0.offer_category == "gifts_for_you" } | ||
| 478 | - self.parentView = parentView | ||
| 479 | - } | ||
| 480 | - | ||
| 481 | - func goBack(){ | ||
| 482 | - for subview in parentView.subviews { | ||
| 483 | - if(subview.tag == 5) { | ||
| 484 | - subview.removeFromSuperview() | ||
| 485 | - } | ||
| 486 | - } | ||
| 487 | - } | ||
| 488 | - | ||
| 489 | - var body: some View { | ||
| 490 | - VStack { | ||
| 491 | - headerView(goBack: goBack) | ||
| 492 | - searchView() | ||
| 493 | - | ||
| 494 | - ScrollView(showsIndicators: false) { | ||
| 495 | - VStack { | ||
| 496 | - if (campains.filter { $0.subcategory == "gifts" }.count) > 0 { | ||
| 497 | - giftsContainer(gifts: campains.filter { $0.subcategory == "gifts" }, title: "ΔΩΡΑ", parentView: parentView) | ||
| 498 | - } | ||
| 499 | - | ||
| 500 | - | ||
| 501 | - if (campains.filter { $0.subcategory == "rewards" }.count) > 0 { | ||
| 502 | - giftsContainer(gifts: campains.filter { $0.subcategory == "rewards"}, title: "ΕΠΙΒΡΑΒΕΥΣΕΙΣ", parentView: parentView ) | ||
| 503 | - } | ||
| 504 | - | ||
| 505 | - if (coupons.count) > 0 { | ||
| 506 | - couponsContainer(coupons: coupons, title: "ΚΟΥΠΟΝΙΑ", parentView: parentView ) | ||
| 507 | - } | ||
| 508 | - | ||
| 509 | - } | ||
| 510 | - .frame(width:self.uiscreen.width) | ||
| 511 | - } | ||
| 512 | - .background( | ||
| 513 | - 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: .top, endPoint: .bottom) | ||
| 514 | - ) | ||
| 515 | - .cornerRadius(30, corners: [.topLeft]) | ||
| 516 | - .frame(width:self.uiscreen.width) | ||
| 517 | - .frame(maxHeight: .infinity) | ||
| 518 | - } | ||
| 519 | - .edgesIgnoringSafeArea([.bottom]) | ||
| 520 | - .frame(width:self.uiscreen.width) | ||
| 521 | - .frame(maxHeight: .infinity) | ||
| 522 | - } | ||
| 523 | -} | ||
| 524 | -#endif | ||
| 525 | - | ||
| 526 | -//@available(iOS 13.0.0, *) | ||
| 527 | -//struct GiftsView_Previews: PreviewProvider { | ||
| 528 | -// static var previews: some View { | ||
| 529 | -// | ||
| 530 | -// GiftsView() | ||
| 531 | -// | ||
| 532 | -// } | ||
| 533 | -//} |
| 1 | -// | ||
| 2 | -// GiftsViewInterface.swift | ||
| 3 | -// WarplySDKFrameworkIOS | ||
| 4 | -// | ||
| 5 | -// Created by Manos Chorianopoulos on 18/4/22. | ||
| 6 | -// | ||
| 7 | - | ||
| 8 | -import Foundation | ||
| 9 | -import SwiftUI | ||
| 10 | - | ||
| 11 | -@available(iOS 13.0.0, *) | ||
| 12 | -@objc public class GiftsViewInterface : NSObject { | ||
| 13 | - | ||
| 14 | - @objc(giftsViewController:) static public func giftsViewController(parentView: UIView?) -> UIViewController { | ||
| 15 | - return UIHostingController(rootView: GiftsView(parentView: parentView!)) | ||
| 16 | - } | ||
| 17 | - | ||
| 18 | -} |
| 1 | -// | ||
| 2 | -// MoreForYouView.swift | ||
| 3 | -// WarplySDKFrameworkIOS | ||
| 4 | -// | ||
| 5 | -// Created by Βασιλης Σκουρας on 20/4/22. | ||
| 6 | -// | ||
| 7 | -import SwiftUI | ||
| 8 | -import Combine | ||
| 9 | -import Foundation | ||
| 10 | -import UIKit | ||
| 11 | - | ||
| 12 | -class DataMFYModel { | ||
| 13 | - var data: Array<NSDictionary> = [] | ||
| 14 | - | ||
| 15 | - init() { //initializer method | ||
| 16 | - let instanceOfMyApi = MyApi() | ||
| 17 | - let inbox = instanceOfMyApi.getInbox() as! Array<NSDictionary> | ||
| 18 | - data = inbox.filter({ $0["offer_category"] as! String == "more_for_you" }) | ||
| 19 | - } | ||
| 20 | - | ||
| 21 | - var getData: Array<NSDictionary> { | ||
| 22 | - get { // getter | ||
| 23 | - return data | ||
| 24 | - } | ||
| 25 | - } | ||
| 26 | -} | ||
| 27 | - | ||
| 28 | -extension MoreForYouView { | ||
| 29 | - | ||
| 30 | - | ||
| 31 | - struct headerView: View { | ||
| 32 | - var goBack: () -> () | ||
| 33 | - var uiscreen = UIScreen.main.bounds | ||
| 34 | - | ||
| 35 | - | ||
| 36 | - var body: some View { | ||
| 37 | - HStack(alignment: .center) { | ||
| 38 | - Button { | ||
| 39 | - // Button Action | ||
| 40 | - goBack() | ||
| 41 | - } label: { | ||
| 42 | - Image("ic_back", bundle: Bundle(for: MyEmptyClass.self)) | ||
| 43 | - .resizable() | ||
| 44 | - .aspectRatio(contentMode: .fit) | ||
| 45 | - .frame(width: self.uiscreen.height * 0.025, height: self.uiscreen.height * 0.02) | ||
| 46 | - } | ||
| 47 | - Spacer().frame(width: 0) | ||
| 48 | - Text("More for you") | ||
| 49 | - .fontWeight(.medium) | ||
| 50 | - .font(.system(size: 16)) | ||
| 51 | - .foregroundColor(Color(red: 0.20784313725490197, green: 0.3176470588235294, blue: 0.40784313725490196)) | ||
| 52 | - .multilineTextAlignment(.center) | ||
| 53 | - .frame(maxWidth: .infinity) | ||
| 54 | - .padding(.horizontal) | ||
| 55 | - .offset(x: -self.uiscreen.height * 0.0125) | ||
| 56 | - } | ||
| 57 | - .frame(maxWidth: .infinity) | ||
| 58 | - .padding(.horizontal) | ||
| 59 | - .padding(.vertical, 10) | ||
| 60 | - } | ||
| 61 | - } | ||
| 62 | - | ||
| 63 | - struct ImageView: View { | ||
| 64 | - @ObservedObject var imageLoader:UrlImageModel | ||
| 65 | - @State var width:CGFloat | ||
| 66 | - @State var height:CGFloat | ||
| 67 | - @State var isFill:Bool | ||
| 68 | - | ||
| 69 | - var uiscreen = UIScreen.main.bounds | ||
| 70 | - | ||
| 71 | - init(withURL url:String , width:CGFloat, height: CGFloat, isFill:Bool) { | ||
| 72 | - imageLoader = UrlImageModel(urlString:url) | ||
| 73 | - self.width = width | ||
| 74 | - self.height = height | ||
| 75 | - self.isFill = isFill | ||
| 76 | - } | ||
| 77 | - | ||
| 78 | - var body: some View { | ||
| 79 | - | ||
| 80 | - Image(uiImage: imageLoader.image ?? UIImage()) | ||
| 81 | - .resizable() | ||
| 82 | - .frame(minWidth: self.uiscreen.width * 0.95, idealWidth: self.uiscreen.width * 0.95, maxWidth: self.uiscreen.width * 0.95, minHeight: self.uiscreen.height * 0.2, idealHeight: self.uiscreen.height * 0.2, maxHeight: self.uiscreen.height * 0.2, alignment: .leading) | ||
| 83 | - .scaledToFill() | ||
| 84 | - .aspectRatio(contentMode: isFill ? .fill : .fit) | ||
| 85 | - .cornerRadius(4) | ||
| 86 | - } | ||
| 87 | - } | ||
| 88 | - | ||
| 89 | - struct inboxView: View { | ||
| 90 | - var result: NSDictionary | ||
| 91 | - var index: Int | ||
| 92 | - | ||
| 93 | - var uiscreen = UIScreen.main.bounds | ||
| 94 | - | ||
| 95 | - static func localizedWithParameter(parameter: String) -> LocalizedStringKey { | ||
| 96 | - return "\(parameter)" | ||
| 97 | - } | ||
| 98 | - | ||
| 99 | - var body: some View { | ||
| 100 | - HStack { | ||
| 101 | - VStack(alignment: .leading) { | ||
| 102 | - Text(MoreForYouView.inboxView.localizedWithParameter(parameter: result["title"] as? String ?? "")) | ||
| 103 | - .font(.system(size: 17).italic()) | ||
| 104 | - .fontWeight(.bold) | ||
| 105 | - .foregroundColor(Color(hex: 0x3A5266)) | ||
| 106 | - .frame(maxWidth: self.uiscreen.width * 0.65, alignment: .topLeading) | ||
| 107 | - .padding(.top, self.uiscreen.height * 0.01) | ||
| 108 | - .padding(.leading, self.uiscreen.width * 0.03) | ||
| 109 | - Spacer() | ||
| 110 | - Text(MoreForYouView.inboxView.localizedWithParameter(parameter: result["subtitle"] as? String ?? "")) | ||
| 111 | - .font(.system(size: 16)) | ||
| 112 | - .fontWeight(.medium) | ||
| 113 | - .foregroundColor(Color(hex: 0x415564)) | ||
| 114 | - .frame(maxWidth: self.uiscreen.width * 0.72, alignment: .topLeading) | ||
| 115 | - .padding(.leading, self.uiscreen.width * 0.03) | ||
| 116 | - .padding(.bottom, self.uiscreen.height * 0.01) | ||
| 117 | - } | ||
| 118 | - .frame(width: self.uiscreen.width * 0.85, height: self.uiscreen.height * 0.2, alignment: .leading) | ||
| 119 | - .background( | ||
| 120 | - Image("MFY_container", bundle: Bundle(for: MyEmptyClass.self)) | ||
| 121 | - .resizable() | ||
| 122 | - .frame(minWidth: self.uiscreen.width * 0.85, idealWidth: self.uiscreen.width * 0.85, maxWidth: self.uiscreen.width * 0.85, minHeight: self.uiscreen.height * 0.2, idealHeight: self.uiscreen.height * 0.2, maxHeight: self.uiscreen.height * 0.2, alignment: .leading) | ||
| 123 | - .scaledToFill() | ||
| 124 | - .aspectRatio(contentMode: .fill) | ||
| 125 | - ) | ||
| 126 | - .cornerRadius(4, corners: [.topLeft, .bottomLeft]) | ||
| 127 | - Spacer() | ||
| 128 | - } | ||
| 129 | - .frame(width: self.uiscreen.width * 0.95, height: self.uiscreen.height * 0.2) | ||
| 130 | - .background( | ||
| 131 | - ImageView(withURL: result["logo_url"] as! String, width: self.uiscreen.width * 0.95, height: self.uiscreen.height * 0.2, isFill: true) | ||
| 132 | - ) | ||
| 133 | - .padding(.bottom, self.uiscreen.height * 0.01) | ||
| 134 | - | ||
| 135 | - } | ||
| 136 | - } | ||
| 137 | -} | ||
| 138 | - | ||
| 139 | -extension Color { | ||
| 140 | - init(hex: Int, opacity: Double = 1.0) { | ||
| 141 | - let red = Double((hex & 0xff0000) >> 16) / 255.0 | ||
| 142 | - let green = Double((hex & 0xff00) >> 8) / 255.0 | ||
| 143 | - let blue = Double((hex & 0xff) >> 0) / 255.0 | ||
| 144 | - self.init(.sRGB, red: red, green: green, blue: blue, opacity: opacity) | ||
| 145 | - } | ||
| 146 | -} | ||
| 147 | - | ||
| 148 | -struct MoreForYouView: View { | ||
| 149 | - | ||
| 150 | - var data:Array<NSDictionary> = DataMFYModel().getData | ||
| 151 | - | ||
| 152 | - var parentView: UIView | ||
| 153 | - | ||
| 154 | - var uiscreen = UIScreen.main.bounds | ||
| 155 | - | ||
| 156 | - func goBack(){ | ||
| 157 | - for subview in parentView.subviews { | ||
| 158 | - if(subview.tag == 4) { | ||
| 159 | - subview.removeFromSuperview() | ||
| 160 | - } | ||
| 161 | - } | ||
| 162 | - } | ||
| 163 | - | ||
| 164 | - var body: some View { | ||
| 165 | - VStack { | ||
| 166 | - headerView(goBack: goBack) | ||
| 167 | - ScrollView(showsIndicators: false) { | ||
| 168 | - VStack { | ||
| 169 | - if (data.count) > 0 { | ||
| 170 | - ForEach(Array(zip(data.indices, data)), id: \.0) { index, result in | ||
| 171 | - inboxView(result: result, index: index) | ||
| 172 | - | ||
| 173 | - } | ||
| 174 | - } | ||
| 175 | - } | ||
| 176 | - .padding(.top, self.uiscreen.height * 0.04) | ||
| 177 | - .padding(.bottom, self.uiscreen.height * 0.05) | ||
| 178 | - } | ||
| 179 | - .frame(maxWidth: .infinity, maxHeight: .infinity ) | ||
| 180 | - .background( | ||
| 181 | - LinearGradient(gradient: Gradient(colors: [Color(hex: 0x1AADCC), Color(hex: 0x83C062)]), startPoint: .top, endPoint: .bottom) | ||
| 182 | - ) | ||
| 183 | - .cornerRadius(20, corners: [.topLeft]) | ||
| 184 | - | ||
| 185 | - } | ||
| 186 | - .frame(maxWidth: .infinity, maxHeight: .infinity ) | ||
| 187 | - .edgesIgnoringSafeArea([.bottom]) | ||
| 188 | - // .frame(width:self.uiscreen.width, height:self.uiscreen.height ) | ||
| 189 | - } | ||
| 190 | -} | ||
| 191 | - | ||
| 192 | -//struct MoreForYouView_Previews: PreviewProvider { | ||
| 193 | -// static var previews: some View { | ||
| 194 | -// MoreForYouView() | ||
| 195 | -// } | ||
| 196 | -//} |
| 1 | -// | ||
| 2 | -// MoreForYouViewInterface.swift | ||
| 3 | -// WarplySDKFrameworkIOS | ||
| 4 | -// | ||
| 5 | -// Created by Βασιλης Σκουρας on 20/4/22. | ||
| 6 | -// | ||
| 7 | - | ||
| 8 | -import Foundation | ||
| 9 | -import SwiftUI | ||
| 10 | - | ||
| 11 | -@available(iOS 13.0.0, *) | ||
| 12 | -@objc public class MoreForYouViewInterface : NSObject { | ||
| 13 | - | ||
| 14 | - @objc(moreForYouViewController:) static public func moreForYouViewController(parentView: UIView?) -> UIViewController { | ||
| 15 | - return UIHostingController(rootView: MoreForYouView(parentView: parentView!)) | ||
| 16 | - } | ||
| 17 | - | ||
| 18 | -} |
| ... | @@ -37,18 +37,18 @@ CMPedometer *pedometer; | ... | @@ -37,18 +37,18 @@ CMPedometer *pedometer; |
| 37 | NSURLCache *sharedCache = [[NSURLCache alloc] initWithMemoryCapacity:cacheSizeMemory diskCapacity:cacheSizeDisk diskPath:@"nsurlcache"]; | 37 | NSURLCache *sharedCache = [[NSURLCache alloc] initWithMemoryCapacity:cacheSizeMemory diskCapacity:cacheSizeDisk diskPath:@"nsurlcache"]; |
| 38 | [NSURLCache setSharedURLCache:sharedCache]; | 38 | [NSURLCache setSharedURLCache:sharedCache]; |
| 39 | 39 | ||
| 40 | - date = [NSDate date]; | 40 | +// date = [NSDate date]; |
| 41 | - if ([CMPedometer isStepCountingAvailable]) { | 41 | +// if ([CMPedometer isStepCountingAvailable]) { |
| 42 | - pedometer = [[CMPedometer alloc] init]; | 42 | +// pedometer = [[CMPedometer alloc] init]; |
| 43 | - [NSTimer scheduledTimerWithTimeInterval:0.5f | 43 | +// [NSTimer scheduledTimerWithTimeInterval:0.5f |
| 44 | - target:self | 44 | +// target:self |
| 45 | - selector:@selector(recursiveQuery) | 45 | +// selector:@selector(recursiveQuery) |
| 46 | - userInfo:nil | 46 | +// userInfo:nil |
| 47 | - repeats:YES]; | 47 | +// repeats:YES]; |
| 48 | - } else { | 48 | +// } else { |
| 49 | - NSLog(@"Nothing available"); | 49 | +// NSLog(@"Nothing available"); |
| 50 | - | 50 | +// |
| 51 | - } | 51 | +// } |
| 52 | } | 52 | } |
| 53 | 53 | ||
| 54 | - (void)queryDataFrom:(NSDate *)startDate toDate:(NSDate *)endDate { | 54 | - (void)queryDataFrom:(NSDate *)startDate toDate:(NSDate *)endDate { | ... | ... |
| 1 | -// | ||
| 2 | -// OldCouponsView.swift | ||
| 3 | -// WarplySDKFrameworkIOS | ||
| 4 | -// | ||
| 5 | -// Created by Manos Chorianopoulos on 28/4/22. | ||
| 6 | -// | ||
| 7 | - | ||
| 8 | -#if canImport(SwiftUI) | ||
| 9 | -import SwiftUI | ||
| 10 | -import Combine | ||
| 11 | -import Foundation | ||
| 12 | -import UIKit | ||
| 13 | - | ||
| 14 | - | ||
| 15 | -extension OldCouponsView { | ||
| 16 | - struct headerView: View { | ||
| 17 | - var goBack: () -> () | ||
| 18 | - | ||
| 19 | - var uiscreen = UIScreen.main.bounds | ||
| 20 | - | ||
| 21 | - var body: some View { | ||
| 22 | - HStack(alignment: .center) { | ||
| 23 | - Button { | ||
| 24 | - // Button Action | ||
| 25 | - print("Back Button tapped!") | ||
| 26 | - goBack() | ||
| 27 | - } label: { | ||
| 28 | - Image("ic_back", bundle: Bundle(for: MyEmptyClass.self)) | ||
| 29 | - .resizable() | ||
| 30 | - .aspectRatio(contentMode: .fit) | ||
| 31 | - .frame(width: self.uiscreen.height * 0.025, height: self.uiscreen.height * 0.02) | ||
| 32 | - } | ||
| 33 | - | ||
| 34 | - Text("Παλαιότερα κουπόνια") | ||
| 35 | - .fontWeight(.medium) | ||
| 36 | - .font(.system(size: 16)) | ||
| 37 | - .foregroundColor(Color(red: 0.20784313725490197, green: 0.3176470588235294, blue: 0.40784313725490196)) | ||
| 38 | - .multilineTextAlignment(.center) | ||
| 39 | - .frame(maxWidth: .infinity) | ||
| 40 | - .padding(.horizontal) | ||
| 41 | - | ||
| 42 | - Button { | ||
| 43 | - // Button Action | ||
| 44 | - print("Wallet tapped!") | ||
| 45 | - } label: { | ||
| 46 | - Image("ic_wallet", bundle: Bundle(for: MyEmptyClass.self)) | ||
| 47 | - .resizable() | ||
| 48 | - .aspectRatio(contentMode: .fit) | ||
| 49 | - .frame(width: self.uiscreen.height * 0.04, height: self.uiscreen.height * 0.04) | ||
| 50 | - } | ||
| 51 | - } | ||
| 52 | - .frame(maxWidth: .infinity) | ||
| 53 | - .padding(.horizontal) | ||
| 54 | - .padding(.vertical, 10) | ||
| 55 | - } | ||
| 56 | - } | ||
| 57 | - | ||
| 58 | - struct ImageView: View { | ||
| 59 | - @ObservedObject var imageLoader:UrlImageModel | ||
| 60 | - @State var width:CGFloat | ||
| 61 | - @State var isFill:Bool | ||
| 62 | - | ||
| 63 | - var uiscreen = UIScreen.main.bounds | ||
| 64 | - | ||
| 65 | - init(withURL url:String , width:CGFloat, isFill:Bool) { | ||
| 66 | - imageLoader = UrlImageModel(urlString:url) | ||
| 67 | - self.width = width | ||
| 68 | - self.isFill = isFill | ||
| 69 | - } | ||
| 70 | - | ||
| 71 | - var body: some View { | ||
| 72 | - | ||
| 73 | - Image(uiImage: imageLoader.image ?? UIImage()) | ||
| 74 | - .resizable() | ||
| 75 | - .aspectRatio(contentMode: isFill ? .fill : .fit) | ||
| 76 | - .frame(width: self.width) | ||
| 77 | - .frame(maxHeight: .infinity) | ||
| 78 | - } | ||
| 79 | - } | ||
| 80 | - | ||
| 81 | - struct couponItemView: View { | ||
| 82 | - var item: swiftApi.CouponItemModel | ||
| 83 | - var parentView: UIView | ||
| 84 | - | ||
| 85 | - var uiscreen = UIScreen.main.bounds | ||
| 86 | - | ||
| 87 | - var body: some View { | ||
| 88 | -// let couponData = item["coupon_data"] as? [String: Any] ?? ["":""] | ||
| 89 | - let couponSetData = item.couponset_data | ||
| 90 | - | ||
| 91 | - Button { | ||
| 92 | - // Coupon Action | ||
| 93 | - print("Coupon tapped!") | ||
| 94 | -// let instanceOfMyApi = MyApi() | ||
| 95 | -// let couponBarcodeViewController = instanceOfMyApi.openCouponBarcode(parentView, coupon: item as! [String : Any])! | ||
| 96 | -// couponBarcodeViewController.view.tag = 7 | ||
| 97 | -//// addChild(couponsViewController) | ||
| 98 | -// couponBarcodeViewController.view.frame = parentView.frame | ||
| 99 | -// parentView.addSubview(couponBarcodeViewController.view) | ||
| 100 | -// couponBarcodeViewController.didMove(toParent: UIHostingController(rootView: self)) | ||
| 101 | - } label: { | ||
| 102 | - | ||
| 103 | - HStack(alignment: .center) { | ||
| 104 | - | ||
| 105 | - ImageView(withURL: couponSetData?.img_preview ?? "", width: self.uiscreen.width * 0.15, isFill: false) | ||
| 106 | - | ||
| 107 | - VLine() | ||
| 108 | - .stroke(style: StrokeStyle(lineWidth: 1, dash: [5])) | ||
| 109 | - .foregroundColor(Color(red: 0.4392156862745098, green: 0.4392156862745098, blue: 0.4392156862745098)) | ||
| 110 | - .frame(width: 1) | ||
| 111 | - .padding(.leading, 10) | ||
| 112 | - | ||
| 113 | - VStack(alignment: .leading, spacing: 5.0) { | ||
| 114 | - Text(couponSetData?.name ?? "") | ||
| 115 | - .fontWeight(.medium) | ||
| 116 | - .font(.system(size: 16)) | ||
| 117 | - .foregroundColor(Color(red: 0.22745098039215686, green: 0.3215686274509804, blue: 0.4)) | ||
| 118 | - .multilineTextAlignment(.leading) | ||
| 119 | -// .lineLimit(1) | ||
| 120 | - | ||
| 121 | - HStack(alignment: .center) { | ||
| 122 | - Text((item.discount ?? "")+"€") | ||
| 123 | - .fontWeight(.bold) | ||
| 124 | - .font(.system(size: 35)) | ||
| 125 | - .foregroundColor(Color(red: 0.22745098039215686, green: 0.3215686274509804, blue: 0.4)) | ||
| 126 | - .multilineTextAlignment(.leading) | ||
| 127 | - .lineLimit(1) | ||
| 128 | - | ||
| 129 | -// Text(couponSetData?.short_description ?? "") | ||
| 130 | -// .fontWeight(.medium) | ||
| 131 | -// .font(.system(size: 11)) | ||
| 132 | -// .foregroundColor(Color(red: 0.3803921568627451, green: 0.44313725490196076, blue: 0.5058823529411764)) | ||
| 133 | -// .multilineTextAlignment(.leading) | ||
| 134 | -// .lineLimit(3) | ||
| 135 | - } | ||
| 136 | - | ||
| 137 | - Text("Εξαργυρώθηκε την " + (item.expiration ?? "")) | ||
| 138 | - .fontWeight(.medium) | ||
| 139 | - .font(.system(size: 11)) | ||
| 140 | - .foregroundColor(Color(red: 0.3803921568627451, green: 0.44313725490196076, blue: 0.5058823529411764)) | ||
| 141 | - .multilineTextAlignment(.leading) | ||
| 142 | - } | ||
| 143 | - .padding(.all, 10) | ||
| 144 | - | ||
| 145 | - Spacer() | ||
| 146 | - | ||
| 147 | - } | ||
| 148 | - .padding(.leading, 28) | ||
| 149 | - .padding(.trailing) | ||
| 150 | - } | ||
| 151 | - .frame(width: self.uiscreen.width * 0.9, height: self.uiscreen.height * 0.14) | ||
| 152 | -// .cornerRadius(5) | ||
| 153 | -// .shadow(color: Color(red: 0, green: 0, blue: 0, opacity: 0.16), radius: 30, x: 0, y: 3) | ||
| 154 | - .background( | ||
| 155 | - Image("coupon_bg", bundle: Bundle(for: MyEmptyClass.self)) | ||
| 156 | - .resizable(resizingMode: .stretch) | ||
| 157 | - .frame(maxWidth: .infinity, maxHeight: .infinity) | ||
| 158 | - .colorMultiply(Color(red: 0.8901960784313725, green: 0.8901960784313725, blue: 0.8901960784313725)) | ||
| 159 | - ) | ||
| 160 | - } | ||
| 161 | - } | ||
| 162 | - | ||
| 163 | - struct VLine: Shape { | ||
| 164 | - func path(in rect: CGRect) -> Path { | ||
| 165 | - Path { path in | ||
| 166 | - path.move(to: CGPoint(x: rect.midX, y: rect.minY)) | ||
| 167 | - path.addLine(to: CGPoint(x: rect.midX, y: rect.maxY)) | ||
| 168 | - } | ||
| 169 | - } | ||
| 170 | - } | ||
| 171 | - | ||
| 172 | - struct couponsContainer: View { | ||
| 173 | - @State var coupons:Array<swiftApi.CouponItemModel> = [] | ||
| 174 | - @State var parentView:UIView | ||
| 175 | - | ||
| 176 | - var uiscreen = UIScreen.main.bounds | ||
| 177 | - | ||
| 178 | -// static func convertDateFormat(inputDate: String) -> String { | ||
| 179 | -// let dateFormatter = DateFormatter() | ||
| 180 | -// dateFormatter.dateFormat = "yyyy-MM-dd hh:mm:ss" | ||
| 181 | -// if let date = dateFormatter.date(from: inputDate) { | ||
| 182 | -// dateFormatter.dateFormat = "dd/MM/yyyy" | ||
| 183 | -// let resultString = dateFormatter.string(from: date) | ||
| 184 | -// return resultString | ||
| 185 | -// } else { | ||
| 186 | -// return "" | ||
| 187 | -// } | ||
| 188 | -// } | ||
| 189 | - | ||
| 190 | - var body: some View { | ||
| 191 | - VStack(alignment: .center, spacing: self.uiscreen.height * 0.03) { | ||
| 192 | - | ||
| 193 | - ForEach(Array(coupons.enumerated()), id: \.offset) { index, item in | ||
| 194 | - | ||
| 195 | - couponItemView(item: item, parentView: parentView) | ||
| 196 | - } | ||
| 197 | - } | ||
| 198 | - .frame(maxWidth: .infinity) | ||
| 199 | - .padding(.top, self.uiscreen.height * 0.05) | ||
| 200 | - .padding(.bottom, self.uiscreen.height * 0.1) | ||
| 201 | - } | ||
| 202 | - } | ||
| 203 | - | ||
| 204 | -} | ||
| 205 | - | ||
| 206 | -@available(iOS 13.0.0, *) | ||
| 207 | -struct OldCouponsView: View { | ||
| 208 | - var parentView: UIView | ||
| 209 | - | ||
| 210 | - var coupons:Array<swiftApi.CouponItemModel> = [] | ||
| 211 | - | ||
| 212 | - var uiscreen = UIScreen.main.bounds | ||
| 213 | - | ||
| 214 | - | ||
| 215 | - init(parentView: UIView) { //initializer method | ||
| 216 | - | ||
| 217 | - let instanceOfMySwiftApi = swiftApi() | ||
| 218 | - let couponsData = instanceOfMySwiftApi.getOldCoupons() | ||
| 219 | - | ||
| 220 | - self.coupons = couponsData | ||
| 221 | - self.parentView = parentView | ||
| 222 | - } | ||
| 223 | - | ||
| 224 | - func goBack(){ | ||
| 225 | - for subview in parentView.subviews { | ||
| 226 | - if(subview.tag == 9) { | ||
| 227 | - subview.removeFromSuperview() | ||
| 228 | - } | ||
| 229 | - } | ||
| 230 | - } | ||
| 231 | - | ||
| 232 | - var body: some View { | ||
| 233 | - VStack { | ||
| 234 | - headerView(goBack: goBack) | ||
| 235 | - | ||
| 236 | - VStack { | ||
| 237 | - ScrollView(showsIndicators: false) { | ||
| 238 | - VStack { | ||
| 239 | - | ||
| 240 | - if (coupons.count) > 0 { | ||
| 241 | - couponsContainer(coupons: coupons, parentView: parentView ) | ||
| 242 | - } | ||
| 243 | - | ||
| 244 | - } | ||
| 245 | - .frame(width:self.uiscreen.width) | ||
| 246 | - } | ||
| 247 | - .cornerRadius(30, corners: [.topLeft]) | ||
| 248 | - .frame(width:self.uiscreen.width) | ||
| 249 | - .frame(maxHeight: .infinity) | ||
| 250 | - } | ||
| 251 | - .frame(width:self.uiscreen.width) | ||
| 252 | - .frame(maxHeight: .infinity) | ||
| 253 | - .padding(.top, 5) | ||
| 254 | - .background( | ||
| 255 | - Image("coupons_scrollview", bundle: Bundle(for: MyEmptyClass.self)) | ||
| 256 | - .resizable() | ||
| 257 | - ) | ||
| 258 | - | ||
| 259 | - } | ||
| 260 | - .edgesIgnoringSafeArea([.bottom]) | ||
| 261 | - .frame(width:self.uiscreen.width) | ||
| 262 | - .frame(maxHeight: .infinity) | ||
| 263 | - } | ||
| 264 | -} | ||
| 265 | -#endif | ||
| 266 | - | ||
| 267 | -//struct OldCouponsView_Previews: PreviewProvider { | ||
| 268 | -// static var previews: some View { | ||
| 269 | -// OldCouponsView() | ||
| 270 | -// } | ||
| 271 | -//} |
| 1 | -// | ||
| 2 | -// OldCouponsViewInterface.swift | ||
| 3 | -// WarplySDKFrameworkIOS | ||
| 4 | -// | ||
| 5 | -// Created by Manos Chorianopoulos on 28/4/22. | ||
| 6 | -// | ||
| 7 | - | ||
| 8 | - | ||
| 9 | -import Foundation | ||
| 10 | -import SwiftUI | ||
| 11 | - | ||
| 12 | -@available(iOS 13.0.0, *) | ||
| 13 | -@objc public class OldCouponsViewInterface : NSObject { | ||
| 14 | - | ||
| 15 | - @objc(oldCouponsViewController:) static public func oldCouponsViewController(parentView: UIView?) -> UIViewController { | ||
| 16 | - return UIHostingController(rootView: OldCouponsView(parentView: parentView!)) | ||
| 17 | - } | ||
| 18 | - | ||
| 19 | -} |
| 1 | -// | ||
| 2 | -// StepsView.swift | ||
| 3 | -// WarplySDKFrameworkIOS | ||
| 4 | -// | ||
| 5 | -// Created by Βασιλης Σκουρας on 3/5/22. | ||
| 6 | -// | ||
| 7 | - | ||
| 8 | -#if canImport(SwiftUI) | ||
| 9 | -import SwiftUI | ||
| 10 | -import Combine | ||
| 11 | -import Foundation | ||
| 12 | -import UIKit | ||
| 13 | - | ||
| 14 | -class StepsModel { | ||
| 15 | - var steps: AnyObject | ||
| 16 | - | ||
| 17 | - init() async { //initializer method | ||
| 18 | - let instanceOfMyApi = MyApi() | ||
| 19 | - self.steps = await instanceOfMyApi.getSteps { _ in | ||
| 20 | - } as AnyObject | ||
| 21 | - print(steps) | ||
| 22 | - } | ||
| 23 | - | ||
| 24 | - var getSteps: AnyObject { | ||
| 25 | - get { // getter | ||
| 26 | - return steps | ||
| 27 | - } | ||
| 28 | - } | ||
| 29 | -} | ||
| 30 | - | ||
| 31 | -extension StepsView { | ||
| 32 | - struct headerView: View { | ||
| 33 | - var goBack: () -> () | ||
| 34 | - var uiscreen = UIScreen.main.bounds | ||
| 35 | - | ||
| 36 | - | ||
| 37 | - var body: some View { | ||
| 38 | - HStack(alignment: .center) { | ||
| 39 | - Button { | ||
| 40 | - // Button Action | ||
| 41 | - goBack() | ||
| 42 | - } label: { | ||
| 43 | - Image("ic_back", bundle: Bundle(for: MyEmptyClass.self)) | ||
| 44 | - .resizable() | ||
| 45 | - .aspectRatio(contentMode: .fit) | ||
| 46 | - .frame(width: self.uiscreen.height * 0.025, height: self.uiscreen.height * 0.02) | ||
| 47 | - } | ||
| 48 | - Spacer().frame(width: 0) | ||
| 49 | - Text("Όλα τα κουπόνια μου") | ||
| 50 | - .fontWeight(.medium) | ||
| 51 | - .font(.system(size: 16)) | ||
| 52 | - .foregroundColor(Color(red: 0.20784313725490197, green: 0.3176470588235294, blue: 0.40784313725490196)) | ||
| 53 | - .multilineTextAlignment(.center) | ||
| 54 | - .frame(maxWidth: .infinity) | ||
| 55 | - .padding(.horizontal) | ||
| 56 | - .offset(x: -self.uiscreen.height * 0.0125) | ||
| 57 | - } | ||
| 58 | - .frame(maxWidth: .infinity) | ||
| 59 | - .padding(.horizontal) | ||
| 60 | - .padding(.vertical, 10) | ||
| 61 | - } | ||
| 62 | - } | ||
| 63 | - | ||
| 64 | -} | ||
| 65 | - | ||
| 66 | -@available(iOS 13.0.0, *) | ||
| 67 | -struct StepsView: View { | ||
| 68 | - @State private var steps = "Loading" | ||
| 69 | - var parentView: UIView | ||
| 70 | - | ||
| 71 | - func getSteps() async -> AnyObject { | ||
| 72 | - return await StepsModel().getSteps | ||
| 73 | - } | ||
| 74 | - | ||
| 75 | - var uiscreen = UIScreen.main.bounds | ||
| 76 | - | ||
| 77 | - init(parentView: UIView) { //initializer method | ||
| 78 | - self.parentView = parentView | ||
| 79 | - } | ||
| 80 | - | ||
| 81 | - func goBack(){ | ||
| 82 | - for subview in parentView.subviews { | ||
| 83 | - if(subview.tag == 11) { | ||
| 84 | - subview.removeFromSuperview() | ||
| 85 | - } | ||
| 86 | - } | ||
| 87 | - } | ||
| 88 | - | ||
| 89 | - func getSteps() async -> String { | ||
| 90 | - let instanceOfMyApi = MyApi() | ||
| 91 | - let stepsData = await instanceOfMyApi.getSteps { _ in | ||
| 92 | - } as AnyObject | ||
| 93 | -// DispatchQueue.main.async { | ||
| 94 | -// steps = "" | ||
| 95 | -// } | ||
| 96 | - return "" | ||
| 97 | - } | ||
| 98 | - | ||
| 99 | - var body: some View { | ||
| 100 | - VStack { | ||
| 101 | - headerView(goBack: goBack) | ||
| 102 | - Text(steps) | ||
| 103 | - .onAppear { | ||
| 104 | - async { | ||
| 105 | - let instanceOfMyApi = MyApi() | ||
| 106 | - let stepsData = try? await instanceOfMyApi.getSteps { _ in | ||
| 107 | - } as AnyObject | ||
| 108 | - self.steps = "" | ||
| 109 | - } | ||
| 110 | - } | ||
| 111 | - | ||
| 112 | - } | ||
| 113 | - .frame(maxWidth: .infinity, maxHeight: .infinity ) | ||
| 114 | -// .frame(width:self.uiscreen.width, height:self.uiscreen.height ) | ||
| 115 | - } | ||
| 116 | -} | ||
| 117 | -#endif | ||
| 118 | - | ||
| 119 | -//@available(iOS 13.0.0, *) | ||
| 120 | -//struct Previews_CouponsView_Previews: PreviewProvider { | ||
| 121 | -// static var uiscreen = UIScreen.main.bounds | ||
| 122 | -// static var previews: some View { | ||
| 123 | -// ZStack { | ||
| 124 | -// Image("ic_back", bundle: Bundle(for: MyEmptyClass.self)) | ||
| 125 | -// .resizable() | ||
| 126 | -// .frame(width: self.uiscreen.height * 0.025, height: self.uiscreen.height * 0.02) | ||
| 127 | -// .offset(x: -self.uiscreen.width / 2 + self.uiscreen.width * 0.05, y: self.uiscreen.height * 0.07) | ||
| 128 | -// Text("Όλα τα κουπόνια μου") | ||
| 129 | -// .frame(width: self.uiscreen.width * 0.8, height: self.uiscreen.height * 0.025, alignment: .center) | ||
| 130 | -// .offset( y: self.uiscreen.height * 0.07) | ||
| 131 | -// } | ||
| 132 | -// | ||
| 133 | -// } | ||
| 134 | -//} | ||
| 135 | - |
| 1 | -// | ||
| 2 | -// StepsViewInterface.swift | ||
| 3 | -// WarplySDKFrameworkIOS | ||
| 4 | -// | ||
| 5 | -// Created by Βασιλης Σκουρας on 3/5/22. | ||
| 6 | -// | ||
| 7 | - | ||
| 8 | -import Foundation | ||
| 9 | -import SwiftUI | ||
| 10 | - | ||
| 11 | -@available(iOS 13.0.0, *) | ||
| 12 | -@objc public class StepsViewInterface : NSObject { | ||
| 13 | - | ||
| 14 | - @objc(stepsViewController:) static public func stepsViewController(parentView: UIView?) -> UIViewController { | ||
| 15 | - return UIHostingController(rootView: StepsView(parentView: parentView!)) | ||
| 16 | - } | ||
| 17 | - | ||
| 18 | -} |
| 1 | -// | ||
| 2 | -// WalletView.swift | ||
| 3 | -// WarplySDKFrameworkIOS | ||
| 4 | -// | ||
| 5 | -// Created by Βασιλης Σκουρας on 20/4/22. | ||
| 6 | -// | ||
| 7 | - | ||
| 8 | -import SwiftUI | ||
| 9 | - | ||
| 10 | -class ProfileDataModel { | ||
| 11 | - var data: NSDictionary | ||
| 12 | - | ||
| 13 | - init() { //initializer method | ||
| 14 | - let instanceOfMyApi = MyApi() | ||
| 15 | - let profile = instanceOfMyApi.getProfile() | ||
| 16 | - var profileData = NSDictionary() | ||
| 17 | - if let profileDictionary = profile as? [String : AnyObject] { | ||
| 18 | - profileData = (profileDictionary["result"] as! NSDictionary) | ||
| 19 | - } | ||
| 20 | - self.data = profileData | ||
| 21 | - } | ||
| 22 | - | ||
| 23 | - var getData: NSDictionary { | ||
| 24 | - get { // getter | ||
| 25 | - return data | ||
| 26 | - } | ||
| 27 | - } | ||
| 28 | -} | ||
| 29 | - | ||
| 30 | -extension WalletView { | ||
| 31 | - | ||
| 32 | - static func localizedWithParameter(parameter: String) -> LocalizedStringKey { | ||
| 33 | - return "\(parameter)" | ||
| 34 | - } | ||
| 35 | - | ||
| 36 | - struct headerView: View { | ||
| 37 | - var goBack: () -> () | ||
| 38 | - var uiscreen = UIScreen.main.bounds | ||
| 39 | - | ||
| 40 | - | ||
| 41 | - var body: some View { | ||
| 42 | - HStack(alignment: .center) { | ||
| 43 | - Button { | ||
| 44 | - // Button Action | ||
| 45 | - goBack() | ||
| 46 | - } label: { | ||
| 47 | - Image("ic_back", bundle: Bundle(for: MyEmptyClass.self)) | ||
| 48 | - .resizable() | ||
| 49 | - .aspectRatio(contentMode: .fit) | ||
| 50 | - .frame(width: self.uiscreen.height * 0.025, height: self.uiscreen.height * 0.02) | ||
| 51 | - } | ||
| 52 | - Spacer().frame(width: 0) | ||
| 53 | - Text("My loyalty wallet") | ||
| 54 | - .fontWeight(.medium) | ||
| 55 | - .font(.system(size: 16)) | ||
| 56 | - .foregroundColor(Color(red: 0.20784313725490197, green: 0.3176470588235294, blue: 0.40784313725490196)) | ||
| 57 | - .multilineTextAlignment(.center) | ||
| 58 | - .frame(maxWidth: .infinity) | ||
| 59 | - .padding(.horizontal) | ||
| 60 | - .offset(x: -self.uiscreen.height * 0.0125) | ||
| 61 | - } | ||
| 62 | - .frame(maxWidth: .infinity) | ||
| 63 | - .padding(.horizontal) | ||
| 64 | - .padding(.vertical, 10) | ||
| 65 | - } | ||
| 66 | - } | ||
| 67 | - | ||
| 68 | - struct ImageView: View { | ||
| 69 | - @ObservedObject var imageLoader:UrlImageModel | ||
| 70 | - @State var width:CGFloat | ||
| 71 | - @State var height:CGFloat | ||
| 72 | - @State var isFill:Bool | ||
| 73 | - | ||
| 74 | - var uiscreen = UIScreen.main.bounds | ||
| 75 | - | ||
| 76 | - init(withURL url:String , width:CGFloat, height: CGFloat, isFill:Bool) { | ||
| 77 | - imageLoader = UrlImageModel(urlString:url) | ||
| 78 | - self.width = width | ||
| 79 | - self.height = height | ||
| 80 | - self.isFill = isFill | ||
| 81 | - } | ||
| 82 | - | ||
| 83 | - var body: some View { | ||
| 84 | - | ||
| 85 | - Image(uiImage: imageLoader.image ?? UIImage()) | ||
| 86 | - .resizable() | ||
| 87 | - .frame(minWidth: self.uiscreen.width * 0.95, idealWidth: self.uiscreen.width * 0.95, maxWidth: self.uiscreen.width * 0.95, minHeight: self.uiscreen.height * 0.2, idealHeight: self.uiscreen.height * 0.2, maxHeight: self.uiscreen.height * 0.2, alignment: .leading) | ||
| 88 | - .scaledToFill() | ||
| 89 | - .aspectRatio(contentMode: isFill ? .fill : .fit) | ||
| 90 | - .cornerRadius(4) | ||
| 91 | - } | ||
| 92 | - } | ||
| 93 | - | ||
| 94 | - struct myCoupons: View { | ||
| 95 | - var uiscreen = UIScreen.main.bounds | ||
| 96 | - | ||
| 97 | - @State var parentView:UIView | ||
| 98 | - | ||
| 99 | - var instanceOfMySwiftApi = swiftApi() | ||
| 100 | -// var couponsLength = instanceOfMySwiftApi.getCoupons().filter({ $0.status! == 1 }).count | ||
| 101 | - var body: some View { | ||
| 102 | - VStack { | ||
| 103 | - HStack { | ||
| 104 | - Text("My coupons") | ||
| 105 | - .font(.system(size: 18)) | ||
| 106 | - .foregroundColor(Color.white) | ||
| 107 | - .fontWeight(.medium) | ||
| 108 | - Spacer() | ||
| 109 | - Button { | ||
| 110 | - let instanceOfMyApi = MyApi() | ||
| 111 | - let oldCouponsView = instanceOfMyApi.openOldCoupons(parentView)! | ||
| 112 | - oldCouponsView.view.tag = 9 | ||
| 113 | - oldCouponsView.view.frame = parentView.frame | ||
| 114 | - parentView.addSubview(oldCouponsView.view) | ||
| 115 | - } label: { | ||
| 116 | - Text("Παλαιότερα κουπόνια ->") | ||
| 117 | - .font(.system(size: 14)) | ||
| 118 | - .foregroundColor(Color.white) | ||
| 119 | - .fontWeight(.medium) | ||
| 120 | - } | ||
| 121 | - } | ||
| 122 | - .padding(.leading, self.uiscreen.width * 0.05) | ||
| 123 | - .padding(.trailing, self.uiscreen.width * 0.05) | ||
| 124 | - HStack { | ||
| 125 | - VStack { | ||
| 126 | - Spacer() | ||
| 127 | - Text(.init("Έχεις **" + String(instanceOfMySwiftApi.getCoupons().filter({ $0.status! == 1 }).count) + "** ενεργά κουπόνια")) | ||
| 128 | - .frame(width: self.uiscreen.width * 0.35, alignment: .leading) | ||
| 129 | - .font(.system(size: 17)) | ||
| 130 | - Spacer() | ||
| 131 | - Button { | ||
| 132 | - let instanceOfMyApi = MyApi() | ||
| 133 | - let couponsView = instanceOfMyApi.openCoupons(parentView)! | ||
| 134 | - couponsView.view.tag = 1 | ||
| 135 | - couponsView.view.frame = parentView.frame | ||
| 136 | - parentView.addSubview(couponsView.view) | ||
| 137 | - } label: { | ||
| 138 | - Text("Δες τα όλα ->") | ||
| 139 | - .font(.system(size: 12)) | ||
| 140 | - .fontWeight(.medium) | ||
| 141 | - .frame(width: self.uiscreen.width * 0.35, alignment: .leading) | ||
| 142 | - } | ||
| 143 | - Spacer() | ||
| 144 | - } | ||
| 145 | - .padding(.leading, self.uiscreen.width * 0.1) | ||
| 146 | - Spacer() | ||
| 147 | - Image("ic_gifts_for_you", bundle: Bundle(for: MyEmptyClass.self)) | ||
| 148 | - .frame(width: self.uiscreen.height * 0.08, height: self.uiscreen.height * 0.1) | ||
| 149 | - .padding(.trailing, self.uiscreen.width * 0.08) | ||
| 150 | - } | ||
| 151 | - .padding(.top, self.uiscreen.height * 0.01) | ||
| 152 | - .padding(.bottom, self.uiscreen.height * 0.01) | ||
| 153 | - .background( | ||
| 154 | - Image("coupons_container", bundle: Bundle(for: MyEmptyClass.self)) | ||
| 155 | - .resizable() | ||
| 156 | - .frame(minWidth: self.uiscreen.width * 0.975, idealWidth: self.uiscreen.width * 0.975, maxWidth: self.uiscreen.width * 0.975) | ||
| 157 | - .scaledToFill() | ||
| 158 | - .aspectRatio(contentMode: .fill) | ||
| 159 | - ) | ||
| 160 | - .frame(width: self.uiscreen.width * 0.975) | ||
| 161 | - } | ||
| 162 | - .padding(.top, self.uiscreen.height * 0.025) | ||
| 163 | - .padding(.bottom, self.uiscreen.height * 0.025) | ||
| 164 | - .frame(width: self.uiscreen.width) | ||
| 165 | - .background(Color(hex: 0xFFFFFF).opacity(0.13)) | ||
| 166 | - } | ||
| 167 | - } | ||
| 168 | - | ||
| 169 | - struct myRewards: View { | ||
| 170 | - var uiscreen = UIScreen.main.bounds | ||
| 171 | - | ||
| 172 | - @State var parentView:UIView | ||
| 173 | - | ||
| 174 | - var instanceOfMySwiftApi = swiftApi() | ||
| 175 | - | ||
| 176 | - var body: some View { | ||
| 177 | - Button { | ||
| 178 | - let instanceOfMyApi = MyApi() | ||
| 179 | - let allGiftsViewController = instanceOfMyApi.openAllGifts(parentView)! | ||
| 180 | - allGiftsViewController.view.tag = 8 | ||
| 181 | - allGiftsViewController.view.frame = parentView.frame | ||
| 182 | - parentView.addSubview(allGiftsViewController.view) | ||
| 183 | - } label: { | ||
| 184 | - VStack { | ||
| 185 | - HStack { | ||
| 186 | - Text("My rewards") | ||
| 187 | - .font(.system(size: 18)) | ||
| 188 | - .foregroundColor(Color.white) | ||
| 189 | - .fontWeight(.medium) | ||
| 190 | - Spacer() | ||
| 191 | - Text("Παλαιότερα δώρα ->") | ||
| 192 | - .font(.system(size: 14)) | ||
| 193 | - .foregroundColor(Color.white) | ||
| 194 | - .fontWeight(.medium) | ||
| 195 | - } | ||
| 196 | - .padding(.leading, self.uiscreen.width * 0.05) | ||
| 197 | - .padding(.trailing, self.uiscreen.width * 0.05) | ||
| 198 | - HStack { | ||
| 199 | - VStack { | ||
| 200 | - Spacer() | ||
| 201 | - Text(.init("Έχεις **" + String(instanceOfMySwiftApi.getCoupons().filter({ $0.status! == 1 }).count) + "** ενεργά δώρα")) | ||
| 202 | - .frame(width: self.uiscreen.width * 0.35, alignment: .leading) | ||
| 203 | - .font(.system(size: 17)) | ||
| 204 | - Spacer() | ||
| 205 | - Text("Δες τα όλα ->") | ||
| 206 | - .font(.system(size: 12)) | ||
| 207 | - .fontWeight(.medium) | ||
| 208 | - .frame(width: self.uiscreen.width * 0.35, alignment: .leading) | ||
| 209 | - Spacer() | ||
| 210 | - } | ||
| 211 | - .padding(.leading, self.uiscreen.width * 0.1) | ||
| 212 | - Spacer() | ||
| 213 | - Image("ic_loyalty_rewards", bundle: Bundle(for: MyEmptyClass.self)) | ||
| 214 | - .resizable() | ||
| 215 | - .frame(width: self.uiscreen.height * 0.08, height: self.uiscreen.height * 0.08) | ||
| 216 | - .padding(.trailing, self.uiscreen.width * 0.08) | ||
| 217 | - } | ||
| 218 | - .padding(.top, self.uiscreen.height * 0.02) | ||
| 219 | - .padding(.bottom, self.uiscreen.height * 0.02) | ||
| 220 | - .frame(width: self.uiscreen.width * 0.975) | ||
| 221 | - .background(Color.white) | ||
| 222 | - } | ||
| 223 | - .padding(.top, self.uiscreen.height * 0.025) | ||
| 224 | - .padding(.bottom, self.uiscreen.height * 0.025) | ||
| 225 | - .frame(width: self.uiscreen.width) | ||
| 226 | - .background(Color(hex: 0xFFFFFF).opacity(0.13)) | ||
| 227 | - .padding(.top, self.uiscreen.height * 0.02) | ||
| 228 | - } | ||
| 229 | - } | ||
| 230 | - } | ||
| 231 | - | ||
| 232 | - struct linearView: View { | ||
| 233 | - var data: NSDictionary | ||
| 234 | - | ||
| 235 | - var uiscreen = UIScreen.main.bounds | ||
| 236 | - | ||
| 237 | - @State var parentView:UIView | ||
| 238 | - | ||
| 239 | - var body: some View { | ||
| 240 | - VStack{ | ||
| 241 | - HStack { | ||
| 242 | - VStack(alignment: .leading) { | ||
| 243 | - Text("Ενεργός κωδικός:") | ||
| 244 | - .font(.system(size: 17)) | ||
| 245 | - .fontWeight(.medium) | ||
| 246 | - .foregroundColor(Color(hex: 0x3C5365)) | ||
| 247 | - Text("961544809") | ||
| 248 | - .font(.system(size: 17)) | ||
| 249 | - .fontWeight(.bold) | ||
| 250 | - .foregroundColor(Color(hex: 0x3C5365)) | ||
| 251 | - Text("Λήγει σε 4 ημέρες") | ||
| 252 | - .font(.system(size: 11)) | ||
| 253 | - .fontWeight(.medium) | ||
| 254 | - .foregroundColor(Color(hex: 0x84929E)) | ||
| 255 | - } | ||
| 256 | - Spacer() | ||
| 257 | - Image("deals_for_you", bundle: Bundle(for: MyEmptyClass.self)) | ||
| 258 | - .resizable() | ||
| 259 | - .frame(width: self.uiscreen.height * 0.08, height: self.uiscreen.height * 0.08) | ||
| 260 | - .padding(.top, self.uiscreen.height * 0.01) | ||
| 261 | - .padding(.bottom, self.uiscreen.height * 0.01) | ||
| 262 | - } | ||
| 263 | - .padding(.leading, self.uiscreen.width * 0.04) | ||
| 264 | - .padding(.trailing, self.uiscreen.width * 0.04) | ||
| 265 | - .frame(width: self.uiscreen.width * 0.975, alignment: .leading) | ||
| 266 | - .background(Color.white) | ||
| 267 | - .cornerRadius(3) | ||
| 268 | - .padding(.top, self.uiscreen.height * 0.04) | ||
| 269 | - .padding(.bottom, self.uiscreen.height * 0.04) | ||
| 270 | - myCoupons(parentView: parentView) | ||
| 271 | - myRewards(parentView: parentView) | ||
| 272 | - HStack { | ||
| 273 | - Text("Ανάλυση") | ||
| 274 | - .font(.system(size: 14)) | ||
| 275 | - .fontWeight(.medium) | ||
| 276 | - .foregroundColor(Color(hex: 0x509E2F)) | ||
| 277 | - .padding(.top, self.uiscreen.height * 0.015) | ||
| 278 | - .padding(.bottom, self.uiscreen.height * 0.015) | ||
| 279 | - } | ||
| 280 | - .frame(width: self.uiscreen.width * 0.925) | ||
| 281 | - .background(Color(hex: 0xE6E6E6)) | ||
| 282 | - .padding(.top, self.uiscreen.height * 0.02) | ||
| 283 | - .padding(.bottom, self.uiscreen.height * 0.03) | ||
| 284 | - | ||
| 285 | - } | ||
| 286 | - .frame(width: self.uiscreen.width, alignment: .center) | ||
| 287 | - .background( | ||
| 288 | - LinearGradient(gradient: Gradient(colors: [Color(hex: 0x1AADCC), Color(hex: 0x83C062)]), startPoint: .top, endPoint: .bottom) | ||
| 289 | - ) | ||
| 290 | - .cornerRadius(15, corners: [.topLeft]) | ||
| 291 | - } | ||
| 292 | - } | ||
| 293 | -} | ||
| 294 | - | ||
| 295 | -struct WalletView: View { | ||
| 296 | - var parentView: UIView | ||
| 297 | - | ||
| 298 | - var uiscreen = UIScreen.main.bounds | ||
| 299 | - | ||
| 300 | - var data: NSDictionary = ProfileDataModel().getData | ||
| 301 | - | ||
| 302 | - func goBack(){ | ||
| 303 | - for subview in parentView.subviews { | ||
| 304 | - if(subview.tag == 3) { | ||
| 305 | - subview.removeFromSuperview() | ||
| 306 | - } | ||
| 307 | - } | ||
| 308 | - } | ||
| 309 | - | ||
| 310 | - var body: some View { | ||
| 311 | - VStack { | ||
| 312 | - headerView(goBack: goBack) | ||
| 313 | - HStack { | ||
| 314 | - ZStack { | ||
| 315 | - if let value = (data["result"] as? String) { | ||
| 316 | - ImageView(withURL: value, width: self.uiscreen.height * 0.05, height: self.uiscreen.height * 0.05, isFill: true) | ||
| 317 | - .cornerRadius(self.uiscreen.height * 0.05) | ||
| 318 | - .padding(.leading, self.uiscreen.width * 0.05) | ||
| 319 | - | ||
| 320 | - } else { | ||
| 321 | - Image("generic_profile") | ||
| 322 | - .frame(width: self.uiscreen.height * 0.05, height: self.uiscreen.height * 0.05) | ||
| 323 | - .background(Color.black) | ||
| 324 | - .cornerRadius(self.uiscreen.height * 0.05) | ||
| 325 | - .padding(.leading, self.uiscreen.width * 0.05) | ||
| 326 | - } | ||
| 327 | - Circle() | ||
| 328 | - .strokeBorder(Color(hex: 0x22A9B5), lineWidth: 1) | ||
| 329 | - .frame(width: self.uiscreen.height * 0.05, height: self.uiscreen.height * 0.05) | ||
| 330 | - .padding(.leading, self.uiscreen.width * 0.05) | ||
| 331 | - } | ||
| 332 | - VStack(alignment: .leading) { | ||
| 333 | - Text(WalletView.localizedWithParameter(parameter: data["firstname"] as! String + " " + (data["lastname"] as! String))) | ||
| 334 | - .font(.system(size: 13)) | ||
| 335 | - .padding(.top, self.uiscreen.height * 0.005) | ||
| 336 | - .frame(width: self.uiscreen.width * 0.7, alignment: .leading) | ||
| 337 | - Spacer() | ||
| 338 | - if let value = (data["profile_metadata"] as? NSDictionary) { | ||
| 339 | - if ((value["answered"] != nil) == true) { | ||
| 340 | - VStack { | ||
| 341 | - } | ||
| 342 | - .background( | ||
| 343 | - LinearGradient(gradient: Gradient(colors: [Color(hex: 0x1AADCC), Color(hex: 0x83C062)]), startPoint: .trailing, endPoint: .leading) | ||
| 344 | - ) | ||
| 345 | - } | ||
| 346 | - } else { | ||
| 347 | - HStack { | ||
| 348 | - Text("+") | ||
| 349 | - .font(.system(size: 17)) | ||
| 350 | - .padding(.bottom, 2) | ||
| 351 | - Text("Ερωτηματολόγιο") | ||
| 352 | - .font(.system(size: 13)) | ||
| 353 | - .fontWeight(.medium) | ||
| 354 | - } | ||
| 355 | - .padding(.leading, 5) | ||
| 356 | - .padding(.trailing, 5) | ||
| 357 | - .overlay( | ||
| 358 | - RoundedRectangle(cornerRadius: 16).stroke(Color(hex: 0x556778), lineWidth: 1) | ||
| 359 | - ) | ||
| 360 | - .padding(.bottom, self.uiscreen.height * 0.005) | ||
| 361 | - } | ||
| 362 | - } | ||
| 363 | - .padding(.leading , self.uiscreen.width * 0.025) | ||
| 364 | - } | ||
| 365 | - .frame(width: self.uiscreen.width, height: self.uiscreen.height * 0.06, alignment: .leading) | ||
| 366 | - .padding(.top, self.uiscreen.height * 0.04) | ||
| 367 | - .padding(.bottom, self.uiscreen.height * 0.02) | ||
| 368 | - ScrollView(showsIndicators: false) { | ||
| 369 | - linearView(data: data, parentView: parentView) | ||
| 370 | - } | ||
| 371 | - .frame(maxWidth: .infinity, maxHeight: .infinity) | ||
| 372 | - .edgesIgnoringSafeArea([.bottom]) | ||
| 373 | - | ||
| 374 | - } | ||
| 375 | - .frame(maxWidth: .infinity, maxHeight: .infinity ) | ||
| 376 | - // .frame(width:self.uiscreen.width, height:self.uiscreen.height ) | ||
| 377 | - } | ||
| 378 | -} | ||
| 379 | - | ||
| 380 | -//struct WalletView_Previews: PreviewProvider { | ||
| 381 | -// static var previews: some View { | ||
| 382 | -// WalletView() | ||
| 383 | -// } | ||
| 384 | -//} |
| 1 | -// | ||
| 2 | -// WalletViewInterface.swift | ||
| 3 | -// WarplySDKFrameworkIOS | ||
| 4 | -// | ||
| 5 | -// Created by Βασιλης Σκουρας on 20/4/22. | ||
| 6 | -// | ||
| 7 | - | ||
| 8 | -import Foundation | ||
| 9 | -import SwiftUI | ||
| 10 | - | ||
| 11 | -@available(iOS 13.0.0, *) | ||
| 12 | -@objc public class WalletViewInterface : NSObject { | ||
| 13 | - | ||
| 14 | - @objc(walletViewController:) static public func walletViewController(parentView: UIView?) -> UIViewController { | ||
| 15 | - return UIHostingController(rootView: WalletView(parentView: parentView!)) | ||
| 16 | - } | ||
| 17 | - | ||
| 18 | -} |
-
Please register or login to post a comment