diff --git a/R/class-auth.R b/R/class-auth.R index 467d361..9f2ae58 100644 --- a/R/class-auth.R +++ b/R/class-auth.R @@ -108,6 +108,10 @@ FirebaseAuth <- R6::R6Class( req_sign_out = function(){ user <- private$get_signed_in_checked() private$.user_signed_in <- user + + if(length(user$success)) + return(FALSE) + req(!user$success) }, #' @details Set language code for auth provider @@ -287,10 +291,10 @@ FirebaseAuth <- R6::R6Class( } - now <- as.numeric(Sys.time() + private$.grace_period) + now <- as.numeric(Sys.time() + private$.grace_period) - if(as.numeric(signature$exp) < now){ - cli_alert_danger("Signature expiry is in the past") + if(as.numeric(signature$exp) < now){ + cli_alert_danger("Signature expiry is in the past") if(interactive){ CHOICE <- menu(c("Yes", "No"), title="Do you still want to continue ?") if (CHOICE != TRUE){ @@ -303,8 +307,8 @@ FirebaseAuth <- R6::R6Class( } } - if(as.numeric(signature$iat) > now){ - cli_alert_danger("Signature expiry is in the future") + if(as.numeric(signature$iat) > now){ + cli_alert_danger("Signature expiry is in the future") if(interactive){ CHOICE <- menu(c("Yes", "No"), title="Do you still want to continue ?") if (CHOICE != TRUE){ diff --git a/R/class-core.R b/R/class-core.R index 43c6de2..44b332a 100644 --- a/R/class-core.R +++ b/R/class-core.R @@ -8,8 +8,8 @@ #' #' @export Firebase <- R6::R6Class( - "Firebase", - public = list( + "Firebase", + public = list( session = NULL, #' @details Initialise Firebase #' @@ -19,12 +19,12 @@ Firebase <- R6::R6Class( #' @param session A valid shiny session. #' #' @return Invisibly return the class. - initialize = function( + initialize = function( config_path = "firebase.rds", - session = shiny::getDefaultReactiveDomain() - ){ + session = shiny::getDefaultReactiveDomain() + ){ - conf <- read_config(config_path) + conf <- read_config(config_path) self$session <- session private$.unique_id <- create_unique_id() private$.conf <- conf @@ -32,11 +32,11 @@ Firebase <- R6::R6Class( # namespace private$.namespace(session) - private$.send( - "initialize-core", + private$.send( + "initialize-core", conf = conf - ) - }, + ) + }, #' @details Expose App #' #' Expose the `firebaseApp` object product of `initializeApp()` by @@ -49,8 +49,8 @@ Firebase <- R6::R6Class( print = function(){ cli_rule("Firebase") } - ), - private = list( + ), + private = list( send = function(func, msg = list()){ func <- paste0("fireblaze-", func) msg$ns <- private$.ns @@ -58,14 +58,14 @@ Firebase <- R6::R6Class( }, .send = function(func, ...){ func <- paste0("fireblaze-", func) - msg <- list( - ns = private$.ns, - ... - ) + msg <- list( + ns = private$.ns, + ... + ) self$session$sendCustomMessage(func, msg) }, .render_deps = function(deps){ - private$.send('render-dependencies', deps = deps) + private$.send("render-dependencies", deps = deps) }, get_input = function(name){ name <- paste0("fireblaze_", name) @@ -85,9 +85,9 @@ Firebase <- R6::R6Class( get_project_id = function() { return(invisible(private$.project_id)) }, - .unique_id = NULL, - .ns = "", - .project_id = NULL, - .conf = list() - ) + .unique_id = NULL, + .ns = "", + .project_id = NULL, + .conf = list() + ) ) diff --git a/R/class-social.R b/R/class-social.R index f832075..9d9f64c 100644 --- a/R/class-social.R +++ b/R/class-social.R @@ -52,12 +52,12 @@ FirebaseSocial <- R6::R6Class( #' @param language_code Sets the language to use for the UI. #' Supported languages are listed [here](https://github.com/firebase/firebaseui-web/blob/master/LANGUAGES.md). #' Set to `browser` to use the default browser language of the user. - initialize = function( + initialize = function( persistence = c("session", "local", "memory"), config_path = "firebase.rds", language_code = NULL, session = shiny::getDefaultReactiveDomain() - ){ + ){ super$initialize( persistence, config_path, @@ -67,7 +67,7 @@ FirebaseSocial <- R6::R6Class( super$.render_deps( list(firebase_dep_social()) ) - }, + }, #' @details Define the scope to request from Google. #' @param scope Google scope. #' @return self