Multiple bug fixes (#1287)
This commit is contained in:
parent
49b0e4cb66
commit
62cedae196
5 changed files with 49 additions and 16 deletions
|
|
@ -63,6 +63,17 @@ public class CustomPushNotification extends PushNotification {
|
|||
}
|
||||
}
|
||||
|
||||
public static void clearNotification(Context mContext, int notificationId, String channelId) {
|
||||
if (notificationId != -1) {
|
||||
channelIdToNotificationCount.remove(channelId);
|
||||
channelIdToNotification.remove(channelId);
|
||||
if (mContext != null) {
|
||||
final NotificationManager notificationManager = (NotificationManager) mContext.getSystemService(Context.NOTIFICATION_SERVICE);
|
||||
notificationManager.cancel(notificationId);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onReceived() throws InvalidNotificationException {
|
||||
Bundle data = mNotificationProps.asBundle();
|
||||
|
|
|
|||
|
|
@ -4,20 +4,23 @@ import android.content.Context;
|
|||
import android.content.Intent;
|
||||
import android.app.IntentService;
|
||||
import android.os.Bundle;
|
||||
import android.util.Log;
|
||||
|
||||
import com.wix.reactnativenotifications.core.NotificationIntentAdapter;
|
||||
|
||||
public class NotificationDismissService extends IntentService {
|
||||
|
||||
private Context mContext;
|
||||
public NotificationDismissService() {
|
||||
super("notificationDismissService");
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onHandleIntent(Intent intent) {
|
||||
mContext = getApplicationContext();
|
||||
Bundle bundle = NotificationIntentAdapter.extractPendingNotificationDataFromIntent(intent);
|
||||
int notificationId = intent.getIntExtra(CustomPushNotification.NOTIFICATION_ID, -1);
|
||||
String channelId = bundle.getString("channel_id");
|
||||
CustomPushNotification.clearNotification(notificationId, channelId);
|
||||
CustomPushNotification.clearNotification(mContext, notificationId, channelId);
|
||||
Log.i("ReactNative", "Dismiss notification");
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -6,6 +6,7 @@ import android.app.NotificationManager;
|
|||
import android.app.RemoteInput;
|
||||
import android.os.Bundle;
|
||||
import android.support.annotation.Nullable;
|
||||
import android.util.Log;
|
||||
|
||||
import com.facebook.react.HeadlessJsTaskService;
|
||||
import com.facebook.react.bridge.Arguments;
|
||||
|
|
@ -15,9 +16,11 @@ import com.facebook.react.jstasks.HeadlessJsTaskConfig;
|
|||
import com.wix.reactnativenotifications.core.NotificationIntentAdapter;
|
||||
|
||||
public class NotificationReplyService extends HeadlessJsTaskService {
|
||||
private Context mContext;
|
||||
|
||||
@Override
|
||||
protected @Nullable HeadlessJsTaskConfig getTaskConfig(Intent intent) {
|
||||
mContext = getApplicationContext();
|
||||
if (CustomPushNotification.KEY_TEXT_REPLY.equals(intent.getAction())) {
|
||||
CharSequence message = getReplyMessage(intent);
|
||||
|
||||
|
|
@ -27,8 +30,9 @@ public class NotificationReplyService extends HeadlessJsTaskService {
|
|||
bundle.putInt("msg_count", CustomPushNotification.getMessageCountInChannel(channelId));
|
||||
|
||||
int notificationId = intent.getIntExtra(CustomPushNotification.NOTIFICATION_ID, -1);
|
||||
CustomPushNotification.clearNotification(notificationId, channelId);
|
||||
CustomPushNotification.clearNotification(mContext, notificationId, channelId);
|
||||
|
||||
Log.i("ReactNative", "Replying service");
|
||||
return new HeadlessJsTaskConfig(
|
||||
"notificationReplied",
|
||||
Arguments.fromBundle(bundle),
|
||||
|
|
|
|||
|
|
@ -8,7 +8,7 @@ import {
|
|||
ScrollView,
|
||||
ViewPagerAndroid,
|
||||
Platform,
|
||||
StyleSheet
|
||||
StyleSheet, InteractionManager
|
||||
} from 'react-native';
|
||||
|
||||
export default class Swiper extends PureComponent {
|
||||
|
|
@ -114,6 +114,14 @@ export default class Swiper extends PureComponent {
|
|||
}
|
||||
};
|
||||
|
||||
scrollToStart = () => {
|
||||
if (Platform.OS === 'ios') {
|
||||
InteractionManager.runAfterInteractions(() => {
|
||||
this.scrollView.scrollTo({x: 0, animated: false});
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
refScrollView = (view) => {
|
||||
this.scrollView = view;
|
||||
};
|
||||
|
|
|
|||
|
|
@ -18,7 +18,7 @@ import StatusBar from 'app/components/status_bar';
|
|||
import {UpgradeTypes} from 'app/constants/view';
|
||||
import logo from 'assets/images/logo.png';
|
||||
import checkUpgradeType from 'app/utils/client_upgrade';
|
||||
import {makeStyleSheetFromTheme, setNavigatorStyles} from 'app/utils/theme';
|
||||
import {changeOpacity, makeStyleSheetFromTheme, setNavigatorStyles} from 'app/utils/theme';
|
||||
|
||||
export default class ClientUpgrade extends PureComponent {
|
||||
static propTypes = {
|
||||
|
|
@ -262,23 +262,29 @@ export default class ClientUpgrade extends PureComponent {
|
|||
const styles = getStyleFromTheme(theme);
|
||||
|
||||
return (
|
||||
<ScrollView
|
||||
style={styles.scrollView}
|
||||
contentContainerStyle={styles.scrollViewContent}
|
||||
>
|
||||
<View style={styles.container}>
|
||||
<StatusBar/>
|
||||
<Image
|
||||
source={logo}
|
||||
style={styles.image}
|
||||
/>
|
||||
{this.renderMessageContent()}
|
||||
</ScrollView>
|
||||
<ScrollView
|
||||
style={styles.scrollView}
|
||||
contentContainerStyle={styles.scrollViewContent}
|
||||
>
|
||||
<Image
|
||||
source={logo}
|
||||
style={styles.image}
|
||||
/>
|
||||
{this.renderMessageContent()}
|
||||
</ScrollView>
|
||||
</View>
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
const getStyleFromTheme = makeStyleSheetFromTheme((theme) => {
|
||||
return {
|
||||
container: {
|
||||
flex: 1,
|
||||
backgroundColor: theme.centerChannelBg
|
||||
},
|
||||
image: {
|
||||
marginTop: 75,
|
||||
width: 76,
|
||||
|
|
@ -325,7 +331,8 @@ const getStyleFromTheme = makeStyleSheetFromTheme((theme) => {
|
|||
paddingHorizontal: 30
|
||||
},
|
||||
scrollView: {
|
||||
flex: 1
|
||||
flex: 1,
|
||||
backgroundColor: changeOpacity(theme.centerChannelColor, 0.03)
|
||||
},
|
||||
scrollViewContent: {
|
||||
paddingBottom: 20,
|
||||
|
|
|
|||
Loading…
Reference in a new issue