improve carplay apply button ui
This commit is contained in:
1 parent
759597dfb2
commit
f9ba2dee0d
7 files changed
+85
-7
No files matched your search
@@ -0,0 +1,39 @@
|
|||||||
|
//
|
||||||
|
// OpaqueButton.swift
|
||||||
|
// Pocket Poster
|
||||||
|
//
|
||||||
|
// Created by lemin on 6/21/25.
|
||||||
|
//
|
||||||
|
|
||||||
|
import SwiftUI
|
||||||
|
|
||||||
|
struct OpaqueButton: ButtonStyle {
|
||||||
|
var color: Color
|
||||||
|
var textColor: Color
|
||||||
|
var fullwidth: Bool = false
|
||||||
|
|
||||||
|
func makeBody(configuration: Configuration) -> some View {
|
||||||
|
ZStack {
|
||||||
|
if fullwidth {
|
||||||
|
configuration.label
|
||||||
|
.padding(15)
|
||||||
|
.frame(maxWidth: .infinity)
|
||||||
|
.background(color)
|
||||||
|
.cornerRadius(8)
|
||||||
|
.foregroundColor(textColor)
|
||||||
|
} else {
|
||||||
|
configuration.label
|
||||||
|
.padding(15)
|
||||||
|
.background(color)
|
||||||
|
.cornerRadius(8)
|
||||||
|
.foregroundColor(textColor)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
init(color: Color = .blue, textColor: Color = .primary, fullwidth: Bool = false) {
|
||||||
|
self.color = color
|
||||||
|
self.textColor = textColor
|
||||||
|
self.fullwidth = fullwidth
|
||||||
|
}
|
||||||
|
}
|
||||||
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
@@ -418,6 +418,9 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
},
|
||||||
|
"Apply CarPlay Wallpapers" : {
|
||||||
|
|
||||||
},
|
},
|
||||||
"Applying Wallpapers..." : {
|
"Applying Wallpapers..." : {
|
||||||
"localizations" : {
|
"localizations" : {
|
||||||
@@ -630,6 +633,15 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
},
|
||||||
|
"CarPlay" : {
|
||||||
|
|
||||||
|
},
|
||||||
|
"CarPlay Applied Wallpapers Successfully Cleared!" : {
|
||||||
|
|
||||||
|
},
|
||||||
|
"CarPlay Wallpapers" : {
|
||||||
|
|
||||||
},
|
},
|
||||||
"Clear App Cache" : {
|
"Clear App Cache" : {
|
||||||
"localizations" : {
|
"localizations" : {
|
||||||
@@ -1977,6 +1989,7 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"Enter App Hash" : {
|
"Enter App Hash" : {
|
||||||
|
"extractionState" : "stale",
|
||||||
"localizations" : {
|
"localizations" : {
|
||||||
"ar" : {
|
"ar" : {
|
||||||
"stringUnit" : {
|
"stringUnit" : {
|
||||||
@@ -2075,6 +2088,15 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
},
|
||||||
|
"Enter CarPlayWallpaper App Hash" : {
|
||||||
|
|
||||||
|
},
|
||||||
|
"Enter PosterBoard App Hash" : {
|
||||||
|
|
||||||
|
},
|
||||||
|
"Enter your CarPlayWallpaper app hash in Settings." : {
|
||||||
|
|
||||||
},
|
},
|
||||||
"Enter your PosterBoard app hash in Settings." : {
|
"Enter your PosterBoard app hash in Settings." : {
|
||||||
"localizations" : {
|
"localizations" : {
|
||||||
@@ -5136,6 +5158,9 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
},
|
||||||
|
"Reset CarPlay Applied Wallpapers" : {
|
||||||
|
|
||||||
},
|
},
|
||||||
"Reset Collections" : {
|
"Reset Collections" : {
|
||||||
"localizations" : {
|
"localizations" : {
|
||||||
@@ -7008,6 +7033,9 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
},
|
||||||
|
"You can now choose your wallpapers in the CarPlay settings in your car." : {
|
||||||
|
|
||||||
},
|
},
|
||||||
"You can only apply %@ descriptors." : {
|
"You can only apply %@ descriptors." : {
|
||||||
"localizations" : {
|
"localizations" : {
|
||||||
|
|||||||
@@ -29,6 +29,7 @@ struct CarPlayView: View {
|
|||||||
|
|
||||||
var body: some View {
|
var body: some View {
|
||||||
NavigationStack {
|
NavigationStack {
|
||||||
|
ZStack {
|
||||||
ScrollView {
|
ScrollView {
|
||||||
if wallpapers.isEmpty {
|
if wallpapers.isEmpty {
|
||||||
ProgressView()
|
ProgressView()
|
||||||
@@ -51,11 +52,10 @@ struct CarPlayView: View {
|
|||||||
}
|
}
|
||||||
.padding()
|
.padding()
|
||||||
}
|
}
|
||||||
|
}
|
||||||
if cpHash == "" {
|
VStack {
|
||||||
Text("Enter your CarPlayWallpaper app hash in Settings.")
|
Spacer()
|
||||||
.padding()
|
if didChange {
|
||||||
} else if didChange {
|
|
||||||
Button(action: {
|
Button(action: {
|
||||||
UIImpactFeedbackGenerator(style: .soft).impactOccurred()
|
UIImpactFeedbackGenerator(style: .soft).impactOccurred()
|
||||||
UIApplication.shared.alert(title: NSLocalizedString("Applying Wallpapers...", comment: ""), body: NSLocalizedString("Please wait", comment: ""), animated: false, withButton: false)
|
UIApplication.shared.alert(title: NSLocalizedString("Applying Wallpapers...", comment: ""), body: NSLocalizedString("Please wait", comment: ""), animated: false, withButton: false)
|
||||||
@@ -80,10 +80,19 @@ struct CarPlayView: View {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}) {
|
}) {
|
||||||
|
if cpHash == "" {
|
||||||
|
Text("Enter your CarPlayWallpaper app hash in Settings.")
|
||||||
|
} else {
|
||||||
Label("Apply CarPlay Wallpapers", systemImage: "checkmark.circle")
|
Label("Apply CarPlay Wallpapers", systemImage: "checkmark.circle")
|
||||||
}
|
}
|
||||||
.buttonStyle(TintedButton(color: .blue, fullwidth: true))
|
}
|
||||||
.padding()
|
.buttonStyle(OpaqueButton(color: cpHash == "" ? .red : .blue, fullwidth: true))
|
||||||
|
.disabled(cpHash == "")
|
||||||
|
.padding(.vertical, 10)
|
||||||
|
.padding(.horizontal, 25)
|
||||||
|
.transition(.move(edge: .bottom))
|
||||||
|
.animation(.easeIn, value: didChange)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
.navigationTitle("CarPlay Wallpapers")
|
.navigationTitle("CarPlay Wallpapers")
|
||||||
@@ -177,12 +186,14 @@ struct WallpaperView: View {
|
|||||||
} else {
|
} else {
|
||||||
wallpaper.selectedImageDataLight = data
|
wallpaper.selectedImageDataLight = data
|
||||||
}
|
}
|
||||||
|
withAnimation {
|
||||||
didChange = true
|
didChange = true
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
struct WallpaperImageView: View {
|
struct WallpaperImageView: View {
|
||||||
var img: UIImage
|
var img: UIImage
|
||||||
|
|||||||
Reference in new issue
Block a user