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/TangemSdk/TangemSdk/UI/TangemSdkStyle.swift b/TangemSdk/TangemSdk/UI/TangemSdkStyle.swift index 418b85da2..3b40f2f6b 100644 --- a/TangemSdk/TangemSdk/UI/TangemSdkStyle.swift +++ b/TangemSdk/TangemSdk/UI/TangemSdkStyle.swift @@ -14,6 +14,7 @@ public class TangemSdkStyle: ObservableObject { public var colors: Colors = .default public var textSizes: TextSizes = .default public var indicatorWidth: Float = 12 + public var nfcTag: NFCTag = .genericCard public static var `default`: TangemSdkStyle = .init() } @@ -66,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 NFCTag { + /// Generic card provided by the SDK + case genericCard + + /// 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(uiImage: UIImage, verticalOffset: Double) + } +} 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..42eabc79e 100644 --- a/TangemSdk/TangemSdk/UI/Views/Scan/ReadView.swift +++ b/TangemSdk/TangemSdk/UI/Views/Scan/ReadView.swift @@ -21,9 +21,8 @@ struct ReadView: View { .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.nfcTag { + case .genericCard: + CardView(cardColor: style.colors.cardColor, starsColor: style.colors.starsColor) + case .image(let uiImage, let verticalOffset): + Image(uiImage: uiImage) + .resizable() + .aspectRatio(contentMode: .fit) + .offset(y: verticalOffset) + } + } } @available(iOS 13.0, *) diff --git a/VERSION b/VERSION index 40c341bdc..7c69a55db 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -3.6.0 +3.7.0