Skip to content

Commit

Permalink
Merge pull request #89 from PAXSTORE/feature/v9.5.0
Browse files Browse the repository at this point in the history
Feature/v9.5.0
  • Loading branch information
Apollolight authored Nov 15, 2024
2 parents fb26df2 + 2e9af7b commit 7e49b60
Show file tree
Hide file tree
Showing 9 changed files with 39 additions and 41 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ Gradle:
Add the dependency

```
implementation 'com.whatspos.sdk:paxstore-3rd-app-android-sdk:9.4.1'
implementation 'com.whatspos.sdk:paxstore-3rd-app-android-sdk:9.5.0'
```

##### Tips: In the near future, our platform will only support applications integrated with sdk version v8.7.0 or higher. Please upgrade the sdk to the latest version as soon as possible
Expand Down
8 changes: 3 additions & 5 deletions demo/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ android {
applicationId "com.pax.android.demoapp"
minSdkVersion 19
targetSdkVersion 31
versionCode 1041
versionName "9.4.1"
versionCode 1050
versionName "9.5.0"
testInstrumentationRunner 'androidx.test.runner.AndroidJUnitRunner'
}
buildTypes {
Expand Down Expand Up @@ -43,15 +43,13 @@ configurations.all {

dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'net.grandcentrix.tray:tray:0.12.0'
implementation 'androidx.appcompat:appcompat:1.0.0'
implementation 'com.google.code.gson:gson:2.9.0'
implementation 'org.slf4j:slf4j-android:1.7.25'

implementation 'com.whatspos.sdk:paxstore-3rd-app-android-sdk:9.4.1'
implementation 'com.whatspos.sdk:paxstore-3rd-app-android-sdk:9.5.0'

//to download below imports, please add this to root build.gradle repositories >> maven { url 'https://jitpack.io' }
implementation 'com.github.PhilJay:MPAndroidChart:v3.1.0'
implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
implementation 'androidx.legacy:legacy-support-v4:1.0.0'
implementation 'commons-io:commons-io:2.7'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
import com.pax.market.android.app.sdk.StoreSdk;
import com.pax.market.android.app.sdk.msg.utils.Notifications;

import net.grandcentrix.tray.AppPreferences;

/**
* Created by fojut on 2017/8/24.
Expand All @@ -29,16 +28,13 @@ public class BaseApplication extends Application {


//todo please make sure get the correct SN here, for pax device you can integrate NeptuneLite SDK to get the correct SN
public static AppPreferences appPreferences;


@Override
public void onCreate() {
super.onCreate();
//initial the SDK
initStoreSdk();
appPreferences = new AppPreferences(getApplicationContext()); // this Preference comes for free from the library

}

private void initStoreSdk() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -87,8 +87,8 @@ protected void onHandleIntent(@Nullable Intent intent) {
//todo check the Error Code and Error Message for fail reason
Log.e(TAG, "ErrorCode: " + downloadResult.getBusinessCode() + "ErrorMessage: " + downloadResult.getMessage());
//update download fail info in main page for Demo
spUtil.setString(DemoConstants.PUSH_RESULT_BANNER_TITLE, DemoConstants.DOWNLOAD_FAILED);
spUtil.setString(DemoConstants.PUSH_RESULT_BANNER_TEXT, "Your push parameters file task failed at " + sdf.format(new Date()) + ", please check error log.");
spUtil.setString(getApplicationContext(), DemoConstants.PUSH_RESULT_BANNER_TITLE, DemoConstants.DOWNLOAD_FAILED);
spUtil.setString(getApplicationContext(), DemoConstants.PUSH_RESULT_BANNER_TEXT, "Your push parameters file task failed at " + sdf.format(new Date()) + ", please check error log.");
updateUI(DemoConstants.DOWNLOAD_STATUS_FAILED);
}
}
Expand All @@ -101,7 +101,7 @@ public int onStartCommand(Intent intent, int flags, int startId) {
}

private void readDataToDisplay() {
spUtil.setString(DemoConstants.PUSH_RESULT_BANNER_TITLE, DemoConstants.DOWNLOAD_SUCCESS);
spUtil.setString(getApplicationContext(), DemoConstants.PUSH_RESULT_BANNER_TITLE, DemoConstants.DOWNLOAD_SUCCESS);

// get specific display data resource <File>sys_cap.p</File>
File parameterFile = getDisplayFile();
Expand All @@ -125,15 +125,15 @@ private void saveDisplayFileDataToSp(File parameterFile) {
String bannerSubTextValue = "Files are stored in " + parameterFile.getPath();
Log.i(TAG, "run=====: " + bannerTextValue);
//save result for demo display
spUtil.setString(DemoConstants.PUSH_RESULT_BANNER_TEXT, bannerTextValue);
spUtil.setString(DemoConstants.PUSH_RESULT_BANNER_SUBTEXT, bannerSubTextValue);
spUtil.setString(getApplicationContext(), DemoConstants.PUSH_RESULT_BANNER_TEXT, bannerTextValue);
spUtil.setString(getApplicationContext(), DemoConstants.PUSH_RESULT_BANNER_SUBTEXT, bannerSubTextValue);
List<Map<String, Object>> datalist = getParameters(parameterFile);

//save result for demo display
spUtil.setDataList(DemoConstants.PUSH_RESULT_DETAIL, datalist);
spUtil.setDataList(getApplicationContext(), DemoConstants.PUSH_RESULT_DETAIL, datalist);
} else {
Log.i(TAG, "parameterFile is null ");
spUtil.setString(DemoConstants.PUSH_RESULT_BANNER_TEXT, "Download file not found. This demo only accept parameter file with name 'sys_cap.p'");
spUtil.setString(getApplicationContext(), DemoConstants.PUSH_RESULT_BANNER_TEXT, "Download file not found. This demo only accept parameter file with name 'sys_cap.p'");
}
}

Expand Down
24 changes: 12 additions & 12 deletions demo/src/main/java/com/pax/android/demoapp/PushFragment.java
Original file line number Diff line number Diff line change
Expand Up @@ -93,13 +93,13 @@ public View onCreateView(LayoutInflater inflater, ViewGroup container,
nodataLayout = view.findViewById(R.id.nodata);


String pushResultBannerTitle = spUtil.getString(DemoConstants.PUSH_RESULT_BANNER_TITLE);
String pushResultBannerTitle = spUtil.getString(getContext(), DemoConstants.PUSH_RESULT_BANNER_TITLE);
if(DemoConstants.DOWNLOAD_SUCCESS.equals(pushResultBannerTitle)){
bannerTitleTV.setText(spUtil.getString(DemoConstants.PUSH_RESULT_BANNER_TITLE));
bannerTextTV.setText(spUtil.getString(DemoConstants.PUSH_RESULT_BANNER_TEXT));
bannerSubTextTV.setText(spUtil.getString(DemoConstants.PUSH_RESULT_BANNER_SUBTEXT));
bannerTitleTV.setText(spUtil.getString(getContext(), DemoConstants.PUSH_RESULT_BANNER_TITLE));
bannerTextTV.setText(spUtil.getString(getContext(), DemoConstants.PUSH_RESULT_BANNER_TEXT));
bannerSubTextTV.setText(spUtil.getString(getContext(), DemoConstants.PUSH_RESULT_BANNER_SUBTEXT));

datalist = spUtil.getDataList(DemoConstants.PUSH_RESULT_DETAIL);
datalist = spUtil.getDataList(getContext(), DemoConstants.PUSH_RESULT_DETAIL);
//if have push history, display it. the demo will only store the latest push record.
if(datalist!=null && datalist.size() >0) {
//display push history detail
Expand All @@ -116,8 +116,8 @@ public View onCreateView(LayoutInflater inflater, ViewGroup container,
}
}else {
if(DemoConstants.DOWNLOAD_FAILED.equals(pushResultBannerTitle)) {
bannerTitleTV.setText(spUtil.getString(DemoConstants.PUSH_RESULT_BANNER_TITLE));
bannerTextTV.setText(spUtil.getString(DemoConstants.PUSH_RESULT_BANNER_TEXT));
bannerTitleTV.setText(spUtil.getString(getContext(), DemoConstants.PUSH_RESULT_BANNER_TITLE));
bannerTextTV.setText(spUtil.getString(getContext(), DemoConstants.PUSH_RESULT_BANNER_TEXT));
}
//display as no data
detailListView.setVisibility(View.GONE);
Expand Down Expand Up @@ -158,10 +158,10 @@ public void onRecive(Context context, Intent intent) {
int resultCode = intent.getIntExtra(DemoConstants.DOWNLOAD_RESULT_CODE, 0);
switch (resultCode) {
case DemoConstants.DOWNLOAD_STATUS_SUCCESS:
bannerTitleTV.setText(spUtil.getString(DemoConstants.PUSH_RESULT_BANNER_TITLE));
bannerTextTV.setText(spUtil.getString(DemoConstants.PUSH_RESULT_BANNER_TEXT));
bannerSubTextTV.setText(spUtil.getString(DemoConstants.PUSH_RESULT_BANNER_SUBTEXT));
datalist = spUtil.getDataList(DemoConstants.PUSH_RESULT_DETAIL);
bannerTitleTV.setText(spUtil.getString(getContext(), DemoConstants.PUSH_RESULT_BANNER_TITLE));
bannerTextTV.setText(spUtil.getString(getContext(), DemoConstants.PUSH_RESULT_BANNER_TEXT));
bannerSubTextTV.setText(spUtil.getString(getContext(), DemoConstants.PUSH_RESULT_BANNER_SUBTEXT));
datalist = spUtil.getDataList(getContext(), DemoConstants.PUSH_RESULT_DETAIL);
if (datalist != null && datalist.size() > 0) {
//display push history detail
detailListView.setVisibility(View.VISIBLE);
Expand All @@ -180,7 +180,7 @@ public void onRecive(Context context, Intent intent) {
break;
case DemoConstants.DOWNLOAD_STATUS_FAILED:
bannerTitleTV.setText(DemoConstants.DOWNLOAD_FAILED);
bannerTextTV.setText(spUtil.getString(DemoConstants.PUSH_RESULT_BANNER_TEXT));
bannerTextTV.setText(spUtil.getString(getContext(), DemoConstants.PUSH_RESULT_BANNER_TEXT));
//display as no data
detailListView.setVisibility(View.GONE);
nodataLayout.setVisibility(View.VISIBLE);
Expand Down
19 changes: 11 additions & 8 deletions demo/src/main/java/com/pax/android/demoapp/SPUtil.java
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
package com.pax.android.demoapp;

import android.content.Context;

import com.google.gson.Gson;
import com.google.gson.reflect.TypeToken;
import com.pax.market.android.app.sdk.util.PreferencesUtils;

import java.util.ArrayList;
import java.util.List;
Expand All @@ -10,12 +13,12 @@
public class SPUtil {


public void setString(String tag, String value) {
BaseApplication.appPreferences.put(tag, value);
public void setString(Context context, String tag, String value) {
PreferencesUtils.putString(context, tag, value);
}

public String getString(String tag) {
String value = BaseApplication.appPreferences.getString(tag,null);
public String getString(Context context, String tag) {
String value = PreferencesUtils.getString(context, tag,null);
return value;

}
Expand All @@ -25,13 +28,13 @@ public String getString(String tag) {
* @param tag
* @param datalist
*/
public <T> void setDataList(String tag, List<T> datalist) {
public <T> void setDataList(Context context, String tag, List<T> datalist) {
if (null == datalist || datalist.size() <= 0)
return;
Gson gson = new Gson();
//转换成json数据,再保存
String strJson = gson.toJson(datalist);
BaseApplication.appPreferences.put(tag, strJson);
PreferencesUtils.putString(context, tag, strJson);

}

Expand All @@ -40,9 +43,9 @@ public <T> void setDataList(String tag, List<T> datalist) {
* @param tag
* @return
*/
public <T> List<T> getDataList(String tag) {
public <T> List<T> getDataList(Context context, String tag) {
List<T> datalist=new ArrayList<T>();
String strJson = BaseApplication.appPreferences.getString(tag, null);
String strJson = PreferencesUtils.getString(context, tag, null);
if (null == strJson) {
return datalist;
}
Expand Down
3 changes: 2 additions & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -18,4 +18,5 @@ org.gradle.jvmargs=-Xmx1024m
# http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
# org.gradle.parallel=true

version=9.4.1
version=9.5.0

2 changes: 1 addition & 1 deletion sdk/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ dependencies {


api 'com.whatspos.sdk:paxstore-3rd-app-java-sdk:9.4.1'
api 'com.whatspos.sdk:paxstore-3rd-app-android-cloud-msg-sdk:9.2.0'
api 'com.whatspos.sdk:paxstore-3rd-app-android-cloud-msg-sdk:9.5.0'



Expand Down
4 changes: 2 additions & 2 deletions sdk/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
package="com.pax.market.android.app.sdk">

<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.FOREGROUND_SERVICE"/>

<!-- FOR MARKET CLIENT -->
<uses-permission android:name="com.market.android.app.OPEN_DETAIL_PAGE" />
Expand All @@ -18,8 +19,7 @@
<package android:name="com.pax.market.android.app" />
</queries>

<application android:allowBackup="true"
android:label="@string/app_name">
<application android:label="@string/app_name">

<service android:name=".RPCService"
android:permission="com.market.android.app.sdk.INSTALL_INQUIRER"
Expand Down

0 comments on commit 7e49b60

Please sign in to comment.