Browse Source

remove unnecessary logic in account switcher; refactor task list

kb/add-usage-guide
Trent Larson 8 months ago
parent
commit
643718619e
  1. 24
      project.task.yaml
  2. 58
      src/views/IdentitySwitcherView.vue

24
project.task.yaml

@ -1,12 +1,22 @@
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
- edit offers & gives, or revoke allowing re-creation
- 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.
- .5 fix timeSafari.org cert renewals
- .2 anchor hash into BTC
- 04 allow backup of localStorage key
- .5 add more detail on TimeSafari.org
- .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
- allow user to add a time when they want their daily notification
- 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
- 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
@ -34,6 +35,7 @@ tasks:
- .1 hide project-create button on project 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
- .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.)
- 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)

58
src/views/IdentitySwitcherView.vue

@ -18,13 +18,23 @@
<!-- Identity List -->
<!-- Current Identity - Display First! -->
<div class="block bg-slate-100 rounded-md flex items-center px-4 py-3 mb-4">
<fa icon="circle-check" class="fa-fw text-blue-600 text-xl mr-3"></fa>
<span class="overflow-hidden">
<div class="text-sm text-slate-500 truncate">
<div
v-if="activeDid && !activeDidInIdentities"
class="block bg-slate-100 rounded-md flex items-center px-4 py-3 mb-4"
>
<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>
</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>
<!-- Other Identity/ies -->
@ -35,7 +45,12 @@
:key="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">
<h2 class="text-xl font-semibold mb-0"></h2>
<div class="text-sm text-slate-500 truncate">
@ -85,21 +100,12 @@ export default class IdentitySwitcherView extends Vue {
Constants = AppString;
public accounts: typeof AccountsSchema;
public activeDid = "";
public activeDidInIdentities = false;
public apiServer = "";
public apiServerInput = "";
public otherIdentities: Array<{ did: string }> = [];
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() {
try {
await db.open();
@ -109,19 +115,13 @@ export default class IdentitySwitcherView extends Vue {
this.apiServerInput = settings?.apiServer || "";
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();
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 });
if (did && this.activeDid === did) {
this.activeDidInIdentities = true;
}
}
} catch (err) {
@ -147,16 +147,6 @@ export default class IdentitySwitcherView extends Vue {
await db.settings.update(MASTER_SETTINGS_KEY, {
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" });
}
}

Loading…
Cancel
Save