mirror of
https://github.com/RaindropViewer/RaindropViewer.git
synced 2026-07-27 22:11:39 +00:00
Make Eula text be loaded from disk
This commit is contained in:
@@ -0,0 +1,27 @@
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using TMPro;
|
||||
using UnityEngine;
|
||||
using UnityEngine.Windows;
|
||||
using File = System.IO.File;
|
||||
|
||||
[RequireComponent(typeof(TMP_Text))]
|
||||
public class EULA_Printer : MonoBehaviour
|
||||
{
|
||||
private string Eulatext =>
|
||||
System.IO.File.ReadAllText(
|
||||
Path.Combine(
|
||||
Disk.DirectoryHelpers.GetInternalCacheDir(),
|
||||
"RD_Eula.txt")
|
||||
)
|
||||
;
|
||||
|
||||
|
||||
private void OnEnable()
|
||||
{
|
||||
var text = this.GetComponent<TMP_Text>();
|
||||
text.text = Eulatext;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 2af89a9f5473e794e9b9d7c98f84a927
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,7 @@
|
||||
fileFormatVersion: 2
|
||||
guid: a5eeca0ea7e05a842925cd2aa56bce27
|
||||
PrefabImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -40,7 +40,8 @@ public class EulaView : MonoBehaviour
|
||||
}
|
||||
|
||||
bool isAcceptedEULA = instance.GlobalSettings["EulaAccepted"];
|
||||
onToggleChanged(isAcceptedEULA);
|
||||
EulaToggle.isOn = isAcceptedEULA;
|
||||
//onToggleChanged(isAcceptedEULA);
|
||||
|
||||
closeBtn.onClick.AddListener(closeEula);
|
||||
}
|
||||
|
||||
@@ -0,0 +1,99 @@
|
||||
using System.Collections;
|
||||
using NUnit.Framework;
|
||||
using OpenMetaverse;
|
||||
using Raindrop;
|
||||
using Raindrop.ServiceLocator;
|
||||
using Raindrop.Services;
|
||||
using Tests.Raindrop.RaindropFullIntegrationTests.InputSubroutines;
|
||||
using UnityEngine;
|
||||
using UnityEngine.SceneManagement;
|
||||
using UnityEngine.TestTools;
|
||||
|
||||
namespace Tests.Raindrop.RaindropFullIntegrationTests
|
||||
{
|
||||
[TestFixture()]
|
||||
public class EulaAcceptanceTests
|
||||
{
|
||||
|
||||
[UnityTest]
|
||||
//go the the flat file and reset the EulaAccepted field.
|
||||
public IEnumerator ResetEulaAcceptance_InBackEnd()
|
||||
{
|
||||
var instance = new RaindropInstance(new GridClient());
|
||||
instance.GlobalSettings["EulaAccepted"] = false;
|
||||
instance.GlobalSettings.Save();
|
||||
|
||||
//cleanup
|
||||
if (instance != null)
|
||||
{
|
||||
instance.CleanUp();
|
||||
instance = null;
|
||||
}
|
||||
|
||||
instance = new RaindropInstance(new GridClient());
|
||||
Assert.False(instance.GlobalSettings["EulaAccepted"]);
|
||||
|
||||
//cleanup
|
||||
if (instance != null)
|
||||
{
|
||||
instance.CleanUp();
|
||||
instance = null;
|
||||
}
|
||||
|
||||
yield break;
|
||||
}
|
||||
|
||||
[UnityTest]
|
||||
// the EULA screen is visible and accepting the EULA takes effect in the next run.
|
||||
// 1. internally set the eula is false.
|
||||
// 2. restart the ui and check it is showing the eula screen.
|
||||
// 3. accept the eula.
|
||||
// 4. restart the ui and check it is showing welcome screen
|
||||
public IEnumerator Can_Accept_EULA()
|
||||
{
|
||||
SceneManager.LoadScene("Scenes/MainScene");
|
||||
yield return new WaitForSeconds(2);
|
||||
|
||||
//1. disable the EULA
|
||||
// var instance = new RaindropInstance(new GridClient());
|
||||
var instance = ServiceLocator.Instance.Get<RaindropInstance>();
|
||||
instance.GlobalSettings["EulaAccepted"] = false;
|
||||
instance.GlobalSettings.Save();
|
||||
Assert.False(instance.GlobalSettings["EulaAccepted"]);
|
||||
|
||||
//2 restart the UI.
|
||||
UIService uiSrv = ServiceLocator.Instance.Get<UIService>();
|
||||
uiSrv.initialise();
|
||||
|
||||
//2a. assert the eula prompt is present
|
||||
Assert.True(uiSrv.ScreensManager.TopCanvas.canvasType == CanvasType.Eula);
|
||||
|
||||
//2b. accept the eula
|
||||
if (uiSrv.ScreensManager.TopCanvas.canvasType == CanvasType.Eula)
|
||||
{
|
||||
// well, we need to agree to eula first.
|
||||
yield return Login.accepttheeula();
|
||||
yield return new WaitForSeconds(2);
|
||||
}
|
||||
|
||||
//3 restart the UI.
|
||||
uiSrv.initialise();
|
||||
yield return new WaitForSeconds(2);
|
||||
|
||||
//3b. should not be eula screen
|
||||
if (uiSrv.ScreensManager.TopCanvas.canvasType == CanvasType.Eula)
|
||||
{
|
||||
Assert.Fail("eula is accepted, but the eula screen is appearing on startup");
|
||||
}
|
||||
|
||||
if (uiSrv.ScreensManager.TopCanvas.canvasType == CanvasType.Welcome)
|
||||
{
|
||||
Assert.Pass();
|
||||
}
|
||||
|
||||
|
||||
yield break;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,3 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 4823b6bbbc144ab28ded1eec5dd4e24d
|
||||
timeCreated: 1643012574
|
||||
Reference in New Issue
Block a user