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

15.0.0 Issues #423

Merged
merged 4 commits into from
Apr 17, 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
25 changes: 17 additions & 8 deletions Example/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,16 @@


var onDeviceReady = function() {
// Workaround: console log for ios
if (device.platform === 'iOS') {
var i = document.createElement('iframe');
i.style.display = 'none';
document.body.appendChild(i);
window.console = i.contentWindow.console;
}
console.log("Device ready!")



Airship.onDeepLink(function(event) {
console.log("onDeepLink: " + JSON.stringify(event))
Expand Down Expand Up @@ -75,7 +82,7 @@
Airship.channel.getTags(function(tags) {
console.log("Removing tag: " + tag)
tags.splice(tags.indexOf(tag), 1)
Airship.channel.setTags(tags)
Airship.channel.editTags().removeTags([tag]).apply(console.log, console.error)
})
})
}
Expand All @@ -98,9 +105,12 @@
$('#quietTimeEnabled').change(function() {
var isEnabled = ($('#pushEnabled').val() == "on")
Airship.push.ios.setQuietTimeEnabled(isEnabled)
}
})

Airship.push.ios.getQuietTime(function(obj) {
if(obj === null){
return;
}
$("#startHour").val(obj.startHour)
$("#startMinute").val(obj.startMinute)
$("#endHour").val(obj.endHour)
Expand Down Expand Up @@ -137,7 +147,7 @@
}
})

Airship.contact.getNamedUser(function(namedUser) {
Airship.contact.getNamedUserId(function(namedUser) {
if(namedUser) {
console.log("Got namedUser: " + namedUser)
setNamedUser(namedUser)
Expand All @@ -150,7 +160,7 @@
})
})



// Set up change callbacks for the UI elements
$('#pushEnabled').change(function() {
Expand Down Expand Up @@ -191,11 +201,10 @@
if(tags.indexOf(tag) == -1) {
console.log("Valid tag: " + tag)
tags = tags.concat([tag])

Airship.channel.setTags(tags, function() {
Airship.channel.editTags().addTags(tags).apply(function (result){
addTag(tag)
$("#addTagField").val('')
})
}, console.error)
}
})
})
Expand Down
2 changes: 1 addition & 1 deletion MIGRATION.md
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ Events are no longer sent as document events. Events are also now queued up unti
| document.addEventListener("urbanairship.registration", callback) | Airship.channel.onChannelCreated(callback) | For channel ID. Use `event.channelId` |
| document.addEventListener("urbanairship.registration", callback) | Airship.push.onPushTokenReceived(callback) | For push token. Use `event.pushToken` |
| document.addEventListener("urbanairship.push", callback) | Airship.push.onPushReceived(callback) | The event has changed, see below for more info. |
| document.addEventListener("urbanairship.notification_opened", callback) | Airship.push.onNotificationReceived(callback) | The event has changed, see below for more info. |
| document.addEventListener("urbanairship.notification_opened", callback) | Airship.push.onNotificationResponse(callback) | The event has changed, see below for more info. |
| document.addEventListener("urbanairship.notification_opt_in_status", callback) | Airship.onNotificationStatusChanged(callback) | The event has changed, see below for more info. |
| document.addEventListener("urbanairship.inbox_updated", callback) | Airship.messageCenter.onUpdated(callback) | |
| document.addEventListener("urbanairship.show_inbox", callback) | Airship.messageCenter.onDisplay(callback) | |
Expand Down
2 changes: 1 addition & 1 deletion cordova-airship/src/ios/AirshipCordova.swift
Original file line number Diff line number Diff line change
Expand Up @@ -322,7 +322,7 @@ public final class AirshipCordova: CDVPlugin {
case "push#ios#isAutobadgeEnabled":
return try AirshipProxy.shared.push.isAutobadgeEnabled()

case "push#ios#resetBadgeNumber":
case "push#ios#resetBadge":
try AirshipProxy.shared.push.setBadgeNumber(0)
return nil

Expand Down
18 changes: 15 additions & 3 deletions cordova-airship/types/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -540,6 +540,7 @@ export namespace Android {
* Enum of authorized Features.
*/
export enum Feature {
All = 'all',
InAppAutomation = 'in_app_automation',
MessageCenter = 'message_center',
Push = 'push',
Expand All @@ -551,7 +552,8 @@ export enum Feature {
/**
* All available features.
*/
export const FEATURES_ALL = Object.values(Feature);
// Error: TS1254: A const initializer in an ambient context must be a string or numeric literal or literal enum reference.
// export const FEATURES_ALL = Object.values(Feature);

/**
* Custom event
Expand Down Expand Up @@ -956,7 +958,7 @@ export interface AirshipPush {
/**
* iOS only push methods.
*/
readonly iOS: AirshipPushIOS;
readonly ios: AirshipPushIOS;


/**
Expand Down Expand Up @@ -1174,6 +1176,16 @@ export interface AirshipPushIOS {
error?: (err: string) => void
): void

/**
* Reset the badge number.
* @param success Success callback.
* @param error Error callback.
*/
resetBadge(
success?: (result) => void,
error?: (err: string) => void
): void

/**
* Gets the list of authorized notification settings.
* @param success Success callback.
Expand Down Expand Up @@ -1224,7 +1236,7 @@ export interface AirshipPushIOS {
* @param success Success callback.
* @param error Error callback.
*/
setQuietTimeEnabled(
setQuietTime(
quietTime: iOS.QuietTime,
success?: () => void,
error?: (err: string) => void
Expand Down
16 changes: 6 additions & 10 deletions cordova-airship/www/Airship.js
Original file line number Diff line number Diff line change
Expand Up @@ -254,10 +254,6 @@ airship.channel.getTags = function (success, failure) {
perform("channel#getTags", null, success, failure)
}

airship.channel.setTags = function (tags, success, failure) {
argscheck.checkArgs('aFF', 'Airship.channel.setTags', arguments)
perform("channel#setTags", tags, success, failure)
}

airship.channel.editTags = function () {
return new TagEditor('Airship.channel.editTags', 'channel#editTags')
Expand All @@ -280,20 +276,20 @@ airship.channel.onChannelCreated = function (callback) {
return registerListener("airship.event.channel_created", callback)
}

airship.channel.enableChannelCreation = function () {
airship.channel.enableChannelCreation = function (success, failure) {
argscheck.checkArgs('FF', 'Airship.channel.enableChannelCreation', arguments)
perform("channel#enableChannelCreation", null, success, failure)
}

// Contact

airship.contact.getNamedUser = function (success, failure) {
argscheck.checkArgs('fF', 'Airship.contact.getNamedUser', arguments)
perform("contact#getNamedUser", null, success, failure)
airship.contact.getNamedUserId = function (success, failure) {
MaximBelov marked this conversation as resolved.
Show resolved Hide resolved
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I guess its currently broken so maybe what you have is fine

argscheck.checkArgs('fF', 'Airship.contact.getNamedUserId', arguments)
perform("contact#getNamedUserId", null, success, failure)
}

airship.contact.identify = function (namedUserId, success, failure) {
argscheck.checkArgs('SFF', 'Airship.contact.getNamedUser', arguments)
argscheck.checkArgs('SFF', 'Airship.contact.identify', arguments)
perform("contact#identify", namedUserId, success, failure)
}

Expand Down Expand Up @@ -471,7 +467,7 @@ airship.push.ios.getAuthorizedNotificationStatus = function (success, failure) {
}

airship.push.ios.resetBadge = function (success, failure) {
argscheck.checkArgs('*FF', 'Airship.push.resetBadge', arguments)
argscheck.checkArgs('*FF', 'Airship.push.ios.resetBadge', arguments)
perform("push#ios#resetBadge", null, success, failure)
}

Expand Down