Skip to content

Commit

Permalink
Got android build working again
Browse files Browse the repository at this point in the history
  • Loading branch information
oxtoacart committed Oct 11, 2023
1 parent 86a840e commit c863b52
Show file tree
Hide file tree
Showing 13 changed files with 173 additions and 168 deletions.
3 changes: 3 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,9 @@ lib/messaging/protos_flutteronly/messaging.pb.dart: protos_flutteronly/messaging
lib/vpn/protos_shared/vpn.pb.dart: protos_shared/vpn.proto
@protoc --dart_out=./lib/vpn --plugin=protoc-gen-dart=$$HOME/.pub-cache/bin/protoc-gen-dart protos_shared/vpn.proto

internalsdk/protos/vpn.pb.go: protos_shared/vpn.proto
@protoc --go_out=internalsdk protos_shared/vpn.proto

# Compiles autorouter routes
routes: lib/core/router/router.gr.dart

Expand Down
2 changes: 1 addition & 1 deletion android/app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -243,7 +243,7 @@ android {
main {
jniLibs.srcDirs = ['libs']
java.srcDirs += 'src/main/kotlin'
proto.srcDirs += '../../protos_shared'
proto.srcDirs += '../../protos_shared'
}
}

Expand Down
4 changes: 2 additions & 2 deletions android/app/libs/liblantern-all.aar
Git LFS file not shown
Original file line number Diff line number Diff line change
Expand Up @@ -474,7 +474,7 @@ abstract class SessionManager(application: Application) : Session {
}

// isPlayVersion checks whether or not the user installed Lantern via the Google Play store
override fun isPlayVersion(): Boolean {
override fun isStoreVersion(): Boolean {
if (BuildConfig.PLAY_VERSION || prefs.getBoolean(PLAY_VERSION, false)) {
return true
}
Expand Down Expand Up @@ -577,7 +577,7 @@ abstract class SessionManager(application: Application) : Session {
prefs = prefsAdapter
prefs.edit().putBoolean(DEVELOPMENT_MODE, BuildConfig.DEVELOPMENT_MODE)
.putBoolean(PAYMENT_TEST_MODE, prefs.getBoolean(PAYMENT_TEST_MODE, false))
.putBoolean(PLAY_VERSION, isPlayVersion())
.putBoolean(PLAY_VERSION, isStoreVersion())
.putString(FORCE_COUNTRY, prefs.getString(FORCE_COUNTRY, "")).apply()

// initialize email address to empty string (if it doesn't already exist)
Expand Down
4 changes: 2 additions & 2 deletions android/app/src/main/kotlin/io/lantern/model/SessionModel.kt
Original file line number Diff line number Diff line change
Expand Up @@ -195,7 +195,7 @@ class SessionModel(
}

"setPlayVersion" -> {
LanternApp.getSession().isPlayVersion = call.argument("on") ?: false
LanternApp.getSession().isStoreVersion = call.argument("on") ?: false
activity.restartApp()
}

Expand Down Expand Up @@ -399,7 +399,7 @@ class SessionModel(

private fun checkEmailExists(emailAddress: String, methodCallResult: MethodChannel.Result) {
val params = mapOf("email" to emailAddress)
val isPlayVersion = LanternApp.getSession().isPlayVersion()
val isPlayVersion = LanternApp.getSession().isStoreVersion()
val useStripe = !isPlayVersion
lanternClient.get(
LanternHttpClient.createProUrl("/email-exists", params),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ open class LanternApp : Application() {

LanternProxySelector(session)

if (session.isPlayVersion) inAppBilling = InAppBilling(this)
if (session.isStoreVersion) inAppBilling = InAppBilling(this)

lanternHttpClient = LanternHttpClient()

Expand Down Expand Up @@ -98,7 +98,7 @@ open class LanternApp : Application() {
fun getPlans(cb: LanternHttpClient.PlansCallback) {
lanternHttpClient.getPlans(
cb,
if (session.isPlayVersion && !session.isRussianUser) inAppBilling else null
if (session.isStoreVersion && !session.isRussianUser) inAppBilling else null
)
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -338,8 +338,8 @@ class LanternSessionManager(application: Application) : SessionManager(applicati
}
}

fun setPlayVersion(playVersion: Boolean) {
prefs.edit().putBoolean(PLAY_VERSION, playVersion).apply()
fun setStoreVersion(storeVersion: Boolean) {
prefs.edit().putBoolean(PLAY_VERSION, storeVersion).apply()
}

companion object {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ class AutoUpdater(val context: Context, val activity: Activity? = null) {
}

fun checkForUpdates() {
if (LanternApp.getSession().isPlayVersion && activity != null) {
if (LanternApp.getSession().isStoreVersion && activity != null) {
Utils.openPlayStore(context)
return
}
Expand Down
2 changes: 1 addition & 1 deletion internalsdk/messaging_model.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ func (s *MessagingModel) InvokeMethod(method string, arguments Arguments) (*mini

func initMessagingModel(m *baseModel) error {
pathdb.Mutate(m.db, func(tx pathdb.TX) error {
pathdb.Put[bool](tx, ONBOARDING_STATUS, false, "")
pathdb.Put(tx, ONBOARDING_STATUS, false, "")
return nil
})
return nil
Expand Down
Loading

0 comments on commit c863b52

Please sign in to comment.