Skip to content

Commit d555d5e

Browse files
authored
location icon change when bg location sharing is activated (#120)
* add location activated icon * make the location button on the top bar change when background location sharing is on.
1 parent c720608 commit d555d5e

4 files changed

Lines changed: 33 additions & 2 deletions

File tree

Antidote/ChatPrivateController.swift

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -534,10 +534,14 @@ extension ChatPrivateController {
534534
if (action_title == "Disable")
535535
{
536536
AppDelegate.location_sharing_contact_pubkey = "-1"
537+
let locationImage = UIImage(named: "location-call-medium")!.withRenderingMode(.alwaysOriginal)
538+
locationButton.setBackgroundImage(locationImage, for: .normal, barMetrics: .default)
537539
}
538540
else
539541
{
540542
AppDelegate.location_sharing_contact_pubkey = self.friend?.publicKey ?? "-1"
543+
let locationImage = UIImage(named: "location-call-activated-medium")!.withRenderingMode(.alwaysOriginal)
544+
locationButton.setBackgroundImage(locationImage, for: .normal, barMetrics: .default)
541545

542546
DispatchQueue.global(qos: .userInitiated).async {
543547

@@ -1464,11 +1468,16 @@ private extension ChatPrivateController {
14641468
else {
14651469
let audioImage = UIImage(named: "start-call-medium")!
14661470
let videoImage = UIImage(named: "video-call-medium")!
1467-
let locationImage = UIImage(named: "location-call-medium")!.withRenderingMode(.alwaysTemplate)
1471+
let locationImage = UIImage(named: "location-call-medium")!.withRenderingMode(.alwaysOriginal)
14681472
audioButton = UIBarButtonItem(image: audioImage, style: .plain, target: self, action: #selector(ChatPrivateController.audioCallButtonPressed))
14691473
videoButton = UIBarButtonItem(image: videoImage, style: .plain, target: self, action: #selector(ChatPrivateController.videoCallButtonPressed))
14701474
locationButton = UIBarButtonItem(image: locationImage, style: .plain, target: self, action: #selector(ChatPrivateController.locationButtonPressed))
1471-
1475+
1476+
if (AppDelegate.location_sharing_contact_pubkey != "-1") {
1477+
let locationImage = UIImage(named: "location-call-activated-medium")!.withRenderingMode(.alwaysOriginal)
1478+
locationButton.setBackgroundImage(locationImage, for: .normal, barMetrics: .default)
1479+
}
1480+
14721481
navigationItem.leftBarButtonItems = nil
14731482
navigationItem.rightBarButtonItems = [
14741483
videoButton,
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
{
2+
"images" : [
3+
{
4+
"idiom" : "universal",
5+
"filename" : "location-call-activated-medium.png",
6+
"scale" : "1x"
7+
},
8+
{
9+
"idiom" : "universal",
10+
"filename" : "location-call-activated-medium@2x.png",
11+
"scale" : "2x"
12+
},
13+
{
14+
"idiom" : "universal",
15+
"scale" : "3x"
16+
}
17+
],
18+
"info" : {
19+
"version" : 1,
20+
"author" : "xcode"
21+
}
22+
}
5.29 KB
Loading
5.56 KB
Loading

0 commit comments

Comments
 (0)