package io.keybase.ossifrage;

import android.content.Intent;
import android.app.PendingIntent;
import android.content.Context;
import keybase.PushNotifier;

import android.os.Bundle;
import android.support.v4.app.NotificationCompat;
import android.support.v4.app.NotificationManagerCompat;

import com.dieam.reactnativepushnotification.modules.RNPushNotificationHelper;

public class KBPushNotifier implements PushNotifier {
    private final Context context;
    private Bundle bundle;

    public KBPushNotifier(Context ctx) {
        this.context = ctx;
    }

    public void setBundle(Bundle bundle) {
        this.bundle = bundle;
    }

    public void localNotification(String ident, String msg, long badgeCount, String soundName, String convID,
            String typ) {
        Intent open_activity_intent = new Intent(context, MainActivity.class);
        open_activity_intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_CLEAR_TOP);
        open_activity_intent.putExtra("isNotification", true);
        open_activity_intent.putExtra("convID", convID);
        open_activity_intent.setPackage(context.getPackageName());

        this.bundle.putBoolean("userInteraction", true);
        open_activity_intent.putExtra("notification", this.bundle);
        PendingIntent pending_intent = PendingIntent.getActivity(this.context, 0, open_activity_intent,
            PendingIntent.FLAG_UPDATE_CURRENT);
        NotificationCompat.Builder mBuilder =
            new NotificationCompat.Builder(this.context, RNPushNotificationHelper.NOTIFICATION_CHANNEL_ID )
            .setSmallIcon(R.drawable.ic_notif)
            .setContentTitle("Keybase")
            .setContentText(msg)
            .setContentIntent(pending_intent)
            .setPriority(NotificationCompat.PRIORITY_HIGH)
            .setAutoCancel(true);
        NotificationManagerCompat notificationManager = NotificationManagerCompat.from(this.context);
        notificationManager.notify(1, mBuilder.build());
    }
}

@@ -770,24 +770,226 @@
 ring typ) %7B%0A
+        Bundle bundle = (Bundle)this.bundle.clone();%0A        bundle.putBoolean(%22userInteraction%22, true);%0A        bundle.putString(%22type%22, %22chat.newmessage%22);%0A        bundle.putString(%22convID%22, convID);%0A
         Inte
@@ -1191,221 +1191,43 @@
 ent.
-putExtra(%22isNotification%22, true);%0A        open_activity_intent.putExtra(%22convID%22, convID);%0A        open_activity_intent.setPackage(context.getPackageName());%0A%0A        this.bundle.putBoolean(%22userInteraction%22, true
+setPackage(context.getPackageName()
 );%0A 
@@ -1279,21 +1279,16 @@
 ation%22, 
-this.
 bundle);
@@ -1284,24 +1284,25 @@
 %22, bundle);%0A
+%0A
         Pend

Make local notifications navigate to the correct conversation.