Updated android project, dependencies and more

This commit is contained in:
Juan Gilsanz Polo
2025-04-03 21:47:26 +02:00
parent f8121ed492
commit 63aca1f3a5
10 changed files with 352 additions and 306 deletions

1
.gitignore vendored
View File

@@ -44,3 +44,4 @@ app.*.map.json
# Env file
.env
android/app/.cxx

View File

@@ -31,16 +31,16 @@ if (keystorePropertiesFile.exists()) {
android {
namespace "com.jgeek00.linkdy"
compileSdkVersion 34
compileSdkVersion 35
ndkVersion flutter.ndkVersion
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
sourceCompatibility JavaVersion.VERSION_21
targetCompatibility JavaVersion.VERSION_21
}
kotlinOptions {
jvmTarget = '1.8'
jvmTarget = '21'
}
sourceSets {
@@ -50,7 +50,7 @@ android {
defaultConfig {
applicationId "com.jgeek00.linkdy"
minSdkVersion 26
targetSdkVersion 34
targetSdkVersion 35
versionCode flutterVersionCode.toInteger()
versionName flutterVersionName
}

View File

@@ -1,5 +1,4 @@
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.jgeek00.linkdy">
<manifest xmlns:android="http://schemas.android.com/apk/res/android">
<uses-permission android:name="android.permission.INTERNET" />
<application
android:label="Linkdy"
@@ -29,11 +28,22 @@
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
<intent-filter>
<action android:name="android.intent.action.SEND" />
<category android:name="android.intent.category.DEFAULT" />
<data android:mimeType="text/*" />
</intent-filter>
<intent-filter>
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />
<data
android:scheme="https"
android:host="example.com"
android:pathPrefix="/invite" />
</intent-filter>
</activity>
<!-- Don't delete the meta-data below.
This is used by the Flutter tool to generate GeneratedPluginRegistrant.java -->

View File

@@ -1,5 +1,5 @@
buildscript {
ext.kotlin_version = '1.7.10'
ext.kotlin_version = '1.9.25'
repositories {
google()
mavenCentral()

View File

@@ -1,3 +1,6 @@
org.gradle.jvmargs=-Xmx4G
android.useAndroidX=true
android.enableJetifier=true
android.defaults.buildfeatures.buildconfig=true
android.nonTransitiveRClass=false
android.nonFinalResIds=false

View File

@@ -1,5 +1,7 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.10-bin.zip
networkTimeout=10000
validateDistributionUrl=true
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-7.5-all.zip

View File

@@ -23,7 +23,7 @@ pluginManagement {
plugins {
id "dev.flutter.flutter-plugin-loader" version "1.0.0"
id "com.android.application" version "7.3.0" apply false
id "com.android.application" version '8.2.2' apply false
}
include ":app"

View File

@@ -4,13 +4,12 @@ import 'package:flutter/foundation.dart';
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:flutter_dotenv/flutter_dotenv.dart';
import 'package:flutter_hooks/flutter_hooks.dart';
import 'package:flutter_localizations/flutter_localizations.dart';
import 'package:dynamic_color/dynamic_color.dart';
import 'package:hooks_riverpod/hooks_riverpod.dart';
import 'package:linkdy/utils/sentry_handle_error.dart';
import 'package:package_info_plus/package_info_plus.dart';
import 'package:receive_sharing_intent_plus/receive_sharing_intent_plus.dart';
import 'package:receive_sharing_intent/receive_sharing_intent.dart';
import 'package:sentry_flutter/sentry_flutter.dart';
import 'package:shared_preferences/shared_preferences.dart';
@@ -67,40 +66,46 @@ void main() async {
}
}
class MyApp extends HookConsumerWidget {
class MyApp extends StatefulHookConsumerWidget {
const MyApp({super.key});
@override
Widget build(BuildContext context, WidgetRef ref) {
final selectedColor = ref.watch(appStatusProvider).selectedColor;
final useDynamicColor = ref.watch(appStatusProvider).useDynamicTheme;
ConsumerState<MyApp> createState() => _MyAppState();
}
useEffect(
() {
// When app is on background
ReceiveSharingIntentPlus.getTextStream().listen(
class _MyAppState extends ConsumerState<MyApp> {
@override
void initState() {
super.initState();
ReceiveSharingIntent.instance.getMediaStream().listen(
(value) {
if (value.isNotEmpty) {
ref.read(receiveSharingIntentUrlProvider.notifier).setValue(value);
if (value.isNotEmpty &&
(value.first.type == SharedMediaType.url || (value.first.type == SharedMediaType.text))) {
ref.read(receiveSharingIntentUrlProvider.notifier).setValue(value.first.path);
ref.read(routerProvider).go(RoutesPaths.bookmarks);
}
},
onError: (e, stackTrace) => Sentry.captureException(e, stackTrace: stackTrace),
);
// When app is closed
ReceiveSharingIntentPlus.getInitialText().then((value) {
if (value != null) {
ref.read(receiveSharingIntentUrlProvider.notifier).setValue(value);
ReceiveSharingIntent.instance.getInitialMedia().then(
(value) {
if (value.isNotEmpty &&
(value.first.type == SharedMediaType.url || (value.first.type == SharedMediaType.text))) {
ref.read(receiveSharingIntentUrlProvider.notifier).setValue(value.first.path);
ref.read(routerProvider).go(RoutesPaths.bookmarks);
ReceiveSharingIntent.instance.reset();
}
ReceiveSharingIntentPlus.reset();
});
return null;
},
[],
onError: (e, stackTrace) => Sentry.captureException(e, stackTrace: stackTrace),
);
}
@override
Widget build(BuildContext context) {
final selectedColor = ref.watch(appStatusProvider).selectedColor;
final useDynamicColor = ref.watch(appStatusProvider).useDynamicTheme;
return DynamicColorBuilder(
builder: (lightDynamic, darkDynamic) {

File diff suppressed because it is too large Load Diff

View File

@@ -63,7 +63,10 @@ dependencies:
url: https://github.com/JGeek00/flutter_split_view
ref: master-alt
super_context_menu: ^0.8.16
receive_sharing_intent_plus: ^1.0.1
receive_sharing_intent:
git:
url: https://github.com/JGeek00/receive_sharing_intent
ref: master
dev_dependencies:
build_runner: ^2.4.8