Skip to content

Commit

Permalink
Merge pull request #711 from WalletConnect/develop
Browse files Browse the repository at this point in the history
1.3.2
  • Loading branch information
llbartekll authored Feb 9, 2023
2 parents f5bd5ff + 494904a commit a11d26c
Show file tree
Hide file tree
Showing 49 changed files with 823 additions and 99 deletions.
1 change: 1 addition & 0 deletions .env.Showcase
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
SCHEME = "Showcase"
APP_IDENTIFIER = "com.walletconnect.chat"
MATCH_IDENTIFIERS = "com.walletconnect.chat"
APPLE_ID = "1634760092"
1 change: 1 addition & 0 deletions .env.WalletApp
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
SCHEME = "WalletApp"
APP_IDENTIFIER = "com.walletconnect.walletapp"
MATCH_IDENTIFIERS = "com.walletconnect.walletapp,com.walletconnect.walletapp.PNDecryptionService"
APPLE_ID = "1667351690"
42 changes: 42 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
name: release

on:
schedule:
# Runs "Every Monday 10am CET"
- cron: '0 10 * * 1'

workflow_dispatch:

jobs:
build:
runs-on: macos-12

steps:
- uses: actions/checkout@v2

- name: Setup Xcode Version
uses: maxim-lobanov/setup-xcode@v1
with:
xcode-version: 14.1

- uses: actions/cache@v2
with:
path: |
.build
SourcePackagesCache
DerivedDataCache
key: ${{ runner.os }}-spm-${{ hashFiles('**/Package.resolved') }}
restore-keys: |
${{ runner.os }}-spm-
- name: Release
shell: bash
env:
MATCH_PASSWORD: ${{ secrets.MATCH_PASSWORD }}
GH_TOKEN: ${{ secrets.GH_TOKEN }}
GH_USER: ${{ secrets.GH_USER }}
APPLE_ISSUER_ID: ${{ secrets.APPLE_ISSUER_ID }}
APPLE_KEY_ID: ${{ secrets.APPLE_KEY_ID }}
APPLE_KEY_CONTENT: ${{ secrets.APPLE_KEY_CONTENT }}
run: |
make release_all APPLE_ID=${{ secrets.APPLE_ID }} TOKEN=$(echo -n $GH_USER:$GH_TOKEN | base64)
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ fastlane/Preview.html
fastlane/screenshots/**/*.png
fastlane/test_output
fastlane/README.md
.env

# Configuration
Configuration.xcconfig
Expand All @@ -28,4 +29,5 @@ SourcePackagesCache
DerivedDataCache

# Artifacts
*.ipa
*.ipa
*.zip
67 changes: 67 additions & 0 deletions .swiftpm/xcode/xcshareddata/xcschemes/WalletConnectEcho.xcscheme
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "1420"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"
buildImplicitDependencies = "YES">
<BuildActionEntries>
<BuildActionEntry
buildForTesting = "YES"
buildForRunning = "YES"
buildForProfiling = "YES"
buildForArchiving = "YES"
buildForAnalyzing = "YES">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "WalletConnectEcho"
BuildableName = "WalletConnectEcho"
BlueprintName = "WalletConnectEcho"
ReferencedContainer = "container:">
</BuildableReference>
</BuildActionEntry>
</BuildActionEntries>
</BuildAction>
<TestAction
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
shouldUseLaunchSchemeArgsEnv = "YES">
<Testables>
</Testables>
</TestAction>
<LaunchAction
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
launchStyle = "0"
useCustomWorkingDirectory = "NO"
ignoresPersistentStateOnLaunch = "NO"
debugDocumentVersioning = "YES"
debugServiceExtension = "internal"
allowLocationSimulation = "YES">
</LaunchAction>
<ProfileAction
buildConfiguration = "Release"
shouldUseLaunchSchemeArgsEnv = "YES"
savedToolIdentifier = ""
useCustomWorkingDirectory = "NO"
debugDocumentVersioning = "YES">
<MacroExpansion>
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "WalletConnectEcho"
BuildableName = "WalletConnectEcho"
BlueprintName = "WalletConnectEcho"
ReferencedContainer = "container:">
</BuildableReference>
</MacroExpansion>
</ProfileAction>
<AnalyzeAction
buildConfiguration = "Debug">
</AnalyzeAction>
<ArchiveAction
buildConfiguration = "Release"
revealArchiveInOrganizer = "YES">
</ArchiveAction>
</Scheme>
145 changes: 128 additions & 17 deletions Example/ExampleApp.xcodeproj/project.pbxproj

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion Example/IntegrationTests/Pairing/PairingTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ final class PairingTests: XCTestCase {
let (pairingClient, networkingInteractor, keychain, keyValueStorage) = makeClientDependencies(prefix: prefix)
let pushLogger = ConsoleLogger(suffix: prefix + " [Push]", loggingLevel: .debug)
walletPairingClient = pairingClient
let echoClient = EchoClientFactory.create(projectId: "", clientId: "", echoHost: "echo.walletconnect.com")
let echoClient = EchoClientFactory.create(projectId: "", clientId: "", echoHost: "echo.walletconnect.com", environment: .sandbox)
walletPushClient = WalletPushClientFactory.create(logger: pushLogger,
keyValueStorage: keyValueStorage,
keychainStorage: keychain,
Expand Down
2 changes: 1 addition & 1 deletion Example/IntegrationTests/Push/PushTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ final class PushTests: XCTestCase {
let (pairingClient, networkingInteractor, keychain, keyValueStorage) = makeClientDependencies(prefix: prefix)
let pushLogger = ConsoleLogger(suffix: prefix + " [Push]", loggingLevel: .debug)
walletPairingClient = pairingClient
let echoClient = EchoClientFactory.create(projectId: "", clientId: "", echoHost: "echo.walletconnect.com")
let echoClient = EchoClientFactory.create(projectId: "", clientId: "", echoHost: "echo.walletconnect.com", environment: .sandbox)
walletPushClient = WalletPushClientFactory.create(logger: pushLogger,
keyValueStorage: keyValueStorage,
keychainStorage: keychain,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,7 @@ struct ThirdPartyConfigurator: Configurator {
)

Web3Wallet.configure(metadata: metadata, signerFactory: DefaultSignerFactory())
Push.configure()

Push.configure(environment: BuildConfiguration.shared.apnsEnvironment)
}

}
27 changes: 27 additions & 0 deletions Example/WalletApp/Common/BuildConfiguration.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
import Foundation
import WalletConnectPush

class BuildConfiguration {
enum Environment: String {
case debug = "Debug"
case release = "Release"
}

static let shared = BuildConfiguration()

var environment: Environment

var apnsEnvironment: APNSEnvironment {
switch environment {
case .debug:
return .sandbox
case .release:
return .production
}
}

init() {
let currentConfiguration = Bundle.main.object(forInfoDictionaryKey: "CONFIGURATION") as! String
environment = Environment(rawValue: currentConfiguration)!
}
}
12 changes: 8 additions & 4 deletions Example/WalletApp/Other/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,10 @@
</dict>
<key>PROJECT_ID</key>
<string>$(PROJECT_ID)</string>
<key>NSCameraUsageDescription</key>
<string>Camera access for scanning QR code</string>
<key>SIMULATOR_IDENTIFIER</key>
<string>$(SIMULATOR_IDENTIFIER)</string>
<key>CONFIGURATION</key>
<string>$(CONFIGURATION)</string>
<key>UIApplicationSceneManifest</key>
<dict>
<key>UIApplicationSupportsMultipleScenes</key>
Expand All @@ -47,7 +49,9 @@
</array>
</dict>
</dict>
<key>SIMULATOR_IDENTIFIER</key>
<string>$(SIMULATOR_IDENTIFIER)</string>
<key>UIBackgroundModes</key>
<array>
<string>remote-notification</string>
</array>
</dict>
</plist>
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
import Combine
import Web3Wallet
import WalletConnectPush
import Foundation

final class MainInteractor {

var sessionProposalPublisher: AnyPublisher<Session.Proposal, Never> {
return Web3Wallet.instance.sessionProposalPublisher
}

var pushRequestPublisher: AnyPublisher<(id: RPCID, account: Account, metadata: AppMetadata), Never> {
return Push.wallet.requestPublisher
}
}
17 changes: 17 additions & 0 deletions Example/WalletApp/PresentationLayer/Wallet/Main/MainModule.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
import SwiftUI

final class MainModule {

@discardableResult
static func create(app: Application) -> UIViewController {
let router = MainRouter(app: app)
let interactor = MainInteractor()
let presenter = MainPresenter(router: router, interactor: interactor)
let viewController = MainViewController(presenter: presenter)

router.viewController = viewController

return viewController
}

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
import UIKit
import Combine

final class MainPresenter {

private let interactor: MainInteractor
private let router: MainRouter
private var disposeBag = Set<AnyCancellable>()

var tabs: [TabPage] {
return TabPage.allCases
}

var viewControllers: [UIViewController] {
return [
router.walletViewController(),
router.notificationsViewController(),
]
}

init(router: MainRouter,
interactor: MainInteractor) {
defer {
setupInitialState()
}
self.router = router
self.interactor = interactor
}
}

// MARK: - Private functions
extension MainPresenter {
private func setupInitialState() {
interactor.pushRequestPublisher
.receive(on: DispatchQueue.main)
.sink { [weak self] request in
self?.router.present(pushRequest: request)
}.store(in: &disposeBag)

interactor.sessionProposalPublisher
.receive(on: DispatchQueue.main)
.sink { [weak self] proposal in
self?.router.present(proposal: proposal)
}
.store(in: &disposeBag)
}
}

33 changes: 33 additions & 0 deletions Example/WalletApp/PresentationLayer/Wallet/Main/MainRouter.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
import UIKit
import WalletConnectPush
import Web3Wallet
final class MainRouter {

weak var viewController: UIViewController!

private let app: Application

func walletViewController() -> UIViewController {
return WalletModule.create(app: app)
.wrapToNavigationController()
}

func present(proposal: Session.Proposal) {
SessionProposalModule.create(app: app, proposal: proposal)
.presentFullScreen(from: viewController, transparentBackground: true)
}

func notificationsViewController() -> UIViewController {
return NotificationsModule.create(app: app)
.wrapToNavigationController()
}

func present(pushRequest: PushRequest) {
PushRequestModule.create(app: app, pushRequest: pushRequest)
.presentFullScreen(from: viewController, transparentBackground: true)
}

init(app: Application) {
self.app = app
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
import UIKit

final class MainViewController: UITabBarController {

private let presenter: MainPresenter

init(presenter: MainPresenter) {
self.presenter = presenter
super.init(nibName: nil, bundle: nil)
}

override func viewDidLoad() {
super.viewDidLoad()

setupTabs()
}

private func setupTabs() {
let viewControllers = presenter.viewControllers

for (index, viewController) in viewControllers.enumerated() {
let model = presenter.tabs[index]
let item = UITabBarItem()
item.title = model.title
item.image = model.icon
item.isEnabled = TabPage.enabledTabs.contains(model)
viewController.tabBarItem = item
viewController.view.backgroundColor = .w_background
}

self.viewControllers = viewControllers
self.selectedIndex = TabPage.selectedIndex
}

required init?(coder: NSCoder) {
fatalError("init(coder:) has not been implemented")
}
}
Loading

0 comments on commit a11d26c

Please sign in to comment.