| Line 5... |
Line 5... |
| 5 |
import android.content.Context;
|
5 |
import android.content.Context;
|
| 6 |
import android.content.DialogInterface;
|
6 |
import android.content.DialogInterface;
|
| 7 |
import android.content.Intent;
|
7 |
import android.content.Intent;
|
| 8 |
import android.content.SharedPreferences;
|
8 |
import android.content.SharedPreferences;
|
| 9 |
import android.net.ConnectivityManager;
|
9 |
import android.net.ConnectivityManager;
|
| - |
|
10 |
import android.net.Uri;
|
| 10 |
import android.os.AsyncTask;
|
11 |
import android.os.AsyncTask;
|
| 11 |
import android.support.v7.app.ActionBarActivity;
|
12 |
import android.support.v7.app.ActionBarActivity;
|
| 12 |
import android.os.Bundle;
|
13 |
import android.os.Bundle;
|
| 13 |
import android.text.SpannableString;
|
14 |
import android.text.SpannableString;
|
| 14 |
import android.text.style.UnderlineSpan;
|
15 |
import android.text.style.UnderlineSpan;
|
| Line 29... |
Line 30... |
| 29 |
import com.google.android.gms.plus.Plus;
|
30 |
import com.google.android.gms.plus.Plus;
|
| 30 |
import com.mixpanel.android.mpmetrics.MixpanelAPI;
|
31 |
import com.mixpanel.android.mpmetrics.MixpanelAPI;
|
| 31 |
import com.saholic.profittill.Constants.ProfitTillConstants;
|
32 |
import com.saholic.profittill.Constants.ProfitTillConstants;
|
| 32 |
import com.saholic.profittill.R;
|
33 |
import com.saholic.profittill.R;
|
| 33 |
import com.saholic.profittill.Utils.AnalyticsUtility;
|
34 |
import com.saholic.profittill.Utils.AnalyticsUtility;
|
| - |
|
35 |
import com.saholic.profittill.Utils.UtilityFunctions;
|
| 34 |
import com.saholic.profittill.Volley.Analytics;
|
36 |
import com.saholic.profittill.Volley.Analytics;
|
| 35 |
import com.saholic.profittill.Volley.AnalyticsErrorResponse;
|
37 |
import com.saholic.profittill.Volley.AnalyticsErrorResponse;
|
| 36 |
import com.saholic.profittill.Volley.AnalyticsJsonResponse;
|
38 |
import com.saholic.profittill.Volley.AnalyticsJsonResponse;
|
| 37 |
import com.testin.agent.TestinAgent;
|
39 |
import com.testin.agent.TestinAgent;
|
| 38 |
|
40 |
|
| Line 63... |
Line 65... |
| 63 |
TextView skipMobileNumber;
|
65 |
TextView skipMobileNumber;
|
| 64 |
Button phoneNumberFirstTimeButton;
|
66 |
Button phoneNumberFirstTimeButton;
|
| 65 |
boolean glogout;
|
67 |
boolean glogout;
|
| 66 |
MixpanelAPI mixpanel;
|
68 |
MixpanelAPI mixpanel;
|
| 67 |
String type1;
|
69 |
String type1;
|
| - |
|
70 |
ArrayList<NameValuePair> nameValuePairsGcm;
|
| 68 |
public GoogleApiClient mGoogleApiClient;
|
71 |
public GoogleApiClient mGoogleApiClient;
|
| 69 |
@Override
|
72 |
@Override
|
| 70 |
protected void onCreate(Bundle savedInstanceState) {
|
73 |
protected void onCreate(Bundle savedInstanceState) {
|
| 71 |
super.onCreate(savedInstanceState);
|
74 |
super.onCreate(savedInstanceState);
|
| 72 |
setContentView(R.layout.activity_mobile_number);
|
75 |
setContentView(R.layout.activity_mobile_number);
|
| Line 94... |
Line 97... |
| 94 |
.addConnectionCallbacks(this)
|
97 |
.addConnectionCallbacks(this)
|
| 95 |
.addOnConnectionFailedListener(this).addApi(Plus.API)
|
98 |
.addOnConnectionFailedListener(this).addApi(Plus.API)
|
| 96 |
.addScope(Plus.SCOPE_PLUS_LOGIN).build();
|
99 |
.addScope(Plus.SCOPE_PLUS_LOGIN).build();
|
| 97 |
mGoogleApiClient.connect();
|
100 |
mGoogleApiClient.connect();
|
| 98 |
}
|
101 |
}
|
| - |
|
102 |
if(getIntent().getAction()=="31"){
|
| - |
|
103 |
String emailURL= String.valueOf(getIntent().getData());
|
| - |
|
104 |
Uri url = Uri.parse(emailURL);
|
| - |
|
105 |
String campaignId = url.getQueryParameter("campaign");
|
| - |
|
106 |
if(url.getQueryParameter("intent_type").equalsIgnoreCase("url")) {
|
| - |
|
107 |
t.send(new HitBuilders.EventBuilder()
|
| - |
|
108 |
.setCategory("Message/Email")
|
| - |
|
109 |
.setAction("Message/Email Opened For User Id " + UtilityFunctions.campaignUserId(url))
|
| - |
|
110 |
.setLabel("Campaign Id " + campaignId)
|
| - |
|
111 |
.build());
|
| - |
|
112 |
new Analytics(ProfitTillConstants.ANALYTICS_URL,
|
| - |
|
113 |
AnalyticsUtility.getAnalyticsRequest(MobileNumber.this, UtilityFunctions.campaignUserId(url), "Message", "Message Opened Mobile", campaignId),
|
| - |
|
114 |
AnalyticsJsonResponse.getAnalyticsRequestInstance(),
|
| - |
|
115 |
AnalyticsErrorResponse.getAnalyitcsResponseInstance()).anlyticsRequest(MobileNumber.this);
|
| - |
|
116 |
nameValuePairsGcm = new ArrayList<>();
|
| - |
|
117 |
nameValuePairsGcm.add(new BasicNameValuePair("user_id", UtilityFunctions.campaignUserId(url)));
|
| - |
|
118 |
nameValuePairsGcm.add(new BasicNameValuePair("cid", campaignId));
|
| - |
|
119 |
nameValuePairsGcm.add(new BasicNameValuePair("timestamp", UtilityFunctions.notificationDate()));
|
| - |
|
120 |
nameValuePairsGcm.add(new BasicNameValuePair("result", "message_opened_mobile"));
|
| - |
|
121 |
new NotificationOpenedData().execute(nameValuePairsGcm);
|
| - |
|
122 |
}else{
|
| - |
|
123 |
nameValuePairsGcm = new ArrayList<>();
|
| - |
|
124 |
nameValuePairsGcm.add(new BasicNameValuePair("user_id", userData.getString("id","")));
|
| - |
|
125 |
nameValuePairsGcm.add(new BasicNameValuePair("cid", campaignId));
|
| - |
|
126 |
nameValuePairsGcm.add(new BasicNameValuePair("timestamp", UtilityFunctions.notificationDate()));
|
| - |
|
127 |
nameValuePairsGcm.add(new BasicNameValuePair("result", "message_opened_mobile"));
|
| - |
|
128 |
new NotificationOpenedData().execute(nameValuePairsGcm);
|
| - |
|
129 |
}
|
| 99 |
|
130 |
}
|
| 100 |
phoneNumberFirstTime=(EditText)findViewById(R.id.phoneNumberFirstTime);
|
131 |
phoneNumberFirstTime=(EditText)findViewById(R.id.phoneNumberFirstTime);
|
| 101 |
skipMobileNumber = (TextView)findViewById(R.id.skipMobileNumber);
|
132 |
skipMobileNumber = (TextView)findViewById(R.id.skipMobileNumber);
|
| 102 |
phoneNumberFirstTimeButton=(Button)findViewById(R.id.phoneNumberFirstTimeButton);
|
133 |
phoneNumberFirstTimeButton=(Button)findViewById(R.id.phoneNumberFirstTimeButton);
|
| 103 |
SpannableString content = new SpannableString(skipMobileNumber.getText().toString());
|
134 |
SpannableString content = new SpannableString(skipMobileNumber.getText().toString());
|
| 104 |
content.setSpan(new UnderlineSpan(), 0, content.length(), 0);
|
135 |
content.setSpan(new UnderlineSpan(), 0, content.length(), 0);
|
| Line 342... |
Line 373... |
| 342 |
return false;
|
373 |
return false;
|
| 343 |
}
|
374 |
}
|
| 344 |
return false;
|
375 |
return false;
|
| 345 |
}
|
376 |
}
|
| 346 |
|
377 |
|
| - |
|
378 |
class NotificationOpenedData extends AsyncTask<ArrayList<NameValuePair>, Integer, String> {
|
| - |
|
379 |
|
| - |
|
380 |
@Override
|
| - |
|
381 |
protected void onPreExecute() {
|
| - |
|
382 |
super.onPreExecute();
|
| - |
|
383 |
}
|
| - |
|
384 |
|
| - |
|
385 |
@Override
|
| - |
|
386 |
protected String doInBackground(ArrayList<NameValuePair>... arg0) {
|
| - |
|
387 |
|
| - |
|
388 |
try {
|
| - |
|
389 |
HttpClient httpclient = new DefaultHttpClient();
|
| - |
|
390 |
HttpPost httppost = new HttpPost(apiData.getString("notication.data.url","http://api.profittill.com/pushnotifications/add"));
|
| - |
|
391 |
httppost.setHeader("Authorization", ProfitTillConstants.BASIC_AUTH);
|
| - |
|
392 |
httppost.setEntity(new UrlEncodedFormEntity(arg0[0]));
|
| - |
|
393 |
HttpResponse response = httpclient.execute(httppost);
|
| - |
|
394 |
HttpEntity entity = response.getEntity();
|
| - |
|
395 |
int status = response.getStatusLine().getStatusCode();
|
| - |
|
396 |
nameValuePairsGcm.clear();
|
| - |
|
397 |
} catch (Exception e) {
|
| - |
|
398 |
Log.e("Fail 1", e.toString());
|
| - |
|
399 |
|
| - |
|
400 |
}
|
| - |
|
401 |
return "success";
|
| - |
|
402 |
}
|
| - |
|
403 |
|
| - |
|
404 |
@Override
|
| - |
|
405 |
protected void onPostExecute(String result) {
|
| - |
|
406 |
super.onPostExecute(result);
|
| - |
|
407 |
}
|
| - |
|
408 |
}
|
| - |
|
409 |
|
| 347 |
}
|
410 |
}
|