Skip to content

Commit 569aab1

Browse files
committed
Merge branch 'release/0.2.8'
2 parents 2ec448d + 10a51ba commit 569aab1

File tree

56 files changed

+2093
-1134
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

56 files changed

+2093
-1134
lines changed

Adamant.xcodeproj/project.pbxproj

Lines changed: 57 additions & 36 deletions
Large diffs are not rendered by default.

Adamant/AppDelegate.swift

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -35,28 +35,28 @@ class AppDelegate: UIResponder, UIApplicationDelegate {
3535
self.window!.rootViewController = UITabBarController()
3636
self.window!.rootViewController?.view.backgroundColor = .white
3737
self.window!.makeKeyAndVisible()
38-
38+
3939
self.window!.tintColor = UIColor.adamantPrimary
40-
40+
4141
guard let router = container.resolve(Router.self) else {
4242
fatalError("Failed to get Router")
4343
}
44-
44+
4545
if let tabbar = self.window!.rootViewController as? UITabBarController {
4646
let account = router.get(story: .Account).instantiateInitialViewController()!
4747
let chats = router.get(story: .Chats).instantiateInitialViewController()!
4848
let settings = router.get(story: .Settings).instantiateInitialViewController()!
4949

50+
account.tabBarItem.badgeColor = UIColor.adamantPrimary
51+
chats.tabBarItem.badgeColor = UIColor.adamantPrimary
52+
settings.tabBarItem.badgeColor = UIColor.adamantPrimary
53+
5054
tabbar.setViewControllers([account, chats, settings], animated: false)
5155
}
5256

5357

5458
// MARK: 3. Initiate login
55-
guard let accountService = container.resolve(AccountService.self) else {
56-
fatalError("Failed to get AccountService")
57-
}
58-
59-
accountService.logoutAndPresentLoginStoryboard(animated: false, authorizationFinishedHandler: nil)
59+
self.window!.rootViewController?.present(router.get(scene: .Login), animated: false, completion: nil)
6060

6161

6262
// MARK: 4 Autoupdate

Adamant/Assets/ru.lproj/Localizable.strings

Lines changed: 33 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,9 @@
2929
/* Config: Application Info section */
3030
"Application info" = "Приложение";
3131

32+
/* Config: Biometry authorization reason for turning on/off biometry usage to log in */
33+
"Authorize yourself" = "Для внесения изменений необходимо авторизироваться";
34+
3235
/* Transfer: logged user balance.
3336
Wallet page: Balance row title */
3437
"Balance" = "Баланс";
@@ -51,6 +54,9 @@
5154
/* Transaction details: date row. */
5255
"Date" = "Дата";
5356

57+
/* Config: turn off 'Stay Logged In' confirmation */
58+
"Do not stay logged in" = "Выходить из системы при выходе из приложения";
59+
5460
/* Shared alert Done message. Used anywhere */
5561
"Done" = "Готово";
5662

@@ -63,6 +69,9 @@
6369
/* QRGenerator: user typed in wrong invalid */
6470
"Enter correct passphrase" = "Введите корректный пароль";
6571

72+
/* Pinpad: Ask user to create new pin */
73+
"Enter new pin" = "Введите новый пин";
74+
6675
/* Shared alert 'Error' title. Used anywhere */
6776
"Error" = "Ошибка";
6877

@@ -103,6 +112,9 @@
103112
Login: login with existing passphrase section */
104113
"Login" = "Вход";
105114

115+
/* Login: Login into previous account with biometry or pincode */
116+
"Login into Adamant" = "Вход в Адамант";
117+
106118
/* Wallet page: 'Logout' button
107119
Wallet page: Confirm logout alert: Logout (Ok) button */
108120
"Logout" = "Выход";
@@ -137,6 +149,9 @@
137149
/* Transaction details: 'Open transaction in explorer' row. */
138150
"Open in Explorer" = "Открыть в Explorer";
139151

152+
/* Login: Login with pincode button */
153+
"Pin" = "Войти с pin-кодом";
154+
140155
/* Transfer: Address validation error */
141156
"Please enter a valid recipient address" = "Введите корректный адрес получателя";
142157

@@ -155,6 +170,9 @@
155170
/* Login: Notify user that device not supported by QR reader */
156171
"QR codes reading not supported by the current device" = "На этом устройстве не поддерживается чтение QR кодов";
157172

173+
/* Pinpad: Ask user to repeat new pin */
174+
"Re-enter new pin" = "Введите пин ещё раз";
175+
158176
/* Shared alert 'Save' button. Used anywhere */
159177
"Save" = "Сохранить";
160178

@@ -180,7 +198,8 @@
180198
/* Transfer: Processing message */
181199
"Sending funds..." = "Отправляем токены...";
182200

183-
/* Shared alert 'Settings' button. Used to go to system Settings app, on application settings page. Should be same as Settings application title. */
201+
/* Shared alert 'Settings' button. Used to go to system Settings app, on application settings page. Should be same as Settings application title.
202+
Config: Settings section */
184203
"Settings" = "Настройки";
185204

186205
/* Wallet page: 'Transfer not allowed' alert title */
@@ -189,6 +208,12 @@
189208
/* Shared alert 'Share' button. Used anywhere for presenting standart iOS 'Share' menu. */
190209
"Share" = "Поделиться";
191210

211+
/* Config: Stay logged option */
212+
"Stay Logged in" = "Оставаться в сети";
213+
214+
/* Config: Authorization reason for turning biometry off */
215+
"Do not use biometry to log in" = "Отключить вход с биометрией";
216+
192217
/* Export transaction: 'Share transaction summary' button */
193218
"Summary" = "Сводка";
194219

@@ -211,6 +236,12 @@
211236
/* Export transaction: 'Share transaction URL' button */
212237
"URL" = "URL";
213238

239+
/* Config: Authorization reason for turning biometry on */
240+
"Use biometry to log in" = "Использовать биометрию для входа в систему";
241+
242+
/* Login: user not logged error */
243+
"User not logged!" = "Не выполнен вход";
244+
214245
/* Unknown internal error */
215246
"Unknown error" = "Неизвестная ошибка";
216247

@@ -258,7 +289,7 @@
258289

259290
/* Login: Passphrase placeholder
260291
QRGenerator: Passphrase textview placeholder */
261-
"passphrase" = "Пароль";
292+
"Passphrase" = "Пароль";
262293

263294
/* Transfer: transfer amount placeholder */
264295
"to send" = "для перевода";

Adamant/CoreData/ChatModels.xcdatamodeld/ChatModels.xcdatamodel/contents

Lines changed: 16 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,34 +1,36 @@
11
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
2-
<model type="com.apple.IDECoreDataModeler.DataModel" documentVersion="1.0" lastSavedToolsVersion="13772" systemVersion="17D47" minimumToolsVersion="Automatic" sourceLanguage="Swift" userDefinedModelVersionIdentifier="">
2+
<model type="com.apple.IDECoreDataModeler.DataModel" documentVersion="1.0" lastSavedToolsVersion="13772" systemVersion="17D102" minimumToolsVersion="Automatic" sourceLanguage="Swift" userDefinedModelVersionIdentifier="">
33
<entity name="BaseTransaction" representedClassName="BaseTransaction" isAbstract="YES" syncable="YES">
44
<attribute name="amount" optional="YES" attributeType="Decimal" defaultValueString="0" syncable="YES"/>
55
<attribute name="date" optional="YES" attributeType="Date" usesScalarValueType="NO" syncable="YES"/>
66
<attribute name="fee" optional="YES" attributeType="Decimal" defaultValueString="0" syncable="YES"/>
7-
<attribute name="height" optional="YES" attributeType="Integer 64" defaultValueString="0" usesScalarValueType="YES" syncable="YES"/>
8-
<attribute name="isOutgoing" optional="YES" attributeType="Boolean" usesScalarValueType="YES" syncable="YES"/>
9-
<attribute name="recipientId" optional="YES" attributeType="String" syncable="YES"/>
10-
<attribute name="senderId" optional="YES" attributeType="String" syncable="YES"/>
11-
<attribute name="transactionId" optional="YES" attributeType="String" syncable="YES"/>
12-
<attribute name="type" optional="YES" attributeType="Integer 16" defaultValueString="0" usesScalarValueType="YES" syncable="YES"/>
7+
<attribute name="height" attributeType="Integer 64" defaultValueString="0" usesScalarValueType="YES" syncable="YES"/>
8+
<attribute name="isOutgoing" attributeType="Boolean" usesScalarValueType="YES" syncable="YES"/>
9+
<attribute name="recipientId" attributeType="String" syncable="YES"/>
10+
<attribute name="senderId" attributeType="String" syncable="YES"/>
11+
<attribute name="transactionId" attributeType="String" syncable="YES"/>
12+
<attribute name="type" attributeType="Integer 16" defaultValueString="0" usesScalarValueType="YES" syncable="YES"/>
1313
</entity>
1414
<entity name="Chatroom" representedClassName="Chatroom" syncable="YES">
15-
<attribute name="updatedAt" optional="YES" attributeType="Date" usesScalarValueType="NO" syncable="YES"/>
15+
<attribute name="hasUnreadMessages" optional="YES" attributeType="Boolean" usesScalarValueType="YES" syncable="YES"/>
16+
<attribute name="updatedAt" attributeType="Date" usesScalarValueType="NO" syncable="YES"/>
1617
<relationship name="lastTransaction" optional="YES" maxCount="1" deletionRule="Nullify" destinationEntity="ChatTransaction" inverseName="lastIn" inverseEntity="ChatTransaction" syncable="YES"/>
1718
<relationship name="partner" optional="YES" maxCount="1" deletionRule="Nullify" destinationEntity="CoreDataAccount" inverseName="chatroom" inverseEntity="CoreDataAccount" syncable="YES"/>
1819
<relationship name="transactions" optional="YES" toMany="YES" deletionRule="Cascade" destinationEntity="ChatTransaction" inverseName="chatroom" inverseEntity="ChatTransaction" syncable="YES"/>
1920
</entity>
2021
<entity name="ChatTransaction" representedClassName="ChatTransaction" parentEntity="BaseTransaction" syncable="YES">
21-
<attribute name="isConfirmed" optional="YES" attributeType="Boolean" usesScalarValueType="YES" syncable="YES"/>
22-
<attribute name="message" optional="YES" attributeType="String" syncable="YES"/>
22+
<attribute name="isConfirmed" attributeType="Boolean" defaultValueString="NO" usesScalarValueType="YES" syncable="YES"/>
23+
<attribute name="isUnread" attributeType="Boolean" defaultValueString="NO" usesScalarValueType="YES" syncable="YES"/>
24+
<attribute name="message" attributeType="String" syncable="YES"/>
2325
<relationship name="chatroom" maxCount="1" deletionRule="Nullify" destinationEntity="Chatroom" inverseName="transactions" inverseEntity="Chatroom" syncable="YES"/>
2426
<relationship name="lastIn" optional="YES" maxCount="1" deletionRule="Nullify" destinationEntity="Chatroom" inverseName="lastTransaction" inverseEntity="Chatroom" syncable="YES"/>
2527
</entity>
2628
<entity name="CoreDataAccount" representedClassName="CoreDataAccount" syncable="YES">
27-
<attribute name="address" optional="YES" attributeType="String" syncable="YES"/>
29+
<attribute name="address" attributeType="String" syncable="YES"/>
2830
<attribute name="avatar" optional="YES" attributeType="String" syncable="YES"/>
2931
<attribute name="knownMessages" optional="YES" attributeType="Transformable" customClassName="[String:String]" syncable="YES"/>
3032
<attribute name="name" optional="YES" attributeType="String" syncable="YES"/>
31-
<attribute name="publicKey" optional="YES" attributeType="String" syncable="YES"/>
33+
<attribute name="publicKey" attributeType="String" syncable="YES"/>
3234
<relationship name="chatroom" optional="YES" maxCount="1" deletionRule="Nullify" destinationEntity="Chatroom" inverseName="partner" inverseEntity="Chatroom" syncable="YES"/>
3335
<relationship name="transfers" optional="YES" toMany="YES" deletionRule="Nullify" destinationEntity="TransferTransaction" inverseName="partner" inverseEntity="TransferTransaction" syncable="YES"/>
3436
</entity>
@@ -37,8 +39,8 @@
3739
</entity>
3840
<elements>
3941
<element name="BaseTransaction" positionX="-9" positionY="99" width="128" height="180"/>
40-
<element name="Chatroom" positionX="-45" positionY="108" width="128" height="105"/>
41-
<element name="ChatTransaction" positionX="-18" positionY="27" width="128" height="105"/>
42+
<element name="Chatroom" positionX="-45" positionY="108" width="128" height="120"/>
43+
<element name="ChatTransaction" positionX="-18" positionY="27" width="128" height="120"/>
4244
<element name="CoreDataAccount" positionX="0" positionY="81" width="128" height="150"/>
4345
<element name="TransferTransaction" positionX="-18" positionY="63" width="128" height="60"/>
4446
</elements>

Adamant/CoreData/ChatTransaction+CoreDataProperties.swift

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ extension ChatTransaction {
1818
}
1919

2020
@NSManaged public var isConfirmed: Bool
21+
@NSManaged public var isUnread: Bool
2122
@NSManaged public var message: String?
2223
@NSManaged public var chatroom: Chatroom?
2324
@NSManaged public var lastIn: Chatroom?

Adamant/CoreData/Chatroom+CoreDataClass.swift

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,4 +13,18 @@ import CoreData
1313
@objc(Chatroom)
1414
public class Chatroom: NSManagedObject {
1515
static let entityName = "Chatroom"
16+
17+
func markAsReaded() {
18+
if hasUnreadMessages {
19+
hasUnreadMessages = false
20+
}
21+
22+
if let trs = transactions as? Set<ChatTransaction> {
23+
trs.forEach({
24+
if $0.isUnread {
25+
$0.isUnread = false
26+
}
27+
})
28+
}
29+
}
1630
}

Adamant/CoreData/Chatroom+CoreDataProperties.swift

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
// Chatroom+CoreDataProperties.swift
33
// Adamant
44
//
5-
// Created by Anokhov Pavel on 10.02.2018.
5+
// Created by Anokhov Pavel on 01.03.2018.
66
// Copyright © 2018 Adamant. All rights reserved.
77
//
88
//
@@ -18,6 +18,7 @@ extension Chatroom {
1818
}
1919

2020
@NSManaged public var updatedAt: NSDate?
21+
@NSManaged public var hasUnreadMessages: Bool
2122
@NSManaged public var lastTransaction: ChatTransaction?
2223
@NSManaged public var partner: CoreDataAccount?
2324
@NSManaged public var transactions: NSSet?

Adamant/Helpers/GlobalConstants.swift

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -11,23 +11,28 @@ import UIKit
1111
extension UIColor {
1212
// MARK: Global colors
1313

14-
/// UIColor(named: "Gray_main")
14+
/// Main dark gray, ~70% gray
1515
static let adamantPrimary = UIColor(red: 0.29, green: 0.29, blue: 0.29, alpha: 1)
1616

17-
/// UIColor(named: "Gray_secondary")
17+
/// Secondary color, ~50% gray
1818
static let adamantSecondary = UIColor(red: 0.478, green: 0.478, blue: 0.478, alpha: 1)
1919

20-
/// UIColor(named: "Icons")
20+
/// Chat icons color, ~40% gray
2121
static let adamantChatIcons = UIColor(red: 0.62, green: 0.62, blue: 0.62, alpha: 1)
2222

2323

2424
// MARK: Chat colors
2525

26-
/// UIColor(named: "Chat_recipient")
26+
/// User chat bubble background, ~4% gray
2727
static let adamantChatRecipientBackground = UIColor(red: 0.965, green: 0.973, blue: 0.981, alpha: 1)
2828

29-
/// UIColor(named: "Chat_sender")!
29+
/// Partner chat bubble background, ~8% gray
3030
static let adamantChatSenderBackground = UIColor(red: 0.925, green: 0.925, blue: 0.925, alpha: 1)
31+
32+
33+
// MARK: Pinpad
34+
/// Pinpad highligh button background, 12% gray
35+
static let adamantPinpadHighlightButton = UIColor(red: 0.88, green: 0.88, blue: 0.88, alpha: 1)
3136
}
3237

3338
extension UIFont {
Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
//
2+
// MyLittlePinpad+adamant.swift
3+
// Adamant
4+
//
5+
// Created by Anokhov Pavel on 07.03.2018.
6+
// Copyright © 2018 Adamant. All rights reserved.
7+
//
8+
9+
import Foundation
10+
import MyLittlePinpad
11+
12+
extension String.adamantLocalized {
13+
struct pinpad {
14+
static let createPin = NSLocalizedString("Enter new pin", comment: "Pinpad: Ask user to create new pin")
15+
static let reenterPin = NSLocalizedString("Re-enter new pin", comment: "Pinpad: Ask user to repeat new pin")
16+
}
17+
}
18+
19+
extension PinpadBiometryButtonType {
20+
var localAuthType: BiometryType {
21+
switch self {
22+
case .hidden:
23+
return .none
24+
25+
case .faceID:
26+
return .faceID
27+
28+
case .touchID:
29+
return .touchID
30+
}
31+
}
32+
}
33+
34+
extension BiometryType {
35+
var pinpadButtonType: PinpadBiometryButtonType {
36+
switch self {
37+
case .none:
38+
return .hidden
39+
40+
case .faceID:
41+
return .faceID
42+
43+
case .touchID:
44+
return .touchID
45+
}
46+
}
47+
}
48+
49+
extension PinpadViewController {
50+
static func adamantPinpad(biometryButton: PinpadBiometryButtonType) -> PinpadViewController {
51+
let pinpad = PinpadViewController.instantiateFromResourceNib()
52+
53+
pinpad.bordersColor = UIColor.adamantSecondary
54+
pinpad.setColor(UIColor.adamantPrimary, for: .normal)
55+
pinpad.buttonsHighlightedColor = UIColor.adamantPinpadHighlightButton
56+
pinpad.buttonsSize = 75
57+
pinpad.buttonsSpacing = 20
58+
pinpad.placeholderViewHeight = 50
59+
pinpad.placeholdersSize = 15
60+
pinpad.placeholderActiveColor = UIColor.adamantPinpadHighlightButton
61+
pinpad.biometryButtonType = biometryButton
62+
pinpad.cancelButton.setTitle(String.adamantLocalized.alert.cancel, for: .normal)
63+
pinpad.pinDigits = 6
64+
65+
return pinpad
66+
}
67+
}
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
//
2+
// QRCodeReader+adamant.swift
3+
// Adamant
4+
//
5+
// Created by Anokhov Pavel on 07.03.2018.
6+
// Copyright © 2018 Adamant. All rights reserved.
7+
//
8+
9+
import Foundation
10+
import QRCodeReader
11+
12+
extension QRCodeReaderViewController {
13+
static func adamantQrCodeReader() -> QRCodeReaderViewController {
14+
let builder = QRCodeReaderViewControllerBuilder {
15+
$0.reader = QRCodeReader(metadataObjectTypes: [.qr ], captureDevicePosition: .back)
16+
$0.cancelButtonTitle = String.adamantLocalized.alert.cancel
17+
$0.showSwitchCameraButton = false
18+
}
19+
20+
return QRCodeReaderViewController(builder: builder)
21+
}
22+
}

Adamant/Info.plist

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,9 @@
1717
<key>CFBundlePackageType</key>
1818
<string>APPL</string>
1919
<key>CFBundleShortVersionString</key>
20-
<string>0.2.7</string>
20+
<string>0.2.8</string>
2121
<key>CFBundleVersion</key>
22-
<string>14</string>
22+
<string>15</string>
2323
<key>LSRequiresIPhoneOS</key>
2424
<true/>
2525
<key>NSCameraUsageDescription</key>
@@ -42,6 +42,10 @@
4242
<string>Roboto_500_normal.ttf</string>
4343
<string>Roboto_700_normal.ttf</string>
4444
</array>
45+
<key>UIBackgroundModes</key>
46+
<array>
47+
<string>fetch</string>
48+
</array>
4549
<key>UILaunchStoryboardName</key>
4650
<string>LaunchScreen</string>
4751
<key>UIRequiredDeviceCapabilities</key>

0 commit comments

Comments
 (0)