Skip to content

Commit

Permalink
Merge pull request #261 from RinteRface/post-release-patch
Browse files Browse the repository at this point in the history
Post release patch
  • Loading branch information
DivadNojnarg authored Jul 17, 2024
2 parents f5eee59 + 44755b6 commit 383e865
Show file tree
Hide file tree
Showing 24 changed files with 90 additions and 55 deletions.
2 changes: 1 addition & 1 deletion DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
Package: shinyMobile
Type: Package
Title: Mobile Ready 'shiny' Apps with Standalone Capabilities
Version: 2.0.0
Version: 2.0.1
Authors@R: c(
person("David", "Granjon", email = "[email protected]", role = c("aut", "cre")),
person("Veerle", "van Leemput", email = "[email protected]", role = "aut"),
Expand Down
7 changes: 7 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
# shinyMobile 2.0.1
## Bug fixes and improvements
- Change appearance of PWA install button: center text and add close button.
- Fix #262: add infinite class to `f7Progress` when value is `NULL`.
- Attach Framework7 to the window object: `window.Framework7 = Framework7`.
- Fix installation issue on older R versions [#260](https://github.com/RinteRface/shinyMobile/issues/260).

# shinyMobile 2.0.0
## Major change
- Update Framework7 from 5.7.14 to 8.3.3
Expand Down
2 changes: 1 addition & 1 deletion R/f7-inputs.R
Original file line number Diff line number Diff line change
Expand Up @@ -1756,7 +1756,7 @@ createOptions <- function(
f7Form <- function(id, ...) {
inputs <- list(...)
# All inputs must have a name + no binding
inputs <- lapply(inputs, \(input) {
inputs <- lapply(inputs, function(input) {
# Test for different input types
valid_inputs <- c("input", "textarea", "select")
target <- NULL
Expand Down
2 changes: 1 addition & 1 deletion R/f7Button.R
Original file line number Diff line number Diff line change
Expand Up @@ -193,7 +193,7 @@ f7Segment <- function(
# the segment, if not already done.
btns <- list(...)
if (rounded) {
btns <- lapply(btns, \(btn) {
btns <- lapply(btns, function(btn) {
is_rounded <- grepl("button-round", btn$attribs$class)
if (!is_rounded) {
btn <- tagAppendAttributes(btn, class = "button-round")
Expand Down
1 change: 1 addition & 0 deletions R/f7Progress.R
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ f7Progress <- function(id, value = NULL, color) {
stopifnot(value >= 0, value <= 100)
}
progressCl <- "progressbar"
if (is.null(value)) progressCl <- paste0(progressCl, "-infinite")
if (!is.null(color)) progressCl <- paste0(progressCl, " color-", color)

shiny::tags$div(
Expand Down
4 changes: 2 additions & 2 deletions R/shinyMobile-dependencies.R
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@
add_shinyMobile_deps <- function(tag) {
shinyMobile_deps <- htmlDependency(
name = "shinyMobile",
version = "2.0.0",
src = c(file = "shinyMobile-2.0.0"),
version = "2.0.1",
src = c(file = "shinyMobile-2.0.1"),
script = "dist/shinyMobile.min.js",
stylesheet = "dist/shinyMobile.min.css",
package = "shinyMobile",
Expand Down
2 changes: 1 addition & 1 deletion R/utils.R
Original file line number Diff line number Diff line change
Expand Up @@ -243,7 +243,7 @@ create_app_link <- function(
#' @keywords internal
#' @noRd
change_id <- function(items, ns) {
lapply(items, \(item) {
lapply(items, function(item) {
full_ns <- ns(character(0))
tmp <- strsplit(as.character(item), "\n")[[1]]
outer_ns <- strsplit(full_ns, "-")[[1]][1]
Expand Down
1 change: 1 addition & 0 deletions _pkgdown.yml
Original file line number Diff line number Diff line change
Expand Up @@ -286,6 +286,7 @@ navbar:

news:
releases:
- text: "shinyMobile 2.0.1"
- text: "shinyMobile 2.0.0"
- text: "shinyMobile 1.0.1"
- text: "shinyMobile 1.0.0"
Expand Down
2 changes: 1 addition & 1 deletion esbuild.prod.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import autoprefixer from 'autoprefixer';
esbuild
.build({
entryPoints: ['./srcjs/main.js'],
outdir: "inst/shinyMobile-2.0.0/dist",
outdir: "inst/shinyMobile-2.0.1/dist",
entryNames: "shinyMobile.min",
bundle: true,
format: "esm",
Expand Down
5 changes: 5 additions & 0 deletions inst/examples/progress/app.R
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ app <- shinyApp(
title = "Update Progress",
f7SingleLayout(
navbar = f7Navbar(title = "f7Progress"),
f7BlockTitle("Progress with value"),
f7Block(
f7Progress(id = "pg1", value = 10, color = "blue")
),
Expand All @@ -16,6 +17,10 @@ app <- shinyApp(
min = 0,
value = 50,
scale = TRUE
),
f7BlockTitle("Infinite progress"),
f7Block(
f7Progress(id = "pg2", value = NULL, color = "red")
)
)
),
Expand Down
2 changes: 1 addition & 1 deletion inst/examples/update_entity/app.R
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ app <- shinyApp(
f7BlockTitle("Swiper", size = "large"),
f7Swiper(
id = "swiper",
lapply(1:20, \(c) {
lapply(1:20, function(c) {
f7Slide(
f7Card(
title = sprintf("Slide %s", c)
Expand Down

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

5 changes: 5 additions & 0 deletions man/progress.Rd

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

2 changes: 1 addition & 1 deletion man/updateF7Entity.Rd

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

11 changes: 7 additions & 4 deletions srcjs/helpers/helpers-pwa.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,12 @@
// Create custom install UI
let installToast = app.toast.create({
position: 'center',
text: '<button id="install-button" class="toast-button button color-green">Install</button>',
text: '<button id="install-button" style="margin:0;" class="toast-button button color-green">Install</button>',
closeButton: true,
closeButtonText: 'Dismiss',
closeButtonColor: 'red',
});

let deferredPrompt;
// Handle install event
$(window).on('beforeinstallprompt', (e) => {
Expand All @@ -15,7 +18,7 @@
// Show install trigger
installToast.open();
});

// Installation must be done by a user gesture!
// close toast whenever a choice is made ... Give time
// to the toast to be created before event registration.
Expand All @@ -38,4 +41,4 @@
});
});
}, 500);
};
};
13 changes: 9 additions & 4 deletions srcjs/init.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ $( document ).ready(function() {
// Only for f7MultiLayout.
let hasRouter = $(".view-main").attr("data-browser-history") !== undefined;
if (hasRouter) {
// Remove content of the first page
// Remove content of the first page
// to prevent shiny from binding any input
// Because we reload the page content via the router, it will
// be reincluded automatically. This avoids duplicated
Expand All @@ -42,12 +42,12 @@ $( document ).ready(function() {
// to another page and moving back.
mainView.router.navigate(
window.location.pathname,
// Doc -> reloadCurrent: true:
// replace the current page with the new one from route,
// Doc -> reloadCurrent: true:
// replace the current page with the new one from route,
// no animation in this case
{reloadCurrent: true}
);

// For some reasons, the navbars get duplicated entries.
// We remove the first one.
$(document).on('shiny:sessioninitialized', function() {
Expand Down Expand Up @@ -75,3 +75,8 @@ $( document ).ready(function() {
export function getAppInstance() {
return app;
}

// attach Framework7 to the window object
// allows usage in browser at later stage (e.g. for offline PWA page)
window.Framework7 = Framework7;

Binary file modified tests/testthat/_snaps/f7Progress/progress-app-001_.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified tests/testthat/_snaps/f7Progress/progress-app-002_.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion tests/testthat/test-f7List.R
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ test_that("list group works", {
expect_s3_class(f7ListGroup(title = "plop"), "shiny.tag")
list_group <- f7ListGroup(
title = "test",
lapply(1:3, \(x) f7ListItem(x))
lapply(1:3, function(x) f7ListItem(x))
)
expect_identical(list_group$attribs$class, "list-group")
})
Expand Down
8 changes: 8 additions & 0 deletions tests/testthat/test-f7Progress.R
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,14 @@ test_that("f7Progress works", {
expect_identical(progress$attribs$`data-progress`, 100)
})

test_that("infinite f7Progress works", {
progress <- f7Progress(id = "progress", value = NULL, "red")
expect_s3_class(progress, "shiny.tag")
expect_identical(progress$attribs$class, "progressbar-infinite color-red")
expect_identical(progress$attribs$id, "progress")
expect_identical(progress$attribs$`data-progress`, NULL)
})

test_that("updateF7Progress function work", {
session <- as.environment(list(
ns = identity,
Expand Down
4 changes: 2 additions & 2 deletions vignettes/update-app.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -865,7 +865,7 @@ There are many options to customize the `f7Swiper()` component. Note that on des
```{r, eval=TRUE, echo=FALSE}
card(
shinyMobile:::create_app_link(
"NobwRAdghgtgpmAXGKAHVA6ASmANGAYwHsIAXOMpMAdzgCMAnRRAVwhiLdIAoAdMAPQsAzgwEAbAJZ0BWCdIZQGATwHCAFpIjKAskTqTxcfgEpeEWo2ZbhpKOPF8IAAmf8NW3fsPG851wxwqETCzgC8zgR8YOqkpKjCiAICDFrkDABmUARwGADmkqTqLHQYkkQpaXCZ2XAAtNRQwjB1BIoQAqbmZhDmUoxKytwe2j39iirDmtp6BkY95iPKAILoTq4skuHOGQDsAApQeXDrrs6khUbb-ADK1JKo1fy4-md7N1p5RgAyUMqcPFeZ2c0AAbnQlNs9gA5KDgpTcC6kK4Rfjve6PBimF4uYE7XY3OB5eBkU54-EAIRYcRIZPJzi0qGpAEkACbXMAsVCsqDkZ5A+niKB0ODiDkAVW5vN8AuBJhx9Mp1NItNleMZLPZqLAgWEcFI-NxiqFIrF2qwcD1BrAatcPXJ8rV6Ie1TpwMkWrcYGEGKefiNeKIqAuJFCESktjdeLBkjyvPKLnDkkjtrxFGFRk9ADFlt8bgBRVN2hWK5yoI5aeMkbYRwEBxXpuiZ7YAFSw4vzJdLzlFHIwPpdDDq5YK0BDvTwbnr9IIUgIAGsM3BW+3C9O5anHevnEL0OIhgBGRAAJgADLg3LxuAQTM4QEX8TcpKyTg-XHsAMJKVlRxVIlHOMIqCpGQGTRE+HrLgApMIzyRPa3bOAhirIXiAC+qF2gKCFbq4eoMKC1RQmwBDjtwGqkBeAJMqQt73gG+j4YR+aEaSFEACRcjy5AXvR5JcdKWa7PmZCFEMqbuL6WL+oqQbjmGO7JnW3ZAXAcCegep7ng+wjPpa+zVAAapIcD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QTM4QEX8TcpKyTk-XHsAMJKVlRxVIiizjCKgqRkBk0Qvh6y4AKTCM8kT2t2zhIYqqF4gAvuhdoCkhW6uHqDCgtUUJXjeGqkBeAJMqQ96PgG+iEcR+bEaSFEACRcjy5AXvR5JcdKWa7PmZCFEMqbuL6WL+oqQbjmGO7JnW3YgXAcCegep7nk+wivpa+zVAAapIcDUNsx5dvSIG1BS+q0BQ2yaZZ5JQNSQZCsoK4ds5eLCG0RAOBCDA1kp-5ptATbqdsOZ5mu3b4aWI6VuOIUptuwKkMojwcqBRB5LqwhBYayE9hFzYRG2HZPglir5R6qXKchGSGGaXrEOILAwBA8EychDBENQCkACzVZuaroVhAoCox1TMaxPAcbq+q8WqAnkEJIlIuJ26SYOxX0nJCYKbWYUEY8UURENWk+cCunQcIBkMMZpkcq5Kr7Yq1k5LZpD2YmzgAKzaelzhve5fzRbmBY3Wcfn9YFkJJmlJWNuVziVXFpY1fSSVjgmDWnWcmXZdqdAsA4+o9TDwKoxd6OrtV1POHVnonR+OwtRy7WdROTMBANCkHqN27YShAqTbiGHdGAGEALpAA", # nolint
"app",
header = FALSE
),
Expand Down Expand Up @@ -911,7 +911,7 @@ shinyApp(
clickable = TRUE
)
),
lapply(1:20, \(c) {
lapply(1:20, function(c) {
f7Slide(
f7Card(
title = sprintf("Slide %s", c)
Expand Down

0 comments on commit 383e865

Please sign in to comment.