Compare commits
10 commits
c5a7a93e5b
...
93f70e9ed5
Author | SHA1 | Date | |
---|---|---|---|
93f70e9ed5 | |||
|
f7d1f35712 | ||
|
670f5470fb | ||
|
7884309ec5 | ||
|
8578cc28ce | ||
|
8b8e8fc6ef | ||
|
70e3615e08 | ||
|
744f499a67 | ||
|
6f3f0ef295 | ||
|
5950356e8d |
16 changed files with 328 additions and 57 deletions
|
@ -47,6 +47,34 @@
|
||||||
"bug",
|
"bug",
|
||||||
"code"
|
"code"
|
||||||
]
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"login": "tneotia",
|
||||||
|
"name": "Tanay Neotia",
|
||||||
|
"avatar_url": "https://avatars.githubusercontent.com/u/50850142?v=4",
|
||||||
|
"profile": "https://github.com/tneotia",
|
||||||
|
"contributions": [
|
||||||
|
"bug",
|
||||||
|
"code"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"login": "GeertJohan",
|
||||||
|
"name": "Geert-Johan Riemer",
|
||||||
|
"avatar_url": "https://avatars.githubusercontent.com/u/564501?v=4",
|
||||||
|
"profile": "https://stack11.io/",
|
||||||
|
"contributions": [
|
||||||
|
"code"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"login": "derrickgw",
|
||||||
|
"name": "Derrick Gibelyou",
|
||||||
|
"avatar_url": "https://avatars.githubusercontent.com/u/26449929?v=4",
|
||||||
|
"profile": "https://github.com/derrickgw",
|
||||||
|
"contributions": [
|
||||||
|
"code"
|
||||||
|
]
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"contributorsPerLine": 7,
|
"contributorsPerLine": 7,
|
||||||
|
|
184
29.patch
Normal file
184
29.patch
Normal file
|
@ -0,0 +1,184 @@
|
||||||
|
From 0aea50296aa0995d95b1d8e5fea6740789e2cabc Mon Sep 17 00:00:00 2001
|
||||||
|
From: luckyrat <luckyrat@musites.com>
|
||||||
|
Date: Fri, 9 Aug 2024 10:38:35 +0100
|
||||||
|
Subject: [PATCH 1/3] Compile and target API 34
|
||||||
|
|
||||||
|
---
|
||||||
|
android/build.gradle | 2 +-
|
||||||
|
example/android/app/build.gradle | 8 ++------
|
||||||
|
example/android/app/src/main/AndroidManifest.xml | 2 +-
|
||||||
|
3 files changed, 4 insertions(+), 8 deletions(-)
|
||||||
|
|
||||||
|
diff --git a/android/build.gradle b/android/build.gradle
|
||||||
|
index fe07d5e..286b91b 100644
|
||||||
|
--- a/android/build.gradle
|
||||||
|
+++ b/android/build.gradle
|
||||||
|
@@ -29,7 +29,7 @@ android {
|
||||||
|
namespace 'com.bhikadia.receive_intent'
|
||||||
|
}
|
||||||
|
|
||||||
|
- compileSdkVersion 30
|
||||||
|
+ compileSdk 34
|
||||||
|
|
||||||
|
compileOptions {
|
||||||
|
sourceCompatibility JavaVersion.VERSION_1_8
|
||||||
|
diff --git a/example/android/app/build.gradle b/example/android/app/build.gradle
|
||||||
|
index 2b53f3b..20fe243 100644
|
||||||
|
--- a/example/android/app/build.gradle
|
||||||
|
+++ b/example/android/app/build.gradle
|
||||||
|
@@ -30,7 +30,7 @@ android {
|
||||||
|
namespace "com.bhikadia.receive_intent_example"
|
||||||
|
}
|
||||||
|
|
||||||
|
- compileSdkVersion flutter.compileSdkVersion
|
||||||
|
+ compileSdk flutter.compileSdkVersion
|
||||||
|
|
||||||
|
compileOptions {
|
||||||
|
sourceCompatibility JavaVersion.VERSION_1_8
|
||||||
|
@@ -49,7 +49,7 @@ android {
|
||||||
|
// TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html).
|
||||||
|
applicationId "com.bhikadia.receive_intent_example"
|
||||||
|
minSdkVersion flutter.minSdkVersion
|
||||||
|
- targetSdkVersion flutter.targetSdkVersion
|
||||||
|
+ targetSdkVersion 34
|
||||||
|
versionCode flutterVersionCode.toInteger()
|
||||||
|
versionName flutterVersionName
|
||||||
|
}
|
||||||
|
@@ -66,7 +66,3 @@ android {
|
||||||
|
flutter {
|
||||||
|
source '../..'
|
||||||
|
}
|
||||||
|
-
|
||||||
|
-dependencies {
|
||||||
|
- implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
|
||||||
|
-}
|
||||||
|
diff --git a/example/android/app/src/main/AndroidManifest.xml b/example/android/app/src/main/AndroidManifest.xml
|
||||||
|
index 3192446..c5f5177 100644
|
||||||
|
--- a/example/android/app/src/main/AndroidManifest.xml
|
||||||
|
+++ b/example/android/app/src/main/AndroidManifest.xml
|
||||||
|
@@ -5,7 +5,7 @@
|
||||||
|
android:icon="@mipmap/ic_launcher">
|
||||||
|
<activity
|
||||||
|
android:name=".MainActivity"
|
||||||
|
- android:exported="false"
|
||||||
|
+ android:exported="true"
|
||||||
|
android:launchMode="singleTop"
|
||||||
|
android:theme="@style/LaunchTheme"
|
||||||
|
android:configChanges="orientation|keyboardHidden|keyboard|screenSize|smallestScreenSize|locale|layoutDirection|fontScale|screenLayout|density|uiMode"
|
||||||
|
|
||||||
|
From 47da31d767f8cf73b1c37df0cb0ca6d84ead0a21 Mon Sep 17 00:00:00 2001
|
||||||
|
From: luckyrat <luckyrat@musites.com>
|
||||||
|
Date: Fri, 9 Aug 2024 10:39:32 +0100
|
||||||
|
Subject: [PATCH 2/3] Target Kotlin 1.9
|
||||||
|
|
||||||
|
---
|
||||||
|
android/build.gradle | 2 +-
|
||||||
|
example/android/build.gradle | 2 +-
|
||||||
|
2 files changed, 2 insertions(+), 2 deletions(-)
|
||||||
|
|
||||||
|
diff --git a/android/build.gradle b/android/build.gradle
|
||||||
|
index 286b91b..bc01ecf 100644
|
||||||
|
--- a/android/build.gradle
|
||||||
|
+++ b/android/build.gradle
|
||||||
|
@@ -2,7 +2,7 @@ group 'com.bhikadia.receive_intent'
|
||||||
|
version '1.0-SNAPSHOT'
|
||||||
|
|
||||||
|
buildscript {
|
||||||
|
- ext.kotlin_version = '1.7.22'
|
||||||
|
+ ext.kotlin_version = '1.9.25'
|
||||||
|
repositories {
|
||||||
|
google()
|
||||||
|
mavenCentral()
|
||||||
|
diff --git a/example/android/build.gradle b/example/android/build.gradle
|
||||||
|
index 513ce39..0d39e09 100644
|
||||||
|
--- a/example/android/build.gradle
|
||||||
|
+++ b/example/android/build.gradle
|
||||||
|
@@ -1,5 +1,5 @@
|
||||||
|
buildscript {
|
||||||
|
- ext.kotlin_version = '1.8.10'
|
||||||
|
+ ext.kotlin_version = '1.9.25'
|
||||||
|
repositories {
|
||||||
|
google()
|
||||||
|
jcenter()
|
||||||
|
|
||||||
|
From 13c662cbfb3a8f67984a8ffae1baf4e0f9e79aef Mon Sep 17 00:00:00 2001
|
||||||
|
From: luckyrat <luckyrat@musites.com>
|
||||||
|
Date: Fri, 9 Aug 2024 10:57:22 +0100
|
||||||
|
Subject: [PATCH 3/3] Upgrade to AGP 8.5 + Gradle 8.7
|
||||||
|
|
||||||
|
---
|
||||||
|
android/build.gradle | 5 ++---
|
||||||
|
android/gradle/wrapper/gradle-wrapper.properties | 2 +-
|
||||||
|
example/android/build.gradle | 6 +++---
|
||||||
|
example/android/gradle/wrapper/gradle-wrapper.properties | 2 +-
|
||||||
|
4 files changed, 7 insertions(+), 8 deletions(-)
|
||||||
|
|
||||||
|
diff --git a/android/build.gradle b/android/build.gradle
|
||||||
|
index bc01ecf..1a90f63 100644
|
||||||
|
--- a/android/build.gradle
|
||||||
|
+++ b/android/build.gradle
|
||||||
|
@@ -9,7 +9,7 @@ buildscript {
|
||||||
|
}
|
||||||
|
|
||||||
|
dependencies {
|
||||||
|
- classpath 'com.android.tools.build:gradle:8.2.0'
|
||||||
|
+ classpath 'com.android.tools.build:gradle:8.5.2'
|
||||||
|
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
@@ -49,6 +49,5 @@ android {
|
||||||
|
}
|
||||||
|
|
||||||
|
dependencies {
|
||||||
|
- implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk8:$kotlin_version"
|
||||||
|
- implementation "androidx.annotation:annotation:1.3.0"
|
||||||
|
+ implementation "androidx.annotation:annotation:1.8.2"
|
||||||
|
}
|
||||||
|
\ No newline at end of file
|
||||||
|
diff --git a/android/gradle/wrapper/gradle-wrapper.properties b/android/gradle/wrapper/gradle-wrapper.properties
|
||||||
|
index dc159ec..4518132 100644
|
||||||
|
--- a/android/gradle/wrapper/gradle-wrapper.properties
|
||||||
|
+++ b/android/gradle/wrapper/gradle-wrapper.properties
|
||||||
|
@@ -2,4 +2,4 @@ distributionBase=GRADLE_USER_HOME
|
||||||
|
distributionPath=wrapper/dists
|
||||||
|
zipStoreBase=GRADLE_USER_HOME
|
||||||
|
zipStorePath=wrapper/dists
|
||||||
|
-distributionUrl=https\://services.gradle.org/distributions/gradle-8.2-bin.zip
|
||||||
|
+distributionUrl=https\://services.gradle.org/distributions/gradle-8.7-bin.zip
|
||||||
|
diff --git a/example/android/build.gradle b/example/android/build.gradle
|
||||||
|
index 0d39e09..665dc0b 100644
|
||||||
|
--- a/example/android/build.gradle
|
||||||
|
+++ b/example/android/build.gradle
|
||||||
|
@@ -2,11 +2,11 @@ buildscript {
|
||||||
|
ext.kotlin_version = '1.9.25'
|
||||||
|
repositories {
|
||||||
|
google()
|
||||||
|
- jcenter()
|
||||||
|
+ mavenCentral()
|
||||||
|
}
|
||||||
|
|
||||||
|
dependencies {
|
||||||
|
- classpath 'com.android.tools.build:gradle:8.2.0'
|
||||||
|
+ classpath 'com.android.tools.build:gradle:8.5.2'
|
||||||
|
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
@@ -14,7 +14,7 @@ buildscript {
|
||||||
|
allprojects {
|
||||||
|
repositories {
|
||||||
|
google()
|
||||||
|
- jcenter()
|
||||||
|
+ mavenCentral()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
diff --git a/example/android/gradle/wrapper/gradle-wrapper.properties b/example/android/gradle/wrapper/gradle-wrapper.properties
|
||||||
|
index d07c7fc..a35eb1f 100644
|
||||||
|
--- a/example/android/gradle/wrapper/gradle-wrapper.properties
|
||||||
|
+++ b/example/android/gradle/wrapper/gradle-wrapper.properties
|
||||||
|
@@ -3,4 +3,4 @@ distributionBase=GRADLE_USER_HOME
|
||||||
|
distributionPath=wrapper/dists
|
||||||
|
zipStoreBase=GRADLE_USER_HOME
|
||||||
|
zipStorePath=wrapper/dists
|
||||||
|
-distributionUrl=https\://services.gradle.org/distributions/gradle-8.2-all.zip
|
||||||
|
+distributionUrl=https\://services.gradle.org/distributions/gradle-8.7-bin.zip
|
15
CHANGELOG.md
15
CHANGELOG.md
|
@ -1,3 +1,18 @@
|
||||||
|
## 0.2.5
|
||||||
|
|
||||||
|
* **FIX**: android: upgrade to gradle 8.2
|
||||||
|
* **FEAT**: add namespace directive for gradle 8.0 compatibility (#25)
|
||||||
|
* **FEAT**: Gradle 8.2.0 compatibility (#26)
|
||||||
|
|
||||||
|
## 0.2.4
|
||||||
|
|
||||||
|
* **FEAT**: added support for ByteArrays (#19)
|
||||||
|
* **FIX**: example: migrate to null-safety
|
||||||
|
|
||||||
|
## 0.2.3
|
||||||
|
|
||||||
|
* **FIX**: encode URI and ArrayList in JSON data (#14)
|
||||||
|
|
||||||
## 0.2.2
|
## 0.2.2
|
||||||
|
|
||||||
* **CHORE**: added proper lints and fixed some warnings
|
* **CHORE**: added proper lints and fixed some warnings
|
||||||
|
|
19
README.md
19
README.md
|
@ -3,7 +3,7 @@
|
||||||
|
|
||||||
<p>
|
<p>
|
||||||
<!-- ALL-CONTRIBUTORS-BADGE:START - Do not remove or modify this section -->
|
<!-- ALL-CONTRIBUTORS-BADGE:START - Do not remove or modify this section -->
|
||||||
<a href="#contributors-"><img src="https://img.shields.io/badge/all_contributors-4-orange.svg" alt="All Contributors" /></a>
|
<a href="#contributors-"><img src="https://img.shields.io/badge/all_contributors-7-orange.svg" alt="All Contributors" /></a>
|
||||||
<!-- ALL-CONTRIBUTORS-BADGE:END -->
|
<!-- ALL-CONTRIBUTORS-BADGE:END -->
|
||||||
<a href="https://pub.dev/packages/receive_intent"><img src="https://img.shields.io/pub/v/receive_intent?logo=dart" alt="pub.dev"></a>
|
<a href="https://pub.dev/packages/receive_intent"><img src="https://img.shields.io/pub/v/receive_intent?logo=dart" alt="pub.dev"></a>
|
||||||
<a href="https://github.com/daadu/receive_intent/actions?query=workflow%3Aanalysis"><img src="https://github.com/daadu/receive_intent/workflows/analysis/badge.svg" alt="analysis"></a>
|
<a href="https://github.com/daadu/receive_intent/actions?query=workflow%3Aanalysis"><img src="https://github.com/daadu/receive_intent/workflows/analysis/badge.svg" alt="analysis"></a>
|
||||||
|
@ -158,12 +158,17 @@ Thanks goes to these wonderful people ([emoji key](https://allcontributors.org/d
|
||||||
<!-- prettier-ignore-start -->
|
<!-- prettier-ignore-start -->
|
||||||
<!-- markdownlint-disable -->
|
<!-- markdownlint-disable -->
|
||||||
<table>
|
<table>
|
||||||
<tr>
|
<tbody>
|
||||||
<td align="center"><a href="https://bhikadia.com/"><img src="https://avatars.githubusercontent.com/u/4963236?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Harsh Bhikadia</b></sub></a><br /><a href="#ideas-daadu" title="Ideas, Planning, & Feedback">🤔</a> <a href="https://github.com/daadu/receive_intent/commits?author=daadu" title="Code">💻</a></td>
|
<tr>
|
||||||
<td align="center"><a href="https://the.lastgimbus.com/"><img src="https://avatars.githubusercontent.com/u/40139196?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Mateusz Soszyński</b></sub></a><br /><a href="https://github.com/daadu/receive_intent/commits?author=TheLastGimbus" title="Code">💻</a></td>
|
<td align="center" valign="top" width="14.28%"><a href="https://bhikadia.com/"><img src="https://avatars.githubusercontent.com/u/4963236?v=4?s=100" width="100px;" alt="Harsh Bhikadia"/><br /><sub><b>Harsh Bhikadia</b></sub></a><br /><a href="#ideas-daadu" title="Ideas, Planning, & Feedback">🤔</a> <a href="https://github.com/daadu/receive_intent/commits?author=daadu" title="Code">💻</a></td>
|
||||||
<td align="center"><a href="https://github.com/luckyrat"><img src="https://avatars.githubusercontent.com/u/1211375?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Chris Tomlinson</b></sub></a><br /><a href="https://github.com/daadu/receive_intent/commits?author=luckyrat" title="Code">💻</a></td>
|
<td align="center" valign="top" width="14.28%"><a href="https://the.lastgimbus.com/"><img src="https://avatars.githubusercontent.com/u/40139196?v=4?s=100" width="100px;" alt="Mateusz Soszyński"/><br /><sub><b>Mateusz Soszyński</b></sub></a><br /><a href="https://github.com/daadu/receive_intent/commits?author=TheLastGimbus" title="Code">💻</a></td>
|
||||||
<td align="center"><a href="https://github.com/eric-nextsense"><img src="https://avatars.githubusercontent.com/u/78733538?v=4?s=100" width="100px;" alt=""/><br /><sub><b>eric-nextsense</b></sub></a><br /><a href="https://github.com/daadu/receive_intent/issues?q=author%3Aeric-nextsense" title="Bug reports">🐛</a> <a href="https://github.com/daadu/receive_intent/commits?author=eric-nextsense" title="Code">💻</a></td>
|
<td align="center" valign="top" width="14.28%"><a href="https://github.com/luckyrat"><img src="https://avatars.githubusercontent.com/u/1211375?v=4?s=100" width="100px;" alt="Chris Tomlinson"/><br /><sub><b>Chris Tomlinson</b></sub></a><br /><a href="https://github.com/daadu/receive_intent/commits?author=luckyrat" title="Code">💻</a></td>
|
||||||
</tr>
|
<td align="center" valign="top" width="14.28%"><a href="https://github.com/eric-nextsense"><img src="https://avatars.githubusercontent.com/u/78733538?v=4?s=100" width="100px;" alt="eric-nextsense"/><br /><sub><b>eric-nextsense</b></sub></a><br /><a href="https://github.com/daadu/receive_intent/issues?q=author%3Aeric-nextsense" title="Bug reports">🐛</a> <a href="https://github.com/daadu/receive_intent/commits?author=eric-nextsense" title="Code">💻</a></td>
|
||||||
|
<td align="center" valign="top" width="14.28%"><a href="https://github.com/tneotia"><img src="https://avatars.githubusercontent.com/u/50850142?v=4?s=100" width="100px;" alt="Tanay Neotia"/><br /><sub><b>Tanay Neotia</b></sub></a><br /><a href="https://github.com/daadu/receive_intent/issues?q=author%3Atneotia" title="Bug reports">🐛</a> <a href="https://github.com/daadu/receive_intent/commits?author=tneotia" title="Code">💻</a></td>
|
||||||
|
<td align="center" valign="top" width="14.28%"><a href="https://stack11.io/"><img src="https://avatars.githubusercontent.com/u/564501?v=4?s=100" width="100px;" alt="Geert-Johan Riemer"/><br /><sub><b>Geert-Johan Riemer</b></sub></a><br /><a href="https://github.com/daadu/receive_intent/commits?author=GeertJohan" title="Code">💻</a></td>
|
||||||
|
<td align="center" valign="top" width="14.28%"><a href="https://github.com/derrickgw"><img src="https://avatars.githubusercontent.com/u/26449929?v=4?s=100" width="100px;" alt="Derrick Gibelyou"/><br /><sub><b>Derrick Gibelyou</b></sub></a><br /><a href="https://github.com/daadu/receive_intent/commits?author=derrickgw" title="Code">💻</a></td>
|
||||||
|
</tr>
|
||||||
|
</tbody>
|
||||||
</table>
|
</table>
|
||||||
|
|
||||||
<!-- markdownlint-restore -->
|
<!-- markdownlint-restore -->
|
||||||
|
|
|
@ -2,14 +2,14 @@ group 'com.bhikadia.receive_intent'
|
||||||
version '1.0-SNAPSHOT'
|
version '1.0-SNAPSHOT'
|
||||||
|
|
||||||
buildscript {
|
buildscript {
|
||||||
ext.kotlin_version = '1.5.31'
|
ext.kotlin_version = '1.9.25'
|
||||||
repositories {
|
repositories {
|
||||||
google()
|
google()
|
||||||
jcenter()
|
mavenCentral()
|
||||||
}
|
}
|
||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
classpath 'com.android.tools.build:gradle:7.1.2'
|
classpath 'com.android.tools.build:gradle:8.5.2'
|
||||||
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
|
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -17,7 +17,7 @@ buildscript {
|
||||||
rootProject.allprojects {
|
rootProject.allprojects {
|
||||||
repositories {
|
repositories {
|
||||||
google()
|
google()
|
||||||
jcenter()
|
mavenCentral()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -25,7 +25,20 @@ apply plugin: 'com.android.library'
|
||||||
apply plugin: 'kotlin-android'
|
apply plugin: 'kotlin-android'
|
||||||
|
|
||||||
android {
|
android {
|
||||||
compileSdkVersion 30
|
if (project.android.hasProperty("namespace")) {
|
||||||
|
namespace 'com.bhikadia.receive_intent'
|
||||||
|
}
|
||||||
|
|
||||||
|
compileSdk 34
|
||||||
|
|
||||||
|
compileOptions {
|
||||||
|
sourceCompatibility JavaVersion.VERSION_1_8
|
||||||
|
targetCompatibility JavaVersion.VERSION_1_8
|
||||||
|
}
|
||||||
|
|
||||||
|
kotlinOptions {
|
||||||
|
jvmTarget = '1.8'
|
||||||
|
}
|
||||||
|
|
||||||
sourceSets {
|
sourceSets {
|
||||||
main.java.srcDirs += 'src/main/kotlin'
|
main.java.srcDirs += 'src/main/kotlin'
|
||||||
|
@ -36,6 +49,5 @@ android {
|
||||||
}
|
}
|
||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk8:$kotlin_version"
|
implementation "androidx.annotation:annotation:1.8.2"
|
||||||
implementation "androidx.annotation:annotation:1.3.0"
|
}
|
||||||
}
|
|
|
@ -2,4 +2,4 @@ distributionBase=GRADLE_USER_HOME
|
||||||
distributionPath=wrapper/dists
|
distributionPath=wrapper/dists
|
||||||
zipStoreBase=GRADLE_USER_HOME
|
zipStoreBase=GRADLE_USER_HOME
|
||||||
zipStorePath=wrapper/dists
|
zipStorePath=wrapper/dists
|
||||||
distributionUrl=https\://services.gradle.org/distributions/gradle-7.4.2-bin.zip
|
distributionUrl=https\://services.gradle.org/distributions/gradle-8.7-bin.zip
|
||||||
|
|
|
@ -14,6 +14,7 @@ import io.flutter.plugin.common.MethodChannel
|
||||||
import io.flutter.plugin.common.MethodChannel.MethodCallHandler
|
import io.flutter.plugin.common.MethodChannel.MethodCallHandler
|
||||||
import io.flutter.plugin.common.MethodChannel.Result
|
import io.flutter.plugin.common.MethodChannel.Result
|
||||||
import org.json.JSONObject
|
import org.json.JSONObject
|
||||||
|
// import android.util.Log
|
||||||
|
|
||||||
|
|
||||||
/** ReceiveIntentPlugin */
|
/** ReceiveIntentPlugin */
|
||||||
|
@ -35,8 +36,10 @@ class ReceiveIntentPlugin : FlutterPlugin, MethodCallHandler, EventChannel.Strea
|
||||||
private var initialIntent = true
|
private var initialIntent = true
|
||||||
|
|
||||||
private fun handleIntent(intent: Intent, fromPackageName: String?) {
|
private fun handleIntent(intent: Intent, fromPackageName: String?) {
|
||||||
//Log.e("ReceiveIntentPlugin", "intent: $intent")
|
// Log.e("ReceiveIntentPlugin", "intent: $intent")
|
||||||
//Log.e("ReceiveIntentPlugin", "fromPackageName: $fromPackageName")
|
// val decodeData = intent.extras?.get("com.symbol.datawedge.decode_data")
|
||||||
|
// Log.e("ReceiveIntentPlugin", "decodeData: $decodeData")
|
||||||
|
// Log.e("ReceiveIntentPlugin", "fromPackageName: $fromPackageName")
|
||||||
val intentMap = mapOf<String, Any?>(
|
val intentMap = mapOf<String, Any?>(
|
||||||
"fromPackageName" to fromPackageName,
|
"fromPackageName" to fromPackageName,
|
||||||
"fromSignatures" to fromPackageName?.let { getApplicationSignature(context, it) },
|
"fromSignatures" to fromPackageName?.let { getApplicationSignature(context, it) },
|
||||||
|
@ -45,7 +48,7 @@ class ReceiveIntentPlugin : FlutterPlugin, MethodCallHandler, EventChannel.Strea
|
||||||
"categories" to intent.categories?.toList(),
|
"categories" to intent.categories?.toList(),
|
||||||
"extra" to intent.extras?.let { bundleToJSON(it).toString() }
|
"extra" to intent.extras?.let { bundleToJSON(it).toString() }
|
||||||
)
|
)
|
||||||
//Log.e("ReceiveIntentPlugin", "intentMap: $intentMap")
|
// Log.e("ReceiveIntentPlugin", "intentMap: $intentMap")
|
||||||
if (initialIntent) {
|
if (initialIntent) {
|
||||||
initialIntentMap = intentMap
|
initialIntentMap = intentMap
|
||||||
initialIntent = false
|
initialIntent = false
|
||||||
|
@ -111,6 +114,7 @@ class ReceiveIntentPlugin : FlutterPlugin, MethodCallHandler, EventChannel.Strea
|
||||||
override fun onAttachedToActivity(binding: ActivityPluginBinding) {
|
override fun onAttachedToActivity(binding: ActivityPluginBinding) {
|
||||||
activity = binding.activity
|
activity = binding.activity
|
||||||
binding.addOnNewIntentListener(fun(intent: Intent?): Boolean {
|
binding.addOnNewIntentListener(fun(intent: Intent?): Boolean {
|
||||||
|
// Log.e("addOnNewIntentListener", "intent: $intent")
|
||||||
intent?.let { handleIntent(it, binding.activity.callingActivity?.packageName) }
|
intent?.let { handleIntent(it, binding.activity.callingActivity?.packageName) }
|
||||||
return false;
|
return false;
|
||||||
})
|
})
|
||||||
|
|
|
@ -7,7 +7,7 @@ import android.net.Uri
|
||||||
import android.os.Build
|
import android.os.Build
|
||||||
import android.os.Bundle
|
import android.os.Bundle
|
||||||
import android.os.Parcelable
|
import android.os.Parcelable
|
||||||
import android.util.Log
|
// import android.util.Log
|
||||||
import org.json.JSONArray
|
import org.json.JSONArray
|
||||||
import org.json.JSONException
|
import org.json.JSONException
|
||||||
import org.json.JSONObject
|
import org.json.JSONObject
|
||||||
|
@ -52,6 +52,7 @@ fun bundleToJSON(bundle: Bundle): JSONObject {
|
||||||
while (iterator.hasNext()) {
|
while (iterator.hasNext()) {
|
||||||
val key = iterator.next()
|
val key = iterator.next()
|
||||||
try {
|
try {
|
||||||
|
// Log.e("ReceiveIntentPlugin wrapping key", "$key")
|
||||||
json.put(key, wrap(bundle.get(key)))
|
json.put(key, wrap(bundle.get(key)))
|
||||||
} catch (e: JSONException) {
|
} catch (e: JSONException) {
|
||||||
e.printStackTrace()
|
e.printStackTrace()
|
||||||
|
@ -62,27 +63,31 @@ fun bundleToJSON(bundle: Bundle): JSONObject {
|
||||||
|
|
||||||
fun wrap(o: Any?): Any? {
|
fun wrap(o: Any?): Any? {
|
||||||
if (o == null) {
|
if (o == null) {
|
||||||
|
// Log.e("ReceiveIntentPlugin", "$o is null")
|
||||||
return JSONObject.NULL
|
return JSONObject.NULL
|
||||||
}
|
}
|
||||||
if (o is JSONArray || o is JSONObject) {
|
if (o is JSONArray || o is JSONObject) {
|
||||||
|
// Log.e("ReceiveIntentPlugin", "$o is JSONArray or JSONObject")
|
||||||
return o
|
return o
|
||||||
}
|
}
|
||||||
if (o == JSONObject.NULL) {
|
if (o == JSONObject.NULL) {
|
||||||
|
// Log.e("ReceiveIntentPlugin", "$o is JSONObject.NULL")
|
||||||
return o
|
return o
|
||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
if (o is Collection<*>) {
|
if (o is Collection<*>) {
|
||||||
//Log.e("ReceiveIntentPlugin", "$o is Collection<*>")
|
// Log.e("ReceiveIntentPlugin", "$o is Collection<*>")
|
||||||
if (o is ArrayList<*>) {
|
if (o is ArrayList<*>) {
|
||||||
|
// Log.e("ReceiveIntentPlugin", "..And also ArrayList")
|
||||||
return toJSONArray(o)
|
return toJSONArray(o)
|
||||||
}
|
}
|
||||||
return JSONArray(o as Collection<*>?)
|
return JSONArray(o as Collection<*>?)
|
||||||
} else if (o.javaClass.isArray) {
|
} else if (o.javaClass.isArray) {
|
||||||
//Log.e("ReceiveIntentPlugin", "$o is isArray")
|
// Log.e("ReceiveIntentPlugin", "$o is isArray")
|
||||||
return toJSONArray(o)
|
return toJSONArray(o)
|
||||||
}
|
}
|
||||||
if (o is Map<*, *>) {
|
if (o is Map<*, *>) {
|
||||||
//Log.e("ReceiveIntentPlugin", "$o is Map<*, *>")
|
// Log.e("ReceiveIntentPlugin", "$o is Map<*, *>")
|
||||||
return JSONObject(o as Map<*, *>?)
|
return JSONObject(o as Map<*, *>?)
|
||||||
}
|
}
|
||||||
if (o is Boolean ||
|
if (o is Boolean ||
|
||||||
|
@ -100,7 +105,7 @@ fun wrap(o: Any?): Any? {
|
||||||
return o.toString()
|
return o.toString()
|
||||||
}
|
}
|
||||||
} catch (e: Exception) {
|
} catch (e: Exception) {
|
||||||
//Log.e("ReceiveIntentPlugin", e.message, e)
|
// Log.e("ReceiveIntentPlugin", e.message, e)
|
||||||
}
|
}
|
||||||
return null
|
return null
|
||||||
}
|
}
|
||||||
|
@ -109,21 +114,41 @@ fun wrap(o: Any?): Any? {
|
||||||
fun toJSONArray(array: Any): JSONArray? {
|
fun toJSONArray(array: Any): JSONArray? {
|
||||||
val result = JSONArray()
|
val result = JSONArray()
|
||||||
if (!array.javaClass.isArray && array !is ArrayList<*>) {
|
if (!array.javaClass.isArray && array !is ArrayList<*>) {
|
||||||
|
// Log.e("ReceiveIntentPlugin not a primitive array", "")
|
||||||
throw JSONException("Not a primitive array: " + array.javaClass)
|
throw JSONException("Not a primitive array: " + array.javaClass)
|
||||||
}
|
}
|
||||||
|
|
||||||
when (array) {
|
when (array) {
|
||||||
is List<*> -> {
|
is List<*> -> {
|
||||||
|
// Log.e("ReceiveIntentPlugin toJSONArray List", "")
|
||||||
|
// Log.e("ReceiveIntentPlugin toJSONArray List size", "${array.size}")
|
||||||
array.forEach { result.put(wrap(it)) }
|
array.forEach { result.put(wrap(it)) }
|
||||||
}
|
}
|
||||||
is Array<*> -> {
|
is Array<*> -> {
|
||||||
|
// Log.e("ReceiveIntentPlugin toJSONArray Array", "")
|
||||||
|
// Log.e("ReceiveIntentPlugin toJSONArray Array size", "${array.size}")
|
||||||
array.forEach { result.put(wrap(it)) }
|
array.forEach { result.put(wrap(it)) }
|
||||||
}
|
}
|
||||||
is ArrayList<*> -> {
|
is ArrayList<*> -> {
|
||||||
|
// Log.e("ReceiveIntentPlugin toJSONArray ArrayList", "")
|
||||||
array.forEach { result.put(wrap(it)) }
|
array.forEach { result.put(wrap(it)) }
|
||||||
}
|
}
|
||||||
|
is ByteArray -> {
|
||||||
|
// Log.e("ReceiveIntentPlugin toJSONArray ByteArray", "")
|
||||||
|
array.forEach { result.put(wrap(it)) }
|
||||||
|
}
|
||||||
|
else -> {
|
||||||
|
// val typename = array.javaClass.kotlin.simpleName
|
||||||
|
// Log.e("ReceiveIntentPlugin toJSONArray else", "$typename")
|
||||||
|
val length = java.lang.reflect.Array.getLength(array)
|
||||||
|
for (i in 0 until length) {
|
||||||
|
result.put(wrap(java.lang.reflect.Array.get(array, i)))
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Log.e("ReceiveIntentPlugin toJSONArray result", "$result")
|
||||||
|
|
||||||
return result
|
return result
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -26,7 +26,20 @@ apply plugin: 'kotlin-android'
|
||||||
apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle"
|
apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle"
|
||||||
|
|
||||||
android {
|
android {
|
||||||
compileSdkVersion 30
|
if (project.android.hasProperty("namespace")) {
|
||||||
|
namespace "com.bhikadia.receive_intent_example"
|
||||||
|
}
|
||||||
|
|
||||||
|
compileSdk flutter.compileSdkVersion
|
||||||
|
|
||||||
|
compileOptions {
|
||||||
|
sourceCompatibility JavaVersion.VERSION_1_8
|
||||||
|
targetCompatibility JavaVersion.VERSION_1_8
|
||||||
|
}
|
||||||
|
|
||||||
|
kotlinOptions {
|
||||||
|
jvmTarget = '1.8'
|
||||||
|
}
|
||||||
|
|
||||||
sourceSets {
|
sourceSets {
|
||||||
main.java.srcDirs += 'src/main/kotlin'
|
main.java.srcDirs += 'src/main/kotlin'
|
||||||
|
@ -35,8 +48,8 @@ android {
|
||||||
defaultConfig {
|
defaultConfig {
|
||||||
// TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html).
|
// TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html).
|
||||||
applicationId "com.bhikadia.receive_intent_example"
|
applicationId "com.bhikadia.receive_intent_example"
|
||||||
minSdkVersion 16
|
minSdkVersion flutter.minSdkVersion
|
||||||
targetSdkVersion 30
|
targetSdkVersion 34
|
||||||
versionCode flutterVersionCode.toInteger()
|
versionCode flutterVersionCode.toInteger()
|
||||||
versionName flutterVersionName
|
versionName flutterVersionName
|
||||||
}
|
}
|
||||||
|
@ -53,7 +66,3 @@ android {
|
||||||
flutter {
|
flutter {
|
||||||
source '../..'
|
source '../..'
|
||||||
}
|
}
|
||||||
|
|
||||||
dependencies {
|
|
||||||
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
|
|
||||||
}
|
|
||||||
|
|
|
@ -5,6 +5,7 @@
|
||||||
android:icon="@mipmap/ic_launcher">
|
android:icon="@mipmap/ic_launcher">
|
||||||
<activity
|
<activity
|
||||||
android:name=".MainActivity"
|
android:name=".MainActivity"
|
||||||
|
android:exported="true"
|
||||||
android:launchMode="singleTop"
|
android:launchMode="singleTop"
|
||||||
android:theme="@style/LaunchTheme"
|
android:theme="@style/LaunchTheme"
|
||||||
android:configChanges="orientation|keyboardHidden|keyboard|screenSize|smallestScreenSize|locale|layoutDirection|fontScale|screenLayout|density|uiMode"
|
android:configChanges="orientation|keyboardHidden|keyboard|screenSize|smallestScreenSize|locale|layoutDirection|fontScale|screenLayout|density|uiMode"
|
||||||
|
|
|
@ -1,12 +1,12 @@
|
||||||
buildscript {
|
buildscript {
|
||||||
ext.kotlin_version = '1.3.50'
|
ext.kotlin_version = '1.9.25'
|
||||||
repositories {
|
repositories {
|
||||||
google()
|
google()
|
||||||
jcenter()
|
mavenCentral()
|
||||||
}
|
}
|
||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
classpath 'com.android.tools.build:gradle:4.1.0'
|
classpath 'com.android.tools.build:gradle:8.5.2'
|
||||||
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
|
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -14,7 +14,7 @@ buildscript {
|
||||||
allprojects {
|
allprojects {
|
||||||
repositories {
|
repositories {
|
||||||
google()
|
google()
|
||||||
jcenter()
|
mavenCentral()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -26,6 +26,6 @@ subprojects {
|
||||||
project.evaluationDependsOn(':app')
|
project.evaluationDependsOn(':app')
|
||||||
}
|
}
|
||||||
|
|
||||||
task clean(type: Delete) {
|
tasks.register("clean", Delete) {
|
||||||
delete rootProject.buildDir
|
delete rootProject.buildDir
|
||||||
}
|
}
|
||||||
|
|
|
@ -3,4 +3,4 @@ distributionBase=GRADLE_USER_HOME
|
||||||
distributionPath=wrapper/dists
|
distributionPath=wrapper/dists
|
||||||
zipStoreBase=GRADLE_USER_HOME
|
zipStoreBase=GRADLE_USER_HOME
|
||||||
zipStorePath=wrapper/dists
|
zipStorePath=wrapper/dists
|
||||||
distributionUrl=https\://services.gradle.org/distributions/gradle-6.7-all.zip
|
distributionUrl=https\://services.gradle.org/distributions/gradle-8.7-bin.zip
|
||||||
|
|
|
@ -10,14 +10,14 @@ void main() {
|
||||||
/// Example app widget for the plugin.
|
/// Example app widget for the plugin.
|
||||||
class MyApp extends StatefulWidget {
|
class MyApp extends StatefulWidget {
|
||||||
/// Constructor of MyApp widget.
|
/// Constructor of MyApp widget.
|
||||||
const MyApp({Key key}) : super(key: key);
|
const MyApp({Key? key}) : super(key: key);
|
||||||
|
|
||||||
@override
|
@override
|
||||||
State<MyApp> createState() => _MyAppState();
|
State<MyApp> createState() => _MyAppState();
|
||||||
}
|
}
|
||||||
|
|
||||||
class _MyAppState extends State<MyApp> {
|
class _MyAppState extends State<MyApp> {
|
||||||
Intent _initialIntent;
|
Intent? _initialIntent;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
void initState() {
|
void initState() {
|
||||||
|
@ -35,7 +35,7 @@ class _MyAppState extends State<MyApp> {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
Widget _buildFromIntent(String label, Intent intent) {
|
Widget _buildFromIntent(String label, Intent? intent) {
|
||||||
return Center(
|
return Center(
|
||||||
child: Column(
|
child: Column(
|
||||||
children: [
|
children: [
|
||||||
|
@ -63,7 +63,7 @@ class _MyAppState extends State<MyApp> {
|
||||||
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
|
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
|
||||||
children: [
|
children: [
|
||||||
_buildFromIntent("INITIAL", _initialIntent),
|
_buildFromIntent("INITIAL", _initialIntent),
|
||||||
StreamBuilder<Intent>(
|
StreamBuilder<Intent?>(
|
||||||
stream: ReceiveIntent.receivedIntentStream,
|
stream: ReceiveIntent.receivedIntentStream,
|
||||||
builder: (context, snapshot) =>
|
builder: (context, snapshot) =>
|
||||||
_buildFromIntent("STREAMED", snapshot.data),
|
_buildFromIntent("STREAMED", snapshot.data),
|
||||||
|
|
|
@ -6,7 +6,7 @@ description: Demonstrates how to use the receive_intent plugin.
|
||||||
publish_to: 'none' # Remove this line if you wish to publish to pub.dev
|
publish_to: 'none' # Remove this line if you wish to publish to pub.dev
|
||||||
|
|
||||||
environment:
|
environment:
|
||||||
sdk: ">=2.7.0 <3.0.0"
|
sdk: ">=2.12.0 <3.0.0"
|
||||||
|
|
||||||
dependencies:
|
dependencies:
|
||||||
flutter:
|
flutter:
|
||||||
|
|
|
@ -10,17 +10,5 @@ import 'package:flutter_test/flutter_test.dart';
|
||||||
import 'package:receive_intent_example/main.dart';
|
import 'package:receive_intent_example/main.dart';
|
||||||
|
|
||||||
void main() {
|
void main() {
|
||||||
testWidgets('Verify Platform version', (WidgetTester tester) async {
|
// TODO
|
||||||
// Build our app and trigger a frame.
|
|
||||||
await tester.pumpWidget(const MyApp());
|
|
||||||
|
|
||||||
// Verify that platform version is retrieved.
|
|
||||||
expect(
|
|
||||||
find.byWidgetPredicate(
|
|
||||||
(Widget widget) =>
|
|
||||||
widget is Text && widget.data.startsWith('Running on:'),
|
|
||||||
),
|
|
||||||
findsOneWidget,
|
|
||||||
);
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,10 +1,10 @@
|
||||||
name: receive_intent
|
name: receive_intent
|
||||||
description: Flutter plugin for passing Android Intents to the Flutter environment.
|
description: Flutter plugin for passing Android Intents to the Flutter environment.
|
||||||
version: 0.2.2
|
version: 0.2.5
|
||||||
homepage: https://github.com/daadu/receive_intent
|
homepage: https://github.com/daadu/receive_intent
|
||||||
|
|
||||||
environment:
|
environment:
|
||||||
sdk: ">=2.12.0 <3.0.0"
|
sdk: ">=2.12.0 <4.0.0"
|
||||||
flutter: ">=1.20.0"
|
flutter: ">=1.20.0"
|
||||||
|
|
||||||
dependencies:
|
dependencies:
|
||||||
|
|
Loading…
Reference in a new issue