Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update Swift Examples #1294

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -624,7 +624,7 @@
repositoryURL = "https://github.com/web3auth/web3auth-swift-sdk";
requirement = {
kind = upToNextMajorVersion;
minimumVersion = 9.0.0;
minimumVersion = 11.0.1;
};
};
/* End XCRemoteSwiftPackageReference section */
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@
"kind" : "remoteSourceControl",
"location" : "https://github.com/tkey/curvelib.swift",
"state" : {
"revision" : "9f88bd5e56d1df443a908f7a7e81ae4f4d9170ea",
"version" : "1.0.1"
"revision" : "432bf1abe7ff505fc2ac9fcf697341ff5b2dc6d0",
"version" : "2.0.0"
}
},
{
Expand Down Expand Up @@ -51,8 +51,8 @@
"kind" : "remoteSourceControl",
"location" : "https://github.com/Web3Auth/session-manager-swift.git",
"state" : {
"revision" : "20cc7bff065d7fe53164d17e7714a3f17d4cea2a",
"version" : "4.0.2"
"revision" : "d86cd2a7f6d8095531ed609c728d851820fe85be",
"version" : "6.0.1"
}
},
{
Expand Down Expand Up @@ -150,8 +150,8 @@
"kind" : "remoteSourceControl",
"location" : "https://github.com/web3auth/web3auth-swift-sdk",
"state" : {
"revision" : "fb4971ad9452a0f0cbf9f5742f22d1c5c6d7759c",
"version" : "9.0.0"
"revision" : "d7b946452919ec9a50d2dfeb67297c844bdec690",
"version" : "11.0.1"
}
},
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,12 +37,6 @@ class ViewModel: ObservableObject {
verifierSubIdentifier: "w3a-a0-github"
)
],
mfaSettings: MfaSettings(
deviceShareFactor: MfaSetting(enable: true, priority: 1),
backUpShareFactor: MfaSetting(enable: true, priority: 2),
socialBackupFactor: MfaSetting(enable: true, priority: 3),
passwordFactor: MfaSetting(enable: true, priority: 4)
),
// 259200 allows user to stay authenticated for 3 days with Web3Auth.
// Default is 86400, which is 1 day.
sessionTime: 259200
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -666,7 +666,7 @@
repositoryURL = "https://github.com/Web3Auth/web3auth-swift-sdk/";
requirement = {
kind = upToNextMajorVersion;
minimumVersion = 9.0.0;
minimumVersion = 11.0.1;
};
};
A4DCEE6F2C8B36670048A663 /* XCRemoteSwiftPackageReference "aptos-swift-sdk" */ = {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"originHash" : "c5d16b0968e4fbe28d85effde140f5fd8b458629cafc7911d79915d17535e9c2",
"originHash" : "6b85e04c538f006ce2b9ae9841cd84700094308248d004c8af2dfa2cd222c76f",
"pins" : [
{
"identity" : "aptos-swift-sdk",
Expand Down Expand Up @@ -33,8 +33,8 @@
"kind" : "remoteSourceControl",
"location" : "https://github.com/tkey/curvelib.swift",
"state" : {
"revision" : "9f88bd5e56d1df443a908f7a7e81ae4f4d9170ea",
"version" : "1.0.1"
"revision" : "432bf1abe7ff505fc2ac9fcf697341ff5b2dc6d0",
"version" : "2.0.0"
}
},
{
Expand Down Expand Up @@ -69,8 +69,8 @@
"kind" : "remoteSourceControl",
"location" : "https://github.com/Web3Auth/session-manager-swift.git",
"state" : {
"revision" : "20cc7bff065d7fe53164d17e7714a3f17d4cea2a",
"version" : "4.0.2"
"revision" : "d86cd2a7f6d8095531ed609c728d851820fe85be",
"version" : "6.0.1"
}
},
{
Expand Down Expand Up @@ -123,8 +123,8 @@
"kind" : "remoteSourceControl",
"location" : "https://github.com/Web3Auth/web3auth-swift-sdk/",
"state" : {
"revision" : "fb4971ad9452a0f0cbf9f5742f22d1c5c6d7759c",
"version" : "9.0.0"
"revision" : "d7b946452919ec9a50d2dfeb67297c844bdec690",
"version" : "11.0.1"
}
}
],
Expand Down
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -9,21 +9,84 @@
<key>isShown</key>
<false/>
<key>orderHint</key>
<integer>5</integer>
<integer>2</integer>
</dict>
<key>Demo (Playground) 2.xcscheme</key>
<dict>
<key>isShown</key>
<false/>
<key>orderHint</key>
<integer>6</integer>
<integer>3</integer>
</dict>
<key>Demo (Playground) 3.xcscheme</key>
<dict>
<key>isShown</key>
<false/>
<key>orderHint</key>
<integer>8</integer>
</dict>
<key>Demo (Playground) 4.xcscheme</key>
<dict>
<key>isShown</key>
<false/>
<key>orderHint</key>
<integer>11</integer>
</dict>
<key>Demo (Playground) 5.xcscheme</key>
<dict>
<key>isShown</key>
<false/>
<key>orderHint</key>
<integer>12</integer>
</dict>
<key>Demo (Playground).xcscheme</key>
<dict>
<key>isShown</key>
<false/>
<key>orderHint</key>
<integer>4</integer>
<integer>1</integer>
</dict>
<key>MnemonicSwiftExample (Playground) 1.xcscheme</key>
<dict>
<key>isShown</key>
<false/>
<key>orderHint</key>
<integer>9</integer>
</dict>
<key>MnemonicSwiftExample (Playground) 2.xcscheme</key>
<dict>
<key>isShown</key>
<false/>
<key>orderHint</key>
<integer>10</integer>
</dict>
<key>MnemonicSwiftExample (Playground) 3.xcscheme</key>
<dict>
<key>isShown</key>
<false/>
<key>orderHint</key>
<integer>13</integer>
</dict>
<key>MnemonicSwiftExample (Playground) 4.xcscheme</key>
<dict>
<key>isShown</key>
<false/>
<key>orderHint</key>
<integer>14</integer>
</dict>
<key>MnemonicSwiftExample (Playground) 5.xcscheme</key>
<dict>
<key>isShown</key>
<false/>
<key>orderHint</key>
<integer>15</integer>
</dict>
<key>MnemonicSwiftExample (Playground).xcscheme</key>
<dict>
<key>isShown</key>
<false/>
<key>orderHint</key>
<integer>7</integer>
</dict>
<key>Playground (Playground) 1.xcscheme</key>
<dict>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,8 @@ class AptosHelper {
/// - Parameter privateKey: The private key received from Web3Auth.
func initialize(privateKey: String) async throws {
aptosClient = Aptos(aptosConfig: .testnet)
account = try generateAptosAccount(privateKey: privateKey)

guard account != nil else {
throw NSError(domain: "AptosHelper", code: 1, userInfo: [NSLocalizedDescriptionKey: "Failed to generate Aptos account."])
if !privateKey.isEmpty {
account = try generateAptosAccount(privateKey: privateKey)
}

print("Aptos client and account initialized successfully.")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -616,7 +616,7 @@
repositoryURL = "https://github.com/Web3Auth/web3auth-swift-sdk/";
requirement = {
kind = upToNextMajorVersion;
minimumVersion = 9.0.0;
minimumVersion = 11.0.1;
};
};
2833BEE02BD6246900243B09 /* XCRemoteSwiftPackageReference "web3" */ = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@
"kind" : "remoteSourceControl",
"location" : "https://github.com/tkey/curvelib.swift",
"state" : {
"revision" : "9f88bd5e56d1df443a908f7a7e81ae4f4d9170ea",
"version" : "1.0.1"
"revision" : "432bf1abe7ff505fc2ac9fcf697341ff5b2dc6d0",
"version" : "2.0.0"
}
},
{
Expand Down Expand Up @@ -51,8 +51,8 @@
"kind" : "remoteSourceControl",
"location" : "https://github.com/Web3Auth/session-manager-swift.git",
"state" : {
"revision" : "20cc7bff065d7fe53164d17e7714a3f17d4cea2a",
"version" : "4.0.2"
"revision" : "d86cd2a7f6d8095531ed609c728d851820fe85be",
"version" : "6.0.1"
}
},
{
Expand Down Expand Up @@ -148,10 +148,10 @@
{
"identity" : "web3auth-swift-sdk",
"kind" : "remoteSourceControl",
"location" : "https://github.com/web3auth/web3auth-swift-sdk",
"location" : "https://github.com/Web3Auth/web3auth-swift-sdk/",
"state" : {
"revision" : "fb4971ad9452a0f0cbf9f5742f22d1c5c6d7759c",
"version" : "9.0.0"
"revision" : "d7b946452919ec9a50d2dfeb67297c844bdec690",
"version" : "11.0.1"
}
},
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -642,7 +642,7 @@
repositoryURL = "https://github.com/Web3Auth/web3auth-swift-sdk/";
requirement = {
kind = upToNextMajorVersion;
minimumVersion = 9.0.0;
minimumVersion = 11.0.1;
};
};
/* End XCRemoteSwiftPackageReference section */
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,8 @@
"kind" : "remoteSourceControl",
"location" : "https://github.com/tkey/curvelib.swift",
"state" : {
"revision" : "9f88bd5e56d1df443a908f7a7e81ae4f4d9170ea",
"version" : "1.0.1"
"revision" : "432bf1abe7ff505fc2ac9fcf697341ff5b2dc6d0",
"version" : "2.0.0"
}
},
{
Expand Down Expand Up @@ -150,8 +150,8 @@
"kind" : "remoteSourceControl",
"location" : "https://github.com/Web3Auth/session-manager-swift.git",
"state" : {
"revision" : "20cc7bff065d7fe53164d17e7714a3f17d4cea2a",
"version" : "4.0.2"
"revision" : "d86cd2a7f6d8095531ed609c728d851820fe85be",
"version" : "6.0.1"
}
},
{
Expand Down Expand Up @@ -267,8 +267,8 @@
"kind" : "remoteSourceControl",
"location" : "https://github.com/Web3Auth/web3auth-swift-sdk/",
"state" : {
"revision" : "fb4971ad9452a0f0cbf9f5742f22d1c5c6d7759c",
"version" : "9.0.0"
"revision" : "d7b946452919ec9a50d2dfeb67297c844bdec690",
"version" : "11.0.1"
}
},
{
Expand Down
47 changes: 21 additions & 26 deletions ios/ios-firebase-example/ios-firebase-example/UserDetailView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import Web3Auth
import web3

struct UserDetailView: View {

@State private var showingAlert = false
@StateObject var web3RPC: Web3RPC
@StateObject var viewModel: ViewModel
Expand All @@ -20,7 +20,7 @@ struct UserDetailView: View {
Section{
Button {
web3RPC.getAccounts()

} label: {
HStack{
Text("Get Public Key")
Expand All @@ -30,27 +30,27 @@ struct UserDetailView: View {
if(web3RPC.publicAddress != ""){
Text("\(web3RPC.publicAddress)")
}

} header: {
Text("Public key")
}
Section {
Text("Name \(user.userInfo?.name ?? "")")
Text("Email \(user.userInfo?.email ?? "")")
}
header: {
Text("User Info")
}
header: {
Text("User Info")
}
Section{
Button {
web3RPC.getBalance()

} label: {
HStack{
Text("Get Balance")
Spacer()
}
}
Button {
web3RPC.getBalance()
} label: {
HStack{
Text("Get Balance")
Spacer()
}
}
if(web3RPC.balance>=0){
Text("\(web3RPC.balance) Eth")

Expand Down Expand Up @@ -79,9 +79,9 @@ struct UserDetailView: View {
}

}
header: {
Text("Blockchain Calls")
}
header: {
Text("Blockchain Calls")
}

Section(
header: Text("Web3Auth Operations")
Expand All @@ -99,23 +99,18 @@ struct UserDetailView: View {
}

Button {
viewModel.request()
} label: {
Text("Request Signature")
}

Button {
viewModel.getSignature{
viewModel.request{
result in
self.signature = result
}
} label: {
Text("Get Signature")
Text("Request Signature")
}

if(!signature.isEmpty) {
Text(signature)
}

}


Expand Down
Loading
Loading