Browse Source

remove location support and its permission, update strings

master
R4SAS 6 years ago
parent
commit
b7e51d4886
  1. 8
      README.md
  2. 7
      app/src/main/AndroidManifest.xml
  3. BIN
      app/src/main/assets/lightning.png
  4. 9
      app/src/main/java/org/purplei2p/lightning/preference/PreferenceManager.java
  5. 7
      app/src/main/java/org/purplei2p/lightning/settings/fragment/PrivacySettingsFragment.java
  6. 48
      app/src/main/java/org/purplei2p/lightning/view/LightningChromeClient.java
  7. 19
      app/src/main/java/org/purplei2p/lightning/view/LightningView.java
  8. 39
      app/src/main/res/values-ru/strings.xml
  9. 14
      app/src/main/res/values/strings.xml
  10. 11
      app/src/main/res/xml/preference_about.xml
  11. 4
      app/src/main/res/xml/preference_privacy.xml

8
README.md

@ -1,10 +1,10 @@ @@ -1,10 +1,10 @@
# Lightning Browser
# Lightning Browser I2P
#### Speed, Simplicity, Security
![](ic_launcher_small.png)
#### About fork
That fork of Lightning Browser aims on native support of I2P without ability go clearnet sites.
That fork of Lightning Browser aims on native support of I2P without ability go clearnet sites (if not used outproxy).
#### Features
* Bookmarks
@ -29,8 +29,6 @@ That fork of Lightning Browser aims on native support of I2P without ability go @@ -29,8 +29,6 @@ That fork of Lightning Browser aims on native support of I2P without ability go
* ````READ_EXTERNAL_STORAGE````: For downloading files from the browser
* ````ACCESS_FINE_LOCATION````: For sites like Google Maps, it is disabled by default in settings and displays a pop-up asking if a site may use your location when it is enabled
* ````ACCESS_NETWORK_STATE````: Required for the WebView to function by some OEM versions of WebKit
#### The Code
@ -49,7 +47,7 @@ Lightning Browser @@ -49,7 +47,7 @@ Lightning Browser
http://mozilla.org/MPL/2.0/
Coryright 2018 PurpleI2P
Copyright 2018 PurpleI2P
Fork of Lightning Browser with same license
```

7
app/src/main/AndroidManifest.xml

@ -8,18 +8,11 @@ @@ -8,18 +8,11 @@
<uses-permission android:name="android.permission.INTERNET"/>
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE"/>
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION"/>
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>
<uses-permission android:name="com.android.browser.permission.READ_HISTORY_BOOKMARKS"/>
<uses-permission android:name="com.android.browser.permission.WRITE_HISTORY_BOOKMARKS"/>
<uses-permission android:name="com.android.launcher.permission.INSTALL_SHORTCUT"/>
<uses-feature
android:name="android.hardware.location.gps"
android:required="false"/>
<uses-feature
android:name="android.hardware.location"
android:required="false"/>
<uses-feature
android:name="android.hardware.touchscreen"
android:required="false"/>

BIN
app/src/main/assets/lightning.png

Binary file not shown.

Before

Width:  |  Height:  |  Size: 21 KiB

After

Width:  |  Height:  |  Size: 23 KiB

9
app/src/main/java/org/purplei2p/lightning/preference/PreferenceManager.java

@ -24,7 +24,6 @@ public class PreferenceManager { @@ -24,7 +24,6 @@ public class PreferenceManager {
static final String HOMEPAGE = "home";
static final String INCOGNITO_COOKIES = "incognitocookies";
static final String JAVASCRIPT = "java";
static final String LOCATION = "location";
static final String OVERVIEW_MODE = "overviewmode";
static final String POPUPS = "newwindows";
static final String RESTORE_LOST_TABS = "restoreclosed";
@ -161,10 +160,6 @@ public class PreferenceManager { @@ -161,10 +160,6 @@ public class PreferenceManager {
return mPrefs.getBoolean(Name.JAVASCRIPT, true);
}
public boolean getLocationEnabled() {
return mPrefs.getBoolean(Name.LOCATION, false);
}
public boolean getOverviewModeEnabled() {
return mPrefs.getBoolean(Name.OVERVIEW_MODE, true);
}
@ -372,10 +367,6 @@ public class PreferenceManager { @@ -372,10 +367,6 @@ public class PreferenceManager {
putBoolean(Name.JAVASCRIPT, enable);
}
public void setLocationEnabled(boolean enable) {
putBoolean(Name.LOCATION, enable);
}
public void setOverviewModeEnabled(boolean enable) {
putBoolean(Name.OVERVIEW_MODE, enable);
}

7
app/src/main/java/org/purplei2p/lightning/settings/fragment/PrivacySettingsFragment.java

@ -32,7 +32,6 @@ import org.purplei2p.lightning.view.LightningView; @@ -32,7 +32,6 @@ import org.purplei2p.lightning.view.LightningView;
public class PrivacySettingsFragment extends LightningPreferenceFragment implements Preference.OnPreferenceClickListener, Preference.OnPreferenceChangeListener {
private static final String SETTINGS_LOCATION = "location";
private static final String SETTINGS_THIRDPCOOKIES = "third_party";
private static final String SETTINGS_SAVEPASSWORD = "password";
private static final String SETTINGS_CACHEEXIT = "clear_cache_exit";
@ -68,7 +67,6 @@ public class PrivacySettingsFragment extends LightningPreferenceFragment impleme @@ -68,7 +67,6 @@ public class PrivacySettingsFragment extends LightningPreferenceFragment impleme
Preference clearcookies = findPreference(SETTINGS_CLEARCOOKIES);
Preference clearwebstorage = findPreference(SETTINGS_CLEARWEBSTORAGE);
CheckBoxPreference cblocation = (CheckBoxPreference) findPreference(SETTINGS_LOCATION);
CheckBoxPreference cb3cookies = (CheckBoxPreference) findPreference(SETTINGS_THIRDPCOOKIES);
CheckBoxPreference cbsavepasswords = (CheckBoxPreference) findPreference(SETTINGS_SAVEPASSWORD);
CheckBoxPreference cbcacheexit = (CheckBoxPreference) findPreference(SETTINGS_CACHEEXIT);
@ -83,7 +81,6 @@ public class PrivacySettingsFragment extends LightningPreferenceFragment impleme @@ -83,7 +81,6 @@ public class PrivacySettingsFragment extends LightningPreferenceFragment impleme
clearcookies.setOnPreferenceClickListener(this);
clearwebstorage.setOnPreferenceClickListener(this);
cblocation.setOnPreferenceChangeListener(this);
cb3cookies.setOnPreferenceChangeListener(this);
cbsavepasswords.setOnPreferenceChangeListener(this);
cbcacheexit.setOnPreferenceChangeListener(this);
@ -93,7 +90,6 @@ public class PrivacySettingsFragment extends LightningPreferenceFragment impleme @@ -93,7 +90,6 @@ public class PrivacySettingsFragment extends LightningPreferenceFragment impleme
cbDoNotTrack.setOnPreferenceChangeListener(this);
cbIdentifyingHeaders.setOnPreferenceChangeListener(this);
cblocation.setChecked(mPreferenceManager.getLocationEnabled());
cbsavepasswords.setChecked(mPreferenceManager.getSavePasswordsEnabled());
cbcacheexit.setChecked(mPreferenceManager.getClearCacheExit());
cbhistoryexit.setChecked(mPreferenceManager.getClearHistoryExitEnabled());
@ -224,9 +220,6 @@ public class PrivacySettingsFragment extends LightningPreferenceFragment impleme @@ -224,9 +220,6 @@ public class PrivacySettingsFragment extends LightningPreferenceFragment impleme
@Override
public boolean onPreferenceChange(@NonNull Preference preference, Object newValue) {
switch (preference.getKey()) {
case SETTINGS_LOCATION:
mPreferenceManager.setLocationEnabled((Boolean) newValue);
return true;
case SETTINGS_THIRDPCOOKIES:
mPreferenceManager.setBlockThirdPartyCookiesEnabled((Boolean) newValue);
return true;

48
app/src/main/java/org/purplei2p/lightning/view/LightningChromeClient.java

@ -13,14 +13,11 @@ import android.support.annotation.Nullable; @@ -13,14 +13,11 @@ import android.support.annotation.Nullable;
import android.support.v7.app.AlertDialog;
import android.view.LayoutInflater;
import android.view.View;
import android.webkit.GeolocationPermissions;
import android.webkit.ValueCallback;
import android.webkit.WebChromeClient;
import android.webkit.WebView;
import com.anthonycr.bonsai.Schedulers;
import com.anthonycr.grant.PermissionsManager;
import com.anthonycr.grant.PermissionsResultAction;
import javax.inject.Inject;
@ -33,8 +30,6 @@ import org.purplei2p.lightning.utils.Preconditions; @@ -33,8 +30,6 @@ import org.purplei2p.lightning.utils.Preconditions;
public class LightningChromeClient extends WebChromeClient {
private static final String[] PERMISSIONS = new String[]{Manifest.permission.ACCESS_FINE_LOCATION};
@NonNull private final Activity mActivity;
@NonNull private final LightningView mLightningView;
@NonNull private final UIController mUIController;
@ -92,49 +87,6 @@ public class LightningChromeClient extends WebChromeClient { @@ -92,49 +87,6 @@ public class LightningChromeClient extends WebChromeClient {
}
}
@Override
public void onGeolocationPermissionsShowPrompt(@NonNull final String origin,
@NonNull final GeolocationPermissions.Callback callback) {
PermissionsManager.getInstance().requestPermissionsIfNecessaryForResult(mActivity, PERMISSIONS, new PermissionsResultAction() {
@Override
public void onGranted() {
final boolean remember = true;
AlertDialog.Builder builder = new AlertDialog.Builder(mActivity);
builder.setTitle(mActivity.getString(R.string.location));
String org;
if (origin.length() > 50) {
org = origin.subSequence(0, 50) + "...";
} else {
org = origin;
}
builder.setMessage(org + mActivity.getString(R.string.message_location))
.setCancelable(true)
.setPositiveButton(mActivity.getString(R.string.action_allow),
new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int id) {
callback.invoke(origin, true, remember);
}
})
.setNegativeButton(mActivity.getString(R.string.action_dont_allow),
new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int id) {
callback.invoke(origin, false, remember);
}
});
AlertDialog alert = builder.create();
alert.show();
BrowserDialog.setDialogSize(mActivity, alert);
}
@Override
public void onDenied(String permission) {
//TODO show message and/or turn off setting
}
});
}
@Override
public boolean onCreateWindow(WebView view, boolean isDialog, boolean isUserGesture,
Message resultMsg) {

19
app/src/main/java/org/purplei2p/lightning/view/LightningView.java

@ -292,12 +292,6 @@ public class LightningView { @@ -292,12 +292,6 @@ public class LightningView {
sHomepage = mPreferences.getHomepage();
setColorMode(mPreferences.getRenderingMode());
if (!mIsIncognitoTab) {
settings.setGeolocationEnabled(mPreferences.getLocationEnabled());
} else {
settings.setGeolocationEnabled(false);
}
setUserAgent(context, mPreferences.getUserAgentChoice());
if (mPreferences.getSavePasswordsEnabled() && !mIsIncognitoTab) {
@ -429,19 +423,6 @@ public class LightningView { @@ -429,19 +423,6 @@ public class LightningView {
}
});
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.N) {
getPathObservable("geolocation").subscribeOn(Schedulers.io())
.observeOn(Schedulers.main())
.subscribe(new SingleOnSubscribe<File>() {
@Override
public void onItem(@Nullable File item) {
Preconditions.checkNonNull(item);
//noinspection deprecation
settings.setGeolocationDatabasePath(item.getPath());
}
});
}
getPathObservable("databases").subscribeOn(Schedulers.io())
.observeOn(Schedulers.main())
.subscribe(new SingleOnSubscribe<File>() {

39
app/src/main/res/values-ru/strings.xml

@ -1,5 +1,5 @@ @@ -1,5 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<resources xmlns:tools="http://schemas.android.com/tools" tools:ignore="MissingTranslation">
<string name="app_name">Молния I2P</string>
<string name="action_new_tab">Создать вкладку</string>
<string name="action_share">Отправить ссылку</string>
@ -10,7 +10,6 @@ @@ -10,7 +10,6 @@
<string name="action_copy">Копировать ссылку</string>
<string name="action_forward">Вперёд</string>
<string name="settings">Настройки</string>
<string name="location">Местоположение</string>
<string name="password">Сохранять пароли</string>
<string name="agent">User Agent</string>
<string name="home">Новая вкладка</string>
@ -56,6 +55,7 @@ @@ -56,6 +55,7 @@
<string name="title_search_engine">Поисковая система</string>
<string name="action_ok">OK</string>
<string name="dialog_download">Загрузить файл? (%1$s)</string>
<string name="unknown_size">Размер неизвестен</string>
<string name="action_cancel">Отмена</string>
<string name="title_warning">Внимание</string>
<string name="title_user_agent">User Agent</string>
@ -93,8 +93,6 @@ @@ -93,8 +93,6 @@
<string name="download_sdcard_busy_dlg_title">Карта памяти недоступна</string>
<string name="download_sdcard_busy_dlg_msg">Карта памяти подключена к ПК. Для начала загрузки отключите её от ПК, нажав на уведомление.</string>
<string name="incognito_cookies">Включить куки в режиме инкогнито</string>
<string name="action_manual">Вручную</string>
<string name="action_auto">Автоматически</string>
<string name="action_follow_me">Связаться с разработчиками</string>
<string name="url_twitter">twitter.com/RestainoAnthony</string>
<string name="clear_cache">Очистить кэш</string>
@ -102,10 +100,8 @@ @@ -102,10 +100,8 @@
<string name="message_import">Закладки импортированы</string>
<string name="message_clear_history">История очищена</string>
<string name="message_cookies_cleared">Куки очищены</string>
<string name="max_tabs">Достигнуто максимальное число вкладок</string>
<string name="message_text_copied">Текст скопирован в буфер обмена</string>
<string name="message_link_copied">Ссылка скопирована в буфер обмена</string>
<string name="search_engine_custom">Пользовательский URL</string>
<string name="message_blocked_local">Локальный файл недоступен для загрузки</string>
<string name="licenses">Open Source Licenses</string>
<string name="suggestion">Искать</string>
@ -119,10 +115,8 @@ @@ -119,10 +115,8 @@
<string name="message_certificate_untrusted">сертификат не является доверенным</string>
<string name="title_form_resubmission">Отправка формы</string>
<string name="message_form_resubmission">Вы действительно хотите повторно отправить данные?</string>
<string name="message_location">\nХотите использовать своё местоположение?</string>
<string name="action_allow">Разрешить</string>
<string name="action_dont_allow">Не разрешать</string>
<string name="title_sign_in">Вход</string>
<string name="label_realm">Сообщение сервера: %s</string>
<string name="hint_username">Имя пользователя</string>
<string name="hint_password">Пароль</string>
<string name="search_suggestions">Подсказки поиска</string>
@ -139,9 +133,6 @@ @@ -139,9 +133,6 @@
<string name="manual_proxy">Прокси</string>
<string name="host">Хост:</string>
<string name="port">Порт:</string>
<string name="use_tor_prompt">Похоже, установлен Orbot. Вы хотите использовать Tor?</string>
<string name="use_i2p_prompt">Похоже, установлен I2P. Вы хотите использовать I2P?</string>
<string name="install_orbot">Пожалуйста, установите Orbot для проксирования через Tor.</string>
<string name="yes">Да</string>
<string name="no">Нет</string>
<string name="clear_cookies_exit">Очищать куки при выходе</string>
@ -152,7 +143,6 @@ @@ -152,7 +143,6 @@
<string name="mpl_license">Mozilla Public License v. 2.0</string>
<string name="freeware">Freeware</string>
<string name="android_open_source_project">Android Open Source Project</string>
<string name="hphosts_ad_server_list">hpHosts Ad Server List</string>
<string name="deleted_tab">Восстановить закрытую вкладку</string>
<string name="rendering_mode">Режим отображения страниц</string>
<string name="name_inverted">Инвертированный</string>
@ -167,6 +157,7 @@ @@ -167,6 +157,7 @@
<string name="export_bookmarks">Сделать резервную копию закладок</string>
<string name="import_backup">Восстановить закладки из резервной копии</string>
<string name="bookmark_export_path">Экспортировать закладки в </string>
<string name="bookmark_export_failure">Извините! Закладки не могут быть экспортированы!</string>
<string name="bookmark_settings">Настройки закладок</string>
<string name="import_bookmark_error">Не удалось импортировать закладки из файла</string>
<string name="title_chooser">Выберите файл</string>
@ -215,6 +206,7 @@ @@ -215,6 +206,7 @@
<string name="action_add_to_homescreen">Добавить на дом. экран</string>
<string name="message_added_to_homescreen">Ярлык добавлен на домашний экран</string>
<string name="action_delete_all_bookmarks">Удалить все закладки</string>
<string name="message_open_download_fail">Не удалось открыть файл</string>
<string name="faq">FAQ</string>
<string name="faq_description">Часто задаваемые вопросы</string>
@ -223,4 +215,25 @@ @@ -223,4 +215,25 @@
<string name="debug_title">Настройки отладки</string>
<string name="debug_leak_canary">LeakCanary</string>
<string name="app_restart">Чтобы изменения вступили в силу, необходимо перезапустить приложение.</string>
<!-- Dialogs -->
<string name="dialog_open_new_tab">Открыть в новой вкладке</string>
<string name="dialog_open_background_tab">Открыть в фоновой вкладке</string>
<string name="dialog_open_incognito_tab">Открыть в приватной вкладке</string>
<string name="dialog_remove_bookmark">Удалить закладку</string>
<string name="dialog_edit_bookmark">Редактировать закладку</string>
<string name="dialog_remove_from_history">Удалить из истории</string>
<string name="dialog_download_image">Сохранить изображение</string>
<string name="dialog_copy_link">Скопировать ссылку</string>
<string name="dialog_rename_folder">Переименовать папку</string>
<string name="dialog_remove_folder">Удалить папку</string>
<string name="dialog_title_close_browser">Закрыть браузер</string>
<string name="dialog_delete_download">Удалить загрузку</string>
<string name="dialog_delete_all_downloads">Удалить все загрузки</string>
<!-- Search Engines -->
<string name="search_engine_custom">Пользовательский URL</string>
<string name="search_engine_legwork">Legwork</string>
<string name="search_engine_duckduckgo">DuckDuckGo</string>
<string name="search_engine_duckduckgo_lite">DuckDuckGo Lite</string>
</resources>

14
app/src/main/res/values/strings.xml

@ -1,6 +1,5 @@ @@ -1,6 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<resources xmlns:tools="http://schemas.android.com/tools" tools:ignore="MissingTranslation">
<string name="app_name">Lightning I2P</string>
<string name="action_new_tab">New tab</string>
<string name="action_share">Share</string>
@ -11,7 +10,6 @@ @@ -11,7 +10,6 @@
<string name="action_copy">Copy link</string>
<string name="action_forward">Forward</string>
<string name="settings">Settings</string>
<string name="location">Location access</string>
<string name="password">Save your passwords</string>
<string name="agent">User agent</string>
<string name="home">Homepage</string>
@ -95,8 +93,6 @@ @@ -95,8 +93,6 @@
<string name="download_sdcard_busy_dlg_title">USB storage unavailable</string>
<string name="download_sdcard_busy_dlg_msg">The storage is busy. To allow downloads, touch \'Turn Off USB Storage\' in the notification.</string>
<string name="incognito_cookies">Enable cookies in incognito mode</string>
<string name="action_manual">Manual</string>
<string name="action_auto">Auto</string>
<string name="action_follow_me">Contact me</string>
<string name="url_twitter">twitter.com/RestainoAnthony</string>
<string name="clear_cache">Clear cache</string>
@ -104,7 +100,6 @@ @@ -104,7 +100,6 @@
<string name="message_import">Bookmarks were imported</string>
<string name="message_clear_history">History cleared</string>
<string name="message_cookies_cleared">Cookies cleared</string>
<string name="max_tabs">Max tabs reached</string>
<string name="message_text_copied">Text copied to clipboard</string>
<string name="message_link_copied">Link copied to clipboard</string>
<string name="message_blocked_local">Local file has been blocked from loading</string>
@ -120,9 +115,6 @@ @@ -120,9 +115,6 @@
<string name="message_certificate_untrusted">Certificate is not trusted</string>
<string name="title_form_resubmission">Form resubmission</string>
<string name="message_form_resubmission">Would you like to resend the data?</string>
<string name="message_location">\nWould like to use your location</string>
<string name="action_allow">Allow</string>
<string name="action_dont_allow">Don\'t allow</string>
<string name="title_sign_in">Sign in</string>
<string name="label_realm">Server message: %s</string>
<string name="hint_username">Username</string>
@ -141,9 +133,6 @@ @@ -141,9 +133,6 @@
<string name="manual_proxy">Manual proxy</string>
<string name="host">Host:</string>
<string name="port">Port:</string>
<string name="use_tor_prompt">It looks like you have Orbot installed. Do you want to use Tor?</string>
<string name="use_i2p_prompt">It looks like you have I2P installed. Do you want to use I2P?</string>
<string name="install_orbot">Please install Orbot in order to proxy with Tor.</string>
<string name="yes">Yes</string>
<string name="no">No</string>
<string name="clear_cookies_exit">Clear cookies on exit</string>
@ -154,7 +143,6 @@ @@ -154,7 +143,6 @@
<string name="mpl_license">Mozilla Public License v. 2.0</string>
<string name="freeware">Freeware</string>
<string name="android_open_source_project">Android Open Source Project</string>
<string name="hphosts_ad_server_list">hpHosts Ad Server List</string>
<string name="deleted_tab">Reopened old tab</string>
<string name="rendering_mode">Rendering mode</string>
<string name="name_inverted">Inverted</string>
@ -211,7 +199,6 @@ @@ -211,7 +199,6 @@
<string name="clear_web_storage">Clear web storage</string>
<string name="clear_web_storage_exit">Clear web storage on exit</string>
<string name="message_web_storage_cleared">Web storage cleared</string>
<string name="hosts_source">Hosts file ad blocking source</string>
<string name="tabs_in_drawer">Show tabs in navigation drawer</string>
<string name="swap_bookmarks_and_tabs">Swap bookmark and tab drawers</string>
<string name="do_not_track">Request \'Do Not Track\'</string>
@ -219,7 +206,6 @@ @@ -219,7 +206,6 @@
<string name="action_add_to_homescreen">Add to home screen</string>
<string name="message_added_to_homescreen">Shortcut added to home screen</string>
<string name="action_delete_all_bookmarks">Delete all bookmarks</string>
<string name="upsell_plus_version">Upgrade to Lightning Plus to block ads</string>
<string name="message_open_download_fail">This file doesn\'t exist anymore</string>
<string name="faq">FAQ</string>

11
app/src/main/res/xml/preference_about.xml

@ -41,17 +41,6 @@ @@ -41,17 +41,6 @@
android:value="SELF" />
</intent>
</Preference>
<Preference
android:summary="@string/freeware"
android:title="@string/hphosts_ad_server_list">
<intent
android:action="android.intent.action.VIEW"
android:data="http://hosts-file.net/">
<extra
android:name="SOURCE"
android:value="SELF" />
</intent>
</Preference>
<Preference
android:summary="@string/license_gnu"
android:title="@string/library_netcipher">

4
app/src/main/res/xml/preference_privacy.xml

@ -2,10 +2,6 @@ @@ -2,10 +2,6 @@
<PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android">
<PreferenceCategory android:title="@string/settings_privacy">
<CheckBoxPreference
android:defaultValue="true"
android:key="location"
android:title="@string/location"/>
<CheckBoxPreference
android:defaultValue="false"
android:key="third_party"

Loading…
Cancel
Save