Git Product home page Git Product logo

phrase-android's People

Contributors

docstun avatar forelabs avatar jablan avatar thesoenke avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Forkers

cojobs

phrase-android's Issues

OTA update strings should fallback to local string resources

Phrase version: 3.0.6

Steps to reproduce:

  • The application contains local string resources A, B, C and D
  • OTA update contains string resources A, B, C but not D
  • When D string resource is queried (using context.getString) empty string is returned

Expected behavior

  • String resources that are not present in OTA update should return local string resource

SDK crash if the resource is not found

this line this.setTextForView(view, resources.getString(attrs.getAttributeResourceValue(index, 0))) in the TextViewTransformer
crashes with NoResourceFoundException when the resource isn't found because of the 0 int value

CLI - Ability to specify `tools:locale`

In order to make Lint checks work properly for default (without language folder suffix) resource xml, tools:locale must be defined in resources xml tag:

<resources xmlns:tools="http://schemas.android.com/tools" tools:locale="cs">

It would be nice to be able to specify this this through .phrase.yml or CLI argument.

Special characters missing through OTA

Hey @theSoenke ,
While using the SDK version 3.x we saw that we miss some special characters for example the &.

We have several keys in Phrase that are for example look like this Test & other test. If we do receive those strings via OTA it gets broken with the new SDK and the retrieved string does not contain the & anymore.
I was tracing it in Charles Proxy and it seems that the Phrase server responds correctly Test &amp; other test I could also verify this by downgrading again to 2.1.3 of the SDK and all worked fine again.

Could you please verify this on your side as well and provide some fix.

Once again the steps to reproduce it:

  1. Have a string with a special character e.g. & in Phrase
  2. Get an OTA update via SDK 3.x
  3. Retrieve the String in code (e.g. context.getString() ) and verify that the & is missing

Just to mention I was also trying the latest SDK 3.0.3 and it also had the issue

Thank you!

java.lang.ClassCastException: com.phrase.android.sdk.inject.PhraseContextWrapper cannot be cast to android.app.ContextImpl

I'm testing Phrase integration and my app has a BroadcastReceiver registered in the manifest.xml like so:

       <receiver android:name="com.redacted.AppUpdatedReceiver">
            <intent-filter>
                <action android:name="android.intent.action.MY_PACKAGE_REPLACED" />
            </intent-filter>
        </receiver>

And the class itself is a simple subclass of BroadcastReceiver implementing onReceive. If I comment this out of the manifest.xml everything works fine. When I have this enabled my app crashes soon after launch with:

    java.lang.RuntimeException: Unable to instantiate receiver com.redacted.AppUpdatedReceiver: java.lang.ClassCastException: com.phrase.android.sdk.inject.PhraseContextWrapper cannot be cast to android.app.ContextImpl
        at android.app.ActivityThread.handleReceiver(ActivityThread.java:4012)
        at android.app.ActivityThread.access$1400(ActivityThread.java:237)
        at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1924)
        at android.os.Handler.dispatchMessage(Handler.java:106)
        at android.os.Looper.loop(Looper.java:223)
        at android.app.ActivityThread.main(ActivityThread.java:7660)
        at java.lang.reflect.Method.invoke(Native Method)
        at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:592)
        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:947)
     Caused by: java.lang.ClassCastException: com.phrase.android.sdk.inject.PhraseContextWrapper cannot be cast to android.app.ContextImpl
        at android.app.ActivityThread.handleReceiver(ActivityThread.java:3996)
        at android.app.ActivityThread.access$1400(ActivityThread.java:237) 
        at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1924) 
        at android.os.Handler.dispatchMessage(Handler.java:106) 
        at android.os.Looper.loop(Looper.java:223) 
        at android.app.ActivityThread.main(ActivityThread.java:7660) 
        at java.lang.reflect.Method.invoke(Native Method) 
        at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:592) 
        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:947) 

Device: Google Pixel 5, Android 11

Crash when using BottomNavigationView from latest material library

I'm using the latest material components version (1.4.0-rc01) and when accessing a screen which hosts the BottomNavigationView component in my app i receive this crash:

java.lang.NoSuchFieldError: No static field BottomNavigationView_menu of type I in class Lcom/google/android/material/R$styleable; or its superclasses (declaration of 'com.google.android.material.R$styleable' appears in /data/app/com.example.debug-Wmm5KDB8jGv2oazN9rPPWQ==/base.apk!classes17.dex)
        at com.phrase.android.sdk.inject.ViewTransformer.a(SourceFile:14)
        at com.phrase.android.sdk.inject.ViewTransformer.transformView(SourceFile:213)
        at androidx.appcompat.app.PhraseAppCompatDelegate.createView(SourceFile:10)
        at androidx.appcompat.app.PhraseAppCompatDelegate$factory2$1.onCreateView(SourceFile:1)
        at android.view.LayoutInflater$FactoryMerger.onCreateView(LayoutInflater.java:189)
        at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:772)
        at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:730)
        at android.view.LayoutInflater.rInflate(LayoutInflater.java:863)
        at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:824)
        at android.view.LayoutInflater.rInflate(LayoutInflater.java:866)
        at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:824)
        at android.view.LayoutInflater.inflate(LayoutInflater.java:515)
        at android.view.LayoutInflater.inflate(LayoutInflater.java:423)
        at androidx.fragment.app.Fragment.onCreateView(Fragment.java:1933)

I also see this issue on previous 1.3.0 version of the material library.
I'm on the latest version (3.0.5) of the phrase sdk, and can confirm that by removing it the issue is solved.

Phrase SDK does not respect locale code while update updateTranslations has not completed

The Phrase SDK only returns strings from the default locale when updateTranslations has not completed, even though setLocaleCode has been called and local string resources for that locale exist.

Scenario:
The app contains English strings in values and German strings in values-de. The Phrase OTA distribution contains strings for both languages.
On app start, Parse is initialized, setLocaleCode("de-DE") and updateTranslations() are called. Before the update completes, we already display some UI.

Expectation:
While OTA translations are (still) unavailable, the Phrase SDK returns bundled string resources for the set locale (in this case German).

Reality:
While OTA translations are (still) unavailable, the Phrase SDK ignores the set locale and returns bundled string resources from the default locale (in this case English).

Dark Mode Problem With MODE_NIGHT_FOLLOW_SYSTEM Selected

There is an error on the library where if user want to use Dark Mode with flag MODE_NIGHT_FOLLOW_SYSTEM.

MODE_NIGHT_NO, MODE_NIGHT_YES or MODE_NIGHT_AUTO_BATTERY works fine and only problem occurs due to the selection of MODE_NIGHT_FOLLOW_SYSTEM.

Once system dark mode is changed, the application did not restarted with proper dark mode theme in MODE_NIGHT_FOLLOW_SYSTEM selected.

The problem caused due to the Application class method overriding.

Causes Error:

override fun attachBaseContext(newBase: Context?) {
super.attachBaseContext(Phrase.wrapApplicationContext(newBase ?: this))
}

Duplicate class a.a.a.a.a in Phrase SDK 3.0.0

Hey there,

I'm reaching out to you because it turned out that the new SDK version 3.0.0 delivers internally some obfuscated classes which are not in the com.phrase.android.sdk package. While compiling with another SDK we use (IDNow) we get a duplicate class error.
I think for a public SDK that should not be done in this way, we will also report the same Issue to IDNow since it is not a very good style of designing an SDK.

I hope you can help and please don't get me wrong obfuscation is totally fine :) But there should be a common package for those classes too.

Thanks for the help if you need further information please let me know.

Also here the compile error:
Duplicate class a.a.a.a.a found in modules jetified-android-sdk-3.0.0-runtime (com.github.phrase:android-sdk:3.0.0) and jetified-idnow-platform-3.20.1-runtime (de.idnow.android.sdk:idnow-platform:3.20.1)

Cheers

Switching from Dark to Light mode crashes the app

if we switch from Light To Dark mode we get our app to crash.

I think this is happening to all apps that implement this SDK

at androidx.appcompat.app.AppCompatDelegateImpl.applyDayNight(AppCompatDelegateImpl.java:2389)
        at androidx.appcompat.app.AppCompatDelegateImpl.onConfigurationChanged(AppCompatDelegateImpl.java:666)
        at androidx.appcompat.app.PhraseBaseAppCompatDelegate.onConfigurationChanged(SourceFile:1)

Tested on:

Android 12
Happens on Real devices as well as Emulator
Version Phrase SDK used 'com.github.phrase:android-sdk:3.1.2'

Access to dynamic strings

Thanks to OTA we can also do some dynamic mappings from keys not previously present in the build but that comes afterwards. For example, to map server error codes into proper user messages is very handy.

In iOS, when we do something like NSLocalizedString("my_server_error_key","") we can get the message from OTA, even if it was not previously included in the build but added later.

However, in Android, I see no way to access it. I see there is a TranslationRepository with a getString() that would make the trick, but that repo is a private property of Phrase. Could you expose a way to access it? maybe something like:

Phase.class


    @Nullable
    public static String getString(String key) {
        return translationRepository.getString(key);
    }

Is there any other way we can access the OTA keys dynamically (and not by a R.string)?

Android OTA update problem

Hello,
We integrated it into our Android app but Over the Air (OTA) doesn't work. I debug your code, download xml file and write to cache successfully. However, the layout on the screen are not updated.
How we can solve this problem ?

Min/Max version constraints behaviour

Hi, I am running into something similar to what I expressed in the iOS SDK some months ago regarding the behavior of min/max version constraints. Basically, this:

What I expected

Min/Max to be applied not only on downloading but also in future uses. So, if for example I am in app version 3.1.0, and there is an OTA for [3.0.0 - 3.2.0], then I expect OTA to download and use that file. However, when the user updates the app (without deleting) to 3.3.0, I was expecting the OTA to no longer apply and therefore serve strings from the app bundle rather than the outdated OTA file.

What I see happening

Min/Max is applied on download, so it only gets a new OTA file if the app version matches the range. However, once the OTA is downloaded, it seems to be used every time from now on, even if the app upgraded to a version that is no longer under the OTA range.

What is the problem?

The main issue I see with this behavior is that the translations are no longer consistent. So, if I update strings, users that downloaded some old OTA content are now seeing the old strings even if they have the app updated with newer texts, while new users downloading the app today see something newer (coming from the binary)

Can you confirm if the Android SDK is behaving this way on purpose? could you make an update like the one in iOS to make the versioning more consistent? otherwise, could it be possible to at least have a "clear cache" method or alike to reset the state after each app upgrade?

Thanks!

translationsChanged's of onSuccess callback always false

Using version 2.0.1 of the library, we noticed that the variable translationsChanged of the callback's onSuccess method is always false.

the name of the variable hints that it should be true when we get a new translations.

And I would like to suggest also to improve the callback by including the version number of the downloaded translation, this would be helpful for us to track the usage of feature.

PhraseContextWrapper does not cover application.getString()

In some cases, we fetch strings using application context. But it even though we've overriden attachBaseContext method in our application It seems like it is not possible to reach your custom resources.

In #25 you mentioned that you will remove this path from the integration. And I see you have already removed it from your documentation.

Our team would appreciate it if you were able to find another way of exposing your PhraseResources layer so we can still enable our usecase. Be it with via the singleton or somehow through the application context.

We were able to work around the issue by providing Phrase.wrapApplicationContext(application) directly to the modules that require it. But this is of course unintended usage of the API and not ideal.

App using Phrase OTA doesn't pick up changed locale without cold start

How to reproduce:

  • have an app with Phrase OTA
  • launch the app
  • leave app via home button
  • go to system settings and change the system locale
  • go back to the app with Phrase OTA via recent applications
  • the app didn't pick up the changed locale

When force closing the app / swiping the app from the recent apps and relaunching the app the changed system locale is picked up

Locale codes mismatch between Phrase OTA and Android

Locales in Phrase | Locales in Android, Locales found in requests
en | en_HK
ja | ja_JP
ko | ko_KR
zh-Hans | zh_CN_#Hans
zh-Hant | zh_HK_#Hant

When I try to request the translation xml with the link containing the locale value zh_HK_#Hant,
https://ota.phraseapp.com/DISTRIBUTION_ID/DEV_SECRET/zh_HK_#Hant/xml?,
a 404 Not Found error is returned.

After checking with Phrase support,
they found out the locale codes in the requests do not match the codes using in the project.

It seems Android added the location to the locale code, i.e. _HK in en_HK .
For English, Japanese, Korean, Phrase OTA can get the translation xml correctly even the location is included in the locale code,
i.e. Phrase OTA can handle to redirection from the url with en_HK, ja_JP, ko_KR
to translation xml for English, Japanese, Korean.
It ONLY failed for Simplified Chinese and Traditional Chinese.

Then I have called the Phrase.setLocaleCode to update the locale to zh-Hans / zh-Hant,
enforcing Phrase OTA to get the correct translation xml for Simplified Chinese / Traditional Chinese.

However, I found that after calling Phease.setLocaleCode with zh-Hans / zh-Hant,
some UI components cannot be completely translated,
see the Day of Week row, Cancel / OK buttons for DatePicker,
which they should be displayed in Chinese instead of English.
image

In short, I have to set the locale with Phrase.setLocaleCode("zh-Hant") to fetch the translation xml.
However, Phrase.setLocaleCode(“zh-Hant”) may change the locale settings in Android context which broke the localization in DatePicker.

Compatibility with Android 6 and 7

I am using Phrase OTA version 3.1.3.

I have tried to launch the app in Android Emulator with Android 6 & 7.
I found the TextView keeps displaying the old translations,
NOT the translation updated with OTA.

Is the Phrase OTA 3.1.X compatible with Android 6 & 7?

Html stripped when using OTA in 3.x versions

We have several texts using html to be able to add bold and some other minor style changes into a styled text.

We were able to use them with no problems up until we upgraded phraseapp sdk from 2.1.3 to 3.0.5 (we are not using 3.0.6 due to some androidx incompatibility in the bottom navigation that we need to solve first). However, with the newer version, every time we try to get the string it returns it without any HTML tag. So:

This code:

getString(R.string.social_feed_post_match_user_title, name, tenant)

with this text value (in the local resources) :

    <string name="social_feed_post_match_user_title"><![CDATA[<b>%1$s</b> shared a result in <b>%2$s</b>]]</string>

Returns:

{name} shared a result in {tenant}

If we disable OTA altogether (removing the delegate, the application context wrapper and the Phrase.setup) then the code returns the expected string:

<b>{name}</b> shared a result in <b>{tenant}</b>

This feature is crucial for us, and a blocker to update the library

Add support to Android 13 (API 33) in-app language change

We use Phase in our project.
Currently we are implementing in-app language change (https://developer.android.com/guide/topics/resources/app-languages) which is officially supported in Appcompat 1.6.0-rc01 or 1.7.0-alpha01.
This works fine with sdk < 33, but on Tiramisu AppCompatDelegate.getApplicationLocales() doesn't return locale code.
To fix it I added a workaround:
` override fun getDelegate(): AppCompatDelegate {

    return if (Build.VERSION.SDK_INT >= TIRAMISU) {

        super.getDelegate()

    } else {

        Phrase.getDelegate(this, super.getDelegate())

    }
}`

Can You add support to in-app language change using Appcompat so we can remove this hack?

Android 2.1.3 Webview Resource not found - Crash

Hello,
App crashes when clicked on “copy” option selected text in android webview on many devices. There was no such problem before 2.1.3 release.
Best,

Fatal Exception: android.content.res.Resources$NotFoundException: Resource ID #0x2090005
       at android.content.res.ResourcesImpl.getValue(ResourcesImpl.java:237)
       at android.content.res.Resources.getInteger(Resources.java:1115)
       at org.chromium.content.browser.selection.SelectionPopupControllerImpl.a(PG:207)
       at yY.onCreateActionMode(PG:15)
       at KW.onCreateActionMode(PG:6)
       at com.android.internal.policy.DecorView$ActionModeCallback2Wrapper.onCreateActionMode(DecorView.java:2595)
       at com.android.internal.policy.DecorView.startActionMode(DecorView.java:913)
       at com.android.internal.policy.DecorView.startActionModeForChild(DecorView.java:869)
       at android.view.ViewGroup.startActionModeForChild(ViewGroup.java:1008)
       at android.view.ViewGroup.startActionModeForChild(ViewGroup.java:1008)
       at android.view.ViewGroup.startActionModeForChild(ViewGroup.java:1008)
       at android.view.View.startActionMode(View.java:7324)
       at HL.a(PG:1)
       at org.chromium.content.browser.selection.SelectionPopupControllerImpl.h(PG:137)
       at LU.a(PG:31)
       at Lv.a(PG:14)
       at EI.run(:6)
       at android.os.Handler.handleCallback(Handler.java:883)
       at android.os.Handler.dispatchMessage(Handler.java:100)
       at android.os.Looper.loop(Looper.java:214)
       at android.app.ActivityThread.main(ActivityThread.java:7356)
       at java.lang.reflect.Method.invoke(Method.java)
       at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:492)
       at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:930)

Unable to download aar when using with another private jitpack library.

Hello, I've encountered following issue when using phraseapp OTA library for my project.
Sometimes gradle is unable to download aar for the dependency (it returns 401 Unauthorized) if I also use another private jitpack library in the project.
When I use phraseapp lib alone it works perfect and always download the dependency during gradle sync.
I created an issue on jitpack's repo with detailed description (jitpack/jitpack.io#3759) , but I'm not sure if the problem is on their side. Maybe you can take a look on it?

Missing support for ComponentActivity

In Compose-only apps there is no need for AppCompatActivity and it would be very good to support usage in ComponentActivity without need to add AppCompat dependency

Using multiple ContextWrapper with Phrase SDK doesn't work

In my current App I'm already wrapping my context with a ContextWrapper when using Phrase SDK with its Phrase.wrap() it seems that it doesn't work.

If I use it as follows:

    @Override
    public void attachBaseContext(Context newBase) {
        super.attachBaseContext(Phrase.wrap(LocaliseContextWrapper.wrap(newBase, getLocale())));
    }

Then Phrase SDK is working and I'm getting the new Strings. But LocaliseContextWrapper isn't working anymore.

If I use it as follows:

    @Override
    public void attachBaseContext(Context newBase) {
        super.attachBaseContext(LocaliseContextWrapper.wrap(Phrase.wrap(newBase), getLocale()));
    }

Then I get the same result.

FYI, this is LocaliseContextWrapper internals

class LocaliseContextWrapper(base: Context?) : ContextWrapper(base) {
    companion object {
        @JvmStatic
        fun wrap(context: Context, newLocale: Locale?): ContextWrapper {
            val config = Configuration()
            config.setLocale(newLocale)
            return ContextWrapper(context.createConfigurationContext(config))
        }
    }
}

Not too weird or something. How can I combine both wrappers? I need them both!

Sidenote:
I'm using AppCompat version 1.2.0

Crash when doing a long press in the content of a webview

Phrase version 3.0.5, AppCompat version 1.3.0.

Steps to reproduce:

  • set minifyEnabled true
  • open a webview and try to copy-paste something or just select some test
  • app crashes when the contextual selection menu shows up

to workaround this i've found in my tests that we can:

  • set minifyEnable false
  • comment the Phrase.getDelegate(this, super.getDelegate()) line in my code

Also, this issue has been found in our live app in multiple phones and android versions.

EDIT- also, i've used app bundles, i don't know if that is meaningful or not

Double quotes added to some strings

Hey, we noticed an issue with the SDK, some messages seems to be surrounded with double quotes on the app.
When investigating we found that all those messages have some trailing white spaces, when we pull those message through the cli, we noticed the double quotes, this doesn't cause any issue when we don't use the SDK, as Android ignores the quotes.
But when these messages gets pulled through OTA, the quotes are displayed on the UI, and we confirmed this by putting a breakpoint in the method CustomResources.getText(id)

Line breaks with localized formatted strings appears as <br/>

We are facing an issue with all formatted strings when using the OTA SDK, they appear as
after updating the SDK to 2.0.0 (before they appeared as \n).

The workaround we are using now is passing the retuned string to Html.fromHtml(), but it's not a pretty solution!

Crash when selecting text in a WebView

Hello. We tried to use "Over the air" integration in our app, but we faced unexpected crashes among our users.
Such crash happens when the user select some text in the WebViews we have for some of our features, as there is a resource not resolved that would seem to be needed in ordre to display the contextual menu for this text selection (copy, etc)
I link the stack trace here:

android.content.res.Resources$NotFoundException: Resource ID #0x20c0062
	at android.content.res.ResourcesImpl.getValue(ResourcesImpl.java:216)
	at android.content.res.Resources.getInteger(Resources.java:1106)
	at org.chromium.ui.base.DeviceFormFactor.b(chromium-Monochrome.aab-stable-541411823:22)
	at org.chromium.content.browser.selection.SelectionPopupControllerImpl.z(chromium-Monochrome.aab-stable-541411823:3)
	at bv.onCreateActionMode(chromium-Monochrome.aab-stable-541411823:28)
	at com.android.internal.policy.DecorView$ActionModeCallback2Wrapper.onCreateActionMode(DecorView.java:2412)
	at com.android.internal.policy.DecorView.startActionMode(DecorView.java:888)
	at com.android.internal.policy.DecorView.startActionModeForChild(DecorView.java:844)
	at android.view.ViewGroup.startActionModeForChild(ViewGroup.java:985)
	at android.view.ViewGroup.startActionModeForChild(ViewGroup.java:985)
	at android.view.ViewGroup.startActionModeForChild(ViewGroup.java:985)
	at android.view.ViewGroup.startActionModeForChild(ViewGroup.java:985)
	at android.view.ViewGroup.startActionModeForChild(ViewGroup.java:985)
	at android.view.View.startActionMode(View.java:6875)
	at org.chromium.content.browser.selection.SelectionPopupControllerImpl.E(chromium-Monochrome.aab-stable-541411823:75)
	at J23.a(chromium-Monochrome.aab-stable-541411823:38)
	at Cd3.k(chromium-Monochrome.aab-stable-541411823:7)
	at uo.run(chromium-Monochrome.aab-stable-541411823:15)
	at android.os.Handler.handleCallback(Handler.java:873)
	at android.os.Handler.dispatchMessage(Handler.java:99)
	at android.os.Looper.loop(Looper.java:193)
	at android.app.ActivityThread.main(ActivityThread.java:6863)
	at java.lang.reflect.Method.invoke(Native Method)
	at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:537)
	at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:858)

This crash seems to be induced by the AppCompatDelegate setup required by the integration guide:

abstract class BaseActivity: AppCompatActivity {

   override fun getDelegate(): AppCompatDelegate =
        Phrase.getDelegate(this, super.getDelegate())
}

We used one of the latest version of Phrase SDK (3.2.1).
Is it something you are aware of? Is it something linked to the version of AppCompat library Phrase sdk is using?

Can you please provide some insights on this? Thanks

XmlPullParserException gets Logged by Phrase OTA

Hi, I get this exception when I tried to use Phrase OTA in my new basic Android project using our existing distribution id & environment.
The sample app that I tried is basically a carbon copy of sdk sample usage in here.

This is the only message/error that appeared on logcat.

D/Phrase OTA: org.xmlpull.v1.XmlPullParserException: expected: /b read: string (position:END_TAG </string>@264:77 in java.io.InputStreamReader@ed564b1).

The detail on translated text that I'm using is:

  • translation key: STRING_CLOSE
  • translation value: Close

More details:

  • Phrase SDK version 3.1.6
  • AppCompat 1.3.0
  • minSdk 22
  • targetSdk 32
  • Currently we don't set the distribution version yet in Phrase web integration page. So I assume any version should get the text.
  • I'd tried providing localecode as well in the code to no avail.

Kindly help explain what is going on here.

Feature Request: get string by locale without set app locale

It will be helpful if Phrase add support to get string for multiple locale for the same time. Like the following code

Phrase.getString(key, locale)

In my case, there are background tasks to generate report (pdf) in multiple language. If I set Phrase.setLocaleCode(locale) before the task then user will see the UI in different language.

Translations update always triggers onFailure callback

Hello,

After updating Phrase OTA SDK from 2.x to 3.0.x we noticed an issue during translations update which always fails. Looking at stack trace in debugger I noticed an XmlPullParserException , I don't know how to get more informations about that exception, I checked the translation files for maybe some weird characters and tried to remove it on a new OTA release, nothing changed

On 2.x version updates were working fine but we were having issues with realtime updates, that's why we decided to try version 3.X

Screenshot 2021-10-12 at 13 40 21

Error(e=org.xmlpull.v1.XmlPullParserException: unexpected type (position:TEXT 
     delete use...@130:5 in java.io.InputStreamReader@a03213b) )

I've read that appcompat may have impact on library proper working, we were using 1.2.0, tried to bump until 1.3.1, same behaviour

Other gradle settings

    compileSdkVersion 30
...
    buildToolsVersion '30.0.3'        
    minSdkVersion 24
    targetSdkVersion 30
..
    compileOptions
    {
        sourceCompatibility JavaVersion.VERSION_11
        targetCompatibility JavaVersion.VERSION_11
    }

Let me know if you need more information ! Thanks.

translationsChanged returns false when using Androids new view-binding

Hi,

I made some changes to my app today and noticed that once I introduced androids new view-binding that the translations are not changed. Reverting the project back to the original synthetic way returns true.
It would seem like the SDK doesn't support the new way of view binding and if so when will it be supported?

I'm using version 3.0.5
The app is written in Kotlin.
You could most likely easily reproduce this by setting up a new project and following the guide provided above but if you need anything else please let me know

The app is blinking

An application that uses the Phrase android SDK becomes blinking after changing a battery saver.

Repro steps:

  1. Clone the example project https://github.com/phrase/android-sdk-example (commit be99ea20d0850012b1264ffe04b3fcfce760879e - it uses the Phrase SDK v3.2.3).
  2. Add your DISTRIBUTION_ID and ENVIRONMENT_TOKEN.
  3. Also add the localeCode: "en" or "en_gb":
Phrase.setup(this, "DISTRIBUTION_ID", "ENVIRONMENT_TOKEN", "en");
  1. Run the app.
  2. When it is started, turn the battery saver ON.

Current behavior: The app is blinking and a user cannot interact with it.
Expected behavior: The app shouldn't blink, it should successfully handle batter saver change.

I would like to mention that the app doesn't become blinking after the battery saver change if we don't pass the localeCode.


Video example:
https://user-images.githubusercontent.com/33689229/219599223-53ea246c-86e5-4a44-8ead-973e895fcdf3.mov


Tested on:

  • Android 13 physical device
  • Android 13 emulator
  • Android 11 physical device
  • Android 10 emulator

ANRs when getString() is called

Hello,

The Google Play Store console is reporting us a lot ANRs (around one million each month) that seems to be due to Android Phrase SDK. I've already reported this to your technical support but never got any answer.
Each ANR happen when a broadcast is received or when a service is started by the app, so it's possible the issue is only there in background. The stacktrace of each report is always the same and look like that :

  at sun.misc.Unsafe.park (Native method)
  at java.util.concurrent.locks.LockSupport.park (LockSupport.java:190)
  at java.util.concurrent.FutureTask.awaitDone (FutureTask.java:450)
  at java.util.concurrent.FutureTask.get (FutureTask.java:192)
  at com.phrase.android.sdk.RepositoryHolder.getRepository (RepositoryHolder.java:1)
  at com.phrase.android.sdk.inject.PhraseResources.b (SourceFile:3)
  at com.phrase.android.sdk.inject.PhraseResources.getText (SourceFile:1)
  at com.phrase.android.sdk.inject.PhraseResources.getString (SourceFile:1)
  at android.content.Context.getString (Context.java:649)

ANRs have an impact on our app quality and Play Store app ranking, that's why we want to get rid of them ASAP. Could you please look at it and let me know how to fix it?

Thanks

Some locales not set properly by xml

Hello. We use "Over the air" integration in our app and we faced issue with applying strings in xml. We use in our xml file something like this.

 <com.google.android.material.tabs.TabLayout
                android:id="@+id/tabLayout"
                style="@style/TabLayoutWallet"
                android:layout_width="match_parent"
                android:layout_height="match_parent">

                <com.google.android.material.tabs.TabItem
                    android:layout_width="wrap_content"
                    android:layout_height="match_parent"
                    android:text="@string/text1" />

                <com.google.android.material.tabs.TabItem
                    android:layout_width="wrap_content"
                    android:layout_height="match_parent"
                    android:text="@string/text2" />

            </com.google.android.material.tabs.TabLayout>

Tab items not load locales and its show only value that stored locally in strings.xml only. Also we faced with this issue when we use helperText in com.google.android.material.textfield.TextInputLayout widget. As a workaround we set a value of this type of views by code but it's so annoying. Please provide any help.

ClassNotFoundException for android.view.Button with TimePickerDialog on Android 9 + 8

We get weird exceptions when using Phrase SDK and android.app.TimePickerDialog widget.

Only reproduced it on Android 9 and 8 for now. 10 and above works as expected.

It seems to be caused by an older version of the ViewPump library. There is an identical issue in this github project.

Additionally, I wasn't able to test with 3.0.4 because something is broken with it on jitpack.io

    android.view.InflateException: Binary XML file line #37: Binary XML file line #37: Error inflating class Button
    Caused by: android.view.InflateException: Binary XML file line #37: Error inflating class Button
    Caused by: java.lang.ClassNotFoundException: Didn't find class "android.view.Button" on path: DexPathList[[zip file "/system/framework/org.apache.http.legacy.boot.jar", zip file "/data/app/our.package-7ocexMTXPn9pTVBEZu4IXQ==/base.apk"],nativeLibraryDirectories=[/data/app/our.package-7ocexMTXPn9pTVBEZu4IXQ==/lib/x86_64, /system/lib64]]
        at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:134)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:379)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:312)
        at android.view.LayoutInflater.createView(LayoutInflater.java:606)
        at android.view.LayoutInflater.onCreateView(LayoutInflater.java:703)
        at android.view.LayoutInflater.onCreateView(LayoutInflater.java:720)
        at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:788)
        at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:730)
        at android.view.LayoutInflater.rInflate(LayoutInflater.java:863)
        at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:824)
        at android.view.LayoutInflater.rInflate(LayoutInflater.java:866)
        at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:824)
        at android.view.LayoutInflater.inflate(LayoutInflater.java:515)
        at android.view.LayoutInflater.inflate(LayoutInflater.java:423)
        at android.view.ViewStub.inflateViewNoAdd(ViewStub.java:269)
        at android.view.ViewStub.inflate(ViewStub.java:302)
        at com.android.internal.app.AlertController.resolvePanel(AlertController.java:506)
        at com.android.internal.app.AlertController.setupView(AlertController.java:530)
        at com.android.internal.app.AlertController.installContent(AlertController.java:264)
        at android.app.AlertDialog.onCreate(AlertDialog.java:436)
        at android.app.Dialog.dispatchOnCreate(Dialog.java:407)
        at android.app.Dialog.show(Dialog.java:302)
        at android.app.TimePickerDialog.show(TimePickerDialog.java:149)
        at androidx.fragment.app.DialogFragment.onStart(DialogFragment.java:688)
        at androidx.fragment.app.Fragment.performStart(Fragment.java:3008)
        at androidx.fragment.app.FragmentStateManager.start(FragmentStateManager.java:586)
        at androidx.fragment.app.FragmentStateManager.moveToExpectedState(FragmentStateManager.java:300)
        at androidx.fragment.app.FragmentManager.executeOpsTogether(FragmentManager.java:2177)
        at androidx.fragment.app.FragmentManager.removeRedundantOperationsAndExecute(FragmentManager.java:2088)
        at androidx.fragment.app.FragmentManager.execPendingActions(FragmentManager.java:1990)
        at androidx.fragment.app.FragmentManager$5.run(FragmentManager.java:524)
        at android.os.Handler.handleCallback(Handler.java:873)
        at android.os.Handler.dispatchMessage(Handler.java:99)
        at android.os.Looper.loop(Looper.java:193)
        at android.app.ActivityThread.main(ActivityThread.java:6669)
        at java.lang.reflect.Method.invoke(Native Method)
        at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:493)
        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:858)

Version Range of the distribution not respected

Hi, we are facing an issue with the integration, which has lead to some crashes in Production, we noticed that the Min Version field is not respected, and that distributions are available to older versions as well.
While investigating we noticed this:

  1. having a release v25 available only to versions >= 4.31.0
    Screen Shot 2020-02-24 at 10 08 25 AM
  2. and the app version set to 4.30.0
  3. The SDK calls the API using the URL: https://ota.phraseapp.com/{distributionId}/{secret}/en_US/xml?client=android&unique_identifier=ba100b94-1a88-468c-b433-95fdea7bbcb2&sdk_version=2.0.1&version=4.30.0

And despite having an older version, the SDK got a 200OK response, with the releaseVersion 25, below a screenshot of the debugging session parameters:
Screen Shot 2020-02-24 at 10 11 24 AM

This is urgent, as it's stopping us from using the SDK in production.

[Android] Some strings still stay its old language after calling Phrase.setLocaleCode(localeCode)

Phrase version 3.0.6
Using Kotlin and RIBs to build the app
After changing language using Phrase.setLocaleCode(localeCode) and Phrase.updateTranslations(), some string didn't update their language into the new one.
For those un-updated strings were declared by the xml andreoid:text attribution but it can be updated once set the text programmatically.
Can anyone help?
Thank you very much.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.