add flutter
This commit is contained in:
0
OnTime_User_live/app/.gitignore
vendored
Normal file → Executable file
0
OnTime_User_live/app/.gitignore
vendored
Normal file → Executable file
18
OnTime_User_live/app/build.gradle
Normal file → Executable file
18
OnTime_User_live/app/build.gradle
Normal file → Executable file
@@ -14,12 +14,12 @@ android {
|
||||
keyPassword '123456@ontime'
|
||||
}
|
||||
}
|
||||
compileSdk 33
|
||||
compileSdk 34
|
||||
|
||||
defaultConfig {
|
||||
applicationId "id.ontime.customer"
|
||||
minSdkVersion 21
|
||||
targetSdkVersion 33
|
||||
minSdkVersion 23
|
||||
targetSdkVersion 34
|
||||
versionCode 10
|
||||
versionName '1.1.0'
|
||||
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
|
||||
@@ -60,12 +60,12 @@ dependencies {
|
||||
implementation 'com.google.android.libraries.places:places:2.5.0'
|
||||
implementation 'com.google.android.gms:play-services-maps:18.0.2'
|
||||
implementation 'com.google.android.gms:play-services-auth:20.1.0'
|
||||
implementation 'com.google.firebase:firebase-database:20.0.3'
|
||||
implementation 'com.google.firebase:firebase-storage:20.0.0'
|
||||
implementation 'com.google.firebase:firebase-core:20.1.0'
|
||||
implementation 'com.google.firebase:firebase-messaging:20.2.0'
|
||||
implementation 'com.google.firebase:firebase-auth:19.3.1'
|
||||
implementation 'com.google.firebase:firebase-appcheck-playintegrity:16.1.0'
|
||||
implementation platform('com.google.firebase:firebase-bom:33.1.0')
|
||||
implementation 'com.google.firebase:firebase-database'
|
||||
implementation 'com.google.firebase:firebase-storage'
|
||||
implementation 'com.google.firebase:firebase-messaging'
|
||||
implementation 'com.google.firebase:firebase-auth'
|
||||
implementation 'com.google.firebase:firebase-appcheck-playintegrity'
|
||||
implementation 'com.jakewharton.picasso:picasso2-okhttp3-downloader:1.1.0'
|
||||
implementation 'androidx.appcompat:appcompat:1.4.1'
|
||||
implementation 'androidx.recyclerview:recyclerview:1.2.1'
|
||||
|
||||
0
OnTime_User_live/app/butterknife-proguard-rules.pro
Normal file → Executable file
0
OnTime_User_live/app/butterknife-proguard-rules.pro
Normal file → Executable file
0
OnTime_User_live/app/google-services.json.old
Normal file → Executable file
0
OnTime_User_live/app/google-services.json.old
Normal file → Executable file
0
OnTime_User_live/app/guava-proguard-rules.pro
Normal file → Executable file
0
OnTime_User_live/app/guava-proguard-rules.pro
Normal file → Executable file
0
OnTime_User_live/app/okhttp3-proguard-rules.pro
Normal file → Executable file
0
OnTime_User_live/app/okhttp3-proguard-rules.pro
Normal file → Executable file
0
OnTime_User_live/app/proguard-rules.pro
vendored
Normal file → Executable file
0
OnTime_User_live/app/proguard-rules.pro
vendored
Normal file → Executable file
0
OnTime_User_live/app/release/output-metadata.json
Normal file → Executable file
0
OnTime_User_live/app/release/output-metadata.json
Normal file → Executable file
0
OnTime_User_live/app/retrofit-proguard-rules.pro
Normal file → Executable file
0
OnTime_User_live/app/retrofit-proguard-rules.pro
Normal file → Executable file
0
OnTime_User_live/app/saripaar-proguard-rules.pro
Normal file → Executable file
0
OnTime_User_live/app/saripaar-proguard-rules.pro
Normal file → Executable file
26
OnTime_User_live/app/sharuser.txt
Normal file
26
OnTime_User_live/app/sharuser.txt
Normal file
@@ -0,0 +1,26 @@
|
||||
Alias name: ontimekeystore
|
||||
Creation date: Oct 26, 2022
|
||||
Entry type: PrivateKeyEntry
|
||||
Certificate chain length: 1
|
||||
Certificate[1]:
|
||||
Owner: CN=Ontime Apps
|
||||
Issuer: CN=Ontime Apps
|
||||
Serial number: 39fdbb23
|
||||
Valid from: Wed Oct 26 11:27:28 WIB 2022 until: Thu Oct 13 11:27:28 WIB 2072
|
||||
Certificate fingerprints:
|
||||
SHA1: DC:13:DA:DC:9F:5F:A8:AD:3A:6C:F7:1C:5C:94:55:BB:AD:2E:F6:10
|
||||
SHA256: 73:17:40:D3:E1:63:4A:2E:AB:C1:BA:0A:65:BD:A4:77:A2:FB:CC:F5:46:C1:87:3D:AE:6D:87:4B:94:5C:2B:66
|
||||
Signature algorithm name: SHA256withRSA
|
||||
Subject Public Key Algorithm: 2048-bit RSA key
|
||||
Version: 3
|
||||
|
||||
Extensions:
|
||||
|
||||
#1: ObjectId: 2.5.29.14 Criticality=false
|
||||
SubjectKeyIdentifier [
|
||||
KeyIdentifier [
|
||||
0000: 04 8E EC F7 50 72 86 16 C2 AF 1C 2B A9 B4 63 47 ....Pr.....+..cG
|
||||
0010: 71 55 24 44 qU$D
|
||||
]
|
||||
]
|
||||
|
||||
1
OnTime_User_live/app/src/main/AndroidManifest.xml
Normal file → Executable file
1
OnTime_User_live/app/src/main/AndroidManifest.xml
Normal file → Executable file
@@ -1,7 +1,6 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
package="id.ontime.customer"
|
||||
android:installLocation="auto">
|
||||
|
||||
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
|
||||
|
||||
0
OnTime_User_live/app/src/main/assets/fonts/Montserrat_Bold.ttf
Normal file → Executable file
0
OnTime_User_live/app/src/main/assets/fonts/Montserrat_Bold.ttf
Normal file → Executable file
0
OnTime_User_live/app/src/main/assets/fonts/Montserrat_Medium.ttf
Normal file → Executable file
0
OnTime_User_live/app/src/main/assets/fonts/Montserrat_Medium.ttf
Normal file → Executable file
0
OnTime_User_live/app/src/main/assets/fonts/Montserrat_Regular.ttf
Normal file → Executable file
0
OnTime_User_live/app/src/main/assets/fonts/Montserrat_Regular.ttf
Normal file → Executable file
0
OnTime_User_live/app/src/main/assets/fonts/Montserrat_SemiBold.ttf
Normal file → Executable file
0
OnTime_User_live/app/src/main/assets/fonts/Montserrat_SemiBold.ttf
Normal file → Executable file
0
OnTime_User_live/app/src/main/assets/fonts/NeoSansPro_Medium.ttf
Normal file → Executable file
0
OnTime_User_live/app/src/main/assets/fonts/NeoSansPro_Medium.ttf
Normal file → Executable file
0
OnTime_User_live/app/src/main/assets/fonts/NeoSans_Pro_Regular.ttf
Normal file → Executable file
0
OnTime_User_live/app/src/main/assets/fonts/NeoSans_Pro_Regular.ttf
Normal file → Executable file
0
OnTime_User_live/app/src/main/assets/fonts/OpenSans-Bold.ttf
Normal file → Executable file
0
OnTime_User_live/app/src/main/assets/fonts/OpenSans-Bold.ttf
Normal file → Executable file
0
OnTime_User_live/app/src/main/assets/fonts/OpenSans-Light.ttf
Normal file → Executable file
0
OnTime_User_live/app/src/main/assets/fonts/OpenSans-Light.ttf
Normal file → Executable file
0
OnTime_User_live/app/src/main/assets/fonts/OpenSans-Regular.ttf
Normal file → Executable file
0
OnTime_User_live/app/src/main/assets/fonts/OpenSans-Regular.ttf
Normal file → Executable file
0
OnTime_User_live/app/src/main/assets/fonts/ride_rewrite_bungee.ttf
Normal file → Executable file
0
OnTime_User_live/app/src/main/assets/fonts/ride_rewrite_bungee.ttf
Normal file → Executable file
0
OnTime_User_live/app/src/main/ic_launcher-playstore.png
Normal file → Executable file
0
OnTime_User_live/app/src/main/ic_launcher-playstore.png
Normal file → Executable file
|
Before Width: | Height: | Size: 22 KiB After Width: | Height: | Size: 22 KiB |
0
OnTime_User_live/app/src/main/java/customfonts/AutoCompleteTextViewSFProDisplayRegular.java
Normal file → Executable file
0
OnTime_User_live/app/src/main/java/customfonts/AutoCompleteTextViewSFProDisplayRegular.java
Normal file → Executable file
0
OnTime_User_live/app/src/main/java/customfonts/Button_SF_Pro_Display_Medium.java
Normal file → Executable file
0
OnTime_User_live/app/src/main/java/customfonts/Button_SF_Pro_Display_Medium.java
Normal file → Executable file
0
OnTime_User_live/app/src/main/java/customfonts/EditTextSFProDisplayMedium.java
Normal file → Executable file
0
OnTime_User_live/app/src/main/java/customfonts/EditTextSFProDisplayMedium.java
Normal file → Executable file
0
OnTime_User_live/app/src/main/java/customfonts/EditTextSFProDisplayRegular.java
Normal file → Executable file
0
OnTime_User_live/app/src/main/java/customfonts/EditTextSFProDisplayRegular.java
Normal file → Executable file
0
OnTime_User_live/app/src/main/java/customfonts/RadioButton_SF_Pro_Display_Medium.java
Normal file → Executable file
0
OnTime_User_live/app/src/main/java/customfonts/RadioButton_SF_Pro_Display_Medium.java
Normal file → Executable file
0
OnTime_User_live/app/src/main/java/customfonts/TextViewSFProDisplayMedium.java
Normal file → Executable file
0
OnTime_User_live/app/src/main/java/customfonts/TextViewSFProDisplayMedium.java
Normal file → Executable file
0
OnTime_User_live/app/src/main/java/customfonts/TextViewSFProDisplayRegular.java
Normal file → Executable file
0
OnTime_User_live/app/src/main/java/customfonts/TextViewSFProDisplayRegular.java
Normal file → Executable file
0
OnTime_User_live/app/src/main/java/id/ontime/customer/activity/AllBeritaActivity.java
Normal file → Executable file
0
OnTime_User_live/app/src/main/java/id/ontime/customer/activity/AllBeritaActivity.java
Normal file → Executable file
0
OnTime_User_live/app/src/main/java/id/ontime/customer/activity/AllMerchantActivity.java
Normal file → Executable file
0
OnTime_User_live/app/src/main/java/id/ontime/customer/activity/AllMerchantActivity.java
Normal file → Executable file
0
OnTime_User_live/app/src/main/java/id/ontime/customer/activity/BeritaDetailActivity.java
Normal file → Executable file
0
OnTime_User_live/app/src/main/java/id/ontime/customer/activity/BeritaDetailActivity.java
Normal file → Executable file
0
OnTime_User_live/app/src/main/java/id/ontime/customer/activity/ChangepassActivity.java
Normal file → Executable file
0
OnTime_User_live/app/src/main/java/id/ontime/customer/activity/ChangepassActivity.java
Normal file → Executable file
9
OnTime_User_live/app/src/main/java/id/ontime/customer/activity/ChatActivity.java
Normal file → Executable file
9
OnTime_User_live/app/src/main/java/id/ontime/customer/activity/ChatActivity.java
Normal file → Executable file
@@ -660,7 +660,7 @@ public class ChatActivity extends AppCompatActivity {
|
||||
chat.tokendriver = tokendriver;
|
||||
chat.tokenuser = tokenku;
|
||||
chat.message = message;
|
||||
sendMessageToDriver(tokenku, chat);
|
||||
sendMessageToDriver(tokendriver, chat);
|
||||
}
|
||||
});
|
||||
}
|
||||
@@ -781,7 +781,7 @@ public class ChatActivity extends AppCompatActivity {
|
||||
chat.tokendriver = tokendriver;
|
||||
chat.tokenuser = tokenku;
|
||||
chat.message = "Send Image.......";
|
||||
sendMessageToDriver(tokenku, chat);
|
||||
sendMessageToDriver(tokendriver, chat);
|
||||
|
||||
|
||||
}
|
||||
@@ -1372,7 +1372,10 @@ public class ChatActivity extends AppCompatActivity {
|
||||
}
|
||||
|
||||
private void sendMessageToDriver(final String regIDTujuan, final Chat chat) {
|
||||
|
||||
// Only use Firebase service when target token is ready (as in test).
|
||||
if (regIDTujuan == null || regIDTujuan.trim().isEmpty()) {
|
||||
return;
|
||||
}
|
||||
final FCMMessage message = new FCMMessage();
|
||||
message.setTo(regIDTujuan);
|
||||
message.setData(chat);
|
||||
|
||||
0
OnTime_User_live/app/src/main/java/id/ontime/customer/activity/Config.java
Normal file → Executable file
0
OnTime_User_live/app/src/main/java/id/ontime/customer/activity/Config.java
Normal file → Executable file
0
OnTime_User_live/app/src/main/java/id/ontime/customer/activity/ConfirmWAActivity.java
Normal file → Executable file
0
OnTime_User_live/app/src/main/java/id/ontime/customer/activity/ConfirmWAActivity.java
Normal file → Executable file
0
OnTime_User_live/app/src/main/java/id/ontime/customer/activity/DetailMerchantActivity.java
Normal file → Executable file
0
OnTime_User_live/app/src/main/java/id/ontime/customer/activity/DetailMerchantActivity.java
Normal file → Executable file
1750
OnTime_User_live/app/src/main/java/id/ontime/customer/activity/DetailOrderActivity.java
Normal file → Executable file
1750
OnTime_User_live/app/src/main/java/id/ontime/customer/activity/DetailOrderActivity.java
Normal file → Executable file
File diff suppressed because it is too large
Load Diff
0
OnTime_User_live/app/src/main/java/id/ontime/customer/activity/EditProfileActivity.java
Normal file → Executable file
0
OnTime_User_live/app/src/main/java/id/ontime/customer/activity/EditProfileActivity.java
Normal file → Executable file
0
OnTime_User_live/app/src/main/java/id/ontime/customer/activity/FavoriteNewsActivity.java
Normal file → Executable file
0
OnTime_User_live/app/src/main/java/id/ontime/customer/activity/FavoriteNewsActivity.java
Normal file → Executable file
0
OnTime_User_live/app/src/main/java/id/ontime/customer/activity/IntroActivity.java
Normal file → Executable file
0
OnTime_User_live/app/src/main/java/id/ontime/customer/activity/IntroActivity.java
Normal file → Executable file
104
OnTime_User_live/app/src/main/java/id/ontime/customer/activity/LoginActivity.java
Normal file → Executable file
104
OnTime_User_live/app/src/main/java/id/ontime/customer/activity/LoginActivity.java
Normal file → Executable file
@@ -47,7 +47,7 @@ import com.google.firebase.auth.FirebaseAuth;
|
||||
import com.google.firebase.auth.FirebaseAuthInvalidCredentialsException;
|
||||
import com.google.firebase.auth.PhoneAuthCredential;
|
||||
import com.google.firebase.auth.PhoneAuthProvider;
|
||||
import com.google.firebase.iid.FirebaseInstanceId;
|
||||
import com.google.firebase.messaging.FirebaseMessaging;
|
||||
import com.ybs.countrypicker.CountryPicker;
|
||||
import com.ybs.countrypicker.CountryPickerListener;
|
||||
|
||||
@@ -67,6 +67,8 @@ import retrofit2.converter.gson.GsonConverterFactory;
|
||||
|
||||
public class LoginActivity extends AppCompatActivity {
|
||||
|
||||
private static final String TAG = "UserLogin";
|
||||
|
||||
EditText phoneText, password, email, numOne, numTwo, numThree, numFour, numFive, numSix;
|
||||
TextView countryCode, sendTo, privacypolicy, textnotif, daftar, textnotif2, lupapass;
|
||||
Button buttonLogin, confirmButton;
|
||||
@@ -164,6 +166,12 @@ public class LoginActivity extends AppCompatActivity {
|
||||
notif(getString(R.string.phonepass));
|
||||
} else {
|
||||
if (NetworkUtils.isConnected(LoginActivity.this)) {
|
||||
// Phone login requires Firebase for SMS verification. When unavailable, only email works.
|
||||
if (!hasEmail && fbAuth == null) {
|
||||
notif(getString(R.string.phone_verification_unavailable));
|
||||
return;
|
||||
}
|
||||
|
||||
// For email+password login, skip SMS verification.
|
||||
verify = hasEmail ? "true" : "false";
|
||||
|
||||
@@ -413,7 +421,7 @@ public class LoginActivity extends AppCompatActivity {
|
||||
public void Send_Number_tofirebase(String phoneNumber) {
|
||||
if (fbAuth == null) {
|
||||
progresshide();
|
||||
notif2(getString(R.string.text_noInternet));
|
||||
notif2(getString(R.string.phone_verification_unavailable));
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -480,7 +488,7 @@ public class LoginActivity extends AppCompatActivity {
|
||||
private void signInWithPhoneAuthCredential(PhoneAuthCredential credential) {
|
||||
if (fbAuth == null) {
|
||||
progresshide();
|
||||
notif2(getString(R.string.text_noInternet));
|
||||
notif2(getString(R.string.phone_verification_unavailable));
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -509,7 +517,7 @@ public class LoginActivity extends AppCompatActivity {
|
||||
|
||||
if (fbAuth == null) {
|
||||
progresshide();
|
||||
notif2(getString(R.string.text_noInternet));
|
||||
notif2(getString(R.string.phone_verification_unavailable));
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -525,56 +533,116 @@ public class LoginActivity extends AppCompatActivity {
|
||||
|
||||
private void onSignInClick() {
|
||||
progressshow();
|
||||
LoginRequestJson request = new LoginRequestJson();
|
||||
final LoginRequestJson request = new LoginRequestJson();
|
||||
String emailText = email.getText().toString().trim();
|
||||
String phoneDigits = phoneText.getText().toString().trim();
|
||||
|
||||
if (!TextUtils.isEmpty(emailText)) {
|
||||
// Login using email + password
|
||||
request.setEmail(emailText);
|
||||
request.setNotelepon("");
|
||||
} else {
|
||||
// Login using phone number + password (legacy flow)
|
||||
request.setEmail(null);
|
||||
request.setNotelepon(countryCode.getText().toString().replace("+", "") + phoneDigits);
|
||||
}
|
||||
request.setPassword(password.getText().toString());
|
||||
try {
|
||||
FirebaseInstanceId token = FirebaseInstanceId.getInstance();
|
||||
request.setRegId(token.getToken());
|
||||
} catch (Exception e) {
|
||||
Log.e("LoginActivity", "Failed to get FirebaseInstanceId token; continuing without regId", e);
|
||||
request.setRegId(null);
|
||||
|
||||
// FCM token is required: prefer cached token from Realm, otherwise fetch a fresh one.
|
||||
Realm realm = BaseApp.getInstance(this).getRealmInstance();
|
||||
FirebaseToken storedToken = realm.where(FirebaseToken.class).findFirst();
|
||||
if (storedToken != null && storedToken.getTokenId() != null && !storedToken.getTokenId().isEmpty()) {
|
||||
request.setRegId(storedToken.getTokenId());
|
||||
doLoginRequest(request, emailText);
|
||||
return;
|
||||
}
|
||||
|
||||
try {
|
||||
FirebaseMessaging.getInstance().getToken()
|
||||
.addOnCompleteListener(task -> {
|
||||
if (task.isSuccessful() && task.getResult() != null && !task.getResult().isEmpty()) {
|
||||
String fcmToken = task.getResult();
|
||||
request.setRegId(fcmToken);
|
||||
// Persist for subsequent logins.
|
||||
realm.executeTransaction(r -> {
|
||||
FirebaseToken t = new FirebaseToken(fcmToken);
|
||||
r.delete(FirebaseToken.class);
|
||||
r.copyToRealm(t);
|
||||
});
|
||||
doLoginRequest(request, emailText);
|
||||
} else {
|
||||
progresshide();
|
||||
Log.e(TAG, "FCM getToken failed: " + (task.getException() != null ? task.getException().getMessage() : "empty token"));
|
||||
notif(getString(R.string.fcm_token_required));
|
||||
}
|
||||
});
|
||||
} catch (IllegalStateException e) {
|
||||
progresshide();
|
||||
Log.e(TAG, "FirebaseMessaging not available; FCM token is required", e);
|
||||
notif(getString(R.string.fcm_token_required));
|
||||
}
|
||||
}
|
||||
|
||||
private void doLoginRequest(LoginRequestJson request, String emailText) {
|
||||
Log.d(TAG, "Login request: baseUrl=" + Constants.CONNECTION + " endpoint=pelanggan/login");
|
||||
Log.d(TAG, "Login request: email=" + (request.getEmail() != null ? request.getEmail() : "null")
|
||||
+ " no_telepon=" + (request.getNotelepon() != null ? "[" + request.getNotelepon().length() + " chars]" : "null")
|
||||
+ " passwordLength=" + (request.getPassword() != null ? request.getPassword().length() : 0)
|
||||
+ " hasFcmToken=" + (request.getRegId() != null && !request.getRegId().isEmpty()));
|
||||
String basicUser = !TextUtils.isEmpty(emailText) ? emailText : request.getNotelepon();
|
||||
Log.d(TAG, "Login request: Basic auth user (identifier)=" + basicUser);
|
||||
|
||||
UserService service = ServiceGenerator.createService(UserService.class, basicUser, request.getPassword());
|
||||
service.login(request).enqueue(new Callback<LoginResponseJson>() {
|
||||
@Override
|
||||
public void onResponse(@NonNull Call<LoginResponseJson> call, @NonNull Response<LoginResponseJson> response) {
|
||||
progresshide();
|
||||
if (response.isSuccessful()) {
|
||||
int code = response.code();
|
||||
boolean ok = response.isSuccessful();
|
||||
Log.d(TAG, "Login response: code=" + code + " isSuccessful=" + ok);
|
||||
|
||||
if (ok) {
|
||||
LoginResponseJson body = response.body();
|
||||
if (body != null && body.getMessage().equalsIgnoreCase("found")) {
|
||||
// On any successful login (email or phone), go straight to home.
|
||||
String msg = body != null ? body.getMessage() : "null";
|
||||
int dataSize = (body != null && body.getData() != null) ? body.getData().size() : -1;
|
||||
Log.d(TAG, "Login response body: message=" + msg + " dataSize=" + dataSize);
|
||||
|
||||
if (body != null && body.getMessage().equalsIgnoreCase("found") && body.getData() != null && !body.getData().isEmpty()) {
|
||||
User user = body.getData().get(0);
|
||||
saveUser(user);
|
||||
Log.d(TAG, "Login success: user id=" + (user.getId() != null ? user.getId() : "?"));
|
||||
loginPanic();
|
||||
Intent intent = new Intent(LoginActivity.this, MainActivity.class);
|
||||
intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TASK | Intent.FLAG_ACTIVITY_CLEAR_TOP | Intent.FLAG_ACTIVITY_NEW_TASK);
|
||||
startActivity(intent);
|
||||
finish();
|
||||
} else {
|
||||
notif(getString(R.string.phoneemailwrong));
|
||||
String showMsg = (body != null && body.getMessage() != null) ? body.getMessage() : getString(R.string.phoneemailwrong);
|
||||
Log.w(TAG, "Login rejected by server: message=" + showMsg);
|
||||
notif(showMsg);
|
||||
}
|
||||
} else {
|
||||
String errMsg = "Login failed";
|
||||
try {
|
||||
if (response.errorBody() != null) {
|
||||
String errBody = response.errorBody().string();
|
||||
Log.e(TAG, "Login error body: code=" + code + " body=" + (errBody != null ? errBody : "null"));
|
||||
if (errBody != null && !errBody.isEmpty()) errMsg = errBody;
|
||||
} else {
|
||||
Log.e(TAG, "Login error: code=" + code + " no error body");
|
||||
}
|
||||
} catch (Exception e) {
|
||||
Log.e(TAG, "Login error reading body", e);
|
||||
}
|
||||
if (code == 401) errMsg = getString(R.string.phoneemailwrong);
|
||||
notif(errMsg);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onFailure(@NonNull Call<LoginResponseJson> call, @NonNull Throwable t) {
|
||||
progresshide();
|
||||
Log.e(TAG, "Login onFailure: " + t.getMessage(), t);
|
||||
t.printStackTrace();
|
||||
notif("error");
|
||||
notif(t.getMessage() != null ? t.getMessage() : "error");
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
0
OnTime_User_live/app/src/main/java/id/ontime/customer/activity/LupapassActivity.java
Normal file → Executable file
0
OnTime_User_live/app/src/main/java/id/ontime/customer/activity/LupapassActivity.java
Normal file → Executable file
0
OnTime_User_live/app/src/main/java/id/ontime/customer/activity/MainActivity.java
Normal file → Executable file
0
OnTime_User_live/app/src/main/java/id/ontime/customer/activity/MainActivity.java
Normal file → Executable file
0
OnTime_User_live/app/src/main/java/id/ontime/customer/activity/MapsMerchantActivity.java
Normal file → Executable file
0
OnTime_User_live/app/src/main/java/id/ontime/customer/activity/MapsMerchantActivity.java
Normal file → Executable file
0
OnTime_User_live/app/src/main/java/id/ontime/customer/activity/OngkirActivity.java
Normal file → Executable file
0
OnTime_User_live/app/src/main/java/id/ontime/customer/activity/OngkirActivity.java
Normal file → Executable file
0
OnTime_User_live/app/src/main/java/id/ontime/customer/activity/OperatorProviderListActivity.java
Normal file → Executable file
0
OnTime_User_live/app/src/main/java/id/ontime/customer/activity/OperatorProviderListActivity.java
Normal file → Executable file
0
OnTime_User_live/app/src/main/java/id/ontime/customer/activity/PicklocationActivity.java
Normal file → Executable file
0
OnTime_User_live/app/src/main/java/id/ontime/customer/activity/PicklocationActivity.java
Normal file → Executable file
0
OnTime_User_live/app/src/main/java/id/ontime/customer/activity/PpobActivity.java
Normal file → Executable file
0
OnTime_User_live/app/src/main/java/id/ontime/customer/activity/PpobActivity.java
Normal file → Executable file
0
OnTime_User_live/app/src/main/java/id/ontime/customer/activity/PrivacyActivity.java
Normal file → Executable file
0
OnTime_User_live/app/src/main/java/id/ontime/customer/activity/PrivacyActivity.java
Normal file → Executable file
18
OnTime_User_live/app/src/main/java/id/ontime/customer/activity/ProgressActivity.java
Normal file → Executable file
18
OnTime_User_live/app/src/main/java/id/ontime/customer/activity/ProgressActivity.java
Normal file → Executable file
@@ -234,7 +234,15 @@ public class ProgressActivity extends AppCompatActivity
|
||||
@Override
|
||||
public void onReceive(Context context, Intent intent) {
|
||||
orderBundle = intent.getExtras();
|
||||
orderHandler(Objects.requireNonNull(orderBundle).getInt("code"));
|
||||
if (orderBundle == null || idtrans == null) return;
|
||||
// Only update if this broadcast is for the current order
|
||||
String broadcastIdTrans = orderBundle.getString("id_transaksi");
|
||||
if (broadcastIdTrans != null && !broadcastIdTrans.equals(idtrans)) return;
|
||||
int code = orderBundle.getInt("code", -1);
|
||||
if (code >= 0) {
|
||||
response = String.valueOf(code);
|
||||
orderHandler(code);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
@@ -729,6 +737,9 @@ public class ProgressActivity extends AppCompatActivity
|
||||
}
|
||||
|
||||
private void fcmcancel() {
|
||||
if (regdriver == null || regdriver.trim().isEmpty()) {
|
||||
return;
|
||||
}
|
||||
DriverResponse response = new DriverResponse();
|
||||
response.type = ORDER;
|
||||
response.setIdTransaksi(idtrans);
|
||||
@@ -738,7 +749,6 @@ public class ProgressActivity extends AppCompatActivity
|
||||
message.setTo(regdriver);
|
||||
message.setData(response);
|
||||
|
||||
|
||||
FCMHelper.sendMessage(message).enqueue(new okhttp3.Callback() {
|
||||
@Override
|
||||
public void onResponse(@NonNull okhttp3.Call call, @NonNull okhttp3.Response response) {
|
||||
@@ -752,6 +762,9 @@ public class ProgressActivity extends AppCompatActivity
|
||||
}
|
||||
|
||||
private void fcmcancelmerchant() {
|
||||
if (tokenmerchant == null || tokenmerchant.trim().isEmpty()) {
|
||||
return;
|
||||
}
|
||||
DriverResponse response = new DriverResponse();
|
||||
response.type = ORDER;
|
||||
response.setIdTransaksi(idtrans);
|
||||
@@ -761,7 +774,6 @@ public class ProgressActivity extends AppCompatActivity
|
||||
message.setTo(tokenmerchant);
|
||||
message.setData(response);
|
||||
|
||||
|
||||
FCMHelper.sendMessage(message).enqueue(new okhttp3.Callback() {
|
||||
@Override
|
||||
public void onResponse(@NonNull okhttp3.Call call, @NonNull okhttp3.Response response) {
|
||||
|
||||
0
OnTime_User_live/app/src/main/java/id/ontime/customer/activity/PromoActivity.java
Normal file → Executable file
0
OnTime_User_live/app/src/main/java/id/ontime/customer/activity/PromoActivity.java
Normal file → Executable file
0
OnTime_User_live/app/src/main/java/id/ontime/customer/activity/RateActivity.java
Normal file → Executable file
0
OnTime_User_live/app/src/main/java/id/ontime/customer/activity/RateActivity.java
Normal file → Executable file
100
OnTime_User_live/app/src/main/java/id/ontime/customer/activity/RegisterActivity.java
Normal file → Executable file
100
OnTime_User_live/app/src/main/java/id/ontime/customer/activity/RegisterActivity.java
Normal file → Executable file
@@ -67,7 +67,7 @@ import com.google.firebase.auth.FirebaseAuthInvalidCredentialsException;
|
||||
import com.google.firebase.auth.FirebaseUser;
|
||||
import com.google.firebase.auth.PhoneAuthCredential;
|
||||
import com.google.firebase.auth.PhoneAuthProvider;
|
||||
import com.google.firebase.iid.FirebaseInstanceId;
|
||||
import com.google.firebase.messaging.FirebaseMessaging;
|
||||
import com.wdullaer.materialdatetimepicker.date.DatePickerDialog;
|
||||
import com.ybs.countrypicker.CountryPicker;
|
||||
import com.ybs.countrypicker.CountryPickerListener;
|
||||
@@ -161,10 +161,17 @@ public class RegisterActivity extends AppCompatActivity {
|
||||
rlnotif2 = findViewById(R.id.rlnotif2);
|
||||
textnotif2 = findViewById(R.id.textnotif2);
|
||||
confirmButton = findViewById(R.id.buttonconfirm);
|
||||
// FCM v1: async token via FirebaseMessaging.getToken()
|
||||
try {
|
||||
token = FirebaseInstanceId.getInstance().getToken();
|
||||
} catch (Exception e) {
|
||||
Log.e("RegisterActivity", "Failed to get FirebaseInstanceId token; continuing without token", e);
|
||||
FirebaseMessaging.getInstance().getToken().addOnCompleteListener(task -> {
|
||||
if (task.isSuccessful() && task.getResult() != null && !task.getResult().isEmpty()) {
|
||||
token = task.getResult();
|
||||
} else {
|
||||
token = null;
|
||||
}
|
||||
});
|
||||
} catch (IllegalStateException e) {
|
||||
Log.e("RegisterActivity", "FirebaseMessaging not available; token will be requested again on submit", e);
|
||||
token = null;
|
||||
}
|
||||
numOne = findViewById(R.id.numone);
|
||||
@@ -830,48 +837,57 @@ public class RegisterActivity extends AppCompatActivity {
|
||||
request.setCountrycode(countryCode.getText().toString());
|
||||
request.setChecked(check);
|
||||
|
||||
// FCM v1: get token async then register (token is mandatory)
|
||||
try {
|
||||
FirebaseInstanceId token = FirebaseInstanceId.getInstance();
|
||||
request.setToken(token.getToken());
|
||||
} catch (Exception e) {
|
||||
Log.e("RegisterActivity", "Failed to get FirebaseInstanceId token; continuing without token", e);
|
||||
request.setToken(null);
|
||||
}
|
||||
|
||||
UserService service = ServiceGenerator.createService(UserService.class, request.getEmail(), request.getPassword());
|
||||
service.register(request).enqueue(new Callback<RegisterResponseJson>() {
|
||||
@Override
|
||||
public void onResponse(@NonNull Call<RegisterResponseJson> call, @NonNull Response<RegisterResponseJson> response) {
|
||||
progresshide();
|
||||
if (response.isSuccessful()) {
|
||||
if (Objects.requireNonNull(response.body()).getMessage().equalsIgnoreCase("next")) {
|
||||
Nextbtn(viewFlipper);
|
||||
|
||||
} else if (response.body().getMessage().equalsIgnoreCase("success")) {
|
||||
|
||||
User user = response.body().getData().get(0);
|
||||
saveUser(user);
|
||||
registerPanic();
|
||||
Intent intent = new Intent(RegisterActivity.this, MainActivity.class);
|
||||
intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TASK | Intent.FLAG_ACTIVITY_CLEAR_TOP | Intent.FLAG_ACTIVITY_NEW_TASK);
|
||||
startActivity(intent);
|
||||
finish();
|
||||
|
||||
} else {
|
||||
notif(response.body().getMessage());
|
||||
}
|
||||
FirebaseMessaging.getInstance().getToken().addOnCompleteListener(task -> {
|
||||
if (task.isSuccessful() && task.getResult() != null && !task.getResult().isEmpty()) {
|
||||
request.setToken(task.getResult());
|
||||
} else {
|
||||
notif("error");
|
||||
progresshide();
|
||||
Log.e("RegisterActivity", "FCM getToken failed for register: " + (task.getException() != null ? task.getException().getMessage() : "empty token"));
|
||||
notif(getString(R.string.fcm_token_required));
|
||||
return;
|
||||
}
|
||||
}
|
||||
UserService service = ServiceGenerator.createService(UserService.class, request.getEmail(), request.getPassword());
|
||||
service.register(request).enqueue(new Callback<RegisterResponseJson>() {
|
||||
@Override
|
||||
public void onResponse(@NonNull Call<RegisterResponseJson> call, @NonNull Response<RegisterResponseJson> response) {
|
||||
progresshide();
|
||||
if (response.isSuccessful()) {
|
||||
if (Objects.requireNonNull(response.body()).getMessage().equalsIgnoreCase("next")) {
|
||||
Nextbtn(viewFlipper);
|
||||
|
||||
@Override
|
||||
public void onFailure(@NonNull Call<RegisterResponseJson> call, @NonNull Throwable t) {
|
||||
progresshide();
|
||||
t.printStackTrace();
|
||||
notif("error!");
|
||||
}
|
||||
});
|
||||
} else if (response.body().getMessage().equalsIgnoreCase("success")) {
|
||||
|
||||
User user = response.body().getData().get(0);
|
||||
saveUser(user);
|
||||
registerPanic();
|
||||
Intent intent = new Intent(RegisterActivity.this, MainActivity.class);
|
||||
intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TASK | Intent.FLAG_ACTIVITY_CLEAR_TOP | Intent.FLAG_ACTIVITY_NEW_TASK);
|
||||
startActivity(intent);
|
||||
finish();
|
||||
|
||||
} else {
|
||||
notif(response.body().getMessage());
|
||||
}
|
||||
} else {
|
||||
notif("error");
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onFailure(@NonNull Call<RegisterResponseJson> call, @NonNull Throwable t) {
|
||||
progresshide();
|
||||
t.printStackTrace();
|
||||
notif("error!");
|
||||
}
|
||||
});
|
||||
});
|
||||
} catch (IllegalStateException e) {
|
||||
progresshide();
|
||||
Log.e("RegisterActivity", "FirebaseMessaging not available; FCM token is required for register", e);
|
||||
notif(getString(R.string.fcm_token_required));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
2
OnTime_User_live/app/src/main/java/id/ontime/customer/activity/RentCarActivity.java
Normal file → Executable file
2
OnTime_User_live/app/src/main/java/id/ontime/customer/activity/RentCarActivity.java
Normal file → Executable file
@@ -844,6 +844,8 @@ public class RentCarActivity extends AppCompatActivity
|
||||
param.setLatitude(latitude);
|
||||
param.setLongitude(longitude);
|
||||
param.setFitur(fitur);
|
||||
int radiusKm = new id.ontime.customer.utils.SettingPreference(this).getDriverSearchRadiusKm();
|
||||
if (radiusKm > 0) param.setRadiusKm((double) radiusKm);
|
||||
|
||||
service.getNearRide(param).enqueue(new Callback<GetNearRideCarResponseJson>() {
|
||||
@Override
|
||||
|
||||
126
OnTime_User_live/app/src/main/java/id/ontime/customer/activity/RideCarActivity.java
Normal file → Executable file
126
OnTime_User_live/app/src/main/java/id/ontime/customer/activity/RideCarActivity.java
Normal file → Executable file
@@ -937,6 +937,8 @@ public class RideCarActivity extends AppCompatActivity
|
||||
param.setLatitude(latitude);
|
||||
param.setLongitude(longitude);
|
||||
param.setFitur(fitur);
|
||||
int radiusKm = new id.ontime.customer.utils.SettingPreference(this).getDriverSearchRadiusKm();
|
||||
if (radiusKm > 0) param.setRadiusKm((double) radiusKm);
|
||||
|
||||
service.getNearRide(param).enqueue(new Callback<GetNearRideCarResponseJson>() {
|
||||
@Override
|
||||
@@ -990,49 +992,103 @@ public class RideCarActivity extends AppCompatActivity
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* When driver list is empty, refetch nearby drivers once then proceed with order or show error.
|
||||
* Uses pickup or last known location so drivers are found even if first fetch was slow or skipped.
|
||||
*/
|
||||
private void refetchDriversThenOrder(final boolean useWallet) {
|
||||
double lat = pickUpLatLang != null ? pickUpLatLang.latitude : (lastKnownLocation != null ? lastKnownLocation.getLatitude() : 0);
|
||||
double lng = pickUpLatLang != null ? pickUpLatLang.longitude : (lastKnownLocation != null ? lastKnownLocation.getLongitude() : 0);
|
||||
if (lat == 0 && lng == 0) {
|
||||
notif("Aktifkan lokasi dan coba lagi.");
|
||||
return;
|
||||
}
|
||||
rlprogress.setVisibility(View.VISIBLE);
|
||||
textprogress.setText(getString(R.string.waiting_desc));
|
||||
User loginUser = BaseApp.getInstance(this).getLoginUser();
|
||||
final BookService service = ServiceGenerator.createService(BookService.class, loginUser.getEmail(), loginUser.getPassword());
|
||||
GetNearRideCarRequestJson param = new GetNearRideCarRequestJson();
|
||||
param.setLatitude(lat);
|
||||
param.setLongitude(lng);
|
||||
param.setFitur(fitur);
|
||||
int radiusKm = new id.ontime.customer.utils.SettingPreference(this).getDriverSearchRadiusKm();
|
||||
if (radiusKm > 0) param.setRadiusKm((double) radiusKm);
|
||||
service.getNearRide(param).enqueue(new Callback<GetNearRideCarResponseJson>() {
|
||||
@Override
|
||||
public void onResponse(@NonNull Call<GetNearRideCarResponseJson> call, @NonNull Response<GetNearRideCarResponseJson> response) {
|
||||
runOnUiThread(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
rlprogress.setVisibility(View.GONE);
|
||||
if (response.isSuccessful() && response.body() != null) {
|
||||
List<DriverModel> list = response.body().getData();
|
||||
if (list != null && !list.isEmpty()) {
|
||||
driverAvailable = list;
|
||||
createMarker();
|
||||
RideCarRequestJson req = buildOrderParam(useWallet);
|
||||
if (req != null) sendRequestTransaksi(req, driverAvailable);
|
||||
} else {
|
||||
notif("Maaf, tidak ada pengemudi di sekitar Anda.");
|
||||
}
|
||||
} else {
|
||||
notif("Maaf, tidak ada pengemudi di sekitar Anda.");
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onFailure(@NonNull Call<GetNearRideCarResponseJson> call, @NonNull Throwable t) {
|
||||
runOnUiThread(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
rlprogress.setVisibility(View.GONE);
|
||||
notif("Gagal mencari pengemudi. Periksa koneksi dan coba lagi.");
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private RideCarRequestJson buildOrderParam(boolean useWallet) {
|
||||
if (pickUpLatLang == null || destinationLatLang == null) return null;
|
||||
User userLogin = BaseApp.getInstance(this).getLoginUser();
|
||||
RideCarRequestJson param = new RideCarRequestJson();
|
||||
param.setIdPelanggan(userLogin.getId());
|
||||
param.setOrderFitur(fitur);
|
||||
param.setStartLatitude(pickUpLatLang.latitude);
|
||||
param.setStartLongitude(pickUpLatLang.longitude);
|
||||
param.setEndLatitude(destinationLatLang.latitude);
|
||||
param.setEndLongitude(destinationLatLang.longitude);
|
||||
param.setJarak(this.jarak);
|
||||
param.setHarga(this.harga);
|
||||
param.setEstimasi(fiturtext.getText().toString());
|
||||
param.setAlamatAsal(pickUpText.getText().toString());
|
||||
param.setAlamatTujuan(destinationText.getText().toString());
|
||||
if (useWallet) {
|
||||
param.setKreditpromo(String.valueOf((Double.parseDouble(biayaakhir) * this.harga) + promocode));
|
||||
param.setPakaiWallet(1);
|
||||
} else {
|
||||
param.setKreditpromo(String.valueOf(promocode));
|
||||
param.setPakaiWallet(0);
|
||||
}
|
||||
return param;
|
||||
}
|
||||
|
||||
private void onOrderButton() {
|
||||
if (checkedpaywallet.equals("1")) {
|
||||
if (driverAvailable.isEmpty()) {
|
||||
notif("Maaf, tidak ada pengemudi di sekitar Anda.");
|
||||
refetchDriversThenOrder(true);
|
||||
} else {
|
||||
RideCarRequestJson param = new RideCarRequestJson();
|
||||
User userLogin = BaseApp.getInstance(this).getLoginUser();
|
||||
param.setIdPelanggan(userLogin.getId());
|
||||
param.setOrderFitur(fitur);
|
||||
param.setStartLatitude(pickUpLatLang.latitude);
|
||||
param.setStartLongitude(pickUpLatLang.longitude);
|
||||
param.setEndLatitude(destinationLatLang.latitude);
|
||||
param.setEndLongitude(destinationLatLang.longitude);
|
||||
param.setJarak(this.jarak);
|
||||
param.setHarga(this.harga);
|
||||
param.setEstimasi(fiturtext.getText().toString());
|
||||
param.setKreditpromo(String.valueOf((Double.parseDouble(biayaakhir) * this.harga) + promocode));
|
||||
param.setAlamatAsal(pickUpText.getText().toString());
|
||||
param.setAlamatTujuan(destinationText.getText().toString());
|
||||
param.setPakaiWallet(1);
|
||||
sendRequestTransaksi(param, driverAvailable);
|
||||
RideCarRequestJson param = buildOrderParam(true);
|
||||
if (param != null) sendRequestTransaksi(param, driverAvailable);
|
||||
}
|
||||
} else {
|
||||
if (driverAvailable.isEmpty()) {
|
||||
notif("Maaf, tidak ada pengemudi di sekitar Anda");
|
||||
refetchDriversThenOrder(false);
|
||||
} else {
|
||||
RideCarRequestJson param = new RideCarRequestJson();
|
||||
User userLogin = BaseApp.getInstance(this).getLoginUser();
|
||||
param.setIdPelanggan(userLogin.getId());
|
||||
param.setOrderFitur(fitur);
|
||||
param.setStartLatitude(pickUpLatLang.latitude);
|
||||
param.setStartLongitude(pickUpLatLang.longitude);
|
||||
param.setEndLatitude(destinationLatLang.latitude);
|
||||
param.setEndLongitude(destinationLatLang.longitude);
|
||||
param.setJarak(this.jarak);
|
||||
param.setHarga(this.harga);
|
||||
param.setEstimasi(fiturtext.getText().toString());
|
||||
param.setKreditpromo(String.valueOf(promocode));
|
||||
param.setAlamatAsal(pickUpText.getText().toString());
|
||||
param.setAlamatTujuan(destinationText.getText().toString());
|
||||
param.setPakaiWallet(0);
|
||||
|
||||
sendRequestTransaksi(param, driverAvailable);
|
||||
RideCarRequestJson param = buildOrderParam(false);
|
||||
if (param != null) sendRequestTransaksi(param, driverAvailable);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
2
OnTime_User_live/app/src/main/java/id/ontime/customer/activity/SendActivity.java
Normal file → Executable file
2
OnTime_User_live/app/src/main/java/id/ontime/customer/activity/SendActivity.java
Normal file → Executable file
@@ -701,6 +701,8 @@ public class SendActivity extends AppCompatActivity
|
||||
param.setLatitude(latitude);
|
||||
param.setLongitude(longitude);
|
||||
param.setFitur(fitur);
|
||||
int radiusKm = new id.ontime.customer.utils.SettingPreference(this).getDriverSearchRadiusKm();
|
||||
if (radiusKm > 0) param.setRadiusKm((double) radiusKm);
|
||||
|
||||
service.getNearRide(param).enqueue(new Callback<GetNearRideCarResponseJson>() {
|
||||
@Override
|
||||
|
||||
0
OnTime_User_live/app/src/main/java/id/ontime/customer/activity/SendDetailActivity.java
Normal file → Executable file
0
OnTime_User_live/app/src/main/java/id/ontime/customer/activity/SendDetailActivity.java
Normal file → Executable file
0
OnTime_User_live/app/src/main/java/id/ontime/customer/activity/SplashActivity.java
Normal file → Executable file
0
OnTime_User_live/app/src/main/java/id/ontime/customer/activity/SplashActivity.java
Normal file → Executable file
0
OnTime_User_live/app/src/main/java/id/ontime/customer/activity/TopUpBpjsActivity.java
Normal file → Executable file
0
OnTime_User_live/app/src/main/java/id/ontime/customer/activity/TopUpBpjsActivity.java
Normal file → Executable file
0
OnTime_User_live/app/src/main/java/id/ontime/customer/activity/TopUpPlnActivity.java
Normal file → Executable file
0
OnTime_User_live/app/src/main/java/id/ontime/customer/activity/TopUpPlnActivity.java
Normal file → Executable file
0
OnTime_User_live/app/src/main/java/id/ontime/customer/activity/TopUpPulsaActivity.java
Normal file → Executable file
0
OnTime_User_live/app/src/main/java/id/ontime/customer/activity/TopUpPulsaActivity.java
Normal file → Executable file
0
OnTime_User_live/app/src/main/java/id/ontime/customer/activity/TopupSaldoActivity.java
Normal file → Executable file
0
OnTime_User_live/app/src/main/java/id/ontime/customer/activity/TopupSaldoActivity.java
Normal file → Executable file
0
OnTime_User_live/app/src/main/java/id/ontime/customer/activity/TopupviewActivity.java
Normal file → Executable file
0
OnTime_User_live/app/src/main/java/id/ontime/customer/activity/TopupviewActivity.java
Normal file → Executable file
0
OnTime_User_live/app/src/main/java/id/ontime/customer/activity/WalletActivity.java
Normal file → Executable file
0
OnTime_User_live/app/src/main/java/id/ontime/customer/activity/WalletActivity.java
Normal file → Executable file
0
OnTime_User_live/app/src/main/java/id/ontime/customer/activity/WithdrawActivity.java
Normal file → Executable file
0
OnTime_User_live/app/src/main/java/id/ontime/customer/activity/WithdrawActivity.java
Normal file → Executable file
0
OnTime_User_live/app/src/main/java/id/ontime/customer/adapter/CityAdapter.java
Normal file → Executable file
0
OnTime_User_live/app/src/main/java/id/ontime/customer/adapter/CityAdapter.java
Normal file → Executable file
0
OnTime_User_live/app/src/main/java/id/ontime/customer/adapter/ExpedisiAdapter.java
Normal file → Executable file
0
OnTime_User_live/app/src/main/java/id/ontime/customer/adapter/ExpedisiAdapter.java
Normal file → Executable file
0
OnTime_User_live/app/src/main/java/id/ontime/customer/adapter/ProvinceAdapter.java
Normal file → Executable file
0
OnTime_User_live/app/src/main/java/id/ontime/customer/adapter/ProvinceAdapter.java
Normal file → Executable file
0
OnTime_User_live/app/src/main/java/id/ontime/customer/api/ApiService.java
Normal file → Executable file
0
OnTime_User_live/app/src/main/java/id/ontime/customer/api/ApiService.java
Normal file → Executable file
0
OnTime_User_live/app/src/main/java/id/ontime/customer/api/ApiUrl.java
Normal file → Executable file
0
OnTime_User_live/app/src/main/java/id/ontime/customer/api/ApiUrl.java
Normal file → Executable file
32
OnTime_User_live/app/src/main/java/id/ontime/customer/constants/BaseApp.java
Normal file → Executable file
32
OnTime_User_live/app/src/main/java/id/ontime/customer/constants/BaseApp.java
Normal file → Executable file
@@ -8,7 +8,6 @@ import androidx.multidex.MultiDex;
|
||||
import id.ontime.customer.models.FirebaseToken;
|
||||
import id.ontime.customer.models.User;
|
||||
import com.google.firebase.FirebaseApp;
|
||||
import com.google.firebase.iid.FirebaseInstanceId;
|
||||
import com.google.firebase.messaging.FirebaseMessaging;
|
||||
|
||||
import io.realm.Realm;
|
||||
@@ -42,24 +41,29 @@ public class BaseApp extends Application {
|
||||
// realmInstance = Realm.getInstance(config);
|
||||
realmInstance = Realm.getDefaultInstance();
|
||||
|
||||
// Best-effort Firebase initialization and token registration.
|
||||
// If Firebase is not configured for this build, ignore failures so the app can still run.
|
||||
// FCM v1: async token fetch and topic subscribe (reference: test app LoginActivity).
|
||||
try {
|
||||
FirebaseApp app = FirebaseApp.initializeApp(this);
|
||||
if (app != null) {
|
||||
String fcmToken = FirebaseInstanceId.getInstance().getToken();
|
||||
if (fcmToken != null) {
|
||||
FirebaseToken token = new FirebaseToken(fcmToken);
|
||||
FirebaseMessaging.getInstance().subscribeToTopic("pelanggan");
|
||||
|
||||
realmInstance.beginTransaction();
|
||||
realmInstance.delete(FirebaseToken.class);
|
||||
realmInstance.copyToRealm(token);
|
||||
realmInstance.commitTransaction();
|
||||
}
|
||||
FirebaseMessaging.getInstance().getToken()
|
||||
.addOnCompleteListener(task -> {
|
||||
if (task.isSuccessful() && task.getResult() != null && !task.getResult().isEmpty()) {
|
||||
String fcmToken = task.getResult();
|
||||
FirebaseToken token = new FirebaseToken(fcmToken);
|
||||
FirebaseMessaging.getInstance().subscribeToTopic("pelanggan");
|
||||
try {
|
||||
realmInstance.beginTransaction();
|
||||
realmInstance.delete(FirebaseToken.class);
|
||||
realmInstance.copyToRealm(token);
|
||||
realmInstance.commitTransaction();
|
||||
} catch (Exception e) {
|
||||
if (realmInstance.isInTransaction()) realmInstance.cancelTransaction();
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
} catch (IllegalStateException e) {
|
||||
// Firebase not initialized / misconfigured for this build; skip FCM registration in debug.
|
||||
e.printStackTrace();
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
|
||||
1
OnTime_User_live/app/src/main/java/id/ontime/customer/constants/Constants.java
Normal file → Executable file
1
OnTime_User_live/app/src/main/java/id/ontime/customer/constants/Constants.java
Normal file → Executable file
@@ -7,6 +7,7 @@ import java.util.Locale;
|
||||
|
||||
public class Constants {
|
||||
|
||||
/** Test backend API base URL (api/, notification/send_generic, etc.). */
|
||||
private static final String BASE_URL = "https://apitest.semestaterpadu.my.id/";
|
||||
public static final String URL = "https://panic.on-time.id/"; //panicButton
|
||||
public static final String CONNECTION = BASE_URL + "api/";
|
||||
|
||||
0
OnTime_User_live/app/src/main/java/id/ontime/customer/constants/Functions.java
Normal file → Executable file
0
OnTime_User_live/app/src/main/java/id/ontime/customer/constants/Functions.java
Normal file → Executable file
0
OnTime_User_live/app/src/main/java/id/ontime/customer/constants/TopUpType.java
Normal file → Executable file
0
OnTime_User_live/app/src/main/java/id/ontime/customer/constants/TopUpType.java
Normal file → Executable file
0
OnTime_User_live/app/src/main/java/id/ontime/customer/constants/VersionChecker.java
Normal file → Executable file
0
OnTime_User_live/app/src/main/java/id/ontime/customer/constants/VersionChecker.java
Normal file → Executable file
0
OnTime_User_live/app/src/main/java/id/ontime/customer/fragment/EnableLlocationFragment.java
Normal file → Executable file
0
OnTime_User_live/app/src/main/java/id/ontime/customer/fragment/EnableLlocationFragment.java
Normal file → Executable file
0
OnTime_User_live/app/src/main/java/id/ontime/customer/fragment/FavouriteFragment.java
Normal file → Executable file
0
OnTime_User_live/app/src/main/java/id/ontime/customer/fragment/FavouriteFragment.java
Normal file → Executable file
0
OnTime_User_live/app/src/main/java/id/ontime/customer/fragment/FullImageFragment.java
Normal file → Executable file
0
OnTime_User_live/app/src/main/java/id/ontime/customer/fragment/FullImageFragment.java
Normal file → Executable file
0
OnTime_User_live/app/src/main/java/id/ontime/customer/fragment/HistoryFragment.java
Normal file → Executable file
0
OnTime_User_live/app/src/main/java/id/ontime/customer/fragment/HistoryFragment.java
Normal file → Executable file
0
OnTime_User_live/app/src/main/java/id/ontime/customer/fragment/HomeFragment.java
Normal file → Executable file
0
OnTime_User_live/app/src/main/java/id/ontime/customer/fragment/HomeFragment.java
Normal file → Executable file
0
OnTime_User_live/app/src/main/java/id/ontime/customer/fragment/MessageFragment.java
Normal file → Executable file
0
OnTime_User_live/app/src/main/java/id/ontime/customer/fragment/MessageFragment.java
Normal file → Executable file
0
OnTime_User_live/app/src/main/java/id/ontime/customer/fragment/PlayAudioFragment.java
Normal file → Executable file
0
OnTime_User_live/app/src/main/java/id/ontime/customer/fragment/PlayAudioFragment.java
Normal file → Executable file
44
OnTime_User_live/app/src/main/java/id/ontime/customer/fragment/ProfileFragment.java
Normal file → Executable file
44
OnTime_User_live/app/src/main/java/id/ontime/customer/fragment/ProfileFragment.java
Normal file → Executable file
@@ -61,7 +61,7 @@ import static android.content.Context.NOTIFICATION_SERVICE;
|
||||
public class ProfileFragment extends Fragment {
|
||||
private Context context;
|
||||
private ImageView foto;
|
||||
private TextView nama, email,countryCode, phone, saldo;
|
||||
private TextView nama, email, countryCode, phone, saldo, driverRadiusSummary;
|
||||
private SettingPreference sp;
|
||||
private String saldoWallet;
|
||||
// public static final String URL = "http://peci.semestaterpadu.my.id/";
|
||||
@@ -84,8 +84,13 @@ public class ProfileFragment extends Fragment {
|
||||
LinearLayout logout = getView.findViewById(R.id.lllogout);
|
||||
LinearLayout llpassword = getView.findViewById(R.id.llpassword);
|
||||
LinearLayout topUp = getView.findViewById(R.id.topUp);
|
||||
LinearLayout llDriverRadius = getView.findViewById(R.id.lldriverradius);
|
||||
driverRadiusSummary = getView.findViewById(R.id.driver_radius_summary);
|
||||
sp = new SettingPreference(context);
|
||||
|
||||
updateDriverRadiusSummary();
|
||||
llDriverRadius.setOnClickListener(v -> showDriverRadiusDialog());
|
||||
|
||||
|
||||
privacy.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
@@ -171,10 +176,45 @@ public class ProfileFragment extends Fragment {
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
return getView;
|
||||
}
|
||||
|
||||
private void updateDriverRadiusSummary() {
|
||||
int km = sp.getDriverSearchRadiusKm();
|
||||
driverRadiusSummary.setText(km <= 0 ? getString(R.string.default_label) : km + " km");
|
||||
}
|
||||
|
||||
private void showDriverRadiusDialog() {
|
||||
final String[] options = new String[]{
|
||||
getString(R.string.default_label),
|
||||
"5 km",
|
||||
"10 km",
|
||||
"15 km",
|
||||
"20 km",
|
||||
"30 km",
|
||||
"50 km"
|
||||
};
|
||||
final int[] values = new int[]{0, 5, 10, 15, 20, 30, 50};
|
||||
int current = sp.getDriverSearchRadiusKm();
|
||||
int selected = 0;
|
||||
for (int i = 0; i < values.length; i++) {
|
||||
if (values[i] == current) {
|
||||
selected = i;
|
||||
break;
|
||||
}
|
||||
}
|
||||
new AlertDialog.Builder(context)
|
||||
.setTitle(R.string.driver_radius_title)
|
||||
.setSingleChoiceItems(options, selected, (dialog, which) -> {
|
||||
sp.setDriverSearchRadiusKm(values[which]);
|
||||
updateDriverRadiusSummary();
|
||||
Toast.makeText(context, getString(R.string.driver_radius_saved), Toast.LENGTH_SHORT).show();
|
||||
dialog.dismiss();
|
||||
})
|
||||
.setNegativeButton(android.R.string.cancel, null)
|
||||
.show();
|
||||
}
|
||||
|
||||
private void clickDone() {
|
||||
new AlertDialog.Builder(context)
|
||||
.setIcon(R.mipmap.ic_launcher)
|
||||
|
||||
0
OnTime_User_live/app/src/main/java/id/ontime/customer/gmap/Direction.java
Normal file → Executable file
0
OnTime_User_live/app/src/main/java/id/ontime/customer/gmap/Direction.java
Normal file → Executable file
0
OnTime_User_live/app/src/main/java/id/ontime/customer/gmap/GMapDirection.java
Normal file → Executable file
0
OnTime_User_live/app/src/main/java/id/ontime/customer/gmap/GMapDirection.java
Normal file → Executable file
0
OnTime_User_live/app/src/main/java/id/ontime/customer/gmap/directions/Bound.java
Normal file → Executable file
0
OnTime_User_live/app/src/main/java/id/ontime/customer/gmap/directions/Bound.java
Normal file → Executable file
0
OnTime_User_live/app/src/main/java/id/ontime/customer/gmap/directions/Directions.java
Normal file → Executable file
0
OnTime_User_live/app/src/main/java/id/ontime/customer/gmap/directions/Directions.java
Normal file → Executable file
0
OnTime_User_live/app/src/main/java/id/ontime/customer/gmap/directions/Distance.java
Normal file → Executable file
0
OnTime_User_live/app/src/main/java/id/ontime/customer/gmap/directions/Distance.java
Normal file → Executable file
0
OnTime_User_live/app/src/main/java/id/ontime/customer/gmap/directions/Duration.java
Normal file → Executable file
0
OnTime_User_live/app/src/main/java/id/ontime/customer/gmap/directions/Duration.java
Normal file → Executable file
0
OnTime_User_live/app/src/main/java/id/ontime/customer/gmap/directions/Leg.java
Normal file → Executable file
0
OnTime_User_live/app/src/main/java/id/ontime/customer/gmap/directions/Leg.java
Normal file → Executable file
0
OnTime_User_live/app/src/main/java/id/ontime/customer/gmap/directions/Route.java
Normal file → Executable file
0
OnTime_User_live/app/src/main/java/id/ontime/customer/gmap/directions/Route.java
Normal file → Executable file
0
OnTime_User_live/app/src/main/java/id/ontime/customer/gmap/directions/Step.java
Normal file → Executable file
0
OnTime_User_live/app/src/main/java/id/ontime/customer/gmap/directions/Step.java
Normal file → Executable file
0
OnTime_User_live/app/src/main/java/id/ontime/customer/item/AllFiturItem.java
Normal file → Executable file
0
OnTime_User_live/app/src/main/java/id/ontime/customer/item/AllFiturItem.java
Normal file → Executable file
0
OnTime_User_live/app/src/main/java/id/ontime/customer/item/AllMerchantNearItem.java
Normal file → Executable file
0
OnTime_User_live/app/src/main/java/id/ontime/customer/item/AllMerchantNearItem.java
Normal file → Executable file
0
OnTime_User_live/app/src/main/java/id/ontime/customer/item/BankItem.java
Normal file → Executable file
0
OnTime_User_live/app/src/main/java/id/ontime/customer/item/BankItem.java
Normal file → Executable file
0
OnTime_User_live/app/src/main/java/id/ontime/customer/item/BeritaItem.java
Normal file → Executable file
0
OnTime_User_live/app/src/main/java/id/ontime/customer/item/BeritaItem.java
Normal file → Executable file
0
OnTime_User_live/app/src/main/java/id/ontime/customer/item/CatItemItem.java
Normal file → Executable file
0
OnTime_User_live/app/src/main/java/id/ontime/customer/item/CatItemItem.java
Normal file → Executable file
0
OnTime_User_live/app/src/main/java/id/ontime/customer/item/CatMerchantItem.java
Normal file → Executable file
0
OnTime_User_live/app/src/main/java/id/ontime/customer/item/CatMerchantItem.java
Normal file → Executable file
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user