Merge custom control changes (#284)

* Move control loaders to CustomControlsUtils.m

* WIP Drawer support (currently broken)

Also, updated MetalANGLE for helping debug stuff on crash.

* temp

* ControlDrawer: free orientation

* Avoid scrolling the hotbar in grab mode

* Popover: fix the frame inside the arrow

* Changes

- Attempt to allow Microsoft login when offline.
- Custom controls: drawer and sub-buttons are now visible.
- Pickers in Preferences: pre-select at the saved index.

* Bump version code to 4, hide sub-button by default

* Fix text trucanting

* impl scroll buttons, rewrite some parts to objc

* Virtual mouse implementation

Also, possible fix for popover crashes on iPad

Exception type: NSInternalInconsistencyException
> Reason: Tried to set <UIBarButtonItem: 0x10fee5660> menuOnTouchDown
menu=0x2810dce10 image=<UIImage:0x280149050 symbol(system:
ellipsis.circle) {20, 19} baseline=3.5,contentInsets={1, 1.5, 1,
1.5},alignmentRectInsets={-0.5, 0, -0.5, 0}
config=<traits=(UserInterfaceIdiom = Pad, DisplayScale = 2,
DisplayGamut = sRGB, HorizontalSizeClass = Regular, VerticalSizeClass
= Regular, UserInterfaceStyle = Dark, UserInterfaceLayoutDirection =
LTR, PreferredContentSizeCategory = L, AccessibilityContrast =
Normal)>> as sourceView of
<_UIAlertControllerActionSheetRegularPresentationController:
0x12043f5a0>, even though it is not a kind of UIView.

Co-authored-by: Duy Tran Khanh <[email protected]>
This commit is contained in:
Duy Tran KhanhandDuy Tran Khanh authored and GitHub committed 2021-10-15 05:16:17 +07:00
1 parent b353a69421
commit db0074d1e5
24 files changed
+511 -175

No files matched your search

@@ -1,5 +1,6 @@
package net.kdt.pojavlaunch.uikit;
import java.net.UnknownHostException;
import net.kdt.pojavlaunch.PojavProfile;
import net.kdt.pojavlaunch.Tools;
import net.kdt.pojavlaunch.authenticator.microsoft.MicrosoftAuthTask;
@@ -26,12 +27,17 @@ public class AccountJNI {
switch (type) {
case TYPE_SELECTACC:
CURRENT_ACCOUNT = MinecraftAccount.load(data);
if (CURRENT_ACCOUNT.isMicrosoft) {
CURRENT_ACCOUNT = new MicrosoftAuthTask().run("true", CURRENT_ACCOUNT.msaRefreshToken);
} else if (CURRENT_ACCOUNT.accessToken.length() > 5) {
PojavProfile.updateTokens(data);
try {
if (CURRENT_ACCOUNT.isMicrosoft) {
CURRENT_ACCOUNT = new MicrosoftAuthTask().run("true", CURRENT_ACCOUNT.msaRefreshToken);
} else if (CURRENT_ACCOUNT.accessToken.length() > 5) {
PojavProfile.updateTokens(data);
}
CURRENT_ACCOUNT = MinecraftAccount.load(data);
} catch (UnknownHostException e) {
e.printStackTrace();
// ignore, since it's likely that the user is offline
}
CURRENT_ACCOUNT = MinecraftAccount.load(data);
break;
case TYPE_MICROSOFT:
@@ -112,23 +112,20 @@ public class UIKit {
CallbackBridge.mouseX = x;
CallbackBridge.mouseY = y;
}
CallbackBridge.mouseLastX = x;
CallbackBridge.mouseLastY = y;
break;
case ACTION_MOVE:
if (GLFW.mGLFWIsGrabbing) {
CallbackBridge.mouseX += x - CallbackBridge.mouseLastX;
CallbackBridge.mouseY += y - CallbackBridge.mouseLastY;
CallbackBridge.mouseLastX = x;
CallbackBridge.mouseLastY = y;
} else {
CallbackBridge.mouseX = x;
CallbackBridge.mouseY = y;
}
break;
}
CallbackBridge.mouseLastX = x;
CallbackBridge.mouseLastY = y;
CallbackBridge.sendCursorPos(CallbackBridge.mouseX, CallbackBridge.mouseY);
}