Skip to content

Commit 5367cd0

Browse files
committed
Merge branch 'main' into ios-fix-extension
2 parents fa18183 + cba8262 commit 5367cd0

File tree

4 files changed

+16
-3
lines changed

4 files changed

+16
-3
lines changed

android/src/main/kotlin/es/antonborri/home_widget/HomeWidgetIntent.kt

+9-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
package es.antonborri.home_widget
22

33
import android.app.Activity
4+
import android.app.ActivityOptions
45
import android.app.PendingIntent
56
import android.content.Context
67
import android.content.Intent
@@ -21,7 +22,14 @@ object HomeWidgetLaunchIntent {
2122
flags = flags or PendingIntent.FLAG_IMMUTABLE
2223
}
2324

24-
return PendingIntent.getActivity(context, 0, intent, flags)
25+
if (Build.VERSION.SDK_INT < 34) {
26+
return PendingIntent.getActivity(context, 0, intent, flags)
27+
}
28+
29+
val options = ActivityOptions.makeBasic()
30+
options.pendingIntentBackgroundActivityStartMode = ActivityOptions.MODE_BACKGROUND_ACTIVITY_START_ALLOWED
31+
32+
return PendingIntent.getActivity(context, 0, intent, flags, options.toBundle())
2533
}
2634
}
2735

example/integration_test/ios_test.dart

+1
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ void main() {
2323
'boolKey': true,
2424
'floatingNumberKey': 12.1,
2525
'nullValueKey': null,
26+
'uint8ListKey': Uint8List.fromList([]),
2627
};
2728

2829
const defaultValue = MapEntry('defaultKey', 'defaultValue');

ios/Classes/HomeWidgetBackgroundWorker.swift

+1-1
Original file line numberDiff line numberDiff line change
@@ -68,8 +68,8 @@ public struct HomeWidgetBackgroundWorker {
6868
public static func handle(_ call: FlutterMethodCall, result: @escaping FlutterResult) {
6969
switch call.method {
7070
case "HomeWidget.backgroundInitialized":
71+
isSetupCompleted = true
7172
while !queue.isEmpty {
72-
isSetupCompleted = true
7373
let entry = queue.removeFirst()
7474
Task {
7575
await sendEvent(url: entry.0, appGroup: entry.1)

ios/Classes/SwiftHomeWidgetPlugin.swift

+5-1
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,11 @@ public class SwiftHomeWidgetPlugin: NSObject, FlutterPlugin, FlutterStreamHandle
7676
{
7777
let preferences = UserDefaults.init(suiteName: SwiftHomeWidgetPlugin.groupId)
7878
if data != nil {
79-
preferences?.setValue(data, forKey: id)
79+
if let binaryData = data as? FlutterStandardTypedData {
80+
preferences?.setValue(Data(binaryData.data), forKey: id)
81+
} else {
82+
preferences?.setValue(data, forKey: id)
83+
}
8084
} else {
8185
preferences?.removeObject(forKey: id)
8286
}

0 commit comments

Comments
 (0)