Skip to content

Commit

Permalink
DeepLink support for Android [ReportIssue] (#993)
Browse files Browse the repository at this point in the history
* Updates to LanternHttpClient and integrate MockK (#900)

* Add Kotlin-based LanternHttpClient

* Kotlin-based LanternHttpClient

* Kotlin-based LanternHttpClient

* Updates to LanternHttpClient

* Add tests

* Add tests

* Add LanternHttpClientTest

* formatting

* Add ProUser data class

* Formatting

---------

Co-authored-by: atavism <[email protected]>

* Use Plausible for app analytics (#929)

* Remove datadog

* Update CI

* update Makefile

* update Makefile

* remove datadog directory

* Use Sentry for crash reporting (#927)

* update Makefile

* Add back Sentry for crash reporting

* remove datadog from gradle config

* Add plausible

* integrate plausible analytics

* integrate plausible analytics

* track when ads are shown

* track when ads are shown

* add Plausible class

* track when Replica content is viewed

* track searches and uploads

* Formatting

* Track when ads fail to load as well

* updated translations...

* Don't switch languages that we don't support. (#944)

* Google Pay updates (#948)

* play payments updates

* Add check isPlayVersion

* skip play check

* Add play checkout page

* Add play checkout page

* clean-ups

* show dialog after successful payment

* clean-ups, show loading spinner submitting payment

* Add plan step and enter email text

* Add Flexible

* show price summary

* Add com.android.vending.BILLING permission

* Add logging

* Add logging

* Remove use of ProgressDialog and some clean-ups

* Remove use of ProgressDialog and some clean-ups

* Update Google Play billing client

* Add liblantern-all

* Update go.sum

* Update golang.org/x/mobile/cmd/gomobile

* run go mod tidy

* Update go.sum

* set GOPRIVATE var

* formatting

* code review updates

* Fix typo, do not append currency in-app billing

* fix typo, run ktlint

* fix typo, run ktlint

* Add setState and do not push page do pop

* Simplify method and fix error message.

* Removed billing-ktx since its not needed.

---------

Co-authored-by: Jigar-f <[email protected]>

* Updated to the latest flashlight with go 1.19 support

* update branch name

* update branch name

* use GITHUB_TOKEN

* use GITHUB_TOKEN

* Get build working with latest flashlight

* update golang.org/x/mobile (#958)

* update branch name

* update branch name

* use GITHUB_TOKEN

* use GITHUB_TOKEN

* update golang.org/x/mobile

* update golang.org/x/mobile

* Test building release

* run go mod tidy

* fix email validation on play checkout page

* fix email validation on play checkout page

* Update how release workflow is triggered

* rename branch to android-legacy to trigger release workflow

* Ads update (#953)

* Added artificial delay while connecting VPN.

* Remove static delay.

* fix typo and do not show delay if user does not have permissions.

* don't set changesNotSentForReview

* initialize plausible sdk in application class (#959)

* initialize Plausible after Lantern starts

* Make accountInitDialog nullable (#960)

* set accountInitDialog to null instead of lateinit

* remove unused imports

* Update to latest flashlight

* fixed missing device linking functionality (#965)

* bumped flashlight to version that properly notifies on geo updates

* Update PlausibleClient to check files for cached events exist (#966)

* Date Fix (#967)

* Refresh user data after purchase request.

* Refactor code and Hide date is vaules comes null or 0 from server.

* Fixed merge conflicts.

* Added Ads delay changes in go model.

* Downgrade to flashlight 7.6.19 due to IOS issue

* Make changes to run on Android & IOS.

* Implemented  google ads.

* Updated Google Ads sdk.

* Update ipproxy

* check for null

* check for null

* remove changesNotSentForReview since its causing an error

* Fix Expecting a condition in parentheses

* add pathdb dependency

* Updating to latest flashlight supporting go 1.20

* fix compile error

* Bump go version

* bump go.mod version

* do not check go version in Makefile

* Test building Android installer

* quick test

* Remove more references to datadog

* update flashlight

* ipproxy updates

* Android crash fixes (#975)

* Refactor reportIssue code on Kotlin and flutter.

* Upgrade webview and fix onStartCommand issue

* change Device linking API.

* Updated error message.

* Upgrade stripe and updated error object to multiple place

* Revert back stripe version.

* Added try catch and added formatter

* Update dnsgrab

* protect connections again

* Change null condition on payment method.

* use working ipproxy

* revert CI changes

* Update ipproxy again

* run go mod tidy, update protected

* Update ipproxy

* Update ipproxy

* update ipproxy, restore DialUDP

* Update ipproxy

* Added GDPR consent and updated google ads plugin. (#978)

* Update ipproxy and flashlight, use Go 1.21 (#970)

* Update ipproxy

* Fix Expecting a condition in parentheses

* add pathdb dependency

* Test building Android installer

* quick test

* update flashlight

* ipproxy updates

* Update dnsgrab

* protect connections again

* use working ipproxy

* revert CI changes

* Update ipproxy again

* run go mod tidy, update protected

* Update ipproxy

* Update ipproxy

* update ipproxy, restore DialUDP

* Update ipproxy

* use go version from go.mod

* Update ipproxy

* Update flashlight to v7.6.42

* update flashlight

* Use ios specific flashlight version and fix proto duplicate issue.

* use flashlight v7.6.43 again

* use flashlight v7.6.44 and restore protobuf messages

* Payment changes (#982)

* Added icon payload in plansV3 API.

* Removed plans API.

* Updated API payload and use Network images.

* Update vpn.proto

* Added search feature in split tunneling  screen. (#980)

* Added search feature in split tunneling screen.

* Made UI changes to split tunneling screen.

* Fix issue with update ui while search

* Added padding to bottom.

* fix showError call in report issue

* Updates to Plausible client (#981)

* updates to Plausible client

* do not track when user switches vpn on/off

* update domain for now

* override X-Forwarded-For header with the correct IP address of the client

* use magnet link when tracking Replica page views

* Add comment

* Add comment

* revert domain to android.lantern.io

* fix tests

* Upgrade sentry

* Remove changes to protect connections (#986)

* Update sentry

* remove changes to protect connections

* upgrade flashlight to v7.6.47

* update release workflow branch

* update CI to install protoc-gen-go

* set default selected tab to vpn/home screen

* use ANDROID_ARCH=all in make android-release

* Migrate to go-llsqlite/crawshaw (#987)

* Migrate to go-llsqlite/crawshaw

* Fix error fetching metadata for object info response

* Update liblantern-all.aar

* Minor fixes

* Update flashlight

* Updated flashlight and pods

* Use http client that goes uses domain fronting and proxying

* update flashlight

* Fix missing method error in invokeMethod getlantern/engineering#1193

* do not use BuildContext across async boundaries

* Remove secret and use env file (#990)

* Update .gitignore

* Added env file support.

* updated file name and fix ios issue.

* updated emoji picker.

* merge latest

* Start working on deeplink support.

* Added support for description on deeplink.

* Changes on deeplink.

* Updated packages and routes.

* Change report and issue route.

* added integration_test

---------

Co-authored-by: atavism <[email protected]>
Co-authored-by: atavism <[email protected]>
Co-authored-by: git <[email protected]>
Co-authored-by: Adam Fisk <[email protected]>
Co-authored-by: atavism <[email protected]>
Co-authored-by: Eli Yukelzon <[email protected]>
Co-authored-by: Matt Joiner <[email protected]>
  • Loading branch information
8 people authored Mar 4, 2024
1 parent 53d48f3 commit bac24ca
Show file tree
Hide file tree
Showing 6 changed files with 114 additions and 82 deletions.
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ internalsdk/protos/vpn.pb.go: protos_shared/vpn.proto
routes: lib/core/router/router.gr.dart

lib/core/router/router.gr.dart: $(shell find lib -name \*.dart -print)
@flutter packages pub run build_runner build --delete-conflicting-outputs
@dart run build_runner build --delete-conflicting-outputs

test:
@flutter test
Expand Down
111 changes: 65 additions & 46 deletions android/app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
android:installLocation="auto"
xmlns:tools="http://schemas.android.com/tools"
package="org.getlantern.lantern">
package="org.getlantern.lantern"
android:installLocation="auto">

<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE"/>
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.FOREGROUND_SERVICE" />
<uses-permission android:name="android.permission.VIBRATE" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
Expand All @@ -27,76 +28,88 @@
android:label="Request for sending mobiamobroadcast to Mobiamo"
android:protectionLevel="signature" />

<uses-permission
android:name="${applicationId}.mobiamo.PAYMENT_BROADCAST_PERMISSION"/>
<uses-permission android:name="${applicationId}.mobiamo.PAYMENT_BROADCAST_PERMISSION" />

<application
android:name="org.getlantern.lantern.LanternApp"
android:hardwareAccelerated="true"
tools:replace="allowBackup, label"
android:allowBackup="false"
android:requestLegacyExternalStorage="true"
android:hardwareAccelerated="true"
android:icon="@drawable/app_icon"
android:label="@string/app_name"
android:networkSecurityConfig="@xml/network_security_config"
android:persistent="true"
android:icon="@drawable/app_icon"
android:requestLegacyExternalStorage="true"
android:theme="@style/AppTheme"
android:label="@string/app_name">
tools:replace="allowBackup, label"
>

<meta-data android:name="io.sentry.dsn" android:value="https://[email protected]/5850353" />
<meta-data android:name="io.sentry.auto-init" android:value="false" />

<activity
android:name=".MainActivity"
android:launchMode="singleTop"
android:theme="@style/LaunchTheme"
android:exported="true"
android:configChanges="orientation|keyboardHidden|keyboard|screenSize|smallestScreenSize|locale|layoutDirection|fontScale|screenLayout|density|uiMode"
android:exported="true"
android:hardwareAccelerated="true"
android:launchMode="singleTask"
android:theme="@style/LaunchTheme"
android:windowSoftInputMode="adjustResize">
<!-- Specifies an Android theme to apply to this Activity as soon as
the Android process has started. This theme is visible to the user
while the Flutter UI initializes. After that, this theme continues
to determine the Window background behind the Flutter UI. -->
<meta-data
android:name="io.flutter.embedding.android.NormalTheme"
android:resource="@style/LaunchTheme"
/>
android:name="io.flutter.embedding.android.NormalTheme"
android:resource="@style/LaunchTheme" />
<intent-filter>
<action android:name="android.intent.action.MAIN"/>
<category android:name="android.intent.category.LAUNCHER"/>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>

<meta-data
android:name="flutter_deeplinking_enabled"
android:value="true" />

<intent-filter android:autoVerify="true">
<action android:name="android.intent.action.VIEW" />

<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />

<data
android:host="lantern.io"
android:scheme="https" />
</intent-filter>
</activity>

<service
android:name=".service.LanternService_"
android:enabled="true"
android:exported="false"
android:stopWithTask="false"
android:name=".service.LanternService_">
</service>
android:stopWithTask="false"/>

<receiver android:name = ".model.DeclineCallBroadcastReceiver" />
<receiver android:name=".model.DeclineCallBroadcastReceiver" />

<receiver android:name="org.getlantern.lantern.notification.NotificationReceiver" android:exported="true">
<receiver
android:name="org.getlantern.lantern.notification.NotificationReceiver"
android:exported="true">
<intent-filter>
<action android:name="org.getlantern.lantern.intent.VPN_DISCONNECTED"/>
<action android:name="org.getlantern.lantern.intent.VPN_DISCONNECTED" />
</intent-filter>
</receiver>

<activity
android:name=".activity.FreeKassaActivity_"
android:screenOrientation="portrait">
</activity>
android:screenOrientation="portrait"></activity>

<activity
android:name=".activity.WelcomeActivity_"
android:screenOrientation="portrait"
android:noHistory="true">
</activity>
android:noHistory="true"
android:screenOrientation="portrait"/>

<activity
android:name=".activity.WebViewActivity_"
android:screenOrientation="portrait"
/>
android:screenOrientation="portrait" />

<!-- It's required to update Lantern on API 24+ -->
<provider
Expand All @@ -109,33 +122,39 @@
android:resource="@xml/file_paths" />
</provider>

<service android:name="org.getlantern.lantern.vpn.LanternVpnService"
<service
android:name="org.getlantern.lantern.vpn.LanternVpnService"
android:exported="false"
android:permission="android.permission.BIND_VPN_SERVICE">
<intent-filter>
<action android:name="android.net.VpnService"/>
<action android:name="android.net.VpnService" />
</intent-filter>
</service>

<receiver android:name=".notification.Notifier"
<receiver
android:name=".notification.Notifier"
android:exported="false"> <!-- since we do specify an intent filter, this receiver will
be available to other apps by default, which is not what we want. We have to explicitly state that it's private within our app -->
<intent-filter>
<action android:name="${applicationId}.intent.DATA_USAGE" />
</intent-filter>
</receiver>

<!-- <receiver android:enabled="true" android:name=".service.AutoStarter"-->
<!-- android:permission="android.permission.RECEIVE_BOOT_COMPLETED"-->
<!-- android:exported="true">-->
<!-- <intent-filter>-->
<!-- <action android:name="android.intent.action.BOOT_COMPLETED" />-->
<!-- <category android:name="android.intent.category.DEFAULT" />-->
<!-- </intent-filter>-->
<!-- </receiver>-->
<!-- <receiver android:enabled="true" android:name=".service.AutoStarter"-->
<!-- android:permission="android.permission.RECEIVE_BOOT_COMPLETED"-->
<!-- android:exported="true">-->
<!-- <intent-filter>-->
<!-- <action android:name="android.intent.action.BOOT_COMPLETED" />-->
<!-- <category android:name="android.intent.category.DEFAULT" />-->
<!-- </intent-filter>-->
<!-- </receiver>-->

<meta-data android:name="google_analytics_adid_collection_enabled" android:value="false" />
<meta-data android:name="google_analytics_ssaid_collection_enabled" android:value="false" />
<meta-data
android:name="google_analytics_adid_collection_enabled"
android:value="false" />
<meta-data
android:name="google_analytics_ssaid_collection_enabled"
android:value="false" />

<!-- Don't delete the meta-data below.
This is used by the Flutter tool to generate GeneratedPluginRegistrant.java -->
Expand All @@ -145,6 +164,6 @@

<meta-data
android:name="com.google.android.gms.ads.APPLICATION_ID"
android:value="ca-app-pub-2685698271254859~9283700921"/>
android:value="ca-app-pub-2685698271254859~9283700921" />
</application>
</manifest>
7 changes: 4 additions & 3 deletions lib/account/report_issue.dart
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@ import 'package:lantern/common/ui/app_loading_dialog.dart';

@RoutePage<void>(name: 'ReportIssue')
class ReportIssue extends StatefulWidget {
ReportIssue({
Key? key,
}) : super(key: key);
final String? description;

const ReportIssue({Key? key, this.description}) : super(key: key);

@override
State<ReportIssue> createState() => _ReportIssueState();
Expand Down Expand Up @@ -40,6 +40,7 @@ class _ReportIssueState extends State<ReportIssue> {

final descFieldKey = GlobalKey<FormState>();
late final descController = CustomTextEditingController(
text: widget.description ?? '',
formKey: descFieldKey,
validator: (value) {
if (value!.isEmpty) {
Expand Down
22 changes: 20 additions & 2 deletions lib/app.dart
Original file line number Diff line number Diff line change
Expand Up @@ -113,8 +113,9 @@ class LanternApp extends StatelessWidget {
GlobalWidgetsLocalizations.delegate,
GlobalCupertinoLocalizations.delegate,
],
routeInformationParser: globalRouter.defaultRouteParser(),
routerDelegate: globalRouter.delegate(),
routerConfig: globalRouter.config(
deepLinkBuilder: navigateToDeepLink,
),
supportedLocales: const [
Locale('ar', 'EG'),
Locale('fr', 'FR'),
Expand All @@ -140,6 +141,23 @@ class LanternApp extends StatelessWidget {
);
}

DeepLink navigateToDeepLink(PlatformDeepLink deepLink) {
logger.d("DeepLink configuration: ${deepLink.configuration.toString()}");
if (deepLink.path.toLowerCase().startsWith('/report-issue')) {
logger.d("DeepLink uri: ${deepLink.uri.toString()}");
final pathUrl = deepLink.uri.toString();
final segment = pathUrl.split('#');
//If deeplink doesn't have data it should send to report issue with empty description'
if (segment.length >= 2) {
final description = segment[1];
return DeepLink([const Home(), ReportIssue(description: '#$description')]);
}
return DeepLink([const Home(), ReportIssue()]);
} else {
return DeepLink.defaultPath;
}
}

Locale currentLocale(String lang) {
if (lang == '' || lang.startsWith('en')) {
return const Locale('en', 'US');
Expand Down
48 changes: 21 additions & 27 deletions lib/core/router/router.gr.dart

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ dependencies:
flutter_switch: ^0.3.2
flag: ^7.0.0

#Loogs and crash reporting
#Loogs and crash reporting
catcher_2: ^1.0.0
sentry_flutter: ^7.16.1

Expand Down Expand Up @@ -162,8 +162,8 @@ flutter:
# included with your application, so that you can use the icons in
# the material Icons class.
uses-material-design: true
# module:
# androidX: true
# module:
# androidX: true

# To add assets to your application, add an assets section, like this:
assets:
Expand Down

0 comments on commit bac24ca

Please sign in to comment.