-
Notifications
You must be signed in to change notification settings - Fork 29
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
16 changed files
with
925 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,7 @@ | ||
{ | ||
"images" : [ | ||
{ | ||
"filename" : "geranium.png", | ||
"idiom" : "universal", | ||
"platform" : "ios", | ||
"size" : "1024x1024" | ||
|
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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,18 @@ | ||
// | ||
// CleanerView.swift | ||
// Geranium | ||
// | ||
// Created by Constantin Clerc on 10/12/2023. | ||
// | ||
|
||
import SwiftUI | ||
|
||
struct CleanerView: View { | ||
var body: some View { | ||
Text(/*@START_MENU_TOKEN@*/"Hello, World!"/*@END_MENU_TOKEN@*/) | ||
} | ||
} | ||
|
||
#Preview { | ||
CleanerView() | ||
} |
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,18 @@ | ||
// | ||
// DaemonView.swift | ||
// Geranium | ||
// | ||
// Created by Constantin Clerc on 10/12/2023. | ||
// | ||
|
||
import SwiftUI | ||
|
||
struct DaemonView: View { | ||
var body: some View { | ||
Text(/*@START_MENU_TOKEN@*/"Hello, World!"/*@END_MENU_TOKEN@*/) | ||
} | ||
} | ||
|
||
#Preview { | ||
DaemonView() | ||
} |
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,12 @@ | ||
// | ||
// Geranium-Bringing-Header.h | ||
// Geranium | ||
// | ||
// Created by Constantin Clerc on 10/12/2023. | ||
// | ||
|
||
#ifndef Geranium_Bringing_Header_h | ||
#define Geranium_Bringing_Header_h | ||
|
||
|
||
#endif /* Geranium_Bringing_Header_h */ |
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,18 @@ | ||
// | ||
// HomeView.swift | ||
// Geranium | ||
// | ||
// Created by Constantin Clerc on 10/12/2023. | ||
// | ||
|
||
import SwiftUI | ||
|
||
struct HomeView: View { | ||
var body: some View { | ||
Text(/*@START_MENU_TOKEN@*/"Hello, World!"/*@END_MENU_TOKEN@*/) | ||
} | ||
} | ||
|
||
#Preview { | ||
HomeView() | ||
} |
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,194 @@ | ||
// | ||
// Addon.swift | ||
// TrollBox | ||
// | ||
// Created by Constantin Clerc on 17/12/2022. | ||
// | ||
|
||
import Foundation | ||
import SwiftUI | ||
import Combine | ||
import UIKit | ||
|
||
struct MaterialView: UIViewRepresentable { | ||
let material: UIBlurEffect.Style | ||
|
||
init(_ material: UIBlurEffect.Style) { | ||
self.material = material | ||
} | ||
|
||
func makeUIView(context: Context) -> UIVisualEffectView { | ||
UIVisualEffectView(effect: UIBlurEffect(style: material)) | ||
} | ||
|
||
func updateUIView(_ uiView: UIVisualEffectView, context: Context) { | ||
uiView.effect = UIBlurEffect(style: material) | ||
} | ||
} | ||
|
||
fileprivate var cancellables = [String : AnyCancellable] () | ||
|
||
public extension Published { | ||
init(wrappedValue defaultValue: Value, key: String) { | ||
let value = UserDefaults.standard.object(forKey: key) as? Value ?? defaultValue | ||
self.init(initialValue: value) | ||
cancellables[key] = projectedValue.sink { val in | ||
UserDefaults.standard.set(val, forKey: key) | ||
} | ||
} | ||
} | ||
|
||
extension StringProtocol { | ||
subscript(offset: Int) -> Character { self[index(startIndex, offsetBy: offset)] } | ||
subscript(range: Range<Int>) -> SubSequence { | ||
let startIndex = index(self.startIndex, offsetBy: range.lowerBound) | ||
return self[startIndex..<index(startIndex, offsetBy: range.count)] | ||
} | ||
subscript(range: ClosedRange<Int>) -> SubSequence { | ||
let startIndex = index(self.startIndex, offsetBy: range.lowerBound) | ||
return self[startIndex..<index(startIndex, offsetBy: range.count)] | ||
} | ||
subscript(range: PartialRangeFrom<Int>) -> SubSequence { self[index(startIndex, offsetBy: range.lowerBound)...] } | ||
subscript(range: PartialRangeThrough<Int>) -> SubSequence { self[...index(startIndex, offsetBy: range.upperBound)] } | ||
subscript(range: PartialRangeUpTo<Int>) -> SubSequence { self[..<index(startIndex, offsetBy: range.upperBound)] } | ||
} | ||
|
||
extension View { | ||
/// Sets the text color for a navigation bar title. | ||
/// - Parameter color: Color the title should be | ||
/// | ||
/// Supports both regular and large titles. | ||
@available(iOS 14, *) | ||
func navigationBarTitleTextColor(_ color: Color) -> some View { | ||
let uiColor = UIColor(color) | ||
|
||
// Set appearance for both normal and large sizes. | ||
UINavigationBar.appearance().titleTextAttributes = [.foregroundColor: uiColor ] | ||
UINavigationBar.appearance().largeTitleTextAttributes = [.foregroundColor: uiColor ] | ||
|
||
return self | ||
} | ||
} | ||
|
||
extension UIApplication { | ||
func respring() { | ||
let app = self | ||
// Credit to Amy While for this respring bug | ||
guard let window = app.windows.first else { return } | ||
while true { | ||
window.snapshotView(afterScreenUpdates: false) | ||
} | ||
} | ||
} | ||
|
||
|
||
extension UIColor { | ||
var rgba: (red: CGFloat, green: CGFloat, blue: CGFloat, alpha: CGFloat) { | ||
var red: CGFloat = 0 | ||
var green: CGFloat = 0 | ||
var blue: CGFloat = 0 | ||
var alpha: CGFloat = 0 | ||
getRed(&red, green: &green, blue: &blue, alpha: &alpha) | ||
|
||
return (red, green, blue, alpha) | ||
} | ||
} | ||
|
||
extension Color { | ||
init(uiColor14: UIColor) { | ||
self.init(red: Double(uiColor14.rgba.red), | ||
green: Double(uiColor14.rgba.green), | ||
blue: Double(uiColor14.rgba.blue), | ||
opacity: Double(uiColor14.rgba.alpha)) | ||
} | ||
} | ||
|
||
var currentUIAlertController: UIAlertController? | ||
|
||
extension UIApplication { | ||
func dismissAlert(animated: Bool) { | ||
DispatchQueue.main.async { | ||
currentUIAlertController?.dismiss(animated: animated) | ||
} | ||
} | ||
func alert(title: String = "Error", body: String, animated: Bool = true, withButton: Bool = true) { | ||
DispatchQueue.main.async { | ||
currentUIAlertController = UIAlertController(title: title, message: body, preferredStyle: .alert) | ||
if withButton { currentUIAlertController?.addAction(.init(title: "OK", style: .cancel)) } | ||
self.present(alert: currentUIAlertController!) | ||
} | ||
} | ||
func confirmAlert(title: String = "Error", body: String, onOK: @escaping () -> (), noCancel: Bool) { | ||
DispatchQueue.main.async { | ||
currentUIAlertController = UIAlertController(title: title, message: body, preferredStyle: .alert) | ||
if !noCancel { | ||
currentUIAlertController?.addAction(.init(title: "Cancel", style: .cancel)) | ||
} | ||
currentUIAlertController?.addAction(.init(title: "Yes", style: noCancel ? .cancel : .default, handler: { _ in | ||
onOK() | ||
})) | ||
self.present(alert: currentUIAlertController!) | ||
} | ||
} | ||
|
||
func TextFieldAlert(title: String, textFieldPlaceHolder: String, completion: @escaping (String?) -> Void) { | ||
let alertController = UIAlertController(title: title, message: nil, preferredStyle: .alert) | ||
alertController.addTextField { (textField) in | ||
textField.placeholder = textFieldPlaceHolder | ||
} | ||
let okAction = UIAlertAction(title: "OK", style: .default) { (action) in | ||
if let text = alertController.textFields?.first?.text { | ||
completion(text) | ||
} else { | ||
completion(nil) | ||
} | ||
} | ||
let cancelAction = UIAlertAction(title: "Cancel", style: .cancel, handler: nil) | ||
alertController.addAction(okAction) | ||
alertController.addAction(cancelAction) | ||
present(alert: alertController) | ||
} | ||
|
||
func change(title: String = "Error", body: String) { | ||
DispatchQueue.main.async { | ||
currentUIAlertController?.title = title | ||
currentUIAlertController?.message = body | ||
} | ||
} | ||
|
||
func present(alert: UIAlertController) { | ||
if var topController = self.windows[0].rootViewController { | ||
while let presentedViewController = topController.presentedViewController { | ||
topController = presentedViewController | ||
} | ||
|
||
topController.present(alert, animated: true) | ||
// topController should now be your topmost view controller | ||
} | ||
} | ||
} | ||
|
||
func checkSandbox() -> Bool { | ||
let fileManager = FileManager.default | ||
fileManager.createFile(atPath: "/var/mobile/tboxtemp", contents: nil) | ||
if fileManager.fileExists(atPath: "/var/mobile/tboxtemp") { | ||
do { | ||
try fileManager.removeItem(atPath: "/var/mobile/tboxtemp") | ||
} catch { | ||
print("Failed to remove sandbox check file") | ||
} | ||
return false | ||
} | ||
|
||
return true | ||
} | ||
|
||
func impactVibrate() { | ||
let impact = UIImpactFeedbackGenerator(style: .medium) | ||
impact.impactOccurred() | ||
} | ||
|
||
func miniimpactVibrate() { | ||
let impact = UIImpactFeedbackGenerator(style: .light) | ||
impact.impactOccurred() | ||
} |
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,61 @@ | ||
#ifndef _REMOTE_LOG_H_ | ||
#define _REMOTE_LOG_H_ | ||
|
||
#import <netinet/in.h> | ||
#import <sys/socket.h> | ||
#import <unistd.h> | ||
#import <arpa/inet.h> | ||
|
||
// change this to match your destination (server) IP address | ||
#define RLOG_IP_ADDRESS "192.168.0.24" | ||
#define RLOG_PORT 11909 | ||
|
||
__attribute__((unused)) static void RLogv(NSString* format, va_list args) | ||
{ | ||
#if DEBUG | ||
NSString* str = [[NSString alloc] initWithFormat:format arguments:args]; | ||
|
||
int sd = socket(PF_INET, SOCK_DGRAM, IPPROTO_UDP); | ||
if (sd <= 0) | ||
{ | ||
NSLog(@"[RemoteLog] Error: Could not open socket"); | ||
return; | ||
} | ||
|
||
int broadcastEnable = 1; | ||
int ret = setsockopt(sd, SOL_SOCKET, SO_BROADCAST, &broadcastEnable, sizeof(broadcastEnable)); | ||
if (ret) | ||
{ | ||
NSLog(@"[RemoteLog] Error: Could not open set socket to broadcast mode"); | ||
close(sd); | ||
return; | ||
} | ||
|
||
struct sockaddr_in broadcastAddr; | ||
memset(&broadcastAddr, 0, sizeof broadcastAddr); | ||
broadcastAddr.sin_family = AF_INET; | ||
inet_pton(AF_INET, RLOG_IP_ADDRESS, &broadcastAddr.sin_addr); | ||
broadcastAddr.sin_port = htons(RLOG_PORT); | ||
|
||
char* request = (char*)[str UTF8String]; | ||
ret = sendto(sd, request, strlen(request), 0, (struct sockaddr*)&broadcastAddr, sizeof broadcastAddr); | ||
if (ret < 0) | ||
{ | ||
NSLog(@"[RemoteLog] Error: Could not send broadcast"); | ||
close(sd); | ||
return; | ||
} | ||
close(sd); | ||
#endif | ||
} | ||
|
||
__attribute__((unused)) static void RLog(NSString* format, ...) | ||
{ | ||
#if DEBUG | ||
va_list args; | ||
va_start(args, format); | ||
RLogv(format, args); | ||
va_end(args); | ||
#endif | ||
} | ||
#endif |
Oops, something went wrong.