Browse Source

add fallback icons for pre iOS13, switch to bell icons, allow to set muted state

cyberta 3 years ago
parent
commit
984527afb3

+ 23 - 0
deltachat-ios/Assets.xcassets/ic_notifications_off.imageset/Contents.json

@@ -0,0 +1,23 @@
+{
+  "images" : [
+    {
+      "filename" : "bell-off-outline_white_1x.png",
+      "idiom" : "universal",
+      "scale" : "1x"
+    },
+    {
+      "filename" : "bell-off-outline_white_2x.png",
+      "idiom" : "universal",
+      "scale" : "2x"
+    },
+    {
+      "filename" : "bell-off-outline_white_3x.png",
+      "idiom" : "universal",
+      "scale" : "3x"
+    }
+  ],
+  "info" : {
+    "author" : "xcode",
+    "version" : 1
+  }
+}

BIN
deltachat-ios/Assets.xcassets/ic_notifications_off.imageset/bell-off-outline_white_1x.png


BIN
deltachat-ios/Assets.xcassets/ic_notifications_off.imageset/bell-off-outline_white_2x.png


BIN
deltachat-ios/Assets.xcassets/ic_notifications_off.imageset/bell-off-outline_white_3x.png


+ 23 - 0
deltachat-ios/Assets.xcassets/ic_notifications_on.imageset/Contents.json

@@ -0,0 +1,23 @@
+{
+  "images" : [
+    {
+      "filename" : "bell-outline_white_1x.png",
+      "idiom" : "universal",
+      "scale" : "1x"
+    },
+    {
+      "filename" : "bell-outline_white_2x.png",
+      "idiom" : "universal",
+      "scale" : "2x"
+    },
+    {
+      "filename" : "bell-outline_white_3x.png",
+      "idiom" : "universal",
+      "scale" : "3x"
+    }
+  ],
+  "info" : {
+    "author" : "xcode",
+    "version" : 1
+  }
+}

BIN
deltachat-ios/Assets.xcassets/ic_notifications_on.imageset/bell-outline_white_1x.png


BIN
deltachat-ios/Assets.xcassets/ic_notifications_on.imageset/bell-outline_white_2x.png


BIN
deltachat-ios/Assets.xcassets/ic_notifications_on.imageset/bell-outline_white_3x.png


+ 18 - 1
deltachat-ios/View/ContactDetailHeader.swift

@@ -63,7 +63,11 @@ class ContactDetailHeader: UIView {
         button.translatesAutoresizingMaskIntoConstraints = false
         button.translatesAutoresizingMaskIntoConstraints = false
         button.addTarget(self, action: #selector(muteBtnTapped), for: .touchUpInside)
         button.addTarget(self, action: #selector(muteBtnTapped), for: .touchUpInside)
         button.backgroundColor = DcColors.defaultBackgroundColor
         button.backgroundColor = DcColors.defaultBackgroundColor
-        button.setImage(UIImage(named: "volume_off")?.sd_tintedImage(with: .systemBlue), for: .normal)
+        if #available(iOS 13.0, *) {
+            button.setImage(UIImage(systemName: "bell")?.sd_tintedImage(with: .systemBlue), for: .normal)
+        } else {
+            button.setImage(UIImage(named: "ic_notifications_on")?.sd_tintedImage(with: .systemBlue), for: .normal)
+        }
         button.layer.cornerRadius = 16
         button.layer.cornerRadius = 16
         button.layer.borderColor = DcColors.colorDisabled.cgColor
         button.layer.borderColor = DcColors.colorDisabled.cgColor
         button.layer.borderWidth = 1
         button.layer.borderWidth = 1
@@ -138,6 +142,19 @@ class ContactDetailHeader: UIView {
         avatar.setName(name)
         avatar.setName(name)
     }
     }
 
 
+    func setMuted(isMuted: Bool) {
+        if #available(iOS 13.0, *) {
+            muteButton.setImage(isMuted ? UIImage(systemName: "bell")?.sd_tintedImage(with: .systemBlue) :
+                                    UIImage(systemName: "bell.slash")?.sd_tintedImage(with: .systemBlue),
+                                for: .normal)
+        } else {
+            muteButton.setImage(isMuted ?
+                                UIImage(named: "ic_notifications_on")?.sd_tintedImage(with: .systemBlue) :
+                                    UIImage(named: "ic_notifications_off")?.sd_tintedImage(with: .systemBlue),
+                                for: .normal)
+        }
+    }
+
     func setVerified(isVerified: Bool) {
     func setVerified(isVerified: Bool) {
         avatar.setVerified(isVerified)
         avatar.setVerified(isVerified)
     }
     }