Skip to content

Commit

Permalink
postNotification UTF-8 fix
Browse files Browse the repository at this point in the history
* postNotification now works correctly with UTF-8 messages.
  • Loading branch information
jkasten2 committed Aug 8, 2015
1 parent 5827264 commit a17314d
Show file tree
Hide file tree
Showing 8 changed files with 73 additions and 44 deletions.
Binary file modified OneSignalSDK.jar
Binary file not shown.
24 changes: 24 additions & 0 deletions OneSignalSDK/.idea/misc.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion OneSignalSDK/OneSignalExampleDev.iml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
</configuration>
</facet>
</component>
<component name="NewModuleRootManager" inherit-compiler-output="true">
<component name="NewModuleRootManager" LANGUAGE_LEVEL="JDK_1_7" inherit-compiler-output="true">
<exclude-output />
<content url="file://$MODULE_DIR$">
<excludeFolder url="file://$MODULE_DIR$/.gradle" />
Expand Down
12 changes: 8 additions & 4 deletions OneSignalSDK/app/app.iml
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,13 @@
<option name="SELECTED_TEST_ARTIFACT" value="_unit_test_" />
<option name="ASSEMBLE_TASK_NAME" value="assembleDebug" />
<option name="COMPILE_JAVA_TASK_NAME" value="compileDebugSources" />
<option name="SOURCE_GEN_TASK_NAME" value="generateDebugSources" />
<option name="ASSEMBLE_TEST_TASK_NAME" value="assembleDebugUnitTest" />
<option name="COMPILE_JAVA_TEST_TASK_NAME" value="compileDebugUnitTestSources" />
<afterSyncTasks>
<task>generateDebugSources</task>
<task>mockableAndroidJar</task>
<task>prepareDebugUnitTestDependencies</task>
</afterSyncTasks>
<option name="ALLOW_USER_CONFIGURATION" value="false" />
<option name="MANIFEST_FILE_RELATIVE_PATH" value="/src/main/AndroidManifest.xml" />
<option name="RES_FOLDER_RELATIVE_PATH" value="/src/main/res" />
Expand All @@ -23,7 +27,7 @@
</configuration>
</facet>
</component>
<component name="NewModuleRootManager" inherit-compiler-output="false">
<component name="NewModuleRootManager" LANGUAGE_LEVEL="JDK_1_7" inherit-compiler-output="false">
<output url="file://$MODULE_DIR$/build/intermediates/classes/debug" />
<output-test url="file://$MODULE_DIR$/build/intermediates/classes/test/debug" />
<exclude-output />
Expand Down Expand Up @@ -98,13 +102,13 @@
<orderEntry type="library" exported="" scope="TEST" name="hamcrest-core-1.3" level="project" />
<orderEntry type="library" exported="" name="support-annotations-22.1.1" level="project" />
<orderEntry type="library" exported="" scope="TEST" name="asm-tree-5.0.1" level="project" />
<orderEntry type="library" exported="" scope="TEST" name="asm-analysis-5.0.1" level="project" />
<orderEntry type="library" exported="" scope="TEST" name="junit-4.12" level="project" />
<orderEntry type="library" exported="" scope="TEST" name="asm-analysis-5.0.1" level="project" />
<orderEntry type="library" exported="" name="appcompat-v7-22.1.1" level="project" />
<orderEntry type="library" exported="" scope="TEST" name="icu4j-53.1" level="project" />
<orderEntry type="library" exported="" scope="TEST" name="ant-1.8.0" level="project" />
<orderEntry type="library" exported="" scope="TEST" name="accessibility-test-framework-1.0" level="project" />
<orderEntry type="library" exported="" scope="TEST" name="ant-launcher-1.8.0" level="project" />
<orderEntry type="library" exported="" scope="TEST" name="accessibility-test-framework-1.0" level="project" />
<orderEntry type="library" exported="" scope="TEST" name="robolectric-3.0" level="project" />
<orderEntry type="library" exported="" scope="TEST" name="bcprov-jdk16-1.46" level="project" />
<orderEntry type="library" exported="" scope="TEST" name="asm-util-5.0.1" level="project" />
Expand Down
4 changes: 2 additions & 2 deletions OneSignalSDK/onesignal/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@ android {

dependencies {
provided fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.google.android.gms:play-services-gcm:7.3.0'
compile 'com.google.android.gms:play-services-ads:7.3.0'
compile "com.google.android.gms:play-services-gcm:7.3.0"
compile "com.google.android.gms:play-services-analytics:7.3.0"
}

apply from: 'maven-push.gradle'
64 changes: 33 additions & 31 deletions OneSignalSDK/onesignal/onesignal.iml
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,17 @@
</facet>
<facet type="android" name="Android">
<configuration>
<option name="SELECTED_BUILD_VARIANT" value="release" />
<option name="SELECTED_BUILD_VARIANT" value="debug" />
<option name="SELECTED_TEST_ARTIFACT" value="_unit_test_" />
<option name="ASSEMBLE_TASK_NAME" value="assembleRelease" />
<option name="COMPILE_JAVA_TASK_NAME" value="compileReleaseSources" />
<option name="SOURCE_GEN_TASK_NAME" value="generateReleaseSources" />
<option name="ASSEMBLE_TEST_TASK_NAME" value="assembleReleaseUnitTest" />
<option name="COMPILE_JAVA_TEST_TASK_NAME" value="compileReleaseUnitTestSources" />
<option name="ASSEMBLE_TASK_NAME" value="assembleDebug" />
<option name="COMPILE_JAVA_TASK_NAME" value="compileDebugSources" />
<option name="ASSEMBLE_TEST_TASK_NAME" value="assembleDebugUnitTest" />
<option name="COMPILE_JAVA_TEST_TASK_NAME" value="compileDebugUnitTestSources" />
<afterSyncTasks>
<task>generateDebugSources</task>
<task>mockableAndroidJar</task>
<task>prepareDebugUnitTestDependencies</task>
</afterSyncTasks>
<option name="ALLOW_USER_CONFIGURATION" value="false" />
<option name="MANIFEST_FILE_RELATIVE_PATH" value="/src/main/AndroidManifest.xml" />
<option name="RES_FOLDER_RELATIVE_PATH" value="/src/main/res" />
Expand All @@ -24,31 +28,31 @@
</configuration>
</facet>
</component>
<component name="NewModuleRootManager" inherit-compiler-output="false">
<output url="file://$MODULE_DIR$/build/intermediates/classes/release" />
<output-test url="file://$MODULE_DIR$/build/intermediates/classes/test/release" />
<component name="NewModuleRootManager" LANGUAGE_LEVEL="JDK_1_7" inherit-compiler-output="false">
<output url="file://$MODULE_DIR$/build/intermediates/classes/debug" />
<output-test url="file://$MODULE_DIR$/build/intermediates/classes/test/debug" />
<exclude-output />
<content url="file://$MODULE_DIR$">
<sourceFolder url="file://$MODULE_DIR$/build/generated/source/r/release" isTestSource="false" generated="true" />
<sourceFolder url="file://$MODULE_DIR$/build/generated/source/aidl/release" isTestSource="false" generated="true" />
<sourceFolder url="file://$MODULE_DIR$/build/generated/source/buildConfig/release" isTestSource="false" generated="true" />
<sourceFolder url="file://$MODULE_DIR$/build/generated/source/rs/release" isTestSource="false" generated="true" />
<sourceFolder url="file://$MODULE_DIR$/build/generated/res/rs/release" type="java-resource" />
<sourceFolder url="file://$MODULE_DIR$/build/generated/res/generated/release" type="java-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/release/res" type="java-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/release/resources" type="java-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/release/assets" type="java-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/release/aidl" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/src/release/java" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/src/release/jni" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/src/release/rs" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/src/testRelease/res" type="java-test-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/testRelease/resources" type="java-test-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/testRelease/assets" type="java-test-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/testRelease/aidl" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src/testRelease/java" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src/testRelease/jni" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src/testRelease/rs" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/build/generated/source/r/debug" isTestSource="false" generated="true" />
<sourceFolder url="file://$MODULE_DIR$/build/generated/source/aidl/debug" isTestSource="false" generated="true" />
<sourceFolder url="file://$MODULE_DIR$/build/generated/source/buildConfig/debug" isTestSource="false" generated="true" />
<sourceFolder url="file://$MODULE_DIR$/build/generated/source/rs/debug" isTestSource="false" generated="true" />
<sourceFolder url="file://$MODULE_DIR$/build/generated/res/rs/debug" type="java-resource" />
<sourceFolder url="file://$MODULE_DIR$/build/generated/res/generated/debug" type="java-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/debug/res" type="java-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/debug/resources" type="java-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/debug/assets" type="java-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/debug/aidl" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/src/debug/java" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/src/debug/jni" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/src/debug/rs" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/src/testDebug/res" type="java-test-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/testDebug/resources" type="java-test-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/testDebug/assets" type="java-test-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/testDebug/aidl" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src/testDebug/java" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src/testDebug/jni" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src/testDebug/rs" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src/main/res" type="java-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/main/resources" type="java-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/main/assets" type="java-resource" />
Expand All @@ -71,7 +75,6 @@
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/dex" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/dex-cache" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/exploded-aar/com.android.support/support-v4/22.0.0/jars" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/exploded-aar/com.google.android.gms/play-services-ads/7.3.0/jars" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/exploded-aar/com.google.android.gms/play-services-analytics/7.3.0/jars" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/exploded-aar/com.google.android.gms/play-services-base/7.3.0/jars" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/exploded-aar/com.google.android.gms/play-services-gcm/7.3.0/jars" />
Expand Down Expand Up @@ -103,7 +106,6 @@
<orderEntry type="library" exported="" name="amazon-device-messaging-1.0.1" level="project" />
<orderEntry type="library" exported="" name="play-services-analytics-7.3.0" level="project" />
<orderEntry type="library" exported="" name="play-services-base-7.3.0" level="project" />
<orderEntry type="library" exported="" name="play-services-ads-7.3.0" level="project" />
<orderEntry type="library" exported="" scope="TEST" name="mockable-android-22" level="project" />
</component>
</module>
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ public interface PostNotificationResponseHandler {
private static TrackGooglePurchase trackGooglePurchase;
private static TrackAmazonPurchase trackAmazonPurchase;

public static final String VERSION = "011003";
public static final String VERSION = "011004";

private static PushRegistrator pushRegistrator;
private static AdvertisingIdentifierProvider mainAdIdProvider = new AdvertisingIdProviderGPS();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ class OneSignalRestClient {
}

static void put(final Context context, final String url, JSONObject jsonBody, final ResponseHandlerInterface responseHandler) throws UnsupportedEncodingException {
final StringEntity entity = new StringEntity(jsonBody.toString());
final StringEntity entity = new StringEntity(jsonBody.toString(), "UTF-8");

new Thread(new Runnable() {
public void run() {
Expand All @@ -65,8 +65,7 @@ public void run() {
}

static void post(final Context context, final String url, JSONObject jsonBody, final ResponseHandlerInterface responseHandler) throws UnsupportedEncodingException {
final StringEntity entity = new StringEntity(jsonBody.toString());

final StringEntity entity = new StringEntity(jsonBody.toString(), "UTF-8");
new Thread(new Runnable() {
public void run() {
clientSync.post(context, BASE_URL + url, entity, "application/json", responseHandler);
Expand All @@ -83,12 +82,12 @@ public void run() {
}

static void putSync(Context context, String url, JSONObject jsonBody, ResponseHandlerInterface responseHandler) throws UnsupportedEncodingException {
StringEntity entity = new StringEntity(jsonBody.toString());
StringEntity entity = new StringEntity(jsonBody.toString(), "UTF-8");
clientSync.put(context, BASE_URL + url, entity, "application/json", responseHandler);
}

static void postSync(Context context, String url, JSONObject jsonBody, ResponseHandlerInterface responseHandler) throws UnsupportedEncodingException {
StringEntity entity = new StringEntity(jsonBody.toString());
StringEntity entity = new StringEntity(jsonBody.toString(), "UTF-8");
clientSync.post(context, BASE_URL + url, entity, "application/json", responseHandler);
}

Expand Down

0 comments on commit a17314d

Please sign in to comment.