Skip to content

Commit 8918ab7

Browse files
ComputerEliteComputerElite
authored andcommitted
Check for data folder access on selected app change and app start
1 parent f170ccc commit 8918ab7

File tree

7 files changed

+48
-3
lines changed

7 files changed

+48
-3
lines changed

QuestAppVersionSwitcher/Assets/html/index.html

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -490,6 +490,18 @@ <h2>You can download mods and cosmetics from the following sites. Only QMods are
490490
</div>
491491
</div>
492492
</div>
493+
<div id="step12" class="restoreStep hidden">
494+
<div class="contentHeader headerMargin">
495+
Access needed
496+
</div>
497+
To create backups, restore backups and manage mods, QuestAppVersionSwitcher needs access to the games data folder. To grant access press the <code>Grant access</code> button below and press <code>Use this folder</code>
498+
<div id="step12box" class="textBox"></div>
499+
<div class="buttonSelectionContainer">
500+
<div class="buttonContainer">
501+
<div class="button" id="grantAccess2">Grant access</div>
502+
</div>
503+
</div>
504+
</div>
493505
</div>
494506
<div class="listContainer hidden" id="appListContainer">
495507
<div id="appList" class="list hidden">

QuestAppVersionSwitcher/Assets/html/script.js

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,20 @@ function BrowserGo(direction) {
4141
function OpenSite(url) {
4242
location = url
4343
}
44+
function CheckFolderPermission() {
45+
fetch("gotaccess?package=" + config.currentApp).then(res => {
46+
res.text().then(text => {
47+
if (text == "True") {
48+
// Do nothing, we already got access to the folder
49+
} else {
50+
OpenRestorePopup();
51+
GotoStep("12")
52+
}
53+
})
54+
})
55+
}
56+
57+
4458

4559
let toasts = 0;
4660
let currentToasts = 0;
@@ -411,10 +425,15 @@ function TokenUIUpdate() {
411425
})
412426
}
413427

428+
var firstConfigFetch = true;
414429
function UpdateUI(closeLists = false) {
415430
UpdateShownCosmetics()
416431
fetch("questappversionswitcher/config").then(res => res.json().then(res => {
417432
config = res
433+
if(firstConfigFetch) {
434+
firstConfigFetch = false;
435+
CheckFolderPermission();
436+
}
418437
Array.prototype.forEach.call(document.getElementsByClassName("packageName"), e => {
419438
if(config.currentApp) e.innerHTML = config.currentApp
420439
else e.innerHTML = "No app selected"
@@ -545,9 +564,11 @@ function ShowAppList() {
545564

546565
function ChangeApp(package) {
547566
console.log("Changing app to " + package)
567+
config.currentApp = package
548568
fetch("questappversionswitcher/changeapp?body=" + package).then(() => UpdateUI(true))
549569
UpdateUI(true)
550570
UpdateCosmeticsTypes()
571+
CheckFolderPermission()
551572
}
552573

553574
document.getElementById("exit").onclick = () => {
@@ -742,6 +763,14 @@ document.getElementById("grantAccess").onclick = () => {
742763
})
743764
}
744765

766+
document.getElementById("grantAccess2").onclick = () => {
767+
fetch("grantaccess?package=" + config.currentApp).then(res => {
768+
res.text().then(text => {
769+
CloseRestorePopup();
770+
})
771+
})
772+
}
773+
745774
document.getElementById("requestManageStorageAppPermission").onclick = () => {
746775
fetch("grantmanagestorageappaccess?package=" + config.currentApp).then(res => {
747776
})

QuestAppVersionSwitcher/Mods/IMod.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,8 @@ public interface IMod
1616
/// Unique ID of the mod, must not contain spaces
1717
/// </summary>
1818
string Id { get; }
19+
20+
bool hasCover { get; set; }
1921

2022
/// <summary>
2123
/// Human readable name of the mod

QuestAppVersionSwitcher/Mods/ModManager.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -184,6 +184,7 @@ public async Task SaveMods()
184184

185185
internal void ModLoadedCallback(IMod mod)
186186
{
187+
mod.hasCover = mod.OpenCover().Length > 0;
187188
(mod.IsLibrary ? Libraries : Mods).Add(mod);
188189
_modConfig?.Mods.Add(mod);
189190
foreach (var copyType in mod.FileCopyTypes)

QuestAppVersionSwitcher/Mods/QPMod.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ public class QPMod : IMod
1818

1919
public string Id => Manifest.Id;
2020
public string Name => Manifest.Name;
21+
public bool hasCover { get; set; } = false;
2122
public string? Description => Manifest.Description;
2223
public SemanticVersioning.Version Version => Manifest.Version;
2324
public string VersionString => Manifest.Version.ToString();

QuestAppVersionSwitcher/Properties/AndroidManifest.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<?xml version="1.0" encoding="utf-8"?>
2-
<manifest xmlns:android="http://schemas.android.com/apk/res/android" android:versionName="1.10.4" package="com.ComputerElite.questappversionswitcher" android:installLocation="preferExternal" android:versionCode="52">
2+
<manifest xmlns:android="http://schemas.android.com/apk/res/android" android:versionName="1.10.5" package="com.ComputerElite.questappversionswitcher" android:installLocation="preferExternal" android:versionCode="53">
33
<uses-sdk android:minSdkVersion="28" android:targetSdkVersion="32" />
44
<uses-permission android:name="oculus.permission.handtracking" />
55
<uses-permission android:name="com.oculus.permission.HAND_TRACKING" />

QuestAppVersionSwitcher/Properties/AssemblyInfo.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,5 +22,5 @@
2222
// Minor Version
2323
// Build Number
2424
// Revision
25-
[assembly: AssemblyVersion("1.10.4.0")]
26-
[assembly: AssemblyFileVersion("1.10.4.0")]
25+
[assembly: AssemblyVersion("1.10.5.0")]
26+
[assembly: AssemblyFileVersion("1.10.5.0")]

0 commit comments

Comments
 (0)