Skip to content

Commit

Permalink
Merge pull request #551 from Adamant-im/release/3.9.0
Browse files Browse the repository at this point in the history
Release 3.9.0
  • Loading branch information
StanislavDevIOS authored Sep 30, 2024
2 parents ec4b606 + 8803443 commit 01feef5
Show file tree
Hide file tree
Showing 346 changed files with 7,011 additions and 4,132 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,7 @@ xcuserdata/

### Here we store Release password. It's super-secret, not for git. ###
AdamantSecret.swift
GitData.plist
runkit ex.rtf
to do.rtf
tz.rtf
Expand Down
611 changes: 325 additions & 286 deletions Adamant.xcodeproj/project.pbxproj

Large diffs are not rendered by default.

12 changes: 6 additions & 6 deletions Adamant.xcworkspace/xcshareddata/swiftpm/Package.resolved
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@
"repositoryURL": "https://github.com/Alamofire/Alamofire.git",
"state": {
"branch": null,
"revision": "d120af1e8638c7da36c8481fd61a66c0c08dc4fc",
"version": "5.4.4"
"revision": "bc268c28fb170f494de9e9927c371b8342979ece",
"version": "5.7.1"
}
},
{
Expand Down Expand Up @@ -60,7 +60,7 @@
"repositoryURL": "https://github.com/EFPrefix/EFQRCode.git",
"state": {
"branch": null,
"revision": "2991c2f318ad9529d93b2a73a382a3f9c72c64ce",
"revision": "3a6c5012f1a0df404a92e55bb01b4b685ff5a2d1",
"version": "6.2.2"
}
},
Expand Down Expand Up @@ -309,11 +309,11 @@
},
{
"package": "swift_qrcodejs",
"repositoryURL": "https://github.com/ApolloZhu/swift_qrcodejs.git",
"repositoryURL": "https://github.com/EFPrefix/swift_qrcodejs.git",
"state": {
"branch": null,
"revision": "374dc7f7b9e76c6aeb393f6a84590c6d387e1ecb",
"version": "2.2.2"
"revision": "817ba220a2eba840bae888e7eeb11207bec05f8c",
"version": "2.3.0"
}
},
{
Expand Down
21 changes: 3 additions & 18 deletions Adamant/App/AppDelegate.swift
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,6 @@ extension StoreKey {
struct application {
static let welcomeScreensIsShown = "app.welcomeScreensIsShown"
static let eulaAccepted = "app.eulaAccepted"
static let firstRun = "app.firstRun"

private init() {}
}
Expand All @@ -62,10 +61,7 @@ class AppDelegate: UIResponder, UIApplicationDelegate {

// MARK: - Lifecycle

func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
// MARK: 0. Migrate keychain if needed
KeychainStore.migrateIfNeeded()

func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
// MARK: 1. Initiating Swinject
container = AppContainer()
screensFactory = AdamantScreensFactory(assembler: container.assembler)
Expand All @@ -82,17 +78,6 @@ class AppDelegate: UIResponder, UIApplicationDelegate {
.resolve(CrashlyticsService.self)?
.configureIfNeeded()

// MARK: 1.2 First run flag
let firstRun = UserDefaults.standard.bool(forKey: StoreKey.application.firstRun)

if !firstRun {
UserDefaults.standard.set(true, forKey: StoreKey.application.firstRun)

if let securedStore = container.resolve(SecuredStore.self) {
securedStore.purgeStore()
}
}

// MARK: 2. Init UI
let window = UIWindow(frame: UIScreen.main.bounds)
self.window = window
Expand Down Expand Up @@ -263,11 +248,11 @@ class AppDelegate: UIResponder, UIApplicationDelegate {
dialogService.showError(withMessage: "Failed to register AddressBookService autoupdate. Please, report a bug", supportEmail: true, error: nil)
}

if let currencyInfoService = container.resolve(CurrencyInfoService.self) {
if let currencyInfoService = container.resolve(InfoServiceProtocol.self) {
currencyInfoService.update() // Initial update
repeater.registerForegroundCall(label: "currencyInfoService", interval: 60, queue: .global(qos: .utility), callback: currencyInfoService.update)
} else {
dialogService.showError(withMessage: "Failed to register CurrencyInfoService autoupdate. Please, report a bug", supportEmail: true, error: nil)
dialogService.showError(withMessage: "Failed to register InfoServiceProtocol autoupdate. Please, report a bug", supportEmail: true, error: nil)
}

// MARK: 7. Logout reset
Expand Down
122 changes: 84 additions & 38 deletions Adamant/App/DI/AppAssembly.swift
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,9 @@ struct AppAssembly: Assembly {
container.register(CellFactory.self) { _ in AdamantCellFactory() }.inObjectScope(.container)

// MARK: Secured Store
container.register(SecuredStore.self) { _ in KeychainStore() }.inObjectScope(.container)
container.register(SecuredStore.self) { _ in
KeychainStore(secureStorage: AdamantSecureStorage())
}.inObjectScope(.container)

// MARK: LocalAuthentication
container.register(LocalAuthentication.self) { _ in AdamantAuthentication() }.inObjectScope(.container)
Expand All @@ -43,16 +45,23 @@ struct AppAssembly: Assembly {
// MARK: - Services with dependencies
// MARK: DialogService
container.register(DialogService.self) { r in
AdamantDialogService(vibroService: r.resolve(VibroService.self)!)
AdamantDialogService(
vibroService: r.resolve(VibroService.self)!,
notificationsService: r.resolve(NotificationsService.self)!
)
}.inObjectScope(.container)

// MARK: Notifications
container.register(NotificationsService.self) { r in
AdamantNotificationsService(securedStore: r.resolve(SecuredStore.self)!)
AdamantNotificationsService(
securedStore: r.resolve(SecuredStore.self)!,
vibroService: r.resolve(VibroService.self)!
)
}.initCompleted { (r, c) in // Weak reference
Task { @MainActor in
guard let service = c as? AdamantNotificationsService else { return }
service.accountService = r.resolve(AccountService.self)
service.chatsProvider = r.resolve(ChatsProvider.self)
}
}.inObjectScope(.container)

Expand Down Expand Up @@ -95,15 +104,21 @@ struct AppAssembly: Assembly {
container.register(PushNotificationsTokenService.self) { r in
AdamantPushNotificationsTokenService(
securedStore: r.resolve(SecuredStore.self)!,
apiService: r.resolve(ApiService.self)!,
apiService: r.resolve(AdamantApiServiceProtocol.self)!,
adamantCore: r.resolve(AdamantCore.self)!,
accountService: r.resolve(AccountService.self)!
)
}.inObjectScope(.container)

// MARK: NodesStorage
container.register(NodesStorageProtocol.self) { r in
NodesStorage(securedStore: r.resolve(SecuredStore.self)!)
NodesStorage(
securedStore: r.resolve(SecuredStore.self)!,
nodesMergingService: r.resolve(NodesMergingServiceProtocol.self)!,
defaultNodes: { [provider = r.resolve(DefaultNodesProvider.self)!] groups in
provider.get(groups)
}
)
}.inObjectScope(.container)

// MARK: NodesAdditionalParamsStorage
Expand All @@ -117,28 +132,30 @@ struct AppAssembly: Assembly {
}.inObjectScope(.container)

// MARK: ApiService
container.register(ApiService.self) { r in
container.register(AdamantApiServiceProtocol.self) { r in
AdamantApiService(
healthCheckWrapper: .init(
service: .init(apiCore: r.resolve(APICoreProtocol.self)!),
nodesStorage: r.resolve(NodesStorageProtocol.self)!,
nodesAdditionalParamsStorage: r.resolve(NodesAdditionalParamsStorageProtocol.self)!,
nodeGroup: .adm
isActive: true,
params: NodeGroup.adm.blockchainHealthCheckParams,
connection: r.resolve(ReachabilityMonitor.self)!.connectionPublisher
),
adamantCore: r.resolve(AdamantCore.self)!
)
}.inObjectScope(.container)

// MARK: IPFSApiService
container.register(IPFSApiService.self) { r in
IPFSApiService(
healthCheckWrapper: .init(
service: .init(apiCore: r.resolve(APICoreProtocol.self)!),
nodesStorage: r.resolve(NodesStorageProtocol.self)!,
nodesAdditionalParamsStorage: r.resolve(NodesAdditionalParamsStorageProtocol.self)!,
nodeGroup: .ipfs
)
)
IPFSApiService(healthCheckWrapper: .init(
service: .init(apiCore: r.resolve(APICoreProtocol.self)!),
nodesStorage: r.resolve(NodesStorageProtocol.self)!,
nodesAdditionalParamsStorage: r.resolve(NodesAdditionalParamsStorageProtocol.self)!,
isActive: true,
params: NodeGroup.ipfs.blockchainHealthCheckParams,
connection: r.resolve(ReachabilityMonitor.self)!.connectionPublisher
))
}.inObjectScope(.container)

// MARK: FilesNetworkManagerProtocol
Expand All @@ -152,7 +169,9 @@ struct AppAssembly: Assembly {
service: .init(apiCore: r.resolve(APICoreProtocol.self)!),
nodesStorage: r.resolve(NodesStorageProtocol.self)!,
nodesAdditionalParamsStorage: r.resolve(NodesAdditionalParamsStorageProtocol.self)!,
nodeGroup: .btc
isActive: true,
params: NodeGroup.btc.blockchainHealthCheckParams,
connection: r.resolve(ReachabilityMonitor.self)!.connectionPublisher
))
}.inObjectScope(.container)

Expand All @@ -162,7 +181,9 @@ struct AppAssembly: Assembly {
service: .init(apiCore: r.resolve(APICoreProtocol.self)!),
nodesStorage: r.resolve(NodesStorageProtocol.self)!,
nodesAdditionalParamsStorage: r.resolve(NodesAdditionalParamsStorageProtocol.self)!,
nodeGroup: .doge
isActive: true,
params: NodeGroup.doge.blockchainHealthCheckParams,
connection: r.resolve(ReachabilityMonitor.self)!.connectionPublisher
))
}.inObjectScope(.container)

Expand All @@ -172,7 +193,9 @@ struct AppAssembly: Assembly {
service: .init(apiCore: r.resolve(APICoreProtocol.self)!),
nodesStorage: r.resolve(NodesStorageProtocol.self)!,
nodesAdditionalParamsStorage: r.resolve(NodesAdditionalParamsStorageProtocol.self)!,
nodeGroup: .dash
isActive: true,
params: NodeGroup.dash.blockchainHealthCheckParams,
connection: r.resolve(ReachabilityMonitor.self)!.connectionPublisher
))
}.inObjectScope(.container)

Expand All @@ -182,7 +205,9 @@ struct AppAssembly: Assembly {
service: .init(),
nodesStorage: r.resolve(NodesStorageProtocol.self)!,
nodesAdditionalParamsStorage: r.resolve(NodesAdditionalParamsStorageProtocol.self)!,
nodeGroup: .klyNode
isActive: true,
params: NodeGroup.klyNode.blockchainHealthCheckParams,
connection: r.resolve(ReachabilityMonitor.self)!.connectionPublisher
))
}.inObjectScope(.container)

Expand All @@ -192,7 +217,9 @@ struct AppAssembly: Assembly {
service: .init(),
nodesStorage: r.resolve(NodesStorageProtocol.self)!,
nodesAdditionalParamsStorage: r.resolve(NodesAdditionalParamsStorageProtocol.self)!,
nodeGroup: .klyService
isActive: true,
params: NodeGroup.klyService.blockchainHealthCheckParams,
connection: r.resolve(ReachabilityMonitor.self)!.connectionPublisher
))
}.inObjectScope(.container)

Expand All @@ -207,7 +234,9 @@ struct AppAssembly: Assembly {
service: .init(apiCore: r.resolve(APICoreProtocol.self)!),
nodesStorage: r.resolve(NodesStorageProtocol.self)!,
nodesAdditionalParamsStorage: r.resolve(NodesAdditionalParamsStorageProtocol.self)!,
nodeGroup: .eth
isActive: true,
params: NodeGroup.eth.blockchainHealthCheckParams,
connection: r.resolve(ReachabilityMonitor.self)!.connectionPublisher
))
}.inObjectScope(.container)

Expand All @@ -222,40 +251,32 @@ struct AppAssembly: Assembly {
// MARK: AccountService
container.register(AccountService.self) { r in
AdamantAccountService(
apiService: r.resolve(ApiService.self)!,
apiService: r.resolve(AdamantApiServiceProtocol.self)!,
adamantCore: r.resolve(AdamantCore.self)!,
dialogService: r.resolve(DialogService.self)!,
securedStore: r.resolve(SecuredStore.self)!,
walletServiceCompose: r.resolve(WalletServiceCompose.self)!
walletServiceCompose: r.resolve(WalletServiceCompose.self)!,
currencyInfoService: r.resolve(InfoServiceProtocol.self)!
)
}.inObjectScope(.container).initCompleted { (r, c) in
Task { @MainActor in
guard let service = c as? AdamantAccountService else { return }
service.notificationsService = r.resolve(NotificationsService.self)!
service.pushNotificationsTokenService = r.resolve(PushNotificationsTokenService.self)!
service.currencyInfoService = r.resolve(CurrencyInfoService.self)!
service.visibleWalletService = r.resolve(VisibleWalletsService.self)!
}
}

// MARK: AddressBookServeice
container.register(AddressBookService.self) { r in
AdamantAddressBookService(
apiService: r.resolve(ApiService.self)!,
apiService: r.resolve(AdamantApiServiceProtocol.self)!,
adamantCore: r.resolve(AdamantCore.self)!,
accountService: r.resolve(AccountService.self)!,
dialogService: r.resolve(DialogService.self)!
)
}.inObjectScope(.container)

// MARK: CurrencyInfoService
container.register(CurrencyInfoService.self) { r in
AdamantCurrencyInfoService(
securedStore: r.resolve(SecuredStore.self)!,
walletServiceCompose: r.resolve(WalletServiceCompose.self)!
)
}.inObjectScope(.container)

// MARK: LanguageStorageProtocol
container.register(LanguageStorageProtocol.self) { _ in
LanguageStorageService()
Expand All @@ -271,15 +292,15 @@ struct AppAssembly: Assembly {
container.register(AccountsProvider.self) { r in
AdamantAccountsProvider(
stack: r.resolve(CoreDataStack.self)!,
apiService: r.resolve(ApiService.self)!,
apiService: r.resolve(AdamantApiServiceProtocol.self)!,
addressBookService: r.resolve(AddressBookService.self)!
)
}.inObjectScope(.container)

// MARK: Transfers
container.register(TransfersProvider.self) { r in
AdamantTransfersProvider(
apiService: r.resolve(ApiService.self)!,
apiService: r.resolve(AdamantApiServiceProtocol.self)!,
stack: r.resolve(CoreDataStack.self)!,
adamantCore: r.resolve(AdamantCore.self)!,
accountService: r.resolve(AccountService.self)!,
Expand Down Expand Up @@ -312,7 +333,7 @@ struct AppAssembly: Assembly {
container.register(ChatsProvider.self) { r in
AdamantChatsProvider(
accountService: r.resolve(AccountService.self)!,
apiService: r.resolve(ApiService.self)!,
apiService: r.resolve(AdamantApiServiceProtocol.self)!,
socketService: r.resolve(SocketService.self)!,
stack: r.resolve(CoreDataStack.self)!,
adamantCore: r.resolve(AdamantCore.self)!,
Expand Down Expand Up @@ -344,7 +365,7 @@ struct AppAssembly: Assembly {
container.register(RichTransactionReplyService.self) { r in
AdamantRichTransactionReplyService(
coreDataStack: r.resolve(CoreDataStack.self)!,
apiService: r.resolve(ApiService.self)!,
apiService: r.resolve(AdamantApiServiceProtocol.self)!,
adamantCore: r.resolve(AdamantCore.self)!,
accountService: r.resolve(AccountService.self)!,
walletServiceCompose: r.resolve(WalletServiceCompose.self)!
Expand All @@ -355,7 +376,7 @@ struct AppAssembly: Assembly {
container.register(RichTransactionReactService.self) { r in
AdamantRichTransactionReactService(
coreDataStack: r.resolve(CoreDataStack.self)!,
apiService: r.resolve(ApiService.self)!,
apiService: r.resolve(AdamantApiServiceProtocol.self)!,
adamantCore: r.resolve(AdamantCore.self)!,
accountService: r.resolve(AccountService.self)!
)
Expand Down Expand Up @@ -400,5 +421,30 @@ struct AppAssembly: Assembly {
}
}
}

// MARK: ApiService Compose
container.register(ApiServiceComposeProtocol.self) {
ApiServiceCompose(
btc: $0.resolve(BtcApiService.self)!,
eth: $0.resolve(EthApiService.self)!,
klyNode: $0.resolve(KlyNodeApiService.self)!,
klyService: $0.resolve(KlyServiceApiService.self)!,
doge: $0.resolve(DogeApiService.self)!,
dash: $0.resolve(DashApiService.self)!,
adm: $0.resolve(AdamantApiServiceProtocol.self)!,
ipfs: $0.resolve(IPFSApiService.self)!,
infoService: $0.resolve(InfoServiceApiServiceProtocol.self)!
)
}.inObjectScope(.transient)

// MARK: NodesMergingService
container.register(NodesMergingServiceProtocol.self) { _ in
NodesMergingService()
}.inObjectScope(.transient)

// MARK: DefaultNodesProvider
container.register(DefaultNodesProvider.self) { _ in
DefaultNodesProvider()
}.inObjectScope(.transient)
}
}
5 changes: 4 additions & 1 deletion Adamant/App/DI/AppContainer.swift
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,10 @@
import Swinject

struct AppContainer {
let assembler = Assembler([AppAssembly()])
let assembler = Assembler([
AppAssembly(),
InfoServiceAssembly()
])

func resolve<T>(_ type: T.Type) -> T? {
assembler.resolve(T.self)
Expand Down
Binary file added Adamant/Assets/antic.mp3
Binary file not shown.
Binary file added Adamant/Assets/cheers.mp3
Binary file not shown.
Binary file added Adamant/Assets/chord.mp3
Binary file not shown.
Binary file added Adamant/Assets/droplet.mp3
Binary file not shown.
Binary file added Adamant/Assets/handoff.mp3
Binary file not shown.
Binary file added Adamant/Assets/milestone.mp3
Binary file not shown.
Binary file added Adamant/Assets/note.mp3
Binary file not shown.
Binary file added Adamant/Assets/passage.mp3
Binary file not shown.
Binary file added Adamant/Assets/portal.mp3
Binary file not shown.
Binary file added Adamant/Assets/rattle.mp3
Binary file not shown.
Binary file added Adamant/Assets/rebound.mp3
Binary file not shown.
Binary file added Adamant/Assets/slide.mp3
Binary file not shown.
Binary file added Adamant/Assets/welcome.mp3
Binary file not shown.
Loading

0 comments on commit 01feef5

Please sign in to comment.