Skip to content

Commit

Permalink
Merge pull request #759 from anthonycr/dev
Browse files Browse the repository at this point in the history
Version 5.0.2
  • Loading branch information
anthonycr authored Sep 7, 2019
2 parents 50c0e14 + d839283 commit 1433e98
Show file tree
Hide file tree
Showing 84 changed files with 968 additions and 734 deletions.
8 changes: 5 additions & 3 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,15 @@ jdk:
android:
components:
- tools
- build-tools-28.0.3
- android-28
- build-tools-28.0.3 # Temporary, used by I2P
- build-tools-29.0.2
- android-28 # Temporary, used by I2P
- android-29
licenses:
- 'android-sdk-license-.+'
- '.*intel.+'
before_install:
- yes | sdkmanager "platforms;android-28"
- yes | sdkmanager "platforms;android-29"
- chmod +x gradlew
- git submodule update --init --recursive
install:
Expand Down
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,13 @@
Change Log
==========

Version 5.0.2 *(2019-09-07)*
----------------------------
- Target Android 10 API 29
- Update desktop and mobile user agents
- Fixed segfault that occurred when some URLs were clicked
- Added dialog to show SSL certificate info when SSL icon is tapped

Version 5.0.1 *(2019-09-01)*
----------------------------
- 64 bit I2P support
Expand Down
18 changes: 9 additions & 9 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ android {
defaultConfig {
minSdkVersion project.minSdkVersion
targetSdkVersion project.targetSdkVersion
versionName project.versionName
versionName "5.0.2"
vectorDrawables.useSupportLibrary = true
}

Expand Down Expand Up @@ -60,14 +60,14 @@ android {
dimension "capabilities"
buildConfigField "boolean", "FULL_VERSION", "Boolean.parseBoolean(\"true\")"
applicationId "acr.browser.lightning"
versionCode project.versionCode_plus
versionCode 100
}

lightningLite {
dimension "capabilities"
buildConfigField "boolean", "FULL_VERSION", "Boolean.parseBoolean(\"false\")"
applicationId "acr.browser.barebones"
versionCode project.versionCode_lite
versionCode 101
}
}

Expand Down Expand Up @@ -112,13 +112,13 @@ dependencies {
// support libraries
implementation "androidx.palette:palette:1.0.0"
implementation "androidx.annotation:annotation:1.1.0"
implementation "androidx.vectordrawable:vectordrawable-animated:1.0.0"
implementation "androidx.appcompat:appcompat:1.0.2"
implementation "androidx.vectordrawable:vectordrawable-animated:1.1.0"
implementation "androidx.appcompat:appcompat:1.1.0"
implementation "com.google.android.material:material:1.0.0"
implementation "androidx.recyclerview:recyclerview:1.0.0"
implementation "androidx.core:core:1.0.2"
implementation "androidx.core:core:1.1.0"
implementation "androidx.constraintlayout:constraintlayout:1.1.3"
implementation "androidx.fragment:fragment:1.0.0"
implementation "androidx.fragment:fragment:1.1.0"
implementation "androidx.drawerlayout:drawerlayout:1.0.0"

// html parsing for reading mode
Expand Down Expand Up @@ -154,7 +154,7 @@ dependencies {

// rx
implementation 'io.reactivex.rxjava2:rxandroid:2.1.1'
implementation 'io.reactivex.rxjava2:rxjava:2.2.11'
implementation 'io.reactivex.rxjava2:rxjava:2.2.12'
implementation 'io.reactivex.rxjava2:rxkotlin:2.4.0'

// tor proxy
Expand All @@ -171,7 +171,7 @@ dependencies {

// kotlin
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlinVersion"
implementation 'androidx.core:core-ktx:1.2.0-alpha03'
implementation 'androidx.core:core-ktx:1.2.0-alpha04'
}

kapt {
Expand Down
12 changes: 12 additions & 0 deletions app/src/main/java/acr/browser/lightning/AppTheme.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
package acr.browser.lightning

import acr.browser.lightning.preference.IntEnum

/**
* The available app themes.
*/
enum class AppTheme(override val value: Int) : IntEnum {
LIGHT(0),
DARK(1),
BLACK(2)
}
2 changes: 2 additions & 0 deletions app/src/main/java/acr/browser/lightning/IncognitoActivity.kt
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@ import io.reactivex.Completable

class IncognitoActivity : BrowserActivity() {

override fun provideThemeOverride(): Int? = R.style.Theme_DarkTheme

@Suppress("DEPRECATION")
public override fun updateCookiePreference(): Completable = Completable.fromAction {
val cookieManager = CookieManager.getInstance()
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
package acr.browser.lightning.adblock

import dagger.Reusable
import javax.inject.Inject
import javax.inject.Singleton

/**
* A no-op ad blocker implementation. Always returns false for [isAd].
*/
@Singleton
@Reusable
class NoOpAdBlocker @Inject constructor() : AdBlocker {

override fun isAd(url: String) = false
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,15 @@ import acr.browser.lightning.log.Logger
import acr.browser.lightning.preference.UserPreferences
import android.app.Application
import android.content.res.AssetManager
import dagger.Reusable
import io.reactivex.Single
import okhttp3.OkHttpClient
import javax.inject.Inject

/**
* A [HostsDataSourceProvider] backed by [UserPreferences].
*/
@Reusable
class PreferencesHostsDataSourceProvider @Inject constructor(
private val userPreferences: UserPreferences,
private val assetManager: AssetManager,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import acr.browser.lightning.html.bookmark.BookmarkPageFactory
import acr.browser.lightning.html.homepage.HomePageFactory
import acr.browser.lightning.log.Logger
import acr.browser.lightning.preference.UserPreferences
import acr.browser.lightning.ssl.SSLState
import acr.browser.lightning.ssl.SslState
import acr.browser.lightning.view.BundleInitializer
import acr.browser.lightning.view.LightningView
import acr.browser.lightning.view.TabInitializer
Expand Down Expand Up @@ -77,7 +77,7 @@ class BrowserPresenter(

private fun onTabChanged(newTab: LightningView?) {
logger.log(TAG, "On tab changed")
view.updateSslState(newTab?.currentSslState() ?: SSLState.None)
view.updateSslState(newTab?.currentSslState() ?: SslState.None)

sslStateSubscription?.dispose()
sslStateSubscription = newTab
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package acr.browser.lightning.browser

import acr.browser.lightning.ssl.SSLState
import acr.browser.lightning.ssl.SslState
import android.view.View
import androidx.annotation.StringRes

Expand All @@ -16,7 +16,7 @@ interface BrowserView {

fun updateTabNumber(number: Int)

fun updateSslState(sslState: SSLState)
fun updateSslState(sslState: SslState)

fun closeBrowser()

Expand Down
13 changes: 13 additions & 0 deletions app/src/main/java/acr/browser/lightning/browser/ProxyChoice.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
package acr.browser.lightning.browser

import acr.browser.lightning.preference.IntEnum

/**
* The available proxy choices.
*/
enum class ProxyChoice(override val value: Int) : IntEnum {
NONE(0),
ORBOT(1),
I2P(2),
MANUAL(3)
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
package acr.browser.lightning.browser

import acr.browser.lightning.preference.IntEnum

/**
* An enum representing what detail level should be displayed in the search box.
*/
enum class SearchBoxDisplayChoice(override val value: Int) : IntEnum {
DOMAIN(0),
URL(1),
TITLE(2)
}
29 changes: 9 additions & 20 deletions app/src/main/java/acr/browser/lightning/browser/SearchBoxModel.kt
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,13 @@ import acr.browser.lightning.preference.UserPreferences
import acr.browser.lightning.utils.Utils
import acr.browser.lightning.utils.isSpecialUrl
import android.app.Application
import dagger.Reusable
import javax.inject.Inject

/**
* A UI model for the search box.
*/
@Reusable
class SearchBoxModel @Inject constructor(
private val userPreferences: UserPreferences,
application: Application
Expand All @@ -32,34 +34,21 @@ class SearchBoxModel @Inject constructor(
* @param isLoading whether the page is currently loading or not.
* @return the string that should be displayed by the search box.
*/
fun getDisplayContent(url: String, title: String?, isLoading: Boolean): String {
fun getDisplayContent(url: String, title: String?, isLoading: Boolean): String =
when {
url.isSpecialUrl() -> return ""
isLoading -> return url
url.isSpecialUrl() -> ""
isLoading -> url
else -> when (userPreferences.urlBoxContentChoice) {
1 -> {
// URL, show the entire URL
return url
}
2 -> {
// Title, show the page's title
return if (title?.isEmpty() == false) {
SearchBoxDisplayChoice.DOMAIN -> safeDomain(url)
SearchBoxDisplayChoice.URL -> url
SearchBoxDisplayChoice.TITLE ->
if (title?.isEmpty() == false) {
title
} else {
untitledTitle
}
}
0 -> {
// Default, show only the domain
return safeDomain(url)
}
else -> {
// Default, show only the domain
return safeDomain(url)
}
}
}
}

private fun safeDomain(url: String) = Utils.getDomainName(url)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -359,7 +359,7 @@ class TabsManager @Inject constructor(
.flattenAsObservable { bundle ->
bundle.keySet()
.filter { it.startsWith(BUNDLE_KEY) }
.map(bundle::getBundle)
.mapNotNull(bundle::getBundle)
}
.doOnNext { logger.log(TAG, "Restoring previous WebView state now") }

Expand Down
Loading

0 comments on commit 1433e98

Please sign in to comment.