diff --git a/.github/FUNDING.yml b/.github/FUNDING.yml new file mode 100644 index 00000000..4a3c12c9 --- /dev/null +++ b/.github/FUNDING.yml @@ -0,0 +1 @@ +github: abausg \ No newline at end of file diff --git a/.github/assets/target_membership.png b/.github/assets/target_membership.png new file mode 100644 index 00000000..56f08d61 Binary files /dev/null and b/.github/assets/target_membership.png differ diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 66ea045f..fa16460d 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -75,14 +75,19 @@ jobs: strategy: matrix: device: - - "iPhone 13" + - "iPhone 14" fail-fast: false - runs-on: macos-latest + runs-on: macos-13 steps: - uses: actions/checkout@v2 + - uses: maxim-lobanov/setup-xcode@v1 + with: + xcode-version: latest + - name: Download iOS 17 + run: xcodebuild -downloadPlatform ios - uses: subosito/flutter-action@v1 with: - channel: stable + channel: beta - uses: futureware-tech/simulator-action@v1 id: simulator with: diff --git a/CHANGELOG.md b/CHANGELOG.md index ad4e2777..6876aa1a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,8 @@ +## 0.4.0 +* Add support for Interactive Widgets on iOS +* Rename `registerBackgroundCallback` to `registerInteractivityCallback` +* Restructure README + ## 0.3.1 * fix: Fix Null Pointer when Saving `renderFlutterWidget` by [milindgoel15](https://github.com/milindgoel15) in [#182](https://github.com/ABausG/home_widget/pull/182) * fix: Update Gradle to 8 by [milindgoel15](https://github.com/milindgoel15) in [#155](https://github.com/ABausG/home_widget/pull/155) diff --git a/README.md b/README.md index bfa77ba0..39648ff5 100644 --- a/README.md +++ b/README.md @@ -17,49 +17,6 @@ HomeWidget does **not** allow writing Widgets with Flutter itself. It still requ ## Platform Setup In order to work correctly there needs to be some platform specific setup. Check below on how to add support for Android and iOS -
Android - -### Create Widget Layout inside `android/app/src/main/res/layout` - -### Create Widget Configuration into `android/app/src/main/res/xml` -```xml - - - -``` - -### Add WidgetReceiver to AndroidManifest -```xml - - - - - - -``` - -### Write your WidgetProvider -For convenience, you can extend from [HomeWidgetProvider](android/src/main/kotlin/es/antonborri/home_widget/HomeWidgetProvider.kt) which gives you access to a SharedPreferences Object with the Data in the `onUpdate` method. -In case you don't want to use the convenience Method you can access the Data using -```kotlin -import es.antonborri.home_widget.HomeWidgetPlugin -... -HomeWidgetPlugin.getData(context) -``` -which will give you access to the same SharedPreferences - -### More Information -For more Information on how to create and configure Android Widgets, check out [this guide](https://developer.android.com/develop/ui/views/appwidgets) on the Android Developers Page. - -
-
iOS ### Add a Widget to your App in Xcode @@ -106,11 +63,56 @@ let data = UserDefaults.init(suiteName:"YOUR_GROUP_ID") ```
+
Android + +### Create Widget Layout inside `android/app/src/main/res/layout` + +### Create Widget Configuration into `android/app/src/main/res/xml` +```xml + + + +``` + +### Add WidgetReceiver to AndroidManifest +```xml + + + + + + +``` + +### Write your WidgetProvider +For convenience, you can extend from [HomeWidgetProvider](android/src/main/kotlin/es/antonborri/home_widget/HomeWidgetProvider.kt) which gives you access to a SharedPreferences Object with the Data in the `onUpdate` method. +In case you don't want to use the convenience Method you can access the Data using +```kotlin +import es.antonborri.home_widget.HomeWidgetPlugin +... +HomeWidgetPlugin.getData(context) +``` +which will give you access to the same SharedPreferences + +### More Information +For more Information on how to create and configure Android Widgets, check out [this guide](https://developer.android.com/develop/ui/views/appwidgets) on the Android Developers Page. + +
+ ## Usage ### Setup +
iOS For iOS, you need to call `HomeWidget.setAppGroupId('YOUR_GROUP_ID');` Without this you won't be able to share data between your App and the Widget and calls to `saveWidgetData` and `getWidgetData` will return an error +
### Save Data In order to save Data call `HomeWidget.saveWidgetData('id', data)` @@ -136,59 +138,105 @@ This name needs to be equal to the Kind specified in you Widget ### Retrieve Data To retrieve the current Data saved in the Widget call `HomeWidget.getWidgetData('id', defaultValue: data)` -### Background Update -As the methods of HomeWidget are static it is possible to use HomeWidget in the background to update the Widget even when the App is in the background. +### Interactive Widgets -The example App is using the [flutter_workmanager](https://pub.dev/packages/workmanager) plugin to achieve this. -Please follow the Setup Instructions for flutter_workmanager (or your preferred background code execution plugin). Most notably make sure that Plugins get registered in iOS in order to be able to communicate with the HomeWidget Plugin. -In case of flutter_workmanager this achieved by adding: -```swift -WorkmanagerPlugin.setPluginRegistrantCallback { registry in - GeneratedPluginRegistrant.register(with: registry) -} -``` -to [AppDelegate.swift](example/ios/Runner/AppDelegate.swift) +Android and iOS (starting with iOS 17) allow widgets to have interactive Elements like Buttons -### Clicking -To detect if the App has been initially started by clicking the Widget you can call `HomeWidget.initiallyLaunchedFromHomeWidget()` if the App was already running in the Background you can receive these Events by listening to `HomeWidget.widgetClicked`. Both methods will provide Uris, so you can easily send back data from the Widget to the App to for example navigate to a content page. +
Dart -In order for these methods to work you need to follow these steps: +1. Write a **static** function that takes a Uri as an argument. This will get called when a user clicks on the View + ```dart + @pragma("vm:entry-point") + FutureOr backgroundCallback(Uri data) async { + // do something with data + ... + } + ``` + `@pragma('vm:entry-point')` must be placed above the `callback` function to avoid tree shaking in release mode. -#### iOS -Add `.widgetUrl` to your WidgetComponent -```swift -Text(entry.message) - .font(.body) - .widgetURL(URL(string: "homeWidgetExample://message?message=\(entry.message)&homeWidget")) -``` -In order to only detect Widget Links you need to add the queryParameter`homeWidget` to the URL +2. Register the callback function by calling + ```dart + HomeWidget.registerInteractivityCallback(backgroundCallback); + ``` +
-#### Android -Add an `IntentFilter` to the `Activity` Section in your `AndroidManifest` -``` - - - -``` +
iOS -In your WidgetProvider add a PendingIntent to your View using `HomeWidgetLaunchIntent.getActivity` -```kotlin -val pendingIntentWithData = HomeWidgetLaunchIntent.getActivity( - context, - MainActivity::class.java, - Uri.parse("homeWidgetExample://message?message=$message")) -setOnClickPendingIntent(R.id.widget_message, pendingIntentWithData) -``` +1. Adjust your Podfile to add `home_widget` as a dependency to your WidgetExtension + ``` + target 'YourWidgetExtension' do + use_frameworks! + use_modular_headers! -### Background Click + pod 'home_widget', :path => '.symlinks/plugins/home_widget/ios' +end + ``` +2. To be able to use plugins with the Background Callback add this to your AppDelegate's `application` function + ```swift + if #available(iOS 17, *) { + HomeWidgetBackgroundWorker.setPluginRegistrantCallback { registry in + GeneratedPluginRegistrant.register(with: registry) + } + } + ``` +3. Create a custom `AppIntent` in your App Target (Runner) and make sure to select both your App and your WidgetExtension in the Target Membership panel + + ![Target Membership](https://github.com/ABausG/home_widget/blob/main/.github/assets/target_membership.png?raw=true) + + In this Intent you should import `home_widget` and call `HomeWidgetBackgroundWorker.run(url: url, appGroup: appGroup!)` in the perform method. `url` and `appGroup` can be either hardcoded or set as parameters from the Widget + ```swift + import AppIntents + import Flutter + import Foundation + import home_widget + + @available(iOS 16, *) + public struct BackgroundIntent: AppIntent { + static public var title: LocalizedStringResource = "HomeWidget Background Intent" + + @Parameter(title: "Widget URI") + var url: URL? + + @Parameter(title: "AppGroup") + var appGroup: String? + + public init() {} + + public init(url: URL?, appGroup: String?) { + self.url = url + self.appGroup = appGroup + } + + public func perform() async throws -> some IntentResult { + await HomeWidgetBackgroundWorker.run(url: url, appGroup: appGroup!) + + return .result() + } + } + ``` +4. Add a Button to your Widget. This Button might be encapsulated by a Version check. Pass in an instance of the `AppIntent` created in the previous step + ```swift + Button( + intent: BackgroundIntent( + url: URL(string: "homeWidgetExample://titleClicked"), appGroup: widgetGroupId) + ) { + Text(entry.title).bold().font( /*@START_MENU_TOKEN@*/.title /*@END_MENU_TOKEN@*/) + }.buttonStyle(.plain) + ``` +5. With the current setup the Widget is now Interactive as long as the App is still in the background. If you want to have the Widget be able to wake the App up you need to add the following to your `AppIntent` file + ```swift + @available(iOS 16, *) + @available(iOSApplicationExtension, unavailable) + extension BackgroundIntent: ForegroundContinuableIntent {} + ``` + This code tells the system to always perform the Intent in the App and not in a process attached to the Widget. Note however that this will start your Flutter App using the normal main entrypoint meaning your full app might be run in the background. To counter this you should add checks in the very first Widget you build inside `runApp` to only perform necessary calls/setups while the App is launched in the background +
-Android allows interactive elements in HomeScreenWidgets. This allows to for example add a refresh button on a widget. -With home_widget you can use this by following these steps: +
Android -#### Android/Native Part 1. Add the necessary Receiver and Service to you `AndroidManifest.xml` file ``` - + @@ -204,26 +252,13 @@ With home_widget you can use this by following these steps: ) setOnClickPendingIntent(R.id.widget_title, backgroundIntent) ``` +
-#### Dart -4. Write a **static** function that takes a Uri as an argument. This will get called when a user clicks on the View - ```dart - @pragma("vm:entry-point") - void backgroundCallback(Uri data) { - // do something with data - ... - } - ``` - `@pragma('vm:entry-point')` must be placed above the `callback` function to avoid tree shaking in release mode for Android. - -5. Register the callback function by calling - ```dart - HomeWidget.registerBackgroundCallback(backgroundCallback); - ``` - ### Using images of Flutter widgets -In some cases, you may not want to rewrite UI code in the native frameworks for your widgets. +In some cases, you may not want to rewrite UI code in the native frameworks for your widgets. + +
Dart For example, say you have a chart in your Flutter app configured with `CustomPaint`: ```dart @@ -247,9 +282,9 @@ class LineChart extends StatelessWidget { Screenshot 2023-06-07 at 12 33 44 PM -Rewriting the code to create this chart on both Android and iOS might be time consuming. -Instead, you can generate a png file of the Flutter widget and save it to a shared container -between your Flutter app and the home screen widget. +Rewriting the code to create this chart on both Android and iOS might be time consuming. +Instead, you can generate a png file of the Flutter widget and save it to a shared container +between your Flutter app and the home screen widget. ```dart var path = await HomeWidget.renderFlutterWidget( @@ -260,8 +295,9 @@ var path = await HomeWidget.renderFlutterWidget( ``` - `LineChart()` is the widget that will be rendered as an image. - `key` is the key in the key/value storage on the device that stores the path of the file for easy retrieval on the native side +
-#### iOS +
iOS To retrieve the image and display it in a widget, you can use the following SwiftUI code: 1. In your `TimelineEntry` struct add a property to retrieve the path: @@ -295,7 +331,7 @@ To retrieve the image and display it in a widget, you can use the following Swif … } ``` - + 4. Display the chart in the body of the widget's `View`: ```swift VStack { @@ -306,8 +342,9 @@ To retrieve the image and display it in a widget, you can use the following Swif ``` Screenshot 2023-06-07 at 12 57 28 PM +
-#### Android +
Android 1. Add an image UI element to your xml file: ```xml @@ -360,3 +397,60 @@ To retrieve the image and display it in a widget, you can use the following Swif } } ``` +
+ +### Launch App and Detect which Widget was clicked +To detect if the App has been initially started by clicking the Widget you can call `HomeWidget.initiallyLaunchedFromHomeWidget()` if the App was already running in the Background you can receive these Events by listening to `HomeWidget.widgetClicked`. Both methods will provide Uris, so you can easily send back data from the Widget to the App to for example navigate to a content page. + +In order for these methods to work you need to follow these steps: + +
iOS + +Add `.widgetUrl` to your WidgetComponent +```swift +Text(entry.message) + .font(.body) + .widgetURL(URL(string: "homeWidgetExample://message?message=\(entry.message)&homeWidget")) +``` +In order to only detect Widget Links you need to add the queryParameter`homeWidget` to the URL +
+ +
Android +Add an `IntentFilter` to the `Activity` Section in your `AndroidManifest` +``` + + + +``` + +In your WidgetProvider add a PendingIntent to your View using `HomeWidgetLaunchIntent.getActivity` +```kotlin +val pendingIntentWithData = HomeWidgetLaunchIntent.getActivity( + context, + MainActivity::class.java, + Uri.parse("homeWidgetExample://message?message=$message")) +setOnClickPendingIntent(R.id.widget_message, pendingIntentWithData) +``` +
+ +### Background Update +As the methods of HomeWidget are static it is possible to use HomeWidget in the background to update the Widget even when the App is in the background. + +The example App is using the [flutter_workmanager](https://pub.dev/packages/workmanager) plugin to achieve this. +Please follow the Setup Instructions for flutter_workmanager (or your preferred background code execution plugin). Most notably make sure that Plugins get registered in iOS in order to be able to communicate with the HomeWidget Plugin. +In case of flutter_workmanager this achieved by adding: +```swift +WorkmanagerPlugin.setPluginRegistrantCallback { registry in + GeneratedPluginRegistrant.register(with: registry) +} +``` +to [AppDelegate.swift](example/ios/Runner/AppDelegate.swift) + + +--- + +## Resources, Articles, Talks +Please add to this list if you have interesting and helpful resources +- [Google Codelab](https://codelabs.developers.google.com/flutter-home-screen-widgets#0) +- [Interactive HomeScreen Widgets with Flutter using home_widget](https://medium.com/p/83cb0706a417) +- [iOS Lockscreen Widgets with Flutter and home_widget](https://medium.com/p/0dfecc18cfa0) \ No newline at end of file diff --git a/example/.metadata b/example/.metadata index 3cc7e975..78a65c5a 100644 --- a/example/.metadata +++ b/example/.metadata @@ -4,7 +4,42 @@ # This file should be version controlled and should not be manually edited. version: - revision: 5a6dfa35caaf7bccb35488dc03677c150ebf2d97 - channel: dev + revision: "9e1c857886f07d342cf106f2cd588bcd5e031bb2" + channel: "stable" project_type: app + +# Tracks metadata for the flutter migrate command +migration: + platforms: + - platform: root + create_revision: 9e1c857886f07d342cf106f2cd588bcd5e031bb2 + base_revision: 9e1c857886f07d342cf106f2cd588bcd5e031bb2 + - platform: android + create_revision: 9e1c857886f07d342cf106f2cd588bcd5e031bb2 + base_revision: 9e1c857886f07d342cf106f2cd588bcd5e031bb2 + - platform: ios + create_revision: 9e1c857886f07d342cf106f2cd588bcd5e031bb2 + base_revision: 9e1c857886f07d342cf106f2cd588bcd5e031bb2 + - platform: linux + create_revision: 9e1c857886f07d342cf106f2cd588bcd5e031bb2 + base_revision: 9e1c857886f07d342cf106f2cd588bcd5e031bb2 + - platform: macos + create_revision: 9e1c857886f07d342cf106f2cd588bcd5e031bb2 + base_revision: 9e1c857886f07d342cf106f2cd588bcd5e031bb2 + - platform: web + create_revision: 9e1c857886f07d342cf106f2cd588bcd5e031bb2 + base_revision: 9e1c857886f07d342cf106f2cd588bcd5e031bb2 + - platform: windows + create_revision: 9e1c857886f07d342cf106f2cd588bcd5e031bb2 + base_revision: 9e1c857886f07d342cf106f2cd588bcd5e031bb2 + + # User provided section + + # List of Local paths (relative to this file) that should be + # ignored by the migrate tool. + # + # Files that are not part of the templates will be ignored by default. + unmanaged_files: + - 'lib/main.dart' + - 'ios/Runner.xcodeproj/project.pbxproj' diff --git a/example/analysis_options.yaml b/example/analysis_options.yaml index e69de29b..d6b52f74 100644 --- a/example/analysis_options.yaml +++ b/example/analysis_options.yaml @@ -0,0 +1,5 @@ +include: package:flutter_lints/flutter.yaml + +linter: + rules: + - require_trailing_commas \ No newline at end of file diff --git a/example/android/app/build.gradle b/example/android/app/build.gradle index dbf07bcb..6100d5a2 100644 --- a/example/android/app/build.gradle +++ b/example/android/app/build.gradle @@ -26,7 +26,7 @@ apply plugin: 'kotlin-android' apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle" android { - compileSdkVersion 33 + compileSdkVersion 34 sourceSets { main.java.srcDirs += 'src/main/kotlin' @@ -39,8 +39,8 @@ android { defaultConfig { // TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html). applicationId "es.antonborri.home_widget_example" - minSdkVersion 19 - targetSdkVersion 33 + minSdkVersion 23 + targetSdkVersion 34 versionCode flutterVersionCode.toInteger() versionName flutterVersionName } diff --git a/example/integration_test/android_test.dart b/example/integration_test/android_test.dart index 298a053d..d941319b 100644 --- a/example/integration_test/android_test.dart +++ b/example/integration_test/android_test.dart @@ -13,7 +13,7 @@ void main() { 'nullValueKey': null, }; - final defaultValue = MapEntry('defaultKey', 'defaultValue'); + const defaultValue = MapEntry('defaultKey', 'defaultValue'); setUpAll(() { // Clear all Data @@ -44,8 +44,10 @@ void main() { }); testWidgets('Returns default Value', (tester) async { - final returnValue = await HomeWidget.getWidgetData(defaultValue.key, - defaultValue: defaultValue.value); + final returnValue = await HomeWidget.getWidgetData( + defaultValue.key, + defaultValue: defaultValue.value, + ); expect(returnValue, defaultValue.value); }); @@ -54,13 +56,15 @@ void main() { testWidgets('Update Widget completes', (tester) async { final returnValue = await HomeWidget.updateWidget( name: 'HomeWidgetExampleProvider', - ).timeout(Duration(seconds: 5)); + ).timeout(const Duration(seconds: 5)); expect(returnValue, true); }); testWidgets('Register Background Callback', (tester) async { - await HomeWidget.registerBackgroundCallback(backgroundCallback); + final returnValue = + await HomeWidget.registerInteractivityCallback(backgroundCallback); + expect(returnValue, true); }); testWidgets( @@ -71,4 +75,4 @@ void main() { }); } -void backgroundCallback(Uri? uri) {} +Future backgroundCallback(Uri? uri) async {} diff --git a/example/integration_test/ios_test.dart b/example/integration_test/ios_test.dart index d2297751..7e6679c5 100644 --- a/example/integration_test/ios_test.dart +++ b/example/integration_test/ios_test.dart @@ -1,3 +1,5 @@ +import 'package:device_info_plus/device_info_plus.dart'; +import 'package:flutter/services.dart'; import 'package:flutter_test/flutter_test.dart'; import 'package:home_widget/home_widget.dart'; import 'package:integration_test/integration_test.dart'; @@ -7,8 +9,10 @@ void main() { group('Need Group Id', () { testWidgets('Save Data needs GroupId', (tester) async { - expect(() async => await HomeWidget.saveWidgetData('AnyId', null), - throwsException); + expect( + () async => await HomeWidget.saveWidgetData('AnyId', null), + throwsException, + ); }); }); @@ -21,7 +25,7 @@ void main() { 'nullValueKey': null, }; - final defaultValue = MapEntry('defaultKey', 'defaultValue'); + const defaultValue = MapEntry('defaultKey', 'defaultValue'); setUpAll(() async { // Add Group Id @@ -54,8 +58,10 @@ void main() { }); testWidgets('Returns default Value', (tester) async { - final returnValue = await HomeWidget.getWidgetData(defaultValue.key, - defaultValue: defaultValue.value); + final returnValue = await HomeWidget.getWidgetData( + defaultValue.key, + defaultValue: defaultValue.value, + ); expect(returnValue, defaultValue.value); }); @@ -65,7 +71,7 @@ void main() { final returnValue = await HomeWidget.updateWidget( name: 'HomeWidgetExampleProvider', iOSName: 'HomeWidgetExample', - ).timeout(Duration(seconds: 5)); + ).timeout(const Duration(seconds: 5)); expect(returnValue, true); }); @@ -83,14 +89,32 @@ void main() { group('Register Backgorund Callback', () { testWidgets('RegisterBackgroundCallback completes without error', (tester) async { + final deviceInfo = await DeviceInfoPlugin().iosInfo; + final hasInteractiveWidgets = + double.parse(deviceInfo.systemVersion) >= 17.0; await HomeWidget.setAppGroupId('group.es.antonborri.integrationtest'); - final registerCallbackResult = - await HomeWidget.registerBackgroundCallback(backgroundCallback); - expect(registerCallbackResult, isNull); + if (hasInteractiveWidgets) { + final registerCallbackResult = + await HomeWidget.registerInteractivityCallback( + interactivityCallback, + ); + + expect( + registerCallbackResult, + isTrue, + ); + } else { + expect( + () async => await HomeWidget.registerInteractivityCallback( + interactivityCallback, + ), + throwsA(isA()), + ); + } }); }); }); }); } -void backgroundCallback(Uri? uri) {} +Future interactivityCallback(Uri? uri) async {} diff --git a/example/ios/.gitignore b/example/ios/.gitignore index e96ef602..7a7f9873 100644 --- a/example/ios/.gitignore +++ b/example/ios/.gitignore @@ -1,3 +1,4 @@ +**/dgph *.mode1v3 *.mode2v3 *.moved-aside @@ -18,6 +19,7 @@ Flutter/App.framework Flutter/Flutter.framework Flutter/Flutter.podspec Flutter/Generated.xcconfig +Flutter/ephemeral/ Flutter/app.flx Flutter/app.zip Flutter/flutter_assets/ diff --git a/example/ios/Flutter/AppFrameworkInfo.plist b/example/ios/Flutter/AppFrameworkInfo.plist index 4f8d4d24..9625e105 100644 --- a/example/ios/Flutter/AppFrameworkInfo.plist +++ b/example/ios/Flutter/AppFrameworkInfo.plist @@ -3,7 +3,7 @@ CFBundleDevelopmentRegion - $(DEVELOPMENT_LANGUAGE) + en CFBundleExecutable App CFBundleIdentifier diff --git a/example/ios/Flutter/Debug.xcconfig b/example/ios/Flutter/Debug.xcconfig index e8efba11..ec97fc6f 100644 --- a/example/ios/Flutter/Debug.xcconfig +++ b/example/ios/Flutter/Debug.xcconfig @@ -1,2 +1,2 @@ -#include "Pods/Target Support Files/Pods-Runner/Pods-Runner.debug.xcconfig" +#include? "Pods/Target Support Files/Pods-Runner/Pods-Runner.debug.xcconfig" #include "Generated.xcconfig" diff --git a/example/ios/Flutter/Release.xcconfig b/example/ios/Flutter/Release.xcconfig index 399e9340..c4855bfe 100644 --- a/example/ios/Flutter/Release.xcconfig +++ b/example/ios/Flutter/Release.xcconfig @@ -1,2 +1,2 @@ -#include "Pods/Target Support Files/Pods-Runner/Pods-Runner.release.xcconfig" +#include? "Pods/Target Support Files/Pods-Runner/Pods-Runner.release.xcconfig" #include "Generated.xcconfig" diff --git a/example/ios/HomeWidgetExample/Assets.xcassets/AppIcon.appiconset/Contents.json b/example/ios/HomeWidgetExample/Assets.xcassets/AppIcon.appiconset/Contents.json index 9221b9bb..13613e3e 100644 --- a/example/ios/HomeWidgetExample/Assets.xcassets/AppIcon.appiconset/Contents.json +++ b/example/ios/HomeWidgetExample/Assets.xcassets/AppIcon.appiconset/Contents.json @@ -1,93 +1,8 @@ { "images" : [ { - "idiom" : "iphone", - "scale" : "2x", - "size" : "20x20" - }, - { - "idiom" : "iphone", - "scale" : "3x", - "size" : "20x20" - }, - { - "idiom" : "iphone", - "scale" : "2x", - "size" : "29x29" - }, - { - "idiom" : "iphone", - "scale" : "3x", - "size" : "29x29" - }, - { - "idiom" : "iphone", - "scale" : "2x", - "size" : "40x40" - }, - { - "idiom" : "iphone", - "scale" : "3x", - "size" : "40x40" - }, - { - "idiom" : "iphone", - "scale" : "2x", - "size" : "60x60" - }, - { - "idiom" : "iphone", - "scale" : "3x", - "size" : "60x60" - }, - { - "idiom" : "ipad", - "scale" : "1x", - "size" : "20x20" - }, - { - "idiom" : "ipad", - "scale" : "2x", - "size" : "20x20" - }, - { - "idiom" : "ipad", - "scale" : "1x", - "size" : "29x29" - }, - { - "idiom" : "ipad", - "scale" : "2x", - "size" : "29x29" - }, - { - "idiom" : "ipad", - "scale" : "1x", - "size" : "40x40" - }, - { - "idiom" : "ipad", - "scale" : "2x", - "size" : "40x40" - }, - { - "idiom" : "ipad", - "scale" : "1x", - "size" : "76x76" - }, - { - "idiom" : "ipad", - "scale" : "2x", - "size" : "76x76" - }, - { - "idiom" : "ipad", - "scale" : "2x", - "size" : "83.5x83.5" - }, - { - "idiom" : "ios-marketing", - "scale" : "1x", + "idiom" : "universal", + "platform" : "ios", "size" : "1024x1024" } ], diff --git a/example/ios/HomeWidgetExample/HomeWidgetExample.entitlements b/example/ios/HomeWidgetExample/HomeWidgetExample.entitlements deleted file mode 100644 index 33c66ecd..00000000 --- a/example/ios/HomeWidgetExample/HomeWidgetExample.entitlements +++ /dev/null @@ -1,10 +0,0 @@ - - - - - com.apple.security.application-groups - - YOUR_APP_GROUP_ID - - - diff --git a/example/ios/HomeWidgetExample/HomeWidgetExample.swift b/example/ios/HomeWidgetExample/HomeWidgetExample.swift index b632a32f..db0ffa7e 100644 --- a/example/ios/HomeWidgetExample/HomeWidgetExample.swift +++ b/example/ios/HomeWidgetExample/HomeWidgetExample.swift @@ -5,79 +5,96 @@ // Created by Anton Borries on 04.10.20. // -import WidgetKit import SwiftUI +import WidgetKit -private let widgetGroupId = "YOUR_APP_GROUP_ID" +private let widgetGroupId = "group.es.antonborri.exampleHomeWidget" struct Provider: TimelineProvider { - func placeholder(in context: Context) -> ExampleEntry { - ExampleEntry(date: Date(), title: "Placeholder Title", message: "Placeholder Message") - } - - func getSnapshot(in context: Context, completion: @escaping (ExampleEntry) -> ()) { - let data = UserDefaults.init(suiteName:widgetGroupId) - let entry = ExampleEntry(date: Date(), title: data?.string(forKey: "title") ?? "No Title Set", message: data?.string(forKey: "message") ?? "No Message Set") - completion(entry) - } - - func getTimeline(in context: Context, completion: @escaping (Timeline) -> ()) { - getSnapshot(in: context) { (entry) in - let timeline = Timeline(entries: [entry], policy: .atEnd) - completion(timeline) - } + func placeholder(in context: Context) -> ExampleEntry { + ExampleEntry(date: Date(), title: "Placeholder Title", message: "Placeholder Message") + } + + func getSnapshot(in context: Context, completion: @escaping (ExampleEntry) -> Void) { + let data = UserDefaults.init(suiteName: widgetGroupId) + let entry = ExampleEntry( + date: Date(), title: data?.string(forKey: "title") ?? "No Title Set", + message: data?.string(forKey: "message") ?? "No Message Set") + completion(entry) + } + + func getTimeline(in context: Context, completion: @escaping (Timeline) -> Void) { + getSnapshot(in: context) { (entry) in + let timeline = Timeline(entries: [entry], policy: .atEnd) + completion(timeline) } + } } struct ExampleEntry: TimelineEntry { - let date: Date - let title: String - let message: String + let date: Date + let title: String + let message: String } -struct HomeWidgetExampleEntryView : View { - var entry: Provider.Entry - let data = UserDefaults.init(suiteName:widgetGroupId) - let iconPath: String? - - init(entry: Provider.Entry) { - self.entry = entry - iconPath = data?.string(forKey: "dashIcon") - - } - - var body: some View { - VStack.init(alignment: .leading, spacing: /*@START_MENU_TOKEN@*/nil/*@END_MENU_TOKEN@*/, content: { - Text(entry.title).bold().font(/*@START_MENU_TOKEN@*/.title/*@END_MENU_TOKEN@*/) - Text(entry.message) - .font(.body) - .widgetURL(URL(string: "homeWidgetExample://message?message=\(entry.message)&homeWidget")) - if (iconPath != nil) { - Image(uiImage: UIImage(contentsOfFile: iconPath!)!).resizable() - .scaledToFill() - .frame(width: 64, height: 64) - } +struct HomeWidgetExampleEntryView: View { + var entry: Provider.Entry + let data = UserDefaults.init(suiteName: widgetGroupId) + let iconPath: String? + + init(entry: Provider.Entry) { + self.entry = entry + iconPath = data?.string(forKey: "dashIcon") + + } + + var body: some View { + VStack.init( + alignment: .center, spacing: /*@START_MENU_TOKEN@*/ nil /*@END_MENU_TOKEN@*/, + content: { + if #available(iOSApplicationExtension 17, *) { + Button( + intent: BackgroundIntent( + url: URL(string: "homeWidgetExample://titleClicked"), appGroup: widgetGroupId) + ) { + Text(entry.title).bold().font( /*@START_MENU_TOKEN@*/.title /*@END_MENU_TOKEN@*/) + }.buttonStyle(.plain).frame(maxWidth: .infinity, alignment: .leading) + } else { + Text(entry.title).bold().font( /*@START_MENU_TOKEN@*/.title /*@END_MENU_TOKEN@*/).frame( + maxWidth: .infinity, alignment: .leading) } - ) - } + Text(entry.message) + .font(.body) + .widgetURL(URL(string: "homeWidgetExample://message?message=\(entry.message)&homeWidget")) + .frame(maxWidth: .infinity, alignment: .leading) + if iconPath != nil { + Image(uiImage: UIImage(contentsOfFile: iconPath!)!).resizable() + .scaledToFill() + .frame(width: 64, height: 64) + } + } + ) + } } @main struct HomeWidgetExample: Widget { - let kind: String = "HomeWidgetExample" - - var body: some WidgetConfiguration { - StaticConfiguration(kind: kind, provider: Provider()) { entry in - HomeWidgetExampleEntryView(entry: entry) - } - .configurationDisplayName("My Widget") - .description("This is an example widget.") + let kind: String = "HomeWidgetExample" + + var body: some WidgetConfiguration { + StaticConfiguration(kind: kind, provider: Provider()) { entry in + HomeWidgetExampleEntryView(entry: entry) } + .configurationDisplayName("My Widget") + .description("This is an example widget.") + } } struct HomeWidgetExample_Previews: PreviewProvider { - static var previews: some View { - HomeWidgetExampleEntryView(entry: ExampleEntry(date: Date(), title: "Example Title", message: "Example Message")) - .previewContext(WidgetPreviewContext(family: .systemSmall)) - } + static var previews: some View { + HomeWidgetExampleEntryView( + entry: ExampleEntry(date: Date(), title: "Example Title", message: "Example Message") + ) + .previewContext(WidgetPreviewContext(family: .systemSmall)) + } } diff --git a/example/ios/HomeWidgetExample/Info.plist b/example/ios/HomeWidgetExample/Info.plist index 40d4f01f..0f118fb7 100644 --- a/example/ios/HomeWidgetExample/Info.plist +++ b/example/ios/HomeWidgetExample/Info.plist @@ -2,24 +2,6 @@ - CFBundleDevelopmentRegion - $(DEVELOPMENT_LANGUAGE) - CFBundleDisplayName - HomeWidgetExample - CFBundleExecutable - $(EXECUTABLE_NAME) - CFBundleIdentifier - $(PRODUCT_BUNDLE_IDENTIFIER) - CFBundleInfoDictionaryVersion - 6.0 - CFBundleName - $(PRODUCT_NAME) - CFBundlePackageType - $(PRODUCT_BUNDLE_PACKAGE_TYPE) - CFBundleShortVersionString - 1.0 - CFBundleVersion - 1 NSExtension NSExtensionPointIdentifier diff --git a/example/ios/HomeWidgetExampleExtension.entitlements b/example/ios/HomeWidgetExampleExtension.entitlements index 33c66ecd..40360484 100644 --- a/example/ios/HomeWidgetExampleExtension.entitlements +++ b/example/ios/HomeWidgetExampleExtension.entitlements @@ -4,7 +4,7 @@ com.apple.security.application-groups - YOUR_APP_GROUP_ID + YOUR_GROUP_ID diff --git a/example/ios/Podfile b/example/ios/Podfile index 5c4ba946..c3fd08a1 100644 --- a/example/ios/Podfile +++ b/example/ios/Podfile @@ -1,4 +1,5 @@ -platform :ios, '11.0' +# Uncomment this line to define a global platform for your project +# platform :ios, '11.0' # CocoaPods analytics sends network stats synchronously affecting flutter build latency. ENV['COCOAPODS_DISABLE_STATS'] = 'true' @@ -31,6 +32,12 @@ target 'Runner' do use_modular_headers! flutter_install_all_ios_pods File.dirname(File.realpath(__FILE__)) + target 'RunnerTests' do + inherit! :search_paths + end + target 'HomeWidgetExampleExtension' do + inherit! :search_paths + end end post_install do |installer| diff --git a/example/ios/Runner.xcodeproj/project.pbxproj b/example/ios/Runner.xcodeproj/project.pbxproj index 5c72903b..89c6d9c6 100644 --- a/example/ios/Runner.xcodeproj/project.pbxproj +++ b/example/ios/Runner.xcodeproj/project.pbxproj @@ -8,62 +8,88 @@ /* Begin PBXBuildFile section */ 1498D2341E8E89220040F4C2 /* GeneratedPluginRegistrant.m in Sources */ = {isa = PBXBuildFile; fileRef = 1498D2331E8E89220040F4C2 /* GeneratedPluginRegistrant.m */; }; + 16A8E8DE0722EAA17C744601 /* Pods_Runner.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 63BD42C9386CBFE26633ADC6 /* Pods_Runner.framework */; }; + 331C808B294A63AB00263BE5 /* RunnerTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 331C807B294A618700263BE5 /* RunnerTests.swift */; }; + 3767795F3957A9DD7F9FD47A /* Pods_RunnerTests.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 782E23792C4AD1515728BC69 /* Pods_RunnerTests.framework */; }; + 3AAC6A3C2B1CD43700ED5F59 /* WidgetKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 3AAC6A3B2B1CD43700ED5F59 /* WidgetKit.framework */; }; + 3AAC6A3E2B1CD43700ED5F59 /* SwiftUI.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 3AAC6A3D2B1CD43700ED5F59 /* SwiftUI.framework */; }; + 3AAC6A432B1CD43700ED5F59 /* HomeWidgetExample.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3AAC6A422B1CD43700ED5F59 /* HomeWidgetExample.swift */; }; + 3AAC6A452B1CD43900ED5F59 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 3AAC6A442B1CD43900ED5F59 /* Assets.xcassets */; }; + 3AAC6A492B1CD43900ED5F59 /* HomeWidgetExampleExtension.appex in Embed Foundation Extensions */ = {isa = PBXBuildFile; fileRef = 3AAC6A392B1CD43700ED5F59 /* HomeWidgetExampleExtension.appex */; settings = {ATTRIBUTES = (RemoveHeadersOnCopy, ); }; }; + 3AAC6A502B1CD45700ED5F59 /* BackgroundIntent.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3AAC6A4F2B1CD45700ED5F59 /* BackgroundIntent.swift */; }; + 3AAC6A512B1CD45700ED5F59 /* BackgroundIntent.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3AAC6A4F2B1CD45700ED5F59 /* BackgroundIntent.swift */; }; 3B3967161E833CAA004F5970 /* AppFrameworkInfo.plist in Resources */ = {isa = PBXBuildFile; fileRef = 3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */; }; + 7080E8EEB234A16B671090D2 /* Pods_HomeWidgetExampleExtension.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = E5C99A981C1592642E9F3DAA /* Pods_HomeWidgetExampleExtension.framework */; }; 74858FAF1ED2DC5600515810 /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 74858FAE1ED2DC5600515810 /* AppDelegate.swift */; }; 97C146FC1CF9000F007C117D /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FA1CF9000F007C117D /* Main.storyboard */; }; 97C146FE1CF9000F007C117D /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FD1CF9000F007C117D /* Assets.xcassets */; }; 97C147011CF9000F007C117D /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FF1CF9000F007C117D /* LaunchScreen.storyboard */; }; - A0B4A45E25299C5800536BC1 /* WidgetKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = A0B4A45D25299C5800536BC1 /* WidgetKit.framework */; }; - A0B4A46025299C5800536BC1 /* SwiftUI.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = A0B4A45F25299C5800536BC1 /* SwiftUI.framework */; }; - A0B4A46325299C5800536BC1 /* HomeWidgetExample.swift in Sources */ = {isa = PBXBuildFile; fileRef = A0B4A46225299C5800536BC1 /* HomeWidgetExample.swift */; }; - A0B4A46525299C5A00536BC1 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = A0B4A46425299C5A00536BC1 /* Assets.xcassets */; }; - A0B4A46925299C5A00536BC1 /* HomeWidgetExampleExtension.appex in Embed App Extensions */ = {isa = PBXBuildFile; fileRef = A0B4A45C25299C5800536BC1 /* HomeWidgetExampleExtension.appex */; settings = {ATTRIBUTES = (RemoveHeadersOnCopy, ); }; }; - B3797C4BF19AC03ADF0B604F /* Pods_Runner.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = DD299E5F80735A8790DA86D1 /* Pods_Runner.framework */; }; /* End PBXBuildFile section */ /* Begin PBXContainerItemProxy section */ - A0B4A46725299C5A00536BC1 /* PBXContainerItemProxy */ = { + 331C8085294A63A400263BE5 /* PBXContainerItemProxy */ = { isa = PBXContainerItemProxy; containerPortal = 97C146E61CF9000F007C117D /* Project object */; proxyType = 1; - remoteGlobalIDString = A0B4A45B25299C5800536BC1; + remoteGlobalIDString = 97C146ED1CF9000F007C117D; + remoteInfo = Runner; + }; + 3AAC6A472B1CD43900ED5F59 /* PBXContainerItemProxy */ = { + isa = PBXContainerItemProxy; + containerPortal = 97C146E61CF9000F007C117D /* Project object */; + proxyType = 1; + remoteGlobalIDString = 3AAC6A382B1CD43700ED5F59; remoteInfo = HomeWidgetExampleExtension; }; /* End PBXContainerItemProxy section */ /* Begin PBXCopyFilesBuildPhase section */ - 9705A1C41CF9048500538489 /* Embed Frameworks */ = { + 3AAC6A4E2B1CD43900ED5F59 /* Embed Foundation Extensions */ = { isa = PBXCopyFilesBuildPhase; buildActionMask = 2147483647; dstPath = ""; - dstSubfolderSpec = 10; + dstSubfolderSpec = 13; files = ( + 3AAC6A492B1CD43900ED5F59 /* HomeWidgetExampleExtension.appex in Embed Foundation Extensions */, ); - name = "Embed Frameworks"; + name = "Embed Foundation Extensions"; runOnlyForDeploymentPostprocessing = 0; }; - A0B4A46A25299C5A00536BC1 /* Embed App Extensions */ = { + 9705A1C41CF9048500538489 /* Embed Frameworks */ = { isa = PBXCopyFilesBuildPhase; buildActionMask = 2147483647; dstPath = ""; - dstSubfolderSpec = 13; + dstSubfolderSpec = 10; files = ( - A0B4A46925299C5A00536BC1 /* HomeWidgetExampleExtension.appex in Embed App Extensions */, ); - name = "Embed App Extensions"; + name = "Embed Frameworks"; runOnlyForDeploymentPostprocessing = 0; }; /* End PBXCopyFilesBuildPhase section */ /* Begin PBXFileReference section */ + 01ED8F3E7A1B3BBE2ED10AB6 /* Pods-RunnerTests.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-RunnerTests.debug.xcconfig"; path = "Target Support Files/Pods-RunnerTests/Pods-RunnerTests.debug.xcconfig"; sourceTree = ""; }; + 02E953153F3D9493743CC26C /* Pods-HomeWidgetExampleExtension.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-HomeWidgetExampleExtension.release.xcconfig"; path = "Target Support Files/Pods-HomeWidgetExampleExtension/Pods-HomeWidgetExampleExtension.release.xcconfig"; sourceTree = ""; }; 1498D2321E8E86230040F4C2 /* GeneratedPluginRegistrant.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = GeneratedPluginRegistrant.h; sourceTree = ""; }; 1498D2331E8E89220040F4C2 /* GeneratedPluginRegistrant.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = GeneratedPluginRegistrant.m; sourceTree = ""; }; - 214A07FC09585E65AA332BAA /* Pods-Runner.profile.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Runner.profile.xcconfig"; path = "Target Support Files/Pods-Runner/Pods-Runner.profile.xcconfig"; sourceTree = ""; }; - 2465B732DCE7D216465C0E0A /* Pods-Runner.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Runner.debug.xcconfig"; path = "Target Support Files/Pods-Runner/Pods-Runner.debug.xcconfig"; sourceTree = ""; }; + 331C807B294A618700263BE5 /* RunnerTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = RunnerTests.swift; sourceTree = ""; }; + 331C8081294A63A400263BE5 /* RunnerTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = RunnerTests.xctest; sourceTree = BUILT_PRODUCTS_DIR; }; + 3AAC6A342B1CD40B00ED5F59 /* Runner.entitlements */ = {isa = PBXFileReference; lastKnownFileType = text.plist.entitlements; path = Runner.entitlements; sourceTree = ""; }; + 3AAC6A392B1CD43700ED5F59 /* HomeWidgetExampleExtension.appex */ = {isa = PBXFileReference; explicitFileType = "wrapper.app-extension"; includeInIndex = 0; path = HomeWidgetExampleExtension.appex; sourceTree = BUILT_PRODUCTS_DIR; }; + 3AAC6A3B2B1CD43700ED5F59 /* WidgetKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = WidgetKit.framework; path = System/Library/Frameworks/WidgetKit.framework; sourceTree = SDKROOT; }; + 3AAC6A3D2B1CD43700ED5F59 /* SwiftUI.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = SwiftUI.framework; path = System/Library/Frameworks/SwiftUI.framework; sourceTree = SDKROOT; }; + 3AAC6A422B1CD43700ED5F59 /* HomeWidgetExample.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = HomeWidgetExample.swift; sourceTree = ""; }; + 3AAC6A442B1CD43900ED5F59 /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = ""; }; + 3AAC6A462B1CD43900ED5F59 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; + 3AAC6A4F2B1CD45700ED5F59 /* BackgroundIntent.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = BackgroundIntent.swift; sourceTree = ""; }; + 3AAC6A522B1CD46500ED5F59 /* HomeWidgetExampleExtension.entitlements */ = {isa = PBXFileReference; lastKnownFileType = text.plist.entitlements; path = HomeWidgetExampleExtension.entitlements; sourceTree = ""; }; 3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; name = AppFrameworkInfo.plist; path = Flutter/AppFrameworkInfo.plist; sourceTree = ""; }; - 4BF9D47C3AA25B71C6A0FD79 /* Pods-Runner.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Runner.release.xcconfig"; path = "Target Support Files/Pods-Runner/Pods-Runner.release.xcconfig"; sourceTree = ""; }; + 63BD42C9386CBFE26633ADC6 /* Pods_Runner.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_Runner.framework; sourceTree = BUILT_PRODUCTS_DIR; }; + 67B96C62570AB0F95CEB9857 /* Pods-Runner.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Runner.debug.xcconfig"; path = "Target Support Files/Pods-Runner/Pods-Runner.debug.xcconfig"; sourceTree = ""; }; + 6AC96EF63E75CCC1A8FD0DAE /* Pods-Runner.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Runner.release.xcconfig"; path = "Target Support Files/Pods-Runner/Pods-Runner.release.xcconfig"; sourceTree = ""; }; 74858FAD1ED2DC5600515810 /* Runner-Bridging-Header.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "Runner-Bridging-Header.h"; sourceTree = ""; }; 74858FAE1ED2DC5600515810 /* AppDelegate.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = ""; }; + 782E23792C4AD1515728BC69 /* Pods_RunnerTests.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_RunnerTests.framework; sourceTree = BUILT_PRODUCTS_DIR; }; 7AFA3C8E1D35360C0083082E /* Release.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; name = Release.xcconfig; path = Flutter/Release.xcconfig; sourceTree = ""; }; 9740EEB21CF90195004384FC /* Debug.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; name = Debug.xcconfig; path = Flutter/Debug.xcconfig; sourceTree = ""; }; 9740EEB31CF90195004384FC /* Generated.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; name = Generated.xcconfig; path = Flutter/Generated.xcconfig; sourceTree = ""; }; @@ -72,59 +98,74 @@ 97C146FD1CF9000F007C117D /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = ""; }; 97C147001CF9000F007C117D /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = ""; }; 97C147021CF9000F007C117D /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; - A0B4A45C25299C5800536BC1 /* HomeWidgetExampleExtension.appex */ = {isa = PBXFileReference; explicitFileType = "wrapper.app-extension"; includeInIndex = 0; path = HomeWidgetExampleExtension.appex; sourceTree = BUILT_PRODUCTS_DIR; }; - A0B4A45D25299C5800536BC1 /* WidgetKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = WidgetKit.framework; path = System/Library/Frameworks/WidgetKit.framework; sourceTree = SDKROOT; }; - A0B4A45F25299C5800536BC1 /* SwiftUI.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = SwiftUI.framework; path = System/Library/Frameworks/SwiftUI.framework; sourceTree = SDKROOT; }; - A0B4A46225299C5800536BC1 /* HomeWidgetExample.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = HomeWidgetExample.swift; sourceTree = ""; }; - A0B4A46425299C5A00536BC1 /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = ""; }; - A0B4A46625299C5A00536BC1 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; - A0B4A4762529A24600536BC1 /* HomeWidgetExampleExtension.entitlements */ = {isa = PBXFileReference; lastKnownFileType = text.plist.entitlements; path = HomeWidgetExampleExtension.entitlements; sourceTree = ""; }; - A0B4A4792529A2E200536BC1 /* Runner.entitlements */ = {isa = PBXFileReference; lastKnownFileType = text.plist.entitlements; path = Runner.entitlements; sourceTree = ""; }; - A0B4A47D2529CF1000536BC1 /* HomeWidgetExample.entitlements */ = {isa = PBXFileReference; lastKnownFileType = text.plist.entitlements; path = HomeWidgetExample.entitlements; sourceTree = ""; }; - DD299E5F80735A8790DA86D1 /* Pods_Runner.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_Runner.framework; sourceTree = BUILT_PRODUCTS_DIR; }; + AB4991BB2F6104F16A20FAFF /* Pods-RunnerTests.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-RunnerTests.release.xcconfig"; path = "Target Support Files/Pods-RunnerTests/Pods-RunnerTests.release.xcconfig"; sourceTree = ""; }; + C1463ED1DE22ED64431F627A /* Pods-Runner.profile.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Runner.profile.xcconfig"; path = "Target Support Files/Pods-Runner/Pods-Runner.profile.xcconfig"; sourceTree = ""; }; + C1F2EEA684896C2FE30BA404 /* Pods-RunnerTests.profile.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-RunnerTests.profile.xcconfig"; path = "Target Support Files/Pods-RunnerTests/Pods-RunnerTests.profile.xcconfig"; sourceTree = ""; }; + C52AF632B32B3D977D171253 /* Pods-HomeWidgetExampleExtension.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-HomeWidgetExampleExtension.debug.xcconfig"; path = "Target Support Files/Pods-HomeWidgetExampleExtension/Pods-HomeWidgetExampleExtension.debug.xcconfig"; sourceTree = ""; }; + E5C99A981C1592642E9F3DAA /* Pods_HomeWidgetExampleExtension.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_HomeWidgetExampleExtension.framework; sourceTree = BUILT_PRODUCTS_DIR; }; + E83E2772F8C2648F6A4B8430 /* Pods-HomeWidgetExampleExtension.profile.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-HomeWidgetExampleExtension.profile.xcconfig"; path = "Target Support Files/Pods-HomeWidgetExampleExtension/Pods-HomeWidgetExampleExtension.profile.xcconfig"; sourceTree = ""; }; /* End PBXFileReference section */ /* Begin PBXFrameworksBuildPhase section */ - 97C146EB1CF9000F007C117D /* Frameworks */ = { + 3AAC6A362B1CD43700ED5F59 /* Frameworks */ = { isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( - B3797C4BF19AC03ADF0B604F /* Pods_Runner.framework in Frameworks */, + 3AAC6A3E2B1CD43700ED5F59 /* SwiftUI.framework in Frameworks */, + 3AAC6A3C2B1CD43700ED5F59 /* WidgetKit.framework in Frameworks */, + 7080E8EEB234A16B671090D2 /* Pods_HomeWidgetExampleExtension.framework in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; }; - A0B4A45925299C5800536BC1 /* Frameworks */ = { + 3D8E2864F322A9424D3DA50E /* Frameworks */ = { isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( - A0B4A46025299C5800536BC1 /* SwiftUI.framework in Frameworks */, - A0B4A45E25299C5800536BC1 /* WidgetKit.framework in Frameworks */, + 3767795F3957A9DD7F9FD47A /* Pods_RunnerTests.framework in Frameworks */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; + 97C146EB1CF9000F007C117D /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( + 16A8E8DE0722EAA17C744601 /* Pods_Runner.framework in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; }; /* End PBXFrameworksBuildPhase section */ /* Begin PBXGroup section */ - 6589C43215B83E64883F01A4 /* Pods */ = { + 331C8082294A63A400263BE5 /* RunnerTests */ = { isa = PBXGroup; children = ( - 2465B732DCE7D216465C0E0A /* Pods-Runner.debug.xcconfig */, - 4BF9D47C3AA25B71C6A0FD79 /* Pods-Runner.release.xcconfig */, - 214A07FC09585E65AA332BAA /* Pods-Runner.profile.xcconfig */, + 331C807B294A618700263BE5 /* RunnerTests.swift */, ); - path = Pods; + path = RunnerTests; sourceTree = ""; }; - 8BC9E98AADD2D6D0E87ADD17 /* Frameworks */ = { + 3AAC6A3A2B1CD43700ED5F59 /* Frameworks */ = { isa = PBXGroup; children = ( - DD299E5F80735A8790DA86D1 /* Pods_Runner.framework */, - A0B4A45D25299C5800536BC1 /* WidgetKit.framework */, - A0B4A45F25299C5800536BC1 /* SwiftUI.framework */, + 3AAC6A3B2B1CD43700ED5F59 /* WidgetKit.framework */, + 3AAC6A3D2B1CD43700ED5F59 /* SwiftUI.framework */, + E5C99A981C1592642E9F3DAA /* Pods_HomeWidgetExampleExtension.framework */, + 63BD42C9386CBFE26633ADC6 /* Pods_Runner.framework */, + 782E23792C4AD1515728BC69 /* Pods_RunnerTests.framework */, ); name = Frameworks; sourceTree = ""; }; + 3AAC6A3F2B1CD43700ED5F59 /* HomeWidgetExample */ = { + isa = PBXGroup; + children = ( + 3AAC6A422B1CD43700ED5F59 /* HomeWidgetExample.swift */, + 3AAC6A442B1CD43900ED5F59 /* Assets.xcassets */, + 3AAC6A462B1CD43900ED5F59 /* Info.plist */, + ); + path = HomeWidgetExample; + sourceTree = ""; + }; 9740EEB11CF90186004384FC /* Flutter */ = { isa = PBXGroup; children = ( @@ -139,13 +180,14 @@ 97C146E51CF9000F007C117D = { isa = PBXGroup; children = ( - A0B4A4762529A24600536BC1 /* HomeWidgetExampleExtension.entitlements */, + 3AAC6A522B1CD46500ED5F59 /* HomeWidgetExampleExtension.entitlements */, 9740EEB11CF90186004384FC /* Flutter */, 97C146F01CF9000F007C117D /* Runner */, - A0B4A46125299C5800536BC1 /* HomeWidgetExample */, + 3AAC6A3F2B1CD43700ED5F59 /* HomeWidgetExample */, + 3AAC6A3A2B1CD43700ED5F59 /* Frameworks */, 97C146EF1CF9000F007C117D /* Products */, - 6589C43215B83E64883F01A4 /* Pods */, - 8BC9E98AADD2D6D0E87ADD17 /* Frameworks */, + 331C8082294A63A400263BE5 /* RunnerTests */, + D18224093D10725FA37CD5EE /* Pods */, ); sourceTree = ""; }; @@ -153,7 +195,8 @@ isa = PBXGroup; children = ( 97C146EE1CF9000F007C117D /* Runner.app */, - A0B4A45C25299C5800536BC1 /* HomeWidgetExampleExtension.appex */, + 331C8081294A63A400263BE5 /* RunnerTests.xctest */, + 3AAC6A392B1CD43700ED5F59 /* HomeWidgetExampleExtension.appex */, ); name = Products; sourceTree = ""; @@ -161,7 +204,7 @@ 97C146F01CF9000F007C117D /* Runner */ = { isa = PBXGroup; children = ( - A0B4A4792529A2E200536BC1 /* Runner.entitlements */, + 3AAC6A342B1CD40B00ED5F59 /* Runner.entitlements */, 97C146FA1CF9000F007C117D /* Main.storyboard */, 97C146FD1CF9000F007C117D /* Assets.xcassets */, 97C146FF1CF9000F007C117D /* LaunchScreen.storyboard */, @@ -170,82 +213,113 @@ 1498D2331E8E89220040F4C2 /* GeneratedPluginRegistrant.m */, 74858FAE1ED2DC5600515810 /* AppDelegate.swift */, 74858FAD1ED2DC5600515810 /* Runner-Bridging-Header.h */, + 3AAC6A4F2B1CD45700ED5F59 /* BackgroundIntent.swift */, ); path = Runner; sourceTree = ""; }; - A0B4A46125299C5800536BC1 /* HomeWidgetExample */ = { + D18224093D10725FA37CD5EE /* Pods */ = { isa = PBXGroup; children = ( - A0B4A46225299C5800536BC1 /* HomeWidgetExample.swift */, - A0B4A46425299C5A00536BC1 /* Assets.xcassets */, - A0B4A46625299C5A00536BC1 /* Info.plist */, - A0B4A47D2529CF1000536BC1 /* HomeWidgetExample.entitlements */, + C52AF632B32B3D977D171253 /* Pods-HomeWidgetExampleExtension.debug.xcconfig */, + 02E953153F3D9493743CC26C /* Pods-HomeWidgetExampleExtension.release.xcconfig */, + E83E2772F8C2648F6A4B8430 /* Pods-HomeWidgetExampleExtension.profile.xcconfig */, + 67B96C62570AB0F95CEB9857 /* Pods-Runner.debug.xcconfig */, + 6AC96EF63E75CCC1A8FD0DAE /* Pods-Runner.release.xcconfig */, + C1463ED1DE22ED64431F627A /* Pods-Runner.profile.xcconfig */, + 01ED8F3E7A1B3BBE2ED10AB6 /* Pods-RunnerTests.debug.xcconfig */, + AB4991BB2F6104F16A20FAFF /* Pods-RunnerTests.release.xcconfig */, + C1F2EEA684896C2FE30BA404 /* Pods-RunnerTests.profile.xcconfig */, ); - path = HomeWidgetExample; + path = Pods; sourceTree = ""; }; /* End PBXGroup section */ /* Begin PBXNativeTarget section */ + 331C8080294A63A400263BE5 /* RunnerTests */ = { + isa = PBXNativeTarget; + buildConfigurationList = 331C8087294A63A400263BE5 /* Build configuration list for PBXNativeTarget "RunnerTests" */; + buildPhases = ( + 36E3567ACFCF6B8F5CA81D98 /* [CP] Check Pods Manifest.lock */, + 331C807D294A63A400263BE5 /* Sources */, + 331C807F294A63A400263BE5 /* Resources */, + 3D8E2864F322A9424D3DA50E /* Frameworks */, + ); + buildRules = ( + ); + dependencies = ( + 331C8086294A63A400263BE5 /* PBXTargetDependency */, + ); + name = RunnerTests; + productName = RunnerTests; + productReference = 331C8081294A63A400263BE5 /* RunnerTests.xctest */; + productType = "com.apple.product-type.bundle.unit-test"; + }; + 3AAC6A382B1CD43700ED5F59 /* HomeWidgetExampleExtension */ = { + isa = PBXNativeTarget; + buildConfigurationList = 3AAC6A4A2B1CD43900ED5F59 /* Build configuration list for PBXNativeTarget "HomeWidgetExampleExtension" */; + buildPhases = ( + 19B855C45531B6FFB948FCBE /* [CP] Check Pods Manifest.lock */, + 3AAC6A352B1CD43700ED5F59 /* Sources */, + 3AAC6A362B1CD43700ED5F59 /* Frameworks */, + 3AAC6A372B1CD43700ED5F59 /* Resources */, + ); + buildRules = ( + ); + dependencies = ( + ); + name = HomeWidgetExampleExtension; + productName = HomeWidgetExampleExtension; + productReference = 3AAC6A392B1CD43700ED5F59 /* HomeWidgetExampleExtension.appex */; + productType = "com.apple.product-type.app-extension"; + }; 97C146ED1CF9000F007C117D /* Runner */ = { isa = PBXNativeTarget; buildConfigurationList = 97C147051CF9000F007C117D /* Build configuration list for PBXNativeTarget "Runner" */; buildPhases = ( - D28D27C01D99FA0B41273269 /* [CP] Check Pods Manifest.lock */, + D05EB4AE28294B897266E68B /* [CP] Check Pods Manifest.lock */, 9740EEB61CF901F6004384FC /* Run Script */, 97C146EA1CF9000F007C117D /* Sources */, 97C146EB1CF9000F007C117D /* Frameworks */, 97C146EC1CF9000F007C117D /* Resources */, 9705A1C41CF9048500538489 /* Embed Frameworks */, + 3AAC6A4E2B1CD43900ED5F59 /* Embed Foundation Extensions */, + DA06ECC516BB8D6C47C7C8FB /* [CP] Embed Pods Frameworks */, 3B06AD1E1E4923F5004D2608 /* Thin Binary */, - 7DEC1846D0083E553565E7AB /* [CP] Embed Pods Frameworks */, - A0B4A46A25299C5A00536BC1 /* Embed App Extensions */, ); buildRules = ( ); dependencies = ( - A0B4A46825299C5A00536BC1 /* PBXTargetDependency */, + 3AAC6A482B1CD43900ED5F59 /* PBXTargetDependency */, ); name = Runner; productName = Runner; productReference = 97C146EE1CF9000F007C117D /* Runner.app */; productType = "com.apple.product-type.application"; }; - A0B4A45B25299C5800536BC1 /* HomeWidgetExampleExtension */ = { - isa = PBXNativeTarget; - buildConfigurationList = A0B4A46E25299C5A00536BC1 /* Build configuration list for PBXNativeTarget "HomeWidgetExampleExtension" */; - buildPhases = ( - A0B4A45825299C5800536BC1 /* Sources */, - A0B4A45925299C5800536BC1 /* Frameworks */, - A0B4A45A25299C5800536BC1 /* Resources */, - ); - buildRules = ( - ); - dependencies = ( - ); - name = HomeWidgetExampleExtension; - productName = HomeWidgetExampleExtension; - productReference = A0B4A45C25299C5800536BC1 /* HomeWidgetExampleExtension.appex */; - productType = "com.apple.product-type.app-extension"; - }; /* End PBXNativeTarget section */ /* Begin PBXProject section */ 97C146E61CF9000F007C117D /* Project object */ = { isa = PBXProject; attributes = { - LastSwiftUpdateCheck = 1200; - LastUpgradeCheck = 1300; + BuildIndependentTargetsInParallel = YES; + LastSwiftUpdateCheck = 1500; + LastUpgradeCheck = 1430; ORGANIZATIONNAME = ""; TargetAttributes = { + 331C8080294A63A400263BE5 = { + CreatedOnToolsVersion = 14.0; + TestTargetID = 97C146ED1CF9000F007C117D; + }; + 3AAC6A382B1CD43700ED5F59 = { + CreatedOnToolsVersion = 15.0.1; + }; 97C146ED1CF9000F007C117D = { CreatedOnToolsVersion = 7.3.1; LastSwiftMigration = 1100; }; - A0B4A45B25299C5800536BC1 = { - CreatedOnToolsVersion = 12.0.1; - }; }; }; buildConfigurationList = 97C146E91CF9000F007C117D /* Build configuration list for PBXProject "Runner" */; @@ -262,67 +336,102 @@ projectRoot = ""; targets = ( 97C146ED1CF9000F007C117D /* Runner */, - A0B4A45B25299C5800536BC1 /* HomeWidgetExampleExtension */, + 331C8080294A63A400263BE5 /* RunnerTests */, + 3AAC6A382B1CD43700ED5F59 /* HomeWidgetExampleExtension */, ); }; /* End PBXProject section */ /* Begin PBXResourcesBuildPhase section */ - 97C146EC1CF9000F007C117D /* Resources */ = { + 331C807F294A63A400263BE5 /* Resources */ = { isa = PBXResourcesBuildPhase; buildActionMask = 2147483647; files = ( - 97C147011CF9000F007C117D /* LaunchScreen.storyboard in Resources */, - 3B3967161E833CAA004F5970 /* AppFrameworkInfo.plist in Resources */, - 97C146FE1CF9000F007C117D /* Assets.xcassets in Resources */, - 97C146FC1CF9000F007C117D /* Main.storyboard in Resources */, ); runOnlyForDeploymentPostprocessing = 0; }; - A0B4A45A25299C5800536BC1 /* Resources */ = { + 3AAC6A372B1CD43700ED5F59 /* Resources */ = { isa = PBXResourcesBuildPhase; buildActionMask = 2147483647; files = ( - A0B4A46525299C5A00536BC1 /* Assets.xcassets in Resources */, + 3AAC6A452B1CD43900ED5F59 /* Assets.xcassets in Resources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; + 97C146EC1CF9000F007C117D /* Resources */ = { + isa = PBXResourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + 97C147011CF9000F007C117D /* LaunchScreen.storyboard in Resources */, + 3B3967161E833CAA004F5970 /* AppFrameworkInfo.plist in Resources */, + 97C146FE1CF9000F007C117D /* Assets.xcassets in Resources */, + 97C146FC1CF9000F007C117D /* Main.storyboard in Resources */, ); runOnlyForDeploymentPostprocessing = 0; }; /* End PBXResourcesBuildPhase section */ /* Begin PBXShellScriptBuildPhase section */ - 3B06AD1E1E4923F5004D2608 /* Thin Binary */ = { + 19B855C45531B6FFB948FCBE /* [CP] Check Pods Manifest.lock */ = { isa = PBXShellScriptBuildPhase; - alwaysOutOfDate = 1; buildActionMask = 2147483647; files = ( ); + inputFileListPaths = ( + ); inputPaths = ( - "${TARGET_BUILD_DIR}/${INFOPLIST_PATH}", + "${PODS_PODFILE_DIR_PATH}/Podfile.lock", + "${PODS_ROOT}/Manifest.lock", + ); + name = "[CP] Check Pods Manifest.lock"; + outputFileListPaths = ( ); - name = "Thin Binary"; outputPaths = ( + "$(DERIVED_FILE_DIR)/Pods-HomeWidgetExampleExtension-checkManifestLockResult.txt", ); runOnlyForDeploymentPostprocessing = 0; shellPath = /bin/sh; - shellScript = "/bin/sh \"$FLUTTER_ROOT/packages/flutter_tools/bin/xcode_backend.sh\" embed_and_thin"; + shellScript = "diff \"${PODS_PODFILE_DIR_PATH}/Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n# This output is used by Xcode 'outputs' to avoid re-running this script phase.\necho \"SUCCESS\" > \"${SCRIPT_OUTPUT_FILE_0}\"\n"; + showEnvVarsInLog = 0; }; - 7DEC1846D0083E553565E7AB /* [CP] Embed Pods Frameworks */ = { + 36E3567ACFCF6B8F5CA81D98 /* [CP] Check Pods Manifest.lock */ = { isa = PBXShellScriptBuildPhase; buildActionMask = 2147483647; files = ( ); inputFileListPaths = ( - "${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-frameworks-${CONFIGURATION}-input-files.xcfilelist", ); - name = "[CP] Embed Pods Frameworks"; + inputPaths = ( + "${PODS_PODFILE_DIR_PATH}/Podfile.lock", + "${PODS_ROOT}/Manifest.lock", + ); + name = "[CP] Check Pods Manifest.lock"; outputFileListPaths = ( - "${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-frameworks-${CONFIGURATION}-output-files.xcfilelist", + ); + outputPaths = ( + "$(DERIVED_FILE_DIR)/Pods-RunnerTests-checkManifestLockResult.txt", ); runOnlyForDeploymentPostprocessing = 0; shellPath = /bin/sh; - shellScript = "\"${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-frameworks.sh\"\n"; + shellScript = "diff \"${PODS_PODFILE_DIR_PATH}/Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n# This output is used by Xcode 'outputs' to avoid re-running this script phase.\necho \"SUCCESS\" > \"${SCRIPT_OUTPUT_FILE_0}\"\n"; showEnvVarsInLog = 0; }; + 3B06AD1E1E4923F5004D2608 /* Thin Binary */ = { + isa = PBXShellScriptBuildPhase; + alwaysOutOfDate = 1; + buildActionMask = 2147483647; + files = ( + ); + inputPaths = ( + "${TARGET_BUILD_DIR}/${INFOPLIST_PATH}", + ); + name = "Thin Binary"; + outputPaths = ( + ); + runOnlyForDeploymentPostprocessing = 0; + shellPath = /bin/sh; + shellScript = "/bin/sh \"$FLUTTER_ROOT/packages/flutter_tools/bin/xcode_backend.sh\" embed_and_thin"; + }; 9740EEB61CF901F6004384FC /* Run Script */ = { isa = PBXShellScriptBuildPhase; alwaysOutOfDate = 1; @@ -338,7 +447,7 @@ shellPath = /bin/sh; shellScript = "/bin/sh \"$FLUTTER_ROOT/packages/flutter_tools/bin/xcode_backend.sh\" build"; }; - D28D27C01D99FA0B41273269 /* [CP] Check Pods Manifest.lock */ = { + D05EB4AE28294B897266E68B /* [CP] Check Pods Manifest.lock */ = { isa = PBXShellScriptBuildPhase; buildActionMask = 2147483647; files = ( @@ -360,33 +469,65 @@ shellScript = "diff \"${PODS_PODFILE_DIR_PATH}/Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n# This output is used by Xcode 'outputs' to avoid re-running this script phase.\necho \"SUCCESS\" > \"${SCRIPT_OUTPUT_FILE_0}\"\n"; showEnvVarsInLog = 0; }; + DA06ECC516BB8D6C47C7C8FB /* [CP] Embed Pods Frameworks */ = { + isa = PBXShellScriptBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + inputFileListPaths = ( + "${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-frameworks-${CONFIGURATION}-input-files.xcfilelist", + ); + name = "[CP] Embed Pods Frameworks"; + outputFileListPaths = ( + "${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-frameworks-${CONFIGURATION}-output-files.xcfilelist", + ); + runOnlyForDeploymentPostprocessing = 0; + shellPath = /bin/sh; + shellScript = "\"${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-frameworks.sh\"\n"; + showEnvVarsInLog = 0; + }; /* End PBXShellScriptBuildPhase section */ /* Begin PBXSourcesBuildPhase section */ - 97C146EA1CF9000F007C117D /* Sources */ = { + 331C807D294A63A400263BE5 /* Sources */ = { isa = PBXSourcesBuildPhase; buildActionMask = 2147483647; files = ( - 74858FAF1ED2DC5600515810 /* AppDelegate.swift in Sources */, - 1498D2341E8E89220040F4C2 /* GeneratedPluginRegistrant.m in Sources */, + 331C808B294A63AB00263BE5 /* RunnerTests.swift in Sources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; + 3AAC6A352B1CD43700ED5F59 /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + 3AAC6A512B1CD45700ED5F59 /* BackgroundIntent.swift in Sources */, + 3AAC6A432B1CD43700ED5F59 /* HomeWidgetExample.swift in Sources */, ); runOnlyForDeploymentPostprocessing = 0; }; - A0B4A45825299C5800536BC1 /* Sources */ = { + 97C146EA1CF9000F007C117D /* Sources */ = { isa = PBXSourcesBuildPhase; buildActionMask = 2147483647; files = ( - A0B4A46325299C5800536BC1 /* HomeWidgetExample.swift in Sources */, + 3AAC6A502B1CD45700ED5F59 /* BackgroundIntent.swift in Sources */, + 74858FAF1ED2DC5600515810 /* AppDelegate.swift in Sources */, + 1498D2341E8E89220040F4C2 /* GeneratedPluginRegistrant.m in Sources */, ); runOnlyForDeploymentPostprocessing = 0; }; /* End PBXSourcesBuildPhase section */ /* Begin PBXTargetDependency section */ - A0B4A46825299C5A00536BC1 /* PBXTargetDependency */ = { + 331C8086294A63A400263BE5 /* PBXTargetDependency */ = { isa = PBXTargetDependency; - target = A0B4A45B25299C5800536BC1 /* HomeWidgetExampleExtension */; - targetProxy = A0B4A46725299C5A00536BC1 /* PBXContainerItemProxy */; + target = 97C146ED1CF9000F007C117D /* Runner */; + targetProxy = 331C8085294A63A400263BE5 /* PBXContainerItemProxy */; + }; + 3AAC6A482B1CD43900ED5F59 /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + target = 3AAC6A382B1CD43700ED5F59 /* HomeWidgetExampleExtension */; + targetProxy = 3AAC6A472B1CD43900ED5F59 /* PBXContainerItemProxy */; }; /* End PBXTargetDependency section */ @@ -451,7 +592,7 @@ GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; GCC_WARN_UNUSED_FUNCTION = YES; GCC_WARN_UNUSED_VARIABLE = YES; - IPHONEOS_DEPLOYMENT_TARGET = 10.0; + IPHONEOS_DEPLOYMENT_TARGET = 11.0; MTL_ENABLE_DEBUG_INFO = NO; SDKROOT = iphoneos; SUPPORTED_PLATFORMS = iphoneos; @@ -468,30 +609,195 @@ ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; CLANG_ENABLE_MODULES = YES; CODE_SIGN_ENTITLEMENTS = Runner/Runner.entitlements; - CODE_SIGN_STYLE = Manual; CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)"; - DEVELOPMENT_TEAM = H54LJFQW93; + DEVELOPMENT_TEAM = T3PND82A9W; ENABLE_BITCODE = NO; - FRAMEWORK_SEARCH_PATHS = ( + INFOPLIST_FILE = Runner/Info.plist; + LD_RUNPATH_SEARCH_PATHS = ( "$(inherited)", - "$(PROJECT_DIR)/Flutter", + "@executable_path/Frameworks", ); - INFOPLIST_FILE = Runner/Info.plist; - IPHONEOS_DEPLOYMENT_TARGET = 14.0; + PRODUCT_BUNDLE_IDENTIFIER = es.antonborri.exampleHomeWidget; + PRODUCT_NAME = "$(TARGET_NAME)"; + SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h"; + SWIFT_VERSION = 5.0; + VERSIONING_SYSTEM = "apple-generic"; + }; + name = Profile; + }; + 331C8088294A63A400263BE5 /* Debug */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = 01ED8F3E7A1B3BBE2ED10AB6 /* Pods-RunnerTests.debug.xcconfig */; + buildSettings = { + BUNDLE_LOADER = "$(TEST_HOST)"; + CODE_SIGN_STYLE = Automatic; + CURRENT_PROJECT_VERSION = 1; + GENERATE_INFOPLIST_FILE = YES; + MARKETING_VERSION = 1.0; + PRODUCT_BUNDLE_IDENTIFIER = es.antonborri.example.RunnerTests; + PRODUCT_NAME = "$(TARGET_NAME)"; + SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG; + SWIFT_OPTIMIZATION_LEVEL = "-Onone"; + SWIFT_VERSION = 5.0; + TEST_HOST = "$(BUILT_PRODUCTS_DIR)/Runner.app/$(BUNDLE_EXECUTABLE_FOLDER_PATH)/Runner"; + }; + name = Debug; + }; + 331C8089294A63A400263BE5 /* Release */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = AB4991BB2F6104F16A20FAFF /* Pods-RunnerTests.release.xcconfig */; + buildSettings = { + BUNDLE_LOADER = "$(TEST_HOST)"; + CODE_SIGN_STYLE = Automatic; + CURRENT_PROJECT_VERSION = 1; + GENERATE_INFOPLIST_FILE = YES; + MARKETING_VERSION = 1.0; + PRODUCT_BUNDLE_IDENTIFIER = es.antonborri.example.RunnerTests; + PRODUCT_NAME = "$(TARGET_NAME)"; + SWIFT_VERSION = 5.0; + TEST_HOST = "$(BUILT_PRODUCTS_DIR)/Runner.app/$(BUNDLE_EXECUTABLE_FOLDER_PATH)/Runner"; + }; + name = Release; + }; + 331C808A294A63A400263BE5 /* Profile */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = C1F2EEA684896C2FE30BA404 /* Pods-RunnerTests.profile.xcconfig */; + buildSettings = { + BUNDLE_LOADER = "$(TEST_HOST)"; + CODE_SIGN_STYLE = Automatic; + CURRENT_PROJECT_VERSION = 1; + GENERATE_INFOPLIST_FILE = YES; + MARKETING_VERSION = 1.0; + PRODUCT_BUNDLE_IDENTIFIER = es.antonborri.example.RunnerTests; + PRODUCT_NAME = "$(TARGET_NAME)"; + SWIFT_VERSION = 5.0; + TEST_HOST = "$(BUILT_PRODUCTS_DIR)/Runner.app/$(BUNDLE_EXECUTABLE_FOLDER_PATH)/Runner"; + }; + name = Profile; + }; + 3AAC6A4B2B1CD43900ED5F59 /* Debug */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = C52AF632B32B3D977D171253 /* Pods-HomeWidgetExampleExtension.debug.xcconfig */; + buildSettings = { + ASSETCATALOG_COMPILER_GENERATE_SWIFT_ASSET_SYMBOL_EXTENSIONS = YES; + ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor; + ASSETCATALOG_COMPILER_WIDGET_BACKGROUND_COLOR_NAME = WidgetBackground; + CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; + CLANG_CXX_LANGUAGE_STANDARD = "gnu++20"; + CLANG_ENABLE_OBJC_WEAK = YES; + CLANG_WARN_DOCUMENTATION_COMMENTS = YES; + CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES; + CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; + CODE_SIGN_ENTITLEMENTS = HomeWidgetExampleExtension.entitlements; + CODE_SIGN_STYLE = Automatic; + CURRENT_PROJECT_VERSION = 1; + DEVELOPMENT_TEAM = T3PND82A9W; + ENABLE_USER_SCRIPT_SANDBOXING = YES; + GCC_C_LANGUAGE_STANDARD = gnu17; + GENERATE_INFOPLIST_FILE = YES; + INFOPLIST_FILE = HomeWidgetExample/Info.plist; + INFOPLIST_KEY_CFBundleDisplayName = HomeWidgetExample; + INFOPLIST_KEY_NSHumanReadableCopyright = ""; + IPHONEOS_DEPLOYMENT_TARGET = 17.0; + LD_RUNPATH_SEARCH_PATHS = ( + "$(inherited)", + "@executable_path/Frameworks", + "@executable_path/../../Frameworks", + ); + LOCALIZATION_PREFERS_STRING_CATALOGS = YES; + MARKETING_VERSION = 1.0; + MTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE; + MTL_FAST_MATH = YES; + PRODUCT_BUNDLE_IDENTIFIER = es.antonborri.exampleHomeWidget.HomeWidgetExample; + PRODUCT_NAME = "$(TARGET_NAME)"; + SKIP_INSTALL = YES; + SWIFT_ACTIVE_COMPILATION_CONDITIONS = "DEBUG $(inherited)"; + SWIFT_EMIT_LOC_STRINGS = YES; + SWIFT_OPTIMIZATION_LEVEL = "-Onone"; + SWIFT_VERSION = 5.0; + TARGETED_DEVICE_FAMILY = "1,2"; + }; + name = Debug; + }; + 3AAC6A4C2B1CD43900ED5F59 /* Release */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = 02E953153F3D9493743CC26C /* Pods-HomeWidgetExampleExtension.release.xcconfig */; + buildSettings = { + ASSETCATALOG_COMPILER_GENERATE_SWIFT_ASSET_SYMBOL_EXTENSIONS = YES; + ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor; + ASSETCATALOG_COMPILER_WIDGET_BACKGROUND_COLOR_NAME = WidgetBackground; + CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; + CLANG_CXX_LANGUAGE_STANDARD = "gnu++20"; + CLANG_ENABLE_OBJC_WEAK = YES; + CLANG_WARN_DOCUMENTATION_COMMENTS = YES; + CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES; + CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; + CODE_SIGN_ENTITLEMENTS = HomeWidgetExampleExtension.entitlements; + CODE_SIGN_STYLE = Automatic; + CURRENT_PROJECT_VERSION = 1; + DEVELOPMENT_TEAM = T3PND82A9W; + ENABLE_USER_SCRIPT_SANDBOXING = YES; + GCC_C_LANGUAGE_STANDARD = gnu17; + GENERATE_INFOPLIST_FILE = YES; + INFOPLIST_FILE = HomeWidgetExample/Info.plist; + INFOPLIST_KEY_CFBundleDisplayName = HomeWidgetExample; + INFOPLIST_KEY_NSHumanReadableCopyright = ""; + IPHONEOS_DEPLOYMENT_TARGET = 17.0; LD_RUNPATH_SEARCH_PATHS = ( "$(inherited)", "@executable_path/Frameworks", + "@executable_path/../../Frameworks", ); - LIBRARY_SEARCH_PATHS = ( + LOCALIZATION_PREFERS_STRING_CATALOGS = YES; + MARKETING_VERSION = 1.0; + MTL_FAST_MATH = YES; + PRODUCT_BUNDLE_IDENTIFIER = es.antonborri.exampleHomeWidget.HomeWidgetExample; + PRODUCT_NAME = "$(TARGET_NAME)"; + SKIP_INSTALL = YES; + SWIFT_EMIT_LOC_STRINGS = YES; + SWIFT_VERSION = 5.0; + TARGETED_DEVICE_FAMILY = "1,2"; + }; + name = Release; + }; + 3AAC6A4D2B1CD43900ED5F59 /* Profile */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = E83E2772F8C2648F6A4B8430 /* Pods-HomeWidgetExampleExtension.profile.xcconfig */; + buildSettings = { + ASSETCATALOG_COMPILER_GENERATE_SWIFT_ASSET_SYMBOL_EXTENSIONS = YES; + ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor; + ASSETCATALOG_COMPILER_WIDGET_BACKGROUND_COLOR_NAME = WidgetBackground; + CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; + CLANG_CXX_LANGUAGE_STANDARD = "gnu++20"; + CLANG_ENABLE_OBJC_WEAK = YES; + CLANG_WARN_DOCUMENTATION_COMMENTS = YES; + CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES; + CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; + CODE_SIGN_ENTITLEMENTS = HomeWidgetExampleExtension.entitlements; + CODE_SIGN_STYLE = Automatic; + CURRENT_PROJECT_VERSION = 1; + DEVELOPMENT_TEAM = T3PND82A9W; + ENABLE_USER_SCRIPT_SANDBOXING = YES; + GCC_C_LANGUAGE_STANDARD = gnu17; + GENERATE_INFOPLIST_FILE = YES; + INFOPLIST_FILE = HomeWidgetExample/Info.plist; + INFOPLIST_KEY_CFBundleDisplayName = HomeWidgetExample; + INFOPLIST_KEY_NSHumanReadableCopyright = ""; + IPHONEOS_DEPLOYMENT_TARGET = 17.0; + LD_RUNPATH_SEARCH_PATHS = ( "$(inherited)", - "$(PROJECT_DIR)/Flutter", + "@executable_path/Frameworks", + "@executable_path/../../Frameworks", ); - PRODUCT_BUNDLE_IDENTIFIER = es.antonborri.homeWidgetExample; + LOCALIZATION_PREFERS_STRING_CATALOGS = YES; + MARKETING_VERSION = 1.0; + MTL_FAST_MATH = YES; + PRODUCT_BUNDLE_IDENTIFIER = es.antonborri.exampleHomeWidget.HomeWidgetExample; PRODUCT_NAME = "$(TARGET_NAME)"; - PROVISIONING_PROFILE_SPECIFIER = ""; - SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h"; + SKIP_INSTALL = YES; + SWIFT_EMIT_LOC_STRINGS = YES; SWIFT_VERSION = 5.0; - VERSIONING_SYSTEM = "apple-generic"; + TARGETED_DEVICE_FAMILY = "1,2"; }; name = Profile; }; @@ -542,7 +848,7 @@ GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; GCC_WARN_UNUSED_FUNCTION = YES; GCC_WARN_UNUSED_VARIABLE = YES; - IPHONEOS_DEPLOYMENT_TARGET = 10.0; + IPHONEOS_DEPLOYMENT_TARGET = 11.0; MTL_ENABLE_DEBUG_INFO = YES; ONLY_ACTIVE_ARCH = YES; SDKROOT = iphoneos; @@ -591,7 +897,7 @@ GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; GCC_WARN_UNUSED_FUNCTION = YES; GCC_WARN_UNUSED_VARIABLE = YES; - IPHONEOS_DEPLOYMENT_TARGET = 10.0; + IPHONEOS_DEPLOYMENT_TARGET = 11.0; MTL_ENABLE_DEBUG_INFO = NO; SDKROOT = iphoneos; SUPPORTED_PLATFORMS = iphoneos; @@ -610,28 +916,16 @@ ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; CLANG_ENABLE_MODULES = YES; CODE_SIGN_ENTITLEMENTS = Runner/Runner.entitlements; - CODE_SIGN_IDENTITY = "Apple Development"; - CODE_SIGN_STYLE = Manual; CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)"; - DEVELOPMENT_TEAM = H54LJFQW93; + DEVELOPMENT_TEAM = T3PND82A9W; ENABLE_BITCODE = NO; - FRAMEWORK_SEARCH_PATHS = ( - "$(inherited)", - "$(PROJECT_DIR)/Flutter", - ); INFOPLIST_FILE = Runner/Info.plist; - IPHONEOS_DEPLOYMENT_TARGET = 14.0; LD_RUNPATH_SEARCH_PATHS = ( "$(inherited)", "@executable_path/Frameworks", ); - LIBRARY_SEARCH_PATHS = ( - "$(inherited)", - "$(PROJECT_DIR)/Flutter", - ); - PRODUCT_BUNDLE_IDENTIFIER = es.antonborri.homeWidgetExample; + PRODUCT_BUNDLE_IDENTIFIER = es.antonborri.exampleHomeWidget; PRODUCT_NAME = "$(TARGET_NAME)"; - PROVISIONING_PROFILE_SPECIFIER = ""; SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h"; SWIFT_OPTIMIZATION_LEVEL = "-Onone"; SWIFT_VERSION = 5.0; @@ -647,138 +941,45 @@ ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; CLANG_ENABLE_MODULES = YES; CODE_SIGN_ENTITLEMENTS = Runner/Runner.entitlements; - CODE_SIGN_IDENTITY = "Apple Development"; - CODE_SIGN_STYLE = Manual; CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)"; - DEVELOPMENT_TEAM = H54LJFQW93; + DEVELOPMENT_TEAM = T3PND82A9W; ENABLE_BITCODE = NO; - FRAMEWORK_SEARCH_PATHS = ( - "$(inherited)", - "$(PROJECT_DIR)/Flutter", - ); INFOPLIST_FILE = Runner/Info.plist; - IPHONEOS_DEPLOYMENT_TARGET = 14.0; LD_RUNPATH_SEARCH_PATHS = ( "$(inherited)", "@executable_path/Frameworks", ); - LIBRARY_SEARCH_PATHS = ( - "$(inherited)", - "$(PROJECT_DIR)/Flutter", - ); - PRODUCT_BUNDLE_IDENTIFIER = es.antonborri.homeWidgetExample; + PRODUCT_BUNDLE_IDENTIFIER = es.antonborri.exampleHomeWidget; PRODUCT_NAME = "$(TARGET_NAME)"; - PROVISIONING_PROFILE_SPECIFIER = ""; SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h"; SWIFT_VERSION = 5.0; VERSIONING_SYSTEM = "apple-generic"; }; name = Release; }; - A0B4A46B25299C5A00536BC1 /* Debug */ = { - isa = XCBuildConfiguration; - buildSettings = { - ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor; - ASSETCATALOG_COMPILER_WIDGET_BACKGROUND_COLOR_NAME = WidgetBackground; - CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; - CLANG_CXX_LANGUAGE_STANDARD = "gnu++14"; - CLANG_ENABLE_OBJC_WEAK = YES; - CLANG_WARN_DOCUMENTATION_COMMENTS = YES; - CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES; - CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; - CODE_SIGN_ENTITLEMENTS = HomeWidgetExampleExtension.entitlements; - CODE_SIGN_IDENTITY = "Apple Development"; - CODE_SIGN_STYLE = Manual; - DEVELOPMENT_TEAM = H54LJFQW93; - GCC_C_LANGUAGE_STANDARD = gnu11; - INFOPLIST_FILE = HomeWidgetExample/Info.plist; - IPHONEOS_DEPLOYMENT_TARGET = 14.0; - LD_RUNPATH_SEARCH_PATHS = ( - "$(inherited)", - "@executable_path/Frameworks", - "@executable_path/../../Frameworks", - ); - MTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE; - MTL_FAST_MATH = YES; - PRODUCT_BUNDLE_IDENTIFIER = es.antonborri.homeWidgetExample.HomeWidgetExample; - PRODUCT_NAME = "$(TARGET_NAME)"; - PROVISIONING_PROFILE_SPECIFIER = ""; - SKIP_INSTALL = YES; - SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG; - SWIFT_OPTIMIZATION_LEVEL = "-Onone"; - SWIFT_VERSION = 5.0; - TARGETED_DEVICE_FAMILY = "1,2"; - }; - name = Debug; - }; - A0B4A46C25299C5A00536BC1 /* Release */ = { - isa = XCBuildConfiguration; - buildSettings = { - ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor; - ASSETCATALOG_COMPILER_WIDGET_BACKGROUND_COLOR_NAME = WidgetBackground; - CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; - CLANG_CXX_LANGUAGE_STANDARD = "gnu++14"; - CLANG_ENABLE_OBJC_WEAK = YES; - CLANG_WARN_DOCUMENTATION_COMMENTS = YES; - CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES; - CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; - CODE_SIGN_ENTITLEMENTS = HomeWidgetExampleExtension.entitlements; - CODE_SIGN_IDENTITY = "Apple Development"; - CODE_SIGN_STYLE = Manual; - DEVELOPMENT_TEAM = H54LJFQW93; - GCC_C_LANGUAGE_STANDARD = gnu11; - INFOPLIST_FILE = HomeWidgetExample/Info.plist; - IPHONEOS_DEPLOYMENT_TARGET = 14.0; - LD_RUNPATH_SEARCH_PATHS = ( - "$(inherited)", - "@executable_path/Frameworks", - "@executable_path/../../Frameworks", - ); - MTL_FAST_MATH = YES; - PRODUCT_BUNDLE_IDENTIFIER = es.antonborri.homeWidgetExample.HomeWidgetExample; - PRODUCT_NAME = "$(TARGET_NAME)"; - PROVISIONING_PROFILE_SPECIFIER = ""; - SKIP_INSTALL = YES; - SWIFT_VERSION = 5.0; - TARGETED_DEVICE_FAMILY = "1,2"; - }; - name = Release; - }; - A0B4A46D25299C5A00536BC1 /* Profile */ = { - isa = XCBuildConfiguration; - buildSettings = { - ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor; - ASSETCATALOG_COMPILER_WIDGET_BACKGROUND_COLOR_NAME = WidgetBackground; - CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; - CLANG_CXX_LANGUAGE_STANDARD = "gnu++14"; - CLANG_ENABLE_OBJC_WEAK = YES; - CLANG_WARN_DOCUMENTATION_COMMENTS = YES; - CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES; - CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; - CODE_SIGN_ENTITLEMENTS = HomeWidgetExampleExtension.entitlements; - CODE_SIGN_STYLE = Manual; - DEVELOPMENT_TEAM = H54LJFQW93; - GCC_C_LANGUAGE_STANDARD = gnu11; - INFOPLIST_FILE = HomeWidgetExample/Info.plist; - IPHONEOS_DEPLOYMENT_TARGET = 14.0; - LD_RUNPATH_SEARCH_PATHS = ( - "$(inherited)", - "@executable_path/Frameworks", - "@executable_path/../../Frameworks", - ); - MTL_FAST_MATH = YES; - PRODUCT_BUNDLE_IDENTIFIER = es.antonborri.homeWidgetExample.HomeWidgetExample; - PRODUCT_NAME = "$(TARGET_NAME)"; - PROVISIONING_PROFILE_SPECIFIER = ""; - SKIP_INSTALL = YES; - SWIFT_VERSION = 5.0; - TARGETED_DEVICE_FAMILY = "1,2"; - }; - name = Profile; - }; /* End XCBuildConfiguration section */ /* Begin XCConfigurationList section */ + 331C8087294A63A400263BE5 /* Build configuration list for PBXNativeTarget "RunnerTests" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 331C8088294A63A400263BE5 /* Debug */, + 331C8089294A63A400263BE5 /* Release */, + 331C808A294A63A400263BE5 /* Profile */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; + 3AAC6A4A2B1CD43900ED5F59 /* Build configuration list for PBXNativeTarget "HomeWidgetExampleExtension" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 3AAC6A4B2B1CD43900ED5F59 /* Debug */, + 3AAC6A4C2B1CD43900ED5F59 /* Release */, + 3AAC6A4D2B1CD43900ED5F59 /* Profile */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; 97C146E91CF9000F007C117D /* Build configuration list for PBXProject "Runner" */ = { isa = XCConfigurationList; buildConfigurations = ( @@ -799,16 +1000,6 @@ defaultConfigurationIsVisible = 0; defaultConfigurationName = Release; }; - A0B4A46E25299C5A00536BC1 /* Build configuration list for PBXNativeTarget "HomeWidgetExampleExtension" */ = { - isa = XCConfigurationList; - buildConfigurations = ( - A0B4A46B25299C5A00536BC1 /* Debug */, - A0B4A46C25299C5A00536BC1 /* Release */, - A0B4A46D25299C5A00536BC1 /* Profile */, - ); - defaultConfigurationIsVisible = 0; - defaultConfigurationName = Release; - }; /* End XCConfigurationList section */ }; rootObject = 97C146E61CF9000F007C117D /* Project object */; diff --git a/example/ios/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme b/example/ios/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme index c87d15a3..87131a09 100644 --- a/example/ios/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme +++ b/example/ios/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme @@ -1,6 +1,6 @@ + + + + Bool { GeneratedPluginRegistrant.register(with: self) - - UIApplication.shared.setMinimumBackgroundFetchInterval(TimeInterval(60*15)) - + + UIApplication.shared.setMinimumBackgroundFetchInterval(TimeInterval(60 * 15)) + WorkmanagerPlugin.setPluginRegistrantCallback { registry in + GeneratedPluginRegistrant.register(with: registry) + } + + if #available(iOS 17, *) { + HomeWidgetBackgroundWorker.setPluginRegistrantCallback { registry in GeneratedPluginRegistrant.register(with: registry) + } } - + return super.application(application, didFinishLaunchingWithOptions: launchOptions) } } diff --git a/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@1x.png b/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@1x.png index 28c6bf03..7353c41e 100644 Binary files a/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@1x.png and b/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@1x.png differ diff --git a/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@2x.png b/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@2x.png index 2ccbfd96..797d452e 100644 Binary files a/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@2x.png and b/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@2x.png differ diff --git a/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@3x.png b/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@3x.png index f091b6b0..6ed2d933 100644 Binary files a/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@3x.png and b/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@3x.png differ diff --git a/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@1x.png b/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@1x.png index 4cde1211..4cd7b009 100644 Binary files a/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@1x.png and b/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@1x.png differ diff --git a/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@2x.png b/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@2x.png index d0ef06e7..fe730945 100644 Binary files a/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@2x.png and b/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@2x.png differ diff --git a/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@3x.png b/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@3x.png index dcdc2306..321773cd 100644 Binary files a/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@3x.png and b/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@3x.png differ diff --git a/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@1x.png b/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@1x.png index 2ccbfd96..797d452e 100644 Binary files a/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@1x.png and b/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@1x.png differ diff --git a/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@2x.png b/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@2x.png index c8f9ed8f..502f463a 100644 Binary files a/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@2x.png and b/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@2x.png differ diff --git a/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@3x.png b/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@3x.png index a6d6b860..0ec30343 100644 Binary files a/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@3x.png and b/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@3x.png differ diff --git a/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@2x.png b/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@2x.png index a6d6b860..0ec30343 100644 Binary files a/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@2x.png and b/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@2x.png differ diff --git a/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@3x.png b/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@3x.png index 75b2d164..e9f5fea2 100644 Binary files a/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@3x.png and b/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@3x.png differ diff --git a/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@1x.png b/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@1x.png index c4df70d3..84ac32ae 100644 Binary files a/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@1x.png and b/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@1x.png differ diff --git a/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@2x.png b/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@2x.png index 6a84f41e..8953cba0 100644 Binary files a/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@2x.png and b/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@2x.png differ diff --git a/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-83.5x83.5@2x.png b/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-83.5x83.5@2x.png index d0e1f585..0467bf12 100644 Binary files a/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-83.5x83.5@2x.png and b/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-83.5x83.5@2x.png differ diff --git a/example/ios/Runner/BackgroundIntent.swift b/example/ios/Runner/BackgroundIntent.swift new file mode 100644 index 00000000..0646b074 --- /dev/null +++ b/example/ios/Runner/BackgroundIntent.swift @@ -0,0 +1,40 @@ +// +// BackgroundIntent.swift +// Runner +// +// Created by Anton Borries on 26.08.23. +// + +import AppIntents +import Foundation +import home_widget + +@available(iOS 17, *) +public struct BackgroundIntent: AppIntent { + static public var title: LocalizedStringResource = "HomeWidget Background Intent" + + @Parameter(title: "Widget URI") + var url: URL? + + @Parameter(title: "AppGroup") + var appGroup: String? + + public init() {} + + public init(url: URL?, appGroup: String?) { + self.url = url + self.appGroup = appGroup + } + + public func perform() async throws -> some IntentResult { + await HomeWidgetBackgroundWorker.run(url: url, appGroup: appGroup!) + + return .result() + } +} + +/// This is required if you want to have the widget be interactive even when the app is fully suspended. +/// Note that this will launch your App so on the Flutter side you should check for the current Lifecycle State before doing heavy tasks +@available(iOS 17, *) +@available(iOSApplicationExtension, unavailable) +extension BackgroundIntent: ForegroundContinuableIntent {} diff --git a/example/ios/Runner/Info.plist b/example/ios/Runner/Info.plist index 654a338f..e359d25a 100644 --- a/example/ios/Runner/Info.plist +++ b/example/ios/Runner/Info.plist @@ -2,8 +2,12 @@ + CADisableMinimumFrameDurationOnPhone + CFBundleDevelopmentRegion $(DEVELOPMENT_LANGUAGE) + CFBundleDisplayName + Example CFBundleExecutable $(EXECUTABLE_NAME) CFBundleIdentifier @@ -22,10 +26,8 @@ $(FLUTTER_BUILD_NUMBER) LSRequiresIPhoneOS - UIBackgroundModes - - fetch - + UIApplicationSupportsIndirectInputEvents + UILaunchStoryboardName LaunchScreen UIMainStoryboardFile @@ -43,11 +45,5 @@ UIInterfaceOrientationLandscapeLeft UIInterfaceOrientationLandscapeRight - UIViewControllerBasedStatusBarAppearance - - CADisableMinimumFrameDurationOnPhone - - UIApplicationSupportsIndirectInputEvents - diff --git a/example/ios/RunnerTests/RunnerTests.swift b/example/ios/RunnerTests/RunnerTests.swift new file mode 100644 index 00000000..86a7c3b1 --- /dev/null +++ b/example/ios/RunnerTests/RunnerTests.swift @@ -0,0 +1,12 @@ +import Flutter +import UIKit +import XCTest + +class RunnerTests: XCTestCase { + + func testExample() { + // If you add code to the Runner application, consider adding tests here. + // See https://developer.apple.com/documentation/xctest for more information about using XCTest. + } + +} diff --git a/example/lib/main.dart b/example/lib/main.dart index 4499b85e..f474dd5e 100644 --- a/example/lib/main.dart +++ b/example/lib/main.dart @@ -34,9 +34,7 @@ void callbackDispatcher() { /// Called when Doing Background Work initiated from Widget @pragma("vm:entry-point") -void backgroundCallback(Uri? data) async { - print(data); - +Future interactiveCallback(Uri? data) async { if (data?.host == 'titleclicked') { final greetings = [ 'Hello', @@ -46,25 +44,29 @@ void backgroundCallback(Uri? data) async { 'Ciao', '哈洛', '안녕하세요', - 'xin chào' + 'xin chào', ]; final selectedGreeting = greetings[Random().nextInt(greetings.length)]; - + await HomeWidget.setAppGroupId('YOUR_GROUP_ID'); await HomeWidget.saveWidgetData('title', selectedGreeting); await HomeWidget.updateWidget( - name: 'HomeWidgetExampleProvider', iOSName: 'HomeWidgetExample'); + name: 'HomeWidgetExampleProvider', + iOSName: 'HomeWidgetExample', + ); } } void main() { WidgetsFlutterBinding.ensureInitialized(); Workmanager().initialize(callbackDispatcher, isInDebugMode: kDebugMode); - runApp(MaterialApp(home: MyApp())); + runApp(const MaterialApp(home: MyApp())); } class MyApp extends StatefulWidget { + const MyApp({Key? key}) : super(key: key); + @override - _MyAppState createState() => _MyAppState(); + State createState() => _MyAppState(); } class _MyAppState extends State { @@ -75,7 +77,7 @@ class _MyAppState extends State { void initState() { super.initState(); HomeWidget.setAppGroupId('YOUR_GROUP_ID'); - HomeWidget.registerBackgroundCallback(backgroundCallback); + HomeWidget.registerInteractivityCallback(interactiveCallback); } @override @@ -98,11 +100,11 @@ class _MyAppState extends State { HomeWidget.saveWidgetData('title', _titleController.text), HomeWidget.saveWidgetData('message', _messageController.text), HomeWidget.renderFlutterWidget( - Icon( + const Icon( Icons.flutter_dash, size: 200, ), - logicalSize: Size(200, 200), + logicalSize: const Size(200, 200), key: 'dashIcon', ), ]); @@ -114,7 +116,9 @@ class _MyAppState extends State { Future _updateWidget() async { try { return HomeWidget.updateWidget( - name: 'HomeWidgetExampleProvider', iOSName: 'HomeWidgetExample'); + name: 'HomeWidgetExampleProvider', + iOSName: 'HomeWidgetExample', + ); } on PlatformException catch (exception) { debugPrint('Error Updating Widget. $exception'); } @@ -125,9 +129,10 @@ class _MyAppState extends State { return Future.wait([ HomeWidget.getWidgetData('title', defaultValue: 'Default Title') .then((value) => _titleController.text = value ?? ''), - HomeWidget.getWidgetData('message', - defaultValue: 'Default Message') - .then((value) => _messageController.text = value ?? ''), + HomeWidget.getWidgetData( + 'message', + defaultValue: 'Default Message', + ).then((value) => _messageController.text = value ?? ''), ]); } on PlatformException catch (exception) { debugPrint('Error Getting Data. $exception'); @@ -146,17 +151,21 @@ class _MyAppState extends State { void _launchedFromWidget(Uri? uri) { if (uri != null) { showDialog( - context: context, - builder: (buildContext) => AlertDialog( - title: Text('App started from HomeScreenWidget'), - content: Text('Here is the URI: $uri'), - )); + context: context, + builder: (buildContext) => AlertDialog( + title: const Text('App started from HomeScreenWidget'), + content: Text('Here is the URI: $uri'), + ), + ); } } void _startBackgroundUpdate() { - Workmanager().registerPeriodicTask('1', 'widgetBackgroundUpdate', - frequency: Duration(minutes: 15)); + Workmanager().registerPeriodicTask( + '1', + 'widgetBackgroundUpdate', + frequency: const Duration(minutes: 15), + ); } void _stopBackgroundUpdate() { @@ -173,39 +182,39 @@ class _MyAppState extends State { child: Column( children: [ TextField( - decoration: InputDecoration( + decoration: const InputDecoration( hintText: 'Title', ), controller: _titleController, ), TextField( - decoration: InputDecoration( + decoration: const InputDecoration( hintText: 'Body', ), controller: _messageController, ), ElevatedButton( onPressed: _sendAndUpdate, - child: Text('Send Data to Widget'), + child: const Text('Send Data to Widget'), ), ElevatedButton( onPressed: _loadData, - child: Text('Load Data'), + child: const Text('Load Data'), ), ElevatedButton( onPressed: _checkForWidgetLaunch, - child: Text('Check For Widget Launch'), + child: const Text('Check For Widget Launch'), ), if (Platform.isAndroid) ElevatedButton( onPressed: _startBackgroundUpdate, - child: Text('Update in background'), + child: const Text('Update in background'), ), if (Platform.isAndroid) ElevatedButton( onPressed: _stopBackgroundUpdate, - child: Text('Stop updating in background'), - ) + child: const Text('Stop updating in background'), + ), ], ), ), diff --git a/example/linux/flutter/generated_plugin_registrant.cc b/example/linux/flutter/generated_plugin_registrant.cc new file mode 100644 index 00000000..e71a16d2 --- /dev/null +++ b/example/linux/flutter/generated_plugin_registrant.cc @@ -0,0 +1,11 @@ +// +// Generated file. Do not edit. +// + +// clang-format off + +#include "generated_plugin_registrant.h" + + +void fl_register_plugins(FlPluginRegistry* registry) { +} diff --git a/example/linux/flutter/generated_plugin_registrant.h b/example/linux/flutter/generated_plugin_registrant.h new file mode 100644 index 00000000..e0f0a47b --- /dev/null +++ b/example/linux/flutter/generated_plugin_registrant.h @@ -0,0 +1,15 @@ +// +// Generated file. Do not edit. +// + +// clang-format off + +#ifndef GENERATED_PLUGIN_REGISTRANT_ +#define GENERATED_PLUGIN_REGISTRANT_ + +#include + +// Registers Flutter plugins. +void fl_register_plugins(FlPluginRegistry* registry); + +#endif // GENERATED_PLUGIN_REGISTRANT_ diff --git a/example/linux/flutter/generated_plugins.cmake b/example/linux/flutter/generated_plugins.cmake new file mode 100644 index 00000000..2e1de87a --- /dev/null +++ b/example/linux/flutter/generated_plugins.cmake @@ -0,0 +1,23 @@ +# +# Generated file, do not edit. +# + +list(APPEND FLUTTER_PLUGIN_LIST +) + +list(APPEND FLUTTER_FFI_PLUGIN_LIST +) + +set(PLUGIN_BUNDLED_LIBRARIES) + +foreach(plugin ${FLUTTER_PLUGIN_LIST}) + add_subdirectory(flutter/ephemeral/.plugin_symlinks/${plugin}/linux plugins/${plugin}) + target_link_libraries(${BINARY_NAME} PRIVATE ${plugin}_plugin) + list(APPEND PLUGIN_BUNDLED_LIBRARIES $) + list(APPEND PLUGIN_BUNDLED_LIBRARIES ${${plugin}_bundled_libraries}) +endforeach(plugin) + +foreach(ffi_plugin ${FLUTTER_FFI_PLUGIN_LIST}) + add_subdirectory(flutter/ephemeral/.plugin_symlinks/${ffi_plugin}/linux plugins/${ffi_plugin}) + list(APPEND PLUGIN_BUNDLED_LIBRARIES ${${ffi_plugin}_bundled_libraries}) +endforeach(ffi_plugin) diff --git a/example/pubspec.yaml b/example/pubspec.yaml index 4e9dabb9..7f757721 100644 --- a/example/pubspec.yaml +++ b/example/pubspec.yaml @@ -9,17 +9,16 @@ environment: dependencies: flutter: sdk: flutter - workmanager: - git: - url: https://github.com/sunalwaysknows/flutter_workmanager - ref: f37742bcf612c51e9571d623138a21a90a5992ea + workmanager: ^0.5.1 home_widget: path: ../ - cupertino_icons: ^1.0.5 + cupertino_icons: ^1.0.6 dev_dependencies: + flutter_lints: ^2.0.1 + device_info_plus: ^9.0.3 integration_test: sdk: flutter flutter_test: diff --git a/ios/Classes/HomeWidgetBackgroundWorker.swift b/ios/Classes/HomeWidgetBackgroundWorker.swift new file mode 100644 index 00000000..764b522d --- /dev/null +++ b/ios/Classes/HomeWidgetBackgroundWorker.swift @@ -0,0 +1,97 @@ +// +// HomeWidgetBackgroundIntent.swift +// home_widget +// +// Created by Anton Borries on 25.08.23. +// + +import Flutter +import Foundation +import Swift + +@available(iOS 17, *) +public struct HomeWidgetBackgroundWorker { + + static let dispatcherKey: String = "home_widget.internal.background.dispatcher" + static let callbackKey: String = "home_widget.internal.background.callback" + + static var isSetupCompleted: Bool = false + static var engine: FlutterEngine? + static var channel: FlutterMethodChannel? + static var queue: [(URL?, String)] = [] + + private static var registerPlugins: FlutterPluginRegistrantCallback? + + public static func setPluginRegistrantCallback(registerPlugins: FlutterPluginRegistrantCallback) { + self.registerPlugins = registerPlugins + } + + /// Call this method to invoke the callback registered in your Flutter App. + /// The url you provide will be used as arguments in the callback function in dart + /// The AppGroup is necessary to retrieve the dart callbacks + static public func run(url: URL?, appGroup: String) async { + if isSetupCompleted { + let preferences = UserDefaults.init(suiteName: appGroup) + + let dispatcher = preferences?.object(forKey: dispatcherKey) as! Int64 + NSLog("Dispatcher: \(dispatcher)") + queue.append((url, appGroup)) + } else { + await sendEvent(url: url, appGroup: appGroup) + } + } + + static func setupEngine(dispatcher: Int64) { + engine = FlutterEngine( + name: "home_widget_background", project: nil, allowHeadlessExecution: true) + + channel = FlutterMethodChannel( + name: "home_widget/background", binaryMessenger: engine!.binaryMessenger, + codec: FlutterStandardMethodCodec.sharedInstance() + ) + let flutterCallbackInfo = FlutterCallbackCache.lookupCallbackInformation(dispatcher) + let callbackName = flutterCallbackInfo?.callbackName + let callbackLibrary = flutterCallbackInfo?.callbackLibraryPath + + let started = engine?.run( + withEntrypoint: flutterCallbackInfo?.callbackName, + libraryURI: flutterCallbackInfo?.callbackLibraryPath) + if registerPlugins != nil { + registerPlugins?(engine!) + } else { + HomeWidgetPlugin.register(with: engine!.registrar(forPlugin: "home_widget")!) + } + + channel?.setMethodCallHandler(handle) + } + + public static func handle(_ call: FlutterMethodCall, result: @escaping FlutterResult) { + switch call.method { + case "HomeWidget.backgroundInitialized": + while !queue.isEmpty { + isSetupCompleted = true + let entry = queue.removeFirst() + Task { + await sendEvent(url: entry.0, appGroup: entry.1) + } + } + result(true) + default: + result(FlutterMethodNotImplemented) + } + } + + static func sendEvent(url: URL?, appGroup: String) async { + DispatchQueue.main.async { + let preferences = UserDefaults.init(suiteName: appGroup) + let callback = preferences?.object(forKey: callbackKey) as! Int64 + + channel?.invokeMethod( + "", + arguments: [ + callback, + url?.absoluteString, + ]) + } + } +} diff --git a/ios/Classes/SwiftHomeWidgetPlugin.swift b/ios/Classes/SwiftHomeWidgetPlugin.swift index a4941557..c8afcf4a 100644 --- a/ios/Classes/SwiftHomeWidgetPlugin.swift +++ b/ios/Classes/SwiftHomeWidgetPlugin.swift @@ -3,146 +3,195 @@ import UIKit import WidgetKit public class SwiftHomeWidgetPlugin: NSObject, FlutterPlugin, FlutterStreamHandler { - - private static var groupId : String? - - private var initialUrl : URL? - private var latestUrl : URL? { - didSet { - if(latestUrl != nil) { - eventSink?.self(latestUrl?.absoluteString) - } - } + + private static var groupId: String? + + private var initialUrl: URL? + private var latestUrl: URL? { + didSet { + if latestUrl != nil { + eventSink?.self(latestUrl?.absoluteString) + } } - - private var eventSink : FlutterEventSink? - - private let notInitializedError = FlutterError( + } + + private var eventSink: FlutterEventSink? + + private let notInitializedError = FlutterError( code: "-7", message: "AppGroupId not set. Call setAppGroupId first", details: nil) - - public static func register(with registrar: FlutterPluginRegistrar) { - let instance = SwiftHomeWidgetPlugin() - - let channel = FlutterMethodChannel(name: "home_widget", binaryMessenger: registrar.messenger()) - registrar.addMethodCallDelegate(instance, channel: channel) - - let eventChannel = FlutterEventChannel(name: "home_widget/updates", binaryMessenger: registrar.messenger()) - eventChannel.setStreamHandler(instance) - - registrar.addApplicationDelegate(instance) - } - - public func handle(_ call: FlutterMethodCall, result: @escaping FlutterResult) { - if call.method == "setAppGroupId" { - guard let args = call.arguments else { - return - } - if let myArgs = args as? [String: Any?], - let groupId = myArgs["groupId"] as? String{ - SwiftHomeWidgetPlugin.groupId = groupId - result(true) - } else { - result(FlutterError(code: "-6", message: "InvalidArguments setAppGroupId must be called with a group id", details: nil)) - } - }else if call.method == "saveWidgetData" { - if (SwiftHomeWidgetPlugin.groupId == nil) { - result(notInitializedError) - return - } - guard let args = call.arguments else { - return - } - if let myArgs = args as? [String: Any?], - let id = myArgs["id"] as? String, - let data = myArgs["data"] { - let preferences = UserDefaults.init(suiteName: SwiftHomeWidgetPlugin.groupId) - if(data != nil) { - preferences?.setValue(data, forKey: id) - } else { - preferences?.removeObject(forKey: id) - } - result(true) - } else { - result(FlutterError(code: "-1", message: "InvalidArguments saveWidgetData must be called with id and data", details: nil)) - } - } else if call.method == "getWidgetData" { - if (SwiftHomeWidgetPlugin.groupId == nil) { - result(notInitializedError) - return - } - guard let args = call.arguments else { - return - } - if let myArgs = args as? [String: Any?], - let id = myArgs["id"] as? String, - let defaultValue = myArgs["defaultValue"] { - let preferences = UserDefaults.init(suiteName: SwiftHomeWidgetPlugin.groupId) - result(preferences?.value(forKey: id) ?? defaultValue) - } else { - result(FlutterError(code: "-2", message: "InvalidArguments getWidgetData must be called with id", details: nil)) - } - } else if call.method == "updateWidget" { - - guard let args = call.arguments else { - return - } - if let myArgs = args as? [String: Any?], - let name = (myArgs["ios"] ?? myArgs["name"]) as? String{ - if #available(iOS 14.0, *) { - #if arch(arm64) || arch(i386) || arch(x86_64) - WidgetCenter.shared.reloadTimelines(ofKind:name) - result(true) - #endif - } else { - result(FlutterError(code: "-4", message: "Widgets are only available on iOS 14.0 and above", details: nil)) - } - } else { - result(FlutterError(code: "-3", message: "InvalidArguments updateWidget must be called with name", details: nil)) - } - } else if call.method == "initiallyLaunchedFromHomeWidget" { - if (SwiftHomeWidgetPlugin.groupId == nil) { - result(notInitializedError) - return - } - result(initialUrl?.absoluteString) - } else if call.method == "registerBackgroundCallback" { - result(nil) + + public static func register(with registrar: FlutterPluginRegistrar) { + let instance = SwiftHomeWidgetPlugin() + + let channel = FlutterMethodChannel(name: "home_widget", binaryMessenger: registrar.messenger()) + registrar.addMethodCallDelegate(instance, channel: channel) + + let eventChannel = FlutterEventChannel( + name: "home_widget/updates", binaryMessenger: registrar.messenger()) + eventChannel.setStreamHandler(instance) + + registrar.addApplicationDelegate(instance) + } + + public func handle(_ call: FlutterMethodCall, result: @escaping FlutterResult) { + if call.method == "setAppGroupId" { + guard let args = call.arguments else { + return + } + if let myArgs = args as? [String: Any?], + let groupId = myArgs["groupId"] as? String + { + SwiftHomeWidgetPlugin.groupId = groupId + result(true) + } else { + result( + FlutterError( + code: "-6", message: "InvalidArguments setAppGroupId must be called with a group id", + details: nil)) + } + } else if call.method == "saveWidgetData" { + if SwiftHomeWidgetPlugin.groupId == nil { + result(notInitializedError) + return + } + guard let args = call.arguments else { + return + } + if let myArgs = args as? [String: Any?], + let id = myArgs["id"] as? String, + let data = myArgs["data"] + { + let preferences = UserDefaults.init(suiteName: SwiftHomeWidgetPlugin.groupId) + if data != nil { + preferences?.setValue(data, forKey: id) } else { - result(FlutterMethodNotImplemented) + preferences?.removeObject(forKey: id) } - } - - public func onListen(withArguments arguments: Any?, eventSink events: @escaping FlutterEventSink) -> FlutterError? { - eventSink = events - return nil - } - - public func onCancel(withArguments arguments: Any?) -> FlutterError? { - eventSink = nil - return nil - } + result(true) + } else { + result( + FlutterError( + code: "-1", message: "InvalidArguments saveWidgetData must be called with id and data", + details: nil)) + } + } else if call.method == "getWidgetData" { + if SwiftHomeWidgetPlugin.groupId == nil { + result(notInitializedError) + return + } + guard let args = call.arguments else { + return + } + if let myArgs = args as? [String: Any?], + let id = myArgs["id"] as? String, + let defaultValue = myArgs["defaultValue"] + { + let preferences = UserDefaults.init(suiteName: SwiftHomeWidgetPlugin.groupId) + result(preferences?.value(forKey: id) ?? defaultValue) + } else { + result( + FlutterError( + code: "-2", message: "InvalidArguments getWidgetData must be called with id", + details: nil)) + } + } else if call.method == "updateWidget" { - - public func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [AnyHashable : Any] = [:]) -> Bool { - let launchUrl = (launchOptions[UIApplication.LaunchOptionsKey.url] as? NSURL)?.absoluteURL - if(launchUrl != nil && isWidgetUrl(url: launchUrl!)) { - initialUrl = launchUrl?.absoluteURL - latestUrl = initialUrl + guard let args = call.arguments else { + return + } + if let myArgs = args as? [String: Any?], + let name = (myArgs["ios"] ?? myArgs["name"]) as? String + { + if #available(iOS 14.0, *) { + #if arch(arm64) || arch(i386) || arch(x86_64) + WidgetCenter.shared.reloadTimelines(ofKind: name) + result(true) + #endif + } else { + result( + FlutterError( + code: "-4", message: "Widgets are only available on iOS 14.0 and above", details: nil) + ) } - return true + } else { + result( + FlutterError( + code: "-3", message: "InvalidArguments updateWidget must be called with name", + details: nil)) + } + } else if call.method == "initiallyLaunchedFromHomeWidget" { + if SwiftHomeWidgetPlugin.groupId == nil { + result(notInitializedError) + return + } + result(initialUrl?.absoluteString) + } else if call.method == "registerBackgroundCallback" { + if SwiftHomeWidgetPlugin.groupId == nil { + result(notInitializedError) + return + } + if #available(iOS 17.0, *) { + let callbackHandels = call.arguments as! [Int64] + let dispatcher = callbackHandels[0] + let callback = callbackHandels[1] + let preferences = UserDefaults.init(suiteName: SwiftHomeWidgetPlugin.groupId) + preferences?.setValue(dispatcher, forKey: HomeWidgetBackgroundWorker.dispatcherKey) + preferences?.setValue(callback, forKey: HomeWidgetBackgroundWorker.callbackKey) + HomeWidgetBackgroundWorker.setupEngine(dispatcher: dispatcher) + + result(true) + return + } else { + result( + FlutterError( + code: "-5", + message: + "Interactivity is only available on iOS 17.0", + details: nil)) + } + + } else { + result(FlutterMethodNotImplemented) } - - public func application(_ application: UIApplication, open url: URL, options: [UIApplication.OpenURLOptionsKey : Any] = [:]) -> Bool { - if(isWidgetUrl(url: url)) { - latestUrl = url - return true - } - return false + } + + public func onListen(withArguments arguments: Any?, eventSink events: @escaping FlutterEventSink) + -> FlutterError? + { + eventSink = events + return nil + } + + public func onCancel(withArguments arguments: Any?) -> FlutterError? { + eventSink = nil + return nil + } + + public func application( + _ application: UIApplication, + didFinishLaunchingWithOptions launchOptions: [AnyHashable: Any] = [:] + ) -> Bool { + let launchUrl = (launchOptions[UIApplication.LaunchOptionsKey.url] as? NSURL)?.absoluteURL + if launchUrl != nil && isWidgetUrl(url: launchUrl!) { + initialUrl = launchUrl?.absoluteURL + latestUrl = initialUrl } - - private func isWidgetUrl(url: URL) -> Bool { - let components = URLComponents.init(url: url, resolvingAgainstBaseURL: false) - return components?.queryItems?.contains(where: {(item) in item.name == "homeWidget"}) ?? false - + return true + } + + public func application( + _ application: UIApplication, open url: URL, + options: [UIApplication.OpenURLOptionsKey: Any] = [:] + ) -> Bool { + if isWidgetUrl(url: url) { + latestUrl = url + return true } + return false + } + + private func isWidgetUrl(url: URL) -> Bool { + let components = URLComponents.init(url: url, resolvingAgainstBaseURL: false) + return components?.queryItems?.contains(where: { (item) in item.name == "homeWidget" }) ?? false + } } diff --git a/lib/home_widget.dart b/lib/home_widget.dart index 86b3830b..5f606d5c 100644 --- a/lib/home_widget.dart +++ b/lib/home_widget.dart @@ -97,9 +97,20 @@ class HomeWidget { } /// Register a callback that gets called when clicked on a specific View in a HomeWidget - /// supported only on Android + /// This enables having Interactive Widgets that can call Dart Code /// More Info on setting this up in the README - static Future registerBackgroundCallback(Function(Uri?) callback) { + @Deprecated('Use `registerInteractivityCallback` instead') + static Future registerBackgroundCallback( + FutureOr Function(Uri?) callback, + ) => + registerInteractivityCallback(callback); + + /// Register a callback that gets called when clicked on a specific View in a HomeWidget + /// This enables having Interactive Widgets that can call Dart Code + /// More Info on setting this up in the README + static Future registerInteractivityCallback( + FutureOr Function(Uri?) callback, + ) { final args = [ ui.PluginUtilities.getCallbackHandle(callbackDispatcher)?.toRawHandle(), ui.PluginUtilities.getCallbackHandle(callback)?.toRawHandle(), diff --git a/lib/home_widget_callback_dispatcher.dart b/lib/home_widget_callback_dispatcher.dart index 9ea4be5d..7c81dc47 100644 --- a/lib/home_widget_callback_dispatcher.dart +++ b/lib/home_widget_callback_dispatcher.dart @@ -1,3 +1,4 @@ +import 'dart:async'; import 'dart:ui'; import 'package:flutter/cupertino.dart'; @@ -5,7 +6,7 @@ import 'package:flutter/services.dart'; /// Dispatcher used for calling dart code from Native Code while in the background @pragma("vm:entry-point") -void callbackDispatcher() { +Future callbackDispatcher() async { const backgroundChannel = MethodChannel('home_widget/background'); WidgetsFlutterBinding.ensureInitialized(); @@ -14,14 +15,17 @@ void callbackDispatcher() { final callback = PluginUtilities.getCallbackFromHandle( CallbackHandle.fromRawHandle(args[0]), - ); + ) as FutureOr Function(Uri?); - final rawUri = args[1] as String; + final rawUri = args[1] as String?; - final uri = Uri.parse(rawUri); + Uri? uri; + if (rawUri != null) { + uri = Uri.parse(rawUri); + } - callback?.call(uri); + await callback.call(uri); }); - backgroundChannel.invokeMethod('HomeWidget.backgroundInitialized'); + await backgroundChannel.invokeMethod('HomeWidget.backgroundInitialized'); } diff --git a/pubspec.yaml b/pubspec.yaml index d52f79b6..a28a719e 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -1,6 +1,6 @@ name: home_widget description: A plugin to provide a common interface for creating HomeScreen Widgets for Android and iOS. -version: 0.3.1 +version: 0.4.0 repository: https://github.com/ABausG/home_widget environment: diff --git a/test/background_test.dart b/test/background_test.dart index 89d7ed25..0dd60429 100644 --- a/test/background_test.dart +++ b/test/background_test.dart @@ -15,18 +15,20 @@ void main() { const testUri = 'homeWidget://homeWidgetTest'; tester.binding.defaultBinaryMessenger - // ignore: body_might_complete_normally_nullable - .setMockMethodCallHandler(backgroundChannel, (call) { + .setMockMethodCallHandler(backgroundChannel, (call) async { if (call.method == 'HomeWidget.backgroundInitialized') { emitEvent( tester, backgroundChannel.codec .encodeMethodCall(MethodCall('', [callbackHandle, testUri])), ); + return true; + } else { + return null; } }); - callbackDispatcher(); + await callbackDispatcher(); final receivedUri = await completer.future; @@ -42,6 +44,6 @@ void emitEvent(WidgetTester tester, ByteData? event) { ); } -void testCallback(Uri? uri) { +Future testCallback(Uri? uri) async { completer.complete(uri); } diff --git a/test/home_widget_test.dart b/test/home_widget_test.dart index e3e5c5ae..3ad17c2a 100644 --- a/test/home_widget_test.dart +++ b/test/home_widget_test.dart @@ -142,6 +142,7 @@ void main() { final callbackHandle = PluginUtilities.getCallbackHandle(testCallback)?.toRawHandle(); + // ignore: deprecated_member_use_from_same_package expect(await HomeWidget.registerBackgroundCallback(testCallback), true); final argument = await passedArguments.future; @@ -150,6 +151,20 @@ void main() { expect(argument[1], callbackHandle); }); + test('Register Interactivity Callback passes Handles', () async { + final dispatcherHandle = + PluginUtilities.getCallbackHandle(callbackDispatcher)?.toRawHandle(); + final callbackHandle = + PluginUtilities.getCallbackHandle(testCallback)?.toRawHandle(); + + expect(await HomeWidget.registerInteractivityCallback(testCallback), true); + + final argument = await passedArguments.future; + + expect(argument[0], dispatcherHandle); + expect(argument[1], callbackHandle); + }); + group('Widget Clicked', () { test('Send Uris to Stream', () async { TestDefaultBinaryMessengerBinding.instance.defaultBinaryMessenger @@ -327,6 +342,6 @@ void emitEvent(ByteData? event) { ); } -void testCallback(Uri? uri) { +Future testCallback(Uri? uri) async { debugPrint('Called TestCallback'); }