Skip to content
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
3 changes: 2 additions & 1 deletion .github/scripts/update_native_sdks.sh
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ echo "Android SDK last version is $androidVersion"

sed -i~ -e "s|io.didomi.sdk:android:[0-9]\{1,2\}.[0-9]\{1,2\}.[0-9]\{1,2\}|io.didomi.sdk:android:$androidVersion|g" android/build.gradle || exit 1

# Update ios SDK Version
# Update ios SDK Version for both CocoaPods and SPM builds
iOSVersion=$(pod_last_version)
if [[ ! $iOSVersion =~ ^[0-9]+.[0-9]+.[0-9]+$ ]]; then
echo "Error while getting ios SDK version ($iOSVersion)"
Expand All @@ -44,6 +44,7 @@ fi
echo "iOS SDK last version is $iOSVersion"

sed -i~ -e "s|s.dependency 'Didomi-XCFramework', '[0-9]\{1,2\}.[0-9]\{1,2\}.[0-9]\{1,2\}'|s.dependency 'Didomi-XCFramework', '$iOSVersion'|g" ios/didomi_sdk.podspec || exit 1
sed -i~ -e "s|from: \"[0-9]\{1,2\}.[0-9]\{1,2\}.[0-9]\{1,2\}\"|from: \"$iOSVersion\"|g" ios/didomi_sdk/Package.swift || exit 1

# Cleanup backup files
find . -type f -name '*~' -delete
Expand Down
18 changes: 16 additions & 2 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -95,10 +95,24 @@ jobs:
working-directory: ./example/ios
run: pod update

# iOS IPA
- name: Build iOS Sample
# iOS IPA with SPM
- name: Build iOS Sample (SPM)
working-directory: ./example
run: |
flutter config --enable-swift-package-manager
flutter build ios --no-codesign
cd build/ios/iphoneos
mkdir Payload-spm
cd Payload-spm
ln -s ../Runner.app
cd ..
zip -r app-spm.ipa Payload-spm

# iOS IPA with CocoaPods
- name: Build iOS Sample (CocoaPods)
working-directory: ./example
run: |
flutter config --no-enable-swift-package-manager
flutter build ios --no-codesign
cd build/ios/iphoneos
mkdir Payload
Expand Down
4 changes: 2 additions & 2 deletions example/ios/Podfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,9 @@ EXTERNAL SOURCES:

SPEC CHECKSUMS:
Didomi-XCFramework: 671c92122f40c407fc0d24f101c27c898ac83a61
didomi_sdk: 0b8b5935f1b53169cfa87d9401a1d3ed8c455b85
didomi_sdk: cd6fc1713dec59d1ac293f5b6fe7d6bae17a28fa
Flutter: cabc95a1d2626b1b06e7179b784ebcf0c0cde467
integration_test: 252f60fa39af5e17c3aa9899d35d908a0721b573
integration_test: 4a889634ef21a45d28d50d622cf412dc6d9f586e

PODFILE CHECKSUM: e2772aabdb96c4d254f2b01df983810e9a468979

Expand Down
4 changes: 2 additions & 2 deletions example/ios/Runner.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -191,7 +191,7 @@
97C146EC1CF9000F007C117D /* Resources */,
9705A1C41CF9048500538489 /* Embed Frameworks */,
3B06AD1E1E4923F5004D2608 /* Thin Binary */,
4C11C7A522D5C5BDF99CED1E /* [CP] Embed Pods Frameworks */,
50A0FB47D488346EABFE2884 /* [CP] Embed Pods Frameworks */,
);
buildRules = (
);
Expand Down Expand Up @@ -320,7 +320,7 @@
shellPath = /bin/sh;
shellScript = "/bin/sh \"$FLUTTER_ROOT/packages/flutter_tools/bin/xcode_backend.sh\" embed_and_thin";
};
4C11C7A522D5C5BDF99CED1E /* [CP] Embed Pods Frameworks */ = {
50A0FB47D488346EABFE2884 /* [CP] Embed Pods Frameworks */ = {
isa = PBXShellScriptBuildPhase;
buildActionMask = 2147483647;
files = (
Expand Down
Empty file removed ios/Assets/.gitkeep
Empty file.
3 changes: 2 additions & 1 deletion ios/didomi_sdk.podspec
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@ Pod::Spec.new do |s|
s.license = { :type => 'BSD', :file => '../LICENSE' }
s.author = { 'Didomi ' => 'tech@didomi.io' }
s.source = { :path => 'git@github.com:didomi/flutter.git', :tag => '2.18.0' }
s.source_files = 'Classes/**/*'
s.source_files = 'didomi_sdk/Sources/**/*.{swift,h,m}'
s.public_header_files = 'didomi_sdk/Sources/DidomiObjC/include/**/*.h'
s.dependency 'Flutter'
s.dependency 'Didomi-XCFramework', '2.34.0'
s.platform = :ios, '13.0'
Expand Down
40 changes: 40 additions & 0 deletions ios/didomi_sdk/Package.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
// swift-tools-version: 5.9
// The swift-tools-version declares the minimum version of Swift required to build this package.

import PackageDescription

let package = Package(
name: "didomi_sdk",
platforms: [
.iOS("10.0")
],
products: [
.library(name: "didomi-sdk", targets: ["didomi_sdk"])
],
dependencies: [
.package(url: "https://github.com/didomi/didomi-ios-sdk-spm", from: "2.34.0")
],
targets: [
.target(
name: "DidomiSwift",
dependencies: [
.product(name: "Didomi", package: "didomi-ios-sdk-spm")
],
path: "Sources/DidomiSwift",
resources: [],
linkerSettings: [
.linkedFramework("Flutter", .when(platforms: [.iOS]))
]
),
.target(
name: "didomi_sdk",
dependencies: ["DidomiSwift"],
path: "Sources/DidomiObjC",
resources: [],
publicHeadersPath: "include",
linkerSettings: [
.linkedFramework("Flutter", .when(platforms: [.iOS]))
]
)
]
)
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
#import "DidomiSdkPlugin.h"
#import <Flutter/Flutter.h>

// For CocoaPods/traditional builds
#if __has_include(<didomi_sdk/didomi_sdk-Swift.h>)
#import <didomi_sdk/didomi_sdk-Swift.h>
#else
// Support project import fallback if the generated compatibility header
// is not copied when this plugin is created as a library.
// https://forums.swift.org/t/swift-static-libraries-dont-copy-generated-objective-c-header/19816
#import "didomi_sdk-Swift.h"
// For SPM builds, import the Swift module directly
@import DidomiSwift;
#endif

@implementation DidomiSdkPlugin
Expand Down
8 changes: 8 additions & 0 deletions ios/didomi_sdk/Sources/DidomiObjC/include/didomi_sdk.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
//
// didomi_sdk.h
// didomi_sdk
//
// Umbrella header for didomi_sdk module
//

#import "DidomiSdkPlugin.h"
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@
// Created by Philémon Merlet on 10/05/2021.
//

import Foundation

struct Constants {
// Channels names
static let methodsChannelName = "didomi_sdk"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import Flutter
import UIKit
import Didomi

public class SwiftDidomiSdkPlugin: NSObject, FlutterPlugin {
@objc public class SwiftDidomiSdkPlugin: NSObject, FlutterPlugin {

/// Default message if SDK is not ready
private static let didomiNotReadyException: String = "Didomi SDK is not ready. Use the onReady callback to access this method."
Expand All @@ -12,13 +12,13 @@ public class SwiftDidomiSdkPlugin: NSObject, FlutterPlugin {

override init() {
super.init()

if let userAgentVersion = Constants.userAgentVersion {
Didomi.shared.setUserAgent(name: Constants.userAgentName, version: userAgentVersion)
}
}
public static func register(with registrar: FlutterPluginRegistrar) {

@objc public static func register(with registrar: FlutterPluginRegistrar) {
let channel = FlutterMethodChannel(name: Constants.methodsChannelName, binaryMessenger: registrar.messenger())
let instance = SwiftDidomiSdkPlugin()
registrar.addMethodCallDelegate(instance, channel: channel)
Expand Down