Skip to content
This repository has been archived by the owner on Dec 21, 2023. It is now read-only.

Commit

Permalink
last-minute UI changes
Browse files Browse the repository at this point in the history
  • Loading branch information
BomberFish committed Jul 12, 2023
1 parent dc196b0 commit d0c3505
Show file tree
Hide file tree
Showing 7 changed files with 132 additions and 43 deletions.
2 changes: 1 addition & 1 deletion AppCommander.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -194,7 +194,7 @@
D6B79B0C29F44DE200E14922 /* ISIconCacheServiceProtocol-Protocol.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "ISIconCacheServiceProtocol-Protocol.h"; sourceTree = "<group>"; };
D6B79B0D29F44DF100E14922 /* IconServices.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = IconServices.h; sourceTree = "<group>"; };
D6D22B6529C64D180095645B /* SettingsView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SettingsView.swift; sourceTree = "<group>"; };
D6D22B6C29C64DC20095645B /* PrivacyPolicyView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PrivacyPolicyView.swift; sourceTree = "<group>"; };
D6D22B6C29C64DC20095645B /* PrivacyPolicyView.swift */ = {isa = PBXFileReference; explicitFileType = sourcecode.swift; path = PrivacyPolicyView.swift; sourceTree = "<group>"; };
D6D22B6E29C65D6B0095645B /* Analytics.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Analytics.swift; sourceTree = "<group>"; };
D6D55A6629D25CC600DD6C4A /* BackupView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = BackupView.swift; sourceTree = "<group>"; };
D6D55A7B29D5EE0800DD6C4A /* ReplaceTestingView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ReplaceTestingView.swift; sourceTree = "<group>"; };
Expand Down
48 changes: 26 additions & 22 deletions AppCommander/Managers/CommonFunctions.swift
Original file line number Diff line number Diff line change
Expand Up @@ -102,46 +102,50 @@ func delDirectoryContents(path: String, progress: ((Double,String)) -> ()) throw
func respring() {
UIImpactFeedbackGenerator(style: .soft).impactOccurred()

let view = UIView(frame: UIScreen.main.bounds)
view.backgroundColor = .black
view.alpha = 0

for window in UIApplication.shared.connectedScenes.map({ $0 as? UIWindowScene }).compactMap({ $0 }).flatMap({ $0.windows.map { $0 } }) {
window.addSubview(view)
UIView.animate(withDuration: 0.5, delay: 0, animations: {
view.alpha = 1
})
let animator = UIViewPropertyAnimator(duration: 0.5, dampingRatio: 1) {
let windows: [UIWindow] = UIApplication.shared.connectedScenes
.compactMap { $0 as? UIWindowScene }
.flatMap(\.windows)
for window in windows {
window.alpha = 0
window.transform = CGAffineTransform(scaleX: 0.9, y: 0.9)
}
}

DispatchQueue.main.asyncAfter(deadline: .now() + 0.6) {
animator.addCompletion { _ in
MacDirtyCow.restartFrontboard()
sleep(2) // give the springboard some time to restart before exiting
exit(0)
}

animator.startAnimation()
}

func reboot() {
UIImpactFeedbackGenerator(style: .soft).impactOccurred()

let view = UIView(frame: UIScreen.main.bounds)
view.backgroundColor = .black
view.alpha = 0

for window in UIApplication.shared.connectedScenes.map({ $0 as? UIWindowScene }).compactMap({ $0 }).flatMap({ $0.windows.map { $0 } }) {
window.addSubview(view)
UIView.animate(withDuration: 0.5, delay: 0, animations: {
view.alpha = 1
})
let animator = UIViewPropertyAnimator(duration: 0.5, dampingRatio: 1) {
let windows: [UIWindow] = UIApplication.shared.connectedScenes
.compactMap { $0 as? UIWindowScene }
.flatMap(\.windows)
for window in windows {
window.alpha = 0
window.transform = CGAffineTransform(scaleX: 0.9, y: 0.9)
}
}

DispatchQueue.main.asyncAfter(deadline: .now() + 0.6) {
animator.addCompletion { _ in
trigger_memmove_oob_copy()
}

animator.startAnimation()
}

var connection: NSXPCConnection?

// 💀
// name is 💀
func remvoeIconCache() {
print("Removing icon cache", loglevel: .info)
if connection == nil {
Expand Down
2 changes: 1 addition & 1 deletion AppCommander/Models/MultiSelectPickerView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ struct MultiSelectPickerView: View {
}
}
//// .background(GradientView())
.listRowBackground(Color.clear)
// .listRowBackground(Color.clear)
//.listStyle(.sidebar)
}
}
Expand Down
5 changes: 3 additions & 2 deletions AppCommander/Views/Settings/AppIconView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -82,8 +82,8 @@ struct IconTile: View {
selected = (UIApplication.shared.alternateIconName == icon.iconName)
}
.padding()
.padding([.top], -2)
.frame(width: 180, height: 165)
.padding([.top], -10)
.frame(width: 200, height: 200)
.cornerRadius(16)
.background(.ultraThinMaterial)
}
Expand All @@ -106,6 +106,7 @@ struct AppIconView: View {
IconTile(icon: icon, selectedicon: currentIcon ?? "AppIcon")
}
}
.padding([.horizontal], 5)
}
//.background(.thinMaterial)
.navigationTitle("Alternate Icons")
Expand Down
102 changes: 89 additions & 13 deletions AppCommander/Views/Settings/PrivacyPolicyView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -7,33 +7,109 @@

import SwiftUI
import WebKit

// MARK: - Copied this from the first search result. Am I going to change it? No!
import Combine

struct WebView: UIViewRepresentable {
var url: URL
typealias UIViewType = WKWebView

let webView: WKWebView

func makeUIView(context: Context) -> WKWebView {
return WKWebView()
return webView
}

func updateUIView(_ uiView: WKWebView, context: Context) { }
}

class WebViewModel: ObservableObject {
let webView: WKWebView

private let navigationDelegate: WebViewNavigationDelegate

init() {
let configuration = WKWebViewConfiguration()
configuration.websiteDataStore = .nonPersistent()
webView = WKWebView(frame: .zero, configuration: configuration)
navigationDelegate = WebViewNavigationDelegate()

webView.navigationDelegate = navigationDelegate
setupBindings()
}

@Published var canGoBack: Bool = false
@Published var canGoForward: Bool = false
@Published var isLoading: Bool = false

private func setupBindings() {
webView.publisher(for: \.canGoBack)
.assign(to: &$canGoBack)

webView.publisher(for: \.canGoForward)
.assign(to: &$canGoForward)

webView.publisher(for: \.isLoading)
.assign(to: &$isLoading)

}

func loadURL(_ urlString: String) {
guard let url = URL(string: urlString) else {
return
}

webView.load(URLRequest(url: url))
}

func goForward() {
webView.goForward()
}

func updateUIView(_ webView: WKWebView, context: Context) {
let request = URLRequest(url: url)
webView.load(request)
func goBack() {
webView.goBack()
}
}

class WebViewNavigationDelegate: NSObject, WKNavigationDelegate {
func webView(_ webView: WKWebView, decidePolicyFor navigationAction: WKNavigationAction, decisionHandler: @escaping (WKNavigationActionPolicy) -> Void) {
// TODO
decisionHandler(.allow)
}

func webView(_ webView: WKWebView, decidePolicyFor navigationResponse: WKNavigationResponse, decisionHandler: @escaping (WKNavigationResponsePolicy) -> Void) {
// TODO
decisionHandler(.allow)
}
}

struct PrivacyPolicyView: View {
@StateObject var model = WebViewModel()

@State var bgColor: Color = Color(uiColor: UIColor.systemBackground)

var body: some View {
ZStack {
ProgressView()
.scaleEffect(CGSize(size: 1.5))
WebView(url: URL(string: "https://telemetrydeck.com/privacy/")!)
.deferredRendering(for: 0.4)
Rectangle()
.background(bgColor)
.ignoresSafeArea(.all)
WebView(webView: model.webView)
//.deferredRendering(for: 0.4)
.onAppear {
model.loadURL("https://telemetrydeck.com/privacy/")
}
.cornerRadius(8)
ProgressView()
//.scaleEffect(CGSize(size: 1.5))
.foregroundColor(.black)
.colorMultiply(.black)
.tint(.black)
.opacity(model.isLoading ? 1 : 0)
}
.padding()
.navigationTitle("Privacy Policy")
//.padding()
.navigationBarTitleDisplayMode(.inline)
.onAppear {
bgColor = .white
}
.animation(.easeInOut(duration: 0.25), value: bgColor)
}
}

Expand Down
7 changes: 6 additions & 1 deletion AppCommander/Views/Settings/ViewSettings.swift
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,12 @@ struct ViewSettings: View {
.cornerRadius(16)
.clipShape(RoundedRectangle(cornerSize: CGSize(width: 16, height: 16)))
}
.listRowBackground(GradientView())
.listRowBackground(
GradientView()
.cornerRadius(8)
.ignoresSafeArea(.all)
.frame(width: .infinity, height: .infinity)
)

Section {
RadioButtonGroup(items: options, selectedId: String(options[selected])) { tempselected in
Expand Down
9 changes: 6 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,11 +35,14 @@ You can install through AltStore, Sideloadly, or Xcode.

TrollStore is not officially supported, and using enterprise signing apps such as Scarlet or ESign will not allow you to import backups.

## Suggestions and support
You can create an issue on this repo, or join the [Cowabunga Discord server](https://discord.gg/Cowabunga) where I or someone else can help you in the #appcommander channel.

## Analytics
AppCommander uses [TelemetryDeck](https://telemetrydeck.com) to collect anonymized analytics data. You can disable any data collection in the Settings tab, and view TelemetryKit's [privacy policy](https://telemetrydeck.com/privacy/).

## Building
Just build like a normal Xcode project. Sign using your own team and bundle identifier. You can also build the IPA file by running `make`.

## Credits
Credits can be viewed in the app by going to `Settings > About AppCommander`.

## Suggestions and support
You can create an issue on this repo, or join the [Cowabunga Discord server](https://discord.gg/MN8JgqSAqT) where I or someone else can help you in the #appcommander channel.

0 comments on commit d0c3505

Please sign in to comment.