Skip to content

Ios-new-arch-only #682

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

Draft
wants to merge 66 commits into
base: MOB-11760-upgrade-rn-to-0-80-1
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
66 commits
Select commit Hold shift + click to select a range
9ae1d5b
feat: implement new API structure with NativeRNIterableAPI and OldApi…
lposen Jul 22, 2025
4c6c0d7
chore: comment out pre-commit and commit-msg configurations in leftho…
lposen Jul 22, 2025
76e8fa1
refactor: comment out unused methods in NativeRNIterableAPI interface…
lposen Jul 22, 2025
c6862f5
chore: update RNIterableSpec to RNIterableAPISpec and add iOS module …
lposen Jul 22, 2025
32654b7
chore: update Podfile to set dynamic linkage to build swift header fo…
lposen Jul 22, 2025
f68e771
Merge branch 'MOB-11760-upgrade-rn-to-0-80-1' into ios-new-arch-only
lposen Jul 22, 2025
c205bd4
refactor: replace Iterable-React-Native-SDK podspec with RNIterableAP…
lposen Jul 22, 2025
ac7ccf4
fix: update jsSrcsDir path in package.json to point to src/api/ for b…
lposen Jul 22, 2025
4723230
feat: add hello method to ReactIterableAPI and integrate with Objecti…
lposen Jul 22, 2025
cd350d4
fix: uncomment and properly import IterableSDK header and related Swi…
lposen Jul 22, 2025
658f44f
refactor: update initialize method in ReactIterableAPI to simplify AP…
lposen Jul 22, 2025
eae48f7
refactor: enhance ReactIterableAPI by implementing URL, custom action…
lposen Jul 22, 2025
aa2e688
refactor: integrated initializeWithApiKey into swift
lposen Jul 22, 2025
0aafd2a
refactor: implement initialize2WithApiKey method in ReactIterableAPI …
lposen Jul 22, 2025
41f51fe
refactor: update setEmail methods in ReactIterableAPI to public and e…
lposen Jul 22, 2025
c0b41de
feat: add Utility component and integrate into Main screen; update na…
lposen Jul 22, 2025
439025e
refactor: update setUserId methods in ReactIterableAPI to public and …
lposen Jul 22, 2025
79a0afa
feat: enhance Utility component with getUserId functionality and upda…
lposen Jul 22, 2025
04e68d9
refactor: update setInAppShowResponse method in ReactIterableAPI to p…
lposen Jul 22, 2025
8889f5f
refactor: update getInAppMessages method to public in ReactIterableAP…
lposen Jul 22, 2025
c813843
refactor: update getInboxMessages method to public in ReactIterableAP…
lposen Jul 22, 2025
81ed64f
refactor: update getUnreadInboxMessagesCount method to public in Reac…
lposen Jul 22, 2025
6d91ad3
refactor: update showMessage method in ReactIterableAPI to public and…
lposen Jul 22, 2025
e33ebf9
refactor: update removeMessage method in ReactIterableAPI to public a…
lposen Jul 22, 2025
a676b01
refactor: update setReadForMessage method in ReactIterableAPI to publ…
lposen Jul 22, 2025
41aa4c2
refactor: update setAutoDisplayPaused method in ReactIterableAPI to p…
lposen Jul 22, 2025
c2a3f43
refactor: update trackEvent method in ReactIterableAPI to public and …
lposen Jul 22, 2025
a97ae2e
refactor: update trackPushOpenWithCampaignId method in ReactIterableA…
lposen Jul 22, 2025
6f44dd3
refactor: remove commented-out code and update dataFields handling in…
lposen Jul 22, 2025
747e4b9
refactor: add trackInAppOpen method to ReactIterableAPI and enhance O…
lposen Jul 22, 2025
4c5faf6
refactor: implement trackInAppClick method in ReactIterableAPI and en…
lposen Jul 22, 2025
5ec2b31
refactor: implement trackInAppClose method in ReactIterableAPI and en…
lposen Jul 22, 2025
f8ce6b6
refactor: add inAppConsume method to ReactIterableAPI and enhance Obj…
lposen Jul 22, 2025
a41410c
refactor: update updateCart method to public in ReactIterableAPI and …
lposen Jul 22, 2025
47860e2
refactor: update trackPurchase method to public in ReactIterableAPI a…
lposen Jul 23, 2025
1c542fc
refactor: update updateUser method in ReactIterableAPI to use NSDicti…
lposen Jul 23, 2025
f96a5c9
refactor: update updateEmail method to public in ReactIterableAPI and…
lposen Jul 23, 2025
3583558
refactor: add getAttributionInfo method to ReactIterableAPI and enhan…
lposen Jul 23, 2025
e5774bc
refactor: add setAttributionInfo method to ReactIterableAPI and enhan…
lposen Jul 23, 2025
539f4b2
refactor: update disableDeviceForCurrentUser method to public in Reac…
lposen Jul 23, 2025
a9cc366
refactor: add getLastPushPayload method to ReactIterableAPI and enhan…
lposen Jul 23, 2025
98149d9
refactor: update getHtmlInAppContent method to public in ReactIterabl…
lposen Jul 23, 2025
d360fda
refactor: update handleAppLink method to public in ReactIterableAPI a…
lposen Jul 23, 2025
d6a6573
refactor: update updateSubscriptions method to public in ReactIterabl…
lposen Jul 23, 2025
cb79cb4
refactor: update startSession and endSession methods to public in Rea…
lposen Jul 23, 2025
e2c977f
refactor: update updateVisibleRows method to public in ReactIterableA…
lposen Jul 23, 2025
4e96920
refactor: update passAlongAuthToken method to public in ReactIterable…
lposen Jul 23, 2025
809f952
refactor: enhance ReactIterableAPI by adding required listener stubs …
lposen Jul 23, 2025
1428547
feat: integrate Iterable SDK and enhance AppDelegate for user notific…
lposen Jul 23, 2025
94b661e
feat: add ReactNativeSdkExampleNotificationService with Iterable inte…
lposen Jul 23, 2025
6babee9
feat: enhance AppDelegate with push notification permissions, deep li…
lposen Jul 23, 2025
6ecec26
fix: update AppDelegate to correctly integrate Iterable SDK for push …
lposen Jul 23, 2025
b7f00bd
chore: update package namespace to use 'com.iterable.reactnativesdk.e…
lposen Jul 23, 2025
f558983
fix: fixed event emitter
lposen Jul 23, 2025
0067c4c
refactor: cleanup
lposen Jul 23, 2025
bd4e74d
refactor: cleanup
lposen Jul 23, 2025
70fbd45
refactor: remove OldApiMock and update API exports
lposen Jul 23, 2025
9ba3e98
refactor: remove unused API methods and clean up imports in useIterab…
lposen Jul 23, 2025
f2d1a8f
refactor: remove debug logging statements and clean up unused methods…
lposen Jul 23, 2025
27046ad
feat: add podspec for Iterable React Native SDK and update import in …
lposen Jul 23, 2025
b60e604
refactor: make backwards compatible
lposen Jul 24, 2025
b922e95
refactor: improve method signatures for better clarity and consistenc…
lposen Jul 24, 2025
d197dc5
chore: type fixes
lposen Jul 24, 2025
c9034a1
chore: fixed linting isssues
lposen Jul 24, 2025
e01be00
chore: enable pre-commit hooks for linting and type checking
lposen Jul 24, 2025
4252534
refactor: changed enum values to match ios sdk
lposen Jul 24, 2025
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
40 changes: 14 additions & 26 deletions Iterable-React-Native-SDK.podspec
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
require "json"

package = JSON.parse(File.read(File.join(__dir__, "package.json")))
folly_compiler_flags = '-DFOLLY_NO_CONFIG -DFOLLY_MOBILE=1 -DFOLLY_USE_LIBCPP=1 -Wno-comma -Wno-shorten-64-to-32'

Pod::Spec.new do |s|
s.name = "Iterable-React-Native-SDK"
Expand All @@ -14,31 +13,20 @@ Pod::Spec.new do |s|
s.platforms = { :ios => min_ios_version_supported }
s.source = { :git => "https://github.com/Iterable/react-native-sdk.git", :tag => "#{s.version}" }

s.source_files = "ios/**/*.{h,m,mm,swift}"

# Use install_modules_dependencies helper to install the dependencies if React Native version >=0.71.0.
# See https://github.com/facebook/react-native/blob/febf6b7f33fdb4904669f99d795eba4c0f95d7bf/scripts/cocoapods/new_architecture.rb#L79.
if respond_to?(:install_modules_dependencies, true)
install_modules_dependencies(s)
else
s.dependency "React-Core"

# Don't install the dependencies when we run `pod install` in the old architecture.
if ENV['RCT_NEW_ARCH_ENABLED'] == '1' then
s.compiler_flags = folly_compiler_flags + " -DRCT_NEW_ARCH_ENABLED=1"
s.pod_target_xcconfig = {
"HEADER_SEARCH_PATHS" => "\"$(PODS_ROOT)/boost\"",
"OTHER_CPLUSPLUSFLAGS" => "-DFOLLY_NO_CONFIG -DFOLLY_MOBILE=1 -DFOLLY_USE_LIBCPP=1",
"CLANG_CXX_LANGUAGE_STANDARD" => "c++17"
}
s.dependency "React-Codegen"
s.dependency "RCT-Folly"
s.dependency "RCTRequired"
s.dependency "RCTTypeSafety"
s.dependency "ReactCommon/turbomodule/core"
end
end
s.source_files = "ios/**/*.{h,m,mm,cpp,swift}"
s.private_header_files = "ios/**/*.h"

# Load Iterables iOS SDK as a dependency
s.dependency "Iterable-iOS-SDK", "6.5.4"


# Basic Swift support
s.pod_target_xcconfig = {
'DEFINES_MODULE' => 'YES',
'CLANG_ENABLE_MODULES' => 'YES',
'SWIFT_VERSION' => '5.0',
"CLANG_CXX_LANGUAGE_STANDARD" => rct_cxx_language_standard(),
}

install_modules_dependencies(s)

end
4 changes: 2 additions & 2 deletions example/android/app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -77,9 +77,9 @@ android {
buildToolsVersion rootProject.ext.buildToolsVersion
compileSdk rootProject.ext.compileSdkVersion

namespace "iterable.reactnativesdk.example"
namespace "com.iterable.reactnativesdk.example"
defaultConfig {
applicationId "iterable.reactnativesdk.example"
applicationId "com.iterable.reactnativesdk.example"
minSdkVersion rootProject.ext.minSdkVersion
targetSdkVersion rootProject.ext.targetSdkVersion
versionCode 1
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package iterable.reactnativesdk.example
package com.iterable.reactnativesdk.example

import android.os.Bundle

Expand Down Expand Up @@ -29,4 +29,4 @@ class MainActivity : ReactActivity() {
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(null)
}
}
}
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package iterable.reactnativesdk.example
package com.iterable.reactnativesdk.example

import android.app.Application
import com.facebook.react.PackageList
Expand Down
10 changes: 8 additions & 2 deletions example/ios/Podfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
ENV['RCT_NEW_ARCH_ENABLED'] = '1'
require_relative '../node_modules/react-native/scripts/react_native_pods'

ENV['RCT_NEW_ARCH_ENABLED'] = '0'

# Resolve react_native_pods.rb with node to allow for hoisting
require Pod::Executable.execute_command('node', ['-p',
Expand All @@ -13,7 +15,7 @@ prepare_react_native_project!
linkage = ENV['USE_FRAMEWORKS']
if linkage != nil
Pod::UI.puts "Configuring Pod with #{linkage}ally linked Frameworks".green
use_frameworks! :linkage => linkage.to_sym
use_frameworks! :linkage => :dynamic
end

target 'ReactNativeSdkExample' do
Expand All @@ -35,3 +37,7 @@ target 'ReactNativeSdkExample' do
)
end
end

target 'ReactNativeSdkExampleNotificationService' do
pod 'Iterable-iOS-AppExtensions'
end
267 changes: 243 additions & 24 deletions example/ios/ReactNativeSdkExample.xcodeproj/project.pbxproj

Large diffs are not rendered by default.

126 changes: 118 additions & 8 deletions example/ios/ReactNativeSdkExample/AppDelegate.swift
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,12 @@
// Created by Loren Posen on 6/11/25.
//

import UIKit
import IterableSDK
import React
import React_RCTAppDelegate
import ReactAppDependencyProvider
import React_RCTAppDelegate
import UIKit
import UserNotifications

@main
class AppDelegate: UIResponder, UIApplicationDelegate {
Expand All @@ -17,7 +19,7 @@ class AppDelegate: UIResponder, UIApplicationDelegate {
var reactNativeDelegate: ReactNativeDelegate?
var reactNativeFactory: RCTReactNativeFactory?

func application(
public func application(
_ application: UIApplication,
didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]? = nil
) -> Bool {
Expand All @@ -36,8 +38,96 @@ class AppDelegate: UIResponder, UIApplicationDelegate {
launchOptions: launchOptions
)

UNUserNotificationCenter.current().delegate = self

/**
* Request permissions for push notifications.
* @see Step 3.5.5 of https://support.iterable.com/hc/en-us/articles/360045714132-Installing-Iterable-s-React-Native-SDK#step-3-5-set-up-support-for-push-notifications
*/
requestPushPermissions(application)

return true
}

/**
* Add support for in-app messages
* @see Step 3.6 of https://support.iterable.com/hc/en-us/articles/360045714132-Installing-Iterable-s-React-Native-SDK#step-3-6-add-support-for-in-app-messages
*/
public func application(
_ application: UIApplication, didReceiveRemoteNotification userInfo: [AnyHashable: Any],
fetchCompletionHandler completionHandler: @escaping (UIBackgroundFetchResult) -> Void
) {
IterableAppIntegration.application(
application, didReceiveRemoteNotification: userInfo,
fetchCompletionHandler: completionHandler
)
NSLog("didReceiveRemoteNotification: \(userInfo)")
}

public func application(
_ application: UIApplication, didRegisterForRemoteNotificationsWithDeviceToken deviceToken: Data
) {
/**
* Register the device token with Iterable.
* @see Step 3.5.4 of https://support.iterable.com/hc/en-us/articles/360045714132-Installing-Iterable-s-React-Native-SDK#step-3-5-set-up-support-for-push-notifications
*/
IterableAPI.register(token: deviceToken)
NSLog("didRegisterForRemoteNotificationsWithDeviceToken: \(deviceToken)")
}

/**
* Add support for deep links
* @see Step 3.7 of https://support.iterable.com/hc/en-us/articles/360045714132-Installing-Iterable-s-React-Native-SDK#step-3-7-add-support-for-deep-links
*/
public func application(
_ application: UIApplication,
continue userActivity: NSUserActivity,
restorationHandler: @escaping ([UIUserActivityRestoring]?) -> Void
) -> Bool {
return RCTLinkingManager.application(
application,
continue: userActivity,
restorationHandler: restorationHandler
)
}

/**
* Add support for deep links
* @see Step 3.7 of https://support.iterable.com/hc/en-us/articles/360045714132-Installing-Iterable-s-React-Native-SDK#step-3-7-add-support-for-deep-links
*/
public func application(
_ app: UIApplication,
open url: URL,
options: [UIApplication.OpenURLOptionsKey: Any] = [:]
) -> Bool {
return RCTLinkingManager.application(app, open: url, options: options)
}

public func requestPushPermissions(_ application: UIApplication) {
UNUserNotificationCenter.current().requestAuthorization(options: [.alert, .badge, .sound]) {
granted, _ in
DispatchQueue.main.async {
if granted {
application.registerForRemoteNotifications()
} else {
NSLog("Push permission denied")
}
}
}
// UNUserNotificationCenter.current().getNotificationSettings { (settings) in
// if settings.authorizationStatus != .authorized {
// NSLog("Not authorized")
// // not authorized, ask for permission
// UNUserNotificationCenter.current().requestAuthorization(options: [.alert, .badge, .sound]) {
// (success, error) in
// NSLog("auth: \(success)")
// }
// } else {
// // already authorized
// NSLog("Already authorized")
// }
// }
}
}

class ReactNativeDelegate: RCTDefaultReactNativeFactoryDelegate {
Expand All @@ -46,11 +136,31 @@ class ReactNativeDelegate: RCTDefaultReactNativeFactoryDelegate {
}

override func bundleURL() -> URL? {
#if DEBUG
RCTBundleURLProvider.sharedSettings().jsBundleURL(forBundleRoot: "index")
#else
Bundle.main.url(forResource: "main", withExtension: "jsbundle")
#endif
#if DEBUG
RCTBundleURLProvider.sharedSettings().jsBundleURL(forBundleRoot: "index")
#else
Bundle.main.url(forResource: "main", withExtension: "jsbundle")
#endif
}
}

/// * Handle incoming push notifications and enable push notification tracking.
/// * @see Step 3.5.5 of https://support.iterable.com/hc/en-us/articles/360045714132-Installing-Iterable-s-React-Native-SDK#step-3-5-set-up-support-for-push-notifications
extension AppDelegate: UNUserNotificationCenterDelegate {
public func userNotificationCenter(
_: UNUserNotificationCenter, willPresent _: UNNotification,
withCompletionHandler completionHandler: @escaping (UNNotificationPresentationOptions) -> Void
) {
completionHandler([.badge, .banner, .list, .sound])
NSLog("willPresent")
}

public func userNotificationCenter(
_ center: UNUserNotificationCenter, didReceive response: UNNotificationResponse,
withCompletionHandler completionHandler: @escaping () -> Void
) {
IterableAppIntegration.userNotificationCenter(
center, didReceive: response, withCompletionHandler: completionHandler)
NSLog("didReceive")
}
}
6 changes: 5 additions & 1 deletion example/ios/ReactNativeSdkExample/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
<key>NSLocationWhenInUseUsageDescription</key>
<string></string>
<key>RCTNewArchEnabled</key>
<true/>
<false/>
<key>UIAppFonts</key>
<array>
<string>AntDesign.ttf</string>
Expand All @@ -61,6 +61,10 @@
<string>Zocial.ttf</string>
<string>Fontisto.ttf</string>
</array>
<key>UIBackgroundModes</key>
<array>
<string>remote-notification</string>
</array>
<key>UILaunchStoryboardName</key>
<string>LaunchScreen</string>
<key>UIRequiredDeviceCapabilities</key>
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
<?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>aps-environment</key>
<string>development</string>
<key>com.apple.developer.usernotifications.time-sensitive</key>
<true/>
</dict>
</plist>
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
<?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>aps-environment</key>
<string>development</string>
<key>com.apple.developer.usernotifications.time-sensitive</key>
<true/>
</dict>
</plist>
15 changes: 15 additions & 0 deletions example/ios/ReactNativeSdkExampleNotificationService/Info.plist
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
<?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.usernotifications.service</string>
<key>NSExtensionPrincipalClass</key>
<string>$(PRODUCT_MODULE_NAME).NotificationService</string>
</dict>
<key>RCTNewArchEnabled</key>
<false/>
</dict>
</plist>
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
import IterableAppExtensions
import UserNotifications

class NotificationService: ITBNotificationServiceExtension {}
1 change: 1 addition & 0 deletions example/src/components/App/App.constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,5 @@ export const routeIcon = {
[Route.Commerce]: 'cash-outline',
[Route.Inbox]: 'mail-outline',
[Route.User]: 'person-outline',
[Route.Utility]: 'build-outline',
};
8 changes: 8 additions & 0 deletions example/src/components/App/Main.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import { User } from '../User';
import { Inbox } from '../Inbox';
import { useIterableApp } from '../../hooks';
import { Commerce } from '../Commerce';
import { Utility } from '../Utility';

const Tab = createBottomTabNavigator<MainScreenParamList>();

Expand Down Expand Up @@ -58,6 +59,13 @@ export const Main = () => {
tabPress: () => setIsInboxTab(false),
})}
/>
<Tab.Screen
name={Route.Utility}
component={Utility}
listeners={() => ({
tabPress: () => setIsInboxTab(false),
})}
/>
</Tab.Navigator>
</>
);
Expand Down
17 changes: 17 additions & 0 deletions example/src/components/Utility/Utility.styles.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
import { StyleSheet, type TextStyle } from 'react-native';
import { appNameSmall, buttonBlock, buttonText, container } from '../../constants';

const text: TextStyle = {
textAlign: 'center',
marginBottom: 20,
};

const styles = StyleSheet.create({
appName: appNameSmall,
button:buttonBlock,
buttonText,
container,
text,
});

export default styles;
Loading
Loading