From 890691023f2679a54440f7a062b70243efdf4d67 Mon Sep 17 00:00:00 2001 From: Alexander Dischberg Date: Thu, 22 Sep 2022 23:14:28 +0800 Subject: [PATCH 1/4] fix(android): onClickIntent should be widget independent --- .../tech/noxasch/app_widget/AppWidgetMethodCallHandler.kt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app_widget_android/android/src/main/kotlin/tech/noxasch/app_widget/AppWidgetMethodCallHandler.kt b/app_widget_android/android/src/main/kotlin/tech/noxasch/app_widget/AppWidgetMethodCallHandler.kt index a986c22..3f2cc34 100644 --- a/app_widget_android/android/src/main/kotlin/tech/noxasch/app_widget/AppWidgetMethodCallHandler.kt +++ b/app_widget_android/android/src/main/kotlin/tech/noxasch/app_widget/AppWidgetMethodCallHandler.kt @@ -229,7 +229,7 @@ class AppWidgetMethodCallHandler(private val context: Context, ) pendingIntentFlag = pendingIntentFlag or PendingIntent.FLAG_IMMUTABLE } - return PendingIntent.getActivity(context, 0, clickIntent, pendingIntentFlag) + return PendingIntent.getActivity(context, widgetId, clickIntent, pendingIntentFlag) } /// force reload the widget and this will trigger onUpdate in broadcast receiver From 72e4835fa70e53cbf9c1f5fb0ebf2c8c47e45db7 Mon Sep 17 00:00:00 2001 From: Alexander Dischberg Date: Thu, 22 Sep 2022 23:14:43 +0800 Subject: [PATCH 2/4] chore(android): bump version --- app_widget_android/example/pubspec.lock | 2 +- app_widget_android/pubspec.yaml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/app_widget_android/example/pubspec.lock b/app_widget_android/example/pubspec.lock index ea151f2..9afc376 100644 --- a/app_widget_android/example/pubspec.lock +++ b/app_widget_android/example/pubspec.lock @@ -7,7 +7,7 @@ packages: path: ".." relative: true source: path - version: "0.2.0" + version: "0.2.1" app_widget_platform_interface: dependency: transitive description: diff --git a/app_widget_android/pubspec.yaml b/app_widget_android/pubspec.yaml index 908e72a..9dac7c3 100644 --- a/app_widget_android/pubspec.yaml +++ b/app_widget_android/pubspec.yaml @@ -1,6 +1,6 @@ name: app_widget_android description: Android implementation for app_widget plugin -version: 0.2.0 +version: 0.2.1 homepage: https://noxasch.tech/ repository: https://github.com/noxasch/flutter_app_widget/tree/master/app_widget_android issue_tracker: https://github.com/noxasch/flutter_app_widget/issues From c155f4ca1c878f272d60bbec5b2174c78afb8189 Mon Sep 17 00:00:00 2001 From: Alexander Dischberg Date: Thu, 22 Sep 2022 23:19:41 +0800 Subject: [PATCH 3/4] chore: update change logs --- app_widget/CHANGELOG.md | 4 ++++ app_widget_android/CHANGELOG.md | 4 ++++ 2 files changed, 8 insertions(+) diff --git a/app_widget/CHANGELOG.md b/app_widget/CHANGELOG.md index 22d6e85..ca43abe 100644 --- a/app_widget/CHANGELOG.md +++ b/app_widget/CHANGELOG.md @@ -1,3 +1,7 @@ +## 0.2.1 + +* fix(android): onClickWidget callback should be independent on each widget + ## 0.2.0 * rename interface into more generic diff --git a/app_widget_android/CHANGELOG.md b/app_widget_android/CHANGELOG.md index 28a156b..fd607a6 100644 --- a/app_widget_android/CHANGELOG.md +++ b/app_widget_android/CHANGELOG.md @@ -1,3 +1,7 @@ +## 0.2.1 + +* fix(android): onClickWidget callback should be independent on each widget + ## 0.2.0 * breaking changes: `androidAppName` renamed to `androidPackageName` From cbae1da3487306587e4c36a4248704f15cc5e5aa Mon Sep 17 00:00:00 2001 From: Alexander Dischberg Date: Thu, 22 Sep 2022 23:21:47 +0800 Subject: [PATCH 4/4] chore: bump version --- app_widget/example/lib/main.dart | 31 +++++++++++++++++++------------ app_widget/example/pubspec.lock | 4 ++-- app_widget/pubspec.yaml | 4 ++-- 3 files changed, 23 insertions(+), 16 deletions(-) diff --git a/app_widget/example/lib/main.dart b/app_widget/example/lib/main.dart index 3aed0ce..eb3e860 100644 --- a/app_widget/example/lib/main.dart +++ b/app_widget/example/lib/main.dart @@ -1,3 +1,6 @@ +import 'dart:convert'; +import 'dart:math'; + import 'package:flutter/material.dart'; import 'package:app_widget/app_widget.dart'; @@ -124,12 +127,14 @@ class UpdateWidgetButton extends StatelessWidget { // send configure await _appWidgetPlugin.updateWidget( - widgetId: widgetId, - widgetLayout: 'example_layout', - textViews: { - 'widget_title': 'App Widget', - 'widget_message': 'Updated in flutter' - }); + widgetId: widgetId, + widgetLayout: 'example_layout', + textViews: { + 'widget_title': 'App Widget', + 'widget_message': 'Updated in flutter' + }, + payload: jsonEncode({'number': Random.secure().nextInt(10)}), + ); } }, child: const Text('Update Widget'), @@ -254,12 +259,14 @@ class ConfigureButton extends StatelessWidget { // send configure await _appWidgetPlugin.configureWidget( - widgetId: _widgetId!, - widgetLayout: 'example_layout', - textViews: { - 'widget_title': 'App Widget', - 'widget_message': 'Configured in flutter' - }); + widgetId: _widgetId!, + widgetLayout: 'example_layout', + textViews: { + 'widget_title': 'App Widget', + 'widget_message': 'Configured in flutter' + }, + payload: jsonEncode({'number': Random().nextInt(10)}), + ); messenger.showSnackBar( const SnackBar(content: Text('Widget has been configured!'))); } else { diff --git a/app_widget/example/pubspec.lock b/app_widget/example/pubspec.lock index de895fe..9d5fd07 100644 --- a/app_widget/example/pubspec.lock +++ b/app_widget/example/pubspec.lock @@ -7,14 +7,14 @@ packages: path: ".." relative: true source: path - version: "0.2.0" + version: "0.2.1" app_widget_android: dependency: transitive description: name: app_widget_android url: "https://pub.dartlang.org" source: hosted - version: "0.2.0" + version: "0.2.1" app_widget_platform_interface: dependency: transitive description: diff --git a/app_widget/pubspec.yaml b/app_widget/pubspec.yaml index f807c5a..7112a31 100644 --- a/app_widget/pubspec.yaml +++ b/app_widget/pubspec.yaml @@ -1,6 +1,6 @@ name: app_widget description: Flutter plugin to manage app widget / home screen widget from within flutter app. -version: 0.2.0 +version: 0.2.1 homepage: https://noxasch.tech/ repository: https://github.com/noxasch/flutter_app_widget/tree/master/app_widget issue_tracker: https://github.com/noxasch/flutter_app_widget/issues @@ -14,7 +14,7 @@ dependencies: sdk: flutter plugin_platform_interface: ^2.0.2 app_widget_platform_interface: ^0.2.0 - app_widget_android: ^0.2.0 + app_widget_android: ^0.2.1 # app_widget_platform_interface: # local dev # path: ../app_widget_platform_interface # app_widget_android: # local dev