Skip to content

Commit

Permalink
remove some bg thread processing
Browse files Browse the repository at this point in the history
  • Loading branch information
zoff99 committed Jan 4, 2024
1 parent caf45c5 commit b1aaf2b
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 30 deletions.
20 changes: 10 additions & 10 deletions src/main/kotlin/com/zoffcc/applications/trifa/ContactStore.kt
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ fun CoroutineScope.createContactStore(): ContactStore

override fun add(item: ContactItem)
{
launch {
//launch {
global_semaphore_contactlist_ui.acquire((Throwable().stackTrace[0].fileName + ":" + Throwable().stackTrace[0].lineNumber))
var found = false
state.contacts.forEach {
Expand All @@ -67,12 +67,12 @@ fun CoroutineScope.createContactStore(): ContactStore
mutableStateFlow.value = state.copy(contacts = new_contacts)
}
global_semaphore_contactlist_ui.release()
}
//}
}

override fun remove(item: ContactItem)
{
launch {
//launch {
global_semaphore_contactlist_ui.acquire((Throwable().stackTrace[0].fileName + ":" + Throwable().stackTrace[0].lineNumber))
var sel_pubkey = state.selectedContactPubkey
var sel_item = state.selectedContact
Expand Down Expand Up @@ -103,12 +103,12 @@ fun CoroutineScope.createContactStore(): ContactStore
mutableStateFlow.value = state.copy(contacts = new_contacts,
selectedContact = sel_item, selectedContactPubkey = sel_pubkey)
global_semaphore_contactlist_ui.release()
}
//}
}

override fun select(pubkey: String?)
{
launch {
//launch {
global_semaphore_contactlist_ui.acquire((Throwable().stackTrace[0].fileName + ":" + Throwable().stackTrace[0].lineNumber))
var wanted_contact_item: ContactItem? = null
state.contacts.forEach {
Expand All @@ -124,7 +124,7 @@ fun CoroutineScope.createContactStore(): ContactStore
}
mutableStateFlow.value = state.copy(contacts = state.contacts, selectedContactPubkey = used_pubkey, selectedContact = wanted_contact_item)
global_semaphore_contactlist_ui.release()
}
//}
}

override fun visible(value: Boolean)
Expand All @@ -136,7 +136,7 @@ fun CoroutineScope.createContactStore(): ContactStore

override fun update(item: ContactItem)
{
launch {
//launch {
global_semaphore_contactlist_ui.acquire((Throwable().stackTrace[0].fileName + ":" + Throwable().stackTrace[0].lineNumber))
var update_item: ContactItem? = null
state.contacts.forEach {
Expand Down Expand Up @@ -168,16 +168,16 @@ fun CoroutineScope.createContactStore(): ContactStore
mutableStateFlow.value = state.copy(contacts = (state.contacts + item), selectedContactPubkey = state.selectedContactPubkey, selectedContact = state.selectedContact)
}
global_semaphore_contactlist_ui.release()
}
//}
}

override fun clear()
{
launch {
//launch {
global_semaphore_contactlist_ui.acquire((Throwable().stackTrace[0].fileName + ":" + Throwable().stackTrace[0].lineNumber))
mutableStateFlow.value = state.copy(contacts = emptyList(), selectedContactPubkey = null, selectedContact = null)
global_semaphore_contactlist_ui.release()
}
//}
}
}
}
20 changes: 10 additions & 10 deletions src/main/kotlin/com/zoffcc/applications/trifa/GroupPeerStore.kt
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ fun CoroutineScope.createGroupPeerStore(): GroupPeerStore

override fun add(item: GroupPeerItem)
{
launch {
//launch {
global_semaphore_grouppeerlist_ui.acquire((Throwable().stackTrace[0].fileName + ":" + Throwable().stackTrace[0].lineNumber))
var found = false
state.grouppeers.forEach {
Expand All @@ -61,12 +61,12 @@ fun CoroutineScope.createGroupPeerStore(): GroupPeerStore
mutableStateFlow.value = state.copy(grouppeers = new_peers)
}
global_semaphore_grouppeerlist_ui.release()
}
//}
}

override fun remove(item: GroupPeerItem)
{
launch {
//launch {
global_semaphore_grouppeerlist_ui.acquire((Throwable().stackTrace[0].fileName + ":" + Throwable().stackTrace[0].lineNumber))
var sel_pubkey = state.selectedGrouppeerPubkey
var sel_item = state.selectedGrouppeer
Expand Down Expand Up @@ -99,12 +99,12 @@ fun CoroutineScope.createGroupPeerStore(): GroupPeerStore
mutableStateFlow.value = state.copy(grouppeers = new_peers,
selectedGrouppeer = sel_item, selectedGrouppeerPubkey = sel_pubkey)
global_semaphore_grouppeerlist_ui.release()
}
//}
}

override fun select(pubkey: String?)
{
launch {
//launch {
global_semaphore_grouppeerlist_ui.acquire((Throwable().stackTrace[0].fileName + ":" + Throwable().stackTrace[0].lineNumber))
var wanted_contact_item: GroupPeerItem? = null
state.grouppeers.forEach {
Expand All @@ -121,12 +121,12 @@ fun CoroutineScope.createGroupPeerStore(): GroupPeerStore
mutableStateFlow.value = state.copy(grouppeers = state.grouppeers,
selectedGrouppeerPubkey = used_pubkey, selectedGrouppeer = wanted_contact_item)
global_semaphore_grouppeerlist_ui.release()
}
//}
}

override fun update(item: GroupPeerItem)
{
launch {
//launch {
global_semaphore_grouppeerlist_ui.acquire((Throwable().stackTrace[0].fileName + ":" + Throwable().stackTrace[0].lineNumber))
var update_item: GroupPeerItem? = null
state.grouppeers.forEach {
Expand Down Expand Up @@ -164,17 +164,17 @@ fun CoroutineScope.createGroupPeerStore(): GroupPeerStore
selectedGrouppeer = state.selectedGrouppeer)
}
global_semaphore_grouppeerlist_ui.release()
}
//}
}

override fun clear()
{
launch {
//launch {
global_semaphore_grouppeerlist_ui.acquire((Throwable().stackTrace[0].fileName + ":" + Throwable().stackTrace[0].lineNumber))
mutableStateFlow.value = state.copy(grouppeers = emptyList(),
selectedGrouppeerPubkey = null, selectedGrouppeer = null)
global_semaphore_grouppeerlist_ui.release()
}
//}
}
}
}
Expand Down
20 changes: 10 additions & 10 deletions src/main/kotlin/com/zoffcc/applications/trifa/GroupStore.kt
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ fun CoroutineScope.createGroupStore(): GroupStore

override fun add(item: GroupItem)
{
launch {
//launch {
global_semaphore_grouplist_ui.acquire((Throwable().stackTrace[0].fileName + ":" + Throwable().stackTrace[0].lineNumber))
var found = false
state.groups.forEach {
Expand All @@ -68,12 +68,12 @@ fun CoroutineScope.createGroupStore(): GroupStore
mutableStateFlow.value = state.copy(groups = new_groups)
}
global_semaphore_grouplist_ui.release()
}
//}
}

override fun remove(item: GroupItem)
{
launch {
//launch {
global_semaphore_grouplist_ui.acquire((Throwable().stackTrace[0].fileName + ":" + Throwable().stackTrace[0].lineNumber))
var sel_groupid = state.selectedGroupId
var sel_item = state.selectedGroup
Expand Down Expand Up @@ -104,12 +104,12 @@ fun CoroutineScope.createGroupStore(): GroupStore
mutableStateFlow.value = state.copy(groups = new_groups,
selectedGroup = sel_item, selectedGroupId = sel_groupid)
global_semaphore_grouplist_ui.release()
}
//}
}

override fun select(groupId: String?)
{
launch {
//launch {
global_semaphore_grouplist_ui.acquire((Throwable().stackTrace[0].fileName + ":" + Throwable().stackTrace[0].lineNumber))
var wanted_group_item: GroupItem? = null
state.groups.forEach {
Expand All @@ -125,7 +125,7 @@ fun CoroutineScope.createGroupStore(): GroupStore
}
mutableStateFlow.value = state.copy(groups = state.groups, selectedGroupId = used_groupid, selectedGroup = wanted_group_item)
global_semaphore_grouplist_ui.release()
}
//}
}

override fun visible(value: Boolean)
Expand All @@ -137,7 +137,7 @@ fun CoroutineScope.createGroupStore(): GroupStore

override fun update(item: GroupItem)
{
launch {
//launch {
global_semaphore_grouplist_ui.acquire((Throwable().stackTrace[0].fileName + ":" + Throwable().stackTrace[0].lineNumber))
var update_item: GroupItem? = null
state.groups.forEach {
Expand Down Expand Up @@ -169,16 +169,16 @@ fun CoroutineScope.createGroupStore(): GroupStore
mutableStateFlow.value = state.copy(groups = (state.groups + item), selectedGroupId = state.selectedGroupId, selectedGroup = state.selectedGroup)
}
global_semaphore_grouplist_ui.release()
}
//}
}

override fun clear()
{
launch {
//launch {
global_semaphore_grouplist_ui.acquire((Throwable().stackTrace[0].fileName + ":" + Throwable().stackTrace[0].lineNumber))
mutableStateFlow.value = state.copy(groups = emptyList(), selectedGroupId = null, selectedGroup = null)
global_semaphore_grouplist_ui.release()
}
//}
}
}
}

0 comments on commit b1aaf2b

Please sign in to comment.