Skip to content

Commit

Permalink
Merge branch 'master' into dependabot/gradle/android/org.mockito-mock…
Browse files Browse the repository at this point in the history
…ito-core-5.11.0
  • Loading branch information
Dmitry-Borodin authored May 2, 2024
2 parents dbc3b89 + 0673d3f commit 49f3f93
Show file tree
Hide file tree
Showing 94 changed files with 2,490 additions and 682 deletions.
2 changes: 1 addition & 1 deletion docs/src/about/Changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ Transactions content is shown before signing; no hash signing is allowed, but si

#### History feature

The Vault now logs all operations it performs. It it important to remember that this is not log of account operations, but log of device history. This history could be cleared if needed, but not modified by other means. Detected presence of network connection is also logged.
The Vault now logs all operations it performs. It is important to remember that this is not log of account operations, but log of device history. This history could be cleared if needed, but not modified by other means. Detected presence of network connection is also logged.

#### N+1 derivation

Expand Down
2 changes: 1 addition & 1 deletion ios/.swift-version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
5.9
5.10
2 changes: 1 addition & 1 deletion ios/Packages/Blockies/Package.swift
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// swift-tools-version: 5.7
// swift-tools-version: 5.9

import PackageDescription

Expand Down
2 changes: 1 addition & 1 deletion ios/Packages/Jdenticon/Package.swift
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// swift-tools-version: 5.8
// swift-tools-version: 5.9

import PackageDescription

Expand Down
2 changes: 1 addition & 1 deletion ios/Packages/PolkadotIdenticon/Package.swift
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// swift-tools-version: 5.7
// swift-tools-version: 5.9

import PackageDescription

Expand Down
279 changes: 173 additions & 106 deletions ios/PolkadotVault.xcodeproj/project.pbxproj

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -32,17 +32,17 @@
"kind" : "remoteSourceControl",
"location" : "https://github.com/krzyzanowskim/CryptoSwift.git",
"state" : {
"revision" : "db51c407d3be4a051484a141bf0bff36c43d3b1e",
"version" : "1.8.0"
"revision" : "7892a123f7e8d0fe62f9f03728b17bbd4f94df5c",
"version" : "1.8.1"
}
},
{
"identity" : "qrcode",
"kind" : "remoteSourceControl",
"location" : "https://github.com/dagronf/QRCode",
"state" : {
"revision" : "13c605cfa866e257ac9d4ac8a47320a0e11fb6e0",
"version" : "17.0.0"
"revision" : "6e32d9e56b25ab50af62a902d29d119d407d05e1",
"version" : "17.1.0"
}
},
{
Expand Down Expand Up @@ -95,8 +95,8 @@
"kind" : "remoteSourceControl",
"location" : "https://github.com/dagronf/SwiftImageReadWrite",
"state" : {
"revision" : "02c141026a0c5d74635a457d2d0964c4cb8935b3",
"version" : "1.4.1"
"revision" : "96361ba7f9dce5184d95aba8ea90d9faa4acabb2",
"version" : "1.6.1"
}
},
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "1510"
LastUpgradeVersion = "1530"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "1510"
LastUpgradeVersion = "1530"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "1510"
LastUpgradeVersion = "1530"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"
Expand Down
11 changes: 8 additions & 3 deletions ios/PolkadotVault/Backend/Services/BananaSplitService.swift
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,10 @@

import Foundation

struct BananaSplitBackup: Equatable, Codable {
let qrCodes: [[UInt8]]
}

// sourcery: AutoMockable
protocol BananaSplitServicing: AnyObject {
func encrypt(
Expand All @@ -15,7 +19,7 @@ protocol BananaSplitServicing: AnyObject {
passphrase: String,
totalShards: UInt32,
requiredShards: UInt32,
_ completion: @escaping (Result<[QrData], ServiceError>) -> Void
_ completion: @escaping (Result<BananaSplitBackup, ServiceError>) -> Void
)
func generatePassphrase(
with words: UInt32,
Expand All @@ -40,16 +44,17 @@ final class BananaSplitService {
passphrase: String,
totalShards: UInt32,
requiredShards: UInt32,
_ completion: @escaping (Result<[QrData], ServiceError>) -> Void
_ completion: @escaping (Result<BananaSplitBackup, ServiceError>) -> Void
) {
backendService.performCall({
try bsEncrypt(
let qrCodes = try bsEncrypt(
secret: secret,
title: title,
passphrase: passphrase,
totalShards: totalShards,
requiredShards: requiredShards
)
return BananaSplitBackup(qrCodes: qrCodes.map(\.payload))
}, completion: completion)
}

Expand Down
9 changes: 6 additions & 3 deletions ios/PolkadotVault/Components/Buttons/CircleButton.swift
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,15 @@

import SwiftUI

struct CloseModalButton: View {
struct CircleButton: View {
private let image: ImageResource
private let action: () -> Void

init(
image: ImageResource = .xmarkButton,
action: @escaping () -> Void
) {
self.image = image
self.action = action
}

Expand All @@ -23,8 +26,8 @@ struct CloseModalButton: View {
ZStack {
Circle()
.frame(width: Sizes.xmarkButtonDiameter, height: Sizes.xmarkButtonDiameter, alignment: .center)
.foregroundColor(.fill6)
Image(.xmarkButton)
.foregroundColor(.fill18)
Image(image)
.foregroundColor(.textAndIconsPrimary)
}
}
Expand Down
58 changes: 58 additions & 0 deletions ios/PolkadotVault/Components/Buttons/IconButton.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
//
// IconButton.swift
// PolkadotVault
//
// Created by Krzysztof Rodak on 15/02/2024.
//

import SwiftUI

struct IconButtonStyle: ButtonStyle {
func makeBody(configuration: Self.Configuration) -> some View {
configuration.label
.padding(Spacing.medium)
.foregroundColor(.textAndIconsSecondary)
.frame(
height: Heights.iconButton,
alignment: .center
)
}
}

struct IconButton: View {
private let action: () -> Void
private let icon: ImageResource

init(
action: @escaping () -> Void,
icon: ImageResource
) {
self.action = action
self.icon = icon
}

var body: some View {
Button(action: action) {
HStack {
Image(icon)
}
}
.buttonStyle(IconButtonStyle())
}
}

#if DEBUG
struct IconButton_Previews: PreviewProvider {
static var previews: some View {
VStack(alignment: .leading, spacing: 10) {
IconButton(
action: {},
icon: .refreshPassphrase
)
}
.padding()
.preferredColorScheme(.dark)
.previewLayout(.sizeThatFits)
}
}
#endif
7 changes: 4 additions & 3 deletions ios/PolkadotVault/Components/Text/ActionableInfoBoxView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,11 @@ struct ActionableInfoBoxView: View {
VStack(alignment: .leading, spacing: Spacing.medium) {
HStack {
Text(renderable.text)
.frame(maxWidth: .infinity, alignment: .leading)
.lineLimit(nil)
.multilineTextAlignment(.leading)
.fixedSize(horizontal: false, vertical: true)
.foregroundColor(.textAndIconsPrimary)
.font(PrimaryFont.bodyM.font)
.fixedSize(horizontal: false, vertical: true)
Spacer().frame(maxWidth: Spacing.medium)
Image(.infoIconBold)
.foregroundColor(.accentPink300)
Expand All @@ -44,8 +45,8 @@ struct ActionableInfoBoxView: View {
.onTapGesture { action.action() }
}
}

.padding(Spacing.medium)
.frame(maxWidth: .infinity)
.containerBackground(CornerRadius.small, state: .actionableInfo)
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,15 @@ struct AttributedInfoBoxView: View {
var body: some View {
HStack {
Text(text)
.frame(maxWidth: .infinity, alignment: .leading)
.lineLimit(nil)
.multilineTextAlignment(.leading)
.fixedSize(horizontal: false, vertical: true)
Spacer().frame(maxWidth: Spacing.medium)
Image(.helpOutline)
.foregroundColor(.accentPink300)
}
.padding()
.frame(maxWidth: .infinity)
.font(PrimaryFont.bodyM.font)
.background(
RoundedRectangle(cornerRadius: CornerRadius.small)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,15 @@ struct AttributedTintInfoBox: View {
var body: some View {
HStack {
Text(text)
.frame(maxWidth: .infinity, alignment: .leading)
.lineLimit(nil)
.multilineTextAlignment(.leading)
.fixedSize(horizontal: false, vertical: true)
Spacer().frame(width: Spacing.large)
Image(.helpOutline)
.foregroundColor(.accentPink300)
}
.padding(Spacing.medium)
.frame(maxWidth: .infinity)
.font(PrimaryFont.bodyM.font)
.background(
RoundedRectangle(cornerRadius: CornerRadius.medium)
Expand Down
4 changes: 3 additions & 1 deletion ios/PolkadotVault/Components/Text/InfoBoxView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,16 @@ struct InfoBoxView: View {
var body: some View {
HStack {
Text(text)
.frame(maxWidth: .infinity, alignment: .leading)
.lineLimit(nil)
.multilineTextAlignment(.leading)
.fixedSize(horizontal: false, vertical: true)
.foregroundColor(.textAndIconsTertiary)
Spacer().frame(maxWidth: Spacing.medium)
Image(.infoIconBold)
.foregroundColor(.accentPink300)
}
.padding()
.frame(maxWidth: .infinity)
.font(PrimaryFont.bodyM.font)
.strokeContainerBackground(CornerRadius.small)
}
Expand Down
11 changes: 9 additions & 2 deletions ios/PolkadotVault/Components/TextFields/PrimaryTextField.swift
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import SwiftUI

struct PrimaryTextFieldStyle: ViewModifier {
let placeholder: String
let keyboardType: UIKeyboardType
@Binding var text: String
@Binding var isValid: Bool

Expand All @@ -19,7 +20,7 @@ struct PrimaryTextFieldStyle: ViewModifier {
.font(PrimaryFont.bodyL.font)
.autocapitalization(.none)
.disableAutocorrection(true)
.keyboardType(.asciiCapable)
.keyboardType(keyboardType)
.submitLabel(.return)
.frame(height: Heights.textFieldHeight)
.padding(.horizontal, Spacing.medium)
Expand All @@ -35,9 +36,15 @@ struct PrimaryTextFieldStyle: ViewModifier {
extension View {
func primaryTextFieldStyle(
_ placeholder: String,
keyboardType: UIKeyboardType = .asciiCapable,
text: Binding<String>,
isValid: Binding<Bool> = Binding<Bool>.constant(true)
) -> some View {
modifier(PrimaryTextFieldStyle(placeholder: placeholder, text: text, isValid: isValid))
modifier(PrimaryTextFieldStyle(
placeholder: placeholder,
keyboardType: keyboardType,
text: text,
isValid: isValid
))
}
}
Loading

0 comments on commit 49f3f93

Please sign in to comment.