Skip to content

Commit d9bc590

Browse files
committed
add friendrequestpopup ids
1 parent 724aa01 commit d9bc590

File tree

1 file changed

+75
-0
lines changed

1 file changed

+75
-0
lines changed

src/FriendRequestPopup.cpp

Lines changed: 75 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,75 @@
1+
#include "IDCheck.hpp"
2+
#include <Geode/Geode.hpp>
3+
#include <Geode/modify/FriendRequestPopup.hpp>
4+
#include <Geode/utils/NodeIDs.hpp>
5+
6+
using namespace geode::prelude;
7+
using namespace geode::node_ids;
8+
9+
$register_ids(FriendRequestPopup) {
10+
m_mainLayer->setID("main-layer");
11+
12+
setIDs(
13+
m_mainLayer,
14+
0,
15+
"background",
16+
"main-menu",
17+
"title-label",
18+
"username-label",
19+
"loading-circle",
20+
"description-background",
21+
"description-area",
22+
"date-label"
23+
);
24+
25+
setIDs(
26+
m_buttonMenu,
27+
0,
28+
"close-button",
29+
"accept-button",
30+
"remove-button",
31+
"block-button"
32+
);
33+
34+
verifyIDSafe(m_buttonMenu, "main-menu");
35+
verifyIDSafe(m_circle, "loading-circle");
36+
verifyIDSafe(m_closeBtn, "close-button");
37+
38+
auto winSize = CCDirector::sharedDirector()->getWinSize();
39+
40+
auto bottomMenu = CCMenu::create();
41+
bottomMenu->setLayout(
42+
RowLayout::create()
43+
->setGap(39.f)
44+
->setAxisAlignment(AxisAlignment::Center)
45+
);
46+
bottomMenu->setID("bottom-menu");
47+
bottomMenu->setContentSize({335, 30});
48+
bottomMenu->setPosition(winSize / 2 + CCPoint {0, -73});
49+
bottomMenu->setZOrder(10);
50+
m_mainLayer->addChild(bottomMenu);
51+
52+
switchToMenu(m_buttonMenu->getChildByID("accept-button"), bottomMenu);
53+
switchToMenu(m_buttonMenu->getChildByID("remove-button"), bottomMenu);
54+
switchToMenu(m_buttonMenu->getChildByID("block-button"), bottomMenu);
55+
56+
bottomMenu->updateLayout();
57+
58+
handleTouchPriority(this);
59+
}
60+
61+
struct FriendRequestPopupIDs : Modify<FriendRequestPopupIDs, FriendRequestPopup> {
62+
static void onModify(auto& self) {
63+
if (!self.setHookPriority("FriendRequestPopup::init", GEODE_ID_PRIORITY)) {
64+
log::warn("Failed to set FriendRequestPopup::init hook priority, node IDs may not work properly");
65+
}
66+
}
67+
68+
bool init(GJFriendRequest* request) {
69+
if(!FriendRequestPopup::init(request)) return false;
70+
71+
NodeIDs::get()->provide(this);
72+
73+
return true;
74+
}
75+
};

0 commit comments

Comments
 (0)