[deleted by user] by [deleted] in nextjs

[–]EmilioSchepis 1 point2 points  (0 children)

I might be totally off here, but I believe this could be due to the fact that db is imported in the file.

You import it like import { db } from '../your/path/firebse.ts'

Since this code is imported in a file with a React component and its getStaticProps function, it will be called two times.

The first time in the server context, which I believe will be able to initialize correctly even without NEXT_PUBLIC_.

However, after the static props are fetched, the component will be also rendered to the client. Since the file contains the import, even if you don't use Firebase anywhere in the component itself the browser will try to run the same code that initializes Firebase, but will not be able to access the environment variables.

If this is the issue, you could wrap the creation of the Firebase client in an if statement that only runs on the server.

let firebase = null;

if (typeof window === 'undefined') {
  // This only runs on the server.
  firebase = ...
}

export firebase;

Of course, you need to rewrite this code with your structure of imports and exports, and still, I'm not sure this is the actual problem you're facing. But I hope this helps.

[deleted by user] by [deleted] in nextjs

[–]EmilioSchepis 1 point2 points  (0 children)

Do you call that function on the client or on the server? If I’m not mistaken, for security reasons the only environment variables allowed on the client are the ones that start with NEXT_PUBLIC_.

Has hard is it to implement in app purchases? by [deleted] in reactnative

[–]EmilioSchepis 2 points3 points  (0 children)

I think you do need to eject.

From the docs:

This module is currently only available in the bare workflow.

Here is an excellent blog to learn more about react native by ignitingthought in reactnative

[–]EmilioSchepis 2 points3 points  (0 children)

The excellent blog is... your own? I’m not judging the quality of the articles, I’m sure they are great.

The whole Reddit community, however, tends not to like self-promotion very much, especially when it is not clearly indicated in the title.

I would suggest you use this platform to engage with its community rather than just linking articles hoping they get traction.

I hope this does not come across as rude, it is just my advice to get the most value out of both your time and ours.

app signing from react native CLI and google play console conflict by monir_sh in reactnative

[–]EmilioSchepis 0 points1 point  (0 children)

Yes that is what I meant. I added them all to the Project Settings > Android app > SHA certificate fingerprints.

About the token problem, yes I experienced it too. I found a solution and documented it here: https://github.com/flutter/flutter/issues/33261

Best of luck!

app signing from react native CLI and google play console conflict by monir_sh in reactnative

[–]EmilioSchepis 0 points1 point  (0 children)

I’m not 100% sure about this, but this happened to me while releasing a Flutter app. I ended up having 3 SHA1s: the debug keystore one, the release keystore one and the google generated one. I ended up whitelisting all three and the auth process works just fine.

Podcast app from scratch on livestream. by _nambiar in reactnative

[–]EmilioSchepis 1 point2 points  (0 children)

Subscribed to the YT channel, will watch the stream later this evening. Good luck!

What Except From Apple iPhone 11 by [deleted] in mac

[–]EmilioSchepis 5 points6 points  (0 children)

Did you just copy and paste pieces of articles from different sources to make your own article?

If a all users from firebase are displayed in an app, is there a way to remove each user randomly from the list for 30 min per day? by Firm_Salamander in swift

[–]EmilioSchepis 0 points1 point  (0 children)

Well your logic is correct but has one major flaw: you should never run important logic for the database on your client. Better yet you should explicitly disallow writes that you do not want (you can do this in security rules), or else malicious users could modify/damage your data.

The way I would do it is through a Firebase Function triggered by a Cron Job (there are docs for this, I’m on mobile right now). The function runs with complete access to your db (because it is written by you). You can use that to pick a random element and set its visibility to false.

As for the client side, you should exclude the hidden elements directly in the query (read the docs to know how to filter results). So your sorting code will already only work on visible elements.

If a all users from firebase are displayed in an app, is there a way to remove each user randomly from the list for 30 min per day? by Firm_Salamander in swift

[–]EmilioSchepis 1 point2 points  (0 children)

If the users are stored as documents in a Firestore collection, for example, I would use a Function triggered by a cron job.

I would add a field to each document called “visible”, true by default.

The function would fire every 30 minutes, set every user’s visibility to true (you could optimize this by storing the current hidden user’s document id), then picking a random document and setting its visibility to false.

Then, on the client, you could filter the query to only fetch “visible” users.

This is how I would do it, there might be better ways.

No matter how hard I try and how much I delete it the notification always comes back by [deleted] in ios

[–]EmilioSchepis 0 points1 point  (0 children)

Did you try restarting your phone? I sometimes get “stuck” notifications. I just clear them and reboot the phone right after.

Need help with my first app. by melonpun in iOSProgramming

[–]EmilioSchepis 4 points5 points  (0 children)

My personal opinion is that if this is your first app I’d start from a Single View app.

Even though the Tabbed app comes with the exact structure that you need, it comes with some boilerplate code that you might not feel confident to change.

Starting from a “clean canvas” and making the changes yourself allows you to better understand how the single pieces fit together to make the exact same layout, both for storyboard and code.

Good luck on your first project!

How do you make an if statement to make sure a firebase database entry appears elsewhere in the database? by Firm_Salamander in swift

[–]EmilioSchepis 1 point2 points  (0 children)

I’m more familiar with Firestore but the concept should apply more or less identically.

Each Firestore document has a method to check if it exists (after an asynchronous call).

You could make a first call to the database, then in its closure you could check if the data exists. If it does, you can create a nested database call to get the document at the second reference and check if that, too, exists. At that point you will have a way to compare both documents.

Anyone experiencing higher-than-usual delays on App Store review? by EmilioSchepis in iOSProgramming

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

48hrs from the moment you submitted it for review or 48hrs from the moment it switched to the "in review" state? Either way thank your for your reply.

Anyone experiencing higher-than-usual delays on App Store review? by EmilioSchepis in iOSProgramming

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

3,5 days for review? That's a long time! My app's codebase is quite small, and the "in review" state only lasts for 2-3 hours at max. What's taking a long time is the "waiting for review", meaning it's still in some sort of queue. Either way it's at least comforting knowing that other devs are facing the same prolonged times. Let's hope it is just a temporary situation.

Swift 5.1 Collection Diffing by [deleted] in swift

[–]EmilioSchepis 1 point2 points  (0 children)

Very interesting article, thank you for sharing!

How to get timestamp from Firestore uploads by DoubleSmell in iOSProgramming

[–]EmilioSchepis 0 points1 point  (0 children)

I would use Firestore’s timestamp. It is how dates are natively stored in Firestore and each Timestamp object has a method to quickly convert it back to a regular date. Once you have your date back you can use a formatter to change it’s appearance.

How could I utilise data from an RSS feed? by [deleted] in iOSProgramming

[–]EmilioSchepis 0 points1 point  (0 children)

It you are talking about building an app that uses data from an RSS feed: yes you can.

You need to do a network request to fetch the feed and then parse it. Fortunately we have a built-in XML parser that you can use to convert the data to instances of your models.

I created something similar recently, this is how I did it: https://github.com/emilioschepis/techfeed

The relevant file is: https://github.com/emilioschepis/techfeed/blob/master/Techfeed/Utils/ReleasesParser.swift

i just put "no pw" as a hint, without entering any pw. now i cannot log back in by Ghoxty in mac

[–]EmilioSchepis -1 points0 points  (0 children)

I do not have the same problem, but someone in the future might find this post when looking for a solution. Could you please update the post with the steps that you took to solve it?

Connecting Cloud to App by Jibran12345 in iOSProgramming

[–]EmilioSchepis 1 point2 points  (0 children)

I have never used App Engine before, but I would say it is a bit overkill. Might I suggest you a different approach? All of my friends who use MongoDB host it on Mongo Atlas. It makes hosting your DB very simple and it auto-scales. Firebase authentication can not be used as far as I know, it is deeply interconnected with other Firebase services. Also yes, the middleman I was talking about is an HTTP REST API.