How to delete cache data after firebase image work is done? i have a camera that takes a photo and then gives that photo a URL like this "file:///data/user/0/host.exp.exponent/cache/ExperienceData/%2540lus%252Fprojectname/Camera/75e75ea1-354f-42ad-9b3b-277414acb3aa.jpg" this URL is generated by "expo-camera" my question is how can I make this URL automatically deletes from user cache without user permission after another firebase URL gets generated by my code logic? how can i make this possible? the purpose of doing this is that the cache URL which is generated by expo-camera loads very fast but my firebase URL takes 6-8 seconds to load and which makes the user experience bad
i am using react native expo how can i make this possible to do that? can i make a auto delte expo url cache
Related
I am using this template for my website and was trying to implement PWA but then realized if I use the code that prevents url sharing the PWA does not work offline. I know this is because the url is not Cashed but I cant cash it because it is based off of the time the page is open'd. Does anyone have a fix? The tutorial I was following is here.
If you want to see my site here is the link.
The problem is the hash fragment. This part of the URL is not passed to the server and therefor not passed to the service worker to cache.
The initial solution I would suggest is to create a current or last response object variable in the service worker within your fetch event handler. Keey that in memory and overwrite it as new documents (HTML) is requested (no need to do this for CSS, scripts, images, etc).
Then when the user wants to do the action you want to cache the current page you can post a message to the service worker to then cache that request. Because this is not really a true response and tied to a timestamp, I would probably cache the page as data in IndexedDB with a timestamp associated with the record.
Not a simple and clean solution, but your problem requirement is sort of an outlier that would require a more complex solution than most.
My application is writing/reading files to/from Google Drive. Before I can access the files I need to get a token that would be passed with the request. I am using googleapis node package.
The flow is as this:
get auth url:
the front end sends request to my api
my api requests the auth url from Google with
(new google.auth.OAuth2(
creds.GoogleDrive.clientId,
creds.GoogleDrive.secret,
'http:localhost:3000/ifr'
)).generateAuthUrl({scope: 'https://www.googleapis.com/auth/drive'});
the received url looks something like this:
https://accounts.google.com/o/oauth2/v2/auth?scope=https%3A%2F%2Fwww.googleapis.com%2Fauth%2Fdrive&response_type=code&client_id=<...>&redirect_uri=http%3A%2F%2Flocalhost%3A3000%2Fifr
this url I return to the front end and set the source of the iframe to it
If a user has already gone before through the steps of consenting to my app accessing their Drive, then google redirects to the provided url, i.e. http:localhost:3000/ifr, in this case, and adds code query sting parameter, which I then pass to my api to get the token from google. This token is later used to create google.drive object that gives access to the drive (this part works fine, though maybe there is a way to avoid going back and forth between client and api?)
If a user hasn't consented yet, then the above url loads google's page where the user has to click through a few confirmation buttons and after they agree to everything, google redirects to http:localhost:3000/ifr?code=.... And this is where I have a problem. In this scenario google's confirmation page wouldn't load in the iframe, it gives me a "broken" page. I don't see a way to distinguish between the url that would load the consent vs the one one that redirects with code, they look the same, so I can't load one in the iframe and the other in parent.
How are these pages different? Why one is ok to be loaded in the iframe and other one isn't? Maybe I am doing this all wrong and the whole authentication can be done server side?
I want to load images from server and want to save into cache.It means i want to load images from server one time and whenever i again want same image it should not be loaded through server for particular time. How can i do this into angular.The problem is related to image caching if one time image is loaded than it should be stored in the cache memory.
Example:- Suppose there are 4 user on portal and each user have their login i want to set cache storage time for each user how can i do this?
Does anyone know if there's a way to upload a file that a user selects (typical HTML-based file input tag) without the current limitation in the SoundCloud API (which seems to be limited to recording local audio)?
I implemented something similar with Vimeo's API which goes something like this:
Get access token to avoid having to use OAuth or require a user to be a Soundcloud user to upload to my account.
Post a request to the API to get an upload token and URL.
Do an HTTP PUT against the upload URL with the file the user selected using HTML5's File API - Note this requires the user to accept the request via headers.
Check upload status (in Vimeo's case, you just re-PUT without data but with the ticket Id which is in the upload URL).
When done, make another API call to finish the process and trigger transcoding.
I'm essentially trying to enable user uploads of audio files and just send the file itself directly to Soundcloud an my account there rather than uploading to my servers and essentially doubling the work by uploading from my server to Soundcloud's.
I see that the SoundCloud JS Api supports PUTs for other tasks. I don't mind manually doing the XHR/Ajax calls directly (I'm using jQuery.ajax) but since the JS SDK hides the process a bit, I don't know how for sure how to approach it, if I can at all.
Anyone try this or happen to know how to make it happen?
This is not possible (for everyone).
In the section "Authenticating without the SoundCloud Connect Screen" on the following soundcloud API docs page:
https://developers.soundcloud.com/docs/api/guide#authentication
It says:
Our Terms of Service specify that you must use the Connect with
SoundCloud screen unless you have made a separate arrangement with us.
So unless you have a deal with soundcloud,
there's no way you can 'automatically' let a program upload sounds (or doing any modification to soundcloud whatsoever) without having to authenticate first.
I've seen a fair amount of stuff about retrieving a Facebook user profile or page via fb:// from within a webpage to direct iOS to open the profile or page in the native Facebook app rather than in the browser on iOS devices. However, I see nothing about how to do so for Facebook status updates.
The behavior I am looking for is to provide a link to a Facebook status on a webpage (HTML5) and when the user clicks on it, to have the user be switched over to Facebook's native app and have the status show up in the app. My question is specific to status updates (sometimes called posts), and not pages or user profiles.
If it helps at all, the link is presented in a Sencha application packaged in PhoneGap/Cordova.
Any help would be much appreciated. I haven't seen anything directly on point around the web.
Isn't a status is just a type of post?
if so, you can find the postid of it and then use "fb://post/(postId)"
The solution is that you need to add userid and an "_" before the actual post id for it to work. most of the data you get back via graph or whatever sdk has the post id as just the single id without the users id and an underscore in front of it.
so it would look like:
fb://post/453453454_34857894375345
first set of numbers being the userid(not an actual one) and the second being the post id(also just random numbers i typed).
haven't tested going from web to native, but just tested it in a native app we made that successfully opens the facebook app to that specific post.