Skip to content
This repository has been archived by the owner on Jun 5, 2020. It is now read-only.

Dev/tim/noodles #196

Open
wants to merge 6 commits into
base: develop
Choose a base branch
from
Open

Dev/tim/noodles #196

wants to merge 6 commits into from

Conversation

tim-dinsdale
Copy link
Contributor

noodly noodly

channelPromise = fin.InterApplicationBus.Channel.connect(SERVICE_CHANNEL, {payload: {version: PACKAGE_VERSION}}).then((channel: ChannelClient) => {
// Register service listeners
channel.register('WARN', (payload: unknown) => console.warn(payload)); // tslint:disable-line:no-any
channelPromise = new Promise<ChannelClient>((resolve, reject) => {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure what we gain from wrapping this in another promise, since the .then will return a promise anyway. You can just make the inner function async and use return/throw instead of resolve/reject.

I know this is more about content than style at the moment, but figure it's worth mentioning.

channel.register('WARN', (payload: unknown) => console.warn(payload)); // tslint:disable-line:no-any
channelPromise = new Promise<ChannelClient>((resolve, reject) => {
fin.System.getRuntimeInfo().then((info: RuntimeInfo & {fdc3AppUuid?: string; fdc3ChannelName?: string}) => {
if (info.fdc3AppUuid && info.fdc3ChannelName) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does this actually work right now, or are you adding these in anticipation of the runtime doing it in a later build?

@@ -15,18 +15,24 @@ import {AppIntent, Context, IntentResolution, Listener} from './main';
import {ChannelId, DefaultChannel, SystemChannel, DisplayMetadata, ChannelWindowAddedEvent, ChannelWindowRemovedEvent, ChannelChangedEvent, ChannelBase, AppChannel} from './contextChannels';
import {FDC3Error} from './errors';

export interface ServiceIdentity{
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why do we need another identity type just for the service? UUID/Name pairs are used all over the place so we should keep it consistent.

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If you do keep it for any reason, brace formatting

Comment on lines +348 to +354
export function getServiceIdentityUUID(): string {
return serviceIdentity.uuid;
}

export function getServiceIdentityName(): string {
return serviceIdentity.name;
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These don't really seem necessary to me. How is getServiceIdentityUUID() any better than getServiceIdentity().uuid?

@@ -18,9 +20,14 @@ export class ChannelHandler {
public readonly onChannelChanged: Signal<[AppConnection, ContextChannel | null, ContextChannel | null], Promise<void>>;

private readonly _model: Model;
private readonly _mrh: MultiRuntimeHandler;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This isn't rust; you can afford to write out an actual variable name.

this._channelHandler.onChannelChanged.add(this.onChannelChangedHandler, this);
}

private async onChannelChangedHandler(connection: AppConnection, channel: ContextChannel | null, previousChannel: ContextChannel | null): Promise<void> {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

on[...]Handler seems a bit redundant. Would make it channelChangeHandler, onChannelChanged, or better yet handleChannelChanged to match the other methods in this class.

}

protected async init(): Promise<void> {
const subMsg = (msg: Msg, sourceUUID: string, sourceName: string) => {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Any particular reason to have this assigned? Could it not just be passed directly into the subscribe call?

@@ -14,6 +14,7 @@ enum Injectable {
EVENT_HANDLER,
INTENT_HANDLER,
MODEL,
MULTI_RUNTIME_HANDLER,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You've added the injectable key, but also need to add a type and a binding for it in injector.ts

type Msg = MsgRequestGetAll | MsgRespondGetAll | MsgSetColorChannel | MsgRegisterAppInChannel | MsgUnregisterAppFromChannel;

@injectable()
export class MultiRuntimeHandler extends AsyncInit {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I know we're just in POC for now, but when we do it for real this should not have any direct fin dependencies, and should instead use the injected Environment to do what it needs to do.

@@ -117,13 +117,13 @@ export class FinEnvironment extends AsyncInit implements Environment {
interface OFManifest {
shortcut?: {name?: string; icon: string};
// eslint-disable-next-line camelcase
startup_app: {uuid: string; name?: string; icon?: string};
startup_app?: {uuid: string; name?: string; icon?: string};
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this really optional? Why did this need changing?

Copy link

@rypete rypete left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@tomrobertsOF marked a few but, what overall what is the reason for the multiple // eslint-disable-line @typescript-eslint/indent? There are a few formatting errors. I'm wondering if a lint will fix both? Ignore me if linting has changed :)

Can we also have a proper title for this PR? It will look nicer in the history when merged

@@ -52,7 +53,7 @@
"openfin-service-async": "^1.0.1",
"openfin-service-config": "1.0.2",
"openfin-service-signal": "^1.0.0",
"openfin-service-tooling": "1.0.21",
"openfin-service-tooling": "1.0.23",
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The latest openfin-service-tooling is version 1.0.25. Can we bring this in as part of this PR (or separate)?

} else {
fin.InterApplicationBus.Channel.connect(getServiceChannel(), {payload: {version: PACKAGE_VERSION}}).then((channel: ChannelClient) => {
// Register service listeners
channel.register('WARN', (payload: unknown) => console.warn(payload)); // tslint:disable-line:no-any
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Still need the // tslint:disable-line:no-any?

@@ -15,18 +15,24 @@ import {AppIntent, Context, IntentResolution, Listener} from './main';
import {ChannelId, DefaultChannel, SystemChannel, DisplayMetadata, ChannelWindowAddedEvent, ChannelWindowRemovedEvent, ChannelChangedEvent, ChannelBase, AppChannel} from './contextChannels';
import {FDC3Error} from './errors';

export interface ServiceIdentity{
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If you do keep it for any reason, brace formatting

source: Identity;
}

interface ChannelState{
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Brace formatting

@@ -18,7 +18,7 @@ const RESOLVER_URL = (() => {
}

// Locate the default resolver HTML page, relative to the location of the provider
return providerLocation.replace('provider.html', 'ui/resolver');
return providerLocation.replace('provider.html', 'ui/resolver/index.html');
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe a silly question, but do we not have index.* be the default document for the server?

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants