From 7e0945583ec43c59d785ab5a722c1774497c8060 Mon Sep 17 00:00:00 2001 From: Dan Ballard Date: Tue, 17 Dec 2019 13:33:38 -0800 Subject: [PATCH] go mod cwtch to 0.3.7; add profile list sorting by onion --- go.mod | 2 +- go.sum | 7 +++++++ go/handlers/peerHandler.go | 2 -- qml/widgets/ProfileList.qml | 12 +++++++++++- 4 files changed, 19 insertions(+), 4 deletions(-) diff --git a/go.mod b/go.mod index 8e577562..d3f1c870 100644 --- a/go.mod +++ b/go.mod @@ -3,7 +3,7 @@ module cwtch.im/ui go 1.12 require ( - cwtch.im/cwtch v0.3.6 + cwtch.im/cwtch v0.3.7 git.openprivacy.ca/openprivacy/libricochet-go v1.0.8 github.com/gopherjs/gopherjs v0.0.0-20190812055157-5d271430af9f // indirect github.com/kr/pretty v0.1.0 // indirect diff --git a/go.sum b/go.sum index fd141d81..803bb95d 100644 --- a/go.sum +++ b/go.sum @@ -12,10 +12,13 @@ cwtch.im/cwtch v0.3.5 h1:L4hBYMRUSADodBz3gwIrYGXZf2V7HzTlzLUku9N3O9A= cwtch.im/cwtch v0.3.5/go.mod h1:I95rbE3aK8uic7LsMOB1lfJDSzlNsRUP0/5cFCLkD0Y= cwtch.im/cwtch v0.3.6 h1:a+BhoTpdlH5yI335HQDB7EEWZJqvNdoZnnjYLYne52Y= cwtch.im/cwtch v0.3.6/go.mod h1:NU6Pm4RgHm97b03U83W7/NabmRvBxHQMxM8/kZnH12Y= +cwtch.im/cwtch v0.3.7 h1:kcNQqxQLT03DKbkyXJGMmoROLcIGlsjw8++gNVq2Dxg= +cwtch.im/cwtch v0.3.7/go.mod h1:wbhUXmJohgHOLx0pPx96LqsDK89PL6Ai+ABL8YC9ZC4= cwtch.im/tapir v0.1.10 h1:V+TkmwXNd6gySZqlVw468wMYEkmDwMSyvhkkpOfUw7w= cwtch.im/tapir v0.1.10/go.mod h1:EuRYdVrwijeaGBQ4OijDDRHf7R2MDSypqHkSl5DxI34= cwtch.im/tapir v0.1.11 h1:JLm1MIYq4VXKzhj68+P8OuVPllAU9U6G0DtUor2fbc4= cwtch.im/tapir v0.1.11/go.mod h1:EuRYdVrwijeaGBQ4OijDDRHf7R2MDSypqHkSl5DxI34= +cwtch.im/tapir v0.1.13/go.mod h1:1fu4d+cMCepVaMm5vHrp4N/romdjKR+R6P8cvdRXYtQ= git.openprivacy.ca/openprivacy/libricochet-go v1.0.4/go.mod h1:yMSG1gBaP4f1U+RMZXN85d29D39OK5s8aTpyVRoH5FY= git.openprivacy.ca/openprivacy/libricochet-go v1.0.6 h1:5o4K2qn3otEE1InC5v5CzU0yL7Wl7DhVp4s8H3K6mXY= git.openprivacy.ca/openprivacy/libricochet-go v1.0.6/go.mod h1:yMSG1gBaP4f1U+RMZXN85d29D39OK5s8aTpyVRoH5FY= @@ -42,6 +45,8 @@ github.com/gopherjs/gopherjs v0.0.0-20190411002643-bd77b112433e/go.mod h1:wJfORR github.com/gopherjs/gopherjs v0.0.0-20190812055157-5d271430af9f h1:KMlcu9X58lhTA/KrfX8Bi1LQSO4pzoVjTiL3h4Jk+Zk= github.com/gopherjs/gopherjs v0.0.0-20190812055157-5d271430af9f/go.mod h1:wJfORRmW1u3UXTncJ5qlYoELFm8eSnnEO6hX4iZ3EWY= github.com/gordonklaus/ineffassign v0.0.0-20190601041439-ed7b1b5ee0f8/go.mod h1:cuNKsD1zp2v6XfE/orVX2QE1LC+i254ceGcVeDT3pTU= +github.com/gtank/merlin v0.1.1/go.mod h1:T86dnYJhcGOh5BjZFCJWTDeTK7XW8uE+E21Cy/bIQ+s= +github.com/gtank/ristretto255 v0.1.1/go.mod h1:Ph5OpO6c7xKUGROZfWVLiJf9icMDwUeIvY4OmlYW69o= github.com/konsorten/go-windows-terminal-sequences v1.0.1/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ= github.com/konsorten/go-windows-terminal-sequences v1.0.2/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ= github.com/kr/pretty v0.1.0 h1:L/CwN0zerZDmRFUapSPitk6f+Q3+0za1rQkzVuMiMFI= @@ -53,6 +58,7 @@ github.com/mattn/go-colorable v0.1.2/go.mod h1:U0ppj6V5qS13XJ6of8GYAs25YV2eR4EVc github.com/mattn/go-isatty v0.0.8/go.mod h1:Iq45c/XA43vh69/j3iqttzPXn0bhXyGjM0Hdxcsrc5s= github.com/mattn/go-runewidth v0.0.4/go.mod h1:LwmH8dsx7+W8Uxz3IHJYH5QSwggIsqBzpuz5H//U1FU= github.com/mattn/go-tty v0.0.0-20190424173100-523744f04859/go.mod h1:XPvLUNfbS4fJH25nqRHfWLMa1ONC8Amw+mIA639KxkE= +github.com/mimoo/StrobeGo v0.0.0-20181016162300-f8f6d4d2b643/go.mod h1:43+3pMjjKimDBf5Kr4ZFNGbLql1zKkbImw+fZbw3geM= github.com/pkg/term v0.0.0-20190109203006-aa71e9d9e942/go.mod h1:eCbImbZ95eXtAUIbLAuAVnBnwf83mjf6QIVH8SHYwqQ= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= @@ -78,6 +84,7 @@ github.com/therecipe/qt/internal/binding/files/docs/5.12.0 v0.0.0-20191101232336 github.com/therecipe/qt/internal/binding/files/docs/5.12.0 v0.0.0-20191101232336-18864661ae4f/go.mod h1:7m8PDYDEtEVqfjoUQc2UrFqhG0CDmoVJjRlQxexndFc= github.com/therecipe/qt/internal/binding/files/docs/5.13.0 v0.0.0-20191002095216-73192f6811d0 h1:SC92QLlGwzwrT3Xi5YzKvtVXFIriPP0Ui1AOIZgDyh8= github.com/therecipe/qt/internal/binding/files/docs/5.13.0 v0.0.0-20191002095216-73192f6811d0/go.mod h1:mH55Ek7AZcdns5KPp99O0bg+78el64YCYWHiQKrOdt4= +go.etcd.io/bbolt v1.3.3/go.mod h1:IbVyRI1SCnLcuJnV2u8VeU0CEYM7e686BmAb1XKL+uU= golang.org/x/crypto v0.0.0-20190128193316-c7b33c32a30b/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= golang.org/x/crypto v0.0.0-20190418165655-df01cb2cc480/go.mod h1:WFFai1msRO1wXaEeE5yQxYXgSfI8pQAWXbQop6sCtWE= diff --git a/go/handlers/peerHandler.go b/go/handlers/peerHandler.go index 8838533d..bec562cb 100644 --- a/go/handlers/peerHandler.go +++ b/go/handlers/peerHandler.go @@ -11,8 +11,6 @@ import ( "time" ) -const ExitPeerHandlerEvent = 10000 - func PeerHandler(onion string, uiManager ui.Manager, subscribed chan bool) { peer := the.CwtchApp.GetPeer(onion) eventBus := the.CwtchApp.GetEventBus(onion) diff --git a/qml/widgets/ProfileList.qml b/qml/widgets/ProfileList.qml index e435a65b..b7c1cc57 100644 --- a/qml/widgets/ProfileList.qml +++ b/qml/widgets/ProfileList.qml @@ -43,6 +43,7 @@ ColumnLayout { onAddProfile: function(handle, displayName, image, tag) { + // don't add duplicates console.log("ProfileList onAddProfile for: " + handle) for (var i = 0; i < profilesModel.count; i++) { if (profilesModel.get(i)["_handle"] == handle) { @@ -50,7 +51,16 @@ ColumnLayout { } } - profilesModel.insert(profilesModel.count-1, + // find index for insert (sort by onion) + var index = profilesModel.count-1 + for (var i = 0; i < profilesModel.count-1; i++) { + if (profilesModel.get(i)["_handle"] > handle) { + index = i + break + } + } + + profilesModel.insert(index, { "_handle": handle, "_displayName": displayName,