Add a badge counter for call list in call view

This commit is contained in:
Benoit Martins 2024-01-25 12:14:14 +01:00
parent 4320f9dcce
commit 5ab64968e3
3 changed files with 78 additions and 24 deletions

View file

@ -48,6 +48,9 @@
},
"#" : {
},
"%lld" : {
},
"%lld Book (Example)" : {
"extractionState" : "manual",
@ -226,6 +229,9 @@
},
"Contacts" : {
},
"Content" : {
},
"Continue" : {
@ -549,6 +555,9 @@
},
"This contact will be deleted definitively." : {
},
"Title" : {
},
"TLS" : {

View file

@ -783,21 +783,43 @@ struct CallView: View {
.frame(width: geo.size.width * 0.25, height: geo.size.width * 0.25)
VStack {
Button {
callViewModel.getCallsList()
withAnimation {
isShowCallsListFragment.toggle()
ZStack {
Button {
callViewModel.getCallsList()
withAnimation {
isShowCallsListFragment.toggle()
}
} label: {
Image("phone-list")
.renderingMode(.template)
.resizable()
.foregroundStyle(.white)
.frame(width: 32, height: 32)
}
.frame(width: 60, height: 60)
.background(Color.gray500)
.cornerRadius(40)
if callViewModel.calls.count > 1 {
VStack {
HStack {
Spacer()
VStack {
Text("\(callViewModel.calls.count)")
.foregroundStyle(.white)
.default_text_style(styleSize: 15)
}
.frame(width: 20, height: 20)
.background(Color.redDanger500)
.cornerRadius(10)
}
Spacer()
}
.frame(width: 60, height: 60)
}
} label: {
Image("phone-list")
.renderingMode(.template)
.resizable()
.foregroundStyle(.white)
.frame(width: 32, height: 32)
}
.frame(width: 60, height: 60)
.background(Color.gray500)
.cornerRadius(40)
Text("Call list")
.foregroundStyle(.white)
@ -962,18 +984,39 @@ struct CallView: View {
.frame(width: geo.size.width * 0.125, height: geo.size.width * 0.125)
VStack {
Button {
} label: {
Image("phone-list")
.renderingMode(.template)
.resizable()
.foregroundStyle(Color.gray500)
.frame(width: 32, height: 32)
ZStack {
Button {
} label: {
Image("phone-list")
.renderingMode(.template)
.resizable()
.foregroundStyle(.white)
.frame(width: 32, height: 32)
}
.frame(width: 60, height: 60)
.background(Color.gray500)
.cornerRadius(40)
if callViewModel.calls.count > 1 {
VStack {
HStack {
Spacer()
VStack {
Text("\(callViewModel.calls.count)")
.foregroundStyle(.white)
.default_text_style(styleSize: 15)
}
.frame(width: 20, height: 20)
.background(Color.redDanger500)
.cornerRadius(10)
}
Spacer()
}
.frame(width: 60, height: 60)
}
}
.frame(width: 60, height: 60)
.background(Color.gray600)
.cornerRadius(40)
.disabled(true)
Text("Call list")
.foregroundStyle(.white)

View file

@ -107,6 +107,8 @@ class CallViewModel: ObservableObject {
let authToken = self.currentCall!.authenticationToken
let isDeviceTrusted = self.currentCall!.authenticationTokenVerified && authToken != nil
self.isRemoteDeviceTrusted = self.telecomManager.callInProgress ? isDeviceTrusted : false
self.getCallsList()
}
self.callSuscriptions.insert(self.currentCall!.publisher?.onEncryptionChanged?.postOnMainQueue {(cbVal: (call: Call, on: Bool, authenticationToken: String?)) in