Compare commits

...

10 commits

Author SHA1 Message Date
93f70e9ed5 Apply patch from https://github.com/daadu/receive_intent/pull/29
Some checks failed
analysis / package-analysis (push) Has been cancelled
2024-09-15 02:48:54 +02:00
Harsh Bhikadia
f7d1f35712 chore(release): bump to v0.2.5 2023-12-28 18:32:07 +05:30
Harsh Bhikadia
670f5470fb fix(android): upgrade to gradle 8.2 2023-12-28 18:30:54 +05:30
Derrick Gibelyou
7884309ec5
feat: add namespace directive for gradle 8.0 compatibility (#25)
* Add namespace directive for gradle 8.0 compatibility

* Check before adding namespace

* Replace jcenter with mavenCentral

Gradle 7 gives the following warning:

The RepositoryHandler.jcenter() method has been deprecated. This is scheduled to be removed in Gradle 8.0. JFrog announced JCenter's sunset in February 2021. Use mavenCentral() instead. Consult the upgrading guide for further information: https://docs.gradle.org/7.5/userguide/upgrading_version_6.html#jcenter_deprecation
        at build_25a2ym3sea7y143gert29dq0p$_run_closure1$_closure2.doCall(/home/derrick/.pub-cache/hosted/pub.dev/receive_intent-0.2.4/android/build.gradle:8)
        (Run with --stacktrace to get the full stack trace of this deprecation warning.)

The link states:
The jcenter() convenience method is now deprecated

JFrog announced the sunset of the JCenter repository in February 2021. Many Gradle builds rely on JCenter for project dependencies.

No new packages or versions are published to JCenter, but JFrog says they will keep JCenter running in a read-only state indefinitely. We recommend that you consider using mavenCentral(), google() or a private maven repository instead.

Gradle emits a deprecation warning when jcenter() is used as a repository and this method is scheduled to be removed in Gradle 8.0.

---------

Co-authored-by: Derrick Gibelyou <derrick@ourdatamine.com>
2023-12-28 18:17:35 +05:30
eric-nextsense
8578cc28ce
Gradle 8.2.0 compatibility (#26)
* Add namespace for AGP 8 compatibility

* Update kotlin version
2023-12-21 11:12:40 +05:30
Harsh Bhikadia
8b8e8fc6ef chore(contrib): added GeertJohan for coding 2023-05-20 22:18:31 +05:30
Harsh Bhikadia
70e3615e08 chore(realease): bump to v0.2.4 2023-05-20 22:16:15 +05:30
Harsh Bhikadia
744f499a67 fix(example): migrate to null-safety 2023-05-20 22:12:40 +05:30
Geert-Johan Riemer
6f3f0ef295
feat: added support for ByteArrays (#19) 2023-05-20 22:05:15 +05:30
Harsh Bhikadia
5950356e8d chore(release): bump to v0.2.3 2022-10-21 11:41:49 +05:30
16 changed files with 328 additions and 57 deletions

View file

@ -47,6 +47,34 @@
"bug",
"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,

184
29.patch Normal file
View 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

View file

@ -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
* **CHORE**: added proper lints and fixed some warnings

View file

@ -3,7 +3,7 @@
<p>
<!-- 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 -->
<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>
@ -158,12 +158,17 @@ Thanks goes to these wonderful people ([emoji key](https://allcontributors.org/d
<!-- prettier-ignore-start -->
<!-- markdownlint-disable -->
<table>
<tr>
<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>
<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"><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"><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>
</tr>
<tbody>
<tr>
<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" 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" 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>
<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>
<!-- markdownlint-restore -->

View file

@ -2,14 +2,14 @@ group 'com.bhikadia.receive_intent'
version '1.0-SNAPSHOT'
buildscript {
ext.kotlin_version = '1.5.31'
ext.kotlin_version = '1.9.25'
repositories {
google()
jcenter()
mavenCentral()
}
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"
}
}
@ -17,7 +17,7 @@ buildscript {
rootProject.allprojects {
repositories {
google()
jcenter()
mavenCentral()
}
}
@ -25,7 +25,20 @@ apply plugin: 'com.android.library'
apply plugin: 'kotlin-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 {
main.java.srcDirs += 'src/main/kotlin'
@ -36,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"
}

View file

@ -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-7.4.2-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.7-bin.zip

View file

@ -14,6 +14,7 @@ import io.flutter.plugin.common.MethodChannel
import io.flutter.plugin.common.MethodChannel.MethodCallHandler
import io.flutter.plugin.common.MethodChannel.Result
import org.json.JSONObject
// import android.util.Log
/** ReceiveIntentPlugin */
@ -35,8 +36,10 @@ class ReceiveIntentPlugin : FlutterPlugin, MethodCallHandler, EventChannel.Strea
private var initialIntent = true
private fun handleIntent(intent: Intent, fromPackageName: String?) {
//Log.e("ReceiveIntentPlugin", "intent: $intent")
//Log.e("ReceiveIntentPlugin", "fromPackageName: $fromPackageName")
// Log.e("ReceiveIntentPlugin", "intent: $intent")
// 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?>(
"fromPackageName" to fromPackageName,
"fromSignatures" to fromPackageName?.let { getApplicationSignature(context, it) },
@ -45,7 +48,7 @@ class ReceiveIntentPlugin : FlutterPlugin, MethodCallHandler, EventChannel.Strea
"categories" to intent.categories?.toList(),
"extra" to intent.extras?.let { bundleToJSON(it).toString() }
)
//Log.e("ReceiveIntentPlugin", "intentMap: $intentMap")
// Log.e("ReceiveIntentPlugin", "intentMap: $intentMap")
if (initialIntent) {
initialIntentMap = intentMap
initialIntent = false
@ -111,6 +114,7 @@ class ReceiveIntentPlugin : FlutterPlugin, MethodCallHandler, EventChannel.Strea
override fun onAttachedToActivity(binding: ActivityPluginBinding) {
activity = binding.activity
binding.addOnNewIntentListener(fun(intent: Intent?): Boolean {
// Log.e("addOnNewIntentListener", "intent: $intent")
intent?.let { handleIntent(it, binding.activity.callingActivity?.packageName) }
return false;
})

View file

@ -7,7 +7,7 @@ import android.net.Uri
import android.os.Build
import android.os.Bundle
import android.os.Parcelable
import android.util.Log
// import android.util.Log
import org.json.JSONArray
import org.json.JSONException
import org.json.JSONObject
@ -52,6 +52,7 @@ fun bundleToJSON(bundle: Bundle): JSONObject {
while (iterator.hasNext()) {
val key = iterator.next()
try {
// Log.e("ReceiveIntentPlugin wrapping key", "$key")
json.put(key, wrap(bundle.get(key)))
} catch (e: JSONException) {
e.printStackTrace()
@ -62,27 +63,31 @@ fun bundleToJSON(bundle: Bundle): JSONObject {
fun wrap(o: Any?): Any? {
if (o == null) {
// Log.e("ReceiveIntentPlugin", "$o is null")
return JSONObject.NULL
}
if (o is JSONArray || o is JSONObject) {
// Log.e("ReceiveIntentPlugin", "$o is JSONArray or JSONObject")
return o
}
if (o == JSONObject.NULL) {
// Log.e("ReceiveIntentPlugin", "$o is JSONObject.NULL")
return o
}
try {
if (o is Collection<*>) {
//Log.e("ReceiveIntentPlugin", "$o is Collection<*>")
// Log.e("ReceiveIntentPlugin", "$o is Collection<*>")
if (o is ArrayList<*>) {
// Log.e("ReceiveIntentPlugin", "..And also ArrayList")
return toJSONArray(o)
}
return JSONArray(o as Collection<*>?)
} else if (o.javaClass.isArray) {
//Log.e("ReceiveIntentPlugin", "$o is isArray")
// Log.e("ReceiveIntentPlugin", "$o is isArray")
return toJSONArray(o)
}
if (o is Map<*, *>) {
//Log.e("ReceiveIntentPlugin", "$o is Map<*, *>")
// Log.e("ReceiveIntentPlugin", "$o is Map<*, *>")
return JSONObject(o as Map<*, *>?)
}
if (o is Boolean ||
@ -100,7 +105,7 @@ fun wrap(o: Any?): Any? {
return o.toString()
}
} catch (e: Exception) {
//Log.e("ReceiveIntentPlugin", e.message, e)
// Log.e("ReceiveIntentPlugin", e.message, e)
}
return null
}
@ -109,21 +114,41 @@ fun wrap(o: Any?): Any? {
fun toJSONArray(array: Any): JSONArray? {
val result = JSONArray()
if (!array.javaClass.isArray && array !is ArrayList<*>) {
// Log.e("ReceiveIntentPlugin not a primitive array", "")
throw JSONException("Not a primitive array: " + array.javaClass)
}
when (array) {
is List<*> -> {
// Log.e("ReceiveIntentPlugin toJSONArray List", "")
// Log.e("ReceiveIntentPlugin toJSONArray List size", "${array.size}")
array.forEach { result.put(wrap(it)) }
}
is Array<*> -> {
// Log.e("ReceiveIntentPlugin toJSONArray Array", "")
// Log.e("ReceiveIntentPlugin toJSONArray Array size", "${array.size}")
array.forEach { result.put(wrap(it)) }
}
is ArrayList<*> -> {
// Log.e("ReceiveIntentPlugin toJSONArray ArrayList", "")
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
}

View file

@ -26,7 +26,20 @@ apply plugin: 'kotlin-android'
apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle"
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 {
main.java.srcDirs += 'src/main/kotlin'
@ -35,8 +48,8 @@ android {
defaultConfig {
// TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html).
applicationId "com.bhikadia.receive_intent_example"
minSdkVersion 16
targetSdkVersion 30
minSdkVersion flutter.minSdkVersion
targetSdkVersion 34
versionCode flutterVersionCode.toInteger()
versionName flutterVersionName
}
@ -53,7 +66,3 @@ android {
flutter {
source '../..'
}
dependencies {
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
}

View file

@ -5,6 +5,7 @@
android:icon="@mipmap/ic_launcher">
<activity
android:name=".MainActivity"
android:exported="true"
android:launchMode="singleTop"
android:theme="@style/LaunchTheme"
android:configChanges="orientation|keyboardHidden|keyboard|screenSize|smallestScreenSize|locale|layoutDirection|fontScale|screenLayout|density|uiMode"

View file

@ -1,12 +1,12 @@
buildscript {
ext.kotlin_version = '1.3.50'
ext.kotlin_version = '1.9.25'
repositories {
google()
jcenter()
mavenCentral()
}
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"
}
}
@ -14,7 +14,7 @@ buildscript {
allprojects {
repositories {
google()
jcenter()
mavenCentral()
}
}
@ -26,6 +26,6 @@ subprojects {
project.evaluationDependsOn(':app')
}
task clean(type: Delete) {
tasks.register("clean", Delete) {
delete rootProject.buildDir
}

View file

@ -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-6.7-all.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.7-bin.zip

View file

@ -10,14 +10,14 @@ void main() {
/// Example app widget for the plugin.
class MyApp extends StatefulWidget {
/// Constructor of MyApp widget.
const MyApp({Key key}) : super(key: key);
const MyApp({Key? key}) : super(key: key);
@override
State<MyApp> createState() => _MyAppState();
}
class _MyAppState extends State<MyApp> {
Intent _initialIntent;
Intent? _initialIntent;
@override
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(
child: Column(
children: [
@ -63,7 +63,7 @@ class _MyAppState extends State<MyApp> {
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
children: [
_buildFromIntent("INITIAL", _initialIntent),
StreamBuilder<Intent>(
StreamBuilder<Intent?>(
stream: ReceiveIntent.receivedIntentStream,
builder: (context, snapshot) =>
_buildFromIntent("STREAMED", snapshot.data),

View file

@ -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
environment:
sdk: ">=2.7.0 <3.0.0"
sdk: ">=2.12.0 <3.0.0"
dependencies:
flutter:

View file

@ -10,17 +10,5 @@ import 'package:flutter_test/flutter_test.dart';
import 'package:receive_intent_example/main.dart';
void main() {
testWidgets('Verify Platform version', (WidgetTester tester) async {
// 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,
);
});
// TODO
}

View file

@ -1,10 +1,10 @@
name: receive_intent
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
environment:
sdk: ">=2.12.0 <3.0.0"
sdk: ">=2.12.0 <4.0.0"
flutter: ">=1.20.0"
dependencies: