diff --git a/README.md b/README.md index 0a0d319..21579f1 100644 --- a/README.md +++ b/README.md @@ -1,47 +1,35 @@ -# Android SDK - -## Table of Contents - -- [Import](#import) -- [Installation](#installation) - - [Project](#project) - - [Settings](#settings) - - [App](#app) - - [Add fragment](#fragment) -- [Troubleshooting](#troubleshooting) -- [Authors](#authors) +Android SDK +=================== +## Table of Contents +- [Import](#import) +- [Installation](#installation) + - [Project](#project) + - [Settings](#settings) + - [App](#app) + - [Add fragment](#fragment) +- [Troubleshooting](#troubleshooting) +- [Authors](#authors) - ## Import - You must use git to download the sdk from [repository](https://github.com/tecnaviapress/newsmemory-android-sdk) - 1. The repository is private, to clone it you must generate an ssh key, see the [guide](https://docs.github.com/en/authentication/connecting-to-github-with-ssh/generating-a-new-ssh-key-and-adding-it-to-the-ssh-agent) 2. Once the key is generate you must send to Tecnavia the public key and wait a confirmation that you are enabled 3. Inside root folder run the following command, replace TAG with the latest release, see the list on [releases](https://github.com/tecnaviapress/newsmemory-android-sdk/releases) - ```sh git clone --depth 1 --brach TAG git@github.com:tecnaviapress/newsmemory-android-sdk.git ``` - 4. if you already has the module you could update to another release by the following commands - ```sh cd newsmemory-android-sdk git checkout tags/TAG ``` - - ## Installation - ### Project Gradle - 1. check main gradle repositories and dependencies - ```java buildscript { repositories { @@ -58,13 +46,6 @@ buildscript { classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:1.5.0" } - - //If photodraweeview:1.1.3 for some reason is not available from Maven force this version - configurations.all { - resolutionStrategy { - force "me.relex:photodraweeview:2.1.0" - } - } } allprojects { @@ -76,119 +57,117 @@ allprojects { maven { url "https://jitpack.io" } + + //If photodraweeview:1.1.3 for some reason is not available from Maven force this version + configurations.all { + resolutionStrategy { + force "me.relex:photodraweeview:2.1.0" + } + } } } ``` 2. if you are using sdk for amazon and it is built for it add the following maven repository - ```java -maven { - url "https://s3.amazonaws.com/android-listener/mvn-repo" +maven { + url "https://s3.amazonaws.com/android-listener/mvn-repo" } ``` 3. you could customize all dependencies version by updating the following variables, !pay attention, because the sdk may not starts or works properly add these variables to ext object in main gradle file, see below example. -| variable | default | Description | -| :--------------------------------------------------------------------------------------------------- | :-----: | :-------------------------------------------------------- | -| compileSdk | 33 | | -| targetSdk | 33 | | -| minSdk | 24 | | -| frescoVersion | 2.5.0 | used by react native to display some images | -| soLoaderVersion | 0.10.1 | used to load needed system native libraries | -| okHttpVersion | 4.9.2 | | -| glideVersion | 4.12.0 | | -| kotlinGradleVersion | 1.5.0 | | -| kotlinVersion | 1.4.0 | | -| webkitVersion | 1.4.0 | | -| androidxVersion | 1.5.0 | | -| androidxWorkRuntimeVersion | 1.5.0 | | -| androidxAnnotationVersion | 1.4.0 | | -| androidxViewpager2Version | 1.0.0 | | -| androidxFragmentVersion | 1.4.1 | | -| androidxBrowserVersion | 1.4.0 | | -| androidxTransitionVersion | 1.1.0 | | -| androidxCoordinatorlayoutVersion | 1.1.0 | | -| androidxSwiperefreshlayoutVersion | 1.0.0 | | -| androidxAppcompatVersion | 1.0.2 | | -| androidxLegacySupportVersion | 1.0.0 | | -| playServiceiidVersion | 17.0.0 | | -| playServiceBaseVersion | 18.0.1 | | -| **The following variables are used if you include on of the optional library listed in description** | -| playServiceAnalyticsVersion | 18.0.1 | react-native-google-analytics-bridge | -| playServiceAdsVersion | 20.6.0 | react-native-prebid, react-native-dfp, react-native-admob | -| playServiceMapsVersion | 17.0.0 | react-native-maps | -| playBillingVersion | 5.0.0 | react-native-iap for google | -| amazonSdkVersion | 3.0.3 | react-native-iap for amazon | +| variable | default | Description | +|:---------------------------------- |:-------:|:-------------------------------------------------------------- | +| compileSdk | 33 | | +| targetSdk | 33 | | +| minSdk | 24 | | +| frescoVersion | 2.5.0 | used by react native to display some images | +| soLoaderVersion | 0.10.1 | used to load needed system native libraries | +| okHttpVersion | 4.9.2 | | +| glideVersion | 4.12.0 | | +| kotlinGradleVersion | 1.5.0 | | +| kotlinVersion | 1.4.0 | | +| webkitVersion | 1.4.0 | | +| androidxVersion | 1.5.0 | | +| androidxWorkRuntimeVersion | 1.5.0 | | +| androidxAnnotationVersion | 1.4.0 | | +| androidxViewpager2Version | 1.0.0 | | +| androidxFragmentVersion | 1.4.1 | | +| androidxBrowserVersion | 1.4.0 | | +| androidxTransitionVersion | 1.1.0 | | +| androidxCoordinatorlayoutVersion | 1.1.0 | | +| androidxSwiperefreshlayoutVersion | 1.0.0 | | +| androidxAppcompatVersion | 1.0.2 | | +| androidxLegacySupportVersion | 1.0.0 | | +| playServiceiidVersion | 17.0.0 | | +| playServiceBaseVersion | 18.0.1 | | +| **The following variables are used if you include on of the optional library listed in description** | +| playServiceAnalyticsVersion | 18.0.1 | react-native-google-analytics-bridge | +| playServiceAdsVersion | 20.6.0 | react-native-prebid, react-native-dfp, react-native-admob | +| playServiceMapsVersion | 17.0.0 | react-native-maps | +| playBillingVersion | 5.0.0 | react-native-iap for google | +| amazonSdkVersion | 3.0.3 | react-native-iap for amazon | ```java ext { - compileSdk 34 - androidxVersion "1.4.0" + compileSdk = 34 + androidxVersion = "1.4.0" ... } ``` - - -### Settings Gradle - +### Settings Gradle ```java include ':newsmemory-android-sdk' ``` - - ### App Gradle - add the following lines if missing - -```java + ```java plugin: "com.android.application" apply plugin: "com.google.gms.google-services" //add crashlytics only if the aar file is included apply plugin: 'com.google.firebase.crashlytics' android{ - ... + ... - defaultConfig { - ... - //This line is required by react-native-iap, not included by default - missingDimensionStrategy "store", "play" - } + defaultConfig { + ... + //This line is required by react-native-iap, not included by default + missingDimensionStrategy "store", "play" + } - ... + ... - packagingOptions { - pickFirst "lib/x86/libc++_shared.so" - pickFirst "lib/x86_64/libc++_shared.so" - pickFirst "lib/arm64-v8a/libc++_shared.so" - pickFirst "lib/armeabi-v7a/libc++_shared.so" - } + packagingOptions { + pickFirst "lib/x86/libc++_shared.so" + pickFirst "lib/x86_64/libc++_shared.so" + pickFirst "lib/arm64-v8a/libc++_shared.so" + pickFirst "lib/armeabi-v7a/libc++_shared.so" + } } dependencies{ - implementation project(":newsmemory-android-sdk") - ... + implementation project(":newsmemory-android-sdk") + ... } ``` - - ## Add fragment to activity - ```java public class YourActivity extends AppCompatActivity { + private TaFragment taFragment; ... - + @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); - TaFragment fragment = new TaFragment() + if(taFragment == null) { + taFragment = new TaFragment() .setDelegate(new TaFragmentDelegate() { @Override public void recreate() { @@ -217,7 +196,7 @@ public class YourActivity extends AppCompatActivity { //TODO implement it and return true if you consume the event return false; } - + @Override public boolean handleTokenExpired(){ //TODO implement it and return true if you consume the event @@ -225,10 +204,13 @@ public class YourActivity extends AppCompatActivity { } }) .setBuildProps(getBuildProps()); - + } else { + taFragment = (TaFragment) getSupportFragmentManager().findFragmentByTag("TA_FRAGMENT"); + } + getSupportFragmentManager() .beginTransaction() - .add(R.id.rnFragment, fragment) + .replace(R.id.rnFragment, taFragment, "TA_FRAGMENT") .commit(); } @@ -238,7 +220,7 @@ public class YourActivity extends AppCompatActivity { bundle.putString(TaConstants.TA_MACHINE, "replace_with_server"); bundle.putString(TaConstants.TA_LOCALE, "en"); bundle.putString(TaConstants.TA_TOKEN, "replace with a valid token"); - //the value inside R.string will be available after first build + //the value inside R.string will be avilable after first build bundle.putString(TaConstants.TA_APP_VERSION_NAME, getString(com.tecnavia.sdk.R.string.APP_VERSION_NAME)); bundle.putString(TaConstants.TA_APP_VERSION_CODE, getString(com.tecnavia.sdk.R.string.APP_VERSION_CODE)); bundle.putString(TaConstants.TA_ANDROID_APP_ID,getString(com.tecnavia.sdk.R.string.ANDROID_APP_ID)); @@ -252,13 +234,11 @@ public class YourActivity extends AppCompatActivity { ``` the following constant is required by SDK to be authorized - ```java bundle.putString(TaConstants.TA_API_KEY, ""); ``` -the following constants are required by SDK otherwise there will be some inconsistencies and bugs - +the following constants are required by SDK otherwise there will be some inconsinstecies and bugs ```java bundle.putString(TaConstants.TA_APP_VERSION_NAME, getString(com.tecnavia.sdk.R.string.APP_VERSION_NAME)); bundle.putString(TaConstants.TA_APP_VERSION_CODE, getString(com.tecnavia.sdk.R.string.APP_VERSION_CODE)); @@ -267,12 +247,11 @@ the following constants are required by SDK otherwise there will be some inconsi bundle.putBoolean(TaConstants.TA_IS_ADDON, true); ``` -1. The activity that load TaFragment must implement the following interface _DefaultHardwareBackBtnHandler_ - +1. The activity that load TaFragment must implement the following interface *DefaultHardwareBackBtnHandler* ```java public class YourActivity extends AppCompatActivity implements DefaultHardwareBackBtnHandler { ... - + @Override public void invokeDefaultOnBackPressed() { //TODO handle finish @@ -280,13 +259,12 @@ public class YourActivity extends AppCompatActivity implements DefaultHardwareBa } ``` -2. you could extends activity class with TaActivity that already has an implementation of _DefaultHardwareBackBtnHandler_ but also add some other methods to force locale. - +2. you could extends activity class with TaActivity that already has an implementation of *DefaultHardwareBackBtnHandler* but also add some other methods to force locale. ```java public class YourActivity extends TaActivity { ... } -``` +``` ## Troubleshooting Guide @@ -328,6 +306,5 @@ protected void onCreate(Bundle savedInstanceState) { For more information, refer to this [GitHub issue comment](https://github.com/software-mansion/react-native-screens/issues/17#issuecomment-424704067). ## Authors - Nicolò Aquilini, iOS Software developer, Tecnavia Andrea Mauri, Android Software developer, Tecnavia diff --git a/build.gradle b/build.gradle index cad83fd..6348c88 100644 --- a/build.gradle +++ b/build.gradle @@ -55,7 +55,7 @@ publishing { tareactnativeasyncstorageasyncstorage(MavenPublication) { groupId 'tecnavia' artifactId 'react-native-async-storage_async-storage' - version '1.17.9' + version '1.23.1' artifact("$libsDirName/react-native-async-storage_async-storage-release.aar") } @@ -164,20 +164,6 @@ publishing { artifact("$libsDirName/react-native-html-to-pdf-release.aar") } - tareactnativeiapplay(MavenPublication) { - groupId 'tecnavia' - artifactId 'react-native-iap-play' - version '12.4.0' - artifact("$libsDirName/react-native-iap-play-release.aar") - } - - tareactnativeiapamazon(MavenPublication) { - groupId 'tecnavia' - artifactId 'react-native-iap-amazon' - version '12.4.0' - artifact("$libsDirName/react-native-iap-amazon-release.aar") - } - tareactnativeidletimer(MavenPublication) { groupId 'tecnavia' artifactId 'react-native-idle-timer' @@ -335,7 +321,7 @@ publishing { tatecnaviareactnativebridge(MavenPublication) { groupId 'tecnavia' artifactId 'tecnavia_react-native-bridge' - version '1.2.15' + version '1.2.20' artifact("$libsDirName/tecnavia_react-native-bridge-release.aar") } @@ -388,6 +374,13 @@ publishing { artifact("$libsDirName/tecnavia_react-native-web-analytics-release.aar") } + tatecnaviareactnativeworkaround(MavenPublication) { + groupId 'tecnavia' + artifactId 'tecnavia_react-native-workaround' + version '0.0.2' + artifact("$libsDirName/tecnavia_react-native-workaround-release.aar") + } + tatecnaviareactnativeziparchive(MavenPublication) { groupId 'tecnavia' artifactId 'tecnavia_react-native-zip-archive' @@ -500,7 +493,7 @@ def amazonSdkVersion = safeExtGet("amazonSdkVersion", "3.0.3") dependencies { implementation "tecnavia:react-native-android-open-settings:1.3.0" implementation "tecnavia:react-native-app-settings:2.0.1" - implementation "tecnavia:react-native-async-storage_async-storage:1.17.9" + implementation "tecnavia:react-native-async-storage_async-storage:1.23.1" implementation "tecnavia:react-native-color-matrix-image-filters:5.2.10" implementation "tecnavia:react-native-community_art:1.2.0" implementation "tecnavia:react-native-community_datetimepicker:6.7.5" @@ -516,8 +509,6 @@ dependencies { implementation "tecnavia:react-native-fs:2.20.0" implementation "tecnavia:react-native-gesture-handler:1.10.3" implementation "tecnavia:react-native-html-to-pdf:0.12.0" - playImplementation "tecnavia:react-native-iap-play:12.4.0" - amazonImplementation "tecnavia:react-native-iap-amazon:12.4.0" implementation "tecnavia:react-native-idle-timer:2.1.6" implementation "tecnavia:react-native-image-marker:0.9.2" implementation "tecnavia:react-native-linear-gradient:2.8.3" @@ -540,7 +531,7 @@ dependencies { implementation "tecnavia:react-native-volume-control:1.0.1" implementation "tecnavia:react-native-webview:11.17.2" implementation "tecnavia:rn-fetch-blob:0.11.2" - api "tecnavia:tecnavia_react-native-bridge:1.2.15" + api "tecnavia:tecnavia_react-native-bridge:1.2.20" implementation "tecnavia:tecnavia_react-native-default-preference:1.5.0" implementation "tecnavia:tecnavia_react-native-dfp:1.5.0" implementation "tecnavia:tecnavia_react-native-geolocation:3.0.1" @@ -548,6 +539,7 @@ dependencies { implementation "tecnavia:tecnavia_react-native-pdf:5.1.6" implementation "tecnavia:tecnavia_react-native-print:0.6.1" implementation "tecnavia:tecnavia_react-native-web-analytics:1.0.0" + implementation "tecnavia:tecnavia_react-native-workaround:0.0.2" implementation "tecnavia:tecnavia_react-native-zip-archive:5.2.0" api "tecnavia:react-native:0.67.5" implementation "tecnavia:hermes:1.0.0" @@ -603,8 +595,8 @@ dependencies { //used by @firebase/app - implementation "com.android.billingclient:billing-ktx:$playBillingVersion" - implementation "com.amazon.device:amazon-appstore-sdk:$amazonSdkVersion" + + //firebase diff --git a/gradle.properties b/gradle.properties index 75fca61..7455f21 100644 --- a/gradle.properties +++ b/gradle.properties @@ -1,7 +1,7 @@ android.useAndroidX=true APP_NAME=Android SDK -APP_VERSION_NAME=3.12.01 -APP_VERSION_CODE=1711618364614 +APP_VERSION_NAME=3.12.05 +APP_VERSION_CODE=1713363289503 ANDROID_APP_ID=com.tecnaviaapplication IS_ADDON=true diff --git a/libs/react-native-async-storage_async-storage-release.aar b/libs/react-native-async-storage_async-storage-release.aar index 8978998..bfb256f 100644 Binary files a/libs/react-native-async-storage_async-storage-release.aar and b/libs/react-native-async-storage_async-storage-release.aar differ diff --git a/libs/react-native-iap-amazon-release.aar b/libs/react-native-iap-amazon-release.aar deleted file mode 100644 index d2cac9e..0000000 Binary files a/libs/react-native-iap-amazon-release.aar and /dev/null differ diff --git a/libs/react-native-iap-play-release.aar b/libs/react-native-iap-play-release.aar deleted file mode 100644 index e4ee8ba..0000000 Binary files a/libs/react-native-iap-play-release.aar and /dev/null differ diff --git a/libs/react-native-screens-release.aar b/libs/react-native-screens-release.aar index 160c3a4..085157a 100644 Binary files a/libs/react-native-screens-release.aar and b/libs/react-native-screens-release.aar differ diff --git a/libs/tecnavia_react-native-bridge-release.aar b/libs/tecnavia_react-native-bridge-release.aar index 6da8dc2..7aadda8 100644 Binary files a/libs/tecnavia_react-native-bridge-release.aar and b/libs/tecnavia_react-native-bridge-release.aar differ diff --git a/libs/tecnavia_react-native-workaround-release.aar b/libs/tecnavia_react-native-workaround-release.aar new file mode 100644 index 0000000..028e1ad Binary files /dev/null and b/libs/tecnavia_react-native-workaround-release.aar differ diff --git a/src/main/assets/index.android.bundle b/src/main/assets/index.android.bundle index b2c6f2b..bf62f0d 100644 Binary files a/src/main/assets/index.android.bundle and b/src/main/assets/index.android.bundle differ diff --git a/src/main/assets/packages.txt b/src/main/assets/packages.txt index e59d0ac..491cb91 100644 --- a/src/main/assets/packages.txt +++ b/src/main/assets/packages.txt @@ -58,4 +58,5 @@ com.wenkesj.voice.VoicePackage com.reactnativecommunity.webview.RNCWebViewPackage com.RNFetchBlob.RNFetchBlobPackage com.blueconic.reactnative.BlueConicClientPackage -com.tecnavia.chartbeat.ChartBeatPackage \ No newline at end of file +com.tecnavia.chartbeat.ChartBeatPackage +com.tecnavia.workaround.WorkaroundPackage \ No newline at end of file