Skip to content

Commit ef861c3

Browse files
committed
Refactoring
1 parent 3854c40 commit ef861c3

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

Assets/PatchKit Patcher/Scripts/GameTitle.cs

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@ namespace PatchKit.Unity
88
{
99
public class GameTitle : MonoBehaviour
1010
{
11+
private const string TitleCacheKey = "app-display-name";
12+
1113
public Text Text;
1214

1315
private bool _hasBeenSet;
@@ -21,8 +23,8 @@ private void Start()
2123

2224
patcher.Data
2325
.ObserveOnMainThread()
24-
.SkipWhile(data => string.IsNullOrEmpty(data.AppSecret))
2526
.Select(x => x.AppSecret)
27+
.SkipWhile(string.IsNullOrEmpty)
2628
.First()
2729
.Subscribe(UseCachedText)
2830
.AddTo(this);
@@ -36,13 +38,13 @@ private void Start()
3638

3739
private void UseCachedText(string appSecret)
3840
{
39-
if(_hasBeenSet)
41+
if (_hasBeenSet)
4042
{
4143
return;
4244
}
4345

4446
var cachedDisplayName = GetCache(appSecret)
45-
.GetValue("app-display-name", null);
47+
.GetValue(TitleCacheKey, null);
4648

4749
if (string.IsNullOrEmpty(cachedDisplayName))
4850
{
@@ -56,7 +58,7 @@ private void SetAndCacheText(PatchKit.Api.Models.Main.App app)
5658
{
5759
string displayName = app.DisplayName;
5860

59-
GetCache(app.Secret).SetValue("app-display-name", displayName);
61+
GetCache(app.Secret).SetValue(TitleCacheKey, displayName);
6062
Text.text = displayName;
6163

6264
_hasBeenSet = true;

0 commit comments

Comments
 (0)