Skip to content

Commit 489636e

Browse files
authored
Merge pull request #20 from ccm-innovation/0.2.0-rc2
0.2.0
2 parents 19c72ac + f6897e1 commit 489636e

File tree

75 files changed

+2235
-984
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

75 files changed

+2235
-984
lines changed

.gitignore

Lines changed: 29 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,29 @@
1-
example/ios/Pods
2-
*.xcuserstate
1+
# ios
2+
Example/ios/Pods
3+
*.xcuserstate
4+
5+
# android
6+
*.iml
7+
android/.gradle
8+
android/local.properties
9+
android/.idea
10+
android/.idea
11+
android/build
12+
android/app/build
13+
android/gradle
14+
android/captures
15+
16+
# android example
17+
Example/android/.gradle
18+
Example/android/local.properties
19+
Example/android/.idea
20+
Example/android/.idea
21+
Example/android/build
22+
Example/android/app/build
23+
Example/android/gradle
24+
Example/android/captures
25+
26+
Example/node_modules
27+
28+
.DS_Store
29+

CHANGELOG.md

Lines changed: 82 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,82 @@
1+
# Changelog
2+
3+
## 0.2.0
4+
5+
(Includes all features from [`0.2.0-rc2`](#020-rc2))
6+
7+
#### Upgrading
8+
Update your `package.json` to use the `0.2.0` version.
9+
```
10+
npm install --save [email protected]
11+
```
12+
13+
###### iOS
14+
Modify your `Podfile` for the Twilio dependency as follows:
15+
```
16+
pod 'TwilioIPMessagingClient', '~> 0.14.2'
17+
```
18+
19+
###### Android
20+
Indicate to Android Studio to refresh the gradle dependencies.
21+
22+
Or, remove the cache and it will be auto-generated on the next build.
23+
24+
```
25+
rm -rf $HOME/.gradle/caches/
26+
```
27+
28+
#### iOS
29+
- PR #19 Fixed issue with NSString token not being converted into NSData (thanks @plonkus!)
30+
- PR #18 Fixed negated `isSuccessful` resolves in `setAttributes` and `setFriendlyName` in client (thanks @Baisang!)
31+
- PR #16 Updated Podspec to match Twilios requirement of only iOS 8.1 (thanks @Baisang!)
32+
- Fixed misspelling of `lastConsumptionTimestamp`
33+
- Fixed lib Channel `getMembers` was still calling `allObjects`
34+
35+
#### Android
36+
- Fixed bug when `lastConsumedMessageIndex` is null
37+
38+
## 0.2.0-rc2
39+
40+
#### Upgrading
41+
Update your `package.json` to use the `0.2.0-rc2` version.
42+
```
43+
npm install --save [email protected]
44+
```
45+
46+
###### iOS
47+
Modify your `Podfile` for the Twilio dependency as follows:
48+
```
49+
pod 'TwilioIPMessagingClient', '~> 0.14.2'
50+
```
51+
52+
###### Android
53+
Indicate to Android Studio to refresh the gradle dependencies.
54+
55+
Or, remove the cache and it will be auto-generated on the next build.
56+
57+
```
58+
rm -rf $HOME/.gradle/caches/
59+
```
60+
61+
#### Changes (both)
62+
- Added `dateCreated` and `dateUpdated` to Channel
63+
- Added `attributes` and `setAttributes` to Message
64+
- Added `isReachabilityEnabeld` to Client
65+
- Added `isOnline` and `isNotifiable` properties to UserInfo
66+
- Added `onUpdate` and `close` methods to UserInfo
67+
- Added `lastConsumedMessageIndex` and `lastConsumptionTimestamp` to Member class
68+
69+
#### Android
70+
- Updated Twilio SDK to 0.8.1
71+
- Updated attributes to be JSONObject instead of Maps
72+
- `sendMessage()` now uses a build in method instead of combing `createMessage` with `sendMessage`
73+
- Added `onToastFailed`, `onToastReceived`, and `onToastSubscribed` events (previously was iOS only)
74+
75+
#### iOS
76+
- Updated Twilio SDK to 0.14.2
77+
- Added `onMemberUserInfoUpdated` event for Client and Channel
78+
79+
#### Depreciated
80+
- `client.getChannelBySid(sid)` is now replaced with `client.getChannel(sid)`
81+
- `client.deregister(token)` is now replaced with `client.unregister(token)`
82+
- `onToastRegistrationFailed` Client event is now replaced with `onToastFailed`

Example/.flowconfig

Lines changed: 16 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,6 @@
1515
# Ignore react and fbjs where there are overlaps, but don't ignore
1616
# anything that react-native relies on
1717
.*/node_modules/fbjs/lib/Map.js
18-
.*/node_modules/fbjs/lib/fetch.js
19-
.*/node_modules/fbjs/lib/ExecutionEnvironment.js
2018
.*/node_modules/fbjs/lib/ErrorUtils.js
2119

2220
# Flow has a built-in definition for the 'react' module which we prefer to use
@@ -42,6 +40,15 @@
4240
# Ignore Website
4341
.*/website/.*
4442

43+
# Ignore generators
44+
.*/local-cli/generator.*
45+
46+
# Ignore BUCK generated folders
47+
.*\.buckd/
48+
49+
# Ignore RNPM
50+
.*/local-cli/rnpm/.*
51+
4552
.*/node_modules/is-my-json-valid/test/.*\.json
4653
.*/node_modules/iconv-lite/encodings/tables/.*\.json
4754
.*/node_modules/y18n/test/.*\.json
@@ -59,6 +66,7 @@
5966
.*/node_modules/isemail/.*\.json
6067
.*/node_modules/tr46/.*\.json
6168

69+
6270
[include]
6371

6472
[libs]
@@ -72,18 +80,20 @@ module.system=haste
7280
esproposal.class_static_fields=enable
7381
esproposal.class_instance_fields=enable
7482

83+
experimental.strict_type_args=true
84+
7585
munge_underscores=true
7686

7787
module.name_mapper='^image![a-zA-Z0-9$_-]+$' -> 'GlobalImageStub'
78-
module.name_mapper='^[./a-zA-Z0-9$_-]+\.\(bmp\|gif\|jpg\|jpeg\|png\|psd\|svg\|webp\|m4v\|mov\|mp4\|mpeg\|mpg\|webm\|aac\|aiff\|caf\|m4a\|mp3\|wav\|html\)$' -> 'RelativeImageStub'
88+
module.name_mapper='^[./a-zA-Z0-9$_-]+\.\(bmp\|gif\|jpg\|jpeg\|png\|psd\|svg\|webp\|m4v\|mov\|mp4\|mpeg\|mpg\|webm\|aac\|aiff\|caf\|m4a\|mp3\|wav\|html\|pdf\)$' -> 'RelativeImageStub'
7989

8090
suppress_type=$FlowIssue
8191
suppress_type=$FlowFixMe
8292
suppress_type=$FixMe
8393

84-
suppress_comment=\\(.\\|\n\\)*\\$FlowFixMe\\($\\|[^(]\\|(\\(>=0\\.\\(2[0-2]\\|1[0-9]\\|[0-9]\\).[0-9]\\)? *\\(site=[a-z,_]*react_native[a-z,_]*\\)?)\\)
85-
suppress_comment=\\(.\\|\n\\)*\\$FlowIssue\\((\\(>=0\\.\\(2[0-2]\\|1[0-9]\\|[0-9]\\).[0-9]\\)? *\\(site=[a-z,_]*react_native[a-z,_]*\\)?)\\)?:? #[0-9]+
94+
suppress_comment=\\(.\\|\n\\)*\\$FlowFixMe\\($\\|[^(]\\|(\\(>=0\\.\\(2[0-6]\\|1[0-9]\\|[0-9]\\).[0-9]\\)? *\\(site=[a-z,_]*react_native[a-z,_]*\\)?)\\)
95+
suppress_comment=\\(.\\|\n\\)*\\$FlowIssue\\((\\(>=0\\.\\(2[0-6]\\|1[0-9]\\|[0-9]\\).[0-9]\\)? *\\(site=[a-z,_]*react_native[a-z,_]*\\)?)\\)?:? #[0-9]+
8696
suppress_comment=\\(.\\|\n\\)*\\$FlowFixedInNextDeploy
8797

8898
[version]
89-
0.22.0
99+
^0.26.0

Example/.gitignore

Lines changed: 0 additions & 34 deletions
This file was deleted.

Example/GiftedMessengerContainer.js

Lines changed: 28 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
'use strict';
22

33
import React, {
4-
Component,
4+
Component
55
} from 'react';
66
import {
77
Linking,
@@ -11,8 +11,11 @@ import {
1111
View,
1212
Text,
1313
Navigator,
14+
NativeModules,
15+
NativeAppEventEmitter
1416
} from 'react-native';
1517

18+
1619
var GiftedMessenger = require('react-native-gifted-messenger');
1720
var Communications = require('react-native-communications');
1821

@@ -46,8 +49,6 @@ const BOT_CONFIRMATIONS = [
4649
"Go for the gold!"
4750
]
4851

49-
var DeviceInfo = require('react-native-device-info')
50-
5152
let {
5253
Client,
5354
Constants,
@@ -78,16 +79,16 @@ class GiftedMessengerContainer extends Component {
7879
};
7980

8081
}
81-
82+
8283
getToken(identity) {
83-
return fetch('http://localhost:3000/token?device=iOS&identity=' + identity, {
84+
return fetch('http://localhost:3000/token?device=' + Platform.OS + '&identity=' + identity, {
8485
method: 'get'
8586
})
8687
.then((res) => {
8788
return res.json()
8889
})
8990
}
90-
91+
9192
parseMessage(message) {
9293
return {
9394
uniqueId: message.sid,
@@ -97,7 +98,7 @@ class GiftedMessengerContainer extends Component {
9798
date: message.timestamp
9899
}
99100
}
100-
101+
101102
initializeMessenging(identity) {
102103
this.getToken(identity)
103104
.then(({token}) => {
@@ -109,13 +110,13 @@ class GiftedMessengerContainer extends Component {
109110
accessManager.onError = ({error}) => {
110111
console.log(error)
111112
}
112-
113+
113114
var client = new Client(accessManager)
114-
115+
115116
client.onError = ({error, userInfo}) => console.log(error)
116117

117118
client.onClientSynchronized = () => {
118-
119+
119120
client.getChannelByUniqueName('general')
120121
.then((channel) => {
121122
channel.initialize()
@@ -124,28 +125,30 @@ class GiftedMessengerContainer extends Component {
124125
channel.join()
125126
}
126127
})
127-
.catch(({error}) => {
128+
.catch((error) => {
128129
console.log(error)
129130
})
130-
131+
131132
channel.onTypingStarted = (member) => {
132133
this.setState({typingMessage: member.userInfo.identity + ' is typing...'})
133134
}
134-
135+
135136
channel.onTypingEnded = (member) => {
136137
this.setState({typingMessage: ''})
137138
}
138-
139+
139140
channel.onMessageAdded = (message) => this.handleReceive(this.parseMessage(message))
140-
141-
this.setState({client, channel})
142-
})
141+
142+
this.setState({client, channel})
143+
})
143144
}
144-
145+
146+
console.log(Constants)
147+
145148
client.initialize()
146149
})
147150
}
148-
151+
149152
botMessage(message, time = 1000) {
150153
this.setState({typingMessage: 'MessagingBot is typing...'})
151154
return new Promise((resolve, reject) => {
@@ -158,7 +161,7 @@ class GiftedMessengerContainer extends Component {
158161
position: 'left',
159162
internal: true
160163
})
161-
resolve()
164+
resolve()
162165
},time)
163166
})
164167
}
@@ -168,6 +171,7 @@ class GiftedMessengerContainer extends Component {
168171
this.botMessage(BOT_GREETINGS[Math.floor(Math.random()*BOT_GREETINGS.length)])
169172
.then(() => this.botMessage(BOT_QUESTIONS[Math.floor(Math.random()*BOT_QUESTIONS.length)], 2000))
170173
},500)
174+
var test = NativeAppEventEmitter.addListener("bradtest", (test) => console.log(test));
171175
}
172176

173177
componentWillUnmount() {
@@ -210,18 +214,18 @@ class GiftedMessengerContainer extends Component {
210214
handleSend(message = {}) {
211215
// Your logic here
212216
// Send message.text to your server
213-
217+
214218
if (this.state.client) {
215219
this.state.channel.sendMessage(message.text)
216220
.catch((error) => console.error(error))
217221
} else {
218222
this.initializeMessenging(message.text)
219223
message.uniqueId = Math.round(Math.random() * 10000); // simulating server-side unique id generation
220-
this.setMessages(this._messages.concat(message));
224+
this.setMessages(this._messages.concat(message));
221225
this.botMessage("Hello " + message.text + "!", 1000)
222226
.then(() => this.botMessage(BOT_CONFIRMATIONS[Math.floor(Math.random()*BOT_CONFIRMATIONS.length)], 2000))
223227
}
224-
228+
225229
// message.uniqueId = Math.round(Math.random() * 10000); // simulating server-side unique id generation
226230
// this.setMessages(this._messages.concat(message));
227231

@@ -319,7 +323,7 @@ class GiftedMessengerContainer extends Component {
319323
senderImage={null}
320324
onImagePress={this.onImagePress}
321325
displayNames={true}
322-
326+
323327
onChangeText={() => this.state.channel ? this.state.channel.typing() : false}
324328

325329
parseText={true} // enable handlePhonePress, handleUrlPress and handleEmailPress

Example/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# Example App
22

3-
Run `npm install` and then `pod install` to bring in the xcode dependencies.
3+
Run `npm install` (in this directory) and then `pod install` (for iOS) to bring in the xcode dependencies.
44

55
This is an example app using [React Native Gifted Messenger](https://github.com/FaridSafi/react-native-gifted-messenger).
66

0 commit comments

Comments
 (0)