Browse Source

remove unnecessary logic in account switcher; refactor task list

starred-projects
Trent Larson 8 months ago
parent
commit
643718619e
  1. 24
      project.task.yaml
  2. 60
      src/views/IdentitySwitcherView.vue

24
project.task.yaml

@ -1,12 +1,22 @@
tasks: tasks:
- .5 fix timeSafari.org cert renewals
- .2 anchor hash into BTC
- .2 add links between projects
- image on give
- Show a camera to take a picture
- Scale the image to a reasonable size
- Upload to a public readable place
- check the rate limits
- use CID
- put the image URL in the claim
- Rates - images erased?
- image not associated with JWT ULID since that's assigned later
- change server plan & project endpoints to use jwtId as identifier rather than rowid - change server plan & project endpoints to use jwtId as identifier rather than rowid
- edit offers & gives, or revoke allowing re-creation - edit offers & gives, or revoke allowing re-creation
- bug (that is hard to reproduce) - offer gave USD (by default?) - bug (that is hard to reproduce) - offer gave USD (by default?)
- .1 When available in the server, give message for 'nonAmountGiven' on offers on ProjectsView page. - .1 When available in the server, give message for 'nonAmountGiven' on offers on ProjectsView page.
- .5 fix timeSafari.org cert renewals
- .2 anchor hash into BTC
- 04 allow backup of localStorage key - 04 allow backup of localStorage key
- .5 add more detail on TimeSafari.org - .5 add more detail on TimeSafari.org
- .1 show better error when user with no ID goes to the "My Project" page - .1 show better error when user with no ID goes to the "My Project" page
@ -15,15 +25,6 @@ tasks:
- checkboxes: randomize vs show in order, show non-person-oriented messages, show only contacts, show only projects - checkboxes: randomize vs show in order, show non-person-oriented messages, show only contacts, show only projects
- allow user to add a time when they want their daily notification - allow user to add a time when they want their daily notification
- prompt for the name directly when they visit the QR scan page - prompt for the name directly when they visit the QR scan page
- image on give
- Show a camera to take a picture
- Scale the image to a reasonable size
- Upload to a public readable place
- check the rate limits
- use CID
- put the image URL in the claim
- Rates - images erased?
- image not associated with JWT ULID since that's assigned later
- mark a project as inactive - mark a project as inactive
- add share button for sending a message to confirmers when we can't see the claim (like the "visible" links) - add share button for sending a message to confirmers when we can't see the claim (like the "visible" links)
- add TimeSafari as a shareable app https://developer.mozilla.org/en-US/docs/Web/Manifest/share_target - add TimeSafari as a shareable app https://developer.mozilla.org/en-US/docs/Web/Manifest/share_target
@ -34,6 +35,7 @@ tasks:
- .1 hide project-create button on project page if not registered - .1 hide project-create button on project page if not registered
- .1 hide offer & give buttons on project list page if not registered - .1 hide offer & give buttons on project list page if not registered
- .1 add cursor-pointer on the icons for giving on the project page, and on the list of projects on the discover page - .1 add cursor-pointer on the icons for giving on the project page, and on the list of projects on the discover page
- .2 record when InfiniteScroll hits the end of the list and don't trigger any more loads
- bug - turning notifications on from the help screen did not stay, though account screen toggle did stay (From Jason on iPhone.) - bug - turning notifications on from the help screen did not stay, though account screen toggle did stay (From Jason on iPhone.)
- refactor - supply the projectId to the OfferDialog just like we do with the GiftedDialog offerId (in the "open" method, maybe as well as an attribute) - refactor - supply the projectId to the OfferDialog just like we do with the GiftedDialog offerId (in the "open" method, maybe as well as an attribute)

60
src/views/IdentitySwitcherView.vue

@ -18,13 +18,23 @@
<!-- Identity List --> <!-- Identity List -->
<!-- Current Identity - Display First! --> <!-- Current Identity - Display First! -->
<div class="block bg-slate-100 rounded-md flex items-center px-4 py-3 mb-4"> <div
<fa icon="circle-check" class="fa-fw text-blue-600 text-xl mr-3"></fa> v-if="activeDid && !activeDidInIdentities"
<span class="overflow-hidden"> class="block bg-slate-100 rounded-md flex items-center px-4 py-3 mb-4"
<div class="text-sm text-slate-500 truncate"> >
<fa icon="circle-check" class="fa-fw text-red-600 text-xl mr-3"></fa>
<div class="text-sm text-slate-500">
<div class="overflow-hidden truncate">
<b>ID:</b> <code>{{ activeDid }}</code> <b>ID:</b> <code>{{ activeDid }}</code>
</div> </div>
</span> <b
>There is a data corruption error: this identity is selected but it is
not in storage. You cannot send any more claims with this identity
until you import the seed again. This may require reinstalling the
app; if you know how, you can also clear out the TimeSafariAccounts
IndexedDB. Be sure to back up all your Settings & Contacts first.</b
>
</div>
</div> </div>
<!-- Other Identity/ies --> <!-- Other Identity/ies -->
@ -35,7 +45,12 @@
:key="ident.did" :key="ident.did"
@click="switchAccount(ident.did)" @click="switchAccount(ident.did)"
> >
<fa icon="circle" class="fa-fw text-slate-400 text-xl mr-3"></fa> <fa
v-if="ident.did === activeDid"
icon="circle-check"
class="fa-fw text-blue-600 text-xl mr-3"
/>
<fa v-else icon="circle" class="fa-fw text-slate-400 text-xl mr-3" />
<span class="overflow-hidden"> <span class="overflow-hidden">
<h2 class="text-xl font-semibold mb-0"></h2> <h2 class="text-xl font-semibold mb-0"></h2>
<div class="text-sm text-slate-500 truncate"> <div class="text-sm text-slate-500 truncate">
@ -85,21 +100,12 @@ export default class IdentitySwitcherView extends Vue {
Constants = AppString; Constants = AppString;
public accounts: typeof AccountsSchema; public accounts: typeof AccountsSchema;
public activeDid = ""; public activeDid = "";
public activeDidInIdentities = false;
public apiServer = ""; public apiServer = "";
public apiServerInput = ""; public apiServerInput = "";
public otherIdentities: Array<{ did: string }> = []; public otherIdentities: Array<{ did: string }> = [];
public showContactGives = false; public showContactGives = false;
public async getIdentity(activeDid: string) {
await accountsDB.open();
const account = await accountsDB.accounts
.where("did")
.equals(activeDid)
.first();
const identity = JSON.parse((account?.identity as string) || "null");
return identity;
}
async created() { async created() {
try { try {
await db.open(); await db.open();
@ -109,19 +115,13 @@ export default class IdentitySwitcherView extends Vue {
this.apiServerInput = settings?.apiServer || ""; this.apiServerInput = settings?.apiServer || "";
this.showContactGives = !!settings?.showContactGivesInline; this.showContactGives = !!settings?.showContactGivesInline;
const identity = await this.getIdentity(this.activeDid);
if (identity) {
db.settings.update(MASTER_SETTINGS_KEY, {
activeDid: identity.did,
});
}
await accountsDB.open(); await accountsDB.open();
const accounts = await accountsDB.accounts.toArray(); const accounts = await accountsDB.accounts.toArray();
for (let n = 0; n < accounts.length; n++) { for (let n = 0; n < accounts.length; n++) {
const did = JSON.parse(accounts[n].identity)["did"]; const did = JSON.parse(accounts[n].identity)["did"];
if (did && this.activeDid !== did) { this.otherIdentities.push({ did: did });
this.otherIdentities.push({ did: did }); if (did && this.activeDid === did) {
this.activeDidInIdentities = true;
} }
} }
} catch (err) { } catch (err) {
@ -147,16 +147,6 @@ export default class IdentitySwitcherView extends Vue {
await db.settings.update(MASTER_SETTINGS_KEY, { await db.settings.update(MASTER_SETTINGS_KEY, {
activeDid: did, activeDid: did,
}); });
this.activeDid = did || "";
this.otherIdentities = [];
await accountsDB.open();
const accounts = await accountsDB.accounts.toArray();
for (let n = 0; n < accounts.length; n++) {
const did = JSON.parse(accounts[n].identity)["did"];
if (did && this.activeDid !== did) {
this.otherIdentities.push({ did: did });
}
}
this.$router.push({ name: "account" }); this.$router.push({ name: "account" });
} }
} }

Loading…
Cancel
Save