Toggle navigation
Toggle navigation
This project
Loading...
Sign in
open-source
/
warply_android_sdk_maven_plugin
Go to a project
Toggle navigation
Toggle navigation pinning
Projects
Groups
Snippets
Help
Project
Activity
Repository
Pipelines
Graphs
Issues
0
Merge Requests
0
Wiki
Snippets
Network
Create a new issue
Builds
Commits
Issue Boards
Authored by
Panagiotis Triantafyllou
2023-05-05 15:04:46 +0300
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
f7ef074b9fa1c43365fcc05fb1a5df7f55c0d435
f7ef074b
1 parent
cd5c0725
android 13 support
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
11 changed files
with
95 additions
and
71 deletions
app/build.gradle
app/src/main/assets/warply.properties
app/src/main/java/warp/ly/android_sdk/activities/SplashActivity.java
build.gradle
warply_android_sdk/build.gradle
warply_android_sdk/src/main/AndroidManifest.xml
warply_android_sdk/src/main/java/ly/warp/sdk/activities/WarpViewActivity.java
warply_android_sdk/src/main/java/ly/warp/sdk/io/volley/toolbox/HurlStack.java
warply_android_sdk/src/main/java/ly/warp/sdk/utils/PermissionsUtil.java
warply_android_sdk/src/main/java/ly/warp/sdk/utils/WarplyDeviceInfoCollector.java
warply_android_sdk/src/main/java/ly/warp/sdk/views/WarpView.java
app/build.gradle
View file @
f7ef074
apply
plugin:
'com.android.application'
android
{
compileSdkVersion
3
1
buildToolsVersion
"3
1.0.0
"
compileSdkVersion
3
3
buildToolsVersion
"3
3.0.2
"
defaultConfig
{
applicationId
"warp.ly.android_sdk"
minSdkVersion
23
targetSdkVersion
3
1
targetSdkVersion
3
3
versionCode
100
versionName
"1.0.0"
}
...
...
@@ -46,8 +46,8 @@ dependencies {
implementation
project
(
':warply_android_sdk'
)
//Support
implementation
'androidx.appcompat:appcompat:1.
4
.1'
implementation
'androidx.recyclerview:recyclerview:1.
2.1
'
implementation
'androidx.appcompat:appcompat:1.
6
.1'
implementation
'androidx.recyclerview:recyclerview:1.
3.0
'
implementation
'androidx.swiperefreshlayout:swiperefreshlayout:1.1.0'
implementation
'org.altbeacon:android-beacon-library:2.19.3'
...
...
app/src/main/assets/warply.properties
View file @
f7ef074
# {@link ly.warp.sdk.utils.WarplyProperty}
# The app uuid the warply sdk need to connect to the engage server
Uuid
=
Uuid
=
b13ade8ef743468b89a7aaa8efbfc468
# If we need to see logs in Logcat
Debug
=
false
...
...
app/src/main/java/warp/ly/android_sdk/activities/SplashActivity.java
View file @
f7ef074
...
...
@@ -79,7 +79,6 @@ public class SplashActivity extends BaseActivity {
runOnUiThread
(
new
Runnable
()
{
public
void
run
()
{
if
(!
isFinishing
())
{
Warply
.
registerGCM
(
SENDER_ID
);
startActivity
(
new
Intent
(
SplashActivity
.
this
,
MainActivity
.
class
));
finish
();
...
...
build.gradle
View file @
f7ef074
...
...
@@ -9,8 +9,8 @@ buildscript {
}
dependencies
{
classpath
'com.android.tools.build:gradle:7.0.4'
classpath
'com.google.gms:google-services:4.3.1
0
'
classpath
'com.huawei.agconnect:agcp:1.
6
.2.300'
classpath
'com.google.gms:google-services:4.3.1
5
'
classpath
'com.huawei.agconnect:agcp:1.
7
.2.300'
classpath
'io.github.gradle-nexus:publish-plugin:1.1.0'
// NOTE: Do not place your application dependencies here; they belong
...
...
warply_android_sdk/build.gradle
View file @
f7ef074
...
...
@@ -2,7 +2,7 @@ apply plugin: 'com.android.library'
ext
{
PUBLISH_GROUP_ID
=
'ly.warp'
PUBLISH_VERSION
=
'4.5.
4.6
'
PUBLISH_VERSION
=
'4.5.
5.0
'
PUBLISH_ARTIFACT_ID
=
'warply-android-sdk'
}
...
...
@@ -10,18 +10,30 @@ apply from: "${rootProject.projectDir}/scripts/publish-module.gradle"
android
{
compileSdkVersion
3
1
buildToolsVersion
"3
1.0.0
"
compileSdkVersion
3
3
buildToolsVersion
"3
3.0.2
"
defaultConfig
{
minSdkVersion
23
targetSdkVersion
3
1
targetSdkVersion
3
3
consumerProguardFiles
'proguard-rules.pro'
}
splits
{
abi
{
reset
()
enable
false
universalApk
false
// If true, also generate a universal APK
include
"armeabi-v7a"
,
"x86"
,
"arm64-v8a"
,
"x86_64"
}
}
lintOptions
{
abortOnError
false
}
sourceSets
{
main
{
jniLibs
.
srcDirs
=
[
'src/main/jniLibs'
]
}
}
buildTypes
{
release
{
minifyEnabled
false
...
...
@@ -34,38 +46,38 @@ android {
dependencies
{
//------------------------------ Support -----------------------------//
api
'androidx.appcompat:appcompat:1.
4
.1'
api
'androidx.recyclerview:recyclerview:1.
2.1
'
api
'androidx.appcompat:appcompat:1.
6
.1'
api
'androidx.recyclerview:recyclerview:1.
3.0
'
api
'androidx.cardview:cardview:1.0.0'
api
"androidx.security:security-crypto:1.1.0-alpha03"
// For minSDK 23 use 1.0.0, for minSDK 21 use 1.1.0 that is currently in alpha
api
'androidx.security:security-crypto:1.1.0-alpha06'
// For minSDK 23 use 1.0.0, for minSDK 21 use 1.1.0 that is currently in alpha
api
'org.altbeacon:android-beacon-library:2.19.3'
api
'org.jbundle.util.osgi.wrapped:org.jbundle.util.osgi.wrapped.org.apache.http.client:4.1.2'
api
"commons-logging:commons-logging:1.2"
//------------------------------ Firebase -----------------------------//
api
platform
(
'com.google.firebase:firebase-bom:
29.0.3
'
)
api
platform
(
'com.google.firebase:firebase-bom:
32.0.0
'
)
api
'com.google.firebase:firebase-messaging'
//------------------------------ GMS -----------------------------//
api
'com.google.android.gms:play-services-base:18.
0.1
'
api
'com.google.android.gms:play-services-location:
19
.0.1'
api
'com.google.android.gms:play-services-base:18.
2.0
'
api
'com.google.android.gms:play-services-location:
21
.0.1'
//------------------------------ Work Manager -----------------------------//
api
'androidx.work:work-runtime:2.
7
.1'
api
'androidx.work:work-runtime:2.
8
.1'
//------------------------------ Glide -----------------------------//
api
'com.github.bumptech.glide:glide:4.12.0'
annotationProcessor
'com.github.bumptech.glide:compiler:4.12.0'
//------------------------------ Huawei -----------------------------//
api
'com.huawei.agconnect:agconnect-core:1.
7.2
.300'
api
'com.huawei.hms:base:6.
6
.0.300'
api
'com.huawei.hms:push:6.
7
.0.300'
api
'com.huawei.hms:ads-identifier:3.4.
56
.300'
api
'com.huawei.agconnect:agconnect-core:1.
9.0
.300'
api
'com.huawei.hms:base:6.
9
.0.300'
api
'com.huawei.hms:push:6.
10
.0.300'
api
'com.huawei.hms:ads-identifier:3.4.
62
.300'
//------------------------------ SQLCipher -----------------------------//
api
"net.zetetic:android-database-sqlcipher:4.5.0"
api
"androidx.sqlite:sqlite:2.2.0"
api
'net.zetetic:android-database-sqlcipher:4.5.2'
api
'androidx.sqlite:sqlite:2.3.1'
}
// In every export please update the version number
...
...
warply_android_sdk/src/main/AndroidManifest.xml
View file @
f7ef074
...
...
@@ -11,6 +11,7 @@
<uses-permission
android:name=
"android.permission.REQUEST_INSTALL_PACKAGES"
tools:node=
"remove"
/>
<uses-permission
android:name=
"android.permission.POST_NOTIFICATIONS"
/>
<application>
<!-- For Huawei Push -->
...
...
warply_android_sdk/src/main/java/ly/warp/sdk/activities/WarpViewActivity.java
View file @
f7ef074
...
...
@@ -158,7 +158,7 @@ public class WarpViewActivity extends WarpBaseActivity {
}
}
});
root
.
addView
(
progressBar
,
progressBarParams
);
//
root.addView(progressBar, progressBarParams);
setContentView
(
root
);
}
...
...
warply_android_sdk/src/main/java/ly/warp/sdk/io/volley/toolbox/HurlStack.java
View file @
f7ef074
...
...
@@ -103,6 +103,7 @@ public class HurlStack implements HttpStack {
}
URL
parsedUrl
=
new
URL
(
url
);
HttpURLConnection
connection
=
openConnection
(
parsedUrl
,
request
);
connection
.
setInstanceFollowRedirects
(
false
);
for
(
String
headerName
:
map
.
keySet
())
{
connection
.
addRequestProperty
(
headerName
,
map
.
get
(
headerName
));
}
...
...
warply_android_sdk/src/main/java/ly/warp/sdk/utils/PermissionsUtil.java
View file @
f7ef074
...
...
@@ -5,6 +5,7 @@ import android.content.Context;
import
android.content.pm.PackageManager
;
import
android.os.Handler
;
import
android.os.HandlerThread
;
import
androidx.annotation.NonNull
;
import
androidx.annotation.Nullable
;
import
androidx.core.content.ContextCompat
;
...
...
@@ -26,15 +27,16 @@ import ly.warp.sdk.dexter.listener.multi.MultiplePermissionsListener;
/**
* Created by Antonis Moustakos on 3/28/2017.
*/
public
class
PermissionsUtil
{
public
class
PermissionsUtil
{
// ===========================================================
// Constants
// ===========================================================
private
static
final
int
SLEEP_TIME
=
5000
;
public
static
final
String
PERMISSION_LOCATION_FINE
=
android
.
Manifest
.
permission
.
ACCESS_FINE_LOCATION
,
PERMISSION_LOCATION_COARSE
=
android
.
Manifest
.
permission
.
ACCESS_COARSE_LOCATION
,
PERMISSION_PHONE_STATE
=
Manifest
.
permission
.
READ_PHONE_STATE
,
SAFE_PERMISSION_BLUETOOTH
=
Manifest
.
permission
.
BLUETOOTH
;
PERMISSION_LOCATION_COARSE
=
android
.
Manifest
.
permission
.
ACCESS_COARSE_LOCATION
,
PERMISSION_PHONE_STATE
=
Manifest
.
permission
.
READ_PHONE_STATE
,
PERMISSION_POST_NOTIFICATIONS
=
Manifest
.
permission
.
POST_NOTIFICATIONS
,
SAFE_PERMISSION_BLUETOOTH
=
Manifest
.
permission
.
BLUETOOTH
;
// PERMISSION_WRITE_EXTERNAL = Manifest.permission.WRITE_EXTERNAL_STORAGE;
private
static
final
String
[]
DANGEROUS_PERMISSIONS
=
{
...
...
@@ -42,6 +44,7 @@ public class PermissionsUtil{
// PERMISSION_LOCATION_COARSE,
// PERMISSION_PHONE_STATE,
// PERMISSION_WRITE_EXTERNAL
PERMISSION_POST_NOTIFICATIONS
};
// ===========================================================
...
...
@@ -64,7 +67,7 @@ public class PermissionsUtil{
this
.
context
=
new
WeakReference
<>(
context
);
this
.
callback
=
callback
;
this
.
requestedPerms
=
requestedPerms
;
if
(
this
.
requestedPerms
==
null
)
if
(
this
.
requestedPerms
==
null
)
this
.
requestedPerms
=
DANGEROUS_PERMISSIONS
;
HandlerThread
mHandlerThread
=
new
HandlerThread
(
"PermissionsUtil"
);
...
...
@@ -75,60 +78,68 @@ public class PermissionsUtil{
// ===========================================================
// Methods
// ===========================================================
public
boolean
requestNeeded
(){
for
(
String
p
:
requestedPerms
)
if
(!
hasPermission
(
context
.
get
(),
p
))
public
boolean
requestNeeded
()
{
for
(
String
p
:
requestedPerms
)
if
(!
hasPermission
(
context
.
get
(),
p
))
return
true
;
return
false
;
}
public
static
boolean
hasPermission
(
Context
con
,
String
permission
){
public
static
boolean
hasPermission
(
Context
con
,
String
permission
)
{
return
ContextCompat
.
checkSelfPermission
(
con
,
permission
)
==
PackageManager
.
PERMISSION_GRANTED
;
}
public
void
requestPermissions
(){
public
void
requestPermissions
()
{
final
DexterBuilder
builder
=
Dexter
.
withContext
(
context
.
get
())
.
withPermissions
(
requestedPerms
)
.
withListener
(
new
MultiplePermissionsListener
()
{
@Override
public
void
onPermissionsChecked
(
MultiplePermissionsReport
report
)
{
if
(
callback
!=
null
)
if
(
report
.
areAllPermissionsGranted
())
callback
.
onPermissionsGranted
();
else
callback
.
onPermissionDenied
(
report
.
getDeniedPermissionResponses
());
}
@Override
public
void
onPermissionRationaleShouldBeShown
(
List
<
PermissionRequest
>
permissions
,
PermissionToken
token
)
{
//TODO: Rationale can be shown here
token
.
continuePermissionRequest
();
}
})
.
withErrorListener
(
new
PermissionRequestErrorListener
()
{
@Override
public
void
onError
(
DexterError
error
)
{
if
(
callback
!=
null
)
callback
.
onError
(
error
);
}
})
.
onSameThread
();
Dexter
.
withContext
(
context
.
get
())
.
withPermissions
(
requestedPerms
)
.
withListener
(
new
MultiplePermissionsListener
()
{
@Override
public
void
onPermissionsChecked
(
MultiplePermissionsReport
report
)
{
if
(
callback
!=
null
)
if
(
report
.
areAllPermissionsGranted
())
callback
.
onPermissionsGranted
();
else
callback
.
onPermissionDenied
(
report
.
getDeniedPermissionResponses
());
}
@Override
public
void
onPermissionRationaleShouldBeShown
(
List
<
PermissionRequest
>
permissions
,
PermissionToken
token
)
{
//TODO: Rationale can be shown here
token
.
continuePermissionRequest
();
}
})
.
withErrorListener
(
new
PermissionRequestErrorListener
()
{
@Override
public
void
onError
(
DexterError
error
)
{
if
(
callback
!=
null
)
callback
.
onError
(
error
);
}
})
.
onSameThread
();
handler
.
post
(
new
Runnable
()
{
public
void
run
()
{
while
(!
prefs
.
isForeground
())
try
{
Thread
.
sleep
(
SLEEP_TIME
);}
catch
(
InterruptedException
ignored
)
{}
builder
.
check
();
new
Runnable
()
{
public
void
run
()
{
while
(!
prefs
.
isForeground
())
try
{
Thread
.
sleep
(
SLEEP_TIME
);
}
catch
(
InterruptedException
ignored
)
{
}
builder
.
check
();
}
}
}
);
}
// ===========================================================
// Inner and Anonymous Classes
// ===========================================================
public
interface
PermissionCallback
{
public
interface
PermissionCallback
{
void
onPermissionDenied
(
List
<
PermissionDeniedResponse
>
denied
);
void
onPermissionsGranted
();
void
onError
(
DexterError
error
);
}
...
...
warply_android_sdk/src/main/java/ly/warp/sdk/utils/WarplyDeviceInfoCollector.java
View file @
f7ef074
This diff is collapsed. Click to expand it.
warply_android_sdk/src/main/java/ly/warp/sdk/views/WarpView.java
View file @
f7ef074
...
...
@@ -117,7 +117,7 @@ public class WarpView extends WebView {
setFadingEdgeLength
(
0
);
WebSettings
settings
=
getSettings
();
settings
.
set
AppCacheEnabled
(
true
);
settings
.
set
CacheMode
(
WebSettings
.
LOAD_DEFAULT
);
settings
.
setJavaScriptEnabled
(
true
);
settings
.
setDatabaseEnabled
(
true
);
settings
.
setDomStorageEnabled
(
true
);
...
...
Please
register
or
login
to post a comment