Skip to content

Commit

Permalink
Pull request #18: SDKs versions bumped, activate for android added
Browse files Browse the repository at this point in the history
Merge in MML/infobip-mobile-messaging-react-native-plugin from okoroleva_MM-4162_AndroidActivatingChat to master

Squashed commit of the following:

commit 009eb7bb0cac5111041e4ca559d6f4da15b80a12
Author: Olga Koroleva <[email protected]>
Date:   Fri Oct 16 14:30:07 2020 +0300

    package-lock

commit ab9f80c0b97bb101e03b0420f186249dfda72d97
Author: Olga Koroleva <[email protected]>
Date:   Fri Oct 16 14:25:26 2020 +0300

    Example aligned with changes in chat module, fixes

commit 620369ab96f91f49be99e805ae3455ab67617698
Merge: 5363932 61b0c9e
Author: Olga Koroleva <[email protected]>
Date:   Thu Oct 15 22:23:27 2020 +0300

    Merge branch 'master' into okoroleva_MM-4162_AndroidActivatingChat

commit 53639324f034870b43e3d89a404690c4b57aec8e
Author: Olga Koroleva <[email protected]>
Date:   Mon Oct 12 16:10:46 2020 +0300

    fix for Xcode 12 Carthage issue for iOS Simulator

commit 08e695dee1e7adf8b7b09edf777abe285d240d04
Author: Olga Koroleva <[email protected]>
Date:   Mon Oct 12 16:07:08 2020 +0300

    SDKs versions bumped, activate for android added
  • Loading branch information
riskpp committed Oct 16, 2020
1 parent 61b0c9e commit b483630
Show file tree
Hide file tree
Showing 16 changed files with 313 additions and 201 deletions.
65 changes: 61 additions & 4 deletions Example/App.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import * as React from 'react';
import {StyleSheet, View, Text, Button} from 'react-native';
import {NavigationContainer} from '@react-navigation/native';
import {createStackNavigator} from '@react-navigation/stack';
import AsyncStorage from '@react-native-community/async-storage';

import {
mobileMessaging,
Expand Down Expand Up @@ -45,6 +46,61 @@ function homeScreen({navigation}) {
);
}

const myMessageStorage = {
save: function (messages) {
for (const [index, message] of messages.entries()) {
AsyncStorage.setItem(message.messageId, JSON.stringify(message));
}
console.log(
'[CustomStorage] Saving messages: ' + JSON.stringify(messages),
);
},

find: async function (messageId, callback) {
console.log('[CustomStorage] Find message: ' + messageId);
let message = await AsyncStorage.getItem(messageId);
if (message) {
console.log('[CustomStorage] Found message: ' + message);
callback(JSON.parse(message));
} else {
callback({});
}
},

findAll: function (callback) {
console.log('[CustomStorage] Find all');
this.getAllMessages(values => {
console.log(
'[CustomStorage] Find all messages result: ',
values.toString(),
);
callback(values);
});
},

start: function () {
console.log('[CustomStorage] Start');
},

stop: function () {
console.log('[CustomStorage] Stop');
},

getAllMessages(callback) {
try {
AsyncStorage.getAllKeys().then(keys => {
console.log('Then AllKeys: ', keys);
AsyncStorage.multiGet(keys).then(values => {
console.log('Then AllValues: ', values);
callback(values);
});
});
} catch (error) {
console.log('[CustomStorage] Error: ', error);
}
},
};

function chatScreen() {
return <ChatView style={{flex: 1}} sendButtonColor={'#FF0000'} />;
}
Expand Down Expand Up @@ -75,14 +131,15 @@ export default class App extends React.Component {
}

initMobileMessaging(): void {
mobileMessaging.init(
mobileMessaging.init(
{
applicationCode: '<Your Application Code>',
ios: {
notificationTypes: ['alert', 'badge', 'sound'],
logging: true,
notificationTypes: ['alert', 'badge', 'sound'],
logging: true,
},
inAppChatEnabled: true,
messageStorage: myMessageStorage,
inAppChatEnabled: true,
},
() => {
this.updateLogInfo('MobileMessaging started');
Expand Down
2 changes: 2 additions & 0 deletions Example/android/app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
package="com.example">

<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.CAMERA" />

<application
android:name=".MainApplication"
Expand Down
180 changes: 88 additions & 92 deletions Example/ios/Example.xcodeproj/project.pbxproj

Large diffs are not rendered by default.

24 changes: 16 additions & 8 deletions Example/ios/Example/Example.entitlements
Original file line number Diff line number Diff line change
@@ -1,12 +1,20 @@
<?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.security.application-groups</key>
<array>
<string>group.com.infobip.Example</string>
</array>
</dict>
<dict>
<key>aps-environment</key>
<string>development</string>
<key>com.apple.developer.icloud-container-identifiers</key>
<array/>
<key>com.apple.developer.icloud-services</key>
<array>
<string>CloudDocuments</string>
</array>
<key>com.apple.developer.ubiquity-container-identifiers</key>
<array/>
<key>com.apple.security.application-groups</key>
<array>
<string>group.com.infobip.Example</string>
</array>
</dict>
</plist>
126 changes: 67 additions & 59 deletions Example/ios/Example/Info.plist
Original file line number Diff line number Diff line change
@@ -1,63 +1,71 @@
<?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>CFBundleDevelopmentRegion</key>
<string>en</string>
<key>CFBundleDisplayName</key>
<string>Example</string>
<key>CFBundleExecutable</key>
<string>$(EXECUTABLE_NAME)</string>
<key>CFBundleIdentifier</key>
<string>$(PRODUCT_BUNDLE_IDENTIFIER)</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundleName</key>
<string>$(PRODUCT_NAME)</string>
<key>CFBundlePackageType</key>
<string>APPL</string>
<key>CFBundleShortVersionString</key>
<string>1.0</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleVersion</key>
<string>1</string>
<key>LSRequiresIPhoneOS</key>
<true/>
<key>NSAppTransportSecurity</key>
<dict>
<key>NSAllowsArbitraryLoads</key>
<true/>
<key>NSExceptionDomains</key>
<dict>
<key>localhost</key>
<dict>
<key>NSExceptionAllowsInsecureHTTPLoads</key>
<true/>
</dict>
</dict>
</dict>
<key>NSLocationWhenInUseUsageDescription</key>
<string/>
<key>UIBackgroundModes</key>
<array>
<string>remote-notification</string>
</array>
<key>UILaunchStoryboardName</key>
<string>LaunchScreen</string>
<key>UIRequiredDeviceCapabilities</key>
<array>
<string>armv7</string>
</array>
<key>UISupportedInterfaceOrientations</key>
<array>
<string>UIInterfaceOrientationPortrait</string>
<string>UIInterfaceOrientationLandscapeLeft</string>
<string>UIInterfaceOrientationLandscapeRight</string>
</array>
<key>UIViewControllerBasedStatusBarAppearance</key>
<false/>
<key>com.mobilemessaging.app_group</key>
<string>group.com.infobip.Example</string>
</dict>
<dict>
<key>CFBundleDevelopmentRegion</key>
<string>en</string>
<key>CFBundleDisplayName</key>
<string>Example</string>
<key>CFBundleExecutable</key>
<string>$(EXECUTABLE_NAME)</string>
<key>CFBundleIdentifier</key>
<string>$(PRODUCT_BUNDLE_IDENTIFIER)</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundleName</key>
<string>$(PRODUCT_NAME)</string>
<key>CFBundlePackageType</key>
<string>APPL</string>
<key>CFBundleShortVersionString</key>
<string>1.0</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleVersion</key>
<string>1</string>
<key>LSRequiresIPhoneOS</key>
<true/>
<key>NSAppTransportSecurity</key>
<dict>
<key>NSAllowsArbitraryLoads</key>
<true/>
<key>NSExceptionDomains</key>
<dict>
<key>localhost</key>
<dict>
<key>NSExceptionAllowsInsecureHTTPLoads</key>
<true/>
</dict>
</dict>
</dict>
<key>NSLocationWhenInUseUsageDescription</key>
<string></string>
<key>UIBackgroundModes</key>
<array>
<string>remote-notification</string>
</array>
<key>UILaunchStoryboardName</key>
<string>LaunchScreen</string>
<key>UIRequiredDeviceCapabilities</key>
<array>
<string>armv7</string>
</array>
<key>UISupportedInterfaceOrientations</key>
<array>
<string>UIInterfaceOrientationPortrait</string>
<string>UIInterfaceOrientationLandscapeLeft</string>
<string>UIInterfaceOrientationLandscapeRight</string>
</array>
<key>UIViewControllerBasedStatusBarAppearance</key>
<false/>
<key>com.mobilemessaging.app_group</key>
<string>group.com.infobip.Example</string>
<key>NSCameraUsageDescription</key>
<string>Example app would like to use your camera to be able to send captured photo and video attachments in the chat</string>
<key>NSMicrophoneUsageDescription</key>
<string>Example app would like to use microphone to be able to send attachments with audio in the chat</string>
<key>NSPhotoLibraryUsageDescription</key>
<string>Example app would like to use photo library to be able to send photos in the chat</string>
<key>NSPhotoLibraryAddUsageDescription</key>
<string>Example app would like to save chat attachments to photo library</string>
</dict>
</plist>
Original file line number Diff line number Diff line change
@@ -1,31 +1,31 @@
<?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>CFBundleDevelopmentRegion</key>
<string>$(DEVELOPMENT_LANGUAGE)</string>
<key>CFBundleDisplayName</key>
<string>MobileMessagingNotificationExtension</string>
<key>CFBundleExecutable</key>
<string>$(EXECUTABLE_NAME)</string>
<key>CFBundleIdentifier</key>
<string>$(PRODUCT_BUNDLE_IDENTIFIER)</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundleName</key>
<string>$(PRODUCT_NAME)</string>
<key>CFBundlePackageType</key>
<string>XPC!</string>
<key>CFBundleShortVersionString</key>
<string>1.0</string>
<key>CFBundleVersion</key>
<string>1</string>
<key>NSExtension</key>
<dict>
<key>NSExtensionPointIdentifier</key>
<string>com.apple.usernotifications.service</string>
<key>NSExtensionPrincipalClass</key>
<string>$(PRODUCT_MODULE_NAME).NotificationService</string>
</dict>
</dict>
<dict>
<key>CFBundleDevelopmentRegion</key>
<string>$(DEVELOPMENT_LANGUAGE)</string>
<key>CFBundleDisplayName</key>
<string>MobileMessagingNotificationExtension</string>
<key>CFBundleExecutable</key>
<string>$(EXECUTABLE_NAME)</string>
<key>CFBundleIdentifier</key>
<string>$(PRODUCT_BUNDLE_IDENTIFIER)</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundleName</key>
<string>$(PRODUCT_NAME)</string>
<key>CFBundlePackageType</key>
<string>XPC!</string>
<key>CFBundleShortVersionString</key>
<string>1.0</string>
<key>CFBundleVersion</key>
<string>1</string>
<key>NSExtension</key>
<dict>
<key>NSExtensionPointIdentifier</key>
<string>com.apple.usernotifications.service</string>
<key>NSExtensionPrincipalClass</key>
<string>$(PRODUCT_MODULE_NAME).NotificationService</string>
</dict>
</dict>
</plist>
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ class NotificationService: UNNotificationServiceExtension {
override func didReceive(_ request: UNNotificationRequest, withContentHandler contentHandler: @escaping (UNNotificationContent) -> Void) {
self.contentHandler = contentHandler
self.originalContent = request.content
MobileMessagingNotificationServiceExtension.startWithApplicationCode( <# Your Application Code #> )
MobileMessagingNotificationServiceExtension.startWithApplicationCode( <# Your Application Code #> )
MobileMessagingNotificationServiceExtension.didReceive(request, withContentHandler: contentHandler)
}

Expand Down
27 changes: 24 additions & 3 deletions Example/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion Example/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,11 @@
"lint": "eslint ."
},
"dependencies": {
"@react-native-community/async-storage": "^1.12.1",
"@react-native-community/masked-view": "^0.1.10",
"@react-navigation/native": "^5.5.0",
"@react-navigation/stack": "^5.4.1",
"infobip-mobile-messaging-react-native-plugin": "^2.1.1",
"infobip-mobile-messaging-react-native-plugin": "^2.1.2",
"react": "16.11.0",
"react-native": "0.62.2",
"react-native-gesture-handler": "^1.6.1",
Expand Down
Loading

0 comments on commit b483630

Please sign in to comment.