1- import { html , css } from "lit" ;
2- import { state , customElement } from "lit/decorators.js" ;
3- import { ContextProvider } from "@lit/context" ;
1+ import { css , html } from "lit" ;
2+ import { customElement , state } from "lit/decorators.js" ;
3+ import { ContextProvider , createContext } from "@lit/context" ;
4+ import { AdminWebsocket , AppWebsocket , InstalledAppId , ZomeName } from "@holochain/client" ;
45import {
5- AdminWebsocket ,
6- AppWebsocket ,
7- InstalledAppId ,
8- ZomeName
9- } from "@holochain/client" ;
10- import {
11- HvmDef , HappElement , HCL ,
12- BaseRoleName ,
13- CloneId ,
14- AppProxy , EntryId ,
15- DvmDef , DnaViewModel , pascal , delay ,
6+ AppProxy ,
7+ BaseRoleName ,
8+ CloneId ,
9+ delay ,
10+ DnaViewModel ,
11+ DvmDef ,
12+ EntryId ,
13+ HappElement ,
14+ HCL ,
15+ HvmDef ,
16+ pascal ,
1617} from "@ddd-qc/lit-happ" ;
17- import {
18- FilesDvm ,
19- FILES_DEFAULT_ROLE_NAME , ProfileInfo ,
20- } from "@ddd-qc/files" ;
18+ import { FILES_DEFAULT_ROLE_NAME , FilesDvm , ProfileInfo , } from "@ddd-qc/files" ;
2119import { HC_ADMIN_PORT , HC_APP_PORT } from "./globals" ;
2220import { AppletId , AppletView , CreatableName , GroupProfile , WAL , WeaveServices } from "@theweave/api" ;
2321import { ProfilesDvm } from "@ddd-qc/profiles-dvm" ;
@@ -26,11 +24,11 @@ import {DELIVERY_INTERGRITY_ZOME_NAME, DeliveryEntryType} from "@ddd-qc/delivery
2624import { buildBlock } from "./files-blocks" ;
2725import { DEFAULT_FILES_DEF } from "./happDef" ;
2826import { setLocale } from "./localization" ;
29- import { msg } from '@lit/localize' ;
27+ import { msg } from '@lit/localize' ;
3028
3129import "./files-main-page"
3230import "@ddd-qc/files" ;
33- import { createContext } from "@lit/context " ;
31+ import { GetStrategy } from "@holochain-open-dev/core-types " ;
3432
3533const weClientContext = createContext < WeaveServices > ( 'weave_client' ) ;
3634
@@ -48,15 +46,15 @@ export class FilesApp extends HappElement {
4846 @state ( ) private _hasHolochainFailed = true ;
4947 @state ( ) private _loaded = false ;
5048 @state ( ) private _hasWeProfile = false ;
51- @state ( ) private _offlinePerspectiveloaded = false ;
52- @state ( ) private _onlinePerspectiveloaded = false ;
49+ @state ( ) private _localPerspectiveloaded = false ;
50+ @state ( ) private _networkPerspectiveloaded = false ;
5351 //@state () private _filesCell: Cell;
5452 /** ZomeName -> (AppEntryDefName, isPublic) */
5553 //private _allAppEntryTypes: Record<string, [string, boolean][]> = {};
5654 //private _dnaDef?: DnaDefinition;
5755
5856
59- /** All arguments should be provided when constructed explicity */
57+ /** All arguments should be provided when constructed explicitly */
6058 constructor ( appWs ?: AppWebsocket , private _adminWs ?: AdminWebsocket , private _canAuthorizeZfns ?: boolean , readonly appId ?: InstalledAppId , public appletView ?: AppletView ) {
6159 const adminUrl = _adminWs
6260 ? undefined
@@ -196,28 +194,31 @@ export class FilesApp extends HappElement {
196194 /** */
197195 override async perspectiveInitializedFromLocal ( ) : Promise < void > {
198196 console . log ( "<files-app>.perspectiveInitializedFromLocal()" ) ;
199- const maybeProfile = await this . filesDvm . profilesZvm . findProfile ( this . filesDvm . cell . address . agentId ) ;
200- console . log ( "perspectiveInitializedFromLocal() maybeProfile" , maybeProfile , this . filesDvm . cell . address . agentId ) ;
197+ //const maybeProfile = await this.filesDvm.profilesZvm.findProfile(this.filesDvm.cell.address.agentId);
198+ //console.log("perspectiveInitializedFromLocal() maybeProfile", maybeProfile, this.filesDvm.cell.address.agentId);
199+ if ( this . appletView && this . appletView . type == "main" ) {
200+ this . hvm . probeAll ( GetStrategy . Local ) ;
201+ }
201202 /** Done */
202- this . _offlinePerspectiveloaded = true ;
203+ this . _localPerspectiveloaded = true ;
203204 }
204205
205206
206207 /** */
207208 override async perspectiveInitializedFromNetwork ( ) : Promise < void > {
208209 console . log ( "<files-app>.perspectiveInitializedFromNetwork()" ) ;
209210 if ( this . appletView && this . appletView . type == "main" ) {
210- this . hvm . probeAll ( ) ;
211+ this . hvm . probeAll ( GetStrategy . Network ) ;
211212 }
212- this . _onlinePerspectiveloaded = true ;
213+ this . _networkPerspectiveloaded = true ;
213214 }
214215
215216
216217 /** */
217218 override render ( ) {
218219 console . log ( "<files-app> render()" , this . _loaded , this . _hasHolochainFailed ) ;
219220
220- if ( ! this . _loaded || ! this . _offlinePerspectiveloaded || ! this . _onlinePerspectiveloaded ) {
221+ if ( ! this . _loaded || ! this . _localPerspectiveloaded || ! this . _networkPerspectiveloaded ) {
221222 return html `<sl- spinner> </ sl- spinner> ` ;
222223 }
223224 if ( this . _hasHolochainFailed ) {
0 commit comments