Skip to content

Commit

Permalink
remove huawei code
Browse files Browse the repository at this point in the history
  • Loading branch information
FatihUtkuKara committed Jul 23, 2024
1 parent 275e7a3 commit 7ebfc24
Show file tree
Hide file tree
Showing 7 changed files with 5 additions and 357 deletions.
1 change: 0 additions & 1 deletion app/build.gradle
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
apply plugin: 'com.android.application'
apply plugin: 'com.google.gms.google-services'
apply plugin: 'com.huawei.agconnect'

android {
compileSdkVersion 33
Expand Down
7 changes: 0 additions & 7 deletions app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -41,13 +41,6 @@
</intent-filter>
</service>

<service
android:name="euromsg.com.euromobileandroid.service.EuroHuaweiMessagingService"
android:exported="false">
<intent-filter>
<action android:name="com.huawei.push.action.MESSAGING_EVENT" />
</intent-filter>
</service>


</application>
Expand Down
37 changes: 2 additions & 35 deletions app/src/main/java/com/relateddigital/euromessage/MainActivity.java
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,6 @@
import com.google.gson.reflect.TypeToken;
import com.relateddigital.euromessage.databinding.ActivityMainBinding;
import com.visilabs.Visilabs;
import com.huawei.agconnect.config.AGConnectServicesConfig;
import com.huawei.hms.aaid.HmsInstanceId;
import com.huawei.hms.common.ApiException;
import java.lang.reflect.Type;
import java.text.DateFormat;
import java.text.SimpleDateFormat;
Expand Down Expand Up @@ -219,16 +216,8 @@ private void setUI() {
String firabaseToken = SP.getString(getApplicationContext(), "FirebaseToken");


if (EuroMobileManager.checkPlayService(getApplicationContext())) {
if (firabaseToken.equals("")) {
getFirabaseToken();
} else {
if (huaweiToken.equals("")) {
getHuaweiToken();
} else {
binding.etHuaweiToken.setText(huaweiToken);
}
}
if (firabaseToken.equals("")) {
getFirabaseToken();
} else {
binding.etToken.setText(firabaseToken);
}
Expand Down Expand Up @@ -462,28 +451,6 @@ public void setupDeletePushWithIdButton() {

}

private void getHuaweiToken() {
new Thread() {
@Override
public void run() {
try {
String appId = AGConnectServicesConfig.fromContext(getApplicationContext()).getString("client/app_id");
final String token = HmsInstanceId.getInstance(getApplicationContext()).getToken(appId, "HCM");

runOnUiThread(new Runnable() {
@Override
public void run() {
binding.etHuaweiToken.setText(token);
}
});

} catch (ApiException e) {
Log.e("Huawei Token", "get token failed, " + e);
}
}
}.start();
}




Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,6 @@
import android.app.Application;
import android.text.TextUtils;
import android.util.Log;
import com.huawei.agconnect.AGConnectOptionsBuilder;
import com.huawei.hms.aaid.HmsInstanceId;
import com.huawei.hms.common.ApiException;
import com.google.firebase.messaging.FirebaseMessaging;
import euromsg.com.euromobileandroid.EuroMobileManager;
import euromsg.com.euromobileandroid.enums.RDNotificationPriority;
Expand Down Expand Up @@ -38,11 +35,9 @@ public void initializeEuroMessage() {



if (EuroMobileManager.checkPlayService(getApplicationContext())) {

setExistingFirebaseTokenToEuroMessage();
} else {
setHuaweiTokenToEuromessage();
}




Expand All @@ -61,31 +56,6 @@ private void setExistingFirebaseTokenToEuroMessage() {
SP.saveString(getApplicationContext(), "FirebaseToken", token);
});
}
private void setHuaweiTokenToEuromessage() {
new Thread() {
@Override
public void run() {
try {
String appId = new AGConnectOptionsBuilder().build(getApplicationContext()).getString("client/app_id");
final String token = HmsInstanceId.getInstance(getApplicationContext()).getToken(appId, "HCM");

if(TextUtils.isEmpty(token) || token == null) {
Log.e("Huawei Token : ", "Empty token!!!");
return;
}

euroMobileManager.subscribe(token, getApplicationContext());

SP.saveString(getApplicationContext(), "HuaweiToken", token);

Log.i("Huawei Token", "" + token);

} catch (ApiException e) {
Log.e("Huawei Token", "Getting the token failed! " + e);
}
}
}.start();
}


}
10 changes: 1 addition & 9 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -4,17 +4,12 @@ buildscript {
repositories {
google()
mavenCentral()
maven {
url 'http://developer.huawei.com/repo/'
allowInsecureProtocol(true)
}

}

dependencies {
classpath 'com.android.tools.build:gradle:7.2.2'
classpath 'com.google.gms:google-services:4.3.14'
classpath 'com.huawei.agconnect:agcp:1.7.2.300'
}
}

Expand All @@ -28,10 +23,7 @@ allprojects {
mavenCentral()
maven { url 'https://jitpack.io' }

maven {
url 'http://developer.huawei.com/repo/'
allowInsecureProtocol(true)
}

}
}

Expand Down
2 changes: 0 additions & 2 deletions euromsg/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -58,8 +58,6 @@ dependencies {
api "com.squareup.retrofit2:converter-gson:2.9.0"
api "com.squareup.okhttp3:okhttp:4.9.0"
api "com.squareup.okhttp3:logging-interceptor:4.9.0"
api 'com.huawei.agconnect:agconnect-core:1.7.2.300'
api 'com.huawei.hms:push:6.7.0.300'
testImplementation 'junit:junit:4.13.2'
}

Expand Down
Loading

0 comments on commit 7ebfc24

Please sign in to comment.