meumobi / mmb-media-provider

MIT License
0 stars 0 forks source link

Refactor to solve inconsitences #2

Open danconte72 opened 5 years ago

danconte72 commented 5 years ago

Function Names

Based on ng-meumobi-utils/Files public functions the names of functions are different

      service.download = download;
      service.decorateFile = decorateFile;
      service.remove = remove;
      service.list = api.getFilesFromLocalStorage;
      service.open = open;

should update openFile to open

Behavior

Update to be an Observable Data Service

Interface

Add the medium interface to project

export interface Medium {
    url: string;
    type: string;
    extension: string;
    status?: string,
    behavior?: {
        label: "string",
        icon: "string",
        download: string,
    },
    name?: string;
    path?: string;
    fullPath?: string;
}

references

vdias38 commented 5 years ago

Naming inconsistency

Why "remove download" and "open medium" ? both are not manipulating same item (local file). You maintain inconsistency on naming.

The service handle 2 types of media: remote and local. For each type you associate actions:

Maybe we should separate concerns and create 2 services to handle file-transfer and local-media-persistence, as done with AuthService and AuthPersistenceService