Add in-app privacy policy link to comply with Google Play policies

Also added Setup Guide and Troubleshooting Guide links too.
This commit is contained in:
Cameron Gutman
2022-05-15 15:56:19 -05:00
parent 4dd3b2cfb7
commit 7f2f2056c3
5 changed files with 76 additions and 1 deletions

View File

@@ -232,6 +232,13 @@ public class StreamSettings extends Activity {
category.removePreference(findPreference("checkbox_enable_pip"));
}
// Fire TV apps are not allowed to use WebViews or browsers, so hide the Help category
if (getActivity().getPackageManager().hasSystemFeature("amazon.hardware.fire_tv")) {
PreferenceCategory category =
(PreferenceCategory) findPreference("category_help");
screen.removePreference(category);
}
// Remove the vibration options if the device can't vibrate
if (!((Vibrator)getActivity().getSystemService(Context.VIBRATOR_SERVICE)).hasVibrator()) {
PreferenceCategory category =

View File

@@ -0,0 +1,45 @@
package com.limelight.preferences;
import android.annotation.TargetApi;
import android.content.Context;
import android.os.Build;
import android.preference.Preference;
import android.util.AttributeSet;
import com.limelight.utils.HelpLauncher;
public class WebLauncherPreference extends Preference {
private String url;
public WebLauncherPreference(Context context, AttributeSet attrs, int defStyleAttr) {
super(context, attrs, defStyleAttr);
initialize(attrs);
}
public WebLauncherPreference(Context context, AttributeSet attrs) {
super(context, attrs);
initialize(attrs);
}
@TargetApi(Build.VERSION_CODES.LOLLIPOP)
public WebLauncherPreference(Context context, AttributeSet attrs, int defStyleAttr, int defStyleRes) {
super(context, attrs, defStyleAttr, defStyleRes);
initialize(attrs);
}
private void initialize(AttributeSet attrs) {
if (attrs == null) {
throw new IllegalStateException("WebLauncherPreference must have attributes!");
}
url = attrs.getAttributeValue(null, "url");
if (url == null) {
throw new IllegalStateException("WebLauncherPreference must have 'url' attribute!");
}
}
@Override
public void onClick() {
HelpLauncher.launchUrl(getContext(), url);
}
}

View File

@@ -8,7 +8,7 @@ import android.net.Uri;
import com.limelight.HelpActivity;
public class HelpLauncher {
private static void launchUrl(Context context, String url) {
public static void launchUrl(Context context, String url) {
// Try to launch the default browser
try {
Intent i = new Intent(Intent.ACTION_VIEW);

View File

@@ -227,6 +227,14 @@
<string name="title_enable_post_stream_toast">Show latency message after streaming</string>
<string name="summary_enable_post_stream_toast">Display a latency information message after the stream ends</string>
<string name="category_help">Help</string>
<string name="title_setup_guide">Setup guide</string>
<string name="summary_setup_guide">View instructions on how to set up your gaming PC for streaming</string>
<string name="title_troubleshooting">Troubleshooting guide</string>
<string name="summary_troubleshooting">View tips for diagnosing and fixing common streaming issues</string>
<string name="title_privacy_policy">Privacy policy</string>
<string name="summary_privacy_policy">View Moonlight\'s privacy policy</string>
<!-- Array strings -->
<string name="resolution_360p">360p</string>
<string name="resolution_480p">480p</string>

View File

@@ -206,4 +206,19 @@
android:summary="@string/summary_enable_post_stream_toast"
android:defaultValue="false"/>
</PreferenceCategory>
<PreferenceCategory android:title="@string/category_help"
android:key="category_help">
<com.limelight.preferences.WebLauncherPreference
android:title="@string/title_setup_guide"
android:summary="@string/summary_setup_guide"
url="https://github.com/moonlight-stream/moonlight-docs/wiki/Setup-Guide"/>
<com.limelight.preferences.WebLauncherPreference
android:title="@string/title_troubleshooting"
android:summary="@string/summary_troubleshooting"
url="https://github.com/moonlight-stream/moonlight-docs/wiki/Troubleshooting"/>
<com.limelight.preferences.WebLauncherPreference
android:title="@string/title_privacy_policy"
android:summary="@string/summary_privacy_policy"
url="https://moonlight-stream.org/privacy.html"/>
</PreferenceCategory>
</PreferenceScreen>