{"metadata":{"image":[],"title":"","description":""},"api":{"url":"","auth":"required","settings":"","results":{"codes":[]},"params":[]},"next":{"description":"","pages":[]},"title":"Rebrand Migration Guide","type":"basic","slug":"rebrand-migration-guide","excerpt":"How to migrate to the rebranded SDKs","body":"From version 10.1.0 of the iOS and Android SDKs and version 4.1.0 of the React Native SDK we have implemented a rebranding of our classes. This will remove all references to 'Carnival' in favor of 'SailthruMobile'. This rebranding will help the SDKs to feel more consistent with the rest of the platform and we have also taken this opportunity to do some overdue restructuring of the main classes. This guide is designed to help walk you through the migration process.\n\n# iOS\n## Framework updates\nThe frameworks have been renamed from `Carnival.framework` to `SailthruMobile.framework` and `CarnivalExtension.framework` to `SailthruMobileExtension.framework`. \n\n### Cocoapods\nIf you are using Cocoapods you will need to update to the new Pods:\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"# Previously\\npod 'Carnival'\\npod 'Carnival/Extension'\\n\\n# Now\\npod 'SailthruMobile'\\npod 'SailthruMobile/Extension'\",\n      \"language\": \"ruby\"\n    }\n  ]\n}\n[/block]\n### Carthage\nIf you are using Carthage the Github location will remain the same but you will need to change the linked frameworks to `SailthruMobile.framework` and `SailthruMobileExtension.framework` instead of the old 'Carnival' versions.\n\n## Carnival to SailthruMobile\nThe main class has been renamed from Carnival to SailthruMobile. It has also been restructured so that all the methods are instance methods rather than static methods. So for instance when calling `startEngine`: \n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"// Previously\\n[Carnival startEngine::::at:::\\\"Your_app_key\\\"];\\n\\n// Now\\n[[SailthruMobile new] startEngine:@\\\"Your_app_key\\\"];\",\n      \"language\": \"objectivec\"\n    },\n    {\n      \"code\": \"// Previously\\nCarnival.startEngine(\\\"Your_app_key\\\")\\n\\n// Now\\nSailthruMobile().startEngine(\\\"Your_app_key\\\")\",\n      \"language\": \"swift\"\n    }\n  ]\n}\n[/block]\n## CarnivalMessageStream to STMMessageStream\nThe Message Stream class is now using the three letter prefix format recommended by Apple. We have opted to use STM for our prefix. The message stream methods have also been converted to instance methods rather than static methods. For example, to set a delegate:\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"// Previously\\n[CarnivalMessageStream setDelegate:self];\\n\\n// Now\\n[[STMMessageStream new] setDelegate:self];\",\n      \"language\": \"objectivec\"\n    },\n    {\n      \"code\": \"// Previously\\nCarnivalMessageStream.setDelegate(self)\\n\\n// Now\\nSTMMessageStream().setDelegate(self)\",\n      \"language\": \"swift\"\n    }\n  ]\n}\n[/block]\n\n[block:callout]\n{\n  \"type\": \"info\",\n  \"title\": \"Note\",\n  \"body\": \"You do not need to hold references to instances of the SailthruMobile or STMMessageStream classes; they can be created, used and released as you need them. The SDK will hold any delegates passed through them, so you only need to set them once on an instance of the class and you're good to go!\"\n}\n[/block]\n## Carnival -> STM\nAll other classes have been renamed but will otherwise function in the same way as before:\n[block:parameters]\n{\n  \"data\": {\n    \"1-0\": \"CarnivalAttributes\",\n    \"h-0\": \"Before\",\n    \"h-1\": \"After\",\n    \"1-1\": \"STMAttributes\",\n    \"2-0\": \"CarnivalContentItem\",\n    \"3-0\": \"CarnivalLogger\",\n    \"4-0\": \"CarnivalMessage\",\n    \"6-0\": \"CarnivalNotificationCategory\",\n    \"7-0\": \"CarnivalPurchase\",\n    \"8-0\": \"CarnivalPurchaseItem\",\n    \"0-0\": \"Carnival\",\n    \"5-0\": \"CarnivalMessageStream\",\n    \"0-1\": \"SailthruMobile\",\n    \"2-1\": \"STMContentItem\",\n    \"3-1\": \"STMLogger\",\n    \"4-1\": \"STMMessage\",\n    \"5-1\": \"STMMessageStream\",\n    \"6-1\": \"STMNotificationCategory\",\n    \"7-1\": \"STMPurchase\",\n    \"8-1\": \"STMPurchaseItem\"\n  },\n  \"cols\": 2,\n  \"rows\": 9\n}\n[/block]\nExamples:\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"// Previously\\nCarnivalAttributes *attributes = [[CarnivalAttributes alloc] init];\\n\\nCarnivalPurchaseItem *item = [[CarnivalPurchaseItem alloc] initWithQuantity:2 title:@\\\"Made Up Object\\\" price:1234 itemId:@\\\"2345\\\" itemUrl:itemUrl];\\n\\nCarnivalPurchase *purchase = [[CarnivalPurchase alloc] initWithPurchaseItems:@[ item ]];\\n\\n\\n// Now\\nSTMAttributes *attributes = [[STMAttributes alloc] init];\\n\\nSTMPurchaseItem *item = [[STMPurchaseItem alloc] initWithQuantity:2 title:@\\\"Made Up Object\\\" price:1234 itemId:@\\\"2345\\\" itemUrl:itemUrl];\\n\\nSTMPurchase *purchase = [[STMPurchase alloc] initWithPurchaseItems:@[ item ]];\",\n      \"language\": \"objectivec\"\n    },\n    {\n      \"code\": \"// Previously\\nlet attributes = CarnivalAttributes()\\n\\nlet item = CarnivalPurchaseItem(quantity: 2, title: \\\"Made Up Object\\\", price: 1234, itemId: \\\"2345\\\", itemUrl: url!)\\n\\n// create purchase\\nlet purchase = CarnivalPurchase(purchaseItems: [ item ])\\n\\n\\n// Now\\nlet attributes = STMAttributes()\\n\\nlet item = STMPurchaseItem(quantity: 2, title: \\\"Made Up Object\\\", price: 1234, itemId: \\\"2345\\\", itemUrl: url!)\\n\\n// create purchase\\nlet purchase = STMPurchase(purchaseItems: [ item ])\",\n      \"language\": \"swift\"\n    }\n  ]\n}\n[/block]\n## Extension SDK\nThe Extension SDK has followed the same rebranding pattern, the main class has changed from `CarnivalExtension` to `SailthruMobileExtension`. The other classes have changed to the 'STM' prefix. The `SailthruMobileExtension` class has also had the `startEngine` and `getInstance` methods removed. You now only need to initialize an instance directly:\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"// Previously\\n[CarnivalExtension startEngine:@\\\"Your_app_key\\\"];\\nCarnivalExtension *extension = [CarnivalExtension getInstanceForGroup:@\\\"your.group.name\\\"];\\n\\n// Now\\nSailthruMobileExtension *extension = [[SailthruMobileExtension alloc] initWithAppKey:@\\\"Your_app_key\\\" groupName:@\\\"your.group.name\\\"];\",\n      \"language\": \"objectivec\"\n    },\n    {\n      \"code\": \"// Previously\\nCarnivalExtension.startEngine(\\\"Your_app_key\\\")\\nlet extension = CarnivalExtension.getInstanceForGroup(\\\"your.group.name\\\")\\n\\n// Now\\nlet extension = SailthruMobileExtension(appKey: \\\"Your_app_key\\\", groupName: \\\"your.group.name\\\")\",\n      \"language\": \"swift\"\n    }\n  ]\n}\n[/block]\n# Android\n## Package Change\nThe Android SDK has been repackaged from `com.carnival.sdk` to `com.sailthru.mobile.sdk`. In your `build.gradle` file it will look like this:\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"// Previously\\nimplementation 'com.carnival.sdk:carnival:10.1.0'\\n\\n// Now\\nimplementation 'com.sailthru.mobile.sdk:sailthru-mobile:10.1.0'\",\n      \"language\": \"groovy\"\n    }\n  ]\n}\n[/block]\nThe Maven url will remain the same. Some of the classes have also been separated out into sub-packages. Below are the mappings for the package changes per class.\n\nEnums:\n[block:parameters]\n{\n  \"data\": {\n    \"h-0\": \"Before\",\n    \"h-1\": \"After\",\n    \"h-2\": \"New Sub-package\",\n    \"0-0\": \"com.carnival.sdk.EventSource\",\n    \"0-1\": \"com.sailthru.mobile.sdk.**enums**.EventSource\",\n    \"1-0\": \"com.carnival.sdk.CarnivalImpressionType\",\n    \"2-0\": \"com.carnival.sdk.NotificationActionState\",\n    \"1-1\": \"com.sailthru.mobile.sdk.**enums**.ImpressionType\",\n    \"2-1\": \"com.sailthru.mobile.sdk.**enums**.NotificationActionState\",\n    \"0-2\": \"Yes\",\n    \"1-2\": \"Yes\",\n    \"2-2\": \"Yes\"\n  },\n  \"cols\": 2,\n  \"rows\": 3\n}\n[/block]\nInterfaces:\n[block:parameters]\n{\n  \"data\": {\n    \"h-0\": \"Before\",\n    \"h-1\": \"After\",\n    \"h-2\": \"New Sub-package\",\n    \"0-0\": \"com.carnival.sdk.ContentIntentBuilder\",\n    \"1-0\": \"com.carnival.sdk.Logger\",\n    \"2-0\": \"com.carnival.sdk.NotificationActionTappedListener\",\n    \"3-0\": \"com.carnival.sdk.NotificationReceivedListener\",\n    \"4-0\": \"com.carnival.sdk.NotificationSilencer\",\n    \"5-0\": \"com.carnival.sdk.NotificationTappedListener\",\n    \"0-1\": \"com.sailthru.mobile.sdk.**interfaces**.ContentIntentBuilder\",\n    \"1-1\": \"com.sailthru.mobile.sdk.**interfaces**.Logger\",\n    \"2-1\": \"com.sailthru.mobile.sdk.**interfaces**.NotificationActionTappedListener\",\n    \"3-1\": \"com.sailthru.mobile.sdk.**interfaces**.NotificationReceivedListener\",\n    \"4-1\": \"com.sailthru.mobile.sdk.**interfaces**.NotificationSilencer\",\n    \"5-1\": \"com.sailthru.mobile.sdk.**interfaces**.NotificationTappedListener\",\n    \"0-2\": \"Yes\",\n    \"1-2\": \"Yes\",\n    \"2-2\": \"Yes\",\n    \"3-2\": \"Yes\",\n    \"4-2\": \"Yes\",\n    \"5-2\": \"Yes\"\n  },\n  \"cols\": 2,\n  \"rows\": 6\n}\n[/block]\nModel:\n[block:parameters]\n{\n  \"data\": {\n    \"h-0\": \"Before\",\n    \"h-1\": \"After\",\n    \"h-2\": \"New Sub-package\",\n    \"0-0\": \"com.carnival.sdk.AttributeMap\",\n    \"1-0\": \"com.carnival.sdk.ContentItem\",\n    \"2-0\": \"com.carnival.sdk.Message\",\n    \"3-0\": \"com.carnival.sdk.Purchase\",\n    \"4-0\": \"com.carnival.sdk.PurchaseItem\",\n    \"0-1\": \"com.sailthru.mobile.sdk.**model**.AttributeMap\",\n    \"1-1\": \"com.sailthru.mobile.sdk.**model**.ContentItem\",\n    \"2-1\": \"com.sailthru.mobile.sdk.**model**.Message\",\n    \"3-1\": \"com.sailthru.mobile.sdk.**model**.Purchase\",\n    \"4-1\": \"com.sailthru.mobile.sdk.**model**.PurchaseItem\",\n    \"0-2\": \"Yes\",\n    \"1-2\": \"Yes\",\n    \"2-2\": \"Yes\",\n    \"3-2\": \"Yes\",\n    \"4-2\": \"Yes\"\n  },\n  \"cols\": 2,\n  \"rows\": 5\n}\n[/block]\nMain:\n[block:parameters]\n{\n  \"data\": {\n    \"h-0\": \"Before\",\n    \"h-1\": \"After\",\n    \"h-2\": \"New Sub-package\",\n    \"0-0\": \"com.carnival.sdk.MessageActivity\",\n    \"1-0\": \"**(new class)**\",\n    \"2-0\": \"com.carnival.sdk.NotificationBundle\",\n    \"3-0\": \"com.carnival.sdk.CarnivalNotificationCategory\",\n    \"4-0\": \"com.carnival.sdk.NotificationConfig\",\n    \"5-0\": \"com.carnival.sdk.CarnivalNotificationExtender\",\n    \"6-0\": \"com.carnival.sdk.Carnival\",\n    \"0-1\": \"com.sailthru.mobile.sdk.MessageActivity\",\n    \"1-1\": \"com.sailthru.mobile.sdk.MessageStream\",\n    \"2-1\": \"com.sailthru.mobile.sdk.NotificationBundle\",\n    \"3-1\": \"com.sailthru.mobile.sdk.NotificationCategory\",\n    \"4-1\": \"com.sailthru.mobile.sdk.NotificationConfig\",\n    \"5-1\": \"com.sailthru.mobile.sdk.NotificationExtender\",\n    \"6-1\": \"com.sailthru.mobile.sdk.SailthruMobile\",\n    \"0-2\": \"No\",\n    \"1-2\": \"No\",\n    \"2-2\": \"No\",\n    \"3-2\": \"No\",\n    \"4-2\": \"No\",\n    \"5-2\": \"No\",\n    \"6-2\": \"No\"\n  },\n  \"cols\": 2,\n  \"rows\": 7\n}\n[/block]\n## Carnival to SailthruMobile\nThe main class in the Android SDK has been renamed from `Carnival` to `SailthruMobile`. It has also been converted to using instance methods rather than static methods:\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"// Previously\\nCarnival.startEngine(\\\"Your_app_key\\\");\\n\\n// Now\\nnew SailthruMobile().startEngine(\\\"Your_app_key\\\");\",\n      \"language\": \"java\"\n    },\n    {\n      \"code\": \"// Previously\\nCarnival.startEngine(\\\"Your_app_key\\\")\\n\\n// Now\\nSailthruMobile().startEngine(\\\"Your_app_key\\\")\",\n      \"language\": \"kotlin\"\n    }\n  ]\n}\n[/block]\n## MessageStream\nThe message stream functionality has been moved out of the Carnival/SailthruMobile class into a new `MessageStream` class. The methods have also been convert from static methods to instance methods:\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"// Previously\\nCarnival.getMessages(new Carnival.MessagesHandler() {\\n  \\[email protected]\\n  \\tpublic void onSuccess(ArrayList<Message> messages) {\\n      \\t// Handle messages\\n    }\\n  \\n  \\[email protected]\\n  \\tpublic void onFailure(Error error) {\\n      \\t// Handle error\\n    }\\n});\\n\\n// Now\\nnew MessageStream().getMessages(new MessageStream.MessagesHandler() {\\n  \\[email protected]\\n  \\tpublic void onSuccess(ArrayList<Message> messages) {\\n      \\t// Handle messages\\n    }\\n  \\n  \\[email protected]\\n  \\tpublic void onFailure(Error error) {\\n      \\t// Handle error\\n    }\\n});\",\n      \"language\": \"java\"\n    },\n    {\n      \"code\": \"// Previously\\nCarnival.getMessages(object : Carnival.MessagesHandler {\\n    override fun onSuccess(messages: java.util.ArrayList<Message>?) {\\n\\t\\t\\t\\t// Handle messages\\n    }\\n\\n    override fun onFailure(error: java.lang.Error?) {\\n\\t\\t\\t\\t// Handle error\\n    }\\n})\\n\\n// Now\\nMessageStream().getMessages(object : MessageStream.MessagesHandler {\\n    override fun onSuccess(messages: ArrayList<Message>?) {\\n      \\t// Handle messages\\n    }\\n\\n    override fun onFailure(error: Error?) {\\n      \\t// Handle error\\n    }\\n})\",\n      \"language\": \"kotlin\"\n    }\n  ]\n}\n[/block]\nThe following methods, as well as their associated handlers and interfaces, have been moved to the MessageStream class:\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"public void getUnreadMessageCount(MessageStream.MessageStreamHandler<Integer> handler);\\n\\npublic void getMessages(MessageStream.MessagesHandler messagesHandler);\\n\\npublic void getMessage(String messageId, MessageStream.MessageStreamHandler<Message> messageHandler);\\n\\npublic void registerMessageImpression(ImpressionType type, Message message);\\n\\npublic void setMessageRead(Message message, MessageStream.MessagesReadHandler handler);\\n\\npublic void setMessagesRead(List<Message> messages, MessageStream.MessagesReadHandler handler);\\n\\npublic void deleteMessage(Message message, MessageStream.MessageDeletedHandler handler);\\n\\npublic void setOnInAppNotificationDisplayListener(MessageStream.OnInAppNotificationDisplayListener listener);\",\n      \"language\": \"java\"\n    },\n    {\n      \"code\": \"fun getUnreadMessageCount(handler: MessageStreamHandler<Int?>?)\\n\\nfun getMessages(messagesHandler: MessagesHandler?)\\n\\nfun getMessage(messageId: String?, messageHandler: MessageStreamHandler<Message>?)\\n\\nfun registerMessageImpression(type: ImpressionType, message: Message?)\\n\\nfun setMessageRead(message: Message?, handler: MessagesReadHandler?)\\n\\nfun setMessagesRead(messages: List<Message?>?, handler: MessagesReadHandler?)\\n\\nfun deleteMessage(message: Message?, handler: MessageDeletedHandler?)\\n\\nfun setOnInAppNotificationDisplayListener(listener: OnInAppNotificationDisplayListener)\",\n      \"language\": \"kotlin\"\n    }\n  ]\n}\n[/block]\n\n[block:callout]\n{\n  \"type\": \"info\",\n  \"title\": \"Note\",\n  \"body\": \"As with the iOS SDK, you do not need to hold references to instances of the SailthruMobile or MessageStream classes; you can create, use and release them as you need them. The SDK will persist any interface implementations passed in via instances of these classes.\"\n}\n[/block]\n## Resources\nAny resources named 'carnival\\_\\*' have been renamed to 'st\\_\\*'.\n\n# React Native\n## Package\nThe package name has been changed from 'react-native-carnival' to 'react-native-sailthru-mobile', you can update this in your project's package.json:\n\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"// Previously\\n\\\"dependencies\\\": {\\n  \\t//...\\n    \\\"react-native-carnival\\\": \\\"^4.1.0\\\",\\n  \\t//...\\n},\\n\\n// Now\\n\\\"dependencies\\\": {\\n  \\t//...\\n    \\\"react-native-sailthru-mobile\\\": \\\"^4.1.0\\\",\\n  \\t//...\\n},\",\n      \"language\": \"json\"\n    }\n  ]\n}\n[/block]\n## Carnival to SailthruMobile\nThe native React Native classes have been renamed:\n### Android\nRNCarnivalModule.java -> RNSailthruMobileModule.java\nRNCarnivalPackage.java -> RNSailthruMobilePackage.java\n\n### iOS\nRNCarnival.h -> RNSailthruMobile.h\nRNCarnival.m -> RNSailthruMobile.m\nRNCarnivalBridge.h -> RNSailthruMobileBridge.h\nRNCarnivalBridge.m -> RNSailthruMobileBridge.m\n\nYou will need to copy the new rebranded classes into your project from `node_modules/react-native-sailthru-mobile`. Once you have done this you will need to change your Podfile to point to the new `SailthruMobile` pod rather than `Carnival` in order for your app to compile. See the iOS [Cocoapods](#Cocoapods) section for details. You should either use the SailthruMobile bridge/module or the Carnival bridge/module in your app. The `index.js` file will pick up whichever bridge you are exporting and populate it accordingly.\n[block:callout]\n{\n  \"type\": \"info\",\n  \"title\": \"Note\",\n  \"body\": \"You should have **either**  RNCarnival and RNCarnivalBridge **or** RNSailthruMobile and RNSailthruMobileBridge in your app. If you are using the RNCarnival classes you will need to use the Carnival pod in your Podfile. If you are using the RNSailthruMobile classes you will need to use the SailthruMobile pod.\"\n}\n[/block]","updates":[],"order":22,"isReference":false,"hidden":false,"sync_unique":"","link_url":"","link_external":false,"_id":"5e680cb5941071064c116f5c","createdAt":"2020-03-10T21:55:01.078Z","user":"5b0b7a46a26e6400036604fd","category":{"sync":{"isSync":false,"url":""},"pages":["5e6156bf5e4a51006dcd812a","5e6156bf5e4a51006dcd812c","5e6156bf5e4a51006dcd812d","5e6156bf5e4a51006dcd812e","55e682b7de6fef23009480dc","5e6156bf5e4a51006dcd812f","5e6156bf5e4a51006dcd8130","5e6156bf5e4a51006dcd8131","5e6156bf5e4a51006dcd8132","5e6156bf5e4a51006dcd8133","5e6156bf5e4a51006dcd8134","5b720760c44b7600034b79bc","5e6156bf5e4a51006dcd8135","5e6156bf5e4a51006dcd8148","5e6156bf5e4a51006dcd8149","5e6156bf5e4a51006dcd814a","5e6156bf5e4a51006dcd814b","5e6156bf5e4a51006dcd814c","5e6156bf5e4a51006dcd814f","5e6156bf5e4a51006dcd8150","5e6156bf5e4a51006dcd8152","561c6ca0be5fb20d00077754","5e6156bf5e4a51006dcd8157","5e6156bf5e4a51006dcd8158","5b720760c44b7600034b79e2","5e6156bf5e4a51006dcd8159","5e6156bf5e4a51006dcd815a","5e6156bf5e4a51006dcd815b","5e6156bf5e4a51006dcd815c","56cfa5386c5d7a13005eec0f","56e73d86555c030e00a52a73","56e7460c9000b120000ffe2e","56e8c19e99c6400e003820cf","56e8c53fc88bf80e00f8bed8","56f06ff4d386ce0e008e9b21"],"title":"Install in your app","slug":"install-in-your-app","order":1,"from_sync":false,"reference":false,"_id":"5e6156bf5e4a51006dcd8121","__v":35,"createdAt":"2015-09-02T04:30:13.305Z","project":"55e67aaa9cc7c62b00c4a1ea","version":"5e6156bf5e4a51006dcd818c"},"version":{"version":"1.5","version_clean":"1.5.0","codename":"ST Rebrand","is_stable":true,"is_beta":false,"is_hidden":false,"is_deprecated":false,"categories":["5e6156bf5e4a51006dcd8120","5e6156bf5e4a51006dcd8121","5e6156bf5e4a51006dcd8122","5e6156bf5e4a51006dcd8123","5e6156bf5e4a51006dcd8124","561c61b4ad272c0d00a892df","586c014c0abf1d0f000d04d4","58991d2ad207df0f0002186b","5e6156bf5e4a51006dcd8125","5e6156bf5e4a51006dcd8126","5af0fe494ca2730003cbc98a","5af0fe55ec80af0003804ca2","5e69868cbd5dcb006b35867b","5e6986ca2c6652006791b6e8"],"_id":"5e6156bf5e4a51006dcd818c","project":"55e67aaa9cc7c62b00c4a1ea","__v":2,"forked_from":"5b720760c44b7600034b7a08","createdAt":"2015-09-02T04:27:23.612Z","releaseDate":"2015-09-02T04:27:23.612Z"},"project":"55e67aaa9cc7c62b00c4a1ea","__v":0,"parentDoc":null}

Rebrand Migration Guide

How to migrate to the rebranded SDKs

From version 10.1.0 of the iOS and Android SDKs and version 4.1.0 of the React Native SDK we have implemented a rebranding of our classes. This will remove all references to 'Carnival' in favor of 'SailthruMobile'. This rebranding will help the SDKs to feel more consistent with the rest of the platform and we have also taken this opportunity to do some overdue restructuring of the main classes. This guide is designed to help walk you through the migration process. # iOS ## Framework updates The frameworks have been renamed from `Carnival.framework` to `SailthruMobile.framework` and `CarnivalExtension.framework` to `SailthruMobileExtension.framework`. ### Cocoapods If you are using Cocoapods you will need to update to the new Pods: [block:code] { "codes": [ { "code": "# Previously\npod 'Carnival'\npod 'Carnival/Extension'\n\n# Now\npod 'SailthruMobile'\npod 'SailthruMobile/Extension'", "language": "ruby" } ] } [/block] ### Carthage If you are using Carthage the Github location will remain the same but you will need to change the linked frameworks to `SailthruMobile.framework` and `SailthruMobileExtension.framework` instead of the old 'Carnival' versions. ## Carnival to SailthruMobile The main class has been renamed from Carnival to SailthruMobile. It has also been restructured so that all the methods are instance methods rather than static methods. So for instance when calling `startEngine`: [block:code] { "codes": [ { "code": "// Previously\n[Carnival startEngine:@\"Your_app_key\"];\n\n// Now\n[[SailthruMobile new] startEngine:@\"Your_app_key\"];", "language": "objectivec" }, { "code": "// Previously\nCarnival.startEngine(\"Your_app_key\")\n\n// Now\nSailthruMobile().startEngine(\"Your_app_key\")", "language": "swift" } ] } [/block] ## CarnivalMessageStream to STMMessageStream The Message Stream class is now using the three letter prefix format recommended by Apple. We have opted to use STM for our prefix. The message stream methods have also been converted to instance methods rather than static methods. For example, to set a delegate: [block:code] { "codes": [ { "code": "// Previously\n[CarnivalMessageStream setDelegate:self];\n\n// Now\n[[STMMessageStream new] setDelegate:self];", "language": "objectivec" }, { "code": "// Previously\nCarnivalMessageStream.setDelegate(self)\n\n// Now\nSTMMessageStream().setDelegate(self)", "language": "swift" } ] } [/block] [block:callout] { "type": "info", "title": "Note", "body": "You do not need to hold references to instances of the SailthruMobile or STMMessageStream classes; they can be created, used and released as you need them. The SDK will hold any delegates passed through them, so you only need to set them once on an instance of the class and you're good to go!" } [/block] ## Carnival -> STM All other classes have been renamed but will otherwise function in the same way as before: [block:parameters] { "data": { "1-0": "CarnivalAttributes", "h-0": "Before", "h-1": "After", "1-1": "STMAttributes", "2-0": "CarnivalContentItem", "3-0": "CarnivalLogger", "4-0": "CarnivalMessage", "6-0": "CarnivalNotificationCategory", "7-0": "CarnivalPurchase", "8-0": "CarnivalPurchaseItem", "0-0": "Carnival", "5-0": "CarnivalMessageStream", "0-1": "SailthruMobile", "2-1": "STMContentItem", "3-1": "STMLogger", "4-1": "STMMessage", "5-1": "STMMessageStream", "6-1": "STMNotificationCategory", "7-1": "STMPurchase", "8-1": "STMPurchaseItem" }, "cols": 2, "rows": 9 } [/block] Examples: [block:code] { "codes": [ { "code": "// Previously\nCarnivalAttributes *attributes = [[CarnivalAttributes alloc] init];\n\nCarnivalPurchaseItem *item = [[CarnivalPurchaseItem alloc] initWithQuantity:2 title:@\"Made Up Object\" price:1234 itemId:@\"2345\" itemUrl:itemUrl];\n\nCarnivalPurchase *purchase = [[CarnivalPurchase alloc] initWithPurchaseItems:@[ item ]];\n\n\n// Now\nSTMAttributes *attributes = [[STMAttributes alloc] init];\n\nSTMPurchaseItem *item = [[STMPurchaseItem alloc] initWithQuantity:2 title:@\"Made Up Object\" price:1234 itemId:@\"2345\" itemUrl:itemUrl];\n\nSTMPurchase *purchase = [[STMPurchase alloc] initWithPurchaseItems:@[ item ]];", "language": "objectivec" }, { "code": "// Previously\nlet attributes = CarnivalAttributes()\n\nlet item = CarnivalPurchaseItem(quantity: 2, title: \"Made Up Object\", price: 1234, itemId: \"2345\", itemUrl: url!)\n\n// create purchase\nlet purchase = CarnivalPurchase(purchaseItems: [ item ])\n\n\n// Now\nlet attributes = STMAttributes()\n\nlet item = STMPurchaseItem(quantity: 2, title: \"Made Up Object\", price: 1234, itemId: \"2345\", itemUrl: url!)\n\n// create purchase\nlet purchase = STMPurchase(purchaseItems: [ item ])", "language": "swift" } ] } [/block] ## Extension SDK The Extension SDK has followed the same rebranding pattern, the main class has changed from `CarnivalExtension` to `SailthruMobileExtension`. The other classes have changed to the 'STM' prefix. The `SailthruMobileExtension` class has also had the `startEngine` and `getInstance` methods removed. You now only need to initialize an instance directly: [block:code] { "codes": [ { "code": "// Previously\n[CarnivalExtension startEngine:@\"Your_app_key\"];\nCarnivalExtension *extension = [CarnivalExtension getInstanceForGroup:@\"your.group.name\"];\n\n// Now\nSailthruMobileExtension *extension = [[SailthruMobileExtension alloc] initWithAppKey:@\"Your_app_key\" groupName:@\"your.group.name\"];", "language": "objectivec" }, { "code": "// Previously\nCarnivalExtension.startEngine(\"Your_app_key\")\nlet extension = CarnivalExtension.getInstanceForGroup(\"your.group.name\")\n\n// Now\nlet extension = SailthruMobileExtension(appKey: \"Your_app_key\", groupName: \"your.group.name\")", "language": "swift" } ] } [/block] # Android ## Package Change The Android SDK has been repackaged from `com.carnival.sdk` to `com.sailthru.mobile.sdk`. In your `build.gradle` file it will look like this: [block:code] { "codes": [ { "code": "// Previously\nimplementation 'com.carnival.sdk:carnival:10.1.0'\n\n// Now\nimplementation 'com.sailthru.mobile.sdk:sailthru-mobile:10.1.0'", "language": "groovy" } ] } [/block] The Maven url will remain the same. Some of the classes have also been separated out into sub-packages. Below are the mappings for the package changes per class. Enums: [block:parameters] { "data": { "h-0": "Before", "h-1": "After", "h-2": "New Sub-package", "0-0": "com.carnival.sdk.EventSource", "0-1": "com.sailthru.mobile.sdk.**enums**.EventSource", "1-0": "com.carnival.sdk.CarnivalImpressionType", "2-0": "com.carnival.sdk.NotificationActionState", "1-1": "com.sailthru.mobile.sdk.**enums**.ImpressionType", "2-1": "com.sailthru.mobile.sdk.**enums**.NotificationActionState", "0-2": "Yes", "1-2": "Yes", "2-2": "Yes" }, "cols": 2, "rows": 3 } [/block] Interfaces: [block:parameters] { "data": { "h-0": "Before", "h-1": "After", "h-2": "New Sub-package", "0-0": "com.carnival.sdk.ContentIntentBuilder", "1-0": "com.carnival.sdk.Logger", "2-0": "com.carnival.sdk.NotificationActionTappedListener", "3-0": "com.carnival.sdk.NotificationReceivedListener", "4-0": "com.carnival.sdk.NotificationSilencer", "5-0": "com.carnival.sdk.NotificationTappedListener", "0-1": "com.sailthru.mobile.sdk.**interfaces**.ContentIntentBuilder", "1-1": "com.sailthru.mobile.sdk.**interfaces**.Logger", "2-1": "com.sailthru.mobile.sdk.**interfaces**.NotificationActionTappedListener", "3-1": "com.sailthru.mobile.sdk.**interfaces**.NotificationReceivedListener", "4-1": "com.sailthru.mobile.sdk.**interfaces**.NotificationSilencer", "5-1": "com.sailthru.mobile.sdk.**interfaces**.NotificationTappedListener", "0-2": "Yes", "1-2": "Yes", "2-2": "Yes", "3-2": "Yes", "4-2": "Yes", "5-2": "Yes" }, "cols": 2, "rows": 6 } [/block] Model: [block:parameters] { "data": { "h-0": "Before", "h-1": "After", "h-2": "New Sub-package", "0-0": "com.carnival.sdk.AttributeMap", "1-0": "com.carnival.sdk.ContentItem", "2-0": "com.carnival.sdk.Message", "3-0": "com.carnival.sdk.Purchase", "4-0": "com.carnival.sdk.PurchaseItem", "0-1": "com.sailthru.mobile.sdk.**model**.AttributeMap", "1-1": "com.sailthru.mobile.sdk.**model**.ContentItem", "2-1": "com.sailthru.mobile.sdk.**model**.Message", "3-1": "com.sailthru.mobile.sdk.**model**.Purchase", "4-1": "com.sailthru.mobile.sdk.**model**.PurchaseItem", "0-2": "Yes", "1-2": "Yes", "2-2": "Yes", "3-2": "Yes", "4-2": "Yes" }, "cols": 2, "rows": 5 } [/block] Main: [block:parameters] { "data": { "h-0": "Before", "h-1": "After", "h-2": "New Sub-package", "0-0": "com.carnival.sdk.MessageActivity", "1-0": "**(new class)**", "2-0": "com.carnival.sdk.NotificationBundle", "3-0": "com.carnival.sdk.CarnivalNotificationCategory", "4-0": "com.carnival.sdk.NotificationConfig", "5-0": "com.carnival.sdk.CarnivalNotificationExtender", "6-0": "com.carnival.sdk.Carnival", "0-1": "com.sailthru.mobile.sdk.MessageActivity", "1-1": "com.sailthru.mobile.sdk.MessageStream", "2-1": "com.sailthru.mobile.sdk.NotificationBundle", "3-1": "com.sailthru.mobile.sdk.NotificationCategory", "4-1": "com.sailthru.mobile.sdk.NotificationConfig", "5-1": "com.sailthru.mobile.sdk.NotificationExtender", "6-1": "com.sailthru.mobile.sdk.SailthruMobile", "0-2": "No", "1-2": "No", "2-2": "No", "3-2": "No", "4-2": "No", "5-2": "No", "6-2": "No" }, "cols": 2, "rows": 7 } [/block] ## Carnival to SailthruMobile The main class in the Android SDK has been renamed from `Carnival` to `SailthruMobile`. It has also been converted to using instance methods rather than static methods: [block:code] { "codes": [ { "code": "// Previously\nCarnival.startEngine(\"Your_app_key\");\n\n// Now\nnew SailthruMobile().startEngine(\"Your_app_key\");", "language": "java" }, { "code": "// Previously\nCarnival.startEngine(\"Your_app_key\")\n\n// Now\nSailthruMobile().startEngine(\"Your_app_key\")", "language": "kotlin" } ] } [/block] ## MessageStream The message stream functionality has been moved out of the Carnival/SailthruMobile class into a new `MessageStream` class. The methods have also been convert from static methods to instance methods: [block:code] { "codes": [ { "code": "// Previously\nCarnival.getMessages(new Carnival.MessagesHandler() {\n \[email protected]\n \tpublic void onSuccess(ArrayList<Message> messages) {\n \t// Handle messages\n }\n \n \[email protected]\n \tpublic void onFailure(Error error) {\n \t// Handle error\n }\n});\n\n// Now\nnew MessageStream().getMessages(new MessageStream.MessagesHandler() {\n \[email protected]\n \tpublic void onSuccess(ArrayList<Message> messages) {\n \t// Handle messages\n }\n \n \[email protected]\n \tpublic void onFailure(Error error) {\n \t// Handle error\n }\n});", "language": "java" }, { "code": "// Previously\nCarnival.getMessages(object : Carnival.MessagesHandler {\n override fun onSuccess(messages: java.util.ArrayList<Message>?) {\n\t\t\t\t// Handle messages\n }\n\n override fun onFailure(error: java.lang.Error?) {\n\t\t\t\t// Handle error\n }\n})\n\n// Now\nMessageStream().getMessages(object : MessageStream.MessagesHandler {\n override fun onSuccess(messages: ArrayList<Message>?) {\n \t// Handle messages\n }\n\n override fun onFailure(error: Error?) {\n \t// Handle error\n }\n})", "language": "kotlin" } ] } [/block] The following methods, as well as their associated handlers and interfaces, have been moved to the MessageStream class: [block:code] { "codes": [ { "code": "public void getUnreadMessageCount(MessageStream.MessageStreamHandler<Integer> handler);\n\npublic void getMessages(MessageStream.MessagesHandler messagesHandler);\n\npublic void getMessage(String messageId, MessageStream.MessageStreamHandler<Message> messageHandler);\n\npublic void registerMessageImpression(ImpressionType type, Message message);\n\npublic void setMessageRead(Message message, MessageStream.MessagesReadHandler handler);\n\npublic void setMessagesRead(List<Message> messages, MessageStream.MessagesReadHandler handler);\n\npublic void deleteMessage(Message message, MessageStream.MessageDeletedHandler handler);\n\npublic void setOnInAppNotificationDisplayListener(MessageStream.OnInAppNotificationDisplayListener listener);", "language": "java" }, { "code": "fun getUnreadMessageCount(handler: MessageStreamHandler<Int?>?)\n\nfun getMessages(messagesHandler: MessagesHandler?)\n\nfun getMessage(messageId: String?, messageHandler: MessageStreamHandler<Message>?)\n\nfun registerMessageImpression(type: ImpressionType, message: Message?)\n\nfun setMessageRead(message: Message?, handler: MessagesReadHandler?)\n\nfun setMessagesRead(messages: List<Message?>?, handler: MessagesReadHandler?)\n\nfun deleteMessage(message: Message?, handler: MessageDeletedHandler?)\n\nfun setOnInAppNotificationDisplayListener(listener: OnInAppNotificationDisplayListener)", "language": "kotlin" } ] } [/block] [block:callout] { "type": "info", "title": "Note", "body": "As with the iOS SDK, you do not need to hold references to instances of the SailthruMobile or MessageStream classes; you can create, use and release them as you need them. The SDK will persist any interface implementations passed in via instances of these classes." } [/block] ## Resources Any resources named 'carnival\_\*' have been renamed to 'st\_\*'. # React Native ## Package The package name has been changed from 'react-native-carnival' to 'react-native-sailthru-mobile', you can update this in your project's package.json: [block:code] { "codes": [ { "code": "// Previously\n\"dependencies\": {\n \t//...\n \"react-native-carnival\": \"^4.1.0\",\n \t//...\n},\n\n// Now\n\"dependencies\": {\n \t//...\n \"react-native-sailthru-mobile\": \"^4.1.0\",\n \t//...\n},", "language": "json" } ] } [/block] ## Carnival to SailthruMobile The native React Native classes have been renamed: ### Android RNCarnivalModule.java -> RNSailthruMobileModule.java RNCarnivalPackage.java -> RNSailthruMobilePackage.java ### iOS RNCarnival.h -> RNSailthruMobile.h RNCarnival.m -> RNSailthruMobile.m RNCarnivalBridge.h -> RNSailthruMobileBridge.h RNCarnivalBridge.m -> RNSailthruMobileBridge.m You will need to copy the new rebranded classes into your project from `node_modules/react-native-sailthru-mobile`. Once you have done this you will need to change your Podfile to point to the new `SailthruMobile` pod rather than `Carnival` in order for your app to compile. See the iOS [Cocoapods](#Cocoapods) section for details. You should either use the SailthruMobile bridge/module or the Carnival bridge/module in your app. The `index.js` file will pick up whichever bridge you are exporting and populate it accordingly. [block:callout] { "type": "info", "title": "Note", "body": "You should have **either** RNCarnival and RNCarnivalBridge **or** RNSailthruMobile and RNSailthruMobileBridge in your app. If you are using the RNCarnival classes you will need to use the Carnival pod in your Podfile. If you are using the RNSailthruMobile classes you will need to use the SailthruMobile pod." } [/block]