RinteRface / shinyMobile

shiny API for Framework7 (IOS/android)
https://shinymobile.rinterface.com
405 stars 74 forks source link

htmlOutput and renderUI problem #139

Open OptimisticWeasel opened 3 years ago

OptimisticWeasel commented 3 years ago

I have been developing mobile compatible "shiny" applications with the help of the package you have developed for about a month. I have not encountered any problems so far. A perfect solution for mobile devices :)

I would have a question about f7Page. Since I don't have a deep technical background in coding I need help :)

For the applications I prepared with the fluidPage() structure, I managed the authentication process with Google FireBase without any problem. I was able to create two different UI’s to manage the situation and choose between these 2 UI’s with the help of the output I prepared on the server-side.

Code is shown below

    isAuth <- reactiveVal(value = FALSE)
    observe({
        if (isAuth() == FALSE) {
            output$screen <- renderUI({
                div(authUI)
            })

        } else if (isAuth() == TRUE) {
            output$screen <- renderUI({
                mainUI()
            })
        }
    })

I defined a isAuth=FALSE at the beginning after the inputs ( username-password )checked by Firebase API isAuth becomes TRUE. With that condition above I swap between mainUI and authUI accordingly

Note that both authUI and mainUI is a function of fluidpage

With two different fluidPage() code worked as I expected. But when i use f7Page(I think since it's not a bootstrap page) I encountered a problem.

At this point how can I call f7Page with in htmlOutput() to display UI conditionally? I couldn't find a way to do it.

Your help is much appreciated

sahilseth commented 3 years ago

Did this get resolved?

I am trying to use firebase pkg from here, it does not solve this issue.

OptimisticWeasel commented 3 years ago

No but I found a great work around for it.

On Thu, 13 May 2021 at 19:00, sahil seth @.***> wrote:

Did this get resolved?

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/RinteRface/shinyMobile/issues/139#issuecomment-840730716, or unsubscribe https://github.com/notifications/unsubscribe-auth/AKWUI2OFOW7H76N2NVOKWYTTNQHVRANCNFSM4UTP7LVA .

sahilseth commented 3 years ago

Would be great if you could share.

firebase package works quite well, but securing the entire app has been tricky

https://firebase.john-coene.com/articles/flow.html


ui = uiOutput("app")

server <- function(input, output){
  f <- FirebaseUI$
          new(persistence = "session")$ # instantiate
          set_providers( # define providers
              email = TRUE, 
              google = TRUE
          )$
          launch() # launch
      print(f)

      # is_signed_in <- reactiveVal(value = FALSE)

      output$app <- renderUI({
          f$req_sign_out()
          # htmlOutput(
          f7Page(
              title = "app",
              useFirebase(), # import dependencies,
              useFirebaseUI(),
          )
          # h2("Please sign in")
      })
}

shinyApp(ui = ui, server = server)