gnunet-svn
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[taler-taler-ios] branch master updated: separate common taler code into


From: gnunet
Subject: [taler-taler-ios] branch master updated: separate common taler code into a local swift package
Date: Wed, 15 Jun 2022 20:10:02 +0200

This is an automated email from the git hooks/post-receive script.

jonathan-buchanan pushed a commit to branch master
in repository taler-ios.

The following commit(s) were added to refs/heads/master by this push:
     new 00e03dd  separate common taler code into a local swift package
00e03dd is described below

commit 00e03ddb0cc3ae1192f312c0f547097e9eeb5d17
Author: Jonathan Buchanan <jonathan.russ.buchanan@gmail.com>
AuthorDate: Wed Jun 15 14:09:48 2022 -0400

    separate common taler code into a local swift package
---
 Taler.xcodeproj/project.pbxproj                    |  22 ++++++++++------
 .../UserInterfaceState.xcuserstate                 | Bin 13567 -> 30487 bytes
 Taler/AppDelegate.swift                            |   6 ++++-
 Taler/BalanceList.swift                            |   4 +--
 Taler/BalanceRow.swift                             |   1 +
 Taler/WalletBackend.swift                          |  12 +++------
 bootstrap                                          |   5 ++--
 taler-swift/.gitignore                             |   9 +++++++
 taler-swift/Package.swift                          |  28 +++++++++++++++++++++
 .../Sources/taler-swift}/Amount.swift              |   8 +++---
 taler-swift/Sources/taler-swift/taler_swift.swift  |   6 +++++
 .../Tests/taler-swiftTests}/AmountTests.swift      |   0
 .../Tests/taler-swiftTests/taler_swiftTests.swift  |  11 ++++++++
 13 files changed, 86 insertions(+), 26 deletions(-)

diff --git a/Taler.xcodeproj/project.pbxproj b/Taler.xcodeproj/project.pbxproj
index 0943e6f..a1be70f 100644
--- a/Taler.xcodeproj/project.pbxproj
+++ b/Taler.xcodeproj/project.pbxproj
@@ -7,8 +7,8 @@
        objects = {
 
 /* Begin PBXBuildFile section */
+               ABC13AA32859962800D23185 /* taler-swift in Frameworks */ = {isa 
= PBXBuildFile; productRef = ABC13AA22859962800D23185 /* taler-swift */; };
                D112510026B12E3200D02E00 /* taler-wallet-embedded.js in 
CopyFiles */ = {isa = PBXBuildFile; fileRef = D11250FF26B12E3200D02E00 /* 
taler-wallet-embedded.js */; };
-               D1472E5526B9206800896566 /* AmountTests.swift in Sources */ = 
{isa = PBXBuildFile; fileRef = D1472E5426B9206800896566 /* AmountTests.swift 
*/; };
                D14AFD2124D232B300C51073 /* AppDelegate.swift in Sources */ = 
{isa = PBXBuildFile; fileRef = D14AFD2024D232B300C51073 /* AppDelegate.swift 
*/; };
                D14AFD2324D232B300C51073 /* SceneDelegate.swift in Sources */ = 
{isa = PBXBuildFile; fileRef = D14AFD2224D232B300C51073 /* SceneDelegate.swift 
*/; };
                D14AFD3824D232B500C51073 /* TalerTests.swift in Sources */ = 
{isa = PBXBuildFile; fileRef = D14AFD3724D232B500C51073 /* TalerTests.swift */; 
};
@@ -37,7 +37,6 @@
                D17D8B8525ADB29B001BD43D /* libcares.a in Frameworks */ = {isa 
= PBXBuildFile; fileRef = D17D8B4825ADB12B001BD43D /* libcares.a */; };
                D18DBB5E26DF160D00A4480D /* TimestampTests.swift in Sources */ 
= {isa = PBXBuildFile; fileRef = D18DBB5D26DF160D00A4480D /* 
TimestampTests.swift */; };
                D1AFF0F3268D59C200FBB744 /* libiono.a in Frameworks */ = {isa = 
PBXBuildFile; fileRef = D1AFF0F2268D59A500FBB744 /* libiono.a */; };
-               D1BA3F9226B8889600A5848B /* Amount.swift in Sources */ = {isa = 
PBXBuildFile; fileRef = D1BA3F9126B8889600A5848B /* Amount.swift */; };
                D1D65B9826992E4600C1012A /* WalletBackend.swift in Sources */ = 
{isa = PBXBuildFile; fileRef = D1D65B9726992E4600C1012A /* WalletBackend.swift 
*/; };
 /* End PBXBuildFile section */
 
@@ -72,6 +71,7 @@
 /* End PBXCopyFilesBuildPhase section */
 
 /* Begin PBXFileReference section */
+               AB710490285995B6008B04F0 /* taler-swift */ = {isa = 
PBXFileReference; lastKnownFileType = text; path = "taler-swift"; sourceTree = 
SOURCE_ROOT; };
                D11250FF26B12E3200D02E00 /* taler-wallet-embedded.js */ = {isa 
= PBXFileReference; lastKnownFileType = sourcecode.javascript; path = 
"taler-wallet-embedded.js"; sourceTree = "<group>"; };
                D11DB44E25A5C487009CF0BC /* libnode.a */ = {isa = 
PBXFileReference; lastKnownFileType = archive.ar; name = libnode.a; path = 
"nodejs-mobile/out/Release/libnode.a"; sourceTree = "<group>"; };
                D11DB45625A5C5C7009CF0BC /* libv8_initializers.a */ = {isa = 
PBXFileReference; lastKnownFileType = archive.ar; name = libv8_initializers.a; 
path = "nodejs-mobile/out/Release/libv8_initializers.a"; sourceTree = 
"<group>"; };
@@ -115,7 +115,6 @@
                D145D1EF25AC416B00CDD61B /* libv8_base_without_compiler.a */ = 
{isa = PBXFileReference; lastKnownFileType = archive.ar; name = 
libv8_base_without_compiler.a; path = 
"ios-node-v8/taler-ios-build/compiled/node-x64/libv8_base_without_compiler.a"; 
sourceTree = "<group>"; };
                D145D1F025AC416B00CDD61B /* libhistogram.a */ = {isa = 
PBXFileReference; lastKnownFileType = archive.ar; name = libhistogram.a; path = 
"ios-node-v8/taler-ios-build/compiled/node-x64/libhistogram.a"; sourceTree = 
"<group>"; };
                D145D1F125AC416B00CDD61B /* libv8_libbase.a */ = {isa = 
PBXFileReference; lastKnownFileType = archive.ar; name = libv8_libbase.a; path 
= "ios-node-v8/taler-ios-build/compiled/node-x64/libv8_libbase.a"; sourceTree = 
"<group>"; };
-               D1472E5426B9206800896566 /* AmountTests.swift */ = {isa = 
PBXFileReference; lastKnownFileType = sourcecode.swift; path = 
AmountTests.swift; sourceTree = "<group>"; };
                D14AFD1D24D232B300C51073 /* Taler.app */ = {isa = 
PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; 
path = Taler.app; sourceTree = BUILT_PRODUCTS_DIR; };
                D14AFD2024D232B300C51073 /* AppDelegate.swift */ = {isa = 
PBXFileReference; lastKnownFileType = sourcecode.swift; path = 
AppDelegate.swift; sourceTree = "<group>"; };
                D14AFD2224D232B300C51073 /* SceneDelegate.swift */ = {isa = 
PBXFileReference; lastKnownFileType = sourcecode.swift; path = 
SceneDelegate.swift; sourceTree = "<group>"; };
@@ -155,7 +154,6 @@
                D18DBB5D26DF160D00A4480D /* TimestampTests.swift */ = {isa = 
PBXFileReference; lastKnownFileType = sourcecode.swift; path = 
TimestampTests.swift; sourceTree = "<group>"; };
                D1AB963B259EB13D00DEAB23 /* libnode.89.dylib */ = {isa = 
PBXFileReference; lastKnownFileType = "compiled.mach-o.dylib"; name = 
libnode.89.dylib; path = 
"ios-node-v8/taler-ios-build/compiled/x64-v8a/libnode.89.dylib"; sourceTree = 
"<group>"; };
                D1AFF0F2268D59A500FBB744 /* libiono.a */ = {isa = 
PBXFileReference; lastKnownFileType = archive.ar; name = libiono.a; path = 
iono/compiled/x64/libiono.a; sourceTree = "<group>"; };
-               D1BA3F9126B8889600A5848B /* Amount.swift */ = {isa = 
PBXFileReference; lastKnownFileType = sourcecode.swift; path = Amount.swift; 
sourceTree = "<group>"; };
                D1D65B9726992E4600C1012A /* WalletBackend.swift */ = {isa = 
PBXFileReference; lastKnownFileType = sourcecode.swift; path = 
WalletBackend.swift; sourceTree = "<group>"; };
                D1F0C22F25A958AE00C3179D /* libllhttp.a */ = {isa = 
PBXFileReference; lastKnownFileType = archive.ar; name = libllhttp.a; path = 
"ios-node-v8/tools/ios-framework/bin/x64/libllhttp.a"; sourceTree = "<group>"; 
};
                D1F0C23025A958AE00C3179D /* libv8_initializers.a */ = {isa = 
PBXFileReference; lastKnownFileType = archive.ar; name = libv8_initializers.a; 
path = "ios-node-v8/tools/ios-framework/bin/x64/libv8_initializers.a"; 
sourceTree = "<group>"; };
@@ -218,6 +216,7 @@
                                D17D8B7B25ADB29B001BD43D /* libv8_compiler.a in 
Frameworks */,
                                D17D8B7225ADB29A001BD43D /* libbrotli.a in 
Frameworks */,
                                D17D8B7625ADB29A001BD43D /* libv8_libsampler.a 
in Frameworks */,
+                               ABC13AA32859962800D23185 /* taler-swift in 
Frameworks */,
                                D17D8B7825ADB29B001BD43D /* libv8_libbase.a in 
Frameworks */,
                                D17D8B7C25ADB29B001BD43D /* 
libv8_base_without_compiler.a in Frameworks */,
                                D17D8B7725ADB29A001BD43D /* libv8_libplatform.a 
in Frameworks */,
@@ -249,6 +248,7 @@
                D14AFD1424D232B300C51073 = {
                        isa = PBXGroup;
                        children = (
+                               AB710490285995B6008B04F0 /* taler-swift */,
                                D11250FF26B12E3200D02E00 /* 
taler-wallet-embedded.js */,
                                D14AFD1F24D232B300C51073 /* Taler */,
                                D14AFD3624D232B500C51073 /* TalerTests */,
@@ -274,7 +274,6 @@
                                D14AFD2024D232B300C51073 /* AppDelegate.swift 
*/,
                                D14AFD2224D232B300C51073 /* SceneDelegate.swift 
*/,
                                D1D65B9726992E4600C1012A /* WalletBackend.swift 
*/,
-                               D1BA3F9126B8889600A5848B /* Amount.swift */,
                                D14CE1B126C39E5D00612DBE /* BalanceRow.swift */,
                                D14CE1B326C3A2D400612DBE /* BalanceList.swift 
*/,
                                D14AFD2624D232B500C51073 /* Assets.xcassets */,
@@ -289,7 +288,6 @@
                        children = (
                                D14AFD3724D232B500C51073 /* TalerTests.swift */,
                                D14AFD3924D232B500C51073 /* Info.plist */,
-                               D1472E5426B9206800896566 /* AmountTests.swift 
*/,
                                D18DBB5D26DF160D00A4480D /* 
TimestampTests.swift */,
                        );
                        path = TalerTests;
@@ -436,6 +434,9 @@
                        dependencies = (
                        );
                        name = Taler;
+                       packageProductDependencies = (
+                               ABC13AA22859962800D23185 /* taler-swift */,
+                       );
                        productName = Taler;
                        productReference = D14AFD1D24D232B300C51073 /* 
Taler.app */;
                        productType = "com.apple.product-type.application";
@@ -591,7 +592,6 @@
                        isa = PBXSourcesBuildPhase;
                        buildActionMask = 2147483647;
                        files = (
-                               D1BA3F9226B8889600A5848B /* Amount.swift in 
Sources */,
                                D14AFD2124D232B300C51073 /* AppDelegate.swift 
in Sources */,
                                D14AFD2324D232B300C51073 /* SceneDelegate.swift 
in Sources */,
                                D1D65B9826992E4600C1012A /* WalletBackend.swift 
in Sources */,
@@ -605,7 +605,6 @@
                        buildActionMask = 2147483647;
                        files = (
                                D14AFD3824D232B500C51073 /* TalerTests.swift in 
Sources */,
-                               D1472E5526B9206800896566 /* AmountTests.swift 
in Sources */,
                                D18DBB5E26DF160D00A4480D /* 
TimestampTests.swift in Sources */,
                        );
                        runOnlyForDeploymentPostprocessing = 0;
@@ -986,6 +985,13 @@
                        defaultConfigurationName = Release;
                };
 /* End XCConfigurationList section */
+
+/* Begin XCSwiftPackageProductDependency section */
+               ABC13AA22859962800D23185 /* taler-swift */ = {
+                       isa = XCSwiftPackageProductDependency;
+                       productName = "taler-swift";
+               };
+/* End XCSwiftPackageProductDependency section */
        };
        rootObject = D14AFD1524D232B300C51073 /* Project object */;
 }
diff --git 
a/Taler.xcodeproj/project.xcworkspace/xcuserdata/jonathan.xcuserdatad/UserInterfaceState.xcuserstate
 
b/Taler.xcodeproj/project.xcworkspace/xcuserdata/jonathan.xcuserdatad/UserInterfaceState.xcuserstate
index 8b562be..f65f460 100644
Binary files 
a/Taler.xcodeproj/project.xcworkspace/xcuserdata/jonathan.xcuserdatad/UserInterfaceState.xcuserstate
 and 
b/Taler.xcodeproj/project.xcworkspace/xcuserdata/jonathan.xcuserdatad/UserInterfaceState.xcuserstate
 differ
diff --git a/Taler/AppDelegate.swift b/Taler/AppDelegate.swift
index 93fc474..0d1d283 100644
--- a/Taler/AppDelegate.swift
+++ b/Taler/AppDelegate.swift
@@ -24,7 +24,11 @@ class AppDelegate: UIResponder, UIApplicationDelegate {
 
     func application(_ application: UIApplication, 
didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: 
Any]?) -> Bool {
         // Override point for customization after application launch.
-        let backend = WalletBackend()
+        do {
+            let backend = try WalletBackend()
+        } catch {
+            
+        }
         return true
     }
 
diff --git a/Taler/BalanceList.swift b/Taler/BalanceList.swift
index 5e77b6c..5b326e3 100644
--- a/Taler/BalanceList.swift
+++ b/Taler/BalanceList.swift
@@ -16,7 +16,7 @@
 
 import SwiftUI
 
-struct IdentifiedArray<T>: RandomAccessCollection {
+/*struct IdentifiedArray<T>: RandomAccessCollection {
     struct Item {
         var id: Int
         var item: T
@@ -73,4 +73,4 @@ struct BalanceList_Previews: PreviewProvider {
             Balance(available: Amount(fromString: "EUR:0.02"), 
pendingIncoming: Amount(fromString: "EUR:0.01"), pendingOutgoing: 
Amount(fromString: "EUR:0.03"), requiresUserInput: false)
         ]))
     }
-}
+}*/
diff --git a/Taler/BalanceRow.swift b/Taler/BalanceRow.swift
index 405a141..b6e86c5 100644
--- a/Taler/BalanceRow.swift
+++ b/Taler/BalanceRow.swift
@@ -15,6 +15,7 @@
  */
 
 import SwiftUI
+import taler_swift
 
 struct BalanceRow: View {
     var balance: Balance
diff --git a/Taler/WalletBackend.swift b/Taler/WalletBackend.swift
index f1b462f..6035c51 100644
--- a/Taler/WalletBackend.swift
+++ b/Taler/WalletBackend.swift
@@ -16,6 +16,7 @@
 
 import Foundation
 import iono
+import taler_swift
 
 enum WalletBackendResponseError: Error {
     case malformedResponse
@@ -1304,6 +1305,7 @@ class WalletBackendSuspendCoinRequest: 
WalletBackendRequest {
 }
 
 enum WalletBackendError: Error {
+    case initializationError
     case serializationError
     case deserializationError
 }
@@ -1319,7 +1321,7 @@ class WalletBackend: IonoMessageHandler {
     }
     private var requests: [UInt : RequestDetail] = [:]
     
-    init() {
+    init() throws {
         iono = Iono()
         requestsMade = 0
         self.backendReady = false
@@ -1335,7 +1337,7 @@ class WalletBackend: IonoMessageHandler {
             iono.evalNodeCode(source: "tw = 
require('@gnu-taler/taler-wallet-embedded');")
             iono.evalNodeCode(source: "tw.installNativeWalletListener();")
         } catch {
-
+            throw WalletBackendError.initializationError
         }
         
         // Send the init message
@@ -1351,12 +1353,6 @@ class WalletBackend: IonoMessageHandler {
         }
         
         waitUntilReady()
-        //try! sendRequest(request: WalletBackendWithdrawTestBalance(amount: 
"TESTKUDOS:10", bankBaseUrl: "https://bank.test.taler.net/";, exchangeBaseUrl: 
"https://exchange.test.taler.net/";))
-        try! sendRequest(request: WalletBackendGetBalancesRequest(onSuccess: { 
([Balance]) -> Void in
-            
-        }, onFailure: { () -> Void in
-            
-        }))
     }
     
     func waitUntilReady() {
diff --git a/bootstrap b/bootstrap
index ca6ab58..7aca615 100755
--- a/bootstrap
+++ b/bootstrap
@@ -1,10 +1,9 @@
 #!/bin/sh
 
-# Bootstrap the repository.  Used when the repository is checked out from git.
-# When using the source tarball, running this script is not necessary.
-
 set -eu
 
+curl 
https://git.taler.net/wallet-core.git/plain/v0.9.0-dev.12/taler-wallet-embedded.js?h=prebuilt
 --output taler-wallet-embedded.js
+
 if ! git --version >/dev/null; then
   echo "git not installed"
   exit 1
diff --git a/taler-swift/.gitignore b/taler-swift/.gitignore
new file mode 100644
index 0000000..3b29812
--- /dev/null
+++ b/taler-swift/.gitignore
@@ -0,0 +1,9 @@
+.DS_Store
+/.build
+/Packages
+/*.xcodeproj
+xcuserdata/
+DerivedData/
+.swiftpm/config/registries.json
+.swiftpm/xcode/package.xcworkspace/contents.xcworkspacedata
+.netrc
diff --git a/taler-swift/Package.swift b/taler-swift/Package.swift
new file mode 100644
index 0000000..a17d516
--- /dev/null
+++ b/taler-swift/Package.swift
@@ -0,0 +1,28 @@
+// swift-tools-version: 5.6
+// The swift-tools-version declares the minimum version of Swift required to 
build this package.
+
+import PackageDescription
+
+let package = Package(
+    name: "taler-swift",
+    products: [
+        // Products define the executables and libraries a package produces, 
and make them visible to other packages.
+        .library(
+            name: "taler-swift",
+            targets: ["taler-swift"]),
+    ],
+    dependencies: [
+        // Dependencies declare other packages that this package depends on.
+        // .package(url: /* package url */, from: "1.0.0"),
+    ],
+    targets: [
+        // Targets are the basic building blocks of a package. A target can 
define a module or a test suite.
+        // Targets can depend on other targets in this package, and on 
products in packages this package depends on.
+        .target(
+            name: "taler-swift",
+            dependencies: []),
+        .testTarget(
+            name: "taler-swiftTests",
+            dependencies: ["taler-swift"]),
+    ]
+)
diff --git a/Taler/Amount.swift b/taler-swift/Sources/taler-swift/Amount.swift
similarity index 98%
rename from Taler/Amount.swift
rename to taler-swift/Sources/taler-swift/Amount.swift
index 98bb1b9..e775a65 100644
--- a/Taler/Amount.swift
+++ b/taler-swift/Sources/taler-swift/Amount.swift
@@ -49,7 +49,7 @@ enum AmountError: Error {
 /**
     A value of a currency.
  */
-class Amount: Codable, CustomStringConvertible {
+public class Amount: Codable, CustomStringConvertible {
     /**
         The largest possible value that can be represented.
      */
@@ -83,7 +83,7 @@ class Amount: Codable, CustomStringConvertible {
     /**
         The string representation of the amount, formatted as 
"`currency`:`value`.`fraction`".
      */
-    var description: String {
+    public var description: String {
         if fraction == 0 {
             return "\(currency):\(value)"
         } else {
@@ -114,7 +114,7 @@ class Amount: Codable, CustomStringConvertible {
             - `AmountError.invalidStringRepresentation` if the string cannot 
be parsed.
             - `AmountError.invalidAmount` if the string can be parsed, but the 
resulting amount is not valid.
      */
-    init(fromString string: String) throws {
+    public init(fromString string: String) throws {
         guard let separatorIndex = string.firstIndex(of: ":") else { throw 
AmountError.invalidStringRepresentation }
         self.currency = String(string[..<separatorIndex])
         let amountStr = String(string[string.index(separatorIndex, offsetBy: 
1)...])
@@ -215,7 +215,7 @@ class Amount: Codable, CustomStringConvertible {
         - Parameters:
             - to: The encoder to encode the amount with.
      */
-    func encode(to encoder: Encoder) throws {
+    public func encode(to encoder: Encoder) throws {
         var container = encoder.singleValueContainer()
         try container.encode(self.description)
     }
diff --git a/taler-swift/Sources/taler-swift/taler_swift.swift 
b/taler-swift/Sources/taler-swift/taler_swift.swift
new file mode 100644
index 0000000..79438a4
--- /dev/null
+++ b/taler-swift/Sources/taler-swift/taler_swift.swift
@@ -0,0 +1,6 @@
+public struct taler_swift {
+    public private(set) var text = "Hello, World!"
+
+    public init() {
+    }
+}
diff --git a/TalerTests/AmountTests.swift 
b/taler-swift/Tests/taler-swiftTests/AmountTests.swift
similarity index 100%
rename from TalerTests/AmountTests.swift
rename to taler-swift/Tests/taler-swiftTests/AmountTests.swift
diff --git a/taler-swift/Tests/taler-swiftTests/taler_swiftTests.swift 
b/taler-swift/Tests/taler-swiftTests/taler_swiftTests.swift
new file mode 100644
index 0000000..d7b1c8f
--- /dev/null
+++ b/taler-swift/Tests/taler-swiftTests/taler_swiftTests.swift
@@ -0,0 +1,11 @@
+import XCTest
+@testable import taler_swift
+
+final class taler_swiftTests: XCTestCase {
+    func testExample() throws {
+        // This is an example of a functional test case.
+        // Use XCTAssert and related functions to verify your tests produce 
the correct
+        // results.
+        XCTAssertEqual(taler_swift().text, "Hello, World!")
+    }
+}

-- 
To stop receiving notification emails like this one, please contact
gnunet@gnunet.org.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]