Skip to content

Commit d9d0226

Browse files
authored
Merge pull request #81 from VirtueSky/dev
Dev
2 parents 85626ee + d34e974 commit d9d0226

32 files changed

Lines changed: 200 additions & 149 deletions
Lines changed: 63 additions & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -1,51 +1,64 @@
11
# .github/workflows/notify-discord-release.yml
2-
name: Notify Discord Release
3-
4-
on:
5-
release:
6-
types: [published]
7-
8-
jobs:
9-
notify-discord:
10-
runs-on: ubuntu-latest
11-
steps:
12-
- name: Send release info to Discord
13-
env:
14-
DISCORD_WEBHOOK_URL: ${{ secrets.DISCORD_WEBHOOK_URL }}
15-
RELEASE_TITLE: ${{ github.event.release.name }}
16-
TAG_NAME: ${{ github.event.release.tag_name }}
17-
RELEASE_NOTE: ${{ github.event.release.body }}
18-
run: |
19-
jq -n \
20-
--arg title "$RELEASE_TITLE" \
21-
--arg tag "$TAG_NAME" \
22-
--arg note "$RELEASE_NOTE" \
23-
'{
24-
embeds: [
25-
{
26-
title: "New GitHub Release",
27-
fields: [
28-
{
29-
name: "Release Title",
30-
value: (if $title == "" then "(empty)" else $title end),
31-
inline: false
32-
},
33-
{
34-
name: "Tag Name",
35-
value: (if $tag == "" then "(empty)" else $tag end),
36-
inline: false
37-
},
38-
{
39-
name: "Release Note",
40-
value: (if $note == "" then "(empty)" else $note end),
41-
inline: false
42-
}
43-
]
44-
}
45-
]
46-
}' > payload.json
47-
48-
curl -H "Content-Type: application/json" \
49-
-X POST \
50-
-d @payload.json \
51-
"$DISCORD_WEBHOOK_URL"
2+
name: Notify Discord on Release
3+
4+
on:
5+
release:
6+
types: [published]
7+
8+
jobs:
9+
notify-discord:
10+
runs-on: ubuntu-latest
11+
steps:
12+
- name: Send release info to Discord
13+
env:
14+
DISCORD_WEBHOOK_URL: ${{ secrets.DISCORD_WEBHOOK_URL }}
15+
run: |
16+
# Escape special characters in release notes
17+
SAFE_NOTES="${{ github.event.release.body }}"
18+
SAFE_NOTES="${SAFE_NOTES//\"/\\\"}"
19+
SAFE_NOTES="${SAFE_NOTES//$'\n'/\\n}"
20+
21+
# Create timestamp
22+
CREATED_AT="${{ github.event.release.created_at }}"
23+
CREATED_AT="${CREATED_AT//T/ }"
24+
CREATED_AT="${CREATED_AT//Z/ UTC}"
25+
26+
jq -n \
27+
--arg title "${{ github.event.release.name }}" \
28+
--arg tag "${{ github.event.release.tag_name }}" \
29+
--arg url "${{ github.event.release.html_url }}" \
30+
--arg author "${{ github.actor }}" \
31+
--arg notes "$SAFE_NOTES" \
32+
--arg created "$CREATED_AT" \
33+
--arg repo "${{ github.repository }}" \
34+
'{
35+
username: "GitHub Release Bot",
36+
avatar_url: "https://github.githubassets.com/images/modules/logos_page/GitHub-Mark.png",
37+
embeds: [
38+
{
39+
title: "🚀 New Release Published",
40+
url: $url,
41+
color: 5793266,
42+
author: {
43+
name: $author,
44+
icon_url: ("https://github.com/" + $author + ".png")
45+
},
46+
fields: [
47+
{name: "Repository", value: $repo, inline: true},
48+
{name: "Tag", value: $tag, inline: true},
49+
{name: "Released at", value: $created, inline: false},
50+
{name: "Release Notes", value: (if $notes == "" then "No description" else $notes end), inline: false}
51+
],
52+
footer: {
53+
text: "GitHub Actions",
54+
icon_url: "https://github.githubassets.com/images/modules/logos_page/GitHub-Mark.png"
55+
},
56+
timestamp: (now | todate)
57+
}
58+
]
59+
}' > payload.json
60+
61+
curl -H "Content-Type: application/json" \
62+
-X POST \
63+
-d @payload.json \
64+
"$DISCORD_WEBHOOK_URL"

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,9 +23,9 @@
2323
### 1: Download the repository and drop it into folder `Assets`
2424
### 2: Add the line below to `Packages/manifest.json`
2525

26-
- for version `3.5.3`
26+
- for version `3.5.4`
2727
```json
28-
"com.virtuesky.sunflower":"https://github.com/VirtueSky/sunflower.git#3.5.3",
28+
"com.virtuesky.sunflower":"https://github.com/VirtueSky/sunflower.git#3.5.4",
2929
```
3030
- depencies:
3131
```json

VirtueSky/Advertising/Runtime/Admob/AdmobAdUnitVariable.cs

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@ public class AdmobAdUnitVariable : AdUnitVariable
99
[SerializeField] protected string iOSId;
1010
[NonSerialized] private string idRuntime = string.Empty;
1111

12+
public override bool IsShowing { get; internal set; }
13+
1214
public override string Id
1315
{
1416
get
@@ -28,18 +30,18 @@ public override string Id
2830
}
2931
}
3032

31-
public void SetIdRuntime(string unitId)
32-
{
33-
idRuntime = unitId;
34-
}
35-
36-
public override AdUnitVariable Show()
33+
public override AdUnitVariable Show(string placement = null)
3734
{
3835
ResetChainCallback();
3936
if (!Application.isMobilePlatform || string.IsNullOrEmpty(Id) || AdStatic.IsRemoveAd ||
4037
!IsReady()) return this;
41-
ShowImpl();
38+
ShowImpl(placement);
4239
return this;
4340
}
41+
42+
public void SetIdRuntime(string unitId)
43+
{
44+
idRuntime = unitId;
45+
}
4446
}
4547
}

VirtueSky/Advertising/Runtime/Admob/AdmodUnitVariable/AdmobAppOpenVariable.cs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ public override bool IsReady()
5757
#endif
5858
}
5959

60-
protected override void ShowImpl()
60+
protected override void ShowImpl(string placement = null)
6161
{
6262
#if VIRTUESKY_ADS && VIRTUESKY_ADMOB
6363
_appOpenAd.Show();
@@ -105,6 +105,7 @@ private void OnAdOpening()
105105
{
106106
AdStatic.waitAppOpenDisplayedAction?.Invoke();
107107
AdStatic.IsShowingAd = true;
108+
IsShowing = true;
108109
Common.CallActionAndClean(ref displayedCallback);
109110
OnDisplayedAdEvent?.Invoke();
110111
}
@@ -119,6 +120,7 @@ private void OnAdClosed()
119120
{
120121
AdStatic.waitAppOpenClosedAction?.Invoke();
121122
AdStatic.IsShowingAd = false;
123+
IsShowing = false;
122124
Common.CallActionAndClean(ref closedCallback);
123125
OnClosedAdEvent?.Invoke();
124126
Destroy();
@@ -129,7 +131,7 @@ private void OnAdPaided(AdValue value)
129131
paidedCallback?.Invoke(value.Value / 1000000f,
130132
"Admob",
131133
Id,
132-
"AppOpenAd", AdNetwork.Admob.ToString());
134+
"AppOpenAd", AdMediation.Admob.ToString());
133135
}
134136

135137
private void OnAdLoaded()

VirtueSky/Advertising/Runtime/Admob/AdmodUnitVariable/AdmobBannerVariable.cs

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -96,10 +96,11 @@ public override bool IsReady()
9696
#endif
9797
}
9898

99-
protected override void ShowImpl()
99+
protected override void ShowImpl(string placement = null)
100100
{
101101
#if VIRTUESKY_ADS && VIRTUESKY_ADMOB
102102
_isBannerShowing = true;
103+
IsShowing = true;
103104
AdStatic.waitAppOpenClosedAction = OnWaitAppOpenClosed;
104105
AdStatic.waitAppOpenDisplayedAction = OnWaitAppOpenDisplayed;
105106
if (_bannerView == null)
@@ -116,6 +117,7 @@ public override void Destroy()
116117
#if VIRTUESKY_ADS && VIRTUESKY_ADMOB
117118
if (_bannerView == null) return;
118119
_isBannerShowing = false;
120+
IsShowing = false;
119121
AdStatic.waitAppOpenClosedAction = null;
120122
AdStatic.waitAppOpenDisplayedAction = null;
121123
_bannerView.Destroy();
@@ -128,6 +130,7 @@ public override void HideBanner()
128130
base.HideBanner();
129131
#if VIRTUESKY_ADS && VIRTUESKY_ADMOB
130132
_isBannerShowing = false;
133+
IsShowing = false;
131134
if (_bannerView != null) _bannerView.Hide();
132135
#endif
133136
}
@@ -182,7 +185,7 @@ private void OnAdPaided(AdValue value)
182185
paidedCallback?.Invoke(value.Value / 1000000f,
183186
"Admob",
184187
Id,
185-
"BannerAd", AdNetwork.Admob.ToString());
188+
"BannerAd", AdMediation.Admob.ToString());
186189
}
187190

188191
private void OnAdClicked()

0 commit comments

Comments
 (0)