Skip to content

Commit

Permalink
merge latest
Browse files Browse the repository at this point in the history
  • Loading branch information
atavism committed Sep 27, 2023
2 parents 5e5b1a7 + ee79e66 commit e929813
Show file tree
Hide file tree
Showing 27 changed files with 86 additions and 56 deletions.
3 changes: 2 additions & 1 deletion .github/workflows/browerstack.yml
Original file line number Diff line number Diff line change
Expand Up @@ -57,9 +57,10 @@ jobs:
run: make android-lib ANDROID_ARCH=all

- name: Build APK
env:
CI: "true"
run: |
flutter pub get
echo "CI=true" >> $GITHUB_ENV
make do-android-debug ANDROID_ARCH=all
- name: List files in current directory
Expand Down
14 changes: 11 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -289,9 +289,17 @@ $(MOBILE_TEST_APK) $(MOBILE_TESTS_APK): $(MOBILE_SOURCES) $(MOBILE_ANDROID_LIB)
-b $(MOBILE_DIR)/app/build.gradle \
:app:assembleAutoTestDebug :app:assembleAutoTestDebugAndroidTest

dart-defines-debug:
@DART_DEFINES="$(CIBASE)"; \
printf "$$DART_DEFINES"

do-android-debug: $(MOBILE_SOURCES) $(MOBILE_ANDROID_LIB)
ln -fs $(MOBILE_DIR)/gradle.properties . && \
CI="$$CI" && $(GRADLE) -PlanternVersion=$(DEBUG_VERSION) -PddClientToken=$$DD_CLIENT_TOKEN -PddApplicationID=$$DD_APPLICATION_ID \
@ln -fs $(MOBILE_DIR)/gradle.properties . && \
DART_DEFINES=`make dart-defines-debug` && \
echo "Value of DART_DEFINES is: $$DART_DEFINES" && \
CI="$$CI" && \
echo "Value of CI is: $$CI" && \
$(GRADLE) -Pdart-defines="$$DART_DEFINES" -PlanternVersion=$(DEBUG_VERSION) -PddClientToken=$$DD_CLIENT_TOKEN -PddApplicationID=$$DD_APPLICATION_ID \
-PproServerUrl=$(PRO_SERVER_URL) -PpaymentProvider=$(PAYMENT_PROVIDER) -Pcountry=$(COUNTRY) \
-PplayVersion=$(FORCE_PLAY_VERSION) -PuseStaging=$(STAGING) -PstickyConfig=$(STICKY_CONFIG) \
-PlanternRevisionDate=$(REVISION_DATE) -PandroidArch=$(ANDROID_ARCH) \
Expand Down Expand Up @@ -354,7 +362,7 @@ android-release-install: $(MOBILE_RELEASE_APK)
$(ADB) install -r $(MOBILE_RELEASE_APK)

package-android: pubget require-version
@ANDROID_ARCH=all make android-release && \
@ANDROID_ARCH=arm32 make android-release && \
ANDROID_ARCH=all make android-bundle && \
echo "-> $(MOBILE_RELEASE_APK)"

Expand Down
Binary file modified android/app/libs/alipaySdk-15.7.6-20200521195109.aar
Binary file not shown.
3 changes: 0 additions & 3 deletions android/app/libs/liblantern-all.aar

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ import io.lantern.model.BaseModel
import io.lantern.model.Vpn
import org.getlantern.lantern.BuildConfig
import org.getlantern.lantern.LanternApp
import org.getlantern.lantern.datadog.Datadog
import org.getlantern.lantern.model.Bandwidth
import org.getlantern.lantern.model.Stats
import org.getlantern.lantern.model.Utils
Expand Down Expand Up @@ -385,6 +386,7 @@ abstract class SessionManager(application: Application) : Session {

override fun setCountry(country: String) {
prefs.edit().putString(GEO_COUNTRY_CODE, country).apply()
Datadog.setCountry(country)
}

private val hasUpdatedStats = AtomicBoolean()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,6 @@ import android.util.Log
import androidx.appcompat.app.AppCompatDelegate
import androidx.core.content.ContextCompat
import androidx.multidex.MultiDex
import org.getlantern.lantern.datadog.Datadog
import org.getlantern.lantern.datadog.FlutterExcludingComponentPredicate
import org.getlantern.lantern.model.InAppBilling
import org.getlantern.lantern.model.LanternHttpClient
import org.getlantern.lantern.model.LanternSessionManager
Expand Down Expand Up @@ -53,7 +51,6 @@ open class LanternApp : Application() {
AppCompatDelegate.setCompatVectorFromResourcesEnabled(true)
appContext = applicationContext
session = LanternSessionManager(this)
if (!BuildConfig.DEBUG) Datadog.initialize()

LanternProxySelector(session)

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
package org.getlantern.lantern.datadog

import android.util.Log
import com.datadog.android.Datadog as DatadogMain
import com.datadog.android.DatadogSite
import com.datadog.android.core.configuration.BatchSize
import com.datadog.android.core.configuration.Configuration
Expand All @@ -17,13 +16,20 @@ import org.getlantern.lantern.LanternApp
import org.getlantern.mobilesdk.Logger
import java.net.InetSocketAddress
import java.net.Proxy
import java.net.URI
import java.util.concurrent.atomic.AtomicBoolean
import com.datadog.android.Datadog as DatadogMain

object Datadog {
private val tracedHosts = listOf(
"datadoghq.eu",
"127.0.0.1",
)
private val tracedHosts =
listOf(
"datadoghq.eu",
"127.0.0.1",
"iantem.io",
"getlantern.org",
"getiantem.org",
"lantern.io",
)
private val initialized = AtomicBoolean()
private lateinit var datadogConfig: Configuration

Expand All @@ -33,13 +39,14 @@ object Datadog {
DatadogMain.setVerbosity(Log.VERBOSE)
datadogConfig = createDatadogConfiguration()

val datadogCredentials = Credentials(
clientToken = "puba617ab01333a95a25a9d3709f04e1654",
envName = "prod",
rumApplicationId = "f8eabf3c-5db3-4f7e-8e6a-5a72433b46d2",
variant = "release",
serviceName = "lantern-android",
)
val datadogCredentials =
Credentials(
clientToken = "puba617ab01333a95a25a9d3709f04e1654",
envName = "prod",
rumApplicationId = "f8eabf3c-5db3-4f7e-8e6a-5a72433b46d2",
variant = "release",
serviceName = "lantern-android",
)

DatadogMain.initialize(
LanternApp.getAppContext(),
Expand All @@ -52,9 +59,20 @@ object Datadog {
id = LanternApp.getSession().userId().toString(),
)

val monitor = RumMonitor.Builder().build()
GlobalRum.registerIfAbsent(monitor)
GlobalRum.registerIfAbsent {
RumMonitor.Builder().build()
}
val session = LanternApp.getSession()
setCountry(session.countryCode)
initialized.set(true)

// For some reason, sessions don't show up in DataDog RUM until we register a user action
// of some sort. So, here we fire the custom action "started" to get data to start flowing.
GlobalRum.get().addUserAction(RumActionType.CUSTOM, "started", emptyMap())
}

fun setCountry(country: String) {
GlobalRum.addAttribute("lantern.country_code", country)
}

fun addError(
Expand All @@ -68,12 +86,12 @@ object Datadog {

// trackUserAction is used to track specific user actions (such as taps, clicks, and scrolls)
// with RumMonitor
fun trackUserAction(
private fun trackUserAction(
actionType: RumActionType,
name: String,
actionAttributes: Map<String, Any?> = emptyMap(),
) {
GlobalRum.get().addUserAction(actionType, name, actionAttributes)
GlobalRum.get().addUserAction(actionType, name, actionAttributes)
}

// trackUserClick is used to track user clicks with RumMonitor
Expand All @@ -94,6 +112,8 @@ object Datadog {

private fun createDatadogConfiguration(): Configuration {
val session = LanternApp.getSession()
val hTTPAddr = session.hTTPAddr
val uri = URI("http://" + hTTPAddr)
return Configuration.Builder(
logsEnabled = true,
tracesEnabled = true,
Expand All @@ -105,15 +125,16 @@ object Datadog {
Proxy(
Proxy.Type.HTTP,
InetSocketAddress(
session.settings.httpProxyHost,
session.settings.httpProxyPort.toInt(),
"127.0.0.1",
uri.getPort(),
),
),
null,
)
.sampleRumSessions(100f)
.setUploadFrequency(UploadFrequency.FREQUENT)
.useSite(DatadogSite.EU1)
.trackBackgroundRumEvents(true)
.trackInteractions()
.trackLongTasks()
.setFirstPartyHosts(tracedHosts)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import com.google.gson.JsonObject
import okhttp3.HttpUrl
import okhttp3.Response
import org.getlantern.lantern.LanternApp
import org.getlantern.lantern.datadog.Datadog
import org.getlantern.lantern.model.AccountInitializationStatus
import org.getlantern.lantern.model.LanternHttpClient
import org.getlantern.lantern.model.LanternHttpClient.ProCallback
Expand Down Expand Up @@ -62,6 +63,13 @@ class LanternService : Service(), ServiceManager.Runner {
EventBus.getDefault().post(loconf)
}
})

Datadog.initialize()

if (!BuildConfig.PLAY_VERSION && !BuildConfig.DEVELOPMENT_MODE) {
// check if an update is available
autoUpdater.checkForUpdates()
}
} catch (lnre: LanternNotRunningException) {
Logger.e(TAG, "Unable to start LanternService", lnre)
}
Expand Down
4 changes: 2 additions & 2 deletions appium_kotlin/app/src/test/resources/live/live_config.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,15 @@
"server": "hub-cloud.browserstack.com/wd/hub",
"username": "jigarj_SNsRyw",
"access_key": "dA4yyG26fHbfJxRUYMwr",
"app": "bs://5fb3d71c0a06de7d496ff6fceba612a15e835577",
"app": "bs://ac26c1c990dabab70870c250ec774ec9f63fa350",
"capabilities": {
"automationName": "Flutter",
"setWebContentsDebuggingEnabled": true,
"appium:noReset": true,
"appium:logLevel": true,
"enablePerformanceLogging": true,
"bstack:options": {
"appiumVersion": "2.0.0",
"appiumVersion": "2.0.1",
"networkLogs": true,
"projectName": "Lantern",
"buildName": "Lantern-APK",
Expand Down
2 changes: 1 addition & 1 deletion assets/locales/ar.po
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ msgid "Go Pro Title"
msgstr "الترقية إلى النسخة الاحترافية!"

msgid "Go Pro Description"
msgstr "احصل على سرعات فائقة وبيانات غير محدودة!"
msgstr ""

msgid "Server Location"
msgstr "موقع الخادم"
Expand Down
2 changes: 1 addition & 1 deletion assets/locales/bn.po
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ msgid "Go Pro Title"
msgstr "প্রো-তে যান!"

msgid "Go Pro Description"
msgstr "আরও দ্রুত গতি এবং সীমিত ডেটা আনলক করুন!"
msgstr ""

msgid "Server Location"
msgstr "সার্ভারের অবস্থান"
Expand Down
2 changes: 1 addition & 1 deletion assets/locales/en.po
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ msgid "Go Pro Title"
msgstr "Go Pro!"

msgid "Go Pro Description"
msgstr "Unlock faster speeds, and unlimited data!"
msgstr "Unlock faster speeds, ad-free experience, and unlimited data!"

msgid "Server Location"
msgstr "Server Location"
Expand Down
2 changes: 1 addition & 1 deletion assets/locales/es.po
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ msgid "Go Pro Title"
msgstr "¡Hágase Pro!"

msgid "Go Pro Description"
msgstr "¡Navegue a más velocidad y con datos ilimitados!"
msgstr ""

msgid "Server Location"
msgstr "Ubicación del servidor"
Expand Down
2 changes: 1 addition & 1 deletion assets/locales/fa.po
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ msgid "Go Pro Title"
msgstr "به نسخه حرفه‌ای بروید!"

msgid "Go Pro Description"
msgstr "به سرعت‌های بالاتر و داده‌های نامحدود دسترسی پیدا کنید!"
msgstr ""

msgid "Server Location"
msgstr "موقعیت سرور"
Expand Down
2 changes: 1 addition & 1 deletion assets/locales/fr.po
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ msgid "Go Pro Title"
msgstr "Passez à la version Pro !"

msgid "Go Pro Description"
msgstr "Profitez de vitesses plus rapides et de données illimitées !"
msgstr ""

msgid "Server Location"
msgstr "Emplacement du serveur"
Expand Down
2 changes: 1 addition & 1 deletion assets/locales/hi.po
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ msgid "Go Pro Title"
msgstr "Pro आज़माएँ!"

msgid "Go Pro Description"
msgstr "तेज गति, और असीमित डेटा अनलॉक करें!"
msgstr ""

msgid "Server Location"
msgstr "सर्वर स्थान"
Expand Down
2 changes: 1 addition & 1 deletion assets/locales/ms.po
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ msgid "Go Pro Title"
msgstr "Go Pro!"

msgid "Go Pro Description"
msgstr "Buka kunci kelajuan lebih pantas, dan data tanpa had!"
msgstr ""

msgid "Server Location"
msgstr "Lokasi Server"
Expand Down
1 change: 0 additions & 1 deletion assets/locales/ru.po
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,6 @@ msgstr "Перейдите на версию Pro!"

msgid "Go Pro Description"
msgstr ""
"Наслаждайтесь более высокой скоростью и неограниченным объемом данных!"

msgid "Server Location"
msgstr "Местоположение сервера"
Expand Down
2 changes: 1 addition & 1 deletion assets/locales/tr.po
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ msgid "Go Pro Title"
msgstr "Pro'ya Yükseltin!"

msgid "Go Pro Description"
msgstr "Daha yüksek hızlara ve sınırsız veriye ulaşın!"
msgstr ""

msgid "Server Location"
msgstr "Sunucu Konumu"
Expand Down
2 changes: 1 addition & 1 deletion assets/locales/ur.po
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ msgid "Go Pro Title"
msgstr "پرو اپنائیں!"

msgid "Go Pro Description"
msgstr "تیز رفتار، اور لامحدود ڈیٹا کو ان لاک کریں!"
msgstr ""

msgid "Server Location"
msgstr "سرور لوکیشن"
Expand Down
2 changes: 1 addition & 1 deletion assets/locales/vi.po
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ msgid "Go Pro Title"
msgstr "Lên Pro!"

msgid "Go Pro Description"
msgstr "Mở khóa tốc độ nhanh hơn và dữ liệu không giới hạn!"
msgstr ""

msgid "Server Location"
msgstr "Địa chỉ Server"
Expand Down
2 changes: 1 addition & 1 deletion assets/locales/zh-cn.po
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ msgid "Go Pro Title"
msgstr "专业互联!"

msgid "Go Pro Description"
msgstr "解锁流畅网速,数据不限量!"
msgstr ""

msgid "Server Location"
msgstr "服务器位置"
Expand Down
2 changes: 1 addition & 1 deletion assets/locales/zh-hk.po
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ msgid "Go Pro Title"
msgstr "升級至 Pro 版!"

msgid "Go Pro Description"
msgstr "速度更快,網路數據用量無上限!"
msgstr ""

msgid "Server Location"
msgstr "伺服器位置"
Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ require (
github.com/getlantern/dnsgrab v0.0.0-20211216020425-5d5e155a01a8
github.com/getlantern/errors v1.0.3
github.com/getlantern/eventual/v2 v2.0.2
github.com/getlantern/flashlight/v7 v7.6.7
github.com/getlantern/flashlight/v7 v7.6.8
github.com/getlantern/golog v0.0.0-20230503153817-8e72de7e0a65
github.com/getlantern/idletiming v0.0.0-20201229174729-33d04d220c4e
github.com/getlantern/ipproxy v0.0.0-20230511223023-ee52513fd782
Expand Down
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -373,8 +373,8 @@ github.com/getlantern/fdcount v0.0.0-20210503151800-5decd65b3731/go.mod h1:XZwE+
github.com/getlantern/filepersist v0.0.0-20160317154340-c5f0cd24e799/go.mod h1:8DGAx0LNUfXNnEH+fXI0s3OCBA/351kZCiz/8YSK3i8=
github.com/getlantern/filepersist v0.0.0-20210901195658-ed29a1cb0b7c h1:mcz27xtAkb1OuOLBct/uFfL1p3XxAIcFct82GbT+UZM=
github.com/getlantern/filepersist v0.0.0-20210901195658-ed29a1cb0b7c/go.mod h1:8DGAx0LNUfXNnEH+fXI0s3OCBA/351kZCiz/8YSK3i8=
github.com/getlantern/flashlight/v7 v7.6.7 h1:61ueXqAv2tzM2TjSfmL14I0oaxf6LhTYK2eHLAx29QQ=
github.com/getlantern/flashlight/v7 v7.6.7/go.mod h1:FLZhyLFeSojL4sRjQEaLRtVl4RB1DdliWegTsIqgzlI=
github.com/getlantern/flashlight/v7 v7.6.8 h1:z4jdHzZuHa0NT98ua8Qx24QIblDViyQ2RfgIxXAfibw=
github.com/getlantern/flashlight/v7 v7.6.8/go.mod h1:FLZhyLFeSojL4sRjQEaLRtVl4RB1DdliWegTsIqgzlI=
github.com/getlantern/framed v0.0.0-20190601192238-ceb6431eeede h1:yrU6Px3ZkvCsDLPryPGi6FN+2iqFPq+JeCb7EFoDBhw=
github.com/getlantern/framed v0.0.0-20190601192238-ceb6431eeede/go.mod h1:nhnoiS6DE6zfe+BaCMU4YI01UpsuiXnDqM5S8jxHuuI=
github.com/getlantern/fronted v0.0.0-20230601004823-7fec719639d8 h1:r/Z/SPPIfLXDI3QA7/tE6nOfPncrqeUPDjiFjnNGP50=
Expand Down
3 changes: 2 additions & 1 deletion lib/main.dart
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@ import 'package:lantern/common/common.dart';
Future<void> main() async {
// CI will be true only when running appium test
var CI = const String.fromEnvironment('CI', defaultValue: 'false');
print('CI is running $CI');
var boolCI = bool.fromEnvironment("CI", defaultValue: false);
print('Appium CI is running $CI and bool $boolCI');
if (CI == 'true') {
enableFlutterDriverExtension();
}
Expand Down
Loading

0 comments on commit e929813

Please sign in to comment.