Skip to content

Commit c01f1f7

Browse files
authored
SDK 20 update (#109)
* Update iOS to SDK 20 * WIP * Android * More updates for iOS * Updates * Fix * Fix * Update Xcode version * Fix toast
1 parent 6ca97cf commit c01f1f7

55 files changed

Lines changed: 297 additions & 452 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.github/workflows/ci.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ on: [pull_request]
44

55
env:
66
BUNDLE_PATH: vendor/bundle
7-
DEVELOPER_DIR: /Applications/Xcode_16.4.app/Contents/Developer
7+
DEVELOPER_DIR: /Applications/Xcode_26.1.app/Contents/Developer
88

99
concurrency:
1010
group: ${{ github.ref }}
@@ -56,7 +56,7 @@ jobs:
5656
xcodebuild \
5757
-project AirshipFrameworkProxy.xcodeproj \
5858
-scheme AirshipFrameworkProxy \
59-
-destination 'platform=iOS Simulator,OS=18.4,name=iPhone 16 Pro Max' \
59+
-destination 'platform=iOS Simulator,OS=26.1,name=iPhone 17 Pro Max' \
6060
clean test | xcbeautify --renderer github-actions
6161
6262
- name: Pod lint

.github/workflows/release.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ on:
77

88
env:
99
BUNDLE_PATH: vendor/bundle
10-
DEVELOPER_DIR: /Applications/Xcode_16.4.app/Contents/Developer
10+
DEVELOPER_DIR: /Applications/Xcode_26.1.app/Contents/Developer
1111

1212
jobs:
1313
android:

AirshipFrameworkProxy.podspec

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11

22
Pod::Spec.new do |s|
3-
s.version = "14.10.1"
3+
s.version = "15.0.0"
44
s.name = "AirshipFrameworkProxy"
55
s.summary = "Airship iOS mobile framework proxy"
66
s.documentation_url = "https://docs.airship.com/platform/mobile"
@@ -11,11 +11,11 @@ Pod::Spec.new do |s|
1111
s.source = { :git => "https://github.com/urbanairship/airship-mobile-framework-proxy.git", :tag => s.version.to_s }
1212

1313
s.module_name = "AirshipFrameworkProxy"
14-
s.ios.deployment_target = "15.0"
14+
s.ios.deployment_target = "16.0"
1515
s.requires_arc = true
1616
s.swift_version = "6.0"
1717
s.source_files = "ios/AirshipFrameworkProxy/**/*.{h,m,swift}"
18-
s.dependency 'Airship', "19.11.2"
18+
s.dependency 'Airship', "20.0.2"
1919
s.source_files = 'ios/AirshipFrameworkProxyLoader/**/*.{swift,h,m,c,cc,mm,cpp}', 'ios/AirshipFrameworkProxy/**/*.{swift,h,m,c,cc,mm,cpp}'
2020
end
2121

Package.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,15 +7,15 @@ import PackageDescription
77
let package = Package(
88
name: "AirshipFrameworkProxy",
99
defaultLocalization: "en",
10-
platforms: [.macOS(.v10_15), .iOS(.v15), .tvOS(.v18), .visionOS(.v1)],
10+
platforms: [.iOS(.v16), .tvOS(.v18), .visionOS(.v1)],
1111
products: [
1212
.library(
1313
name: "AirshipFrameworkProxy",
1414
targets: ["AirshipFrameworkProxy", "AirshipFrameworkProxyLoader"]
1515
)
1616
],
1717
dependencies: [
18-
.package(url: "https://github.com/urbanairship/ios-library.git", from: "19.11.2")
18+
.package(url: "https://github.com/urbanairship/ios-library.git", from: "20.0.2")
1919
],
2020
targets: [
2121
.target(

android/airship-framework-proxy/src/main/java/com/urbanairship/android/framework/proxy/AirshipListener.kt

Lines changed: 9 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
package com.urbanairship.android.framework.proxy
22

3-
import com.urbanairship.UAirship
3+
import com.urbanairship.Airship
44
import com.urbanairship.actions.DeepLinkListener
55
import com.urbanairship.android.framework.proxy.events.ChannelCreatedEvent
66
import com.urbanairship.android.framework.proxy.events.DeepLinkEvent
@@ -43,13 +43,12 @@ internal class AirshipListener(
4343
private val scope = CoroutineScope(Dispatchers.Main + SupervisorJob())
4444
private val isAppForegrounded: Boolean
4545
get() {
46-
return GlobalActivityMonitor.shared(UAirship.getApplicationContext()).isAppForegrounded
46+
return GlobalActivityMonitor.shared(Airship.application).isAppForegrounded
4747
}
4848

49-
@Suppress("deprecation")
5049
private val forwardNotificationListener: NotificationListener?
5150
get() {
52-
return AirshipPluginExtensions.forwardNotificationListener ?: AirshipPluginForwardListeners.notificationListener
51+
return AirshipPluginExtensions.forwardNotificationListener
5352
}
5453

5554
override fun onShowMessageCenter(messageId: String?): Boolean {
@@ -95,38 +94,30 @@ internal class AirshipListener(
9594

9695
override fun onNotificationForegroundAction(
9796
notificationInfo: NotificationInfo,
98-
notificationActionButtonInfo: NotificationActionButtonInfo
97+
actionButtonInfo: NotificationActionButtonInfo
9998
): Boolean {
10099
eventEmitter.addEvent(
101-
NotificationResponseEvent(notificationInfo, notificationActionButtonInfo)
100+
NotificationResponseEvent(notificationInfo, actionButtonInfo)
102101
)
103-
return forwardNotificationListener?.onNotificationForegroundAction(notificationInfo, notificationActionButtonInfo) ?: false
102+
return forwardNotificationListener?.onNotificationForegroundAction(notificationInfo, actionButtonInfo) ?: false
104103
}
105104

106105
override fun onNotificationBackgroundAction(
107106
notificationInfo: NotificationInfo,
108-
notificationActionButtonInfo: NotificationActionButtonInfo
107+
actionButtonInfo: NotificationActionButtonInfo
109108
) {
110109
eventEmitter.addEvent(
111-
NotificationResponseEvent(notificationInfo, notificationActionButtonInfo)
110+
NotificationResponseEvent(notificationInfo, actionButtonInfo)
112111
)
113-
forwardNotificationListener?.onNotificationBackgroundAction(notificationInfo, notificationActionButtonInfo)
112+
forwardNotificationListener?.onNotificationBackgroundAction(notificationInfo, actionButtonInfo)
114113
}
115114

116115
override fun onNotificationDismissed(notificationInfo: NotificationInfo) {
117116
forwardNotificationListener?.onNotificationDismissed(notificationInfo)
118117
}
119118

120-
@Suppress("deprecation")
121119
override fun onDeepLink(deepLink: String): Boolean {
122120
val override = AirshipPluginExtensions.onDeepLink?.invoke(deepLink)
123-
if (override == null) {
124-
if (AirshipPluginForwardListeners.deepLinkListener?.onDeepLink(deepLink) == true) {
125-
ProxyLogger.debug("Deeplink handling for $deepLink overridden by deprecated forward delegate")
126-
return true
127-
}
128-
}
129-
130121
when(override) {
131122
is AirshipPluginOverride.Override -> {
132123
ProxyLogger.debug("Deeplink handling for $deepLink overridden by plugin extension")

android/airship-framework-proxy/src/main/java/com/urbanairship/android/framework/proxy/AirshipPluginForwardListeners.kt

Lines changed: 0 additions & 22 deletions
This file was deleted.

android/airship-framework-proxy/src/main/java/com/urbanairship/android/framework/proxy/AirshpPluginExtender.kt

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ package com.urbanairship.android.framework.proxy
44

55
import android.content.Context
66
import com.urbanairship.AirshipConfigOptions
7-
import com.urbanairship.UAirship
87

98
/**
109
* Extender that will be called during `takeOff` to customize the Airship instance.
@@ -43,9 +42,8 @@ public interface AirshipPluginExtender {
4342
* to process notifications.
4443
*
4544
* @param context The application context.
46-
* @param airship The airship instance.
4745
*/
48-
public fun onAirshipReady(context: Context, airship: UAirship)
46+
public fun onAirshipReady(context: Context)
4947

5048
/**
5149
* Used to extend the AirshipConfig. The configBuilder will have the default config applied from the properties file if available,

android/airship-framework-proxy/src/main/java/com/urbanairship/android/framework/proxy/BaseAutopilot.kt

Lines changed: 36 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -2,17 +2,15 @@
22

33
package com.urbanairship.android.framework.proxy
44

5+
import android.annotation.SuppressLint
56
import android.content.Context
67
import android.content.pm.ApplicationInfo
78
import android.content.pm.PackageManager
8-
import android.net.Uri
9-
import android.util.Log
109
import androidx.annotation.XmlRes
10+
import com.urbanairship.Airship
1111
import com.urbanairship.AirshipConfigOptions
1212
import com.urbanairship.Autopilot
1313
import com.urbanairship.Predicate
14-
import com.urbanairship.UAirship
15-
import com.urbanairship.android.framework.proxy.Utils.getHexColor
1614
import com.urbanairship.android.framework.proxy.Utils.getNamedResource
1715
import com.urbanairship.android.framework.proxy.events.EventEmitter
1816
import com.urbanairship.android.framework.proxy.events.NotificationStatusEvent
@@ -29,6 +27,7 @@ import kotlinx.coroutines.flow.combine
2927
import kotlinx.coroutines.flow.filter
3028
import kotlinx.coroutines.launch
3129
import kotlinx.coroutines.runBlocking
30+
import androidx.core.net.toUri
3231

3332
/**
3433
* Module's autopilot to customize Urban Airship.
@@ -41,11 +40,9 @@ public abstract class BaseAutopilot : Autopilot() {
4140

4241
private val dispatcher = CoroutineScope(Dispatchers.Main + SupervisorJob())
4342

44-
final override fun onAirshipReady(airship: UAirship) {
45-
super.onAirshipReady(airship)
43+
final override fun onAirshipReady(context: Context) {
4644

47-
ProxyLogger.setLogLevel(airship.airshipConfigOptions.logLevel)
48-
val context = UAirship.getApplicationContext()
45+
ProxyLogger.setLogLevel(Airship.airshipConfigOptions.logLevel.level)
4946

5047
val proxyStore = AirshipProxy.shared(context).proxyStore
5148
val airshipListener = AirshipListener(
@@ -57,11 +54,11 @@ public abstract class BaseAutopilot : Autopilot() {
5754
MessageCenter.shared().setOnShowMessageCenterListener(airshipListener)
5855
MessageCenter.shared().inbox.addListener(airshipListener)
5956

60-
airship.channel.addChannelListener(airshipListener)
61-
airship.pushManager.addPushListener(airshipListener)
62-
airship.pushManager.addPushTokenListener(airshipListener)
63-
airship.pushManager.notificationListener = airshipListener
64-
airship.deepLinkListener = airshipListener
57+
Airship.channel.addChannelListener(airshipListener)
58+
Airship.push.addPushListener(airshipListener)
59+
Airship.push.addPushTokenListener(airshipListener)
60+
Airship.push.notificationListener = airshipListener
61+
Airship.deepLinkListener = airshipListener
6562

6663
dispatcher.launch {
6764
PendingEmbedded.pending.collect {
@@ -74,8 +71,8 @@ public abstract class BaseAutopilot : Autopilot() {
7471

7572
dispatcher.launch {
7673
combine(
77-
airship.pushManager.pushNotificationStatusFlow,
78-
airship.permissionsManager.permissionsUpdate(Permission.DISPLAY_NOTIFICATIONS)
74+
Airship.push.pushNotificationStatusFlow,
75+
Airship.permissionsManager.permissionsUpdate(Permission.DISPLAY_NOTIFICATIONS)
7976
) { status, permissionStatus ->
8077
NotificationStatus(status, permissionStatus.value)
8178
}.filter {
@@ -90,9 +87,10 @@ public abstract class BaseAutopilot : Autopilot() {
9087
}
9188

9289
// Set our custom notification provider
93-
val notificationProvider = BaseNotificationProvider(context, airship.airshipConfigOptions)
94-
airship.pushManager.notificationProvider = notificationProvider
95-
airship.pushManager.foregroundNotificationDisplayPredicate = Predicate { message ->
90+
val notificationProvider = BaseNotificationProvider(context, Airship.airshipConfigOptions)
91+
notificationProvider.applyNotificationConfig(proxyStore.notificationConfig)
92+
Airship.push.notificationProvider = notificationProvider
93+
Airship.push.foregroundNotificationDisplayPredicate = Predicate { message ->
9694
return@Predicate runBlocking {
9795
val override = AirshipPluginExtensions.onShouldDisplayForegroundNotification?.invoke(message) ?: AirshipPluginOverride.UseDefault
9896
return@runBlocking when(override) {
@@ -110,34 +108,36 @@ public abstract class BaseAutopilot : Autopilot() {
110108
}
111109
}
112110

113-
loadCustomNotificationChannels(context, airship)
114-
loadCustomNotificationButtonGroups(context, airship)
111+
loadCustomNotificationChannels(context)
112+
loadCustomNotificationButtonGroups(context)
115113

116-
onReady(context, airship)
114+
onReady(context)
117115

118-
extenderProvider.get(context)?.onAirshipReady(context, airship)
116+
extenderProvider.get(context)?.onAirshipReady(context)
119117
extenderProvider.reset()
120118
}
121119

122-
protected abstract fun onReady(context: Context, airship: UAirship)
120+
protected abstract fun onReady(context: Context)
123121

124-
private fun loadCustomNotificationChannels(context: Context, airship: UAirship) {
125-
val packageName = UAirship.getPackageName()
122+
@SuppressLint("DiscouragedApi")
123+
private fun loadCustomNotificationChannels(context: Context) {
124+
val packageName = context.packageName
126125
@XmlRes val resId = context.resources.getIdentifier("ua_custom_notification_channels", "xml", packageName)
127126

128127
if (resId != 0) {
129128
ProxyLogger.debug("Loading custom notification channels")
130-
airship.pushManager.notificationChannelRegistry.createNotificationChannels(resId)
129+
Airship.push.notificationChannelRegistry.createNotificationChannels(resId)
131130
}
132131
}
133132

134-
private fun loadCustomNotificationButtonGroups(context: Context, airship: UAirship) {
135-
val packageName = UAirship.getPackageName()
133+
@SuppressLint("DiscouragedApi")
134+
private fun loadCustomNotificationButtonGroups(context: Context) {
135+
val packageName = context.packageName
136136
@XmlRes val resId = context.resources.getIdentifier("ua_custom_notification_buttons", "xml", packageName)
137137

138138
if (resId != 0) {
139139
ProxyLogger.debug("Loading custom notification button groups")
140-
airship.pushManager.addNotificationActionButtonGroups(context, resId)
140+
Airship.push.addNotificationActionButtonGroups(context, resId)
141141
}
142142
}
143143

@@ -160,7 +160,7 @@ public abstract class BaseAutopilot : Autopilot() {
160160
configOptions.validate()
161161
this.configOptions = configOptions
162162
true
163-
} catch (e: Exception) {
163+
} catch (_: Exception) {
164164
false
165165
}
166166
}
@@ -189,7 +189,7 @@ public fun AirshipConfigOptions.Builder.applyProxyConfig(context: Context, proxy
189189
proxyConfig.developmentEnvironment?.let {
190190
this.setDevelopmentAppKey(it.appKey)
191191
.setDevelopmentAppSecret(it.appSecret)
192-
.setDevelopmentLogLevel(it.logLevel ?: Log.DEBUG)
192+
.setDevelopmentLogLevel(it.logLevel ?: AirshipConfigOptions.LogLevel.DEBUG)
193193

194194
proxyConfig.androidConfig?.logPrivacyLevel?.let { privacyLevel ->
195195
this.setDevelopmentLogPrivacyLevel(privacyLevel)
@@ -199,7 +199,7 @@ public fun AirshipConfigOptions.Builder.applyProxyConfig(context: Context, proxy
199199
proxyConfig.productionEnvironment?.let {
200200
this.setProductionAppKey(it.appKey)
201201
.setProductionAppSecret(it.appSecret)
202-
.setProductionLogLevel(it.logLevel ?: Log.DEBUG)
202+
.setProductionLogLevel(it.logLevel ?: AirshipConfigOptions.LogLevel.ERROR)
203203

204204
proxyConfig.androidConfig?.logPrivacyLevel?.let { privacyLevel ->
205205
this.setProductionLogPrivacyLevel(privacyLevel)
@@ -209,7 +209,7 @@ public fun AirshipConfigOptions.Builder.applyProxyConfig(context: Context, proxy
209209
proxyConfig.defaultEnvironment?.let {
210210
this.setAppKey(it.appKey)
211211
.setAppSecret(it.appSecret)
212-
.setLogLevel(it.logLevel ?: Log.ERROR)
212+
.setLogLevel(it.logLevel ?: AirshipConfigOptions.LogLevel.ERROR)
213213
}
214214

215215
proxyConfig.site?.let { this.setSite(it) }
@@ -220,7 +220,7 @@ public fun AirshipConfigOptions.Builder.applyProxyConfig(context: Context, proxy
220220
proxyConfig.urlAllowList?.let { this.setUrlAllowList(it.toTypedArray()) }
221221
proxyConfig.urlAllowListScopeJavaScriptInterface?.let { this.setUrlAllowListScopeJavaScriptInterface(it.toTypedArray()) }
222222
proxyConfig.urlAllowListScopeOpenUrl?.let { this.setUrlAllowListScopeOpenUrl(it.toTypedArray()) }
223-
proxyConfig.androidConfig?.appStoreUri?.let { this.setAppStoreUri(Uri.parse(it)) }
223+
proxyConfig.androidConfig?.appStoreUri?.let { this.setAppStoreUri(it.toUri()) }
224224
proxyConfig.androidConfig?.fcmFirebaseAppName?.let { this.setFcmFirebaseAppName(it) }
225225
proxyConfig.enabledFeatures?.let { this.setEnabledFeatures(it) }
226226
proxyConfig.autoPauseInAppAutomationOnLaunch?.let { this.setAutoPauseInAppAutomationOnLaunch(it) }
@@ -237,7 +237,7 @@ public fun AirshipConfigOptions.Builder.applyProxyConfig(context: Context, proxy
237237
}
238238

239239
notificationConfig.defaultChannelId?.let { this.setNotificationChannel(it) }
240-
notificationConfig.accentColor?.let { this.setNotificationAccentColor(getHexColor(it, 0)) }
240+
notificationConfig.accentColor?.let { this.setNotificationAccentColor(Utils.getHexColor(it, 0)) }
241241
}
242242
}
243243

@@ -265,7 +265,7 @@ private class ExtenderProvider {
265265
if (ai.metaData == null) {
266266
return null
267267
}
268-
} catch (e: PackageManager.NameNotFoundException) {
268+
} catch (_: PackageManager.NameNotFoundException) {
269269
return null
270270
}
271271

0 commit comments

Comments
 (0)