Skip to content

Commit

Permalink
Merge pull request #1294 from novasamatech/base/seamless-dapp-browser
Browse files Browse the repository at this point in the history
Base/seamless dapp browser
  • Loading branch information
svojsu authored Jan 15, 2025
2 parents 51a86d9 + 6e68065 commit 80ce4cb
Show file tree
Hide file tree
Showing 262 changed files with 12,013 additions and 2,883 deletions.
846 changes: 682 additions & 164 deletions novawallet.xcodeproj/project.pbxproj

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
{
"colors" : [
{
"color" : {
"color-space" : "srgb",
"components" : {
"alpha" : "1.000",
"blue" : "0xC3",
"green" : "0xB9",
"red" : "0xB8"
}
},
"idiom" : "universal"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
{
"colors" : [
{
"color" : {
"color-space" : "srgb",
"components" : {
"alpha" : "0.880",
"blue" : "0xFF",
"green" : "0xFF",
"red" : "0xFF"
}
},
"idiom" : "universal"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
{
"colors" : [
{
"color" : {
"color-space" : "srgb",
"components" : {
"alpha" : "0.480",
"blue" : "0x0E",
"green" : "0x09",
"red" : "0x08"
}
},
"idiom" : "universal"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
{
"colors" : [
{
"color" : {
"color-space" : "srgb",
"components" : {
"alpha" : "1.000",
"blue" : "0x50",
"green" : "0x34",
"red" : "0xE5"
}
},
"idiom" : "universal"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
{
"colors" : [
{
"color" : {
"color-space" : "srgb",
"components" : {
"alpha" : "1.000",
"blue" : "0x9A",
"green" : "0x8F",
"red" : "0x8E"
}
},
"idiom" : "universal"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
{
"colors" : [
{
"color" : {
"color-space" : "srgb",
"components" : {
"alpha" : "1.000",
"blue" : "0x1C",
"green" : "0x08",
"red" : "0x05"
}
},
"idiom" : "universal"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
{
"colors" : [
{
"color" : {
"color-space" : "srgb",
"components" : {
"alpha" : "1.000",
"blue" : "0x00",
"green" : "0x00",
"red" : "0x00"
}
},
"idiom" : "universal"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}
12 changes: 12 additions & 0 deletions novawallet/Assets.xcassets/iconCloseDAppTab.imageset/Contents.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{
"images" : [
{
"filename" : "iconCloseDAppTab.pdf",
"idiom" : "universal"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}
Binary file not shown.
12 changes: 12 additions & 0 deletions novawallet/Assets.xcassets/iconDappNewTab.imageset/Contents.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{
"images" : [
{
"filename" : "iconDappNewTab.pdf",
"idiom" : "universal"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{
"images" : [
{
"filename" : "iconSiriPawBrowser.pdf",
"idiom" : "universal"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}
Binary file not shown.
5 changes: 5 additions & 0 deletions novawallet/Common/Configs/ApplicationConfigs.swift
Original file line number Diff line number Diff line change
Expand Up @@ -224,6 +224,11 @@ extension ApplicationConfig: ApplicationConfigProtocol {
.appendingPathComponent("files-cache").path
}

var webPageRenderCachePath: String {
FileManager.default.urls(for: .cachesDirectory, in: .userDomainMask)[0]
.appendingPathComponent("webpage-renders-cache").path
}

var commonTypesURL: URL {
URL(string: "https://raw.githubusercontent.com/novasamatech/nova-utils/master/chains/types/default.json")!
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,33 @@ protocol WalletListLocalStorageSubscriber where Self: AnyObject {
func subscribeAllWalletsProvider() -> StreamableProvider<ManagedMetaAccountModel>?

func subscribeWallet(by walletId: String) -> StreamableProvider<ManagedMetaAccountModel>?

func subscribeSelectedWalletProvider() -> StreamableProvider<ManagedMetaAccountModel>?
}

private extension WalletListLocalStorageSubscriber {
func subscribeWallets(
provider: StreamableProvider<ManagedMetaAccountModel>,
updateClosure: @escaping ([DataProviderChange<ManagedMetaAccountModel>]) -> Void,
failureClosure: @escaping (Error) -> Void
) -> StreamableProvider<ManagedMetaAccountModel>? {
let options = StreamableProviderObserverOptions(
alwaysNotifyOnRefresh: false,
waitsInProgressSyncOnAdd: false,
initialSize: 0,
refreshWhenEmpty: false
)

provider.addObserver(
self,
deliverOn: .main,
executing: updateClosure,
failing: failureClosure,
options: options
)

return provider
}
}

extension WalletListLocalStorageSubscriber {
Expand All @@ -27,22 +54,11 @@ extension WalletListLocalStorageSubscriber {
return
}

let options = StreamableProviderObserverOptions(
alwaysNotifyOnRefresh: false,
waitsInProgressSyncOnAdd: false,
initialSize: 0,
refreshWhenEmpty: false
return subscribeWallets(
provider: provider,
updateClosure: updateClosure,
failureClosure: failureClosure
)

provider.addObserver(
self,
deliverOn: .main,
executing: updateClosure,
failing: failureClosure,
options: options
)

return provider
}

func subscribeWallet(by walletId: String) -> StreamableProvider<ManagedMetaAccountModel>? {
Expand All @@ -58,26 +74,39 @@ extension WalletListLocalStorageSubscriber {
}

let failureClosure = { [weak self] (error: Error) in
self?.walletListLocalSubscriptionHandler.handleAllWallets(result: .failure(error))
self?.walletListLocalSubscriptionHandler.handleWallet(result: .failure(error), for: walletId)
return
}

let options = StreamableProviderObserverOptions(
alwaysNotifyOnRefresh: false,
waitsInProgressSyncOnAdd: false,
initialSize: 0,
refreshWhenEmpty: false
return subscribeWallets(
provider: provider,
updateClosure: updateClosure,
failureClosure: failureClosure
)
}

provider.addObserver(
self,
deliverOn: .main,
executing: updateClosure,
failing: failureClosure,
options: options
)
func subscribeSelectedWalletProvider() -> StreamableProvider<ManagedMetaAccountModel>? {
guard let provider = try? walletListLocalSubscriptionFactory.getSelectedWalletProvider() else {
return nil
}

return provider
let updateClosure = { [weak self] (changes: [DataProviderChange<ManagedMetaAccountModel>]) in
let wallet = changes.reduceToLastChange()

self?.walletListLocalSubscriptionHandler.handleSelectedWallet(result: .success(wallet))
return
}

let failureClosure = { [weak self] (error: Error) in
self?.walletListLocalSubscriptionHandler.handleSelectedWallet(result: .failure(error))
return
}

return subscribeWallets(
provider: provider,
updateClosure: updateClosure,
failureClosure: failureClosure
)
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,11 @@ import Operation_iOS
protocol WalletListLocalSubscriptionHandler {
func handleAllWallets(result: Result<[DataProviderChange<ManagedMetaAccountModel>], Error>)
func handleWallet(result: Result<ManagedMetaAccountModel?, Error>, for walletId: String)
func handleSelectedWallet(result: Result<ManagedMetaAccountModel?, Error>)
}

extension WalletListLocalSubscriptionHandler {
func handleAllWallets(result _: Result<[DataProviderChange<ManagedMetaAccountModel>], Error>) {}
func handleWallet(result _: Result<ManagedMetaAccountModel?, Error>, for _: String) {}
func handleSelectedWallet(result _: Result<ManagedMetaAccountModel?, Error>) {}
}
Loading

0 comments on commit 80ce4cb

Please sign in to comment.