Skip to content

Commit c831585

Browse files
committed
Merge branch 'release/0.1.4'
2 parents bf83418 + 22a9835 commit c831585

40 files changed

+2108
-900
lines changed

Adamant.xcodeproj/project.pbxproj

Lines changed: 112 additions & 44 deletions
Large diffs are not rendered by default.

Adamant/AppDelegate.swift

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,14 @@ class AppDelegate: UIResponder, UIApplicationDelegate {
5757

5858
accountService.logoutAndPresentLoginStoryboard(animated: false, authorizationFinishedHandler: nil)
5959

60+
61+
// MARK: 4 Autoupdate
62+
let chatsProvider = container.resolve(ChatsProvider.self)!
63+
let repeater = RepeaterService()
64+
repeater.registerForegroundCall(label: "chatsProvider", interval: 3, queue: DispatchQueue.global(qos: .utility), callback: chatsProvider.update)
65+
66+
67+
// MARK: 4. On logout, pop all navigators to root.
6068
NotificationCenter.default.addObserver(forName: Notification.Name.adamantUserLoggedOut, object: nil, queue: OperationQueue.main) { [weak self] _ in
6169
guard let tbc = self?.window?.rootViewController as? UITabBarController, let vcs = tbc.viewControllers else {
6270
return

Adamant/Assets/knownContacts.json

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,24 @@
11
[
22
{
33
"address": "U15423595369615486571",
4-
"title": "ADAMANT Bounty Wallet",
5-
"messageKeys": [
4+
"name": "ADAMANT Bounty Wallet",
5+
"messages": [
66
{
77
"key": "chats.welcome_message",
8-
"translationKey": "chats.welcome_message",
98
"message": "Welcome to ADAMANT, the most secure and anonymous messenger. You are credited with bounty tokens, which you can use to get acquainted with the messenger.\nRemember, your security and anonymity is up to you also. Do not follow links you receive, otherwise your IP can be compromised. Do not trust browser extensions. Better to share your ADM address personally, but not using other messengers. Keep your secret passphrase secure. Set a password on your device or logout before leaving.\nLearn more about security and anonymity at https://adamant.im/staysecured/.\n\nDo not reply to this message, it is a system account."
109
}
1110
]
1211
},
1312
{
1413
"address": "U7047165086065693428",
15-
"title": "ADAMANT ICO",
16-
"messageKeys": [
14+
"name": "ADAMANT ICO",
15+
"messages": [
1716
{
1817
"key": "chats.preico_message",
19-
"translationKey": "chats.preico_message",
2018
"message": "You have a possibility to invest in ADAMANT, the most secure and anonymous messenger. Now is a Pre-ICO stage — the most profitable for investors. Learn more on Adamant.im website or in the Whitepaper. To participate just reply to this message and we will assist. We are eager to answer quickly, but sometimes delays for a couple of hours are possible.\nAfter you invest and receive ADM tokens, we recommend to keep them as long as possible. All of unsold tokens during ICO will be distributed among users wallets, adding 5% monthly. Additional info is on Adamant.im website and in the Whitepaper."
2119
},
2220
{
2321
"key": "chats.ico_message",
24-
"translationKey": "chats.ico_message",
2522
"message": "You have a possibility to invest in ICO of ADAMANT, the most secure and anonymous messenger. Earlier you participate, better offer you will get. Learn more on Adamant.im website or in the Whitepaper. To invest, go to Wallet→Invest in the ICO, or follow a website page Adamant.im/ico/. If you still have any questions, you can ask them by replying to this message. We are eager to answer quickly, but sometimes delays for a couple of hours are possible.\nAfter you invest and receive ADM tokens, we recommend to keep them as long as possible. All of unsold tokens during ICO will be distributed among users wallets, adding 5% monthly. Additional info is on Adamant.im website and in the Whitepaper."
2623
}
2724
]
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
//
2+
// BaseTransaction+CoreDataClass.swift
3+
// Adamant
4+
//
5+
// Created by Anokhov Pavel on 07.02.2018.
6+
// Copyright © 2018 Adamant. All rights reserved.
7+
//
8+
//
9+
10+
import Foundation
11+
import CoreData
12+
13+
@objc(BaseTransaction)
14+
public class BaseTransaction: NSManagedObject {
15+
16+
}
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
//
2+
// BaseTransaction+CoreDataProperties.swift
3+
// Adamant
4+
//
5+
// Created by Anokhov Pavel on 10.02.2018.
6+
// Copyright © 2018 Adamant. All rights reserved.
7+
//
8+
//
9+
10+
import Foundation
11+
import CoreData
12+
13+
14+
extension BaseTransaction {
15+
16+
@nonobjc public class func fetchRequest() -> NSFetchRequest<BaseTransaction> {
17+
return NSFetchRequest<BaseTransaction>(entityName: "BaseTransaction")
18+
}
19+
20+
@NSManaged public var amount: NSDecimalNumber?
21+
@NSManaged public var date: NSDate?
22+
@NSManaged public var fee: NSDecimalNumber?
23+
@NSManaged public var height: Int64
24+
@NSManaged public var recipientId: String?
25+
@NSManaged public var senderId: String?
26+
@NSManaged public var transactionId: String?
27+
@NSManaged public var type: Int16
28+
@NSManaged public var isOutgoing: Bool
29+
30+
}
Lines changed: 30 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,44 @@
11
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
2-
<model type="com.apple.IDECoreDataModeler.DataModel" documentVersion="1.0" lastSavedToolsVersion="13772" systemVersion="17C205" minimumToolsVersion="Automatic" sourceLanguage="Swift" userDefinedModelVersionIdentifier="">
2+
<model type="com.apple.IDECoreDataModeler.DataModel" documentVersion="1.0" lastSavedToolsVersion="13772" systemVersion="17D47" minimumToolsVersion="Automatic" sourceLanguage="Swift" userDefinedModelVersionIdentifier="">
3+
<entity name="BaseTransaction" representedClassName="BaseTransaction" isAbstract="YES" syncable="YES">
4+
<attribute name="amount" optional="YES" attributeType="Decimal" defaultValueString="0" syncable="YES"/>
5+
<attribute name="date" optional="YES" attributeType="Date" usesScalarValueType="NO" syncable="YES"/>
6+
<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"/>
13+
</entity>
314
<entity name="Chatroom" representedClassName="Chatroom" syncable="YES">
4-
<attribute name="id" attributeType="String" syncable="YES"/>
5-
<attribute name="title" optional="YES" attributeType="String" syncable="YES"/>
615
<attribute name="updatedAt" optional="YES" attributeType="Date" usesScalarValueType="NO" syncable="YES"/>
716
<relationship name="lastTransaction" optional="YES" maxCount="1" deletionRule="Nullify" destinationEntity="ChatTransaction" inverseName="lastIn" inverseEntity="ChatTransaction" syncable="YES"/>
17+
<relationship name="partner" optional="YES" maxCount="1" deletionRule="Nullify" destinationEntity="CoreDataAccount" inverseName="chatroom" inverseEntity="CoreDataAccount" syncable="YES"/>
818
<relationship name="transactions" optional="YES" toMany="YES" deletionRule="Cascade" destinationEntity="ChatTransaction" inverseName="chatroom" inverseEntity="ChatTransaction" syncable="YES"/>
919
</entity>
10-
<entity name="ChatTransaction" representedClassName="ChatTransaction" syncable="YES">
11-
<attribute name="date" attributeType="Date" usesScalarValueType="NO" syncable="YES"/>
12-
<attribute name="height" optional="YES" attributeType="Integer 64" defaultValueString="0" usesScalarValueType="YES" syncable="YES"/>
20+
<entity name="ChatTransaction" representedClassName="ChatTransaction" parentEntity="BaseTransaction" syncable="YES">
1321
<attribute name="isConfirmed" optional="YES" attributeType="Boolean" usesScalarValueType="YES" syncable="YES"/>
1422
<attribute name="message" optional="YES" attributeType="String" syncable="YES"/>
15-
<attribute name="recipientId" attributeType="String" syncable="YES"/>
16-
<attribute name="senderId" attributeType="String" syncable="YES"/>
17-
<attribute name="transactionId" attributeType="String" syncable="YES"/>
18-
<attribute name="type" attributeType="Integer 16" minValueString="0" defaultValueString="0" usesScalarValueType="YES" syncable="YES"/>
1923
<relationship name="chatroom" maxCount="1" deletionRule="Nullify" destinationEntity="Chatroom" inverseName="transactions" inverseEntity="Chatroom" syncable="YES"/>
2024
<relationship name="lastIn" optional="YES" maxCount="1" deletionRule="Nullify" destinationEntity="Chatroom" inverseName="lastTransaction" inverseEntity="Chatroom" syncable="YES"/>
2125
</entity>
26+
<entity name="CoreDataAccount" representedClassName="CoreDataAccount" syncable="YES">
27+
<attribute name="address" optional="YES" attributeType="String" syncable="YES"/>
28+
<attribute name="knownMessages" optional="YES" attributeType="Transformable" customClassName="[String:String]" syncable="YES"/>
29+
<attribute name="name" optional="YES" attributeType="String" syncable="YES"/>
30+
<attribute name="publicKey" optional="YES" attributeType="String" syncable="YES"/>
31+
<relationship name="chatroom" optional="YES" maxCount="1" deletionRule="Nullify" destinationEntity="Chatroom" inverseName="partner" inverseEntity="Chatroom" syncable="YES"/>
32+
<relationship name="transfers" optional="YES" toMany="YES" deletionRule="Nullify" destinationEntity="TransferTransaction" inverseName="partner" inverseEntity="TransferTransaction" syncable="YES"/>
33+
</entity>
34+
<entity name="TransferTransaction" representedClassName="TransferTransaction" parentEntity="BaseTransaction" syncable="YES">
35+
<relationship name="partner" maxCount="1" deletionRule="Nullify" destinationEntity="CoreDataAccount" inverseName="transfers" inverseEntity="CoreDataAccount" syncable="YES"/>
36+
</entity>
2237
<elements>
23-
<element name="Chatroom" positionX="-45" positionY="0" width="128" height="120"/>
24-
<element name="ChatTransaction" positionX="-18" positionY="27" width="128" height="195"/>
38+
<element name="BaseTransaction" positionX="-9" positionY="99" width="128" height="180"/>
39+
<element name="Chatroom" positionX="-45" positionY="108" width="128" height="105"/>
40+
<element name="ChatTransaction" positionX="-18" positionY="27" width="128" height="105"/>
41+
<element name="CoreDataAccount" positionX="0" positionY="81" width="128" height="135"/>
42+
<element name="TransferTransaction" positionX="-18" positionY="63" width="128" height="60"/>
2543
</elements>
2644
</model>

Adamant/CoreData/ChatTransaction+CoreDataClass.swift

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
// ChatTransaction+CoreDataClass.swift
33
// Adamant
44
//
5-
// Created by Anokhov Pavel on 12.01.2018.
5+
// Created by Anokhov Pavel on 07.02.2018.
66
// Copyright © 2018 Adamant. All rights reserved.
77
//
88
//
@@ -11,8 +11,6 @@ import Foundation
1111
import CoreData
1212

1313
@objc(ChatTransaction)
14-
public class ChatTransaction: NSManagedObject {
14+
public class ChatTransaction: BaseTransaction {
1515
static let entityName = "ChatTransaction"
16-
17-
var isOutgoing: Bool = false
1816
}

Adamant/CoreData/ChatTransaction+CoreDataProperties.swift

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
// ChatTransaction+CoreDataProperties.swift
33
// Adamant
44
//
5-
// Created by Anokhov Pavel on 20.01.2018.
5+
// Created by Anokhov Pavel on 07.02.2018.
66
// Copyright © 2018 Adamant. All rights reserved.
77
//
88
//
@@ -17,14 +17,8 @@ extension ChatTransaction {
1717
return NSFetchRequest<ChatTransaction>(entityName: "ChatTransaction")
1818
}
1919

20-
@NSManaged public var date: NSDate?
21-
@NSManaged public var height: Int64
22-
@NSManaged public var message: String?
23-
@NSManaged public var recipientId: String?
24-
@NSManaged public var senderId: String?
25-
@NSManaged public var transactionId: String?
26-
@NSManaged public var type: Int16
2720
@NSManaged public var isConfirmed: Bool
21+
@NSManaged public var message: String?
2822
@NSManaged public var chatroom: Chatroom?
2923
@NSManaged public var lastIn: Chatroom?
3024

Adamant/CoreData/Chatroom+CoreDataClass.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
// Chatroom+CoreDataClass.swift
33
// Adamant
44
//
5-
// Created by Anokhov Pavel on 12.01.2018.
5+
// Created by Anokhov Pavel on 07.02.2018.
66
// Copyright © 2018 Adamant. All rights reserved.
77
//
88
//

Adamant/CoreData/Chatroom+CoreDataProperties.swift

Lines changed: 2 additions & 3 deletions
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 22.01.2018.
5+
// Created by Anokhov Pavel on 10.02.2018.
66
// Copyright © 2018 Adamant. All rights reserved.
77
//
88
//
@@ -17,10 +17,9 @@ extension Chatroom {
1717
return NSFetchRequest<Chatroom>(entityName: "Chatroom")
1818
}
1919

20-
@NSManaged public var id: String?
2120
@NSManaged public var updatedAt: NSDate?
22-
@NSManaged public var title: String?
2321
@NSManaged public var lastTransaction: ChatTransaction?
22+
@NSManaged public var partner: CoreDataAccount?
2423
@NSManaged public var transactions: NSSet?
2524

2625
}
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
//
2+
// CoreDataAccount+CoreDataClass.swift
3+
// Adamant
4+
//
5+
// Created by Anokhov Pavel on 07.02.2018.
6+
// Copyright © 2018 Adamant. All rights reserved.
7+
//
8+
//
9+
10+
import Foundation
11+
import CoreData
12+
13+
@objc(CoreDataAccount)
14+
public class CoreDataAccount: NSManagedObject {
15+
static let entityName = "CoreDataAccount"
16+
}
Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
//
2+
// CoreDataAccount+CoreDataProperties.swift
3+
// Adamant
4+
//
5+
// Created by Anokhov Pavel on 10.02.2018.
6+
// Copyright © 2018 Adamant. All rights reserved.
7+
//
8+
//
9+
10+
import Foundation
11+
import CoreData
12+
13+
14+
extension CoreDataAccount {
15+
16+
@nonobjc public class func fetchRequest() -> NSFetchRequest<CoreDataAccount> {
17+
return NSFetchRequest<CoreDataAccount>(entityName: "CoreDataAccount")
18+
}
19+
20+
@NSManaged public var address: String?
21+
@NSManaged public var name: String?
22+
@NSManaged public var publicKey: String?
23+
@NSManaged public var knownMessages: [String:String]?
24+
@NSManaged public var chatroom: Chatroom?
25+
@NSManaged public var transfers: NSSet?
26+
27+
}
28+
29+
// MARK: Generated accessors for transfers
30+
extension CoreDataAccount {
31+
32+
@objc(addTransfersObject:)
33+
@NSManaged public func addToTransfers(_ value: TransferTransaction)
34+
35+
@objc(removeTransfersObject:)
36+
@NSManaged public func removeFromTransfers(_ value: TransferTransaction)
37+
38+
@objc(addTransfers:)
39+
@NSManaged public func addToTransfers(_ values: NSSet)
40+
41+
@objc(removeTransfers:)
42+
@NSManaged public func removeFromTransfers(_ values: NSSet)
43+
44+
}
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
//
2+
// TransferTransaction+CoreDataClass.swift
3+
// Adamant
4+
//
5+
// Created by Anokhov Pavel on 07.02.2018.
6+
// Copyright © 2018 Adamant. All rights reserved.
7+
//
8+
//
9+
10+
import Foundation
11+
import CoreData
12+
13+
@objc(TransferTransaction)
14+
public class TransferTransaction: BaseTransaction {
15+
static let entityName = "TransferTransaction"
16+
}
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
//
2+
// TransferTransaction+CoreDataProperties.swift
3+
// Adamant
4+
//
5+
// Created by Anokhov Pavel on 07.02.2018.
6+
// Copyright © 2018 Adamant. All rights reserved.
7+
//
8+
//
9+
10+
import Foundation
11+
import CoreData
12+
13+
14+
extension TransferTransaction {
15+
16+
@nonobjc public class func fetchRequest() -> NSFetchRequest<TransferTransaction> {
17+
return NSFetchRequest<TransferTransaction>(entityName: "TransferTransaction")
18+
}
19+
20+
@NSManaged public var partner: CoreDataAccount?
21+
22+
}
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
//
2+
// AdamantUserInfoKeys.swift
3+
// Adamant
4+
//
5+
// Created by Anokhov Pavel on 02.02.2018.
6+
// Copyright © 2018 Adamant. All rights reserved.
7+
//
8+
9+
import Foundation
10+
11+
struct AdamantUserInfoKey {
12+
private init() {}
13+
}

Adamant/Info.plist

Lines changed: 2 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.1.3</string>
20+
<string>0.1.4</string>
2121
<key>CFBundleVersion</key>
22-
<string>4</string>
22+
<string>5</string>
2323
<key>LSRequiresIPhoneOS</key>
2424
<true/>
2525
<key>UIAppFonts</key>

Adamant/ServiceProtocols/ApiService.swift

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ protocol ApiService {
1818
func newAccount(byPublicKey publicKey: String, completionHandler: @escaping (Account?, AdamantError?) -> Void)
1919
func getAccount(byPassphrase passphrase: String, completionHandler: @escaping (Account?, AdamantError?) -> Void)
2020
func getAccount(byPublicKey publicKey: String, completionHandler: @escaping (Account?, AdamantError?) -> Void)
21+
func getAccount(byAddress address: String, completionHandler: @escaping (Account?, AdamantError?) -> Void)
2122

2223

2324
// MARK: - Keys
@@ -28,7 +29,7 @@ protocol ApiService {
2829
// MARK: - Transactions
2930

3031
func getTransaction(id: UInt, completionHandler: @escaping (Transaction?, AdamantError?) -> Void)
31-
func getTransactions(forAccount: String, type: TransactionType, completionHandler: @escaping ([Transaction]?, AdamantError?) -> Void)
32+
func getTransactions(forAccount: String, type: TransactionType, fromHeight: UInt?, completionHandler: @escaping ([Transaction]?, AdamantError?) -> Void)
3233

3334

3435
// MARK: - Funds

0 commit comments

Comments
 (0)