Skip to content

Commit

Permalink
Fix example app (#220)
Browse files Browse the repository at this point in the history
  • Loading branch information
nakajima authored Jan 22, 2024
1 parent 466b022 commit 7632a9b
Show file tree
Hide file tree
Showing 9 changed files with 35 additions and 42 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ class NotificationService: UNNotificationServiceExtension {
let client = try await Client.from(bundle: keys)
let conversation = conversationContainer.decode(with: client)

let envelope = XMTP.Envelope.with { envelope in
let envelope = XMTPiOS.Envelope.with { envelope in
envelope.message = encryptedMessageData
envelope.contentTopic = topic
}
Expand Down
27 changes: 10 additions & 17 deletions XMTPiOSExample/XMTPiOSExample.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -20,17 +20,17 @@
A65F0704297B5D4E00C3C76E /* Persistence.swift in Sources */ = {isa = PBXBuildFile; fileRef = A65F0703297B5D4E00C3C76E /* Persistence.swift */; };
A65F0707297B5E7600C3C76E /* WalletConnectSwift in Frameworks */ = {isa = PBXBuildFile; productRef = A65F0706297B5E7600C3C76E /* WalletConnectSwift */; };
A65F070A297B5E8600C3C76E /* KeychainAccess in Frameworks */ = {isa = PBXBuildFile; productRef = A65F0709297B5E8600C3C76E /* KeychainAccess */; };
A6606A182B5EE7F000E2ED4D /* XMTPiOS in Frameworks */ = {isa = PBXBuildFile; productRef = A6606A172B5EE7F000E2ED4D /* XMTPiOS */; };
A6606A1A2B5EE80000E2ED4D /* XMTPiOS in Frameworks */ = {isa = PBXBuildFile; productRef = A6606A192B5EE80000E2ED4D /* XMTPiOS */; };
A67CCEC129355B4B00131F5C /* AccountManager.swift in Sources */ = {isa = PBXBuildFile; fileRef = A67CCEC029355B4B00131F5C /* AccountManager.swift */; };
A683860C293EA862006336FF /* MessageListView.swift in Sources */ = {isa = PBXBuildFile; fileRef = A683860B293EA862006336FF /* MessageListView.swift */; };
A687810729679BC700042FAB /* Account.swift in Sources */ = {isa = PBXBuildFile; fileRef = A687810629679BC700042FAB /* Account.swift */; };
A687810C29679BFC00042FAB /* WalletConnection.swift in Sources */ = {isa = PBXBuildFile; fileRef = A687810B29679BFC00042FAB /* WalletConnection.swift */; };
A687810E29679C0D00042FAB /* WalletConnectionMethod.swift in Sources */ = {isa = PBXBuildFile; fileRef = A687810D29679C0D00042FAB /* WalletConnectionMethod.swift */; };
A69F33C6292DC992005A5556 /* XMTP in Frameworks */ = {isa = PBXBuildFile; productRef = A69F33C5292DC992005A5556 /* XMTP */; };
A69F33CA292DD557005A5556 /* LoggedInView.swift in Sources */ = {isa = PBXBuildFile; fileRef = A69F33C9292DD557005A5556 /* LoggedInView.swift */; };
A69F33CC292DD568005A5556 /* QRCodeSheetView.swift in Sources */ = {isa = PBXBuildFile; fileRef = A69F33CB292DD568005A5556 /* QRCodeSheetView.swift */; };
A6AE5187297B61AE006FDD0F /* NotificationService.appex in Embed Foundation Extensions */ = {isa = PBXBuildFile; fileRef = A6AE5180297B61AE006FDD0F /* NotificationService.appex */; settings = {ATTRIBUTES = (RemoveHeadersOnCopy, ); }; };
A6AE518E297B6210006FDD0F /* NotificationService.swift in Sources */ = {isa = PBXBuildFile; fileRef = A6AE518C297B6210006FDD0F /* NotificationService.swift */; };
A6AE5191297B625F006FDD0F /* XMTP in Frameworks */ = {isa = PBXBuildFile; productRef = A6AE5190297B625F006FDD0F /* XMTP */; };
A6AE5192297B6270006FDD0F /* Persistence.swift in Sources */ = {isa = PBXBuildFile; fileRef = A65F0703297B5D4E00C3C76E /* Persistence.swift */; };
A6AE5194297B62C8006FDD0F /* KeychainAccess in Frameworks */ = {isa = PBXBuildFile; productRef = A6AE5193297B62C8006FDD0F /* KeychainAccess */; };
A6C0F37B2AC1E321008C6AA7 /* Starscream in Frameworks */ = {isa = PBXBuildFile; productRef = A6C0F37A2AC1E321008C6AA7 /* Starscream */; };
Expand All @@ -40,7 +40,6 @@
A6C0F3842AC1E4B5008C6AA7 /* LoginView.swift in Sources */ = {isa = PBXBuildFile; fileRef = A6C0F3832AC1E4B5008C6AA7 /* LoginView.swift */; };
A6C0F3862AC1E549008C6AA7 /* Data.swift in Sources */ = {isa = PBXBuildFile; fileRef = A6C0F3852AC1E549008C6AA7 /* Data.swift */; };
A6D192D0293A7B97006B49F2 /* ConversationListView.swift in Sources */ = {isa = PBXBuildFile; fileRef = A6D192CF293A7B97006B49F2 /* ConversationListView.swift */; };
A6E774162B154CF000F01DFF /* XMTP in Frameworks */ = {isa = PBXBuildFile; productRef = A6E774152B154CF000F01DFF /* XMTP */; };
/* End PBXBuildFile section */

/* Begin PBXContainerItemProxy section */
Expand Down Expand Up @@ -101,13 +100,12 @@
isa = PBXFrameworksBuildPhase;
buildActionMask = 2147483647;
files = (
A6E774162B154CF000F01DFF /* XMTP in Frameworks */,
A65F0707297B5E7600C3C76E /* WalletConnectSwift in Frameworks */,
A6C0F3802AC1E34F008C6AA7 /* WalletConnectModal in Frameworks */,
A6606A1A2B5EE80000E2ED4D /* XMTPiOS in Frameworks */,
6AEE396E29F330CD0027B657 /* secp256k1 in Frameworks */,
A6C0F37E2AC1E34F008C6AA7 /* WalletConnect in Frameworks */,
A6C0F3822AC1E34F008C6AA7 /* Web3Wallet in Frameworks */,
A69F33C6292DC992005A5556 /* XMTP in Frameworks */,
A6C0F37B2AC1E321008C6AA7 /* Starscream in Frameworks */,
A65F070A297B5E8600C3C76E /* KeychainAccess in Frameworks */,
);
Expand All @@ -118,7 +116,7 @@
buildActionMask = 2147483647;
files = (
A6AE5194297B62C8006FDD0F /* KeychainAccess in Frameworks */,
A6AE5191297B625F006FDD0F /* XMTP in Frameworks */,
A6606A182B5EE7F000E2ED4D /* XMTPiOS in Frameworks */,
);
runOnlyForDeploymentPostprocessing = 0;
};
Expand Down Expand Up @@ -240,15 +238,14 @@
);
name = XMTPiOSExample;
packageProductDependencies = (
A69F33C5292DC992005A5556 /* XMTP */,
A65F0706297B5E7600C3C76E /* WalletConnectSwift */,
A65F0709297B5E8600C3C76E /* KeychainAccess */,
6AEE396D29F330CD0027B657 /* secp256k1 */,
A6C0F37A2AC1E321008C6AA7 /* Starscream */,
A6C0F37D2AC1E34F008C6AA7 /* WalletConnect */,
A6C0F37F2AC1E34F008C6AA7 /* WalletConnectModal */,
A6C0F3812AC1E34F008C6AA7 /* Web3Wallet */,
A6E774152B154CF000F01DFF /* XMTP */,
A6606A192B5EE80000E2ED4D /* XMTPiOS */,
);
productName = XMTPiOSExample;
productReference = A628198F292DC825004B9117 /* XMTPiOSExample.app */;
Expand All @@ -268,8 +265,8 @@
);
name = NotificationService;
packageProductDependencies = (
A6AE5190297B625F006FDD0F /* XMTP */,
A6AE5193297B62C8006FDD0F /* KeychainAccess */,
A6606A172B5EE7F000E2ED4D /* XMTPiOS */,
);
productName = NotificationService;
productReference = A6AE5180297B61AE006FDD0F /* NotificationService.appex */;
Expand Down Expand Up @@ -722,13 +719,13 @@
package = A65F0708297B5E8600C3C76E /* XCRemoteSwiftPackageReference "KeychainAccess" */;
productName = KeychainAccess;
};
A69F33C5292DC992005A5556 /* XMTP */ = {
A6606A172B5EE7F000E2ED4D /* XMTPiOS */ = {
isa = XCSwiftPackageProductDependency;
productName = XMTP;
productName = XMTPiOS;
};
A6AE5190297B625F006FDD0F /* XMTP */ = {
A6606A192B5EE80000E2ED4D /* XMTPiOS */ = {
isa = XCSwiftPackageProductDependency;
productName = XMTP;
productName = XMTPiOS;
};
A6AE5193297B62C8006FDD0F /* KeychainAccess */ = {
isa = XCSwiftPackageProductDependency;
Expand All @@ -755,10 +752,6 @@
package = A6C0F37C2AC1E34F008C6AA7 /* XCRemoteSwiftPackageReference "WalletConnectSwiftV2" */;
productName = Web3Wallet;
};
A6E774152B154CF000F01DFF /* XMTP */ = {
isa = XCSwiftPackageProductDependency;
productName = XMTP;
};
/* End XCSwiftPackageProductDependency section */
};
rootObject = A6281987292DC825004B9117 /* Project object */;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,15 @@
"revision" : "ecb18d8ce4d88277cc4fb103973352d91e18c535"
}
},
{
"identity" : "libxmtp-swift",
"kind" : "remoteSourceControl",
"location" : "https://github.com/xmtp/libxmtp-swift",
"state" : {
"branch" : "60b99d0",
"revision" : "60b99d04f642a7e2b15156d818dabc4aab65b1c0"
}
},
{
"identity" : "qrcode",
"kind" : "remoteSourceControl",
Expand Down Expand Up @@ -242,15 +251,6 @@
"revision" : "53fe0639a98903858d0196b699720decb42aee7b",
"version" : "2.14.0"
}
},
{
"identity" : "xmtp-rust-swift",
"kind" : "remoteSourceControl",
"location" : "https://github.com/xmtp/xmtp-rust-swift",
"state" : {
"branch" : "main",
"revision" : "e08af6942841054ae02a6fe01d90d18e76d5f248"
}
}
],
"version" : 2
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ import SwiftUI
import XMTPiOS

struct ConversationDetailView: View {
var client: XMTP.Client
var conversation: XMTP.Conversation
var client: Client
var conversation: Conversation

@State private var messages: [DecodedMessage] = []

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,10 @@ import SwiftUI
import XMTPiOS

struct ConversationListView: View {
var client: XMTP.Client
var client: XMTPiOS.Client

@EnvironmentObject var coordinator: EnvironmentCoordinator
@State private var conversations: [XMTP.Conversation] = []
@State private var conversations: [XMTPiOS.Conversation] = []
@State private var isShowingNewConversation = false

var body: some View {
Expand Down
2 changes: 1 addition & 1 deletion XMTPiOSExample/XMTPiOSExample/Views/LoggedInView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ class EnvironmentCoordinator: ObservableObject {
}

struct LoggedInView: View {
var client: XMTP.Client
var client: XMTPiOS.Client

@StateObject var environmentCoordinator = EnvironmentCoordinator()

Expand Down
6 changes: 3 additions & 3 deletions XMTPiOSExample/XMTPiOSExample/Views/LoginView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -71,9 +71,9 @@ class Signer: SigningKey {
}

var cancellable: AnyCancellable?
var continuation: CheckedContinuation<XMTP.Signature, Never>?
var continuation: CheckedContinuation<Signature, Never>?

func sign(_ data: Data) async throws -> XMTP.Signature {
func sign(_ data: Data) async throws -> Signature {
let address = account.address
let topic = session.topic
let blockchain = account.blockchain
Expand Down Expand Up @@ -101,7 +101,7 @@ class Signer: SigningKey {
}
}

func sign(message: String) async throws -> XMTP.Signature {
func sign(message: String) async throws -> Signature {
try await sign(Data(message.utf8))
}
}
Expand Down
12 changes: 6 additions & 6 deletions XMTPiOSExample/XMTPiOSExample/Views/MessageListView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -39,12 +39,12 @@ struct MessageListView_Previews: PreviewProvider {
PreviewClientProvider { client in
MessageListView(
myAddress: "0x00", messages: [
XMTP.DecodedMessage.preview(client: client, topic: "foo", body: "Hello", senderAddress: "0x00", sent: Date().addingTimeInterval(-10)),
XMTP.DecodedMessage.preview(client: client, topic: "foo",body: "Oh hi", senderAddress: "0x01", sent: Date().addingTimeInterval(-9)),
XMTP.DecodedMessage.preview(client: client, topic: "foo",body: "Sup", senderAddress: "0x01", sent: Date().addingTimeInterval(-8)),
XMTP.DecodedMessage.preview(client: client, topic: "foo",body: "Nice to see you", senderAddress: "0x00", sent: Date().addingTimeInterval(-7)),
XMTP.DecodedMessage.preview(client: client, topic: "foo",body: "What if it's a longer message I mean really really long like should it wrap?", senderAddress: "0x01", sent: Date().addingTimeInterval(-6)),
XMTP.DecodedMessage.preview(client: client, topic: "foo",body: "🧐", senderAddress: "0x00", sent: Date().addingTimeInterval(-5)),
DecodedMessage.preview(client: client, topic: "foo", body: "Hello", senderAddress: "0x00", sent: Date().addingTimeInterval(-10)),
DecodedMessage.preview(client: client, topic: "foo",body: "Oh hi", senderAddress: "0x01", sent: Date().addingTimeInterval(-9)),
DecodedMessage.preview(client: client, topic: "foo",body: "Sup", senderAddress: "0x01", sent: Date().addingTimeInterval(-8)),
DecodedMessage.preview(client: client, topic: "foo",body: "Nice to see you", senderAddress: "0x00", sent: Date().addingTimeInterval(-7)),
DecodedMessage.preview(client: client, topic: "foo",body: "What if it's a longer message I mean really really long like should it wrap?", senderAddress: "0x01", sent: Date().addingTimeInterval(-6)),
DecodedMessage.preview(client: client, topic: "foo",body: "🧐", senderAddress: "0x00", sent: Date().addingTimeInterval(-5)),
]
)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import SwiftUI
import XMTPiOS

struct NewConversationView: View {
var client: XMTP.Client
var client: XMTPiOS.Client
var onCreate: (Conversation) -> Void

@Environment(\.dismiss) var dismiss
Expand Down

0 comments on commit 7632a9b

Please sign in to comment.