Skip to content

Commit

Permalink
Merge remote-tracking branch 'source/release/0.9.5' into wave/rc_from…
Browse files Browse the repository at this point in the history
…_7_8_22_with_0_9_5
  • Loading branch information
hardcoded2 committed Jul 12, 2022
2 parents 932851c + 7c19eab commit f92b00b
Show file tree
Hide file tree
Showing 19 changed files with 490 additions and 55 deletions.
7 changes: 7 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# Wolvic Release Notes

## version 0.9.5
* Restored Firefox Accounts synchronization. You can now sync your bookmarks and send tabs between devices running Firefox and Wolvic.
* Ability to select a default search engine. To change your search engine, open the Settings window, select “Privacy & Security”, and then the “Edit” button that accompanies the “Search engine” option. The engine you have set will appear below the “Search engine” label.
* Added Wolvic's privacy policy.
* Added some changes to address 6DoF controller problems in the latest Huawei VR SDK.
2 changes: 1 addition & 1 deletion app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ android {
applicationId "com.igalia.wolvic"
minSdkVersion build_versions.min_sdk
targetSdkVersion build_versions.target_sdk
versionCode 26
versionCode 28
versionName "0.9.5"
buildConfigField "String", "GIT_HASH", "\"${getGitHash()}\""
buildConfigField "Boolean", "DISABLE_CRASH_RESTART", getCrashRestartDisabled()
Expand Down
42 changes: 36 additions & 6 deletions app/src/common/shared/com/igalia/wolvic/VRBrowserActivity.java
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,7 @@
import com.igalia.wolvic.ui.widgets.WindowWidget;
import com.igalia.wolvic.ui.widgets.Windows;
import com.igalia.wolvic.ui.widgets.dialogs.CrashDialogWidget;
import com.igalia.wolvic.ui.widgets.dialogs.PrivacyPolicyDialogWidget;
import com.igalia.wolvic.ui.widgets.dialogs.PromptDialogWidget;
import com.igalia.wolvic.ui.widgets.dialogs.SendTabDialogWidget;
import com.igalia.wolvic.ui.widgets.dialogs.WhatsNewWidget;
Expand Down Expand Up @@ -372,12 +373,9 @@ public void onWindowVideoAvailabilityChanged(@NonNull WindowWidget aWindow) {

addWidgets(Arrays.asList(mRootWidget, mNavigationBar, mKeyboard, mTray, mWebXRInterstitial));

// Show the what's upp dialog if we haven't showed it yet and this is v6.
if (!SettingsStore.getInstance(this).isWhatsNewDisplayed()) {
mWhatsNewWidget = new WhatsNewWidget(this);
mWhatsNewWidget.setLoginOrigin(Accounts.LoginOrigin.NONE);
mWhatsNewWidget.getPlacement().parentHandle = mWindows.getFocusedWindow().getHandle();
mWhatsNewWidget.show(UIWidget.REQUEST_FOCUS);
// Show the launch dialogs, if needed.
if (!showPrivacyDialogIfNeeded()) {
showWhatsNewDialogIfNeeded();
}

mWindows.restoreSessions();
Expand All @@ -400,6 +398,38 @@ WRuntime.CrashReportIntent getCrashReportIntent() {
return EngineProvider.INSTANCE.getOrCreateRuntime(this).getCrashReportIntent();
}

// Returns true if the dialog was shown, false otherwise.
private boolean showPrivacyDialogIfNeeded() {
if (SettingsStore.getInstance(this).isPrivacyPolicyAccepted()) {
return false;
}

PrivacyPolicyDialogWidget privacyPolicyDialog = new PrivacyPolicyDialogWidget(this);
privacyPolicyDialog.setDelegate(response -> {
if (response) {
SettingsStore.getInstance(this).setPrivacyPolicyAccepted(true);
showWhatsNewDialogIfNeeded();
} else {
// TODO ask for confirmation ("are you really sure that you want to close Wolvic?")
Log.w(LOGTAG, "The user rejected the privacy policy, closing the app.");
finish();
}
});
privacyPolicyDialog.attachToWindow(mWindows.getFocusedWindow());
privacyPolicyDialog.show(UIWidget.REQUEST_FOCUS);
return true;
}

private void showWhatsNewDialogIfNeeded() {
if (SettingsStore.getInstance(this).isWhatsNewDisplayed()) {
return;
}
mWhatsNewWidget = new WhatsNewWidget(this);
mWhatsNewWidget.setLoginOrigin(Accounts.LoginOrigin.NONE);
mWhatsNewWidget.getPlacement().parentHandle = mWindows.getFocusedWindow().getHandle();
mWhatsNewWidget.show(UIWidget.REQUEST_FOCUS);
}

@Override
protected void onStart() {
SettingsStore.getInstance(getBaseContext()).setPid(Process.myPid());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,28 +47,9 @@ public class VRBrowserApplication extends Application implements AppServicesProv
private Addons mAddons;
private ConnectivityReceiver mConnectivityManager;

@Override
public void onCreate() {
super.onCreate();

if (!SystemUtils.isMainProcess(this)) {
// If this is not the main process then do not continue with the initialization here. Everything that
// follows only needs to be done in our app's main process and should not be done in other processes like
// a GeckoView child process or the crash handling process. Most importantly we never want to end up in a
// situation where we create a GeckoRuntime from the Gecko child process.
return;
}

// Fix potential Gecko static initialization order.
// GeckoResult.allow() and GeckoResult.deny() static initializer might get a null mDispatcher
// depending on how JVM classloader does the initialization job.
// See https://github.com/MozillaReality/FirefoxReality/issues/3651
Looper.getMainLooper().getThread();
TelemetryService.init(this);
}

protected void onActivityCreate(@NonNull Context activityContext) {
onConfigurationChanged(activityContext.getResources().getConfiguration());
TelemetryService.init(activityContext);
mAppExecutors = new AppExecutors();
mConnectivityManager = new ConnectivityReceiver(activityContext);
mConnectivityManager.init();
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,97 @@
/* -*- Mode: Java; c-basic-offset: 4; tab-width: 4; indent-tabs-mode: nil; -*-
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */

package com.igalia.wolvic.ui.widgets.dialogs;

import android.content.Context;
import android.content.res.Configuration;
import android.view.LayoutInflater;

import androidx.annotation.NonNull;
import androidx.databinding.DataBindingUtil;

import com.igalia.wolvic.R;
import com.igalia.wolvic.databinding.PrivacyPolicyDialogBinding;
import com.igalia.wolvic.ui.widgets.WidgetPlacement;
import com.igalia.wolvic.ui.widgets.WindowWidget;

/**
* A dialog that displays the Privacy Policy along with two buttons to accept or reject it.
*/
public class PrivacyPolicyDialogWidget extends UIDialog {

public interface Delegate {
void onUserResponse(boolean response);
}

private PrivacyPolicyDialogBinding mBinding;
private Delegate mPrivacyDialogDelegate;

public PrivacyPolicyDialogWidget(Context aContext) {
super(aContext);
initialize(aContext);
}

protected void initialize(Context aContext) {
updateUI();
}

@Override
public void onConfigurationChanged(Configuration newConfig) {
super.onConfigurationChanged(newConfig);
updateUI();
}

public void updateUI() {
removeAllViews();

LayoutInflater inflater = LayoutInflater.from(getContext());

// Inflate this data binding layout
mBinding = DataBindingUtil.inflate(inflater, R.layout.privacy_policy_dialog, this, true);

mBinding.acceptButton.setOnClickListener(v -> {
if (mPrivacyDialogDelegate != null) {
mPrivacyDialogDelegate.onUserResponse(true);
}
onDismiss();
});
mBinding.declineButton.setOnClickListener(v -> {
if (mPrivacyDialogDelegate != null) {
mPrivacyDialogDelegate.onUserResponse(false);
}
onDismiss();
});
}

public void setDelegate(Delegate delegate) {
mPrivacyDialogDelegate = delegate;
}

@Override
public void onWorldClick() {
// ignored: this is a modal dialog
}

@Override
public void attachToWindow(@NonNull WindowWidget window) {
mWidgetPlacement.parentHandle = window.getHandle();
}

@Override
protected void initializeWidgetPlacement(WidgetPlacement aPlacement) {
aPlacement.visible = false;
aPlacement.width = WidgetPlacement.dpDimension(getContext(), R.dimen.settings_dialog_width);
aPlacement.height = WidgetPlacement.dpDimension(getContext(), R.dimen.privacy_options_height);
aPlacement.parentAnchorX = 0.5f;
aPlacement.parentAnchorY = 0.0f;
aPlacement.anchorX = 0.5f;
aPlacement.anchorY = 0.5f;
aPlacement.translationY = WidgetPlacement.unitFromMeters(getContext(), R.dimen.settings_world_y) -
WidgetPlacement.unitFromMeters(getContext(), R.dimen.window_world_y);
aPlacement.translationZ = WidgetPlacement.unitFromMeters(getContext(), R.dimen.settings_world_z) -
WidgetPlacement.unitFromMeters(getContext(), R.dimen.window_world_z);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -68,10 +68,7 @@ protected void updateUI() {
mBinding.footerLayout.setFooterButtonClickListener(v -> resetOptions());

// Options
mBinding.showPrivacyButton.setOnClickListener(v -> {
SessionStore.get().getActiveSession().loadUri(getContext().getString(R.string.private_policy_url));
exitWholeSettings();
});
mBinding.showPrivacyButton.setOnClickListener(v -> mDelegate.showView(SettingViewType.PRIVACY_POLICY));

mBinding.clearCookiesSite.setOnClickListener(v -> {
SessionStore.get().clearCache(
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
package com.igalia.wolvic.ui.widgets.settings;

import android.content.Context;
import android.graphics.Point;
import android.view.LayoutInflater;

import androidx.databinding.DataBindingUtil;

import com.igalia.wolvic.R;
import com.igalia.wolvic.databinding.OptionsPrivacyPolicyBinding;
import com.igalia.wolvic.ui.widgets.WidgetManagerDelegate;
import com.igalia.wolvic.ui.widgets.WidgetPlacement;

/**
* A SettingsView that displays Wolvic's Privacy Policy.
* The content itself is shared with PrivacyPolicyDialogWidget.
*/
public class PrivacyPolicyView extends SettingsView {

private OptionsPrivacyPolicyBinding mBinding;

public PrivacyPolicyView(Context aContext, WidgetManagerDelegate aWidgetManager) {
super(aContext, aWidgetManager);
initialize(aContext);
}

private void initialize(Context aContext) {
updateUI();
}

@Override
protected void updateUI() {
super.updateUI();

LayoutInflater inflater = LayoutInflater.from(getContext());

// Inflate this data binding layout
mBinding = DataBindingUtil.inflate(inflater, R.layout.options_privacy_policy, this, true);

mScrollbar = mBinding.scrollbar;

// Header
mBinding.headerLayout.setBackClickListener(view -> {
mDelegate.showView(SettingViewType.PRIVACY);
});
}

@Override
public Point getDimensions() {
return new Point(WidgetPlacement.dpDimension(getContext(), R.dimen.settings_dialog_width),
WidgetPlacement.dpDimension(getContext(), R.dimen.privacy_options_height));
}

@Override
protected SettingViewType getType() {
return SettingViewType.PRIVACY_POLICY;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,16 @@ public void onHidden() {
@Override
public void onSharedPreferenceChanged(SharedPreferences sharedPreferences, String key) {
if (key.equals(getContext().getString(R.string.settings_key_search_engine_id))) {
int checkedId = mBinding.searchEngineRadio.getCheckedRadioButtonId();
if (checkedId >= 0 && checkedId < mSearchEngines.size()) {
SearchEngine selected = mSearchEngines.get(checkedId);
String storedSearchEngineId = sharedPreferences.getString(key, "");
if (storedSearchEngineId.equals(selected.getIdentifier())) {
// The selected radio button is already the correct one, so we are done.
return;
}
}
// Otherwise, update the UI.
updateUI();
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,8 @@ public enum SettingViewType {
SAVED_LOGINS,
LOGIN_EXCEPTIONS,
LOGIN_EDIT,
SEARCH_ENGINE
SEARCH_ENGINE,
PRIVACY_POLICY
}

protected Delegate mDelegate;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -460,6 +460,9 @@ public void showView(SettingsView.SettingViewType aType, @Nullable Object extras
case SEARCH_ENGINE:
showView(new SearchEngineView(getContext(), mWidgetManager));
break;
case PRIVACY_POLICY:
showView(new PrivacyPolicyView(getContext(), mWidgetManager));
break;
}
}

Expand Down
41 changes: 41 additions & 0 deletions app/src/main/res/layout/options_privacy_policy.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
<?xml version="1.0" encoding="utf-8"?>
<layout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto">

<androidx.constraintlayout.widget.ConstraintLayout
android:id="@+id/optionsLayout"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@drawable/dialog_background"
android:paddingStart="30dp"
android:paddingEnd="30dp">

<com.igalia.wolvic.ui.widgets.settings.SettingsHeader
android:id="@+id/header_layout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:helpVisibility="gone"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:title="@string/settings_privacy_policy" />

<com.igalia.wolvic.ui.views.CustomScrollView
android:id="@+id/scrollbar"
style="@style/customScrollViewStyle"
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_marginTop="10dp"
android:layout_marginBottom="30dp"
android:paddingEnd="30dp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/header_layout">

<include layout="@layout/privacy_policy_content" />

</com.igalia.wolvic.ui.views.CustomScrollView>

</androidx.constraintlayout.widget.ConstraintLayout>
</layout>
Loading

0 comments on commit f92b00b

Please sign in to comment.