Skip to content

Commit

Permalink
Add watchOS app target, icon and update rules UI
Browse files Browse the repository at this point in the history
  • Loading branch information
grgar committed Oct 20, 2023
1 parent 2ba2284 commit fca40d6
Show file tree
Hide file tree
Showing 13 changed files with 548 additions and 124 deletions.
6 changes: 6 additions & 0 deletions Assets.xcassets/AppIcon.appiconset/Contents.json
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,12 @@
"idiom" : "mac",
"scale" : "2x",
"size" : "512x512"
},
{
"filename" : "Icon 1.png",
"idiom" : "universal",
"platform" : "watchos",
"size" : "1024x1024"
}
],
"info" : {
Expand Down
Binary file added Assets.xcassets/AppIcon.appiconset/Icon 1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion ContentView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ struct ContentView: View {
#else
NavigationSplitView(columnVisibility: $visibility) {
HomeSidebar(selection: $navigationCategory)
#if !os(tvOS)
#if os(iOS) || os(macOS)
.listStyle(.sidebar)
#endif
} content: {
Expand Down
22 changes: 21 additions & 1 deletion Domains/ChangePasswordURLs.swift
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,21 @@ struct ChangePasswordURLs: View {
}
}
ForEach(responses, id: \.key) { response in
#if os(tvOS) || os(watchOS)
Label {
LabeledContent {
EmptyView()
} label: {
Text(response.key)
Text(response.value.relativePath)
.foregroundStyle(.secondary)
}
} icon: {
if showFavicon {
Favicon(domain: response.key)
}
}
#else
Link(destination: response.value) {
Label {
LabeledContent {
Expand All @@ -67,15 +82,20 @@ struct ChangePasswordURLs: View {
}
}
.foregroundStyle(.foreground)
#endif
}
}
.toolbar {
ToolbarItemGroup(placement: .automatic) {
#if os(watchOS)
Toggle("Favicon", isOn: $showFavicon)
#else
Picker("Favicon", selection: $showFavicon) {
Label("Show", systemImage: "checklist.unchecked").tag(true)
Label("Hide", systemImage: "list.bullet").tag(false)
}
.pickerStyle(.segmented)
#endif
}
}
.searchable(text: $searchText, prompt: Text("Search Domains"))
Expand All @@ -96,7 +116,7 @@ struct ChangePasswordURLs: View {
}
.navigationTitle(Text("Change Password"))
#if os(iOS)
.navigationBarTitleDisplayMode(.large)
.navigationBarTitleDisplayMode(.large)
#endif
}
}
Expand Down
2 changes: 1 addition & 1 deletion Home/HomeSidebar.swift
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ struct HomeSidebar: View {
#endif
}
}
#if !os(tvOS)
#if os(iOS) || os(macOS)
.scrollContentBackground(.hidden)
.listStyle(.sidebar)
#endif
Expand Down
202 changes: 197 additions & 5 deletions Passwords Inspector.xcodeproj/project.pbxproj

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
@@ -0,0 +1,91 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "1500"
version = "1.7">
<BuildAction
parallelizeBuildables = "YES"
buildImplicitDependencies = "YES">
<BuildActionEntries>
<BuildActionEntry
buildForTesting = "YES"
buildForRunning = "YES"
buildForProfiling = "YES"
buildForArchiving = "YES"
buildForAnalyzing = "YES">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "171459ED2ADB3FCF00E6C111"
BuildableName = "Passwords Inspector.app"
BlueprintName = "Watch App"
ReferencedContainer = "container:Passwords Inspector.xcodeproj">
</BuildableReference>
</BuildActionEntry>
<BuildActionEntry
buildForTesting = "YES"
buildForRunning = "YES"
buildForProfiling = "YES"
buildForArchiving = "YES"
buildForAnalyzing = "YES">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "1717C4992ABA44EC00AD991A"
BuildableName = "Passwords Inspector.app"
BlueprintName = "Passwords Inspector"
ReferencedContainer = "container:Passwords Inspector.xcodeproj">
</BuildableReference>
</BuildActionEntry>
</BuildActionEntries>
</BuildAction>
<TestAction
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
shouldUseLaunchSchemeArgsEnv = "YES"
shouldAutocreateTestPlan = "YES">
</TestAction>
<LaunchAction
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
launchStyle = "0"
useCustomWorkingDirectory = "NO"
ignoresPersistentStateOnLaunch = "NO"
debugDocumentVersioning = "YES"
debugServiceExtension = "internal"
allowLocationSimulation = "YES">
<BuildableProductRunnable
runnableDebuggingMode = "0">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "171459ED2ADB3FCF00E6C111"
BuildableName = "Passwords Inspector.app"
BlueprintName = "Watch App"
ReferencedContainer = "container:Passwords Inspector.xcodeproj">
</BuildableReference>
</BuildableProductRunnable>
</LaunchAction>
<ProfileAction
buildConfiguration = "Release"
shouldUseLaunchSchemeArgsEnv = "YES"
savedToolIdentifier = ""
useCustomWorkingDirectory = "NO"
debugDocumentVersioning = "YES">
<BuildableProductRunnable
runnableDebuggingMode = "0">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "171459ED2ADB3FCF00E6C111"
BuildableName = "Passwords Inspector.app"
BlueprintName = "Watch App"
ReferencedContainer = "container:Passwords Inspector.xcodeproj">
</BuildableReference>
</BuildableProductRunnable>
</ProfileAction>
<AnalyzeAction
buildConfiguration = "Debug">
</AnalyzeAction>
<ArchiveAction
buildConfiguration = "Release"
revealArchiveInOrganizer = "YES">
</ArchiveAction>
</Scheme>
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,24 @@
<key>orderHint</key>
<integer>0</integer>
</dict>
<key>Watch.xcscheme_^#shared#^_</key>
<dict>
<key>orderHint</key>
<integer>1</integer>
</dict>
</dict>
<key>SuppressBuildableAutocreation</key>
<dict>
<key>171459ED2ADB3FCF00E6C111</key>
<dict>
<key>primary</key>
<true/>
</dict>
<key>1717C4992ABA44EC00AD991A</key>
<dict>
<key>primary</key>
<true/>
</dict>
</dict>
</dict>
</plist>
74 changes: 73 additions & 1 deletion Rule/PasswordRuleDetail.swift
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ struct PasswordRuleDetail: View {

Section {
Grid {
#if !os(watchOS)
GridRow {
Text("")
.accessibilityHidden(true)
Expand All @@ -55,22 +56,61 @@ struct PasswordRuleDetail: View {
Text("Allowed")
}
.font(.caption)
#else
GridRow {
#if !os(watchOS)
Text("")
.gridCellUnsizedAxes([.horizontal, .vertical])
.gridColumnAlignment(.trailing)
#endif
Color.clear
.gridCellUnsizedAxes(.vertical)
.gridColumnAlignment(.leading)
Text("")
.gridCellUnsizedAxes([.horizontal, .vertical])
Text("")
.gridCellUnsizedAxes([.horizontal, .vertical])
}
.font(.caption)
.frame(height: 0)
.accessibilityHidden(true)
#endif

ForEach(rule.required.sorted()) { required in
GridRow {
if let symbol = required.symbol {
#if os(watchOS)
switch required {
case let .other(set):
Text("\(Image(systemName: symbol)) \(set.sorted().map(String.init).joined())")
default:
Text("\(Image(systemName: symbol)) \(required.description)")
}
#else
Image(systemName: symbol)
#endif
} else {
#if os(watchOS)
switch required {
case let .other(set):
Text(set.sorted().map(String.init).joined())
default:
Text(required.description)
}
#else
Text("")
.accessibilityHidden(true)
.gridCellUnsizedAxes([.horizontal, .vertical])
#endif
}
#if !os(watchOS)
switch required {
case let .other(set):
Text(set.sorted().map(String.init).joined())
default:
Text(required.description)
}
#endif
Image(systemName: "checkmark.circle.fill")
.symbolRenderingMode(.palette)
.foregroundStyle(.foreground, .quaternary)
Expand All @@ -84,18 +124,38 @@ struct PasswordRuleDetail: View {
ForEach((rule.allowed.subtracting(rule.required)).sorted()) { required in
GridRow {
if let symbol = required.symbol {
#if os(watchOS)
switch required {
case let .other(set):
Text("\(Image(systemName: symbol)) \(set.sorted().map(String.init).joined())")
default:
Text("\(Image(systemName: symbol)) \(required.description)")
}
#else
Image(systemName: symbol)
#endif
} else {
#if os(watchOS)
switch required {
case let .other(set):
Text(set.sorted().map(String.init).joined())
default:
Text(required.description)
}
#else
Text("")
.accessibilityHidden(true)
.gridCellUnsizedAxes([.horizontal, .vertical])
#endif
}
#if !os(watchOS)
switch required {
case let .other(set):
Text(set.sorted().map(String.init).joined())
default:
Text(required.description)
}
#endif
Text("")
.accessibilityHidden(true)
Image(systemName: "checkmark.circle.fill")
Expand All @@ -107,12 +167,24 @@ struct PasswordRuleDetail: View {
}
.padding(.vertical, 8)
} header: {
#if os(watchOS)
VStack(alignment: .leading) {
Text("Characters")
HStack {
Spacer()
Text("Required")
Text("Allowed")
}
.font(.caption2)
}
#else
Text("Characters")
#endif
}
}
.navigationTitle(rule.id)
#if os(iOS)
.navigationBarTitleDisplayMode(.large)
.navigationBarTitleDisplayMode(.large)
#endif
}
}
Expand Down
Loading

0 comments on commit fca40d6

Please sign in to comment.