-
Notifications
You must be signed in to change notification settings - Fork 14
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 #1629 from planetary-social/go-to-feed-tip
#1601: Go to Your Feed tip
- Loading branch information
Showing
10 changed files
with
107 additions
and
8 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
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
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,26 @@ | ||
import TipKit | ||
|
||
/// A tip that's displayed on the Discover view after the user has followed three accounts. | ||
struct GoToFeedTip: Tip { | ||
/// A TipKit Event that tracks the number of accounts that have been followed. | ||
static let followedAccount = Tips.Event(id: "followedAccount") | ||
|
||
/// A TipKit Event that tracks how many times the Feed has been displayed. | ||
static let viewedFeed = Tips.Event(id: "viewedFeed") | ||
|
||
var title: Text { | ||
Text("goToYourFeed") | ||
} | ||
|
||
var rules: [Rule] { | ||
// Each rule here is combined using the logical AND, so all rules must return true for the tip to display. | ||
|
||
#Rule(Self.followedAccount) { | ||
$0.donations.count >= 3 | ||
} | ||
|
||
#Rule(Self.viewedFeed) { | ||
$0.donations.count < 1 | ||
} | ||
} | ||
} |
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,34 @@ | ||
import TipKit | ||
|
||
/// A popover tip view style that has a point down emoji (👇) in the bottom left in addition to the title and | ||
/// close button. | ||
struct PointDownEmojiTipViewStyle: TipViewStyle { | ||
func makeBody(configuration: TipViewStyle.Configuration) -> some View { | ||
VStack(alignment: .leading, spacing: 10) { | ||
HStack(alignment: .top) { | ||
configuration.title | ||
.font(.body.bold()) | ||
.foregroundStyle(Color.primaryTxt) | ||
.shadow(color: .lightShadow, radius: 2, x: 0, y: 1) | ||
|
||
Spacer() | ||
|
||
Button { | ||
configuration.tip.invalidate(reason: .tipClosed) | ||
} label: { | ||
Image(systemName: "xmark").scaledToFit() | ||
.foregroundStyle(Color.primaryTxt) | ||
.font(.system(size: 20).bold()) | ||
} | ||
} | ||
|
||
Text("👇") | ||
} | ||
.padding(.vertical, 20) | ||
.padding(.horizontal, 16) | ||
} | ||
} | ||
|
||
extension TipViewStyle where Self == PointDownEmojiTipViewStyle { | ||
static var pointDownEmoji: Self { Self() } | ||
} |