Skip to content

Commit

Permalink
welcome page !
Browse files Browse the repository at this point in the history
  • Loading branch information
Constantin Clerc committed Dec 19, 2023
1 parent 4eaaad8 commit e315d28
Show file tree
Hide file tree
Showing 9 changed files with 127 additions and 15 deletions.
4 changes: 4 additions & 0 deletions Geranium.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
79AEFBBD2B2CBC6B0074EC34 /* ProgressBar.swift in Sources */ = {isa = PBXBuildFile; fileRef = 79AEFBBC2B2CBC6B0074EC34 /* ProgressBar.swift */; };
79BA958A2B30D91600380D83 /* RootHelperMan.swift in Sources */ = {isa = PBXBuildFile; fileRef = 79BA95892B30D91600380D83 /* RootHelperMan.swift */; };
79D359942B2C9D91004C0FCF /* LSApplicationProxy+AltList.m in Sources */ = {isa = PBXBuildFile; fileRef = 79D359932B2C9D91004C0FCF /* LSApplicationProxy+AltList.m */; };
79DF26992B31C90C005D81D2 /* WelcomeView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 79DF26982B31C90C005D81D2 /* WelcomeView.swift */; };
FAA456D52B265FEA00FC7287 /* GeraniumApp.swift in Sources */ = {isa = PBXBuildFile; fileRef = FAA456D42B265FEA00FC7287 /* GeraniumApp.swift */; };
FAA456D72B265FEA00FC7287 /* ContentView.swift in Sources */ = {isa = PBXBuildFile; fileRef = FAA456D62B265FEA00FC7287 /* ContentView.swift */; };
FAA456D92B265FEC00FC7287 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = FAA456D82B265FEC00FC7287 /* Assets.xcassets */; };
Expand Down Expand Up @@ -59,6 +60,7 @@
79BA95892B30D91600380D83 /* RootHelperMan.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = RootHelperMan.swift; sourceTree = "<group>"; };
79D359932B2C9D91004C0FCF /* LSApplicationProxy+AltList.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "LSApplicationProxy+AltList.m"; sourceTree = "<group>"; };
79D359952B2C9DAD004C0FCF /* LSApplicationProxy+AltList.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "LSApplicationProxy+AltList.h"; sourceTree = "<group>"; };
79DF26982B31C90C005D81D2 /* WelcomeView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = WelcomeView.swift; sourceTree = "<group>"; };
FAA456D12B265FEA00FC7287 /* Geranium.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = Geranium.app; sourceTree = BUILT_PRODUCTS_DIR; };
FAA456D42B265FEA00FC7287 /* GeraniumApp.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = GeraniumApp.swift; sourceTree = "<group>"; };
FAA456D62B265FEA00FC7287 /* ContentView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ContentView.swift; sourceTree = "<group>"; };
Expand Down Expand Up @@ -154,6 +156,7 @@
FAA457042B2660AC00FC7287 /* Geranium-Bringing-Header.h */,
FAA457052B2661AD00FC7287 /* Libs */,
FAA456D62B265FEA00FC7287 /* ContentView.swift */,
79DF26982B31C90C005D81D2 /* WelcomeView.swift */,
FAA457262B26667E00FC7287 /* HomeView.swift */,
FAA4572E2B2666E800FC7287 /* Cleaner */,
FAA4572B2B26669B00FC7287 /* The Supviser */,
Expand Down Expand Up @@ -390,6 +393,7 @@
FAA457292B26668900FC7287 /* DaemonView.swift in Sources */,
FAA457032B26608900FC7287 /* LocationSimulationView.swift in Sources */,
FAA457232B26654700FC7287 /* Addon.swift in Sources */,
79DF26992B31C90C005D81D2 /* WelcomeView.swift in Sources */,
FAA457322B2667CB00FC7287 /* SuperviseView.swift in Sources */,
79D359942B2C9D91004C0FCF /* LSApplicationProxy+AltList.m in Sources */,
792845532B2C67910021E1FD /* FileCleaner.swift in Sources */,
Expand Down
Binary file not shown.
2 changes: 1 addition & 1 deletion Geranium/Cleaner/CleanerView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,7 @@ struct CleanerView: View {
}
}
}
.navigationBarTitle("Cleaner")
.navigationTitle("Cleaner")
}
func performCleanup() {
cleanProcess(safari: safari, appCaches: appCaches, otaCaches: otaCaches, batteryUsageDat: batteryUsageDat) { progressHandler in
Expand Down
3 changes: 2 additions & 1 deletion Geranium/ContentView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,12 @@ struct ContentView: View {
@State private var isTabViewHidden = false
@Binding var tsBypass: Bool
@Binding var updBypass: Bool
@Binding var loggingAllowed: Bool
var body: some View {
TabView {
if !isTabViewHidden {
// TD : USERSPACE REBBOT IMPLEMENTATION
HomeView(tsBypass: $tsBypass, updBypass: $updBypass)
HomeView(tsBypass: $tsBypass, updBypass: $updBypass, loggingAllowed: $loggingAllowed)
.tabItem {
Label("Home", systemImage: "house.fill")
}
Expand Down
18 changes: 16 additions & 2 deletions Geranium/GeraniumApp.swift
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,14 @@ import SwiftUI
struct GeraniumApp: App {
@AppStorage("TSBypass") var tsBypass: Bool = false
@AppStorage("UPDBypass") var updBypass: Bool = false
@AppStorage("isLoggingAllowed") var loggingAllowed: Bool = true
@AppStorage("isFirstRun") var isFirstRun: Bool = true
@Environment(\.dismiss) var dismiss
var body: some Scene {
WindowGroup {
ContentView(tsBypass: $tsBypass, updBypass: $updBypass)
ContentView(tsBypass: $tsBypass, updBypass: $updBypass, loggingAllowed: $loggingAllowed)
.onAppear {
if checkSandbox() && !tsBypass{
if checkSandbox(), !tsBypass, !isFirstRun{
UIApplication.shared.alert(title:"Geranium wasn't installed with TrollStore", body:"Unable to create test file. The app cannot work without the correct entitlements. Please use TrollStore to install it.", withButton:true)
}
// thanks sourceloc again
Expand All @@ -34,6 +37,17 @@ struct GeraniumApp: App {
task.resume()
}
}
.sheet(isPresented: $isFirstRun) {
if #available(iOS 16.0, *) {
NavigationStack {
WelcomeView(loggingAllowed: $loggingAllowed, updBypass: $updBypass)
}
} else {
NavigationView {
WelcomeView(loggingAllowed: $loggingAllowed, updBypass: $updBypass)
}
}
}
}
}
}
18 changes: 18 additions & 0 deletions Geranium/HomeView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import SwiftUI
struct HomeView: View {
@Binding var tsBypass: Bool
@Binding var updBypass: Bool
@Binding var loggingAllowed: Bool
@Environment(\.colorScheme) var colorScheme
@State var isDebugSheetOn = false
@State var DebugStuff = false
Expand Down Expand Up @@ -66,6 +67,7 @@ struct HomeView: View {
LinkCell(imageLink: "https://cdn.discordapp.com/avatars/470637062870269952/67eb5d0a0501a96ab0a014ae89027e32.webp?size=160", url: "https://github.com/bomberfish", title: "BomberFish")
LinkCell(imageLink: "https://cdn.discordapp.com/avatars/396496265430695947/0904860dfb31d8b1f39f0e7dc4832b1e.webp?size=160", url: "https://github.com/donato-fiore", title: "fiore")
LinkCell(imageLink: "https://cdn.discordapp.com/avatars/412187004407775242/1df69ac879b9e5f98396553eeac80cec.webp?size=160", url: "https://github.com/sourcelocation", title: "sourcelocation")
LinkCell(imageLink: "https://avatars.githubusercontent.com/u/85764897?s=160&v=4", url: "https://github.com/haxi0", title: "haxi0")
}
}
// https://stackoverflow.com/a/75516471
Expand Down Expand Up @@ -98,6 +100,12 @@ struct HomeView: View {
}
if DebugStuff {
Text("RootHelper Path : \(RootHelper.whatsthePath())")
if UIDevice.current.userInterfaceIdiom == .pad {
Text("Is the user running an iPad on iPadOS 16 : yes")
}
else {
Text("Is the user running an iPad on iPadOS 16 : no")
}
}
}
Section(header:
Expand All @@ -113,6 +121,16 @@ struct HomeView: View {
Text("Bypass App Update Pop Up")
}
}
Section(header:
HStack {
Image(systemName: "cloud")
Text("Logging Settings")
}, footer: Text("We collect some logs that are uploaded to our server for fixing bugs and adressing crash logs. The logs never contains any of your personal information, just your device type and the crash log itself. We also collect measurement information to see what was the most used in the app. You can choose if you want to prevent ANY data from being sent to our server.")
) {
Toggle(isOn: $loggingAllowed) {
Text("Enable logging")
}
}
}
.navigationTitle("Settings")
}
Expand Down
12 changes: 5 additions & 7 deletions Geranium/Libs/Addon.swift
Original file line number Diff line number Diff line change
Expand Up @@ -243,15 +243,13 @@ struct LinkCell: View {
var body: some View {
HStack(alignment: .center) {
Group {

if let imageURL = URL(string: imageLink) {
AsyncImageView(url: imageURL)
.frame(width: 30, height: 30)
.cornerRadius(25)
}
if let imageURL = URL(string: imageLink) {
AsyncImageView(url: imageURL)
.frame(width: 30, height: 30)
.cornerRadius(25)
}
}
.aspectRatio(contentMode: .fit)

Button(title) {
UIApplication.shared.open(URL(string: url)!)
}
Expand Down
2 changes: 1 addition & 1 deletion Geranium/The Supviser/SuperviseView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ struct SuperviseView: View {
.background(Color.accentColor)
.cornerRadius(8)
.foregroundColor(.black)
.navigationBarTitle("The Superviser")
.navigationTitle("The Superviser")
}
}
}
Expand Down
83 changes: 80 additions & 3 deletions Geranium/WelcomeView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,92 @@
//
// Created by cclerc on 19.12.23.
//
// credit to haxi0

import SwiftUI

struct WelcomeView: View {
@Environment(\.dismiss) var dismiss
@Binding var loggingAllowed: Bool
@Binding var updBypass: Bool
var body: some View {
Text(/*@START_MENU_TOKEN@*/"Hello, World!"/*@END_MENU_TOKEN@*/)
List {
Section(header: Text("Setup")) {
Text("Welcome to Geranium, a toolbox for TrollStore that allows you to disable some daemons, simulate your location, clean your phone's storage and other. We need to configure a few things before you can use the app. This will only take a minute. You will still be able to change the settings later.")
}

Section(header: Text("Log Collection")) {
Text("We collect some logs that are uploaded to our server for fixing bugs and adressing crash logs. The logs never contains any of your personal information, just your device type and the crash log itself. We also collect measurement information to see what was the most used in the app. You can choose if you want to prevent ANY data from being sent to our server.")
Toggle(isOn: $loggingAllowed) {
Text("Enable log collection")
}
}

Section(header: Text("Update Warnings")) {
Text("When a new update is published, you will receive a pop-up on app launch asking you if you want to update. You can prevent this from hapenning")
Toggle(isOn: $updBypass) {
Text("Disable update pop-up")
}
}
if !updBypass {
Section(header: Text("WARNING")) {
Text("If you want to enable auto-update, you need to turn on Magnifier URL Scheme in TrollStore.")
Text("1. Open TrollStore")
Text("2. Go to Settings")
Text("3. Enable URL Scheme")
}
}
}
.navigationTitle("Welcome!")
.environment(\.defaultMinListRowHeight, 50)
.interactiveDismissDisabled()
Button("Dismiss") {
close()
}
.buttonStyle(DangerButtonStyle())
.padding()
}

func close() {
dismiss()
}
}

public struct CustomButtonStyle: ButtonStyle {
public func makeBody(configuration: Self.Configuration) -> some View {
configuration.label
.font(.body.weight(.medium))
.padding(.vertical, 12)
.foregroundColor(.white)
.frame(maxWidth: .infinity)
.background(RoundedRectangle(cornerRadius: 14.0, style: .continuous)
.fill(Color.accentColor))
.opacity(configuration.isPressed ? 0.4 : 1.0)
}
}

#Preview {
WelcomeView()
public struct LinkButtonStyle: ButtonStyle {
public func makeBody(configuration: Self.Configuration) -> some View {
configuration.label
.font(.body.weight(.medium))
.padding(.vertical, 12)
.foregroundColor(.blue)
.frame(maxWidth: .infinity)
.background(RoundedRectangle(cornerRadius: 12.0, style: .continuous)
.fill(Color.blue.opacity(0.1)))
.opacity(configuration.isPressed ? 0.4 : 1.0)
}
}

public struct DangerButtonStyle: ButtonStyle {
public func makeBody(configuration: Self.Configuration) -> some View {
configuration.label
.font(.headline.weight(.bold))
.padding(.vertical, 12)
.foregroundColor(.red)
.frame(maxWidth: .infinity)
.background(RoundedRectangle(cornerRadius: 12.0, style: .continuous)
.fill(Color.red.opacity(0.1)))
.opacity(configuration.isPressed ? 0.4 : 1.0)
}
}

0 comments on commit e315d28

Please sign in to comment.