Merge pull request #8409 from tclaus/add_app_smart_banner
Add app smart banner to web site when using an iOS device
This commit is contained in:
commit
ce32a7d16b
4 changed files with 40 additions and 0 deletions
|
|
@ -70,6 +70,7 @@ We use yarn to install the frontend dependencies now, so you need to have that i
|
|||
* Allow to select multiple aspects when posting on mobile [#8217](https://github.com/diaspora/diaspora/pull/8217)
|
||||
* Add info links to drawer in mobile UI [#8405](https://github.com/diaspora/diaspora/pull/8405)
|
||||
* Tell users that there is no help in mobile version, allow to switch to desktop [#8407](https://github.com/diaspora/diaspora/pull/8407)
|
||||
* Add Smart App Banner on iOS devices [#8409](https://github.com/diaspora/diaspora/pull/8409)
|
||||
|
||||
# 0.7.18.1
|
||||
|
||||
|
|
|
|||
|
|
@ -13,6 +13,14 @@ module ApplicationHelper
|
|||
AppConfig.version.number
|
||||
end
|
||||
|
||||
def uri_with_username
|
||||
if user_signed_in?
|
||||
AppConfig.pod_uri + "?username=#{current_user.username}"
|
||||
else
|
||||
AppConfig.pod_uri
|
||||
end
|
||||
end
|
||||
|
||||
def changelog_url
|
||||
return AppConfig.settings.changelog_url.get if AppConfig.settings.changelog_url.present?
|
||||
|
||||
|
|
|
|||
|
|
@ -6,6 +6,7 @@
|
|||
%html{lang: I18n.locale.to_s, dir: (rtl? ? "rtl" : "ltr")}
|
||||
%head{prefix: og_prefix}
|
||||
%meta{name: "viewport", content: "width=device-width, initial-scale=1"}/
|
||||
%meta{name: "apple-itunes-app", content: "app-id=1538074832, app-argument=#{uri_with_username}"}
|
||||
|
||||
- content_for :javascript do
|
||||
= javascript_include_tag :main
|
||||
|
|
|
|||
|
|
@ -165,4 +165,34 @@ describe ApplicationHelper, :type => :helper do
|
|||
expect(pod_version).to match "0.0.1.0"
|
||||
end
|
||||
end
|
||||
|
||||
describe "#uri_with_username" do
|
||||
attr_reader :current_user
|
||||
|
||||
before do
|
||||
@current_user = alice
|
||||
def user_signed_in?
|
||||
true
|
||||
end
|
||||
end
|
||||
|
||||
it "displays the pod uri and username if logged in" do
|
||||
allow(AppConfig).to receive(:pod_uri) { "https://diaspora.social" }
|
||||
expect(uri_with_username).to match "https://diaspora.social?username=alice"
|
||||
end
|
||||
end
|
||||
|
||||
describe "#uri_with_username without logged in user" do
|
||||
before do
|
||||
@current_user = alice
|
||||
def user_signed_in?
|
||||
false
|
||||
end
|
||||
end
|
||||
|
||||
it "displays the pod uri" do
|
||||
allow(AppConfig).to receive(:pod_uri) { "https://diaspora.social" }
|
||||
expect(uri_with_username).to match "https://diaspora.social"
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
|||
Loading…
Reference in a new issue