parent
e67a07064b
commit
ab7f3f73ba
8 changed files with 57 additions and 58 deletions
|
|
@ -9,20 +9,18 @@ import android.content.Context;
|
|||
import android.content.Intent;
|
||||
import android.os.Bundle;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.annotation.Nullable;
|
||||
import androidx.core.app.NotificationCompat;
|
||||
import androidx.core.app.Person;
|
||||
|
||||
import com.facebook.react.ReactApplication;
|
||||
import com.facebook.react.ReactNativeHost;
|
||||
import com.facebook.react.bridge.Arguments;
|
||||
import com.facebook.react.bridge.ReactApplicationContext;
|
||||
import com.facebook.react.bridge.ReadableMap;
|
||||
import com.facebook.react.bridge.WritableMap;
|
||||
|
||||
import com.mattermost.helpers.*;
|
||||
import com.mattermost.turbolog.TurboLog;
|
||||
import com.wix.reactnativenotifications.core.NotificationIntentAdapter;
|
||||
import com.wix.reactnativenotifications.core.notification.INotificationsApplication;
|
||||
import com.wix.reactnativenotifications.core.notification.PushNotificationProps;
|
||||
|
||||
public class NotificationReplyBroadcastReceiver extends BroadcastReceiver {
|
||||
|
|
@ -30,15 +28,6 @@ public class NotificationReplyBroadcastReceiver extends BroadcastReceiver {
|
|||
private Bundle bundle;
|
||||
private NotificationManager notificationManager;
|
||||
|
||||
private ReactApplicationContext getReactContext(Context context) {
|
||||
if (context instanceof ReactApplication) {
|
||||
ReactNativeHost host = ((ReactApplication) context).getReactNativeHost();
|
||||
return (ReactApplicationContext) host.getReactInstanceManager().getCurrentReactContext();
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onReceive(Context context, Intent intent) {
|
||||
try {
|
||||
|
|
@ -80,7 +69,6 @@ public class NotificationReplyBroadcastReceiver extends BroadcastReceiver {
|
|||
WritableMap headers = Arguments.createMap();
|
||||
headers.putString("Content-Type", "application/json");
|
||||
|
||||
|
||||
WritableMap body = Arguments.createMap();
|
||||
body.putString("channel_id", channelId);
|
||||
body.putString("message", message.toString());
|
||||
|
|
@ -92,9 +80,19 @@ public class NotificationReplyBroadcastReceiver extends BroadcastReceiver {
|
|||
|
||||
String postsEndpoint = "/api/v4/posts?set_online=false";
|
||||
Network.post(serverUrl, postsEndpoint, options, new ResolvePromise() {
|
||||
private boolean isSuccessful(int statusCode) {
|
||||
return statusCode >= 200 && statusCode < 300;
|
||||
}
|
||||
@Override
|
||||
public void resolve(@Nullable Object value) {
|
||||
if (value != null) {
|
||||
ReadableMap response = (ReadableMap)value;
|
||||
ReadableMap data = response.getMap("data");
|
||||
if (data != null && data.hasKey("status_code") && !isSuccessful(data.getInt("status_code"))) {
|
||||
TurboLog.Companion.i("ReactNative", String.format("Reply FAILED exception %s", data.getString("message")));
|
||||
onReplyFailed(notificationId);
|
||||
return;
|
||||
}
|
||||
onReplySuccess(notificationId, message);
|
||||
TurboLog.Companion.i("ReactNative", "Reply SUCCESS");
|
||||
} else {
|
||||
|
|
@ -104,13 +102,13 @@ public class NotificationReplyBroadcastReceiver extends BroadcastReceiver {
|
|||
}
|
||||
|
||||
@Override
|
||||
public void reject(Throwable reason) {
|
||||
public void reject(@NonNull Throwable reason) {
|
||||
TurboLog.Companion.i("ReactNative", String.format("Reply FAILED exception %s", reason.getMessage()));
|
||||
onReplyFailed(notificationId);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void reject(String code, String message) {
|
||||
public void reject(@NonNull String code, String message) {
|
||||
TurboLog.Companion.i("ReactNative",
|
||||
String.format("Reply FAILED status %s BODY %s", code, message)
|
||||
);
|
||||
|
|
|
|||
|
|
@ -38,6 +38,7 @@ public class ReceiptDelivery {
|
|||
JSONObject jsonResponse = new JSONObject(responseBody);
|
||||
return parseAckResponse(jsonResponse);
|
||||
} catch (Exception e) {
|
||||
TurboLog.Companion.e("ReactNative", "Send receipt delivery failed " + e.getMessage());
|
||||
e.printStackTrace();
|
||||
return null;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -162,19 +162,19 @@ const RecentMentionsScreen = ({appsEnabled, customEmojiNames, mentions, currentT
|
|||
return (
|
||||
<Freeze freeze={!isFocused}>
|
||||
<ExtraKeyboardProvider>
|
||||
<NavigationHeader
|
||||
isLargeTitle={true}
|
||||
showBackButton={false}
|
||||
subtitle={subtitle}
|
||||
title={title}
|
||||
hasSearch={false}
|
||||
scrollValue={scrollValue}
|
||||
/>
|
||||
<SafeAreaView
|
||||
style={styles.flex}
|
||||
edges={EDGES}
|
||||
testID='recent_mentions.screen'
|
||||
>
|
||||
<NavigationHeader
|
||||
isLargeTitle={true}
|
||||
showBackButton={false}
|
||||
subtitle={subtitle}
|
||||
title={title}
|
||||
hasSearch={false}
|
||||
scrollValue={scrollValue}
|
||||
/>
|
||||
<Animated.View style={[styles.flex, animated]}>
|
||||
<Animated.View style={top}>
|
||||
<RoundedHeaderContext/>
|
||||
|
|
|
|||
|
|
@ -164,19 +164,19 @@ function SavedMessages({appsEnabled, posts, currentTimezone, customEmojiNames}:
|
|||
return (
|
||||
<Freeze freeze={!isFocused}>
|
||||
<ExtraKeyboardProvider>
|
||||
<NavigationHeader
|
||||
isLargeTitle={true}
|
||||
showBackButton={false}
|
||||
subtitle={subtitle}
|
||||
title={title}
|
||||
hasSearch={false}
|
||||
scrollValue={scrollValue}
|
||||
/>
|
||||
<SafeAreaView
|
||||
edges={edges}
|
||||
style={styles.flex}
|
||||
testID='saved_messages.screen'
|
||||
>
|
||||
<NavigationHeader
|
||||
isLargeTitle={true}
|
||||
showBackButton={false}
|
||||
subtitle={subtitle}
|
||||
title={title}
|
||||
hasSearch={false}
|
||||
scrollValue={scrollValue}
|
||||
/>
|
||||
<Animated.View style={[styles.flex, animated]}>
|
||||
<Animated.View style={top}>
|
||||
<RoundedHeaderContext/>
|
||||
|
|
|
|||
|
|
@ -352,31 +352,31 @@ const SearchScreen = ({teamId, teams}: Props) => {
|
|||
|
||||
return (
|
||||
<Freeze freeze={!isFocused}>
|
||||
<NavigationHeader
|
||||
isLargeTitle={true}
|
||||
showBackButton={false}
|
||||
title={intl.formatMessage({id: 'screen.search.title', defaultMessage: 'Search'})}
|
||||
hasSearch={true}
|
||||
scrollValue={scrollValue}
|
||||
lockValue={lockValue}
|
||||
hideHeader={hideHeader}
|
||||
onChangeText={handleTextChange}
|
||||
onSubmitEditing={onSubmit}
|
||||
blurOnSubmit={true}
|
||||
placeholder={intl.formatMessage({id: 'screen.search.placeholder', defaultMessage: 'Search messages & files'})}
|
||||
onBlur={onBlur}
|
||||
onClear={handleClearSearch}
|
||||
onCancel={handleCancelSearch}
|
||||
onFocus={onFocus}
|
||||
defaultValue={searchValue}
|
||||
ref={searchRef}
|
||||
/>
|
||||
<SafeAreaView
|
||||
style={styles.flex}
|
||||
edges={EDGES}
|
||||
onLayout={onLayout}
|
||||
testID='search_messages.screen'
|
||||
>
|
||||
<NavigationHeader
|
||||
isLargeTitle={true}
|
||||
showBackButton={false}
|
||||
title={intl.formatMessage({id: 'screen.search.title', defaultMessage: 'Search'})}
|
||||
hasSearch={true}
|
||||
scrollValue={scrollValue}
|
||||
lockValue={lockValue}
|
||||
hideHeader={hideHeader}
|
||||
onChangeText={handleTextChange}
|
||||
onSubmitEditing={onSubmit}
|
||||
blurOnSubmit={true}
|
||||
placeholder={intl.formatMessage({id: 'screen.search.placeholder', defaultMessage: 'Search messages & files'})}
|
||||
onBlur={onBlur}
|
||||
onClear={handleClearSearch}
|
||||
onCancel={handleCancelSearch}
|
||||
onFocus={onFocus}
|
||||
defaultValue={searchValue}
|
||||
ref={searchRef}
|
||||
/>
|
||||
<KeyboardAvoidingView
|
||||
style={styles.flex}
|
||||
behavior={Platform.OS === 'ios' ? 'padding' : undefined}
|
||||
|
|
|
|||
|
|
@ -1454,7 +1454,7 @@ PODS:
|
|||
- Yoga
|
||||
- react-native-netinfo (11.4.1):
|
||||
- React-Core
|
||||
- react-native-network-client (1.8.1):
|
||||
- react-native-network-client (1.8.2):
|
||||
- Alamofire (~> 5.10.2)
|
||||
- DoubleConversion
|
||||
- glog
|
||||
|
|
@ -2518,7 +2518,7 @@ SPEC CHECKSUMS:
|
|||
react-native-emm: f6003bebdf4fef4feef7c61f96a5c174f43c6b5f
|
||||
react-native-image-picker: 130fad649d07e4eec8faaed361d3bba570e1e5ff
|
||||
react-native-netinfo: cec9c4e86083cb5b6aba0e0711f563e2fbbff187
|
||||
react-native-network-client: f2996a6440c422e64e787bdf8c8e3f992be1cee6
|
||||
react-native-network-client: fdbd7f5f4c2818d6b90b4dcf9613d0a54ab41303
|
||||
react-native-notifications: 3bafa1237ae8a47569a84801f17d80242fe9f6a5
|
||||
react-native-paste-input: d33daa183942fa57f34dff2088805a60895f14d2
|
||||
react-native-performance: 125a96c145e29918b55b45ce25cbba54f1e24dcd
|
||||
|
|
|
|||
8
package-lock.json
generated
8
package-lock.json
generated
|
|
@ -21,7 +21,7 @@
|
|||
"@mattermost/compass-icons": "0.1.48",
|
||||
"@mattermost/hardware-keyboard": "file:./libraries/@mattermost/hardware-keyboard",
|
||||
"@mattermost/react-native-emm": "1.5.1",
|
||||
"@mattermost/react-native-network-client": "1.8.1",
|
||||
"@mattermost/react-native-network-client": "1.8.2",
|
||||
"@mattermost/react-native-paste-input": "0.8.1",
|
||||
"@mattermost/react-native-turbo-log": "0.5.0",
|
||||
"@mattermost/rnshare": "file:./libraries/@mattermost/rnshare",
|
||||
|
|
@ -4631,9 +4631,9 @@
|
|||
}
|
||||
},
|
||||
"node_modules/@mattermost/react-native-network-client": {
|
||||
"version": "1.8.1",
|
||||
"resolved": "https://registry.npmjs.org/@mattermost/react-native-network-client/-/react-native-network-client-1.8.1.tgz",
|
||||
"integrity": "sha512-CrIVcIkSJej2Dg2162z2U4qyL0QIV/LYuHd0wXh9wnrcGBjk8Dt0TDhUkUaTe8V1YKYVQiJU7vsL9GlDMxVuXQ==",
|
||||
"version": "1.8.2",
|
||||
"resolved": "https://registry.npmjs.org/@mattermost/react-native-network-client/-/react-native-network-client-1.8.2.tgz",
|
||||
"integrity": "sha512-wveW7wuXqwjxt3udip1H3Uw72ApNmSo6ii2qx9HZ81+LX3FnhBJhlB6q7xF6KP8DUEOxRZHvPWwAtGxYKWI0lw==",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"validator": "13.12.0",
|
||||
|
|
|
|||
|
|
@ -22,7 +22,7 @@
|
|||
"@mattermost/compass-icons": "0.1.48",
|
||||
"@mattermost/hardware-keyboard": "file:./libraries/@mattermost/hardware-keyboard",
|
||||
"@mattermost/react-native-emm": "1.5.1",
|
||||
"@mattermost/react-native-network-client": "1.8.1",
|
||||
"@mattermost/react-native-network-client": "1.8.2",
|
||||
"@mattermost/react-native-paste-input": "0.8.1",
|
||||
"@mattermost/react-native-turbo-log": "0.5.0",
|
||||
"@mattermost/rnshare": "file:./libraries/@mattermost/rnshare",
|
||||
|
|
|
|||
Loading…
Reference in a new issue