Skip to content

Commit

Permalink
Merge pull request #5 from QuestCraftPlusPlus/MSAL
Browse files Browse the repository at this point in the history
MSAL Integreation
  • Loading branch information
thejudge156 authored Aug 14, 2023
2 parents 5d63244 + b700b38 commit 6122555
Show file tree
Hide file tree
Showing 7 changed files with 78 additions and 26 deletions.
1 change: 1 addition & 0 deletions Assets/Plugins/Android/mainTemplate.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ dependencies {
implementation("com.google.code.gson:gson:2.9.1")
implementation("commons-io:commons-io:2.11.0")
implementation("commons-codec:commons-codec:1.15")
implementation("com.microsoft.azure:msal4j:1.13.9")
**DEPS**}

android {
Expand Down
8 changes: 6 additions & 2 deletions Assets/Scripts/.idea/.idea.Scripts.dir/.idea/workspace.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Assets/Scripts/InstanceButton.cs
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ public void LaunchCurrentInstance()
AndroidJavaObject instance = GetInstance();
string currentFile = JNIStorage.apiClass.GetStatic<string>("currentDownload");

instance.Call("updateOrDownloadsMods");
instance.Call("updateOrDownloadMods");

if (currentFile != null)
{
Expand Down
27 changes: 17 additions & 10 deletions Assets/Scripts/LoginHandler.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,19 +11,26 @@ public class LoginHandler : MonoBehaviour
{
public WindowHandler handler;
bool hasAttemptedLogin = false;
AndroidJavaClass jc;
AndroidJavaObject jo;

public void Login()
public void Login() {
jc = new AndroidJavaClass("com.unity3d.player.UnityPlayer");
jo = jc.GetStatic<AndroidJavaObject>("currentActivity");
JNIStorage.apiClass.CallStatic("login", jo);
hasAttemptedLogin = true;
}

public void Update()
{
AndroidJavaClass jc = new AndroidJavaClass("com.unity3d.player.UnityPlayer");
AndroidJavaObject jo = jc.GetStatic<AndroidJavaObject>("currentActivity");
JNIStorage.accountObj = JNIStorage.apiClass.CallStatic<AndroidJavaObject>("login", "d17a73a2-707c-40f5-8c90-d3eda0956f10", jo);
if (JNIStorage.accountObj != null)
{
if(!hasAttemptedLogin) {
return;
}
if (JNIStorage.accountObj != null) {
handler.MainPanelSwitch();
} else if(hasAttemptedLogin) {
JNIStorage.apiClass.SetStatic("msaMessage", "Login failure! Ensure you have accepted the permissions then try again.");
}
hasAttemptedLogin = true;
} else {
JNIStorage.accountObj = JNIStorage.apiClass.GetStatic<AndroidJavaObject>("currentAcc");
}
}

public void LogoutButton()
Expand Down
2 changes: 1 addition & 1 deletion Assets/Scripts/LoginText.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ void Update()
GetComponent<TextMeshProUGUI>().text = JNIStorage.apiClass.GetStatic<string>("msaMessage");
if(GetComponent<TextMeshProUGUI>().text != "")
{
GetComponent<TextMeshProUGUI>().text = GetComponent<TextMeshProUGUI>().text + "Click the Microsoft button again once done.";
GetComponent<TextMeshProUGUI>().text = GetComponent<TextMeshProUGUI>().text + "Complete then you will be logged in.";
}
}
}
60 changes: 50 additions & 10 deletions Assets/XR/Settings/OpenXR Package Settings.asset
Original file line number Diff line number Diff line change
Expand Up @@ -201,12 +201,12 @@ MonoBehaviour:
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 651ead225c5006a47a4c1b260324bcad, type: 3}
m_Name: PICOTouchControllerProfile Standalone
m_EditorClassIdentifier:
m_EditorClassIdentifier:
m_enabled: 0
nameUi: PICO Touch Controller Profile
version: 1.0.0
featureIdInternal: com.unity.openxr.feature.input.PICOtouch
openxrExtensionStrings:
openxrExtensionStrings:
company: Unity
priority: 0
required: 0
Expand Down Expand Up @@ -354,8 +354,8 @@ MonoBehaviour:
- {fileID: -4385940899802160061}
- {fileID: -747992668352682029}
- {fileID: -5775585660762845452}
- {fileID: 1974839888606913054}
- {fileID: -1326321940886872886}
- {fileID: 2350260251562571038}
- {fileID: 289832301501076296}
- {fileID: -1602194547347681964}
m_renderMode: 1
m_depthSubmissionMode: 0
Expand Down Expand Up @@ -412,12 +412,12 @@ MonoBehaviour:
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 651ead225c5006a47a4c1b260324bcad, type: 3}
m_Name: PICOTouchControllerProfile Android
m_EditorClassIdentifier:
m_EditorClassIdentifier:
m_enabled: 0
nameUi: PICO Touch Controller Profile
version: 1.0.0
featureIdInternal: com.unity.openxr.feature.input.PICOtouch
openxrExtensionStrings:
openxrExtensionStrings:
company: Unity
priority: 0
required: 0
Expand Down Expand Up @@ -459,6 +459,26 @@ MonoBehaviour:
Values:
- {fileID: 6049331634818758740}
- {fileID: -2452932707305564552}
--- !u!114 &289832301501076296
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 0}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 651ead225c5006a47a4c1b260324bcad, type: 3}
m_Name: PICOTouchControllerProfile Android
m_EditorClassIdentifier:
m_enabled: 0
nameUi: PICO Touch Controller Profile
version: 1.0.0
featureIdInternal: com.unity.openxr.feature.input.PICOtouch
openxrExtensionStrings:
company: Unity
priority: 0
required: 0
--- !u!114 &485601243302538492
MonoBehaviour:
m_ObjectHideFlags: 0
Expand All @@ -481,7 +501,27 @@ MonoBehaviour:
required: 0
cacheSize: 1048576
perThreadCacheSize: 51200
--- !u!114 &1974839888606913054
--- !u!114 &2158027343007070627
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 0}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 651ead225c5006a47a4c1b260324bcad, type: 3}
m_Name: PICOTouchControllerProfile Standalone
m_EditorClassIdentifier:
m_enabled: 0
nameUi: PICO Touch Controller Profile
version: 1.0.0
featureIdInternal: com.unity.openxr.feature.input.PICOtouch
openxrExtensionStrings:
company: Unity
priority: 0
required: 0
--- !u!114 &2350260251562571038
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
Expand All @@ -492,12 +532,12 @@ MonoBehaviour:
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: baa5b568c4324bd4faad2da2e7ee7e84, type: 3}
m_Name: PICOFeature Android
m_EditorClassIdentifier:
m_EditorClassIdentifier:
m_enabled: 0
nameUi: PICO Support
version: 1.0.0
featureIdInternal: com.unity.openxr.feature.piconeo3
openxrExtensionStrings:
openxrExtensionStrings:
company: Unity
priority: 0
required: 0
Expand Down Expand Up @@ -543,7 +583,7 @@ MonoBehaviour:
- {fileID: 7470925067048501927}
- {fileID: -2880336092103312573}
- {fileID: -4479395911564737717}
- {fileID: -4940385545727823542}
- {fileID: 2158027343007070627}
- {fileID: 485601243302538492}
- {fileID: -4311972797160638725}
m_renderMode: 1
Expand Down
4 changes: 2 additions & 2 deletions ProjectSettings/ProjectSettings.asset
Original file line number Diff line number Diff line change
Expand Up @@ -162,8 +162,8 @@ PlayerSettings:
iPhone: 0
tvOS: 0
overrideDefaultApplicationIdentifier: 1
AndroidBundleVersionCode: 1
AndroidMinSdkVersion: 31
AndroidBundleVersionCode: 2
AndroidMinSdkVersion: 32
AndroidTargetSdkVersion: 0
AndroidPreferredInstallLocation: 0
aotOptions:
Expand Down

0 comments on commit 6122555

Please sign in to comment.