Skip to content

Commit

Permalink
intl 0.19, remove greenrobot.eventbus to support latest version of Fl…
Browse files Browse the repository at this point in the history
…utter (#1102)

* update intl and i18n_extension

* run go mod tidy

* update Flutter dependencies

* re-enable sentry sdk

* re-enable sentry sdk

* Remove use of org.greenrobot.eventbus and implement event bus using shared flow (#1103)

* Remove use of org.greenrobot.eventbus

* Remove use of org.greenrobot.eventbus

* Add EventHandler

* Update how we subscribe to app events

* Update how we subscribe to app events

* Update how we subscribe to app events

* clean-ups

* handle LocaleEvent

* Add proguard rules for J2ObjC Annotations

* update go version
  • Loading branch information
atavism authored Jun 22, 2024
1 parent 210d709 commit 396e05e
Show file tree
Hide file tree
Showing 15 changed files with 541 additions and 473 deletions.
10 changes: 0 additions & 10 deletions android/app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -384,16 +384,6 @@ dependencies {
// Google Play libraries
implementation 'com.android.billingclient:billing:6.2.0'

// lib that simplifies event bus communication between activities, fragments, threads, services, etc
implementation 'org.greenrobot:eventbus:3.3.1'

// https://mvnrepository.com/artifact/net.jodah/expiringmap
// implementation group: 'net.jodah', name: 'expiringmap', version: '0.5.9'
// implementation 'androidx.lifecycle:lifecycle-runtime-ktx:2.7.0'
// implementation group: 'commons-codec', name: 'commons-codec', version: '1.12'
// https://mvnrepository.com/artifact/javax.mail/mail
// implementation group: 'javax.mail', name: 'mail', version: '1.4.7'

implementation 'com.stripe:stripe-android:20.17.0'
annotationProcessor "org.androidannotations:androidannotations:$androidAnnotationsVersion"
implementation("org.androidannotations:androidannotations-api:$androidAnnotationsVersion")
Expand Down
4 changes: 4 additions & 0 deletions android/app/proguard-rules.pro
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,10 @@
-keep,allowobfuscation,allowshrinking class com.google.gson.reflect.TypeToken
-keep,allowobfuscation,allowshrinking class * extends com.google.gson.reflect.TypeToken

# J2ObjC Annotations
-dontwarn com.google.j2objc.annotations.ReflectionSupport$Level
-dontwarn com.google.j2objc.annotations.ReflectionSupport
-dontwarn com.google.j2objc.annotations.RetainedWith

## Lifecycle
#-keep class androidx.lifecycle.** {*;}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,14 +25,14 @@ import io.lantern.model.Vpn
import org.getlantern.lantern.BuildConfig
import org.getlantern.lantern.LanternApp
import org.getlantern.lantern.model.Bandwidth
import org.getlantern.lantern.event.EventHandler
import org.getlantern.lantern.model.Stats
import org.getlantern.lantern.model.Utils
import org.getlantern.mobilesdk.Logger
import org.getlantern.mobilesdk.Settings
import org.getlantern.mobilesdk.StartResult
import org.getlantern.mobilesdk.util.DnsDetector
import org.getlantern.mobilesdk.util.LanguageHelper
import org.greenrobot.eventbus.EventBus
import java.io.PrintWriter
import java.io.StringWriter
import java.lang.reflect.InvocationTargetException
Expand Down Expand Up @@ -136,7 +136,7 @@ abstract class SessionManager(application: Application) : Session {
val oldLocale = prefs.getString(LANG, "")
prefs.edit().putString(LANG, locale.toString()).apply()
if (locale.language != oldLocale) {
EventBus.getDefault().post(locale)
EventHandler.postLocaleEvent(locale)
}
}
}
Expand Down Expand Up @@ -183,7 +183,7 @@ abstract class SessionManager(application: Application) : Session {
}

override fun updateAdSettings(adSettings: AdSettings) {
EventBus.getDefault().post(adSettings)

}

/**
Expand Down Expand Up @@ -356,7 +356,7 @@ abstract class SessionManager(application: Application) : Session {
val b = Bandwidth(percent, remaining, allowed, ttlSeconds)
Logger.debug("bandwidth", b.toString())
saveLatestBandwidth(b)
EventBus.getDefault().postSticky(b)
EventHandler.postBandwidthEvent(b)
}

fun setSurveyLinkOpened(url: String?) {
Expand Down Expand Up @@ -401,7 +401,7 @@ abstract class SessionManager(application: Application) : Session {
}

val st = Stats(city, country, countryCode, httpsUpgrades, adsBlocked, hasSucceedingProxy)
EventBus.getDefault().postSticky(st)
EventHandler.postStatsEvent(st)

// save last location received
prefs.edit().putString(SERVER_COUNTRY, country)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@

import org.getlantern.mobilesdk.Logger;
import org.getlantern.mobilesdk.model.Event;
import org.greenrobot.eventbus.EventBus;

import java.net.Inet6Address;
import java.net.InetAddress;
Expand Down Expand Up @@ -114,7 +113,6 @@ private String doGetDnsServer() {
public void publishNetworkAvailability() {
if (findActiveNetwork() == null) {
Logger.debug(TAG, "No network available");
EventBus.getDefault().postSticky(Event.NoNetworkAvailable);
}
}

Expand Down
Loading

0 comments on commit 396e05e

Please sign in to comment.