Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow http connection in debug mode and upgrade gradle script #321

Merged
merged 7 commits into from
Mar 16, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ jobs:
uses: actions/setup-java@v4
with:
distribution: 'temurin'
java-version: '11.x'
java-version: '17.x'
cache: 'gradle'

- name: Setup Flutter SDK
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/release-mobile.yml
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ jobs:
uses: actions/setup-java@v4
with:
distribution: 'temurin'
java-version: '11.x'
java-version: '17.x'
cache: 'gradle'

- name: Setup Flutter SDK
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ For iOS, add your `GoogleService-Info.plist` in `ios/config/<flavor/`.
On mobile, using plaintext HTTP connexions may raise issues.

#### Android
Update [AndroidManifest.xml](./android/app/src/main/AndroidManifest.xml):
Update [AndroidManifest.xml](./android/app/src/debug/AndroidManifest.xml):
```
<application
...
Expand Down
14 changes: 7 additions & 7 deletions android/app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ def keystoreProperties = new Properties()

android {
compileSdkVersion 34
ndkVersion flutter.ndkVersion
ndkVersion "25.1.8937393"

compileOptions {
coreLibraryDesugaringEnabled true
Expand All @@ -51,7 +51,6 @@ android {
}

defaultConfig {
// TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html).
applicationId "fr.myecl.titan"
minSdkVersion flutter.minSdkVersion
targetSdkVersion flutter.targetSdkVersion
Expand Down Expand Up @@ -102,14 +101,15 @@ flutter {
}

dependencies {
coreLibraryDesugaring 'com.android.tools:desugar_jdk_libs:1.1.5'
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:1.8.21"
implementation platform('com.google.firebase:firebase-bom:32.1.1')
coreLibraryDesugaring 'com.android.tools:desugar_jdk_libs:2.0.4'
implementation platform('com.google.firebase:firebase-bom:32.7.4')
}

android {

namespace 'com.example.myecl'
defaultConfig {
targetSdkVersion 33
minSdkVersion 19
targetSdkVersion 34
minSdkVersion flutter.minSdkVersion
}
}
9 changes: 9 additions & 0 deletions android/app/src/debug/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<manifest xmlns:android="http://schemas.android.com/apk/res/android">
<!-- The INTERNET permission is required for development. Specifically,
the Flutter tool needs it to communicate with the running application
to allow setting breakpoints, to provide hot reload, etc.
-->
<uses-permission android:name="android.permission.INTERNET"/>
<application
android:usesCleartextTraffic="true"/>
</manifest>
4 changes: 1 addition & 3 deletions android/app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -1,13 +1,11 @@
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.myecl">
<manifest xmlns:android="http://schemas.android.com/apk/res/android">
<uses-permission android:name="android.permission.INTERNET" />
<!-- <uses-permission android:name="android.permission.CAMERA" /> -->
<!-- <uses-permission android:name="android.permission.FLASHLIGHT" /> -->
<application
android:label="@string/app_name"
android:name="${applicationName}"
android:icon="@mipmap/ic_launcher"
android:usesCleartextTraffic="true"
android:enableOnBackInvokedCallback="true">
<activity
android:name=".MainActivity"
Expand Down
7 changes: 7 additions & 0 deletions android/app/src/profile/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
<manifest xmlns:android="http://schemas.android.com/apk/res/android">
<!-- The INTERNET permission is required for development. Specifically,
the Flutter tool needs it to communicate with the running application
to allow setting breakpoints, to provide hot reload, etc.
-->
<uses-permission android:name="android.permission.INTERNET"/>
</manifest>
3 changes: 3 additions & 0 deletions android/gradle.properties
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
org.gradle.jvmargs=-Xmx1536M
android.useAndroidX=true
android.enableJetifier=true
android.defaults.buildfeatures.buildconfig=true
android.nonTransitiveRClass=false
android.nonFinalResIds=false
2 changes: 1 addition & 1 deletion android/gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#Wed Nov 09 22:02:36 CET 2022
distributionBase=GRADLE_USER_HOME
distributionUrl=https\://services.gradle.org/distributions/gradle-7.6.1-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.4-bin.zip
distributionPath=wrapper/dists
zipStorePath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
2 changes: 1 addition & 1 deletion android/settings.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ pluginManagement {

plugins {
id "dev.flutter.flutter-plugin-loader" version "1.0.0"
id "com.android.application" version "7.3.1" apply false
id "com.android.application" version '8.3.0' apply false
id "org.jetbrains.kotlin.android" version "1.8.21" apply false
id "com.google.gms.google-services" version "4.3.15" apply false
}
Expand Down
6 changes: 5 additions & 1 deletion lib/auth/providers/openid_provider.dart
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import 'package:jwt_decoder/jwt_decoder.dart';
import 'package:flutter_riverpod/flutter_riverpod.dart';
import 'package:flutter_secure_storage/flutter_secure_storage.dart';
import 'package:flutter_appauth/flutter_appauth.dart';
import 'package:flutter/foundation.dart' show kIsWeb;
import 'package:flutter/foundation.dart' show kDebugMode, kIsWeb;
import 'package:myecl/auth/providers/is_connected_provider.dart';
import 'package:myecl/auth/repository/openid_repository.dart';
import 'package:myecl/tools/cache/cache_manager.dart';
Expand Down Expand Up @@ -218,6 +218,7 @@ class OpenIdTokenProvider
redirectUrl,
discoveryUrl: discoveryUrl,
scopes: scopes,
allowInsecureConnections: kDebugMode,
),
);
if (resp != null) {
Expand Down Expand Up @@ -257,6 +258,7 @@ class OpenIdTokenProvider
discoveryUrl: discoveryUrl,
scopes: scopes,
refreshToken: token,
allowInsecureConnections: kDebugMode,
));
if (resp != null) {
state = AsyncValue.data({
Expand Down Expand Up @@ -285,6 +287,7 @@ class OpenIdTokenProvider
discoveryUrl: discoveryUrl,
scopes: scopes,
authorizationCode: authorizationToken,
allowInsecureConnections: kDebugMode,
))
.then((resp) {
if (resp != null) {
Expand All @@ -309,6 +312,7 @@ class OpenIdTokenProvider
discoveryUrl: discoveryUrl,
scopes: scopes,
refreshToken: token[refreshTokenKey] as String,
allowInsecureConnections: kDebugMode,
),
);
if (resp == null) {
Expand Down