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

Update iOS #77

Draft
wants to merge 2 commits into
base: main
Choose a base branch
from
Draft
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 AirshipFrameworkProxy.podspec
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@

Pod::Spec.new do |s|
s.version = "11.2.2"
s.version = "12.0.0"
s.name = "AirshipFrameworkProxy"
s.summary = "Airship iOS mobile framework proxy"
s.documentation_url = "https://docs.airship.com/platform/mobile"
Expand All @@ -11,11 +11,11 @@ Pod::Spec.new do |s|
s.source = { :git => "/~https://github.com/urbanairship/airship-mobile-framework-proxy.git", :tag => s.version.to_s }

s.module_name = "AirshipFrameworkProxy"
s.ios.deployment_target = "14.0"
s.ios.deployment_target = "15.0"
s.requires_arc = true
s.swift_version = "5.0"
s.source_files = "ios/AirshipFrameworkProxy/**/*.{h,m,swift}"
s.dependency 'Airship', "18.14.2"
s.dependency 'Airship', "19.0.0"
s.source_files = 'ios/AirshipFrameworkProxyLoader/**/*.{swift,h,m,c,cc,mm,cpp}', 'ios/AirshipFrameworkProxy/**/*.{swift,h,m,c,cc,mm,cpp}'
end

Expand Down
4 changes: 2 additions & 2 deletions Package.resolved
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
"kind" : "remoteSourceControl",
"location" : "/~https://github.com/urbanairship/ios-library.git",
"state" : {
"revision" : "89003c30ec77ef5d8419e6725d1c673d64429825",
"version" : "18.14.2"
"revision" : "03baf0f2e1dac61ac1fb676d9b3a6d540d2f144f",
"version" : "19.0.0"
}
}
],
Expand Down
4 changes: 2 additions & 2 deletions Package.swift
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,15 @@ import PackageDescription
let package = Package(
name: "AirshipFrameworkProxy",
defaultLocalization: "en",
platforms: [.macOS(.v10_15), .iOS(.v14), .tvOS(.v14), .visionOS(.v1)],
platforms: [.macOS(.v10_15), .iOS(.v15), .tvOS(.v18), .visionOS(.v1)],
products: [
.library(
name: "AirshipFrameworkProxy",
targets: ["AirshipFrameworkProxy", "AirshipFrameworkProxyLoader"]
)
],
dependencies: [
.package(url: "/~https://github.com/urbanairship/ios-library.git", from: "18.14.2")
.package(url: "/~https://github.com/urbanairship/ios-library.git", from: "19.0.0")
],
targets: [
.target(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,10 @@ import com.urbanairship.push.NotificationListener
import com.urbanairship.push.PushListener
import com.urbanairship.push.PushMessage
import com.urbanairship.push.PushTokenListener
import kotlinx.coroutines.CoroutineScope
import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.SupervisorJob
import kotlinx.coroutines.launch

internal class AirshipListener(
private val proxyStore: ProxyStore,
Expand All @@ -36,6 +40,7 @@ internal class AirshipListener(
AirshipChannelListener,
InboxListener
{
private val scope = CoroutineScope(Dispatchers.Main + SupervisorJob())
private val isAppForegrounded: Boolean
get() {
return GlobalActivityMonitor.shared(UAirship.getApplicationContext()).isAppForegrounded
Expand Down Expand Up @@ -119,13 +124,16 @@ internal class AirshipListener(
}

override fun onInboxUpdated() {
eventEmitter.addEvent(
MessageCenterUpdatedEvent(
MessageCenter.shared().inbox.unreadCount,
MessageCenter.shared().inbox.count
),
replacePending = true
)
scope.launch {
eventEmitter.addEvent(
MessageCenterUpdatedEvent(
MessageCenter.shared().inbox.getUnreadCount(),
MessageCenter.shared().inbox.getCount()
),
replacePending = true
)
}

}

}
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ package com.urbanairship.android.framework.proxy
import android.os.Bundle
import androidx.lifecycle.lifecycleScope
import com.urbanairship.android.framework.proxy.proxies.AirshipProxy
import com.urbanairship.messagecenter.MessageActivity
import com.urbanairship.messagecenter.ui.MessageActivity
import kotlinx.coroutines.launch

public class CustomMessageActivity : MessageActivity() {
Expand All @@ -21,4 +21,4 @@ public class CustomMessageActivity : MessageActivity() {
}
}
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -11,18 +11,18 @@ public data class MessageCenterMessage(
val sentDate: Long,
val listIconUrl: String?,
val isRead: Boolean,
val extras: Map<String, String>,
val extras: Map<String, String?>,
val expirationDate: Long?
) : JsonSerializable {

internal constructor(message: Message) : this(
title = message.title,
id = message.messageId,
sentDate = message.sentDateMS,
id = message.id,
sentDate = message.sentDate.time,
listIconUrl = message.listIconUrl,
isRead = message.isRead,
extras = message.extrasMap,
expirationDate = message.expirationDateMS
extras = message.extras ?: emptyMap<String, String?>(),
expirationDate = message.expirationDate?.time
)

override fun toJsonValue(): JsonValue = JsonMap.newBuilder()
Expand All @@ -35,4 +35,4 @@ public data class MessageCenterMessage(
.putOpt("expirationDate", expirationDate)
.build()
.toJsonValue()
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ public class MessageCenterProxy internal constructor(
messageId?.let {
intent.setData(Uri.fromParts("message", it, null as String?))
}

try {
context.startActivity(intent)
} catch(exception: Exception) {
Expand All @@ -68,24 +68,23 @@ public class MessageCenterProxy internal constructor(
}
}

public fun getMessages(): List<MessageCenterMessage> {
return messageCenterProvider().inbox.messages.map { MessageCenterMessage(it) }
public suspend fun getMessages(): List<MessageCenterMessage> {
return messageCenterProvider().inbox.getMessages().map { MessageCenterMessage(it) }
}

public fun getMessage(messageId: String): MessageCenterMessage {
public suspend fun getMessage(messageId: String): MessageCenterMessage {
return MessageCenterMessage(
requireNotNull(messageCenterProvider().inbox.getMessage(messageId))
)
}

public fun deleteMessage(messageId: String) {
requireNotNull(messageCenterProvider().inbox.getMessage(messageId))
.delete()
messageCenterProvider().inbox.deleteMessages(messageId)
}

public fun markMessageRead(messageId: String) {
requireNotNull(messageCenterProvider().inbox.getMessage(messageId))
.markRead()

public suspend fun markMessageRead(messageId: String) {
messageCenterProvider().inbox.markMessagesRead(messageId)
}

public fun refreshInbox(): PendingResult<Boolean> {
Expand All @@ -96,8 +95,8 @@ public class MessageCenterProxy internal constructor(
return pendingResult
}

public fun getUnreadMessagesCount(): Int {
return messageCenterProvider().inbox.unreadCount
public suspend fun getUnreadMessagesCount(): Int {
return messageCenterProvider().inbox.getUnreadCount()
}

public fun setAutoLaunchDefaultMessageCenter(enabled: Boolean) {
Expand Down
20 changes: 10 additions & 10 deletions android/gradle/libs.versions.toml
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
[versions]

# Airship
airshipProxy = '11.2.2'
airship = '18.6.0'
airshipProxy = '12.0.0'
airship = '19.0.0'

# Gradle plugins
androidGradlePlugin = '8.3.2'
Expand All @@ -17,22 +17,22 @@ ktlint = '0.45.2'
# Dependencies

# Kotlin
kotlin = '1.9.23'
kotlinx-coroutines = '1.7.3'
kotlin = '1.9.24'
kotlinx-coroutines = '1.8.1'

# Androidx
androidx-annotation = '1.8.0'
androidx-annotation = '1.9.1'

# Test
google-truth = '1.1.3'
junit = '4.13.2'
mockk = '1.12.5'
robolectric = '4.11.1'
androidx-test-core = '1.6.0'
androidx-test-espresso = '3.6.0'
androidx-test-junit = '1.2.0'
androidx-test-rules = '1.6.0'
androidx-test-runner = '1.6.0'
androidx-test-core = '1.6.1'
androidx-test-espresso = '3.6.1'
androidx-test-junit = '1.2.1'
androidx-test-rules = '1.6.1'
androidx-test-runner = '1.6.2'
androidx-test-truth = '1.6.0'

[plugins]
Expand Down
Loading
Loading