react-native-acoustic-mobile-push-inbox-beta 3.8.12
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +45 -0
- package/android/android-react-native-acoustic-mobile-push-inbox.iml +217 -0
- package/android/build.gradle +41 -0
- package/android/react-native-acoustic-mobile-push-inbox.iml +218 -0
- package/android/src/main/AndroidManifest.xml +3 -0
- package/android/src/main/java/co/acoustic/mobile/push/plugin/inbox/RNAcousticMobilePushBroadcastReceiver.java +114 -0
- package/android/src/main/java/co/acoustic/mobile/push/plugin/inbox/RNAcousticMobilePushInboxModule.java +630 -0
- package/android/src/main/java/co/acoustic/mobile/push/plugin/inbox/RNAcousticMobilePushInboxPackage.java +37 -0
- package/android/src/main/res/drawable-hdpi/ic_action_back.png +0 -0
- package/android/src/main/res/drawable-hdpi/ic_action_forward.png +0 -0
- package/android/src/main/res/drawable-mdpi/ic_action_back.png +0 -0
- package/android/src/main/res/drawable-mdpi/ic_action_forward.png +0 -0
- package/android/src/main/res/drawable-xhdpi/ic_action_back.png +0 -0
- package/android/src/main/res/drawable-xhdpi/ic_action_forward.png +0 -0
- package/android/src/main/res/drawable-xxhdpi/ic_action_back.png +0 -0
- package/android/src/main/res/drawable-xxhdpi/ic_action_forward.png +0 -0
- package/android/src/main/res/layout/activity_action_webview.xml +10 -0
- package/android/src/main/res/menu/menu_action_webview.xml +19 -0
- package/android/src/main/res/values/mce-plugin-displayweb-strings.xml +5 -0
- package/ios/RNAcousticMobilePushInbox.h +22 -0
- package/ios/RNAcousticMobilePushInbox.m +288 -0
- package/ios/RNAcousticMobilePushInbox.xcodeproj/project.pbxproj +278 -0
- package/ios/RNAcousticMobilePushInbox.xcodeproj/project.xcworkspace/contents.xcworkspacedata +7 -0
- package/ios/RNAcousticMobilePushInbox.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist +8 -0
- package/ios/RNAcousticMobilePushInbox.xcodeproj/project.xcworkspace/xcuserdata/buchmanj.xcuserdatad/UserInterfaceState.xcuserstate +0 -0
- package/ios/RNAcousticMobilePushInbox.xcodeproj/xcshareddata/xcschemes/RNAcousticMobilePushInbox.xcscheme +67 -0
- package/ios/RNAcousticMobilePushInbox.xcodeproj/xcuserdata/buchmanj.xcuserdatad/xcschemes/xcschememanagement.plist +32 -0
- package/ios/RNAcousticMobilePushInbox.xcworkspace/contents.xcworkspacedata +9 -0
- package/javascript/default-inbox-template.js +67 -0
- package/javascript/full-width-image.js +62 -0
- package/javascript/full-width-video.js +66 -0
- package/javascript/inbox-action.js +68 -0
- package/javascript/inbox-list-item.js +26 -0
- package/javascript/inbox-message-view.js +27 -0
- package/javascript/inbox-template-registry.js +57 -0
- package/javascript/post-inbox-template.js +84 -0
- package/package.json +39 -0
- package/postinstall.js +103 -0
- package/react-native-acoustic-mobile-push-inbox.podspec +23 -0
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
|
2
|
+
<Scheme
|
|
3
|
+
LastUpgradeVersion = "1120"
|
|
4
|
+
version = "1.3">
|
|
5
|
+
<BuildAction
|
|
6
|
+
parallelizeBuildables = "YES"
|
|
7
|
+
buildImplicitDependencies = "YES">
|
|
8
|
+
<BuildActionEntries>
|
|
9
|
+
<BuildActionEntry
|
|
10
|
+
buildForTesting = "YES"
|
|
11
|
+
buildForRunning = "YES"
|
|
12
|
+
buildForProfiling = "YES"
|
|
13
|
+
buildForArchiving = "YES"
|
|
14
|
+
buildForAnalyzing = "YES">
|
|
15
|
+
<BuildableReference
|
|
16
|
+
BuildableIdentifier = "primary"
|
|
17
|
+
BlueprintIdentifier = "58B511DA1A9E6C8500147676"
|
|
18
|
+
BuildableName = "libRNAcousticMobilePushInbox.a"
|
|
19
|
+
BlueprintName = "RNAcousticMobilePushInbox"
|
|
20
|
+
ReferencedContainer = "container:RNAcousticMobilePushInbox.xcodeproj">
|
|
21
|
+
</BuildableReference>
|
|
22
|
+
</BuildActionEntry>
|
|
23
|
+
</BuildActionEntries>
|
|
24
|
+
</BuildAction>
|
|
25
|
+
<TestAction
|
|
26
|
+
buildConfiguration = "Debug"
|
|
27
|
+
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
|
|
28
|
+
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
|
|
29
|
+
shouldUseLaunchSchemeArgsEnv = "YES">
|
|
30
|
+
<Testables>
|
|
31
|
+
</Testables>
|
|
32
|
+
</TestAction>
|
|
33
|
+
<LaunchAction
|
|
34
|
+
buildConfiguration = "Debug"
|
|
35
|
+
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
|
|
36
|
+
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
|
|
37
|
+
launchStyle = "0"
|
|
38
|
+
useCustomWorkingDirectory = "NO"
|
|
39
|
+
ignoresPersistentStateOnLaunch = "NO"
|
|
40
|
+
debugDocumentVersioning = "YES"
|
|
41
|
+
debugServiceExtension = "internal"
|
|
42
|
+
allowLocationSimulation = "YES">
|
|
43
|
+
</LaunchAction>
|
|
44
|
+
<ProfileAction
|
|
45
|
+
buildConfiguration = "Release"
|
|
46
|
+
shouldUseLaunchSchemeArgsEnv = "YES"
|
|
47
|
+
savedToolIdentifier = ""
|
|
48
|
+
useCustomWorkingDirectory = "NO"
|
|
49
|
+
debugDocumentVersioning = "YES">
|
|
50
|
+
<MacroExpansion>
|
|
51
|
+
<BuildableReference
|
|
52
|
+
BuildableIdentifier = "primary"
|
|
53
|
+
BlueprintIdentifier = "58B511DA1A9E6C8500147676"
|
|
54
|
+
BuildableName = "libRNAcousticMobilePushInbox.a"
|
|
55
|
+
BlueprintName = "RNAcousticMobilePushInbox"
|
|
56
|
+
ReferencedContainer = "container:RNAcousticMobilePushInbox.xcodeproj">
|
|
57
|
+
</BuildableReference>
|
|
58
|
+
</MacroExpansion>
|
|
59
|
+
</ProfileAction>
|
|
60
|
+
<AnalyzeAction
|
|
61
|
+
buildConfiguration = "Debug">
|
|
62
|
+
</AnalyzeAction>
|
|
63
|
+
<ArchiveAction
|
|
64
|
+
buildConfiguration = "Release"
|
|
65
|
+
revealArchiveInOrganizer = "YES">
|
|
66
|
+
</ArchiveAction>
|
|
67
|
+
</Scheme>
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
|
2
|
+
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
|
3
|
+
<plist version="1.0">
|
|
4
|
+
<dict>
|
|
5
|
+
<key>SchemeUserState</key>
|
|
6
|
+
<dict>
|
|
7
|
+
<key>RNAcousticMobilePushInbox.xcscheme_^#shared#^_</key>
|
|
8
|
+
<dict>
|
|
9
|
+
<key>orderHint</key>
|
|
10
|
+
<integer>5</integer>
|
|
11
|
+
</dict>
|
|
12
|
+
<key>RNIbmMobilePushCalendar 2.xcscheme_^#shared#^_</key>
|
|
13
|
+
<dict>
|
|
14
|
+
<key>orderHint</key>
|
|
15
|
+
<integer>1</integer>
|
|
16
|
+
</dict>
|
|
17
|
+
<key>RNIbmMobilePushCalendarCalendar.xcscheme_^#shared#^_</key>
|
|
18
|
+
<dict>
|
|
19
|
+
<key>orderHint</key>
|
|
20
|
+
<integer>48</integer>
|
|
21
|
+
</dict>
|
|
22
|
+
</dict>
|
|
23
|
+
<key>SuppressBuildableAutocreation</key>
|
|
24
|
+
<dict>
|
|
25
|
+
<key>58B511DA1A9E6C8500147676</key>
|
|
26
|
+
<dict>
|
|
27
|
+
<key>primary</key>
|
|
28
|
+
<true/>
|
|
29
|
+
</dict>
|
|
30
|
+
</dict>
|
|
31
|
+
</dict>
|
|
32
|
+
</plist>
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright © 2019, 2023 Acoustic, L.P. All rights reserved.
|
|
3
|
+
*
|
|
4
|
+
* NOTICE: This file contains material that is confidential and proprietary to
|
|
5
|
+
* Acoustic, L.P. and/or other developers. No license is granted under any intellectual or
|
|
6
|
+
* industrial property rights of Acoustic, L.P. except as may be provided in an agreement with
|
|
7
|
+
* Acoustic, L.P. Any unauthorized copying or distribution of content from this file is
|
|
8
|
+
* prohibited.
|
|
9
|
+
*/
|
|
10
|
+
|
|
11
|
+
'use strict';
|
|
12
|
+
import React from 'react';
|
|
13
|
+
import InboxTemplateRegistry from './inbox-template-registry';
|
|
14
|
+
import { ListItem } from 'react-native-elements'
|
|
15
|
+
import { Text, View } from 'react-native';
|
|
16
|
+
import { WebView } from 'react-native-webview';
|
|
17
|
+
import { RNAcousticMobilePushInbox } from 'NativeModules';
|
|
18
|
+
|
|
19
|
+
const instance = undefined;
|
|
20
|
+
Object.freeze(instance);
|
|
21
|
+
export default instance;
|
|
22
|
+
|
|
23
|
+
InboxTemplateRegistry.registerMessageViewRenderer('default', function (inboxMessage) {
|
|
24
|
+
var html = '<meta charset="UTF-8"><meta name="viewport" content="width=device-width, initial-scale=1 maximum-scale=1">' + inboxMessage.content.messageDetails.richContent;
|
|
25
|
+
|
|
26
|
+
return (
|
|
27
|
+
<View style={{ flex: 1, alignItems: 'stretch' }}>
|
|
28
|
+
<View style={{ padding: 8, borderBottomColor: "#dbdbdb", borderBottomWidth: 1 }}>
|
|
29
|
+
<Text style={{ color: inboxMessage.isExpired ? '#aaaaaa' : "#000000" }} numberOfLines={1}>{inboxMessage.content.messagePreview.subject}</Text>
|
|
30
|
+
{inboxMessage.isExpired ?
|
|
31
|
+
(<Text numberOfLines={1} style={{ color: 'red' }}>Expired: {new Date(inboxMessage.expirationDate).toLocaleString()}</Text>) :
|
|
32
|
+
(<Text numberOfLines={1} style={{ color: '#327BF7' }}>{new Date(inboxMessage.sendDate).toLocaleString()}</Text>)
|
|
33
|
+
}
|
|
34
|
+
</View>
|
|
35
|
+
<WebView onShouldStartLoadWithRequest={(nav) => {
|
|
36
|
+
if (nav.url.startsWith("actionid:")) {
|
|
37
|
+
var identifier = nav.url.slice(9);
|
|
38
|
+
var action = inboxMessage.content.actions[identifier];
|
|
39
|
+
RNAcousticMobilePushInbox.clickInboxAction(action, inboxMessage.inboxMessageId);
|
|
40
|
+
return false;
|
|
41
|
+
}
|
|
42
|
+
return true;
|
|
43
|
+
}} startInLoadingState={true} style={{ padding: 0, width: '100%', height: '100%' }} originWhitelist={['*']} source={{ html: html }} />
|
|
44
|
+
|
|
45
|
+
</View>
|
|
46
|
+
);
|
|
47
|
+
});
|
|
48
|
+
|
|
49
|
+
InboxTemplateRegistry.registerListItemRenderer('default', function (inboxMessage) {
|
|
50
|
+
|
|
51
|
+
return (
|
|
52
|
+
<ListItem
|
|
53
|
+
chevron
|
|
54
|
+
title={inboxMessage.content.messagePreview.subject}
|
|
55
|
+
titleStyle={{ fontWeight: inboxMessage.isRead ? "normal" : "bold", color: inboxMessage.isExpired ? '#aaaaaa' : "#000000" }}
|
|
56
|
+
titleProps={{ numberOfLines: 1 }}
|
|
57
|
+
subtitle={inboxMessage.content.messagePreview.previewContent}
|
|
58
|
+
subtitleStyle={{ color: inboxMessage.isExpired ? '#aaaaaa' : "#000000" }}
|
|
59
|
+
subtitleProps={{ numberOfLines: 1 }}
|
|
60
|
+
rightElement={
|
|
61
|
+
inboxMessage.isExpired ?
|
|
62
|
+
(<Text style={{ color: 'red' }}>Expired: {new Date(inboxMessage.expirationDate).toLocaleDateString()}</Text>) :
|
|
63
|
+
(<Text style={{ color: '#327BF7' }}>{new Date(inboxMessage.sendDate).toLocaleDateString()}</Text>)
|
|
64
|
+
}
|
|
65
|
+
/>
|
|
66
|
+
);
|
|
67
|
+
});
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright © 2019, 2023 Acoustic, L.P. All rights reserved.
|
|
3
|
+
*
|
|
4
|
+
* NOTICE: This file contains material that is confidential and proprietary to
|
|
5
|
+
* Acoustic, L.P. and/or other developers. No license is granted under any intellectual or
|
|
6
|
+
* industrial property rights of Acoustic, L.P. except as may be provided in an agreement with
|
|
7
|
+
* Acoustic, L.P. Any unauthorized copying or distribution of content from this file is
|
|
8
|
+
* prohibited.
|
|
9
|
+
*/
|
|
10
|
+
|
|
11
|
+
'use strict';
|
|
12
|
+
import {View, Image} from 'react-native';
|
|
13
|
+
import React, {Component} from 'react';
|
|
14
|
+
|
|
15
|
+
export default class FullWidthImage extends Component {
|
|
16
|
+
constructor() {
|
|
17
|
+
super();
|
|
18
|
+
|
|
19
|
+
this.state = {
|
|
20
|
+
width: 0,
|
|
21
|
+
height: 0
|
|
22
|
+
};
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
onLayout(event) {
|
|
26
|
+
const containerWidth = event.nativeEvent.layout.width;
|
|
27
|
+
|
|
28
|
+
if (this.props.ratio) {
|
|
29
|
+
this.setState({
|
|
30
|
+
width: containerWidth,
|
|
31
|
+
height: containerWidth * this.props.ratio
|
|
32
|
+
});
|
|
33
|
+
} else if (typeof this.props.source === 'number') {
|
|
34
|
+
const source = resolveAssetSource(this.props.source);
|
|
35
|
+
|
|
36
|
+
this.setState({
|
|
37
|
+
width: containerWidth,
|
|
38
|
+
height: containerWidth * source.height / source.width
|
|
39
|
+
});
|
|
40
|
+
} else if (typeof this.props.source === 'object') {
|
|
41
|
+
Image.getSize(this.props.source.uri, (width, height) => {
|
|
42
|
+
this.setState({
|
|
43
|
+
width: containerWidth,
|
|
44
|
+
height: containerWidth * height / width
|
|
45
|
+
});
|
|
46
|
+
});
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
render() {
|
|
51
|
+
return (
|
|
52
|
+
<View onLayout={this.onLayout.bind(this)}>
|
|
53
|
+
<Image
|
|
54
|
+
source={this.props.source}
|
|
55
|
+
style={{
|
|
56
|
+
width: this.state.width,
|
|
57
|
+
height: this.state.height
|
|
58
|
+
}} />
|
|
59
|
+
</View>
|
|
60
|
+
);
|
|
61
|
+
}
|
|
62
|
+
}
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright © 2019, 2023 Acoustic, L.P. All rights reserved.
|
|
3
|
+
*
|
|
4
|
+
* NOTICE: This file contains material that is confidential and proprietary to
|
|
5
|
+
* Acoustic, L.P. and/or other developers. No license is granted under any intellectual or
|
|
6
|
+
* industrial property rights of Acoustic, L.P. except as may be provided in an agreement with
|
|
7
|
+
* Acoustic, L.P. Any unauthorized copying or distribution of content from this file is
|
|
8
|
+
* prohibited.
|
|
9
|
+
*/
|
|
10
|
+
|
|
11
|
+
'use strict';
|
|
12
|
+
import {View, Platform, TouchableNativeFeedback, TouchableOpacity} from 'react-native';
|
|
13
|
+
import Video from 'react-native-video';
|
|
14
|
+
import React, {Component} from 'react';
|
|
15
|
+
const Touchable = Platform.OS === 'android' ? TouchableNativeFeedback : TouchableOpacity;
|
|
16
|
+
|
|
17
|
+
export default class FullWidthVideo extends Component {
|
|
18
|
+
constructor() {
|
|
19
|
+
super();
|
|
20
|
+
|
|
21
|
+
this.state = {
|
|
22
|
+
containerWidth: 0,
|
|
23
|
+
width: 1,
|
|
24
|
+
height: 1,
|
|
25
|
+
videoPaused: false
|
|
26
|
+
};
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
onLayout(event) {
|
|
30
|
+
const containerWidth = event.nativeEvent.layout.width;
|
|
31
|
+
this.setState({containerWidth:containerWidth});
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
onLoad(response) {
|
|
35
|
+
const { width, height } = response.naturalSize;
|
|
36
|
+
this.setState({width: width, height: height, videoPaused: true});
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
onPress() {
|
|
40
|
+
this.setState({ videoPaused: !this.state.videoPaused});
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
componentWillUnmount() {
|
|
44
|
+
this.setState({ videoPaused: true });
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
render() {
|
|
48
|
+
const heightScaled = this.state.height * (this.state.containerWidth / this.state.width);
|
|
49
|
+
return (
|
|
50
|
+
<View onLayout={this.onLayout.bind(this)}>
|
|
51
|
+
<Touchable accessibilityRole="button" onPress={this.onPress.bind(this)}>
|
|
52
|
+
<Video
|
|
53
|
+
controls={true}
|
|
54
|
+
style={{
|
|
55
|
+
width: this.state.containerWidth,
|
|
56
|
+
height: heightScaled
|
|
57
|
+
}}
|
|
58
|
+
resizeMode='cover'
|
|
59
|
+
paused={this.state.videoPaused}
|
|
60
|
+
onLoad={this.onLoad.bind(this)}
|
|
61
|
+
source={this.props.source} />
|
|
62
|
+
</Touchable>
|
|
63
|
+
</View>
|
|
64
|
+
)
|
|
65
|
+
}
|
|
66
|
+
}
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright © 2019, 2023 Acoustic, L.P. All rights reserved.
|
|
3
|
+
*
|
|
4
|
+
* NOTICE: This file contains material that is confidential and proprietary to
|
|
5
|
+
* Acoustic, L.P. and/or other developers. No license is granted under any intellectual or
|
|
6
|
+
* industrial property rights of Acoustic, L.P. except as may be provided in an agreement with
|
|
7
|
+
* Acoustic, L.P. Any unauthorized copying or distribution of content from this file is
|
|
8
|
+
* prohibited.
|
|
9
|
+
*/
|
|
10
|
+
|
|
11
|
+
/*
|
|
12
|
+
Add API docs for:
|
|
13
|
+
registerInbox(module)
|
|
14
|
+
hideInbox()
|
|
15
|
+
Android Support
|
|
16
|
+
*/
|
|
17
|
+
|
|
18
|
+
'use strict';
|
|
19
|
+
import {AppRegistry, View, Animated, SafeAreaView, Platform, TouchableNativeFeedback, TouchableOpacity} from 'react-native';
|
|
20
|
+
import {RNAcousticMobilePushInbox} from 'NativeModules';
|
|
21
|
+
import React from 'react';
|
|
22
|
+
import {InboxMessageView} from './inbox-message-view';
|
|
23
|
+
import {Button} from 'react-native-elements';
|
|
24
|
+
import Icon from 'react-native-vector-icons/Ionicons';
|
|
25
|
+
const Touchable = Platform.OS === 'android' ? TouchableNativeFeedback : TouchableOpacity;
|
|
26
|
+
|
|
27
|
+
export class InboxAction extends React.Component {
|
|
28
|
+
constructor(props) {
|
|
29
|
+
super(props);
|
|
30
|
+
this.state = {
|
|
31
|
+
inboxMessage: props.message
|
|
32
|
+
}
|
|
33
|
+
this.state.animation = new Animated.Value(0);
|
|
34
|
+
RNAcousticMobilePushInbox.readInboxMessage(this.state.inboxMessage.inboxMessageId);
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
hide() {
|
|
38
|
+
Animated.timing(this.state.animation, {toValue: 0, duration: 500}).start((finished) => { RNAcousticMobilePushInbox.hideInbox(); });
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
show() {
|
|
42
|
+
Animated.timing(this.state.animation, {toValue: 1, duration: 500}).start();
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
componentDidMount() {
|
|
46
|
+
this.show();
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
render() {
|
|
50
|
+
return (
|
|
51
|
+
<Animated.View style={{ height: '100%', width: '100%', opacity: this.state.animation, backgroundColor: "#ffffff" }}>
|
|
52
|
+
<SafeAreaView style={{height: "100%", width: "100%"}}>
|
|
53
|
+
<View style={{width: '100%', height: '100%'}}>
|
|
54
|
+
<View style={{backgroundColor: "#dddddd"}}>
|
|
55
|
+
<Touchable onPress={()=>{this.hide();}}>
|
|
56
|
+
<Icon name="ios-close-circle" color="#000" size={24} style={{alignSelf: "flex-end", padding: 10}} />
|
|
57
|
+
</Touchable>
|
|
58
|
+
</View>
|
|
59
|
+
<InboxMessageView inboxMessage={this.state.inboxMessage} />
|
|
60
|
+
</View>
|
|
61
|
+
</SafeAreaView>
|
|
62
|
+
</Animated.View>
|
|
63
|
+
);
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
AppRegistry.registerComponent("InboxAction", () => InboxAction);
|
|
68
|
+
RNAcousticMobilePushInbox.registerInboxComponent("InboxAction");
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright © 2019, 2023 Acoustic, L.P. All rights reserved.
|
|
3
|
+
*
|
|
4
|
+
* NOTICE: This file contains material that is confidential and proprietary to
|
|
5
|
+
* Acoustic, L.P. and/or other developers. No license is granted under any intellectual or
|
|
6
|
+
* industrial property rights of Acoustic, L.P. except as may be provided in an agreement with
|
|
7
|
+
* Acoustic, L.P. Any unauthorized copying or distribution of content from this file is
|
|
8
|
+
* prohibited.
|
|
9
|
+
*/
|
|
10
|
+
|
|
11
|
+
'use strict';
|
|
12
|
+
import React from 'react';
|
|
13
|
+
import InboxTemplateRegistry from './inbox-template-registry';
|
|
14
|
+
|
|
15
|
+
export default class InboxListItem extends React.Component {
|
|
16
|
+
constructor(props) {
|
|
17
|
+
super(props);
|
|
18
|
+
this.state = {
|
|
19
|
+
inboxMessage: props.inboxMessage,
|
|
20
|
+
};
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
render() {
|
|
24
|
+
return InboxTemplateRegistry.renderListItem(this.state.inboxMessage);
|
|
25
|
+
}
|
|
26
|
+
}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright © 2019, 2023 Acoustic, L.P. All rights reserved.
|
|
3
|
+
*
|
|
4
|
+
* NOTICE: This file contains material that is confidential and proprietary to
|
|
5
|
+
* Acoustic, L.P. and/or other developers. No license is granted under any intellectual or
|
|
6
|
+
* industrial property rights of Acoustic, L.P. except as may be provided in an agreement with
|
|
7
|
+
* Acoustic, L.P. Any unauthorized copying or distribution of content from this file is
|
|
8
|
+
* prohibited.
|
|
9
|
+
*/
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
'use strict';
|
|
13
|
+
import React from 'react';
|
|
14
|
+
import InboxTemplateRegistry from './inbox-template-registry';
|
|
15
|
+
|
|
16
|
+
export class InboxMessageView extends React.Component {
|
|
17
|
+
constructor(props) {
|
|
18
|
+
super(props);
|
|
19
|
+
this.state = {
|
|
20
|
+
inboxMessage: props.inboxMessage,
|
|
21
|
+
};
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
render() {
|
|
25
|
+
return InboxTemplateRegistry.renderMessageView(this.state.inboxMessage);
|
|
26
|
+
}
|
|
27
|
+
}
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright © 2019, 2023 Acoustic, L.P. All rights reserved.
|
|
3
|
+
*
|
|
4
|
+
* NOTICE: This file contains material that is confidential and proprietary to
|
|
5
|
+
* Acoustic, L.P. and/or other developers. No license is granted under any intellectual or
|
|
6
|
+
* industrial property rights of Acoustic, L.P. except as may be provided in an agreement with
|
|
7
|
+
* Acoustic, L.P. Any unauthorized copying or distribution of content from this file is
|
|
8
|
+
* prohibited.
|
|
9
|
+
*/
|
|
10
|
+
|
|
11
|
+
"use strict";
|
|
12
|
+
import React from 'react';
|
|
13
|
+
import {Text} from 'react-native';
|
|
14
|
+
|
|
15
|
+
class InboxTemplateRegistry {
|
|
16
|
+
constructor() {
|
|
17
|
+
if(! InboxTemplateRegistry.instance) {
|
|
18
|
+
this.messageViewRenderers = {};
|
|
19
|
+
this.listItemRenderers = {};
|
|
20
|
+
InboxTemplateRegistry.instance = this;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
return InboxTemplateRegistry.instance;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
registerMessageViewRenderer(templateName, renderer) {
|
|
27
|
+
this.messageViewRenderers[templateName] = renderer;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
registerListItemRenderer(templateName, renderer) {
|
|
31
|
+
this.listItemRenderers[templateName] = renderer;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
renderListItem(inboxMessage) {
|
|
35
|
+
const renderer = this.listItemRenderers[inboxMessage.templateName];
|
|
36
|
+
if(typeof(renderer) == "undefined") {
|
|
37
|
+
return (
|
|
38
|
+
<Text>List item renderer not definied for template named: {inboxMessage.templateName}</Text>
|
|
39
|
+
);
|
|
40
|
+
}
|
|
41
|
+
return renderer(inboxMessage);
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
renderMessageView(inboxMessage) {
|
|
45
|
+
const renderer = this.messageViewRenderers[inboxMessage.templateName];
|
|
46
|
+
if(typeof(renderer) == "undefined") {
|
|
47
|
+
return (
|
|
48
|
+
<Text>Message View renderer not definied for template named: {inboxMessage.templateName}</Text>
|
|
49
|
+
);
|
|
50
|
+
}
|
|
51
|
+
return renderer(inboxMessage);
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
const instance = new InboxTemplateRegistry();
|
|
55
|
+
Object.freeze(instance);
|
|
56
|
+
|
|
57
|
+
export default instance;
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright © 2019, 2023 Acoustic, L.P. All rights reserved.
|
|
3
|
+
*
|
|
4
|
+
* NOTICE: This file contains material that is confidential and proprietary to
|
|
5
|
+
* Acoustic, L.P. and/or other developers. No license is granted under any intellectual or
|
|
6
|
+
* industrial property rights of Acoustic, L.P. except as may be provided in an agreement with
|
|
7
|
+
* Acoustic, L.P. Any unauthorized copying or distribution of content from this file is
|
|
8
|
+
* prohibited.
|
|
9
|
+
*/
|
|
10
|
+
|
|
11
|
+
'use strict';
|
|
12
|
+
import InboxTemplateRegistry from './inbox-template-registry';
|
|
13
|
+
import { Text, View, Image, Button, ScrollView } from 'react-native';
|
|
14
|
+
import { RNAcousticMobilePushInbox } from 'NativeModules';
|
|
15
|
+
import React from 'react';
|
|
16
|
+
import FullWidthImage from './full-width-image';
|
|
17
|
+
import FullWidthVideo from './full-width-video';
|
|
18
|
+
|
|
19
|
+
const instance = undefined;
|
|
20
|
+
Object.freeze(instance);
|
|
21
|
+
export default instance;
|
|
22
|
+
|
|
23
|
+
function render(inboxMessage, full) {
|
|
24
|
+
var contentVideo = (<View />);
|
|
25
|
+
if (typeof (inboxMessage.content.contentVideo) != 'undefined') {
|
|
26
|
+
contentVideo = (<FullWidthVideo source={{ uri: inboxMessage.content.contentVideo }} />);
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
var contentImage = (<View />);
|
|
30
|
+
if (typeof (inboxMessage.content.contentImage) != 'undefined') {
|
|
31
|
+
contentImage = (<FullWidthImage source={{ uri: inboxMessage.content.contentImage }} />);
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
var contentText = (<View />);
|
|
35
|
+
if (typeof (inboxMessage.content.contentText) != 'undefined') {
|
|
36
|
+
contentText = (<Text style={{ paddingTop: 8 }} numberOfLines={full ? 0 : 2}>{inboxMessage.content.contentText}</Text>);
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
var contentActions = (<View />);
|
|
40
|
+
|
|
41
|
+
function action(action, index) {
|
|
42
|
+
if (typeof (action) == "string") {
|
|
43
|
+
action = JSON.parse(action);
|
|
44
|
+
}
|
|
45
|
+
return (<Button onPress={() => {
|
|
46
|
+
RNAcousticMobilePushInbox.clickInboxAction(action, inboxMessage.inboxMessageId);
|
|
47
|
+
}} key={`${action.name} - ${index}`} title={action.name} />);
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
if (typeof (inboxMessage.content.actions) != "undefined") {
|
|
51
|
+
var actions = [];
|
|
52
|
+
for (var i = 0; i < inboxMessage.content.actions.length; i++) {
|
|
53
|
+
actions.push(action(inboxMessage.content.actions[i], i))
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
contentActions = (<View style={{ paddingTop: 8, flex: 1, flexDirection: "row", justifyContent: 'space-evenly' }}>{actions}</View>);
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
return (
|
|
60
|
+
<ScrollView>
|
|
61
|
+
<View style={{ padding: 16, flex: 1, flexDirection: "column", justifyContent: "flex-start" }}>
|
|
62
|
+
<View style={{ height: 50, flex: 1, flexDirection: "row", paddingBottom: 8 }}>
|
|
63
|
+
<Image resizeMode="cover" style={{ width: 50, height: 50 }} source={{ uri: inboxMessage.content.headerImage }} />
|
|
64
|
+
<View style={{ height: 50, flex: 1, paddingLeft: 8, flexDirection: "column", justifyContent: 'space-evenly' }}>
|
|
65
|
+
<Text numberOfLines={1} style={{ fontWeight: inboxMessage.isRead ? "normal" : "bold" }}>{inboxMessage.content.header}</Text>
|
|
66
|
+
<Text numberOfLines={1}>{inboxMessage.content.subHeader}</Text>
|
|
67
|
+
</View>
|
|
68
|
+
</View>
|
|
69
|
+
{contentVideo}
|
|
70
|
+
{contentImage}
|
|
71
|
+
{contentText}
|
|
72
|
+
{contentActions}
|
|
73
|
+
</View>
|
|
74
|
+
</ScrollView>
|
|
75
|
+
);
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
InboxTemplateRegistry.registerMessageViewRenderer('post', function (inboxMessage) {
|
|
79
|
+
return render(inboxMessage, true);
|
|
80
|
+
});
|
|
81
|
+
|
|
82
|
+
InboxTemplateRegistry.registerListItemRenderer('post', function (inboxMessage) {
|
|
83
|
+
return render(inboxMessage, false);
|
|
84
|
+
});
|
package/package.json
ADDED
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
{
|
|
2
|
+
"author": "Acoustic, L.P.",
|
|
3
|
+
"dependencies": {
|
|
4
|
+
"chalk": "^2.4.2",
|
|
5
|
+
"ncp": "^2.0.0",
|
|
6
|
+
"plist": "^3.0.1",
|
|
7
|
+
"xcode": "^2.0.0",
|
|
8
|
+
"xml2js": "^0.4.19"
|
|
9
|
+
},
|
|
10
|
+
"description": "BETA: Acoustic Mobile Push Inbox Content Plugin",
|
|
11
|
+
"devDependencies": {
|
|
12
|
+
"jetifier": "^1.6.3"
|
|
13
|
+
},
|
|
14
|
+
"homepage": "https://github.com/aipoweredmarketer/ca-mce-react-native",
|
|
15
|
+
"keywords": [
|
|
16
|
+
"react-native",
|
|
17
|
+
"ios",
|
|
18
|
+
"android",
|
|
19
|
+
"mobile push inbox content",
|
|
20
|
+
"Campaign"
|
|
21
|
+
],
|
|
22
|
+
"license": "See license in ../../../license.txt",
|
|
23
|
+
"main": "index.js",
|
|
24
|
+
"name": "react-native-acoustic-mobile-push-inbox-beta",
|
|
25
|
+
"peerDependencies": {
|
|
26
|
+
"react-native-acoustic-mobile-push-beta": "3.8.12"
|
|
27
|
+
},
|
|
28
|
+
"repository": {
|
|
29
|
+
"directory": "plugins/react-native-acoustic-mobile-push-inbox",
|
|
30
|
+
"type": "git",
|
|
31
|
+
"url": "https://github.com/aipoweredmarketer/ca-mce-react-native"
|
|
32
|
+
},
|
|
33
|
+
"scripts": {
|
|
34
|
+
"postinstall": "node postinstall.js $INIT_CWD",
|
|
35
|
+
"test": "echo \"Error: no test specified\" && exit 1"
|
|
36
|
+
},
|
|
37
|
+
"summary": "react-native ios android mobile push Campaign",
|
|
38
|
+
"version": "3.8.12"
|
|
39
|
+
}
|