-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
ok i am NOW gonna make it a library!
- Loading branch information
1 parent
e83a158
commit 1a16c6c
Showing
9 changed files
with
114 additions
and
79 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
#pragma once | ||
|
||
void showAlert(const char *title, const char *message, const char *Btn); | ||
void iOSVersion(); | ||
void CShowAlert(const char *title, const char *message, const char *Btn); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,92 @@ | ||
#import <UIKit/UIKit.h> | ||
#include <functional> | ||
#include "main.hpp" | ||
|
||
/* | ||
shows a system level alert. | ||
usage: | ||
showAlert("Insert title here", "insert message here...", "insert button here."); | ||
you cannot create a callback with this, use the showAlertWithCallback() function for callbacks. | ||
*/ | ||
void showAlert(const char *title, const char *message, const char *Btn) { | ||
NSString *titleString = [NSString stringWithUTF8String:title]; | ||
NSString *messageString = [NSString stringWithUTF8String:message]; | ||
NSString *btnString = [NSString stringWithUTF8String:Btn]; | ||
|
||
UIAlertController *alertController = [UIAlertController alertControllerWithTitle:titleString | ||
message:messageString | ||
preferredStyle:UIAlertControllerStyleAlert]; | ||
|
||
UIAlertAction *okAction = [UIAlertAction actionWithTitle:btnString | ||
style:UIAlertActionStyleDefault | ||
handler:nil]; | ||
|
||
[alertController addAction:okAction]; | ||
|
||
UIViewController *rootViewController = [[[[UIApplication sharedApplication] delegate] window] rootViewController]; | ||
|
||
[rootViewController presentViewController:alertController animated:YES completion:nil]; | ||
} | ||
|
||
/* | ||
ShowAlert but with a function callback. | ||
usage: | ||
CShowAlert("Title", "Message", "go away", MyCoolFunction()); | ||
- this function allows you to add 2 buttons!!! | ||
usage: (again) | ||
CShowAlert("Title", "Message", "go away", nullptr, "go away again"); | ||
this should give you an alert with 2 buttons and no callback at al!!!!; | ||
*/ | ||
|
||
void CShowAlert(const char *title, const char *message, const char *Btn, std::function<void()> callback = nullptr, const char *Btn2 = nullptr, std::function<void()> callback2 = nullptr) { | ||
NSString *titleString = [NSString stringWithUTF8String:title]; | ||
NSString *messageString = [NSString stringWithUTF8String:message]; | ||
NSString *btnString = [NSString stringWithUTF8String:Btn]; | ||
|
||
UIAlertController *alertController = [UIAlertController alertControllerWithTitle:titleString | ||
message:messageString | ||
preferredStyle:UIAlertControllerStyleAlert]; | ||
|
||
UIAlertAction *ButtonAction = [UIAlertAction actionWithTitle:btnString | ||
style:UIAlertActionStyleDefault | ||
handler:^(UIAlertAction *action) { | ||
if (callback != nullptr) { | ||
callback(); | ||
} | ||
}]; | ||
|
||
|
||
[alertController addAction:ButtonAction]; | ||
|
||
if (Btn2 != nullptr) { | ||
NSString *btnString2 = [NSString stringWithUTF8String:Btn2]; | ||
UIAlertAction *ButtonAction2 = [UIAlertAction ActionWithTitle:btnString2 | ||
style:UIAlertActionStyleDefault | ||
handler:^(UIAlertAction *action) { | ||
if (callback2 != nullptr) { | ||
callback2(); | ||
} | ||
}]; | ||
[alertController addAction:ButtonAction2]; | ||
} | ||
|
||
UIViewController *rootViewController = [[[[UIApplication sharedApplication] delegate] window] rootViewController]; | ||
|
||
[rootViewController presentViewController:alertController animated:YES completion:nil]; | ||
} | ||
|
||
/* self explanatory, get the ios version. | ||
usage: iOSVersion(); | ||
you can also do something like this | ||
if (iOSVersion == "17.4") { | ||
showAlert("iOS 17.4", "You are on iOS 17.4", "go away"); | ||
} else { | ||
showAlert("Update Required", "Update to iOS 17.4", "shut up"); | ||
} | ||
*/ | ||
void iOSVersion() { | ||
UIDevice *device = [UIDevice currentDevice]; | ||
NSString *iOSVersion = [device systemVersion]; | ||
return iOSVersion; | ||
} |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
#include <Geode/Geode.hpp> | ||
#include <Geode/Modify/MenuLayer.hpp> | ||
#include "iGeodeLib.hpp" | ||
|
||
using namespace geode::prelude; | ||
|
||
class $modify(MenuLayer) { | ||
void onMoreGames(CCObject*) { | ||
CShowAlert("Hello", "hi", "go away", nullptr, "hi"); | ||
} | ||
}; |