Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix for issue #354, add per-contact notifications #366

Closed
wants to merge 12 commits into from
Closed

Fix for issue #354, add per-contact notifications #366

wants to merge 12 commits into from

Conversation

doozan
Copy link

@doozan doozan commented Oct 7, 2013

This adds ability to customize notifications on a per-contact basis and adds some additional notification options.

A large part of this code is borrowed from the excellent SMSPopup app, but any bugs are entirely mine.

@moxie0
Copy link
Contributor

moxie0 commented Oct 10, 2013

At a first glance, some high level comments:

  1. Please read the OWS code style guidelines:
    https://github.com/WhisperSystems/RedPhone/wiki/Code-style-Guidelines

The style for this pull is currently pretty diverse. In particular, indents should be two spaces, no tabs anywhere, no trailing whitespace.

  1. Please include a class-level comment for each new class describing what the class does at a high level.

  2. Please do not include comments anywhere else. Method-level comments should be treated as a sign that the method should be named more descriptively. Line-level comments should be treated as a sign that the method should be broken up into separate methods.

@moxie0
Copy link
Contributor

moxie0 commented Oct 10, 2013

It appears that you populate the '0' row with some defaults on an upgrade, but that doesn't do anything for a fresh install.

E/AndroidRuntime( 2763): java.lang.RuntimeException: Unable to start activity ComponentInfo{org.thoughtcrime.securesms/org.thoughtcrime.securesms.ConfigNotificationActivity}: java.lang.IllegalArgumentException: Invalid lookup id: 0
E/AndroidRuntime( 2763): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2308)
E/AndroidRuntime( 2763): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2358)
E/AndroidRuntime( 2763): at android.app.ActivityThread.access$600(ActivityThread.java:153)
E/AndroidRuntime( 2763): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1247)
E/AndroidRuntime( 2763): at android.os.Handler.dispatchMessage(Handler.java:99)
E/AndroidRuntime( 2763): at android.os.Looper.loop(Looper.java:137)
E/AndroidRuntime( 2763): at android.app.ActivityThread.main(ActivityThread.java:5227)
E/AndroidRuntime( 2763): at java.lang.reflect.Method.invokeNative(Native Method)
E/AndroidRuntime( 2763): at java.lang.reflect.Method.invoke(Method.java:511)
E/AndroidRuntime( 2763): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:795)
E/AndroidRuntime( 2763): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:562)
E/AndroidRuntime( 2763): at dalvik.system.NativeStart.main(Native Method)
E/AndroidRuntime( 2763): Caused by: java.lang.IllegalArgumentException: Invalid lookup id: 0
E/AndroidRuntime( 2763): at android.database.DatabaseUtils.readExceptionFromParcel(DatabaseUtils.java:167)
E/AndroidRuntime( 2763): at android.database.DatabaseUtils.readExceptionFromParcel(DatabaseUtils.java:137)
E/AndroidRuntime( 2763): at android.content.ContentProviderProxy.query(ContentProviderNative.java:366)
E/AndroidRuntime( 2763): at android.content.ContentResolver.query(ContentResolver.java:372)
E/AndroidRuntime( 2763): at android.content.ContentResolver.query(ContentResolver.java:315)
E/AndroidRuntime( 2763): at org.thoughtcrime.securesms.ConfigNotificationActivity.getContactName(ConfigNotificationActivity.java:289)
E/AndroidRuntime( 2763): at org.thoughtcrime.securesms.ConfigNotificationActivity.createContact(ConfigNotificationActivity.java:312)
E/AndroidRuntime( 2763): at org.thoughtcrime.securesms.ConfigNotificationActivity.createContact(ConfigNotificationActivity.java:330)
E/AndroidRuntime( 2763): at org.thoughtcrime.securesms.ConfigNotificationActivity.createOrFetchContactPreferences(ConfigNotificationActivity.java:86)
E/AndroidRuntime( 2763): at org.thoughtcrime.securesms.ConfigNotificationActivity.onCreate(ConfigNotificationActivity.java:58)
E/AndroidRuntime( 2763): at android.app.Activity.performCreate(Activity.java:5104)
E/AndroidRuntime( 2763): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1080)
E/AndroidRuntime( 2763): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2262)
E/AndroidRuntime( 2763): ... 11 more
W/ActivityManager( 568): Force finishing activity org.thoughtcrime.securesms/.ConfigNotificationActivity
W/ActivityManager( 568): Force finishing activity org.thoughtcrime.securesms/.ApplicationPreferencesActivity

@moxie0
Copy link
Contributor

moxie0 commented Oct 10, 2013

When using the contact selector:

E/AndroidRuntime( 2978): java.lang.RuntimeException: Unable to start activity ComponentInfo{org.thoughtcrime.securesms/org.thoughtcrime.securesms.ConfigNotificationActivity}: java.lang.UnsupportedOperationException: Unknown uri: content://org.thoughtcrime.notificationprovider.securesms/contacts/-1
E/AndroidRuntime( 2978): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2308)
E/AndroidRuntime( 2978): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2358)
E/AndroidRuntime( 2978): at android.app.ActivityThread.access$600(ActivityThread.java:153)
E/AndroidRuntime( 2978): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1247)
E/AndroidRuntime( 2978): at android.os.Handler.dispatchMessage(Handler.java:99)
E/AndroidRuntime( 2978): at android.os.Looper.loop(Looper.java:137)
E/AndroidRuntime( 2978): at android.app.ActivityThread.main(ActivityThread.java:5227)
E/AndroidRuntime( 2978): at java.lang.reflect.Method.invokeNative(Native Method)
E/AndroidRuntime( 2978): at java.lang.reflect.Method.invoke(Method.java:511)
E/AndroidRuntime( 2978): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:795)
E/AndroidRuntime( 2978): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:562)
E/AndroidRuntime( 2978): at dalvik.system.NativeStart.main(Native Method)
E/AndroidRuntime( 2978): Caused by: java.lang.UnsupportedOperationException: Unknown uri: content://org.thoughtcrime.notificationprovider.securesms/contacts/-1
E/AndroidRuntime( 2978): at org.thoughtcrime.securesms.providers.NotificationProvider.query(NotificationProvider.java:141)
E/AndroidRuntime( 2978): at org.thoughtcrime.securesms.providers.NotificationProvider.updateContactNotificationSummary(NotificationProvider.java:180)
E/AndroidRuntime( 2978): at org.thoughtcrime.securesms.providers.NotificationProvider.insert(NotificationProvider.java:104)
E/AndroidRuntime( 2978): at android.content.ContentProvider$Transport.insert(ContentProvider.java:201)
E/AndroidRuntime( 2978): at android.content.ContentResolver.insert(ContentResolver.java:866)
E/AndroidRuntime( 2978): at org.thoughtcrime.securesms.ConfigNotificationActivity.createContact(ConfigNotificationActivity.java:323)
E/AndroidRuntime( 2978): at org.thoughtcrime.securesms.ConfigNotificationActivity.createContact(ConfigNotificationActivity.java:330)
E/AndroidRuntime( 2978): at org.thoughtcrime.securesms.ConfigNotificationActivity.createOrFetchContactPreferences(ConfigNotificationActivity.java:86)
E/AndroidRuntime( 2978): at org.thoughtcrime.securesms.ConfigNotificationActivity.onCreate(ConfigNotificationActivity.java:58)
E/AndroidRuntime( 2978): at android.app.Activity.performCreate(Activity.java:5104)
E/AndroidRuntime( 2978): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1080)
E/AndroidRuntime( 2978): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2262)
E/AndroidRuntime( 2978): ... 11 more
W/ActivityManager( 568): Force finishing activity org.thoughtcrime.securesms/.ConfigNotificationActivity
W/ActivityManager( 568): Force finishing activity org.thoughtcrime.securesms/.ConfigContactsActivity

@@ -220,6 +233,8 @@

<provider android:name=".providers.PartProvider"
android:authorities="org.thoughtcrime.provider.securesms" />
<provider android:name=".providers.NotificationProvider"
android:authorities="org.thoughtcrime.notificationprovider.securesms" />
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you explain why a provider is necessary? It doesn't seem as if this is information any other app on the system would need to access.

@moxie0
Copy link
Contributor

moxie0 commented Oct 10, 2013

Please update all string names to be a tuple of their file name and english value, unless absurdly long. So for instance, "contact_customization_add_hint" should be "config_contacts_fragment__add_edit_contact_notifications"

android:background="?conversation_background">

<AutoCompleteTextView
android:text=""
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Empty strings won't build in AOSP, which will cause problems with Cyanogen embedding. Please just leave the property out if empty.

@moxie0
Copy link
Contributor

moxie0 commented Oct 10, 2013

Thanks for the pull request, I think this will be a great feature.

@ash359
Copy link

ash359 commented Nov 30, 2013

Is there a beta when I can test this feature?

@meskio
Copy link
Contributor

meskio commented Nov 30, 2013

@ash359 there is no beta versions of TextSecure. You can checkout the repo from @doozan:
https://github.com/doozan/TextSecure
compile it and install it by hand:
https://github.com/WhisperSystems/TextSecure/blob/master/BUILDING.md

@ash359
Copy link

ash359 commented Dec 1, 2013

@meskio compile? HuH? I know how to flash things.
I'll just have to wait for it, I'm way out of my league here.

@meskio
Copy link
Contributor

meskio commented Dec 1, 2013

@ash359 Yes, I guess you'll have to wait until it gets merged.

@Hellmy
Copy link

Hellmy commented Apr 22, 2014

Is anyone doing something on this pull request?
I think some of the comments have to be considered before merge, right?

@moxie0
Copy link
Contributor

moxie0 commented Apr 22, 2014

@Hellmy Yes I think it still has a little ways to go. Needs to be rebased as well.

@Hellmy
Copy link

Hellmy commented Apr 22, 2014

Thank you @moxie0 for the quick answer.
Best way to go? I think push to doozan's directory?

@doozan
Copy link
Author

doozan commented Apr 22, 2014

@Hellmy I'd recommend just forking my directory and submitting your own pull request as I have no interest in working on Text Secure any more. I did some rebasing and refactoring work already in pull requests 558, 564 and 567 which were all ignored.

@Wikinaut
Copy link
Contributor

@doozan rebasing is a normal step. Please don't give up!

@moxie0
Copy link
Contributor

moxie0 commented Jun 3, 2014

There are still some outstanding comments here, so we're going to close this for now. For future reference I think the outstanding work we're looking for is to manage the normal notification settings through the preferences.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

6 participants