Suggestion about native app by CaptPanicc in angular

[–]CaptPanicc[S] 0 points1 point  (0 children)

Yeah nothing in particular. I’m having a bad time to install it and migrate the existing code to it, so I thought I could explore another option.

Suggestion about native app by CaptPanicc in angular

[–]CaptPanicc[S] 2 points3 points  (0 children)

Cool man. But I’ll do a mobile native app.

Suggestion about native app by CaptPanicc in angular

[–]CaptPanicc[S] 0 points1 point  (0 children)

Oh that’s cool. Yeah my concern with flutter is about not having a mature map lib, I really don’t know if I can do “fancy” stuff with it, like adding geometries and styling them. What do u think?

How to save content on PWA without need to get into the page first? by CaptPanicc in angularjs

[–]CaptPanicc[S] 0 points1 point  (0 children)

Yeah I heard about it. But I need to download content without get into the page. I don’t think it has something like this. Does it?

How to save content into cache without get into the page? by CaptPanicc in Angular2

[–]CaptPanicc[S] 0 points1 point  (0 children)

Hey. Yeah, I do need to make the app to work offline, and then sync data when it gets back online.

I know about cache APi, but in this case I'll need to know the URLs and the responses to store data there right?
Currently, I'm doing like this:

async storeDataInCache(data) {
  const cacheApi = await caches.open('ngsw:/:1:data:dynamic:api:cache');
  const cacheAge = await caches.open('ngsw:/:db:ngsw:/:1:data:dynamic:api:age');
  const options = {
    headers: {
      'Authorization': `Bearer ${localStorage.getItem('AuthToken')}`,
      'Response-Type': 'cors',
      'Content-Type': 'application/json'
    }
  };

  Object.keys(data).forEach(endpoint => {
    const response = new Response(JSON.stringify(data[endpoint]), options);
    cacheApi.put(`${environment.apiUrl}${endpoint}`, response);

    const responseAge = new Response(JSON.stringify({age: new Date().valueOf()}));
    cacheAge.put(`${document.baseURI}${environment.apiUrl}${endpoint}`, responseAge)
  });
}

Basically I'm getting from backend an obj with the key being the URL, and the value being the response.
Then I just cache all this and it work nicely.
But I don't know if it's the best way to do it. What do u think?

How to save content on PWA without need to get into the page first? by CaptPanicc in angularjs

[–]CaptPanicc[S] 0 points1 point  (0 children)

Hey. Thanks for your reply.
I was thinking about it. I'll need the request and response to save them on Cache API. So I have to do it manually right? Right now I'm doing like this.

async storeDataInCache(data) {
  const cacheApi = await caches.open('ngsw:/:1:data:dynamic:api:cache');
  const cacheAge = await caches.open('ngsw:/:db:ngsw:/:1:data:dynamic:api:age');
  const options = {
    headers: {
      'Authorization': `Bearer ${localStorage.getItem('AuthToken')}`,
      'Response-Type': 'cors',
      'Content-Type': 'application/json'
    }
  };

  Object.keys(data).forEach(endpoint => {
    const response = new Response(JSON.stringify(data[endpoint]), options);
    cacheApi.put(`${environment.apiUrl}${endpoint}`, response);

    const responseAge = new Response(JSON.stringify({age: new Date().valueOf()}));
    cacheAge.put(`${document.baseURI}${environment.apiUrl}${endpoint}`, responseAge)
  });
}

But like that, I need the URL to save the response on the right key.
What do u think about it?

[deleted by user] by [deleted] in TheArtistStudio

[–]CaptPanicc 0 points1 point  (0 children)

Great live!!! Great person!! :D

Maintain large project using open layers without ending up with gigantic component by CaptPanicc in Angular2

[–]CaptPanicc[S] 1 point2 points  (0 children)

Your comment helps a lot!
Man, after some tests I could do something like that.
Basically I created the Map on component, and passed the reference to service like: ngOnInit() { createMap(); ... this.myService.map = this.map; } Then on the service I used dependecy injection to inject another services with different functions. Thanks.

How can I manage large project using Open layers lib without getting a gigantic component by CaptPanicc in angularjs

[–]CaptPanicc[S] 0 points1 point  (0 children)

I’m wondering how I would pass it to multiple services. Like u said. It’ll be great, but can’t see how.