Compare commits
3 Commits
377b5f5c85
...
b9e359ba83
Author | SHA1 | Date |
---|---|---|
Shadowfacts | b9e359ba83 | |
Shadowfacts | edb86fc503 | |
Shadowfacts | 49f58cf955 |
|
@ -7,3 +7,9 @@
|
|||
[submodule "Gifu"]
|
||||
path = Gifu
|
||||
url = git://github.com/kaishin/Gifu.git
|
||||
[submodule "Embassy"]
|
||||
path = Embassy
|
||||
url = https://github.com/envoy/Embassy.git
|
||||
[submodule "Ambassador"]
|
||||
path = Ambassador
|
||||
url = https://github.com/envoy/Ambassador.git
|
||||
|
|
|
@ -0,0 +1 @@
|
|||
Subproject commit 4fe264af51e0dd7228486c604750909e368241a7
|
Binary file not shown.
|
@ -0,0 +1 @@
|
|||
Subproject commit 189436100c00efbf5fb2653fe7972a9371db0a91
|
|
@ -114,6 +114,9 @@
|
|||
D64F80E2215875CC00BEF393 /* XCBActionType.swift in Sources */ = {isa = PBXBuildFile; fileRef = D64F80E1215875CC00BEF393 /* XCBActionType.swift */; };
|
||||
D6538945214D6D7500E3CEFC /* TableViewSwipeActionProvider.swift in Sources */ = {isa = PBXBuildFile; fileRef = D6538944214D6D7500E3CEFC /* TableViewSwipeActionProvider.swift */; };
|
||||
D65A37F321472F300087646E /* SwiftSoup.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = D6BED16E212663DA00F02DA0 /* SwiftSoup.framework */; };
|
||||
D65F613423AEAB6600F3CFD3 /* OnboardingTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = D65F613323AEAB6600F3CFD3 /* OnboardingTests.swift */; };
|
||||
D65F613623AFD65900F3CFD3 /* Ambassador.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = D65F613523AFD65900F3CFD3 /* Ambassador.framework */; };
|
||||
D65F613823AFD65D00F3CFD3 /* Embassy.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = D65F613723AFD65D00F3CFD3 /* Embassy.framework */; };
|
||||
D663625D2135C74800C9CBA2 /* ConversationMainStatusTableViewCell.xib in Resources */ = {isa = PBXBuildFile; fileRef = D663625C2135C74800C9CBA2 /* ConversationMainStatusTableViewCell.xib */; };
|
||||
D663625F2135C75500C9CBA2 /* ConversationMainStatusTableViewCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = D663625E2135C75500C9CBA2 /* ConversationMainStatusTableViewCell.swift */; };
|
||||
D663626221360B1900C9CBA2 /* Preferences.swift in Sources */ = {isa = PBXBuildFile; fileRef = D663626121360B1900C9CBA2 /* Preferences.swift */; };
|
||||
|
@ -391,6 +394,11 @@
|
|||
D64D0AB02128D9AE005A6F37 /* OnboardingViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = OnboardingViewController.swift; sourceTree = "<group>"; };
|
||||
D64F80E1215875CC00BEF393 /* XCBActionType.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = XCBActionType.swift; sourceTree = "<group>"; };
|
||||
D6538944214D6D7500E3CEFC /* TableViewSwipeActionProvider.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TableViewSwipeActionProvider.swift; sourceTree = "<group>"; };
|
||||
D65F612D23AE990C00F3CFD3 /* Embassy.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; path = Embassy.framework; sourceTree = BUILT_PRODUCTS_DIR; };
|
||||
D65F613023AE99E000F3CFD3 /* Ambassador.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; path = Ambassador.framework; sourceTree = BUILT_PRODUCTS_DIR; };
|
||||
D65F613323AEAB6600F3CFD3 /* OnboardingTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = OnboardingTests.swift; sourceTree = "<group>"; };
|
||||
D65F613523AFD65900F3CFD3 /* Ambassador.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; path = Ambassador.framework; sourceTree = BUILT_PRODUCTS_DIR; };
|
||||
D65F613723AFD65D00F3CFD3 /* Embassy.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; path = Embassy.framework; sourceTree = BUILT_PRODUCTS_DIR; };
|
||||
D663625C2135C74800C9CBA2 /* ConversationMainStatusTableViewCell.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; path = ConversationMainStatusTableViewCell.xib; sourceTree = "<group>"; };
|
||||
D663625E2135C75500C9CBA2 /* ConversationMainStatusTableViewCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ConversationMainStatusTableViewCell.swift; sourceTree = "<group>"; };
|
||||
D663626121360B1900C9CBA2 /* Preferences.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Preferences.swift; sourceTree = "<group>"; };
|
||||
|
@ -501,6 +509,7 @@
|
|||
D6F1F84C2193B56E00F5FE67 /* Cache.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Cache.swift; sourceTree = "<group>"; };
|
||||
D6F953EB212519E700CF0F2B /* TimelineTableViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TimelineTableViewController.swift; sourceTree = "<group>"; };
|
||||
D6F953EF21251A2900CF0F2B /* MastodonController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MastodonController.swift; sourceTree = "<group>"; };
|
||||
D6F98BD523AE951F008A4DAC /* Swifter.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; path = Swifter.framework; sourceTree = BUILT_PRODUCTS_DIR; };
|
||||
/* End PBXFileReference section */
|
||||
|
||||
/* Begin PBXFrameworksBuildPhase section */
|
||||
|
@ -530,6 +539,8 @@
|
|||
isa = PBXFrameworksBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
D65F613823AFD65D00F3CFD3 /* Embassy.framework in Frameworks */,
|
||||
D65F613623AFD65900F3CFD3 /* Ambassador.framework in Frameworks */,
|
||||
D60A549221ED515800F1F87C /* GMImagePicker.framework in Frameworks */,
|
||||
D61099C02144B0CC00432DC2 /* Pachyderm.framework in Frameworks */,
|
||||
D65A37F321472F300087646E /* SwiftSoup.framework in Frameworks */,
|
||||
|
@ -947,6 +958,11 @@
|
|||
D65A37F221472F300087646E /* Frameworks */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
D65F613723AFD65D00F3CFD3 /* Embassy.framework */,
|
||||
D65F613523AFD65900F3CFD3 /* Ambassador.framework */,
|
||||
D65F613023AE99E000F3CFD3 /* Ambassador.framework */,
|
||||
D65F612D23AE990C00F3CFD3 /* Embassy.framework */,
|
||||
D6F98BD523AE951F008A4DAC /* Swifter.framework */,
|
||||
);
|
||||
name = Frameworks;
|
||||
sourceTree = "<group>";
|
||||
|
@ -1259,6 +1275,7 @@
|
|||
isa = PBXGroup;
|
||||
children = (
|
||||
D6D4DDEF212518A200E1C4BB /* TuskerUITests.swift */,
|
||||
D65F613323AEAB6600F3CFD3 /* OnboardingTests.swift */,
|
||||
D6D4DDF1212518A200E1C4BB /* Info.plist */,
|
||||
);
|
||||
path = TuskerUITests;
|
||||
|
@ -1371,6 +1388,7 @@
|
|||
D6D4DDC9212518A000E1C4BB /* Frameworks */,
|
||||
D6D4DDCA212518A000E1C4BB /* Resources */,
|
||||
D6F953E52125197500CF0F2B /* Embed Frameworks */,
|
||||
D65F612C23AE957600F3CFD3 /* Embed debug-only frameworks */,
|
||||
);
|
||||
buildRules = (
|
||||
);
|
||||
|
@ -1415,6 +1433,8 @@
|
|||
D6D4DDED212518A200E1C4BB /* PBXTargetDependency */,
|
||||
);
|
||||
name = TuskerUITests;
|
||||
packageProductDependencies = (
|
||||
);
|
||||
productName = TuskerUITests;
|
||||
productReference = D6D4DDEB212518A200E1C4BB /* TuskerUITests.xctest */;
|
||||
productType = "com.apple.product-type.bundle.ui-testing";
|
||||
|
@ -1472,6 +1492,8 @@
|
|||
ca,
|
||||
);
|
||||
mainGroup = D6D4DDC3212518A000E1C4BB;
|
||||
packageReferences = (
|
||||
);
|
||||
productRefGroup = D6D4DDCD212518A000E1C4BB /* Products */;
|
||||
projectDirPath = "";
|
||||
projectRoot = "";
|
||||
|
@ -1564,6 +1586,31 @@
|
|||
};
|
||||
/* End PBXResourcesBuildPhase section */
|
||||
|
||||
/* Begin PBXShellScriptBuildPhase section */
|
||||
D65F612C23AE957600F3CFD3 /* Embed debug-only frameworks */ = {
|
||||
isa = PBXShellScriptBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
);
|
||||
inputFileListPaths = (
|
||||
);
|
||||
inputPaths = (
|
||||
"${BUILT_PRODUCTS_DIR}/Embassy.framework",
|
||||
"${BUILT_PRODUCTS_DIR}/Ambassador.framework",
|
||||
);
|
||||
name = "Embed debug-only frameworks";
|
||||
outputFileListPaths = (
|
||||
);
|
||||
outputPaths = (
|
||||
"${BUILT_PRODUCTS_DIR}/${FRAMEWORKS_FOLDER_PATH}/Embassy.framework",
|
||||
"${BUILT_PRODUCTS_DIR}/${FRAMEWORKS_FOLDER_PATH}/Ambassador.framework",
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
shellPath = /bin/sh;
|
||||
shellScript = "if [ \"${CONFIGURATION}\" == \"Debug\" ]; then\n echo \"Embedding ${SCRIPT_INPUT_FILE_0}\"\n cp -R $SCRIPT_INPUT_FILE_0 $SCRIPT_OUTPUT_FILE_0\n codesign --force --verbose --sign $EXPANDED_CODE_SIGN_IDENTITY $SCRIPT_OUTPUT_FILE_0\n \n echo \"Embedding ${SCRIPT_INPUT_FILE_1}\"\n cp -R $SCRIPT_INPUT_FILE_1 $SCRIPT_OUTPUT_FILE_1\n codesign --force --verbose --sign $EXPANDED_CODE_SIGN_IDENTITY $SCRIPT_OUTPUT_FILE_1\nelse\n echo \"Skipping embedding debug frameworks\"\nfi\n";
|
||||
};
|
||||
/* End PBXShellScriptBuildPhase section */
|
||||
|
||||
/* Begin PBXSourcesBuildPhase section */
|
||||
D60A548721ED515800F1F87C /* Sources */ = {
|
||||
isa = PBXSourcesBuildPhase;
|
||||
|
@ -1764,6 +1811,7 @@
|
|||
isa = PBXSourcesBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
D65F613423AEAB6600F3CFD3 /* OnboardingTests.swift in Sources */,
|
||||
D6D4DDF0212518A200E1C4BB /* TuskerUITests.swift in Sources */,
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
|
@ -2166,6 +2214,7 @@
|
|||
"$(inherited)",
|
||||
"@executable_path/Frameworks",
|
||||
);
|
||||
OTHER_LDFLAGS = "";
|
||||
PRODUCT_BUNDLE_IDENTIFIER = net.shadowfacts.Tusker;
|
||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||
PROVISIONING_PROFILE_SPECIFIER = "";
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<Scheme
|
||||
LastUpgradeVersion = "1020"
|
||||
version = "1.3">
|
||||
version = "1.7">
|
||||
<BuildAction
|
||||
parallelizeBuildables = "YES"
|
||||
buildImplicitDependencies = "YES">
|
||||
|
@ -27,6 +27,15 @@
|
|||
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
|
||||
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
|
||||
shouldUseLaunchSchemeArgsEnv = "YES">
|
||||
<MacroExpansion>
|
||||
<BuildableReference
|
||||
BuildableIdentifier = "primary"
|
||||
BlueprintIdentifier = "D6D4DDCB212518A000E1C4BB"
|
||||
BuildableName = "Tusker.app"
|
||||
BlueprintName = "Tusker"
|
||||
ReferencedContainer = "container:Tusker.xcodeproj">
|
||||
</BuildableReference>
|
||||
</MacroExpansion>
|
||||
<Testables>
|
||||
<TestableReference
|
||||
skipped = "NO">
|
||||
|
@ -47,6 +56,9 @@
|
|||
BlueprintName = "TuskerUITests"
|
||||
ReferencedContainer = "container:Tusker.xcodeproj">
|
||||
</BuildableReference>
|
||||
<DeviceAppData
|
||||
resolvedPath = "../BlankSlate.xcappdata">
|
||||
</DeviceAppData>
|
||||
</TestableReference>
|
||||
<TestableReference
|
||||
skipped = "NO">
|
||||
|
@ -59,17 +71,6 @@
|
|||
</BuildableReference>
|
||||
</TestableReference>
|
||||
</Testables>
|
||||
<MacroExpansion>
|
||||
<BuildableReference
|
||||
BuildableIdentifier = "primary"
|
||||
BlueprintIdentifier = "D6D4DDCB212518A000E1C4BB"
|
||||
BuildableName = "Tusker.app"
|
||||
BlueprintName = "Tusker"
|
||||
ReferencedContainer = "container:Tusker.xcodeproj">
|
||||
</BuildableReference>
|
||||
</MacroExpansion>
|
||||
<AdditionalOptions>
|
||||
</AdditionalOptions>
|
||||
</TestAction>
|
||||
<LaunchAction
|
||||
buildConfiguration = "Debug"
|
||||
|
@ -91,8 +92,6 @@
|
|||
ReferencedContainer = "container:Tusker.xcodeproj">
|
||||
</BuildableReference>
|
||||
</BuildableProductRunnable>
|
||||
<AdditionalOptions>
|
||||
</AdditionalOptions>
|
||||
</LaunchAction>
|
||||
<ProfileAction
|
||||
buildConfiguration = "Release"
|
||||
|
|
|
@ -4,6 +4,9 @@
|
|||
<FileRef
|
||||
location = "container:Tusker.xcodeproj">
|
||||
</FileRef>
|
||||
<FileRef
|
||||
location = "group:BlankSlate.xcappdata">
|
||||
</FileRef>
|
||||
<FileRef
|
||||
location = "group:Cache/Cache.xcodeproj">
|
||||
</FileRef>
|
||||
|
@ -13,4 +16,10 @@
|
|||
<FileRef
|
||||
location = "group:Gifu/Gifu.xcodeproj">
|
||||
</FileRef>
|
||||
<FileRef
|
||||
location = "group:Embassy/Embassy.xcodeproj">
|
||||
</FileRef>
|
||||
<FileRef
|
||||
location = "group:Ambassador/Ambassador.xcodeproj">
|
||||
</FileRef>
|
||||
</Workspace>
|
||||
|
|
|
@ -26,6 +26,9 @@ class AppDelegate: UIResponder, UIApplicationDelegate {
|
|||
|
||||
NotificationCenter.default.addObserver(self, selector: #selector(onUserLoggedOut), name: .userLoggedOut, object: nil)
|
||||
|
||||
NotificationCenter.default.addObserver(self, selector: #selector(themePrefChanged), name: .themePreferenceChanged, object: nil)
|
||||
themePrefChanged()
|
||||
|
||||
window!.makeKeyAndVisible()
|
||||
|
||||
if let shortcutItem = launchOptions?[.shortcutItem] as? UIApplicationShortcutItem {
|
||||
|
@ -110,6 +113,10 @@ class AppDelegate: UIResponder, UIApplicationDelegate {
|
|||
showOnboardingUI()
|
||||
}
|
||||
|
||||
@objc func themePrefChanged() {
|
||||
window?.overrideUserInterfaceStyle = Preferences.shared.theme
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
extension AppDelegate: OnboardingViewControllerDelegate {
|
||||
|
|
|
@ -2,6 +2,17 @@
|
|||
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
||||
<plist version="1.0">
|
||||
<dict>
|
||||
<key>NSAppTransportSecurity</key>
|
||||
<dict>
|
||||
<key>NSExceptionDomains</key>
|
||||
<dict>
|
||||
<key>localhost</key>
|
||||
<dict>
|
||||
<key>NSExceptionAllowsInsecureHTTPLoads</key>
|
||||
<true/>
|
||||
</dict>
|
||||
</dict>
|
||||
</dict>
|
||||
<key>NSUserActivityTypes</key>
|
||||
<array>
|
||||
<string>$(PRODUCT_BUNDLE_IDENTIFIER).activity.show-timeline</string>
|
||||
|
|
|
@ -12,7 +12,15 @@ class LocalData {
|
|||
|
||||
static let shared = LocalData()
|
||||
|
||||
let defaults = UserDefaults()
|
||||
let defaults: UserDefaults
|
||||
|
||||
private init() {
|
||||
if ProcessInfo.processInfo.environment.keys.contains("UI_TESTING") {
|
||||
defaults = UserDefaults(suiteName: "\(Bundle.main.bundleIdentifier!).uitesting")!
|
||||
} else {
|
||||
defaults = UserDefaults()
|
||||
}
|
||||
}
|
||||
|
||||
private let onboardingCompleteKey = "onboardingComplete"
|
||||
var onboardingComplete: Bool {
|
||||
|
@ -63,10 +71,6 @@ class LocalData {
|
|||
defaults.set(newValue, forKey: accessTokenKey)
|
||||
}
|
||||
}
|
||||
|
||||
private init() {
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
extension Notification.Name {
|
||||
|
|
|
@ -10,4 +10,5 @@ import Foundation
|
|||
|
||||
extension Notification.Name {
|
||||
static let preferencesChanged = Notification.Name("Tusker.preferencesChanged")
|
||||
static let themePreferenceChanged = Notification.Name("Tusker.themePreferenceChanged")
|
||||
}
|
||||
|
|
|
@ -37,6 +37,7 @@ class Preferences: Codable, ObservableObject {
|
|||
required init(from decoder: Decoder) throws {
|
||||
let container = try decoder.container(keyedBy: CodingKeys.self)
|
||||
|
||||
self.theme = try container.decode(UIUserInterfaceStyle.self, forKey: .theme)
|
||||
self.showRepliesInProfiles = try container.decode(Bool.self, forKey: .showRepliesInProfiles)
|
||||
self.avatarStyle = try container.decode(AvatarStyle.self, forKey: .avatarStyle)
|
||||
self.hideCustomEmojiInUsernames = try container.decode(Bool.self, forKey: .hideCustomEmojiInUsernames)
|
||||
|
@ -59,6 +60,7 @@ class Preferences: Codable, ObservableObject {
|
|||
func encode(to encoder: Encoder) throws {
|
||||
var container = encoder.container(keyedBy: CodingKeys.self)
|
||||
|
||||
try container.encode(theme, forKey: .theme)
|
||||
try container.encode(showRepliesInProfiles, forKey: .showRepliesInProfiles)
|
||||
try container.encode(avatarStyle, forKey: .avatarStyle)
|
||||
try container.encode(hideCustomEmojiInUsernames, forKey: .hideCustomEmojiInUsernames)
|
||||
|
@ -79,6 +81,7 @@ class Preferences: Codable, ObservableObject {
|
|||
}
|
||||
|
||||
// MARK: - Appearance
|
||||
@Published var theme = UIUserInterfaceStyle.unspecified
|
||||
@Published var showRepliesInProfiles = false
|
||||
@Published var avatarStyle = AvatarStyle.roundRect
|
||||
@Published var hideCustomEmojiInUsernames = false
|
||||
|
@ -101,6 +104,7 @@ class Preferences: Codable, ObservableObject {
|
|||
@Published var statusContentType: StatusContentType = .plain
|
||||
|
||||
enum CodingKeys: String, CodingKey {
|
||||
case theme
|
||||
case showRepliesInProfiles
|
||||
case avatarStyle
|
||||
case hideCustomEmojiInUsernames
|
||||
|
@ -127,3 +131,5 @@ extension Preferences {
|
|||
case undecided, accepted, rejected
|
||||
}
|
||||
}
|
||||
|
||||
extension UIUserInterfaceStyle: Codable {}
|
||||
|
|
|
@ -74,19 +74,36 @@ class InstanceSelectorTableViewController: UITableViewController {
|
|||
loadRecommendedInstances()
|
||||
}
|
||||
|
||||
private func updateSpecificInstance(domain: String) {
|
||||
private func parseURLComponents(input: String) -> URLComponents {
|
||||
// we can't just use the URLComponents(string:) initializer, because when given just a domain (w/o protocol), it interprets it as the path
|
||||
var input = input
|
||||
var components = URLComponents()
|
||||
if domain.contains("://") {
|
||||
let parts = domain.components(separatedBy: "://")
|
||||
components.scheme = parts[0]
|
||||
components.host = parts[1]
|
||||
} else {
|
||||
components.host = domain
|
||||
// extract protocol
|
||||
if input.contains("://") {
|
||||
let parts = input.components(separatedBy: "://")
|
||||
components.scheme = parts.first!
|
||||
input = parts.last!
|
||||
}
|
||||
if components.scheme != "https" && components.scheme != "http" {
|
||||
components.scheme = "https"
|
||||
}
|
||||
components.path = "/"
|
||||
// drop path
|
||||
if input.contains("/") {
|
||||
let parts = input.components(separatedBy: "/")
|
||||
input = parts.first!
|
||||
}
|
||||
// parse port
|
||||
if input.contains(":") {
|
||||
let parts = input.components(separatedBy: ":")
|
||||
input = parts.first!
|
||||
components.port = Int(parts.last!)
|
||||
}
|
||||
components.host = input
|
||||
return components
|
||||
}
|
||||
|
||||
private func updateSpecificInstance(domain: String) {
|
||||
let components = parseURLComponents(input: domain)
|
||||
|
||||
let client = Client(baseURL: components.url!)
|
||||
let request = client.getInstance()
|
||||
|
|
|
@ -10,6 +10,13 @@ import SwiftUI
|
|||
struct AppearancePrefsView : View {
|
||||
@ObservedObject var preferences = Preferences.shared
|
||||
|
||||
var theme: Binding<UIUserInterfaceStyle> = Binding(get: {
|
||||
Preferences.shared.theme
|
||||
}, set: {
|
||||
Preferences.shared.theme = $0
|
||||
NotificationCenter.default.post(name: .themePreferenceChanged, object: nil)
|
||||
})
|
||||
|
||||
var useCircularAvatars: Binding<Bool> = Binding(get: {
|
||||
Preferences.shared.avatarStyle == .circle
|
||||
}) {
|
||||
|
@ -18,6 +25,11 @@ struct AppearancePrefsView : View {
|
|||
|
||||
var body: some View {
|
||||
List {
|
||||
Picker(selection: theme, label: Text("Theme")) {
|
||||
Text("Use System Theme").tag(UIUserInterfaceStyle.unspecified)
|
||||
Text("Light").tag(UIUserInterfaceStyle.light)
|
||||
Text("Dark").tag(UIUserInterfaceStyle.dark)
|
||||
}
|
||||
Toggle(isOn: $preferences.showRepliesInProfiles) {
|
||||
Text("Show Replies in Profiles")
|
||||
}
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="14868" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES">
|
||||
<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="15701" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES">
|
||||
<device id="retina6_1" orientation="portrait" appearance="light"/>
|
||||
<dependencies>
|
||||
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="14824"/>
|
||||
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="15703"/>
|
||||
<capability name="Safe area layout guides" minToolsVersion="9.0"/>
|
||||
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
|
||||
</dependencies>
|
||||
|
@ -53,6 +53,9 @@
|
|||
</stackView>
|
||||
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" text="Instance Description" textAlignment="natural" lineBreakMode="tailTruncation" numberOfLines="0" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="aD6-LG-BWG" customClass="ContentLabel" customModule="Tusker" customModuleProvider="target">
|
||||
<rect key="frame" x="0.0" y="26.5" width="200" height="20.5"/>
|
||||
<accessibility key="accessibilityConfiguration">
|
||||
<accessibilityTraits key="traits" staticText="YES" notEnabled="YES"/>
|
||||
</accessibility>
|
||||
<fontDescription key="fontDescription" type="system" pointSize="17"/>
|
||||
<nil key="textColor"/>
|
||||
<nil key="highlightedColor"/>
|
||||
|
|
|
@ -0,0 +1,38 @@
|
|||
//
|
||||
// OnboardingTests.swift
|
||||
// TuskerUITests
|
||||
//
|
||||
// Created by Shadowfacts on 12/21/19.
|
||||
// Copyright © 2019 Shadowfacts. All rights reserved.
|
||||
//
|
||||
|
||||
import XCTest
|
||||
import Ambassador
|
||||
|
||||
class OnboardingTests: TuskerUITests {
|
||||
|
||||
override func setUp() {
|
||||
super.setUp()
|
||||
|
||||
router["/api/v1/instance"] = JSONResponse(handler: { (_) in
|
||||
return [
|
||||
"description": "An instance description",
|
||||
"max_toot_chars": 500,
|
||||
"thumbnail": "http://localhost:8080/thumbnail.png",
|
||||
"title": "Localhost",
|
||||
"uri": "http://localhost:8080",
|
||||
"version": "2.7.2",
|
||||
"urls": [:]
|
||||
]
|
||||
})
|
||||
}
|
||||
|
||||
func testExample() {
|
||||
let searchField = app.searchFields.element
|
||||
searchField.tap()
|
||||
searchField.typeText("http://localhost:8080")
|
||||
XCTAssertTrue(app.staticTexts["localhost"].exists)
|
||||
XCTAssertTrue(app.staticTexts["An instance description"].exists)
|
||||
}
|
||||
|
||||
}
|
|
@ -7,28 +7,56 @@
|
|||
//
|
||||
|
||||
import XCTest
|
||||
import Embassy
|
||||
import Ambassador
|
||||
|
||||
class TuskerUITests: XCTestCase {
|
||||
|
||||
var eventLoop: EventLoop!
|
||||
var router: Router!
|
||||
var server: HTTPServer!
|
||||
var eventLoopThreadCondition: NSCondition!
|
||||
var eventLoopThread: Thread!
|
||||
|
||||
var app: XCUIApplication!
|
||||
|
||||
private func setupWebServer() {
|
||||
eventLoop = try! SelectorEventLoop(selector: try! KqueueSelector())
|
||||
router = Router()
|
||||
server = DefaultHTTPServer(eventLoop: eventLoop, port: 8080, app: router.app)
|
||||
router["/hello"] = JSONResponse(handler: { (_) in
|
||||
return ["Hello", "World"]
|
||||
})
|
||||
try! server.start()
|
||||
|
||||
eventLoopThreadCondition = NSCondition()
|
||||
eventLoopThread = Thread(block: {
|
||||
self.eventLoop.runForever()
|
||||
self.eventLoopThreadCondition.lock()
|
||||
self.eventLoopThreadCondition.signal()
|
||||
self.eventLoopThreadCondition.unlock()
|
||||
})
|
||||
eventLoopThread.start()
|
||||
}
|
||||
|
||||
override func setUp() {
|
||||
// Put setup code here. This method is called before the invocation of each test method in the class.
|
||||
setupWebServer()
|
||||
|
||||
// In UI tests it is usually best to stop immediately when a failure occurs.
|
||||
continueAfterFailure = false
|
||||
|
||||
// UI tests must launch the application that they test. Doing this in setup will make sure it happens for each test method.
|
||||
XCUIApplication().launch()
|
||||
|
||||
// In UI tests it’s important to set the initial state - such as interface orientation - required for your tests before they run. The setUp method is a good place to do this.
|
||||
app = XCUIApplication()
|
||||
app.launchEnvironment["UI_TESTING"] = "true"
|
||||
app.launch()
|
||||
}
|
||||
|
||||
override func tearDown() {
|
||||
// Put teardown code here. This method is called after the invocation of each test method in the class.
|
||||
server.stopAndWait()
|
||||
eventLoopThreadCondition.lock()
|
||||
eventLoop.stop()
|
||||
while eventLoop.running {
|
||||
if !eventLoopThreadCondition.wait(until: Date(timeIntervalSinceNow: 10)) {
|
||||
fatalError("Join eventLoopThread timeout")
|
||||
}
|
||||
}
|
||||
|
||||
func testExample() {
|
||||
// Use recording to get started writing UI tests.
|
||||
// Use XCTAssert and related functions to verify your tests produce the correct results.
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue