Skip to content

Commit

Permalink
Merge pull request #110 from Appsilon/cran-review
Browse files Browse the repository at this point in the history
Address CRAN review comments
  • Loading branch information
kamilzyla committed May 4, 2023
2 parents c1ac1f6 + a97aca4 commit 589bebe
Show file tree
Hide file tree
Showing 11 changed files with 53 additions and 101 deletions.
4 changes: 3 additions & 1 deletion DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Package: shiny.telemetry
Type: Package
Title: Shiny App Usage Telemetry
Title: 'Shiny' App Usage Telemetry
Version: 0.1.0
Authors@R:
c(
Expand All @@ -15,6 +15,8 @@ Description:
such as input changes, browser type, and session duration.
These events can be sent to any of the available storage backends
and analyzed using the included 'Shiny' app to gain insights about app usage and adoption.
URL: https://appsilon.github.io/shiny.telemetry/, https://github.com/Appsilon/shiny.telemetry
BugReports: https://github.com/Appsilon/shiny.telemetry/issues
License: LGPL-3
Encoding: UTF-8
LazyData: true
Expand Down
14 changes: 7 additions & 7 deletions R/auxiliary.R
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,14 @@
#'
#' @return A string with SQL query.
#'
#' @noRd
#' @examples
#'
#' shiny.telemetry:::build_query_sql("table_name")
#' shiny.telemetry:::build_query_sql("table_name", Sys.Date() - 365)
#' shiny.telemetry:::build_query_sql("table_name", date_to = Sys.Date() + 365)
#' shiny.telemetry:::build_query_sql("table_name", Sys.Date() - 365, Sys.Date() + 365)
#' shiny.telemetry:::build_query_sql("table_name", as.Date("2023-04-13"), as.Date("2000-01-01"))
#' shiny.telemetry:::build_query_sql(
#' build_query_sql("table_name")
#' build_query_sql("table_name", Sys.Date() - 365)
#' build_query_sql("table_name", date_to = Sys.Date() + 365)
#' build_query_sql("table_name", Sys.Date() - 365, Sys.Date() + 365)
#' build_query_sql("table_name", as.Date("2023-04-13"), as.Date("2000-01-01"))
#' build_query_sql(
#' "table_name", as.Date("2023-04-13"), as.Date("2000-01-01"), timestamp_wrapper = "to_timestamp"
#' )
build_query_sql <- function(
Expand Down
9 changes: 4 additions & 5 deletions R/data-storage-log-file.R
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,8 @@
#' @export
#'
#' @examples
#' \dontrun{
#' data_storage <- DataStorageLogFile$new(
#' log_file_path = tempfile(pattern = "user_stats", fileext = ".txt")
#' )
#' log_file_path <- tempfile(fileext = ".txt")
#' data_storage <- DataStorageLogFile$new(log_file_path = log_file_path)
#'
#' data_storage$insert("example", "test_event", "session1")
#' data_storage$insert("example", "input", "s1", list(id = "id"))
Expand All @@ -23,7 +21,8 @@
#'
#' data_storage$read_event_data()
#' data_storage$read_event_data(Sys.Date() - 1, Sys.Date() + 1)
#' }
#'
#' file.remove(log_file_path)
DataStorageLogFile <- R6::R6Class( # nolint object_name_linter
classname = "DataStorageLogFile",
inherit = DataStorage,
Expand Down
9 changes: 4 additions & 5 deletions R/data-storage-sqlite.R
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,8 @@
#' @export
#'
#' @examples
#' \dontrun{
#' data_storage <- DataStorageSQLite$new(
#' db_path = tempfile(pattern = "user_stats", fileext = ".sqlite")
#' )
#' db_path <- tempfile(fileext = ".sqlite")
#' data_storage <- DataStorageSQLite$new(db_path = db_path)
#'
#' data_storage$insert("example", "test_event", "session1")
#' data_storage$insert("example", "input", "s1", list(id = "id1"))
Expand All @@ -23,7 +21,8 @@
#'
#' data_storage$read_event_data()
#' data_storage$read_event_data(Sys.Date() - 1, Sys.Date() + 1)
#' }
#'
#' file.remove(db_path)
DataStorageSQLite <- R6::R6Class( # nolint object_name_linter
classname = "DataStorageSQLite",
inherit = DataStorageSQLFamily,
Expand Down
16 changes: 8 additions & 8 deletions R/telemetry.R
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,9 @@
#' @seealso [shiny.telemetry::DataStorage] which this function wraps.
#' @export
#' @examples
#' \dontrun{
#' log_file_path <- tempfile(fileext = ".txt")
#' telemetry <- Telemetry$new(
#' data_storage = DataStorageLogFile$new(
#' log_file_path = tempfile(pattern = "user_stats", fileext = ".txt")
#' )
#' data_storage = DataStorageLogFile$new(log_file_path = log_file_path)
#' )
#'
#' #
Expand All @@ -43,20 +41,22 @@
#'
#' telemetry$data_storage$read_event_data("2020-01-01", "2025-01-01")
#'
#' file.remove(log_file_path)
#'
#' #
#' # Using SQLite
#'
#' db_path <- tempfile(fileext = ".sqlite")
#' telemetry <- Telemetry$new(
#' data_storage = DataStorageSQLite$new(
#' db_path = tempfile(pattern = "telemetry", fileext = ".sqlite")
#' )
#' data_storage = DataStorageSQLite$new(db_path = db_path)
#' )
#'
#' telemetry$log_custom_event("a_button", list(value = 2023), session = session)
#' telemetry$log_custom_event("a_button", list(custom_field = 23), session = session)
#'
#' telemetry$data_storage$read_event_data("2020-01-01", "2025-01-01")
#' }
#'
#' file.remove(db_path)
Telemetry <- R6::R6Class( # nolint object_name_linter
classname = "Telemetry",
public = list(
Expand Down
9 changes: 4 additions & 5 deletions man/DataStorageLogFile.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

12 changes: 1 addition & 11 deletions man/DataStorageSQLFamily.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

9 changes: 4 additions & 5 deletions man/DataStorageSQLite.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

16 changes: 8 additions & 8 deletions man/Telemetry.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

40 changes: 0 additions & 40 deletions man/build_query_sql.Rd

This file was deleted.

16 changes: 10 additions & 6 deletions pkgdown/extra.css
Original file line number Diff line number Diff line change
@@ -1,13 +1,17 @@
:root {
--primary-color: #2f4c36;
}

.navbar {
background-color: #505050 !important;
background-color: var(--primary-color) !important;
}

#navbar > ul.navbar-nav > li.nav-item a:hover {
background-color: #505050 !important;
background-color: var(--primary-color) !important;
}

.navbar-dark .navbar-nav .active>.nav-link {
background-color: #505050 !important;
background-color: var(--primary-color) !important;
color: #fff;
}

Expand All @@ -21,16 +25,16 @@ nav .text-muted {
}

a {
color: #505050;
color: var(--primary-color);
}

a:hover {
color: #2c2b2b;
}

button.btn.btn-primary.btn-copy-ex {
background-color: #505050;
border-color: #505050;
background-color: var(--primary-color);
border-color: var(--primary-color);
}

.home {
Expand Down

0 comments on commit 589bebe

Please sign in to comment.