From 3f9e59c2c8396b053565efa1d326946e5b48d922 Mon Sep 17 00:00:00 2001 From: Andrey Chukavin Date: Fri, 5 May 2023 17:55:30 +0400 Subject: [PATCH 1/7] IOS-3575 Added a way to show an image in the ReadView --- TangemSdk/TangemSdk/UI/TangemSdkStyle.swift | 9 +++++++++ .../TangemSdk/UI/Views/Scan/CardView.swift | 1 + .../TangemSdk/UI/Views/Scan/ReadView.swift | 20 +++++++++++++++---- 3 files changed, 26 insertions(+), 4 deletions(-) diff --git a/TangemSdk/TangemSdk/UI/TangemSdkStyle.swift b/TangemSdk/TangemSdk/UI/TangemSdkStyle.swift index 418b85da2..f71fbace0 100644 --- a/TangemSdk/TangemSdk/UI/TangemSdkStyle.swift +++ b/TangemSdk/TangemSdk/UI/TangemSdkStyle.swift @@ -14,10 +14,19 @@ public class TangemSdkStyle: ObservableObject { public var colors: Colors = .default public var textSizes: TextSizes = .default public var indicatorWidth: Float = 12 + public var readViewTag: ReadViewTag = .genericCard public static var `default`: TangemSdkStyle = .init() } +@available(iOS 13.0, *) +public extension TangemSdkStyle { + enum ReadViewTag { + case genericCard + case image(name: String, verticalOffset: Double, bundle: Bundle) + } +} + @available(iOS 13.0, *) public extension TangemSdkStyle { struct Colors { diff --git a/TangemSdk/TangemSdk/UI/Views/Scan/CardView.swift b/TangemSdk/TangemSdk/UI/Views/Scan/CardView.swift index 28defc716..39144cad7 100644 --- a/TangemSdk/TangemSdk/UI/Views/Scan/CardView.swift +++ b/TangemSdk/TangemSdk/UI/Views/Scan/CardView.swift @@ -17,6 +17,7 @@ struct CardView: View { RoundedRectangle(cornerRadius: 10) .fill(cardColor) .overlay(overlay) + .aspectRatio(CGSize(width: 210, height: 130), contentMode: .fit) } @ViewBuilder diff --git a/TangemSdk/TangemSdk/UI/Views/Scan/ReadView.swift b/TangemSdk/TangemSdk/UI/Views/Scan/ReadView.swift index 72e8667ea..04373b46b 100644 --- a/TangemSdk/TangemSdk/UI/Views/Scan/ReadView.swift +++ b/TangemSdk/TangemSdk/UI/Views/Scan/ReadView.swift @@ -20,10 +20,9 @@ struct ReadView: View { NFCFieldView(isAnimationOn: true) .frame(width: 240, height: 240) .offset(y: -160) - - CardView(cardColor: style.colors.cardColor, - starsColor: style.colors.starsColor) - .frame(width: 210, height: 130) + + tagView + .frame(minWidth: 210, maxWidth: 210) .offset(cardOffset) .animation(Animation .easeInOut(duration: 1) @@ -40,6 +39,19 @@ struct ReadView: View { cardOffset.width = 0 } } + + @ViewBuilder + private var tagView: some View { + switch style.readViewTag { + case .genericCard: + CardView(cardColor: style.colors.cardColor, starsColor: style.colors.starsColor) + case .image(let name, let verticalOffset, let bundle): + Image(name, bundle: bundle) + .resizable() + .aspectRatio(contentMode: .fit) + .offset(y: verticalOffset) + } + } } @available(iOS 13.0, *) From 83fe4f6fa18c059af1272494b2bbafd3b1f7f48b Mon Sep 17 00:00:00 2001 From: Andrey Chukavin Date: Fri, 5 May 2023 17:56:51 +0400 Subject: [PATCH 2/7] IOS-3575 Whitespace --- TangemSdk/TangemSdk/UI/Views/Scan/ReadView.swift | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/TangemSdk/TangemSdk/UI/Views/Scan/ReadView.swift b/TangemSdk/TangemSdk/UI/Views/Scan/ReadView.swift index 04373b46b..2bed3d713 100644 --- a/TangemSdk/TangemSdk/UI/Views/Scan/ReadView.swift +++ b/TangemSdk/TangemSdk/UI/Views/Scan/ReadView.swift @@ -20,7 +20,7 @@ struct ReadView: View { NFCFieldView(isAnimationOn: true) .frame(width: 240, height: 240) .offset(y: -160) - + tagView .frame(minWidth: 210, maxWidth: 210) .offset(cardOffset) From 69bf337d7dff3fa7ff7b84c1457484f0d8cf7d7e Mon Sep 17 00:00:00 2001 From: Andrey Chukavin Date: Fri, 5 May 2023 18:08:38 +0400 Subject: [PATCH 3/7] IOS-3575 Added some docs --- TangemSdk/TangemSdk/UI/TangemSdkStyle.swift | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/TangemSdk/TangemSdk/UI/TangemSdkStyle.swift b/TangemSdk/TangemSdk/UI/TangemSdkStyle.swift index f71fbace0..d5a0619c1 100644 --- a/TangemSdk/TangemSdk/UI/TangemSdkStyle.swift +++ b/TangemSdk/TangemSdk/UI/TangemSdkStyle.swift @@ -21,8 +21,15 @@ public class TangemSdkStyle: ObservableObject { @available(iOS 13.0, *) public extension TangemSdkStyle { + /// Options for displaying different tags on the scanning screen enum ReadViewTag { + /// Generic card provided by the SDK case genericCard + + /// A custom image with a name `name` that resides in an Asset Catalog in a `bundle` bundle. + /// The image can be shifted vertically from the standard position by specifying `verticalOffset`. + /// Note that the width of the image will be limited to a certain size, while the height will be determined by the aspect ratio of the image. + /// The value of the width can be found in ReadView.swift and is 210 points at the time of the writing. case image(name: String, verticalOffset: Double, bundle: Bundle) } } From e3d7b78f35510216bcb812666a336b43d45a2762 Mon Sep 17 00:00:00 2001 From: Andrey Chukavin Date: Fri, 5 May 2023 18:09:43 +0400 Subject: [PATCH 4/7] IOS-3575 Changed the code order --- TangemSdk/TangemSdk/UI/TangemSdkStyle.swift | 30 ++++++++++----------- 1 file changed, 15 insertions(+), 15 deletions(-) diff --git a/TangemSdk/TangemSdk/UI/TangemSdkStyle.swift b/TangemSdk/TangemSdk/UI/TangemSdkStyle.swift index d5a0619c1..62818eece 100644 --- a/TangemSdk/TangemSdk/UI/TangemSdkStyle.swift +++ b/TangemSdk/TangemSdk/UI/TangemSdkStyle.swift @@ -19,21 +19,6 @@ public class TangemSdkStyle: ObservableObject { public static var `default`: TangemSdkStyle = .init() } -@available(iOS 13.0, *) -public extension TangemSdkStyle { - /// Options for displaying different tags on the scanning screen - enum ReadViewTag { - /// Generic card provided by the SDK - case genericCard - - /// A custom image with a name `name` that resides in an Asset Catalog in a `bundle` bundle. - /// The image can be shifted vertically from the standard position by specifying `verticalOffset`. - /// Note that the width of the image will be limited to a certain size, while the height will be determined by the aspect ratio of the image. - /// The value of the width can be found in ReadView.swift and is 210 points at the time of the writing. - case image(name: String, verticalOffset: Double, bundle: Bundle) - } -} - @available(iOS 13.0, *) public extension TangemSdkStyle { struct Colors { @@ -82,3 +67,18 @@ public extension TangemSdkStyle { public static var `default`: TextSizes = .init() } } + +@available(iOS 13.0, *) +public extension TangemSdkStyle { + /// Options for displaying different tags on the scanning screen + enum ReadViewTag { + /// Generic card provided by the SDK + case genericCard + + /// A custom image with a name `name` that resides in an Asset Catalog in a `bundle` bundle. + /// The image can be shifted vertically from the standard position by specifying `verticalOffset`. + /// Note that the width of the image will be limited to a certain size, while the height will be determined by the aspect ratio of the image. + /// The value of the width can be found in ReadView.swift and is 210 points at the time of the writing. + case image(name: String, verticalOffset: Double, bundle: Bundle) + } +} From 15cfa9aeb169fc84371ac9655d9e04e8da75b2b5 Mon Sep 17 00:00:00 2001 From: Andrey Chukavin Date: Fri, 5 May 2023 18:12:13 +0400 Subject: [PATCH 5/7] IOS-3575 Renamed the type --- TangemSdk/TangemSdk/UI/TangemSdkStyle.swift | 4 ++-- TangemSdk/TangemSdk/UI/Views/Scan/ReadView.swift | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/TangemSdk/TangemSdk/UI/TangemSdkStyle.swift b/TangemSdk/TangemSdk/UI/TangemSdkStyle.swift index 62818eece..38b869ac6 100644 --- a/TangemSdk/TangemSdk/UI/TangemSdkStyle.swift +++ b/TangemSdk/TangemSdk/UI/TangemSdkStyle.swift @@ -14,7 +14,7 @@ public class TangemSdkStyle: ObservableObject { public var colors: Colors = .default public var textSizes: TextSizes = .default public var indicatorWidth: Float = 12 - public var readViewTag: ReadViewTag = .genericCard + public var nfcTag: NFCTag = .genericCard public static var `default`: TangemSdkStyle = .init() } @@ -71,7 +71,7 @@ public extension TangemSdkStyle { @available(iOS 13.0, *) public extension TangemSdkStyle { /// Options for displaying different tags on the scanning screen - enum ReadViewTag { + enum NFCTag { /// Generic card provided by the SDK case genericCard diff --git a/TangemSdk/TangemSdk/UI/Views/Scan/ReadView.swift b/TangemSdk/TangemSdk/UI/Views/Scan/ReadView.swift index 2bed3d713..73c2646cc 100644 --- a/TangemSdk/TangemSdk/UI/Views/Scan/ReadView.swift +++ b/TangemSdk/TangemSdk/UI/Views/Scan/ReadView.swift @@ -42,7 +42,7 @@ struct ReadView: View { @ViewBuilder private var tagView: some View { - switch style.readViewTag { + switch style.nfcTag { case .genericCard: CardView(cardColor: style.colors.cardColor, starsColor: style.colors.starsColor) case .image(let name, let verticalOffset, let bundle): From b6fabd2a05b3165808e69ac011006afe2e05d115 Mon Sep 17 00:00:00 2001 From: Andrey Chukavin Date: Wed, 10 May 2023 13:02:50 +0400 Subject: [PATCH 6/7] IOS-3575 Displaying UIImage as an NFC tag for more flexibility --- TangemSdk/TangemSdk/UI/TangemSdkStyle.swift | 4 ++-- TangemSdk/TangemSdk/UI/Views/Scan/ReadView.swift | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/TangemSdk/TangemSdk/UI/TangemSdkStyle.swift b/TangemSdk/TangemSdk/UI/TangemSdkStyle.swift index 38b869ac6..3b40f2f6b 100644 --- a/TangemSdk/TangemSdk/UI/TangemSdkStyle.swift +++ b/TangemSdk/TangemSdk/UI/TangemSdkStyle.swift @@ -75,10 +75,10 @@ public extension TangemSdkStyle { /// Generic card provided by the SDK case genericCard - /// A custom image with a name `name` that resides in an Asset Catalog in a `bundle` bundle. + /// A custom tag made out of an UIImage instance. /// The image can be shifted vertically from the standard position by specifying `verticalOffset`. /// Note that the width of the image will be limited to a certain size, while the height will be determined by the aspect ratio of the image. /// The value of the width can be found in ReadView.swift and is 210 points at the time of the writing. - case image(name: String, verticalOffset: Double, bundle: Bundle) + case image(uiImage: UIImage, verticalOffset: Double) } } diff --git a/TangemSdk/TangemSdk/UI/Views/Scan/ReadView.swift b/TangemSdk/TangemSdk/UI/Views/Scan/ReadView.swift index 73c2646cc..42eabc79e 100644 --- a/TangemSdk/TangemSdk/UI/Views/Scan/ReadView.swift +++ b/TangemSdk/TangemSdk/UI/Views/Scan/ReadView.swift @@ -45,8 +45,8 @@ struct ReadView: View { switch style.nfcTag { case .genericCard: CardView(cardColor: style.colors.cardColor, starsColor: style.colors.starsColor) - case .image(let name, let verticalOffset, let bundle): - Image(name, bundle: bundle) + case .image(let uiImage, let verticalOffset): + Image(uiImage: uiImage) .resizable() .aspectRatio(contentMode: .fit) .offset(y: verticalOffset) From 35ff8879d0babbf45b844c6a68060871711ae1e8 Mon Sep 17 00:00:00 2001 From: Tangem Bot Date: Fri, 12 May 2023 13:28:50 +0000 Subject: [PATCH 7/7] Prepare release version 3.7.0 --- CHANGELOG | 22 +++++++++------------- TangemSdk.podspec | 2 +- VERSION | 2 +- 3 files changed, 11 insertions(+), 15 deletions(-) diff --git a/CHANGELOG b/CHANGELOG index d0609d38c..92da1e8ce 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -1,13 +1,9 @@ -* 7c0c3ef - (HEAD -> release/3.6.0, tag: develop-228, origin/develop, develop) Merge pull request #279 from tangem/IOS-3574_derivedkeys_serialization -|\ -| * 2a2d69d - IOS-3574 Serialize derivedKeys as object -|/ -* c2b460c - (tag: develop-227) Merge pull request #277 from tangem/IOS-3533-sdk-chaining-example-command-does-not-execute -|\ -| * b632a9d - Merge branch 'develop' into IOS-3533-sdk-chaining-example-command-does-not-execute -| |\ -| |/ -|/| -* | 0f6b2c4 - (tag: develop-226) Merge pull request #278 from tangem/master - / -* f22dcfd - IOS-3533 Added a hack to delay the execution of the second command in chaining example \ No newline at end of file +* 36a3eb9 - (HEAD -> release/3.7.0, tag: develop-230, origin/develop, develop) Merge pull request #283 from tangem/master +* 134866c - (tag: develop-229, tag: 29) Merge pull request #280 from tangem/IOS-3575-sdk-research-implement-custom-card-image +* 4751c9c - Merge branch 'develop' into IOS-3575-sdk-research-implement-custom-card-image +* b6fabd2 - IOS-3575 Displaying UIImage as an NFC tag for more flexibility +* 15cfa9a - IOS-3575 Renamed the type +* e3d7b78 - IOS-3575 Changed the code order +* 69bf337 - IOS-3575 Added some docs +* 83fe4f6 - IOS-3575 Whitespace +* 3f9e59c - IOS-3575 Added a way to show an image in the ReadView \ No newline at end of file diff --git a/TangemSdk.podspec b/TangemSdk.podspec index 0f7824a34..dd41d177d 100644 --- a/TangemSdk.podspec +++ b/TangemSdk.podspec @@ -8,7 +8,7 @@ Pod::Spec.new do |s| s.name = 'TangemSdk' - s.version = '3.6.0' + s.version = '3.7.0' s.summary = 'Use TangemSdk for Tangem cards integration' # This description is used to generate tags and improve search results. diff --git a/VERSION b/VERSION index 40c341bdc..7c69a55db 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -3.6.0 +3.7.0