-
-
Notifications
You must be signed in to change notification settings - Fork 39
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #77 from MetaMask/session-persistance
Session persistance
- Loading branch information
Showing
19 changed files
with
532 additions
and
204 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
// | ||
// ToastOverlay.swift | ||
// metamask-ios-sdk_Example | ||
// | ||
|
||
import SwiftUI | ||
|
||
struct ToastOverlay<ToastContent>: View where ToastContent : View { | ||
let content: ToastContent | ||
@Binding var isPresented: Bool | ||
|
||
|
||
var body: some View { | ||
GeometryReader { geometry in | ||
VStack { | ||
Spacer() | ||
HStack { | ||
Spacer() | ||
content | ||
.frame(width: geometry.size.width * 0.8, height: 8) | ||
.animation(.easeIn) | ||
Spacer() | ||
} | ||
Spacer() | ||
} | ||
} | ||
.background(Color.clear) | ||
.edgesIgnoringSafeArea(.bottom) | ||
.onAppear { | ||
DispatchQueue.main.asyncAfter(deadline: .now() + 3) { | ||
isPresented = false | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
// | ||
// ToastView.swift | ||
// metamask-ios-sdk_Example | ||
// | ||
|
||
import SwiftUI | ||
|
||
struct ToastView: View { | ||
let message: String | ||
|
||
var body: some View { | ||
VStack { | ||
Text(message) | ||
.padding() | ||
.foregroundColor(.white) | ||
.background(Color.black) | ||
.clipShape(RoundedRectangle(cornerRadius: 30, style: .continuous)) | ||
} | ||
} | ||
} | ||
|
||
struct ToastView_Previews: PreviewProvider { | ||
static var previews: some View { | ||
ToastView(message: "Test message") | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
// | ||
// ViewExtension.swift | ||
// metamask-ios-sdk_Example | ||
// | ||
|
||
import SwiftUI | ||
|
||
extension View { | ||
func toast<ToastContent: View>(isPresented: Binding<Bool>, @ViewBuilder content: () -> ToastContent) -> some View { | ||
ZStack { | ||
self | ||
if isPresented.wrappedValue { | ||
ToastOverlay(content: content(), isPresented: isPresented) | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.