浏览代码

Revert back to using

Deniz Cengiz 1 年之前
父节点
当前提交
d9027fbb8a
共有 1 个文件被更改,包括 12 次插入2 次删除
  1. 12 2
      LiveActivity/Views/LiveActivityView.swift

+ 12 - 2
LiveActivity/Views/LiveActivityView.swift

@@ -104,7 +104,12 @@ struct LiveActivityView: View {
             .privacySensitive()
             .padding(.all, 14)
             .foregroundStyle(Color.primary)
-            .activityBackgroundTint(colorScheme == .light ? Color.white.opacity(0.43) : Color.black.opacity(0.43))
+            // Semantic BackgroundStyle and Color values work here. They adapt to the given interface style (light mode, dark mode)
+            // Semantic UIColors do NOT (as of iOS 17.1.1). Like UIColor.systemBackgroundColor (it does not adapt to changes of the interface style)
+            // The colorScheme environment variable does work here, but BackgroundStyle gives us this functionality for free
+            .foregroundStyle(Color.primary)
+            .background(BackgroundStyle.background.opacity(0.4))
+            .activityBackgroundTint(Color.clear)
         } else {
             Group {
                 if context.state.isInitialState {
@@ -128,7 +133,12 @@ struct LiveActivityView: View {
             .privacySensitive()
             .padding(.all, 15)
             .foregroundStyle(Color.primary)
-            .activityBackgroundTint(colorScheme == .light ? Color.white.opacity(0.43) : Color.black.opacity(0.43))
+            /// Semantic BackgroundStyle and Color values work here. They adapt to the given interface style (light mode, dark mode)
+            // Semantic UIColors do NOT (as of iOS 17.1.1). Like UIColor.systemBackgroundColor (it does not adapt to changes of the interface style)
+            // The colorScheme environment variable does work here, but BackgroundStyle gives us this functionality for free
+            .foregroundStyle(Color.primary)
+            .background(BackgroundStyle.background.opacity(0.4))
+            .activityBackgroundTint(Color.clear)
         }
     }
 }