diff --git a/android/app/src/main/java/com/mattermost/rnbeta/CustomPushNotification.java b/android/app/src/main/java/com/mattermost/rnbeta/CustomPushNotification.java index aa2d51f84..4e00f8be2 100644 --- a/android/app/src/main/java/com/mattermost/rnbeta/CustomPushNotification.java +++ b/android/app/src/main/java/com/mattermost/rnbeta/CustomPushNotification.java @@ -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(); diff --git a/android/app/src/main/java/com/mattermost/rnbeta/NotificationDismissService.java b/android/app/src/main/java/com/mattermost/rnbeta/NotificationDismissService.java index 48406f275..8aeefb704 100644 --- a/android/app/src/main/java/com/mattermost/rnbeta/NotificationDismissService.java +++ b/android/app/src/main/java/com/mattermost/rnbeta/NotificationDismissService.java @@ -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"); } } diff --git a/android/app/src/main/java/com/mattermost/rnbeta/NotificationReplyService.java b/android/app/src/main/java/com/mattermost/rnbeta/NotificationReplyService.java index cadc2abcb..1376168a7 100644 --- a/android/app/src/main/java/com/mattermost/rnbeta/NotificationReplyService.java +++ b/android/app/src/main/java/com/mattermost/rnbeta/NotificationReplyService.java @@ -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), diff --git a/app/components/swiper.js b/app/components/swiper.js index 50160fc5e..138bece8a 100644 --- a/app/components/swiper.js +++ b/app/components/swiper.js @@ -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; }; diff --git a/app/screens/client_upgrade/client_upgrade.js b/app/screens/client_upgrade/client_upgrade.js index fdbeacd8f..8258ced37 100644 --- a/app/screens/client_upgrade/client_upgrade.js +++ b/app/screens/client_upgrade/client_upgrade.js @@ -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 ( - + - - {this.renderMessageContent()} - + + + {this.renderMessageContent()} + + ); } } 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,