Skip to content

Commit

Permalink
Merge pull request #881 from OneSignal/push-to-start-live-activities
Browse files Browse the repository at this point in the history
Push to Start Live Activities
  • Loading branch information
brismithers authored May 15, 2024
2 parents 67bc03c + bd03ab7 commit 74d614b
Show file tree
Hide file tree
Showing 20 changed files with 692 additions and 44 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"colors" : [
{
"idiom" : "universal"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
{
"images" : [
{
"idiom" : "universal",
"platform" : "ios",
"size" : "1024x1024"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}
6 changes: 6 additions & 0 deletions example/ios/ExampleWidget/Assets.xcassets/Contents.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"info" : {
"author" : "xcode",
"version" : 1
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"colors" : [
{
"idiom" : "universal"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
{
"images" : [
{
"idiom" : "universal",
"scale" : "1x"
},
{
"idiom" : "universal",
"scale" : "2x"
},
{
"filename" : "onesignal-logo.png",
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
17 changes: 17 additions & 0 deletions example/ios/ExampleWidget/ExampleWidgetBundle.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
//
// ExampleWidgetBundle.swift
// ExampleWidget
//
// Created by Brian Smith on 4/30/24.
// Copyright © 2024 The Chromium Authors. All rights reserved.
//

import WidgetKit
import SwiftUI

@main
struct ExampleWidgetBundle: WidgetBundle {
var body: some Widget {
ExampleWidgetLiveActivity()
}
}
66 changes: 66 additions & 0 deletions example/ios/ExampleWidget/ExampleWidgetLiveActivity.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
//
// ExampleWidgetLiveActivity.swift
// ExampleWidget
//
// Created by Brian Smith on 4/30/24.
// Copyright © 2024 The Chromium Authors. All rights reserved.
//

import ActivityKit
import WidgetKit
import SwiftUI
import OneSignalLiveActivities

struct ExampleWidgetLiveActivity: Widget {
var body: some WidgetConfiguration {
ActivityConfiguration(for: DefaultLiveActivityAttributes.self) { context in
// Lock screen/banner UI goes here\VStack(alignment: .leading) {
VStack {
Spacer()
Text("FLUTTER: " + (context.attributes.data["title"]?.asString() ?? "")).font(.headline)
Spacer()
HStack {
Spacer()
Label {
Text(context.state.data["message"]?.asDict()?["en"]?.asString() ?? "")
} icon: {
Image("onesignaldemo")
.resizable()
.scaledToFit()
.frame(width: 40.0, height: 40.0)
}
Spacer()
}
Text("INT: " + String(context.state.data["intValue"]?.asInt() ?? 0))
Text("DBL: " + String(context.state.data["doubleValue"]?.asDouble() ?? 0.0))
Text("BOL: " + String(context.state.data["boolValue"]?.asBool() ?? false))
Spacer()
}
.activitySystemActionForegroundColor(.black)
.activityBackgroundTint(.white)
} dynamicIsland: { _ in
DynamicIsland {
// Expanded UI goes here. Compose the expanded UI through
// various regions, like leading/trailing/center/bottom
DynamicIslandExpandedRegion(.leading) {
Text("Leading")
}
DynamicIslandExpandedRegion(.trailing) {
Text("Trailing")
}
DynamicIslandExpandedRegion(.bottom) {
Text("Bottom")
// more content
}
} compactLeading: {
Text("L")
} compactTrailing: {
Text("T")
} minimal: {
Text("Min")
}
.widgetURL(URL(string: "http://www.apple.com"))
.keylineTint(Color.red)
}
}
}
11 changes: 11 additions & 0 deletions example/ios/ExampleWidget/Info.plist
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>NSExtension</key>
<dict>
<key>NSExtensionPointIdentifier</key>
<string>com.apple.widgetkit-extension</string>
</dict>
</dict>
</plist>
2 changes: 1 addition & 1 deletion example/ios/Flutter/AppFrameworkInfo.plist
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,6 @@
<key>CFBundleVersion</key>
<string>1.0</string>
<key>MinimumOSVersion</key>
<string>11.0</string>
<string>12.0</string>
</dict>
</plist>
6 changes: 3 additions & 3 deletions example/ios/Flutter/Flutter.podspec
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#
# NOTE: This podspec is NOT to be published. It is only used as a local source!
# This is a generated file; do not edit or check into version control.
# This podspec is NOT to be published. It is only used as a local source!
# This is a generated file; do not edit or check into version control.
#

Pod::Spec.new do |s|
Expand All @@ -11,7 +11,7 @@ Pod::Spec.new do |s|
s.license = { :type => 'BSD' }
s.author = { 'Flutter Dev Team' => '[email protected]' }
s.source = { :git => 'https://github.com/flutter/engine', :tag => s.version.to_s }
s.ios.deployment_target = '11.0'
s.ios.deployment_target = '12.0'
# Framework linking is handled by Flutter tooling, not CocoaPods.
# Add a placeholder to satisfy `s.dependency 'Flutter'` plugin podspecs.
s.vendored_frameworks = 'path/to/nothing'
Expand Down
6 changes: 5 additions & 1 deletion example/ios/Podfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# Uncomment this line to define a global platform for your project
platform :ios, '11.0'
platform :ios, '12.0'

# CocoaPods analytics sends network stats synchronously affecting flutter build latency.
ENV['COCOAPODS_DISABLE_STATS'] = 'true'
Expand Down Expand Up @@ -35,6 +35,10 @@ target 'OneSignalNotificationServiceExtension' do
pod 'OneSignalXCFramework', '>= 5.0.2', '< 6.0.0'
end

target 'ExampleWidgetExtension' do
pod 'OneSignalXCFramework', '>= 5.0.2', '< 6.0.0'
end

post_install do |installer|
installer.pods_project.targets.each do |target|
flutter_additional_ios_build_settings(target)
Expand Down
45 changes: 25 additions & 20 deletions example/ios/Podfile.lock
Original file line number Diff line number Diff line change
@@ -1,45 +1,50 @@
PODS:
- Flutter (1.0.0)
- onesignal_flutter (5.0.0):
- onesignal_flutter (5.1.5):
- Flutter
- OneSignalXCFramework (= 5.0.1)
- OneSignalXCFramework (5.0.1):
- OneSignalXCFramework/OneSignalComplete (= 5.0.1)
- OneSignalXCFramework/OneSignal (5.0.1):
- OneSignalXCFramework (= 5.2.0)
- OneSignalXCFramework (5.2.0):
- OneSignalXCFramework/OneSignalComplete (= 5.2.0)
- OneSignalXCFramework/OneSignal (5.2.0):
- OneSignalXCFramework/OneSignalCore
- OneSignalXCFramework/OneSignalExtension
- OneSignalXCFramework/OneSignalLiveActivities
- OneSignalXCFramework/OneSignalNotifications
- OneSignalXCFramework/OneSignalOSCore
- OneSignalXCFramework/OneSignalOutcomes
- OneSignalXCFramework/OneSignalUser
- OneSignalXCFramework/OneSignalComplete (5.0.1):
- OneSignalXCFramework/OneSignalComplete (5.2.0):
- OneSignalXCFramework/OneSignal
- OneSignalXCFramework/OneSignalInAppMessages
- OneSignalXCFramework/OneSignalLocation
- OneSignalXCFramework/OneSignalCore (5.0.1)
- OneSignalXCFramework/OneSignalExtension (5.0.1):
- OneSignalXCFramework/OneSignalCore (5.2.0)
- OneSignalXCFramework/OneSignalExtension (5.2.0):
- OneSignalXCFramework/OneSignalCore
- OneSignalXCFramework/OneSignalOutcomes
- OneSignalXCFramework/OneSignalInAppMessages (5.0.1):
- OneSignalXCFramework/OneSignalInAppMessages (5.2.0):
- OneSignalXCFramework/OneSignalCore
- OneSignalXCFramework/OneSignalNotifications
- OneSignalXCFramework/OneSignalOSCore
- OneSignalXCFramework/OneSignalOutcomes
- OneSignalXCFramework/OneSignalUser
- OneSignalXCFramework/OneSignalLocation (5.0.1):
- OneSignalXCFramework/OneSignalLiveActivities (5.2.0):
- OneSignalXCFramework/OneSignalCore
- OneSignalXCFramework/OneSignalOSCore
- OneSignalXCFramework/OneSignalUser
- OneSignalXCFramework/OneSignalLocation (5.2.0):
- OneSignalXCFramework/OneSignalCore
- OneSignalXCFramework/OneSignalNotifications
- OneSignalXCFramework/OneSignalOSCore
- OneSignalXCFramework/OneSignalUser
- OneSignalXCFramework/OneSignalNotifications (5.0.1):
- OneSignalXCFramework/OneSignalNotifications (5.2.0):
- OneSignalXCFramework/OneSignalCore
- OneSignalXCFramework/OneSignalExtension
- OneSignalXCFramework/OneSignalOutcomes
- OneSignalXCFramework/OneSignalOSCore (5.0.1):
- OneSignalXCFramework/OneSignalOSCore (5.2.0):
- OneSignalXCFramework/OneSignalCore
- OneSignalXCFramework/OneSignalOutcomes (5.0.1):
- OneSignalXCFramework/OneSignalOutcomes (5.2.0):
- OneSignalXCFramework/OneSignalCore
- OneSignalXCFramework/OneSignalUser (5.0.1):
- OneSignalXCFramework/OneSignalUser (5.2.0):
- OneSignalXCFramework/OneSignalCore
- OneSignalXCFramework/OneSignalNotifications
- OneSignalXCFramework/OneSignalOSCore
Expand All @@ -48,7 +53,7 @@ PODS:
DEPENDENCIES:
- Flutter (from `Flutter`)
- onesignal_flutter (from `.symlinks/plugins/onesignal_flutter/ios`)
- OneSignalXCFramework (< 6.0.0, >= 5.0.1)
- OneSignalXCFramework (< 6.0.0, >= 5.0.2)

SPEC REPOS:
trunk:
Expand All @@ -61,10 +66,10 @@ EXTERNAL SOURCES:
:path: ".symlinks/plugins/onesignal_flutter/ios"

SPEC CHECKSUMS:
Flutter: f04841e97a9d0b0a8025694d0796dd46242b2854
onesignal_flutter: 33912d40612d20a6b34cd77e3d783f61843493fc
OneSignalXCFramework: 8429bc2456554da1b09b17135621087152ad05a0
Flutter: e0871f40cf51350855a761d2e70bf5af5b9b5de7
onesignal_flutter: 6e7b22bc9bbdb32cbaf79728e624a02264adec94
OneSignalXCFramework: bdf74fdc06888f9466dc21e826fe1549ed143095

PODFILE CHECKSUM: 90d5364fb6d80b7d4d98fb125af13a6b8da34c0b
PODFILE CHECKSUM: 4866dde54f21b323e83902730ef350ff4a561f44

COCOAPODS: 1.12.1
COCOAPODS: 1.15.2
Loading

0 comments on commit 74d614b

Please sign in to comment.