Skip to content
Merged
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
Binary file modified .DS_Store
Binary file not shown.
3 changes: 2 additions & 1 deletion .github/PULL_REQUEST_TEMPLATE.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,8 @@

- [ ] `swift build` passes
- [ ] `swift test` passes
- [ ] Demo app builds (`xcodebuild -project Examples/sdk-demo/oms-sdk-demo.xcodeproj -scheme oms-sdk-demo build`) — if applicable
- [ ] SDK demo app builds (`xcodebuild -project Examples/sdk-demo/oms-sdk-demo.xcodeproj -scheme oms-sdk-demo build CODE_SIGNING_ALLOWED=NO`)
- [ ] Trails Actions demo app builds (`xcodebuild -project Examples/trails-actions/trails-actions.xcodeproj -scheme trails-actions build CODE_SIGNING_ALLOWED=NO`)

## Related

Expand Down
6 changes: 6 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,3 +22,9 @@ jobs:

- name: Test
run: swift test

- name: Build SDK demo app
run: xcodebuild -project Examples/sdk-demo/oms-sdk-demo.xcodeproj -scheme oms-sdk-demo build CODE_SIGNING_ALLOWED=NO

- name: Build Trails Actions demo app
run: xcodebuild -project Examples/trails-actions/trails-actions.xcodeproj -scheme trails-actions build CODE_SIGNING_ALLOWED=NO
14 changes: 9 additions & 5 deletions AGENTS.md
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,8 @@ and target names in shell commands, for example `"Sources/Swift SDK"` and
`#expect`.
- `Examples/sdk-demo/oms-sdk-demo.xcodeproj` and
`Examples/sdk-demo/oms-sdk-demo/` contain the SwiftUI demo app.
- `Examples/trails-actions/trails-actions.xcodeproj` and
`Examples/trails-actions/trails-actions/` contain the Trails Actions demo app.
- `README.md` is the user-facing guide; `API.md` is the detailed API reference.

## Common Commands
Expand All @@ -93,11 +95,13 @@ and target names in shell commands, for example `"Sources/Swift SDK"` and
swift build
swift test
xcodebuild -list -project Examples/sdk-demo/oms-sdk-demo.xcodeproj
xcodebuild -project Examples/sdk-demo/oms-sdk-demo.xcodeproj -scheme oms-sdk-demo build
xcodebuild -project Examples/sdk-demo/oms-sdk-demo.xcodeproj -scheme oms-sdk-demo build CODE_SIGNING_ALLOWED=NO
xcodebuild -list -project Examples/trails-actions/trails-actions.xcodeproj
xcodebuild -project Examples/trails-actions/trails-actions.xcodeproj -scheme trails-actions build CODE_SIGNING_ALLOWED=NO
```

Run `swift test` for SDK changes. For demo app changes, also build the Xcode
project with the `oms-sdk-demo` scheme when feasible.
Run `swift test` for SDK changes. For demo app changes, also build the relevant
Xcode project with signing disabled when feasible.

## Testing

Expand Down Expand Up @@ -127,8 +131,8 @@ execution commands.
## CI/CD

CI runs on every PR and push to `master` via `.github/workflows/ci.yml`:
`swift build` and `swift test` are required to pass. Claude GitHub Actions are
defined in `.github/workflows/claude.yml` (mention handler) and
`swift build`, `swift test`, and the demo app Xcode builds are required to pass.
Claude GitHub Actions are defined in `.github/workflows/claude.yml` (mention handler) and
`.github/workflows/claude-code-review.yml` (auto-review on PRs).

## Documentation
Expand Down
4 changes: 2 additions & 2 deletions API.md
Original file line number Diff line number Diff line change
Expand Up @@ -102,15 +102,15 @@ Most apps create a wallet client through `OMSClient`. Use this initializer only
var walletAddress: String
```

The on-chain address of the active wallet. Empty until a wallet is restored or activated by `completeEmailAuth`, `useWallet`, or `createWallet`.
The read-only on-chain address of the active wallet. Empty until a wallet is restored or activated by `completeEmailAuth`, `useWallet`, or `createWallet`.

### walletId

```swift
var walletId: String
```

The server-side wallet ID. Empty until a wallet is restored or activated by `completeEmailAuth`, `useWallet`, or `createWallet`.
The read-only server-side wallet ID. Empty until a wallet is restored or activated by `completeEmailAuth`, `useWallet`, or `createWallet`.

### session

Expand Down
2 changes: 2 additions & 0 deletions Examples/sdk-demo/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -57,5 +57,7 @@
<string>UIInterfaceOrientationLandscapeLeft</string>
<string>UIInterfaceOrientationLandscapeRight</string>
</array>
<key>UIUserInterfaceStyle</key>
<string>Light</string>
</dict>
</plist>
4 changes: 4 additions & 0 deletions Examples/sdk-demo/oms-sdk-demo.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,11 @@

/* Begin PBXBuildFile section */
3D2708222F98AE7300CD78D9 /* OMS SDK in Frameworks */ = {isa = PBXBuildFile; productRef = 3D2708212F98AE7300CD78D9 /* OMS SDK */; };
3D8F2A012F9A000100000001 /* styling.gen.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3D8F2A002F9A000100000001 /* styling.gen.swift */; };
/* End PBXBuildFile section */

/* Begin PBXFileReference section */
3D8F2A002F9A000100000001 /* styling.gen.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = styling.gen.swift; sourceTree = "<group>"; };
3D65FC962F86D5AC009476BA /* oms-sdk-demo.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = "oms-sdk-demo.app"; sourceTree = BUILT_PRODUCTS_DIR; };
/* End PBXFileReference section */

Expand Down Expand Up @@ -45,6 +47,7 @@
isa = PBXGroup;
children = (
3D65FC982F86D5AC009476BA /* oms-sdk-demo */,
3D8F2A002F9A000100000001 /* styling.gen.swift */,
3D2708202F98AE7300CD78D9 /* Frameworks */,
3D65FC972F86D5AC009476BA /* Products */,
);
Expand Down Expand Up @@ -136,6 +139,7 @@
isa = PBXSourcesBuildPhase;
buildActionMask = 2147483647;
files = (
3D8F2A012F9A000100000001 /* styling.gen.swift in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
Expand Down
78 changes: 73 additions & 5 deletions Examples/sdk-demo/oms-sdk-demo/AppError.swift
Original file line number Diff line number Diff line change
Expand Up @@ -110,12 +110,80 @@ private func serviceErrorMessage(_ error: WebRPCError, fallback: String) -> Stri

extension View {
func genericErrorWindow(error: Binding<GenericAppError?>) -> some View {
alert(item: error) { error in
Alert(
title: Text("Something went wrong"),
message: Text(error.message),
dismissButton: .default(Text("OK"))
modifier(GenericErrorDialog(error: error))
}
}

private struct GenericErrorDialog: ViewModifier {
@Binding var error: GenericAppError?

func body(content: Content) -> some View {
content
.overlay {
if let error {
TokenDialog(
title: "Something went wrong",
message: error.message,
primaryTitle: "OK",
primaryAction: {
self.error = nil
}
)
}
}
}
}

struct TokenDialog: View {
let title: String
let message: String
let primaryTitle: String
let primaryAction: () -> Void
var secondaryTitle: String? = nil
var secondaryAction: (() -> Void)? = nil

var body: some View {
ZStack {
DesignTokens.Color.primaryText
.opacity(0.18)
.ignoresSafeArea()

VStack(alignment: .leading, spacing: 16) {
VStack(alignment: .leading, spacing: 8) {
Text(title)
.font(DesignTokens.Typography.heading)
.foregroundStyle(DesignTokens.Color.primaryText)
.fixedSize(horizontal: false, vertical: true)

Text(message)
.font(DesignTokens.Typography.caption)
.foregroundStyle(DesignTokens.Color.secondaryText)
.fixedSize(horizontal: false, vertical: true)
}

HStack(spacing: 12) {
if let secondaryTitle, let secondaryAction {
Button(secondaryTitle, action: secondaryAction)
.buttonStyle(DesignButtonStyle(variant: .secondary))
}

Spacer(minLength: 0)

Button(primaryTitle, action: primaryAction)
.buttonStyle(DesignButtonStyle(variant: .primary))
}
}
.padding(24)
.frame(maxWidth: 360, alignment: .leading)
.background(
RoundedRectangle(cornerRadius: DesignTokens.Radius.card)
.fill(DesignTokens.Color.surface)
)
.overlay(
RoundedRectangle(cornerRadius: DesignTokens.Radius.card)
.stroke(DesignTokens.Color.headerBorder, lineWidth: DesignTokens.Stroke.defaultWidth)
)
.padding(24)
}
}
}
Loading
Loading