Skip to content

Commit

Permalink
Merge pull request #374 from CirclesUBI/feature/app-390-fix-runtime-e…
Browse files Browse the repository at this point in the history
…rrors

Feature/app 390 fix runtime errors
  • Loading branch information
ingoCollatz authored Jul 27, 2023
2 parents e6f53b8 + dd47915 commit f89f7ab
Show file tree
Hide file tree
Showing 7 changed files with 34 additions and 34 deletions.
Binary file modified .yarn/install-state.gz
Binary file not shown.
2 changes: 1 addition & 1 deletion shell/src/App.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
const followTrust: FollowTrust = new FollowTrust();
followTrust.start();
export const FollowTrustWorker = followTrust;followTrust
export const FollowTrustWorker = followTrust;
</script>
<script lang="ts">
import "./shared/css/tailwind.css";
Expand Down
42 changes: 21 additions & 21 deletions shell/src/main.ts
Original file line number Diff line number Diff line change
@@ -1,29 +1,29 @@
import {RpcGateway} from "@o-platform/o-circles/dist/rpcGateway";
import { RpcGateway } from "@o-platform/o-circles/dist/rpcGateway";
import dayjs from "dayjs";
import relativeTime from "dayjs/plugin/relativeTime";
import {_, setupI18n} from "./i18n/i18nDictionary";
import {get} from "svelte/store";
import {ProcessDefinition} from "@o-platform/o-process/dist/interfaces/processManifest";
import {ProcessContext} from "@o-platform/o-process/dist/interfaces/processContext";
import {Generate} from "@o-platform/o-utils/dist/generate";
import { _, setupI18n } from "./i18n/i18nDictionary";
import { get } from "svelte/store";
import { ProcessDefinition } from "@o-platform/o-process/dist/interfaces/processManifest";
import { ProcessContext } from "@o-platform/o-process/dist/interfaces/processContext";
import { Generate } from "@o-platform/o-utils/dist/generate";
import * as LoadingIndicator from "./shared/atoms/LoadingIndicator.svelte";
import Success from "./shared/atoms/Success.svelte";
import ErrorIndicator from "./shared/atoms/Error.svelte";
import {useMachine} from "@xstate/svelte";
import {Subject, Subscription} from "rxjs";
import {ProcessEvent} from "@o-platform/o-process/dist/interfaces/processEvent";
import {AnyEventObject} from "xstate";
import {Bubble} from "@o-platform/o-process/dist/events/bubble";
import {PlatformEvent} from "@o-platform/o-events/dist/platformEvent";
import {Process} from "@o-platform/o-process/dist/interfaces/process";
import {Sinker} from "@o-platform/o-process/dist/events/sinker";
import {shellEvents} from "./shared/shellEvents";
import {ApiConnection} from "./shared/apiConnection";
import {Stopped} from "@o-platform/o-process/dist/events/stopped";
import {Environment} from "./shared/environment";
import {IShell} from "./iShell";
import { useMachine } from "@xstate/svelte";
import { Subject, Subscription } from "rxjs";
import { ProcessEvent } from "@o-platform/o-process/dist/interfaces/processEvent";
import { AnyEventObject } from "xstate";
import { Bubble } from "@o-platform/o-process/dist/events/bubble";
import { PlatformEvent } from "@o-platform/o-events/dist/platformEvent";
import { Process } from "@o-platform/o-process/dist/interfaces/process";
import { Sinker } from "@o-platform/o-process/dist/events/sinker";
import { shellEvents } from "./shared/shellEvents";
import { ApiConnection } from "./shared/apiConnection";
import { Stopped } from "@o-platform/o-process/dist/events/stopped";
import { Environment } from "./shared/environment";
import { IShell } from "./iShell";
import * as Sentry from "@sentry/browser";
import {BrowserTracing} from "@sentry/tracing";
import { BrowserTracing } from "@sentry/tracing";
import * as bip39 from "bip39";
import posthog from 'posthog-js'

Expand Down Expand Up @@ -124,7 +124,7 @@ window.o = <any>{
},
async run<TContext>(definition: ProcessDefinition<any, any>, contextModifier?: (processContext: ProcessContext<any>) => Promise<TContext>) {
const processId = Generate.randomHexString(8);
console.log(`Starting process (id: ${processId}) with definition:`, definition);
// console.log(`Starting process (id: ${processId}) with definition:`, definition);

const machine = (<any>definition).stateMachine(LoadingIndicator, Success, ErrorIndicator);
const machineOptions = {
Expand Down
7 changes: 5 additions & 2 deletions shell/src/shared/followTrust.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import { me } from "./stores/me";
import { ApiClient } from "./apiConnection";
import { fSetTrust } from "../dapps/o-banking/processes/setTrust";
import { Environment } from "./environment";
import { get } from 'svelte/store'

export class FollowTrust {
static readonly shortIntervalInMilliseconds = 6000;
Expand All @@ -12,7 +13,7 @@ export class FollowTrust {
private intervalHandle: any;
private isWorking = false;

constructor() {}
constructor() { }

reset() {
this.stop();
Expand All @@ -25,7 +26,9 @@ export class FollowTrust {

this.intervalHandle = setInterval(() => {
// console.log(`FollowTrust is running. (isWorking: ${this.isWorking})`);
if (this.isWorking) {
const $me = get(me)

if (this.isWorking || !$me?.id) {
return;
}
this.followTrust()
Expand Down
1 change: 1 addition & 0 deletions shell/src/shared/openLogin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ export async function getOpenLogin(): Promise<GetOpenLoginResult> {
privKey: acc.privateKey,
};
},
// async logout(): Promise<void> { },
async getUserInfo(): Promise<OpenloginUserInfo> {
return {
email: "[email protected]",
Expand Down
3 changes: 2 additions & 1 deletion shell/src/shared/processes/shellProcess.ts
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ const processDefinition = () => {
id: childProcessId,
src: (context) => {
const sm = context.childProcessDefinition.stateMachine(childProcessId);
// console.log(`Running child process ${processId}: `, sm);
// console.log(`invoking child process: ${sm.id}`)
return <any>sm; // TODO: Fix 'any'
},
Expand Down Expand Up @@ -125,7 +126,7 @@ const processDefinition = () => {
field: {
name: "",
get: () => undefined,
set: (o: any) => {},
set: (o: any) => { },
},
}),
],
Expand Down
13 changes: 4 additions & 9 deletions shell/src/shared/stores/pagedEventQuery.ts
Original file line number Diff line number Diff line change
Expand Up @@ -113,15 +113,10 @@ export abstract class PagedEventQuery implements ObjectCache<ProfileEvent> {

async next(): Promise<boolean> {
let $me: Profile;
me.subscribe((m) => ($me = m))();

// Possible Solution for avoiding thrown an Error here when the user is not logged in
// const sessionInfo = await me.getSessionInfo(true);
// if (!sessionInfo.isLoggedOn) {
// console.log("NO SESSION, BAILING");
// return false;
// }

me.subscribe(m => $me = m)();
if (!$me?.id) {
return;
}
const args = <QueryEventsArgs>{
safeAddress: $me.circlesAddress,
types: this.eventTypes,
Expand Down

0 comments on commit f89f7ab

Please sign in to comment.