瀏覽代碼

Expose nicknames in profile list

Peter Cai 3 年之前
父節點
當前提交
45dcb1d282

+ 6 - 2
app/src/main/java/im/angry/openeuicc/ui/EuiccManagementFragment.kt

@@ -128,8 +128,12 @@ class EuiccManagementFragment : Fragment(), EuiccFragmentMarker, EuiccProfilesCh
 
 
         fun setProfile(profile: Map<String, String>) {
         fun setProfile(profile: Map<String, String>) {
             this.profile = profile
             this.profile = profile
-            // TODO: The library is not exposing the nicknames. Expose them so that we can do something here.
-            binding.name.text = profile[NAME.name]
+            binding.name.text =
+                if (profile[NICKNAME.name].isNullOrEmpty()) {
+                    profile[NAME.name]
+                } else {
+                    profile[NICKNAME.name]
+                }
             binding.state.setText(
             binding.state.setText(
                 if (isEnabled()) {
                 if (isEnabled()) {
                     R.string.enabled
                     R.string.enabled

+ 1 - 0
libs/lpad-sm-dp-plus-connector/src/main/java/com/truphone/lpa/impl/ListProfilesWorker.java

@@ -42,6 +42,7 @@ class ListProfilesWorker {
                 profileMap.put(ProfileKey.STATE.name(), LocalProfileAssistantImpl.DISABLED_STATE.equals(info.getProfileState().toString()) ? "Disabled" : "Enabled");
                 profileMap.put(ProfileKey.STATE.name(), LocalProfileAssistantImpl.DISABLED_STATE.equals(info.getProfileState().toString()) ? "Disabled" : "Enabled");
                 profileMap.put(ProfileKey.ICCID.name(), info.getIccid().toString());
                 profileMap.put(ProfileKey.ICCID.name(), info.getIccid().toString());
                 profileMap.put(ProfileKey.NAME.name(), (info.getProfileName()!=null)?info.getProfileName().toString():"");
                 profileMap.put(ProfileKey.NAME.name(), (info.getProfileName()!=null)?info.getProfileName().toString():"");
+                profileMap.put(ProfileKey.NICKNAME.name(), (info.getProfileNickname()!=null)?info.getProfileNickname().toString():"");
                 profileMap.put(ProfileKey.PROVIDER_NAME.name(), (info.getServiceProviderName()!=null)?info.getServiceProviderName().toString():"");
                 profileMap.put(ProfileKey.PROVIDER_NAME.name(), (info.getServiceProviderName()!=null)?info.getServiceProviderName().toString():"");
                 profileMap.put(ProfileKey.ISDP_AID.name(), (info.getIsdpAid()!=null)?info.getIsdpAid().toString():"");
                 profileMap.put(ProfileKey.ISDP_AID.name(), (info.getIsdpAid()!=null)?info.getIsdpAid().toString():"");
                 profileMap.put(ProfileKey.PROFILE_CLASS.name(), (info.getProfileClass()!=null)?info.getProfileClass().toString():"");
                 profileMap.put(ProfileKey.PROFILE_CLASS.name(), (info.getProfileClass()!=null)?info.getProfileClass().toString():"");

+ 2 - 1
libs/lpad-sm-dp-plus-connector/src/main/java/com/truphone/lpa/impl/ProfileKey.java

@@ -4,9 +4,10 @@ public enum ProfileKey {
     ICCID,
     ICCID,
     STATE,
     STATE,
     NAME,
     NAME,
+    NICKNAME,
     PROVIDER_NAME,
     PROVIDER_NAME,
     ISDP_AID,
     ISDP_AID,
     PROFILE_CLASS,
     PROFILE_CLASS,
     PROFILE_STATE
     PROFILE_STATE
-    
+
 }
 }