Skip to content

Commit

Permalink
Merge pull request #212 from mysteriumnetwork/upgrade-node-0.37
Browse files Browse the repository at this point in the history
Upgrade Mysterium node to 0.37.0
  • Loading branch information
tadaskay authored Jul 24, 2020
2 parents ab722fe + 41474f1 commit 833ec2f
Show file tree
Hide file tree
Showing 19 changed files with 74 additions and 67 deletions.
58 changes: 34 additions & 24 deletions android/app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -57,10 +57,16 @@ android {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
kotlinOptions {
jvmTarget = "1.8"
}

testOptions {
unitTests.includeAndroidResources = true
}
lintOptions {
abortOnError false
}

androidExtensions {
experimental = true
Expand All @@ -78,7 +84,11 @@ android {

javaCompileOptions {
annotationProcessorOptions {
arguments = ["room.schemaLocation": "$projectDir/schemas".toString()]
arguments += [
"room.schemaLocation" : "$projectDir/schemas".toString(),
"room.incremental" : "true",
"room.expandProjection": "true"
]
}
}
}
Expand Down Expand Up @@ -129,48 +139,48 @@ android {
}

dependencies {
implementation 'androidx.navigation:navigation-fragment-ktx:2.1.0'
implementation 'androidx.navigation:navigation-ui-ktx:2.1.0'

implementation('com.crashlytics.sdk.android:crashlytics:2.9.6@aar') {
transitive = true
}

implementation 'androidx.multidex:multidex:2.0.1'
implementation 'com.google.firebase:firebase-core:17.2.1'
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-core:1.3.0'
implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-android:1.3.0'
implementation "org.jetbrains.kotlin:kotlin-reflect:$kotlin_version"

implementation 'androidx.core:core-ktx:1.3.1'
implementation 'androidx.lifecycle:lifecycle-extensions:2.2.0'
implementation 'androidx.lifecycle:lifecycle-viewmodel-ktx:2.2.0'
implementation 'androidx.lifecycle:lifecycle-viewmodel-ktx:2.2.0'
implementation 'androidx.navigation:navigation-fragment-ktx:2.3.0'
implementation 'androidx.navigation:navigation-ui-ktx:2.3.0'
implementation 'androidx.room:room-runtime:2.2.5'
implementation 'androidx.room:room-ktx:2.2.5'
implementation 'androidx.multidex:multidex:2.0.1'
implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
implementation 'androidx.legacy:legacy-support-v4:1.0.0'
implementation 'androidx.appcompat:appcompat:1.1.0'
implementation 'androidx.core:core-ktx:1.1.0'
implementation 'com.android.support:support-compat:28.0.0'
implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
implementation 'androidx.lifecycle:lifecycle-extensions:2.1.0'
implementation 'androidx.lifecycle:lifecycle-viewmodel-ktx:2.1.0'
implementation 'com.google.android.material:material:1.3.0-alpha01'
implementation 'androidx.recyclerview:recyclerview:1.1.0'
implementation 'com.android.support:support-compat:28.0.0'
implementation 'com.google.android.material:material:1.3.0-alpha01'

implementation 'com.google.firebase:firebase-core:17.2.1'
implementation('com.crashlytics.sdk.android:crashlytics:2.9.6@aar') {
transitive = true
}
implementation 'com.makeramen:roundedimageview:2.3.0'
implementation 'com.beust:klaxon:5.0.1'
implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-core:1.3.0'
implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-android:1.3.0'
implementation 'org.jetbrains.kotlin:kotlin-reflect:1.3.50'
implementation 'androidx.lifecycle:lifecycle-viewmodel-ktx:2.1.0'
implementation 'androidx.room:room-runtime:2.2.2'
implementation 'androidx.room:room-ktx:2.2.2'
implementation 'com.journeyapps:zxing-android-embedded:4.1.0'
implementation 'io.intercom.android:intercom-sdk-base:7.1.0'

kapt 'androidx.room:room-compiler:2.2.2'
kapt 'androidx.room:room-compiler:2.2.5'

testImplementation 'junit:junit:4.12'
androidTestImplementation 'androidx.test:core:1.2.0'
androidTestImplementation 'androidx.test.ext:junit:1.1.1'
androidTestImplementation 'androidx.test:runner:1.2.0'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0'
androidTestImplementation 'com.android.support.test.espresso:espresso-contrib:3.0.2'
androidTestImplementation 'androidx.test:rules:1.3.0-alpha03'
androidTestImplementation 'androidx.test:rules:1.3.0-rc01'

implementation 'network.mysterium:mobile-node:0.36.1'
implementation 'network.mysterium:mobile-node:0.37.0'
// Comment network.mysterium:mobile-node and replace with your local path to use local node build.
//implementation files('/Users/zolia/golang/src/github.com/mysteriumnetwork/node/build/package/Mysterium.aar')
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,7 @@ class WireguardAndroidTunnelSetup(val vpnService: VpnService) : WireguardTunnelS


override fun setBlocking(blocking: Boolean) {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
tunBuilder?.setBlocking(blocking)
}
tunBuilder?.setBlocking(blocking)
}

override fun newTunnel() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ class ForceUpdateFragment : Fragment() {
override fun onViewCreated(root: View, savedInstanceState: Bundle?) {
super.onViewCreated(root, savedInstanceState)

val appContainer = (activity!!.application as MainApplication).appContainer
val appContainer = (requireActivity().application as MainApplication).appContainer
val versionViewModel = appContainer.versionViewModel

updateBtn = root.findViewById(R.id.force_update_btn)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -124,19 +124,19 @@ class MainVpnFragment : Fragment() {
handleConnectionPress(root)
}

sharedViewModel.selectedProposal.observe(this, Observer { updateSelectedProposal(it) })
sharedViewModel.selectedProposal.observe(viewLifecycleOwner, Observer { updateSelectedProposal(it) })

sharedViewModel.connectionState.observe(this, Observer {
sharedViewModel.connectionState.observe(viewLifecycleOwner, Observer {
updateConnStateLabel(it)
updateConnButtonState(it)
updateStatsLayoutVisibility()
})

sharedViewModel.statistics.observe(this, Observer { updateStatsLabels(it) })
sharedViewModel.statistics.observe(viewLifecycleOwner, Observer { updateStatsLabels(it) })

sharedViewModel.location.observe(this, Observer { updateLocation(it) })
sharedViewModel.location.observe(viewLifecycleOwner, Observer { updateLocation(it) })

walletViewModel.balance.observe(this, Observer { updateBalance(it) })
walletViewModel.balance.observe(viewLifecycleOwner, Observer { updateBalance(it) })

onBackPress { emulateHomePress() }

Expand All @@ -161,7 +161,7 @@ class MainVpnFragment : Fragment() {
}

private fun updateLocation(location: LocationModel) {
conStatusIP.text = "IP: ${location.ip}"
conStatusIP.text = getString(R.string.vpn_ip)
if (location.countryFlagImage == null) {
vpnStatusCountry.setImageResource(R.drawable.ic_public_black_24dp)
} else {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ class ProposalsCountryFilterList : Fragment() {
override fun onViewCreated(root: View, savedInstanceState: Bundle?) {
super.onViewCreated(root, savedInstanceState)

val appContainer = (activity!!.application as MainApplication).appContainer
val appContainer = (requireActivity().application as MainApplication).appContainer
proposalsViewModel = appContainer.proposalsViewModel

feedbackToolbar = root.findViewById(R.id.proposals_country_filter_toolbar)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ class ProposalsFragment : Fragment() {

val root = inflater.inflate(R.layout.fragment_proposals, container, false)

appContainer = (activity!!.application as MainApplication).appContainer
appContainer = (requireActivity().application as MainApplication).appContainer
proposalsViewModel = appContainer.proposalsViewModel

// Initialize UI elements.
Expand Down Expand Up @@ -140,7 +140,7 @@ class ProposalsFragment : Fragment() {
}

// Subscribe to proposals changes.
proposalsViewModel.getFilteredProposals().observe(this, Observer { newItems ->
proposalsViewModel.getFilteredProposals().observe(viewLifecycleOwner, Observer { newItems ->
listAdapter.submitList(createProposalItemsWithGroups(root, newItems))
listAdapter.notifyDataSetChanged()

Expand All @@ -152,7 +152,7 @@ class ProposalsFragment : Fragment() {
})


proposalsViewModel.initialProposalsLoaded.observe(this, Observer {loaded ->
proposalsViewModel.initialProposalsLoaded.observe(viewLifecycleOwner, Observer {loaded ->
if (loaded) {
return@Observer
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ class ProposalsNodeTypeFilterListFragment : Fragment() {
override fun onViewCreated(root: View, savedInstanceState: Bundle?) {
super.onViewCreated(root, savedInstanceState)

val appContainer = (activity!!.application as MainApplication).appContainer
val appContainer = (requireActivity().application as MainApplication).appContainer
proposalsViewModel = appContainer.proposalsViewModel

toolbar = root.findViewById(R.id.proposals_node_type_filter_toolbar)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ class ProposalsPriceFilterFragment : Fragment() {
override fun onViewCreated(root: View, savedInstanceState: Bundle?) {
super.onViewCreated(root, savedInstanceState)

val appContainer = (activity!!.application as MainApplication).appContainer
val appContainer = (requireActivity().application as MainApplication).appContainer
proposalsViewModel = appContainer.proposalsViewModel

feedbackToolbar = root.findViewById(R.id.proposals_price_filter_toolbar)
Expand All @@ -51,7 +51,7 @@ class ProposalsPriceFilterFragment : Fragment() {
proposalsPricePerMinuteValue.text = formatPriceValue(proposalsViewModel.filter.pricePerMinute)
proposalsPricePerMinuteSlider.stepSize = (priceSettings.perMinuteMax / filterSteps).toFloat()
proposalsPricePerMinuteSlider.setLabelFormatter { formatPriceValue(it.toDouble()) }
proposalsPricePerMinuteSlider.addOnChangeListener { slider, value, fromUser ->
proposalsPricePerMinuteSlider.addOnChangeListener { _, value, _ ->
proposalsViewModel.applyPricePerMinFilter(value.toDouble())
proposalsPricePerMinuteValue.text = formatPriceValue(proposalsViewModel.filter.pricePerMinute)
}
Expand All @@ -62,7 +62,7 @@ class ProposalsPriceFilterFragment : Fragment() {
proposalsPricePerGibValue.text = formatPriceValue(proposalsViewModel.filter.pricePerGiB)
proposalsPricePerGibSlider.stepSize = (priceSettings.perGibMax / filterSteps).toFloat()
proposalsPricePerGibSlider.setLabelFormatter { formatPriceValue(it.toDouble()) }
proposalsPricePerGibSlider.addOnChangeListener { slider, value, fromUser ->
proposalsPricePerGibSlider.addOnChangeListener { _, value, _ ->
proposalsViewModel.applyPricePerGiBFilter(value.toDouble())
proposalsPricePerGibValue.text = formatPriceValue(proposalsViewModel.filter.pricePerGiB)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ class ProposalsQualityFilterListFragment : Fragment() {
override fun onViewCreated(root: View, savedInstanceState: Bundle?) {
super.onViewCreated(root, savedInstanceState)

val appContainer = (activity!!.application as MainApplication).appContainer
val appContainer = (requireActivity().application as MainApplication).appContainer
proposalsViewModel = appContainer.proposalsViewModel

toolbar = root.findViewById(R.id.proposals_quality_filter_toolbar)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -296,10 +296,16 @@ class ProposalsViewModel(private val sharedViewModel: SharedViewModel, private v

private suspend fun loadInitialProposals(refresh: Boolean = false, favoriteProposals: MutableMap<String, FavoriteProposal>) {
try {
val req = GetProposalsRequest()
req.refresh = refresh
req.includeFailed = true
req.serviceType = "wireguard"
val req = GetProposalsRequest().apply {
this.refresh = refresh
includeFailed = true
serviceType = "wireguard"
// Temporary fix with huge values until mobile-node is upgrade to >= 0.38 where these are removed
lowerTimePriceBound = 0
upperTimePriceBound = 1_000_000_000_000
lowerGBPriceBound = 0
upperGBPriceBound = 1_000_000_000_000
}

val nodeProposals = nodeRepository.proposals(req)
allProposals = nodeProposals
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ import android.view.View
import android.view.ViewGroup
import android.widget.Button
import android.widget.TextView
import androidx.core.text.HtmlCompat
import androidx.navigation.findNavController
import kotlinx.coroutines.CoroutineScope
import kotlinx.coroutines.Dispatchers
Expand All @@ -43,11 +44,11 @@ class TermsFragment : Fragment() {

val root = inflater.inflate(R.layout.fragment_terms, container, false)

termsViewModel = (activity!!.application as MainApplication).appContainer.termsViewModel
termsViewModel = (requireActivity().application as MainApplication).appContainer.termsViewModel
termsTextWiew = root.findViewById(R.id.terms_text_wiew)
termsAcceptButton = root.findViewById(R.id.terms_accept_button)

termsTextWiew.setText(Html.fromHtml(termsViewModel.termsText))
termsTextWiew.setText(Html.fromHtml(termsViewModel.termsText, HtmlCompat.FROM_HTML_MODE_LEGACY))

termsAcceptButton.setOnClickListener {
termsAcceptButton.isEnabled = false
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -89,11 +89,11 @@ class WalletFragment : Fragment() {
navigateTo(root, Screen.MAIN)
}

walletViewModel.identity.observe(this, Observer {
walletViewModel.identity.observe(viewLifecycleOwner, Observer {
handleIdentityChange(it)
})

walletViewModel.balance.observe(this, Observer {
walletViewModel.balance.observe(viewLifecycleOwner, Observer {
handleBalanceChange(it)
})

Expand Down
2 changes: 1 addition & 1 deletion android/app/src/main/res/layout/activity_main.xml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
android:visibility="gone"
android:layout_height="40dp">
<TextView
android:text="No internet connection"
android:text="@string/no_internet_connection"
android:textStyle="bold"
android:textSize="16dp"
android:textColor="@color/ColorWhite"
Expand Down
2 changes: 2 additions & 0 deletions android/app/src/main/res/values-ru/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -90,4 +90,6 @@
<string name="wallet_mystt_test_explanation">MYSTT - это тестовый токен, который вы получаете бесплатно, пока мы находимся в Testnet</string>
<string name="wallet_identity_address">Идентификационный адрес</string>
<string name="wallet_identity_address_explanation">Идентификатор - это ваш внутренний идентификатор пользователя Mysterium. Никогда не посылайте эфир или какие-либо ERC20 токены сюда.</string>
<string name="no_internet_connection">Нет соединения с интернетом</string>
<string name="vpn_ip">IP: %1$s</string>
</resources>
13 changes: 0 additions & 13 deletions android/app/src/main/res/values/arrays.xml

This file was deleted.

2 changes: 2 additions & 0 deletions android/app/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -91,4 +91,6 @@
<string name="wallet_balance">Balance</string>
<string name="wallet_identity_address">Identity Address</string>
<string name="wallet_identity_address_explanation">Identity is your Mysterium internal user ID. Never send ether or any kind of ERC20 tokens there.</string>
<string name="no_internet_connection">No internet connection</string>
<string name="vpn_ip">IP: %1$s</string>
</resources>
2 changes: 1 addition & 1 deletion android/build.gradle
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// Top-level build file where you can add configuration options common to all sub-projects/modules.

buildscript {
ext.kotlin_version = '1.3.50'
ext.kotlin_version = '1.3.72'
ext {
buildToolsVersion = "28.0.3"
minSdkVersion = 24
Expand Down
1 change: 1 addition & 0 deletions android/gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -20,3 +20,4 @@
android.useAndroidX=true
android.enableJetifier=true
kapt.incremental.apt=true
org.gradle.jvmargs=-Xmx2048m
2 changes: 1 addition & 1 deletion android/gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@ distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-6.1.1-all.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-6.3-all.zip

0 comments on commit 833ec2f

Please sign in to comment.