diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 67a5bd90..7605ec58 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -1,10 +1,14 @@ -name: iOS Unit Tests +name: Unit Tests on: push: - branches: [ "main" ] + branches: ["main"] pull_request: - branches: [ "main" ] + branches: ["main"] + +env: + SCCACHE_GHA_ENABLED: "true" + RUSTC_WRAPPER: "sccache" jobs: unit_test: @@ -16,6 +20,21 @@ jobs: uses: actions/checkout@v4 with: submodules: true + - uses: actions/cache@v3 + with: + path: | + ~/.cargo/registry + ~/.cargo/git + target + key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }} + + - name: Run sccache-cache + uses: mozilla-actions/sccache-action@v0.0.3 + + - name: Install dependencies + run: | + make install-typeshare && make install-toolchains + brew install swiftgen xcbeautify - name: Build Core run: make generate diff --git a/.gitignore b/.gitignore index a5cc3401..6e8eeb09 100644 --- a/.gitignore +++ b/.gitignore @@ -9,3 +9,4 @@ DerivedData/ .DS_Store *~ Packages/Gemstone/ +.vscode/settings.json diff --git a/Makefile b/Makefile index 9f05ca61..e0314fde 100644 --- a/Makefile +++ b/Makefile @@ -20,7 +20,11 @@ core-upgrade: git submodule update --recursive --remote test: - cd xcodebuild -scheme Gem -destination 'platform=iOS Simulator,name=iPhone 14' test | xcbeautify + @set -o pipefail && xcodebuild -project Gem.xcodeproj \ + -scheme Gem \ + -sdk iphonesimulator \ + -destination "platform=iOS Simulator,name=iPhone 15" \ + test | xcbeautify localize: @sh core/scripts/localize.sh ios Assets diff --git a/Packages/Keystore/Tests/KeystoreTests/LocalKeystoreTests.swift b/Packages/Keystore/Tests/KeystoreTests/LocalKeystoreTests.swift index fbac664a..1104cb2b 100644 --- a/Packages/Keystore/Tests/KeystoreTests/LocalKeystoreTests.swift +++ b/Packages/Keystore/Tests/KeystoreTests/LocalKeystoreTests.swift @@ -157,7 +157,7 @@ extension LocalKeystore { let id = NSUUID().uuidString return LocalKeystore( folder: id, - walletStore: WalletStore(db: DB(path: "\(id)..sqlite")), + walletStore: WalletStore(db: DB(path: "\(id).sqlite")), preferences: preferences, keystorePassword: keystorePassword ) diff --git a/Packages/Primitives/Sources/AssetDetails.swift b/Packages/Primitives/Sources/AssetDetails.swift index 057e0979..d5a0ec98 100644 --- a/Packages/Primitives/Sources/AssetDetails.swift +++ b/Packages/Primitives/Sources/AssetDetails.swift @@ -66,6 +66,16 @@ public struct AssetFull: Codable { } } +public struct AssetMarketPrice: Codable { + public let price: Price? + public let market: AssetMarket? + + public init(price: Price?, market: AssetMarket?) { + self.price = price + self.market = market + } +} + public struct AssetDetailsInfo: Codable { public let details: AssetDetails public let market: AssetMarket diff --git a/Packages/Store/Sources/DB.swift b/Packages/Store/Sources/DB.swift index 89bf922f..a70a6073 100644 --- a/Packages/Store/Sources/DB.swift +++ b/Packages/Store/Sources/DB.swift @@ -4,29 +4,29 @@ import GRDB public class DB: ObservableObject { private let documentsDirectory = NSSearchPathForDirectoriesInDomains(.documentDirectory, .userDomainMask, true)[0] public let dbQueue: DatabaseQueue - + static let ignoreMethods = ["COMMIT TRANSACTION", "PRAGMA query_only", "BEGIN DEFERRED TRANSACTION"].asSet() - + public static var defaultConfiguration: GRDB.Configuration = { var config = GRDB.Configuration() - #if DEBUG +#if DEBUG config.publicStatementArguments = true config.prepareDatabase { db in db.trace { //sql in switch $0 { case .profile(let statement, let duration): - break + break //NSLog("profile SQL> \(statement)") case .statement(let statement): let sql = statement.sql - + if ignoreMethods.filter({ sql.description.contains($0) }).isEmpty { //NSLog("SQL> \(sql)") } } } } - #endif +#endif return config }() let dbPath: URL @@ -36,9 +36,9 @@ public class DB: ObservableObject { path: String, configuration: GRDB.Configuration = DB.defaultConfiguration ) { - dbPath = URL(fileURLWithPath: String(format: "%@/%@", documentsDirectory, path)) + dbPath = try! FileManager.default.url(for: .documentDirectory, in: .userDomainMask, appropriateFor: nil, create: true).appending(path: path) dbQueue = try! DatabaseQueue(path: dbPath.absoluteString, configuration: configuration) - + try! migrations.run(dbQueue: dbQueue) } diff --git a/README.md b/README.md index 6458a3e7..174cccb3 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,7 @@ # 💎 Gem Wallet - iOS +[![iOS Unit Tests](https://github.com/gemwalletcom/gem-ios/actions/workflows/ci.yml/badge.svg)](https://github.com/gemwalletcom/gem-ios/actions/workflows/ci.yml) + Gem Wallet is a powerful and secure mobile application designed for iOS and [Android](https://github.com/gemwalletcom/gem-android). It provides users with a seamless and intuitive experience to manage their digital assets and cryptocurrencies. The app is developed using SwiftUI. The codebase also includes a [Core](https://github.com/gemwalletcom/core) library implemented in Rust, providing efficient and secure cryptographic operations for enhanced data protection. @@ -32,7 +34,6 @@ The app is developed using SwiftUI. The codebase also includes a [Core](https:// - 🔔 **Customizable Notifications:** Set alerts for transactions, price changes, and important events. - 🛡️ **Advanced Security:** Encryption and secure key management. - ## 🏄‍♂️ Contributing @@ -60,6 +61,7 @@ If you want to contribute, you can use our [developers telegram](https://t.me/ge ## 🚀 Getting Started ### iOS Development + 1. Setup [Xcode](https://developer.apple.com/xcode) 2. Run `make boostrap-ios` to install all nessesary tools. @@ -69,7 +71,7 @@ We love contributors! Feel free to contribute to this project but please read th ## 🌍 Localization -Join us in making our app accessible worldwide! Contribute to localization efforts by visiting our [Lokalise project](https://app.lokalise.com/public/94865410644ee707546334.60736699) +Join us in making our app accessible worldwide! Contribute to localization efforts by visiting our [Lokalise project](https://app.lokalise.com/public/94865410644ee707546334.60736699) ## ⚖️ License