Skip to content

Commit

Permalink
Merge branch 'jan-milovanovic-minor' into minor
Browse files Browse the repository at this point in the history
  • Loading branch information
ryanheise committed Jul 17, 2024
2 parents e3abd9b + c62d77d commit f94d0d3
Show file tree
Hide file tree
Showing 8 changed files with 45 additions and 13 deletions.
5 changes: 5 additions & 0 deletions audio_service/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
## 0.18.15

* Add deep link support for FlutterFragmentActivity (@jan-milovanovic).
* Fix JDK 21 compile error.

## 0.18.14

* Support rxdart 0.28.x.
Expand Down
2 changes: 1 addition & 1 deletion audio_service/android/build.gradle
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
group 'com.ryanheise.audioservice'
version '1.0-SNAPSHOT'
def args = ["-Xlint:deprecation","-Xlint:unchecked","-Werror"]
def args = ["-Xlint:deprecation","-Xlint:unchecked"]

buildscript {
repositories {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,4 +33,16 @@ protected String getCachedEngineId() {
public boolean shouldDestroyEngineWithHost() {
return false;
}

// Make this protected method public
@Override
public String getInitialRoute() {
return super.getInitialRoute();
}

// Make this protected method public
@Override
public boolean shouldHandleDeeplinking() {
return super.shouldHandleDeeplinking();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@
import java.util.concurrent.Executors;

import io.flutter.embedding.android.FlutterActivity;
import io.flutter.embedding.android.FlutterFragmentActivity;
import io.flutter.embedding.engine.plugins.FlutterPlugin;
import io.flutter.embedding.engine.plugins.activity.ActivityPluginBinding;
import io.flutter.embedding.engine.plugins.activity.ActivityAware;
Expand Down Expand Up @@ -87,6 +88,20 @@ public static synchronized FlutterEngine getFlutterEngine(Context context) {
}
}
}
} else if (context instanceof AudioServiceFragmentActivity) {
final AudioServiceFragmentActivity activity = (AudioServiceFragmentActivity)context;
initialRoute = activity.getInitialRoute();
if (initialRoute == null) {
if (activity.shouldHandleDeeplinking()) {
Uri data = activity.getIntent().getData();
if (data != null) {
initialRoute = data.getPath();
if (data.getQuery() != null && !data.getQuery().isEmpty()) {
initialRoute += "?" + data.getQuery();
}
}
}
}
}
if (initialRoute == null) {
initialRoute = "/";
Expand Down
4 changes: 2 additions & 2 deletions audio_service/example/android/app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle"

android {
namespace 'com.ryanheise.audioserviceexample'
compileSdkVersion 33
compileSdkVersion 34

lintOptions {
disable 'InvalidPackage'
Expand All @@ -35,7 +35,7 @@ android {
defaultConfig {
applicationId "com.ryanheise.audioserviceexample"
minSdkVersion 21
targetSdkVersion 33
targetSdkVersion 34
versionCode flutterVersionCode.toInteger()
versionName flutterVersionName
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,7 @@
<uses-permission android:name="android.permission.INTERNET"/>
<uses-permission android:name="android.permission.WAKE_LOCK"/>
<uses-permission android:name="android.permission.FOREGROUND_SERVICE"/>
<!-- If targeting SDK 34 -->
<!-- <uses-permission android:name="android.permission.FOREGROUND_SERVICE_MEDIA_PLAYBACK"/> -->
<uses-permission android:name="android.permission.FOREGROUND_SERVICE_MEDIA_PLAYBACK"/>

<!-- For example_android_songs example -->
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
Expand Down
15 changes: 8 additions & 7 deletions audio_service/example/android/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,6 @@ allprojects {
google()
mavenCentral()
}

gradle.projectsEvaluated {
tasks.withType(JavaCompile) {
options.compilerArgs << "-Xlint:deprecation"
options.compilerArgs << "-Xlint:unchecked"
}
}
}

rootProject.buildDir = '../build'
Expand All @@ -34,3 +27,11 @@ subprojects {
tasks.register("clean", Delete) {
delete rootProject.buildDir
}

gradle.projectsEvaluated {
project(":audio_service") {
tasks.withType(JavaCompile) {
options.compilerArgs << "-Werror"
}
}
}
2 changes: 1 addition & 1 deletion audio_service/pubspec.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name: audio_service
description: Flutter plugin to play audio in the background while the screen is off.
version: 0.18.14
version: 0.18.15
repository: https://github.com/ryanheise/audio_service/tree/minor/audio_service
issue_tracker: https://github.com/ryanheise/audio_service/issues
topics:
Expand Down

0 comments on commit f94d0d3

Please sign in to comment.