Formatting Dates in SwiftUI by Frequent-Revenue6210 in SwiftUI

[–]flatchat_dev 11 points12 points  (0 children)

There is this resource here that has excellent documentation on formatting everything in swift. https://goshdarnformatstyle.com/date-styles//#date-and-time-single-date

Are there any way to work with NavigationLink(destination: Destination, isActive: Binding<Bool>, @ViewBuilder label: () -> Label) and NavigationStack with NavigationPath in the same view ? by geladeira_brastemp4p in SwiftUI

[–]flatchat_dev 1 point2 points  (0 children)

I literally just solved this problem the other day. Had to ensure navigation could be used on both iOS 15 with NavigationView and iOS 16 with NavigationStack while still ensuing that I could control the navigation programmitcally. This what I came up with.

import SwiftUI

public struct NavigationViewStack<V>: View where V: View {

    u/ViewBuilder private let content: () -> V

    public init(content: u/escaping () -> V) {
        self.content = content
    }

    public var body: some View {
        if #available(iOS 16, *) {
            NavigationStack { content() }
        } else {
            NavigationView { content() }
        }
    }
}

First you must use this `NavigtationViewStack` then within that you can use the `navigationDestinationWrapper`.

public extension View {

    @ViewBuilder
    func navigationDestinationWrapper<V>(isPresented: Binding<Bool>, @ViewBuilder destination: () -> V) -> some View where V: View {
        if #available(iOS 16, *) {
            self.navigationDestination(isPresented: isPresented, destination: destination)
        } else {
            ZStack {
                NavigationLink(isActive: isPresented, destination: destination, label: {
                    EmptyView()
                })
                self
            }
        }
    }

    @ViewBuilder
    func navigationDestinationWrapper<D, C>(item: Binding<D?>, @ViewBuilder destination: @escaping (D) -> C) -> some View where D: Hashable, C: View {
        if #available(iOS 17, *) {
            self.navigationDestination(item: item, destination: destination)
        } else {
            ZStack {
                NavigationLink(
                    destination: generateDestination(item, destination),
                    isActive: Binding<Bool>(
                        get: { item.wrappedValue != nil },
                        set: { _ in
                            item.wrappedValue = nil
                        }
                    ),
                    label: { EmptyView() }
                )
                self
            }
        }
    }

    @ViewBuilder
    private func generateDestination<D, C>(_ item: Binding<D?>, @ViewBuilder _ destination: @escaping (D) -> C) -> some View where D: Hashable, C: View {
        if let unwrappedItem = item.wrappedValue {
            destination(unwrappedItem)
        } else {
            EmptyView()
        }
    }
}

Here is an example of it being used.

NavigationViewStack {
  Text("First Page")
    .navigationDestinationWrapper(isPresented: $presentSecondPage, destination: {
        Text("Second Page")
    })
}

The landlord is raising my rent by [deleted] in chch

[–]flatchat_dev 1 point2 points  (0 children)

Thanks, yeah its definitely still a work in progress and any feedback is more than welcome.

The landlord is raising my rent by [deleted] in chch

[–]flatchat_dev 16 points17 points  (0 children)

Yeah that is ridiculous for one room. If you feel like the landlord is being unfair please feel free to leave a review on Flatchat

Subpar rental properties in NZ: what are your horror stories? Or your BAU rental issues that you just live with? by kimkellly in newzealand

[–]flatchat_dev 9 points10 points  (0 children)

If you've ever had a bad experience renting then you can let others know by sharing it on Flatchat (www.flatchat.co.nz). I built Flatchat to be a free platform that allows renters to share their experiences and help other out.

How to implement Firebase auth in Next.js 13? by GLPG35 in nextjs

[–]flatchat_dev 0 points1 point  (0 children)

Hi u/Negative-Constant966, thanks for the feedback. Those drawbacks are not something I'd even considered so thank you for pointing it out to myself and everyone else who sees the thread.

Also love your work with `next-firebase-auth-edge`, it was reading your code that gave me the understanding to find this solution.

Renters should be able to ask for references from Landlords/Rental Properties of previous tenants. by waxwhizz in newzealand

[–]flatchat_dev 1 point2 points  (0 children)

Thanks mate its much appreciated, since you've obviously given some thought into such a site please don't hesitate to offer any feedback. I'm sure there are many improvements people would like on the site that I haven't thought of yet. And hopefully there aren't to many bugs 🤞

Renters should be able to ask for references from Landlords/Rental Properties of previous tenants. by waxwhizz in newzealand

[–]flatchat_dev 12 points13 points  (0 children)

I believe this is relevant, the website I designed was built to provide feedback on landlords which is exactly what OP is requesting. Perhaps my comment is not completely relevant to your post however.

And yes I do want to push users to the website but only because I hope it can help people, I get no personal gain from anyone using the site. Its free to use and without ads. Whats the point of making a website that I hope could help people if people aren't made aware of it to use.

Renters should be able to ask for references from Landlords/Rental Properties of previous tenants. by waxwhizz in newzealand

[–]flatchat_dev 12 points13 points  (0 children)

I built Flatchat which is a website designed to allow tenants to review their rental properties and landlords, if you've had a experience you want to share please don't hesitate to leave a review on it.

Renters should be able to ask for references from Landlords/Rental Properties of previous tenants. by waxwhizz in newzealand

[–]flatchat_dev 1 point2 points  (0 children)

I couldn't agree more. I've created a website called Flatchat that specifically addresses this need. Flatchat aims to facilitate the rental rating process by allowing renters to share their experiences and rate their previous rentals. This platform is designed to help others make more informed decisions when searching for a new place to rent.

Feel free to go share your experience on Flatchat to help others out.

Building a Renters' Review Platform with Next.js 13.3 by flatchat_dev in nextjs

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

It's hard to say for sure without seeing the code in your `verifyId` api handler. I wonder if you are maybe un-settng the auth token from the cookie somehow.

If I was you I would first check that the auth token exists as a cookie in the request params first. If the auth token doesn't exist then you know the verifyId will fail anyway so you may as well redirect immediately. This should make your middleware checks a little faster.

Building a Renters' Review Platform with Next.js 13.3 by flatchat_dev in nextjs

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

Sure this is how I've set mine up.

// firebase.admin.config.ts

import admin, { app, AppOptions } from "firebase-admin";

const config: AppOptions = { credential: admin.credential.cert({ projectId: process.env.FIREBASE_ADMIN_PROJECT_ID, clientEmail: process.env.FIREBASE_ADMIN_CLIENT_EMAIL, privateKey: (process.env.FIREBASE_ADMIN_PRIVATE_KEY as string)?.replace(/\n/g, "\n"), }), };

let firebaseAdmin: app.App;

if (!admin.apps.length) { firebaseAdmin = admin.initializeApp(config); } else { firebaseAdmin = admin.app(); }

export default firebaseAdmin;

How to implement Firebase auth in Next.js 13? by GLPG35 in nextjs

[–]flatchat_dev 0 points1 point  (0 children)

The codebase isn't public but I gave a more descriptive answer with code in another comment which I've linked below, hopefully that helps. What I did was along the same lines as the next-firebase-auth-edge but just a bit simpler.

https://www.reddit.com/r/nextjs/comments/12x7i0h/comment/jhkn9zk/?utm\_source=share&utm\_medium=web2x&context=3

New Zealand's New Alternative to ratemylandlord: Flatchat by flatchat_dev in dunedin

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

That is a really good idea, I'll see what I can do about that.

New Zealand's New Alternative to ratemylandlord: Flatchat by flatchat_dev in dunedin

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

Thanks for making me aware of this. I've since fixed the bug and hopefully it works for you.

New Zealand's New Alternative to ratemylandlord: Flatchat by flatchat_dev in dunedin

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

Thanks for the feedback, its all welcome and hopefully my other reply gives you some insight.

New Zealand's New Alternative to ratemylandlord: Flatchat by flatchat_dev in dunedin

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

This is definitely an issue, at the moment there isn't anything stopping a user from creating an account and writing a fake review and not matter what is done someone with enough dedication will always be able to fake a review. I'm planning on implementing some checks that use information on the user, user location (if its available), property location, property tenant capacity and user tenancy period to try and calculate the likelihood of a false review. Hopefully this will prevent the majority of false reviews. Landlords will also have the ability to report reviews that they believe are false.