Skip to content

Commit

Permalink
Updated UserVoiceSDK Library.
Browse files Browse the repository at this point in the history
  • Loading branch information
PaitoAnderson committed May 13, 2014
1 parent ed9bb21 commit 5c9c17a
Show file tree
Hide file tree
Showing 17 changed files with 167 additions and 73 deletions.

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

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

11 changes: 0 additions & 11 deletions .idea/libraries/support_v4_19_0_1.xml

This file was deleted.

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

6 changes: 3 additions & 3 deletions Skrumaz/Skrumaz.iml
Original file line number Diff line number Diff line change
Expand Up @@ -72,12 +72,12 @@
<orderEntry type="sourceFolder" forTests="false" />
<orderEntry type="library" exported="" name="signpost-commonshttp4-1.2.1.2" level="project" />
<orderEntry type="library" exported="" name="commons-codec-1.3" level="project" />
<orderEntry type="library" exported="" name="library-0.2.0" level="project" />
<orderEntry type="library" exported="" name="library-0.9.3" level="project" />
<orderEntry type="library" exported="" name="httpcore-4.0.1" level="project" />
<orderEntry type="library" exported="" name="signpost-core-1.2.1.2" level="project" />
<orderEntry type="library" exported="" name="support-v4-19.1.0" level="project" />
<orderEntry type="library" exported="" name="library-0.9.9" level="project" />
<orderEntry type="library" exported="" name="libGoogleAnalyticsServices" level="project" />
<orderEntry type="library" exported="" name="support-v4-19.0.1" level="project" />
<orderEntry type="library" exported="" name="library-0.4.0" level="project" />
<orderEntry type="library" exported="" name="crouton-1.8.4" level="project" />
<orderEntry type="module" module-name="ViewPageIndicator" exported="" />
<orderEntry type="module" module-name="UserVoiceSDK" exported="" />
Expand Down
7 changes: 5 additions & 2 deletions Skrumaz/libs/UserVoiceSDK/UserVoiceSDK.iml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
<option name="SOURCE_GEN_TASK_NAME" value="generateDebugSources" />
<option name="ALLOW_USER_CONFIGURATION" value="false" />
<option name="RES_FOLDERS_RELATIVE_PATH" value="file://$MODULE_DIR$/res" />
<option name="ASSETS_FOLDER_RELATIVE_PATH" value="/src/main/assets" />
<option name="LIBRARY_PROJECT" value="true" />
</configuration>
</facet>
Expand Down Expand Up @@ -42,9 +43,11 @@
<sourceFolder url="file://$MODULE_DIR$/src/debug/rs" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/res" type="java-resource" />
<sourceFolder url="file://$MODULE_DIR$/src" type="java-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/main/aidl" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/src/main/assets" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/src" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/assets" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/src/main/jni" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/src/main/rs" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/src/androidTest/res" type="java-test-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/androidTest/resources" type="java-test-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/androidTest/aidl" isTestSource="true" />
Expand All @@ -66,11 +69,11 @@
</content>
<orderEntry type="jdk" jdkName="Android API 19 Platform" jdkType="Android SDK" />
<orderEntry type="sourceFolder" forTests="false" />
<orderEntry type="library" exported="" name="support-v4-18.0.0" level="project" />
<orderEntry type="library" exported="" name="signpost-commonshttp4-1.2.1.2" level="project" />
<orderEntry type="library" exported="" name="commons-codec-1.3" level="project" />
<orderEntry type="library" exported="" name="httpcore-4.0.1" level="project" />
<orderEntry type="library" exported="" name="signpost-core-1.2.1.2" level="project" />
<orderEntry type="library" exported="" name="support-v4-19.1.0" level="project" />
</component>
</module>

10 changes: 4 additions & 6 deletions Skrumaz/libs/UserVoiceSDK/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ buildscript {
repositories {
mavenCentral()
}

dependencies {
classpath 'com.android.tools.build:gradle:0.9.+'
}
Expand All @@ -10,7 +11,7 @@ buildscript {
apply plugin: 'android-library'

repositories {
mavenCentral();
mavenCentral()
}

android {
Expand All @@ -27,15 +28,12 @@ android {
manifest.srcFile 'AndroidManifest.xml'
java.srcDirs = ['src']
resources.srcDirs = ['src']
aidl.srcDirs = ['src']
renderscript.srcDirs = ['src']
res.srcDirs = ['res']
assets.srcDirs = ['assets']
}
}
}

dependencies {
compile('com.android.support:support-v4:18.0.+')
compile 'com.android.support:support-v4:19.1.0'
compile group: 'oauth.signpost', name: 'signpost-commonshttp4', version: '1.2.1.2' exclude module: 'httpclient'
}
}
113 changes: 113 additions & 0 deletions Skrumaz/libs/UserVoiceSDK/res/values-hr/strings.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,113 @@
<?xml version="1.0" encoding="utf-8" standalone="no"?>
<resources>
<plurals name="uv_comments">
<item quantity="one">komentar</item>
<item quantity="other">komentari</item>
</plurals>
<plurals name="uv_subscribers">
<item quantity="one">pretplatnik</item>
<item quantity="other">pretplatnici</item>
</plurals>
<plurals name="uv_articles">
<item quantity="one">članak</item>
<item quantity="other">članci</item>
</plurals>
<plurals name="uv_ideas">
<item quantity="one">ideja</item>
<item quantity="other">ideje</item>
</plurals>
<plurals name="uv_people">
<item quantity="one">osoba</item>
<item quantity="other">osobe</item>
</plurals>
<plurals name="uv_number_of_subscribers_format">
<item quantity="one">%1$s želi ovu ideju</item>
<item quantity="other">%1$s želi ovu ideju</item>
</plurals>
<string name="uv_loading">Učitavanje…</string>
<string name="uv_submit_idea">Pošalji ideju</string>
<string name="uv_idea_form_title">Pošalji ideju</string>
<string name="uv_menu_search">Pretraga</string>
<string name="uv_email_address">Email adresa</string>
<string name="uv_email_address_hint">your@email.com (obavezno)</string>
<string name="uv_display_name">Ime</string>
<string name="uv_password">Lozinka</string>
<string name="uv_forgot_password">Zaboravljena lozinka</string>
<string name="uv_msg_comment_posted">Vaš komentar je poslan</string>
<string name="uv_title_idea">Ideja</string>
<string name="uv_posted_by_format">Poslao %1$s u %2$s</string>
<string name="uv_all_articles">Svi članci</string>
<string name="uv_portal_title">Pomoć</string>
<string name="uv_network_error">Problem u spajanju na UserVoice</string>
<string name="uv_signin_dialog_title">Sign in</string>
<string name="uv_signin_dialog_ok">Sign in</string>
<string name="uv_failed_signin_error">Neispravan email ili lozinka</string>
<string name="uv_msg_forgot_password">Podjestnik na lozinku poslan email-om</string>
<string name="uv_subscribe_dialog_title">Pretplati se na ovu ideju</string>
<string name="uv_remove_votes">Briši glasove</string>
<string name="uv_feedback_forum">Feedback Forum</string>
<string name="uv_knowledge_base">Baza znanja</string>
<string name="uv_admin_response_format">Odgovor admin-a: %1$s</string>
<string name="uv_post_comment">Pošalji komentar</string>
<string name="uv_next">Dalje</string>
<string name="uv_none_of_these_help">Nijedno ne pomaže</string>
<string name="uv_send_message">Šalji poruku</string>
<string name="uv_your_email_address">Vaša email adresa</string>
<string name="uv_your_name">Vaše ime</string>
<string name="uv_name_hint">“Anonymous”</string>
<string name="uv_select_one">Odaberi</string>
<string name="uv_value">Vrijednost</string>
<string name="uv_article">Članak</string>
<string name="uv_idea">Ideja</string>
<string name="uv_msg_ticket_created">Vaša poruka je poslana</string>
<string name="uv_msg_idea_created">Vaša iedja je kreirana</string>
<string name="uv_article_instant_answer_question">Da li ovaj članak pomaže?</string>
<string name="uv_suggestion_instant_answer_question">Da li je ova ideja korisna?</string>
<string name="uv_no">Ne</string>
<string name="uv_yes">Da</string>
<string name="uv_very_yes">Da!</string>
<string name="uv_helpful_article_message_question">Da li još uvijek želite poslati poruku?</string>
<string name="uv_unhelpful_article_message_question">Želite li nam poslati poruku?</string>
<string name="uv_idea_description_heading">Opišite detaljnije svoju ideju</string>
<string name="uv_category">Kategorija</string>
<string name="uv_idea_description_hint">(opcija)</string>
<string name="uv_idea_text_heading">Predlažem da…</string>
<string name="uv_idea_text_hint">Unesite svoju ideju…</string>
<string name="uv_idea_form_help">Kad apošaljete ideju u naš forum, ostali će se moći pretplatiti na ideju i kometirati. Ako mi odgovorimo, bit ćete obaviješteni.</string>
<string name="uv_contact_us">Kontakt</string>
<string name="uv_close">Zatvori</string>
<string name="uv_new_comment">Novi komentar</string>
<string name="uv_error">Greška</string>
<string name="uv_msg_user_identity_validation">Unesite svoj email address</string>
<string name="uv_status_format">Status: %1$s</string>
<string name="uv_subscribe">Pretplati se</string>
<string name="uv_nevermind">Nema veze</string>
<string name="uv_msg_subscribe">Obavještavat ćemo Vas o napretku ideje.</string>
<string name="uv_msg_subscribe_success">Pretplaćeni ste na ovu ideju.</string>
<string name="uv_msg_unsubscribe">Otkazali ste pretplatu na ovu ideju.</string>
<string name="uv_msg_custom_fields_validation">Molim popunite sva obvezna polja.</string>
<string name="uv_contact_hint">Upišite svojue pitanje ili feedback</string>
<string name="uv_matching_ideas">Podudarne ideje</string>
<string name="uv_matching_articles">Podudarni članci</string>
<string name="uv_matching_articles_and_ideas">Podudarni članci i ideje</string>
<string name="uv_post_idea_continue_button">I dalje želim poslati moju ideju</string>
<string name="uv_contact_continue_button">I dalje želim poslati poruku</string>
<string name="uv_i_want_this">Ja to želim!</string>
<string name="uv_post_a_comment">Pošalji komentar</string>
<string name="uv_all_results_filter">SVE</string>
<string name="uv_articles_filter">ČLANCI</string>
<string name="uv_ideas_filter">IDEJE</string>
<string name="uv_comment_hint">Upišite svoj komentar</string>
<string name="uv_cancel">Odustani</string>
<string name="uv_select_none">(nijedno)</string>
<string name="uv_confirm">Potvrda</string>
<string name="uv_msg_confirm_discard_idea">Sigurni ste da želite odbaciti svoju ideju?</string>
<string name="uv_msg_confirm_discard_message">Sigurni ste da želite odbaciti svoju poruku?</string>
<string name="uv_post_an_idea">Pošalji ideju</string>
<string name="uv_password_dialog_title">Molim upišite lozinku</string>
<string name="uv_article_browse_question">Da li je ovaj članak pomogao?</string>
<string name="uv_thanks">Hvala!</string>
<string name="uv_powered_by_uservoice">Powered by UserVoice</string>
<string name="uv_android_sdk">Android SDK</string>
<string name="uv_msg_bad_email_format">Molim upišite ispravnu email adresu.</string>
</resources>
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
package com.uservoice.uservoicesdk;

import android.util.Log;

import java.util.Date;
import java.util.HashMap;
import java.util.Map;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,6 @@ public ClientConfig getClientConfig() {

public void setClientConfig(ClientConfig clientConfig) {
this.clientConfig = clientConfig;
Babayaga.flush();
}

public void setExternalId(String scope, String id) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,22 +17,18 @@
public class UserVoice {

public static void launchUserVoice(Context context) {
Babayaga.track(Babayaga.Event.VIEW_CHANNEL);
context.startActivity(new Intent(context, PortalActivity.class));
}

public static void launchForum(Context context) {
Babayaga.track(Babayaga.Event.VIEW_CHANNEL);
context.startActivity(new Intent(context, ForumActivity.class));
}

public static void launchContactUs(Context context) {
Babayaga.track(Babayaga.Event.VIEW_CHANNEL);
context.startActivity(new Intent(context, ContactActivity.class));
}

public static void launchPostIdea(Context context) {
Babayaga.track(Babayaga.Event.VIEW_CHANNEL);
context.startActivity(new Intent(context, PostIdeaActivity.class));
}

Expand All @@ -42,19 +38,6 @@ public static void init(Config config, Context context) {
Babayaga.setUserTraits(config.getUserTraits());
Session.getInstance().setContext(context);
Session.getInstance().setConfig(config);

// we have to do this preemptively so that Babayaga can send the view_app event
ClientConfig.loadClientConfig(new DefaultCallback<ClientConfig>(context) {
@Override
public void onModel(ClientConfig model) {
Session.getInstance().setClientConfig(model);
}

@Override
public void onError(RestResult error) {
// ignore
}
});
}

public static void setExternalId(String scope, String id) {
Expand All @@ -70,6 +53,6 @@ public static void track(String event) {
}

public static String getVersion() {
return "1.0.1";
return "1.1.0";
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ public class Babayaga {

static String DOMAIN = "by.uservoice.com";
public static String CHANNEL = "d";
public static String EXTERNAL_CHANNEL = "x";

private static class Track {
public String event;
Expand All @@ -30,7 +31,6 @@ public Track(String event, Map<String, Object> eventProps) {
private static String uvts;
private static Map<String, Object> traits;
private static SharedPreferences prefs;
private static List<Track> queue = new ArrayList<Track>();

public enum Event {
VIEW_APP("g"),
Expand Down Expand Up @@ -99,19 +99,8 @@ public static void track(Event event, Map<String, Object> eventProps) {
}

public static void track(String event, Map<String, Object> eventProps) {
if (Session.getInstance().getClientConfig() == null) {
queue.add(new Track(event, eventProps));
} else {
// Log.d("UV", "BY flushing: " + event);
new BabayagaTask(event, uvts, traits, eventProps).execute();
}
}

public static void flush() {
for (Track track : queue) {
track(track.event, track.eventProps);
}
queue = new ArrayList<Track>();
// Log.d("UV", "BY flushing: " + event);
new BabayagaTask(event, uvts, traits, eventProps).execute();
}

public static void init(Context context) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,17 @@ protected Void doInBackground(String... args) {
if (eventProps != null && !eventProps.isEmpty()) {
data.put("e", eventProps);
}
String subdomainId = Session.getInstance().getClientConfig().getSubdomainId();
StringBuilder url = new StringBuilder(String.format("https://%s/t/%s/%s/%s", Babayaga.DOMAIN, subdomainId, Babayaga.CHANNEL, event));
String subdomain;
String route;
if (Session.getInstance().getClientConfig() != null) {
subdomain = Session.getInstance().getClientConfig().getSubdomainId();
route = "t";
} else {
subdomain = Session.getInstance().getConfig().getSite().split("\\.")[0];
route = "t/k";
}
String channel = event.equals(Babayaga.Event.VIEW_APP) ? Babayaga.EXTERNAL_CHANNEL : Babayaga.CHANNEL;
StringBuilder url = new StringBuilder(String.format("https://%s/%s/%s/%s/%s", Babayaga.DOMAIN, route, subdomain, channel, event));
if (uvts != null) {
url.append("/");
url.append(uvts);
Expand All @@ -64,6 +73,7 @@ protected Void doInBackground(String... args) {
throw new RuntimeException(e);
}
}
Log.d("UV", url.toString());

HttpRequestBase request = new HttpGet();
request.setURI(new URI(url.toString()));
Expand Down
Loading

0 comments on commit 5c9c17a

Please sign in to comment.