Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

OneSignalLiveActivities framework included for mac catalyst #1446

Merged
merged 3 commits into from
Jun 10, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions iOS_SDK/OneSignalSDK/OneSignal.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -5413,7 +5413,7 @@
PRODUCT_NAME = "$(TARGET_NAME:c99extidentifier)";
SKIP_INSTALL = YES;
SUPPORTED_PLATFORMS = "iphoneos iphonesimulator";
SUPPORTS_MACCATALYST = NO;
SUPPORTS_MACCATALYST = YES;
SWIFT_COMPILATION_MODE = wholemodule;
SWIFT_EMIT_LOC_STRINGS = YES;
SWIFT_VERSION = 5.0;
Expand Down Expand Up @@ -5486,7 +5486,7 @@
PRODUCT_NAME = "$(TARGET_NAME:c99extidentifier)";
SKIP_INSTALL = YES;
SUPPORTED_PLATFORMS = "iphoneos iphonesimulator";
SUPPORTS_MACCATALYST = NO;
SUPPORTS_MACCATALYST = YES;
SWIFT_ACTIVE_COMPILATION_CONDITIONS = "DEBUG $(inherited)";
SWIFT_EMIT_LOC_STRINGS = YES;
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
Expand Down Expand Up @@ -5554,7 +5554,7 @@
PRODUCT_NAME = "$(TARGET_NAME:c99extidentifier)";
SKIP_INSTALL = YES;
SUPPORTED_PLATFORMS = "iphoneos iphonesimulator";
SUPPORTS_MACCATALYST = NO;
SUPPORTS_MACCATALYST = YES;
SWIFT_COMPILATION_MODE = wholemodule;
SWIFT_EMIT_LOC_STRINGS = YES;
SWIFT_VERSION = 5.0;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,10 @@
THE SOFTWARE.
*/

// Effectively blanks out this file for Mac Catalyst
#if targetEnvironment(macCatalyst)
#else

/**
A default struct conforming to OneSignalLiveActivityAttributes which is registered with OneSignal as a Live Activity
through `OneSignal.LiveActivities.setupDefault`. The only action required by the customer app is
Expand Down Expand Up @@ -74,3 +78,4 @@ public struct DefaultLiveActivityAttributes: OneSignalLiveActivityAttributes {
public var data: [String: AnyCodable]
public var onesignal: OneSignalLiveActivityAttributeData
}
#endif
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,9 @@
THE SOFTWARE.
*/

// Effectively blanks out this file for Mac Catalyst
#if targetEnvironment(macCatalyst)
#else
import OneSignalOSCore
import ActivityKit

Expand Down Expand Up @@ -116,3 +119,4 @@ public class LiveActivitySetupOptions: NSObject {
self.enablePushToUpdate = enablePushToUpdate
}
}
#endif
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,9 @@
THE SOFTWARE.
*/

// Effectively blanks out this file for Mac Catalyst
#if targetEnvironment(macCatalyst)
#else
import OneSignalCore
import OneSignalOSCore
import ActivityKit
Expand Down Expand Up @@ -238,3 +241,4 @@ public class OneSignalLiveActivitiesManagerImpl: NSObject, OSLiveActivities {
}
}
}
#endif
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,9 @@
THE SOFTWARE.
*/

// Effectively blanks out this file for Mac Catalyst
#if targetEnvironment(macCatalyst)
#else
import ActivityKit

/**
Expand Down Expand Up @@ -83,3 +86,4 @@ public protocol OneSignalLiveActivityContentState: Decodable, Encodable, Hashabl
public struct OneSignalLiveActivityContentStateData: Decodable, Encodable, Hashable {
public var notificationId: String
}
#endif
34 changes: 1 addition & 33 deletions iOS_SDK/OneSignalSDK/build_all_frameworks.sh
Original file line number Diff line number Diff line change
Expand Up @@ -39,38 +39,6 @@ create_xcframework() {
rm -rf "${CATALYST_ARCHIVE_PATH}"
}

create_xcframework_no_catalyst() {
FRAMEWORK_FOLDER_NAME=$1

FRAMEWORK_NAME=$2

FRAMEWORK_PATH="${WORKING_DIR}/${FRAMEWORK_FOLDER_NAME}/${FRAMEWORK_NAME}.xcframework"

BUILD_SCHEME=$3

SIMULATOR_ARCHIVE_PATH="${WORKING_DIR}/${FRAMEWORK_FOLDER_NAME}/simulator.xcarchive"

IOS_DEVICE_ARCHIVE_PATH="${WORKING_DIR}/${FRAMEWORK_FOLDER_NAME}/iOS.xcarchive"

rm -rf "${WORKING_DIR}/${FRAMEWORK_FOLDER_NAME}"
echo "Deleted ${FRAMEWORK_FOLDER_NAME}"
mkdir "${FRAMEWORK_FOLDER_NAME}"
echo "Created ${FRAMEWORK_FOLDER_NAME}"
echo "Archiving ${FRAMEWORK_NAME}"

xcodebuild -list

xcodebuild archive ONLY_ACTIVE_ARCH=NO -scheme ${BUILD_SCHEME} -destination="generic/platform=iOS Simulator" -archivePath "${SIMULATOR_ARCHIVE_PATH}" -sdk iphonesimulator SKIP_INSTALL=NO BUILD_LIBRARIES_FOR_DISTRIBUTION=YES

xcodebuild archive -scheme ${BUILD_SCHEME} -destination="generic/platform=iOS" -archivePath "${IOS_DEVICE_ARCHIVE_PATH}" -sdk iphoneos SKIP_INSTALL=NO BUILD_LIBRARIES_FOR_DISTRIBUTION=YES

xcodebuild -create-xcframework -framework ${SIMULATOR_ARCHIVE_PATH}/Products/Library/Frameworks/${FRAMEWORK_NAME}.framework -framework ${IOS_DEVICE_ARCHIVE_PATH}/Products/Library/Frameworks/${FRAMEWORK_NAME}.framework -output "${FRAMEWORK_PATH}"

rm -rf "${SIMULATOR_ARCHIVE_PATH}"
rm -rf "${IOS_DEVICE_ARCHIVE_PATH}"
rm -rf "${CATALYST_ARCHIVE_PATH}"
}

# BUILD ONESIGNAL CORE ##
create_xcframework "OneSignal_Core" "OneSignalCore" "OneSignalCore"

Expand All @@ -90,7 +58,7 @@ create_xcframework "OneSignal_Notifications" "OneSignalNotifications" "OneSignal
create_xcframework "OneSignal_User" "OneSignalUser" "OneSignalUser"

## BUILD ONESIGNAL LIVE ACTIVITIES ##
create_xcframework_no_catalyst "OneSignal_LiveActivities" "OneSignalLiveActivities" "OneSignalLiveActivities"
create_xcframework "OneSignal_LiveActivities" "OneSignalLiveActivities" "OneSignalLiveActivities"

## BUILD ONESIGNAL USER ##
create_xcframework "OneSignal_Location" "OneSignalLocation" "OneSignalLocation"
Expand Down
Loading