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
2022-11-15 18:27:07 +0200
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
54bf8176d6658190ad77bb7c088b90b81abc9026
54bf8176
1 parent
3f057f88
new keys
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
106 additions
and
74 deletions
app/src/main/assets/warply.properties
app/src/main/java/warp/ly/android_sdk/activities/SplashActivity.java
warply_android_sdk/build.gradle
warply_android_sdk/src/main/java/ly/warp/sdk/activities/CouponsetInfoActivity.java
warply_android_sdk/src/main/java/ly/warp/sdk/db/WarplyDBHelper.java
warply_android_sdk/src/main/res/layout/activity_couponset_info.xml
app/src/main/assets/warply.properties
View file @
54bf817
...
...
@@ -3,7 +3,7 @@
# The app uuid the warply sdk need to connect to the engage server
# dev f83dfde1145e4c2da69793abb2f579af
# prod 0086a2088301440792091b9f814c2267
Uuid
=
f83dfde1145e4c2da69793abb2f579af
Uuid
=
0086a2088301440792091b9f814c2267
# If we need to see logs in Logcat
Debug
=
true
...
...
@@ -11,7 +11,7 @@ Debug=true
# Production or Development environment of the engage server
# Production: https://engage.warp.ly
# Development: https://engage-stage.warp.ly
BaseURL
=
https://engage
-stage
.warp.ly
BaseURL
=
https://engage.warp.ly
# For Verify Ticket request
VerifyURL
=
/partners/cosmote/verify
...
...
app/src/main/java/warp/ly/android_sdk/activities/SplashActivity.java
View file @
54bf817
...
...
@@ -36,7 +36,7 @@ public class SplashActivity extends BaseActivity {
public
void
onWarplyReady
()
{
if
(!
WarplyDBHelper
.
getInstance
(
SplashActivity
.
this
).
isTableNotEmpty
(
"auth"
))
{
WarplyManager
.
getCosmoteUser
(
new
WarplyCosmoteUserRequest
()
.
setGuid
(
"
7000000831
"
),
//6012049321, 6012049322, 6012049323, 7000000831 history, 7000000826, 7000000831 shared coupons, prod 6006552990, live 3000184910
.
setGuid
(
"
6010139202
"
),
//6012049321, 6012049322, 6012049323, 7000000831 history, 7000000826, 7000000831 shared coupons, prod 6006552990, live 3000184910
mLoginReceiver
);
}
else
{
startNextActivity
();
...
...
warply_android_sdk/build.gradle
View file @
54bf817
...
...
@@ -2,7 +2,7 @@ apply plugin: 'com.android.library'
ext
{
PUBLISH_GROUP_ID
=
'ly.warp'
PUBLISH_VERSION
=
'4.5.4.6rc1
1
'
PUBLISH_VERSION
=
'4.5.4.6rc1
2
'
PUBLISH_ARTIFACT_ID
=
'warply-android-sdk'
}
...
...
warply_android_sdk/src/main/java/ly/warp/sdk/activities/CouponsetInfoActivity.java
View file @
54bf817
...
...
@@ -250,6 +250,7 @@ public class CouponsetInfoActivity extends Activity implements View.OnClickListe
onBackPressed
();
}
})
.
setCancelable
(
false
)
.
show
();
}
}
else
{
...
...
warply_android_sdk/src/main/java/ly/warp/sdk/db/WarplyDBHelper.java
View file @
54bf817
...
...
@@ -35,7 +35,7 @@ public class WarplyDBHelper extends SQLiteOpenHelper {
}
private
static
final
String
DB_NAME
=
"warply.db"
;
private
static
final
int
DB_VERSION
=
5
;
private
static
final
int
DB_VERSION
=
6
;
private
static
final
String
KEY_CIPHER
=
"tn#mpOl3v3Dy1pr@W"
;
//------------------------------ Fields -----------------------------//
...
...
@@ -222,10 +222,15 @@ public class WarplyDBHelper extends SQLiteOpenHelper {
values
.
put
(
KEY_CLIENT_ID
,
clientId
);
if
(!
TextUtils
.
isEmpty
(
clientSecret
))
values
.
put
(
KEY_CLIENT_SECRET
,
clientSecret
);
if
(
isTableNotEmpty
(
TABLE_CLIENT
))
update
(
TABLE_CLIENT
,
values
);
else
insert
(
TABLE_CLIENT
,
values
);
if
(
isTableNotEmpty
(
TABLE_CLIENT
))
{
new
Thread
(()
->
{
update
(
TABLE_CLIENT
,
values
);
}).
start
();
}
else
{
new
Thread
(()
->
{
insert
(
TABLE_CLIENT
,
values
);
}).
start
();
}
}
public
synchronized
void
saveAuthAccess
(
String
accessToken
,
String
refreshToken
)
{
...
...
@@ -234,10 +239,15 @@ public class WarplyDBHelper extends SQLiteOpenHelper {
values
.
put
(
KEY_ACCESS_TOKEN
,
accessToken
);
if
(!
TextUtils
.
isEmpty
(
refreshToken
))
values
.
put
(
KEY_REFRESH_TOKEN
,
refreshToken
);
if
(
isTableNotEmpty
(
TABLE_AUTH
))
update
(
TABLE_AUTH
,
values
);
else
insert
(
TABLE_AUTH
,
values
);
if
(
isTableNotEmpty
(
TABLE_AUTH
))
{
new
Thread
(()
->
{
update
(
TABLE_AUTH
,
values
);
}).
start
();
}
else
{
new
Thread
(()
->
{
insert
(
TABLE_AUTH
,
values
);
}).
start
();
}
}
@Nullable
...
...
@@ -265,11 +275,15 @@ public class WarplyDBHelper extends SQLiteOpenHelper {
}
public
synchronized
void
deleteClient
()
{
clearTable
(
TABLE_CLIENT
);
new
Thread
(()
->
{
clearTable
(
TABLE_CLIENT
);
}).
start
();
}
public
synchronized
void
deleteAuth
()
{
clearTable
(
TABLE_AUTH
);
new
Thread
(()
->
{
clearTable
(
TABLE_AUTH
);
}).
start
();
}
//------------------------------ Api requests -----------------------------//
...
...
@@ -298,47 +312,56 @@ public class WarplyDBHelper extends SQLiteOpenHelper {
}
public
synchronized
void
deleteAllRequests
()
{
clearTable
(
TABLE_REQUESTS
);
new
Thread
(()
->
{
clearTable
(
TABLE_REQUESTS
);
}).
start
();
}
public
synchronized
void
deleteAllPushRequests
()
{
clearTable
(
TABLE_PUSH_REQUESTS
);
new
Thread
(()
->
{
clearTable
(
TABLE_PUSH_REQUESTS
);
}).
start
();
}
public
synchronized
void
deleteAllPushAckRequests
()
{
clearTable
(
TABLE_PUSH_ACK_REQUESTS
);
new
Thread
(()
->
{
clearTable
(
TABLE_PUSH_ACK_REQUESTS
);
}).
start
();
}
public
synchronized
long
addRequest
(
String
microapp
,
String
entity
,
boolean
force
)
{
ContentValues
values
=
new
ContentValues
();
values
.
put
(
KEY_REQUESTS_MICROAPP
,
microapp
);
values
.
put
(
KEY_REQUESTS_ENTITY
,
entity
);
values
.
put
(
KEY_REQUESTS_FORCE
,
force
?
1
:
0
);
values
.
put
(
KEY_REQUESTS_DATE_ADDED
,
System
.
currentTimeMillis
());
insert
(
TABLE_REQUESTS
,
values
);
new
Thread
(()
->
{
ContentValues
values
=
new
ContentValues
();
values
.
put
(
KEY_REQUESTS_MICROAPP
,
microapp
);
values
.
put
(
KEY_REQUESTS_ENTITY
,
entity
);
values
.
put
(
KEY_REQUESTS_FORCE
,
force
?
1
:
0
);
values
.
put
(
KEY_REQUESTS_DATE_ADDED
,
System
.
currentTimeMillis
());
insert
(
TABLE_REQUESTS
,
values
);
}).
start
();
return
getRequestsInQueueCount
();
}
public
synchronized
long
addPushRequest
(
String
microapp
,
String
entity
,
boolean
force
)
{
ContentValues
values
=
new
ContentValues
();
values
.
put
(
KEY_REQUESTS_MICROAPP
,
microapp
);
values
.
put
(
KEY_REQUESTS_ENTITY
,
entity
);
values
.
put
(
KEY_REQUESTS_FORCE
,
force
?
1
:
0
);
values
.
put
(
KEY_REQUESTS_DATE_ADDED
,
System
.
currentTimeMillis
());
insert
(
TABLE_PUSH_REQUESTS
,
values
);
new
Thread
(()
->
{
ContentValues
values
=
new
ContentValues
();
values
.
put
(
KEY_REQUESTS_MICROAPP
,
microapp
);
values
.
put
(
KEY_REQUESTS_ENTITY
,
entity
);
values
.
put
(
KEY_REQUESTS_FORCE
,
force
?
1
:
0
);
values
.
put
(
KEY_REQUESTS_DATE_ADDED
,
System
.
currentTimeMillis
());
insert
(
TABLE_PUSH_REQUESTS
,
values
);
}).
start
();
return
getPushRequestsInQueueCount
();
}
public
synchronized
long
addPushAckRequest
(
String
microapp
,
String
entity
,
boolean
force
)
{
ContentValues
values
=
new
ContentValues
();
values
.
put
(
KEY_REQUESTS_MICROAPP
,
microapp
);
values
.
put
(
KEY_REQUESTS_ENTITY
,
entity
);
values
.
put
(
KEY_REQUESTS_FORCE
,
force
?
1
:
0
);
values
.
put
(
KEY_REQUESTS_DATE_ADDED
,
System
.
currentTimeMillis
());
insert
(
TABLE_PUSH_ACK_REQUESTS
,
values
);
new
Thread
(()
->
{
ContentValues
values
=
new
ContentValues
();
values
.
put
(
KEY_REQUESTS_MICROAPP
,
microapp
);
values
.
put
(
KEY_REQUESTS_ENTITY
,
entity
);
values
.
put
(
KEY_REQUESTS_FORCE
,
force
?
1
:
0
);
values
.
put
(
KEY_REQUESTS_DATE_ADDED
,
System
.
currentTimeMillis
());
insert
(
TABLE_PUSH_ACK_REQUESTS
,
values
);
}).
start
();
return
getPushAckRequestsInQueueCount
();
}
...
...
@@ -365,7 +388,9 @@ public class WarplyDBHelper extends SQLiteOpenHelper {
strFilter
.
append
(
"="
);
strFilter
.
append
(
ids
[
i
]);
}
getDb
().
delete
(
TABLE_REQUESTS
,
strFilter
.
toString
(),
null
);
new
Thread
(()
->
{
getDb
().
delete
(
TABLE_REQUESTS
,
strFilter
.
toString
(),
null
);
}).
start
();
}
public
synchronized
void
deletePushRequests
(
Long
...
ids
)
{
...
...
@@ -379,7 +404,9 @@ public class WarplyDBHelper extends SQLiteOpenHelper {
strFilter
.
append
(
"="
);
strFilter
.
append
(
ids
[
i
]);
}
getDb
().
delete
(
TABLE_PUSH_REQUESTS
,
strFilter
.
toString
(),
null
);
new
Thread
(()
->
{
getDb
().
delete
(
TABLE_PUSH_REQUESTS
,
strFilter
.
toString
(),
null
);
}).
start
();
}
public
synchronized
void
deletePushAckRequests
(
Long
...
ids
)
{
...
...
@@ -393,7 +420,9 @@ public class WarplyDBHelper extends SQLiteOpenHelper {
strFilter
.
append
(
"="
);
strFilter
.
append
(
ids
[
i
]);
}
getDb
().
delete
(
TABLE_PUSH_ACK_REQUESTS
,
strFilter
.
toString
(),
null
);
new
Thread
(()
->
{
getDb
().
delete
(
TABLE_PUSH_ACK_REQUESTS
,
strFilter
.
toString
(),
null
);
}).
start
();
}
public
synchronized
boolean
isForceRequestsExist
()
{
...
...
@@ -431,43 +460,45 @@ public class WarplyDBHelper extends SQLiteOpenHelper {
//------------------------------ Tags -----------------------------//
public
synchronized
void
saveTags
(
String
[]
tags
)
{
if
(
tags
!=
null
&&
tags
.
length
>
0
)
{
try
{
getDb
().
beginTransaction
();
ContentValues
values
=
new
ContentValues
();
for
(
String
tag
:
tags
)
{
values
.
put
(
KEY_TAG
,
tag
);
values
.
put
(
KEY_TAG_LAST_ADD_DATE
,
System
.
currentTimeMillis
());
insert
(
TABLE_TAGS
,
values
);
new
Thread
(()
->
{
if
(
tags
!=
null
&&
tags
.
length
>
0
)
{
try
{
getDb
().
beginTransaction
();
ContentValues
values
=
new
ContentValues
();
for
(
String
tag
:
tags
)
{
values
.
put
(
KEY_TAG
,
tag
);
values
.
put
(
KEY_TAG_LAST_ADD_DATE
,
System
.
currentTimeMillis
());
insert
(
TABLE_TAGS
,
values
);
}
getDb
().
setTransactionSuccessful
();
}
catch
(
SQLException
e
)
{
if
(
WarpConstants
.
DEBUG
)
{
e
.
printStackTrace
();
}
}
finally
{
getDb
().
endTransaction
();
}
getDb
().
setTransactionSuccessful
();
}
catch
(
SQLException
e
)
{
if
(
WarpConstants
.
DEBUG
)
{
e
.
printStackTrace
();
}
}
finally
{
getDb
().
endTransaction
();
}
}
}
).
start
();
}
public
synchronized
void
removeTags
(
String
[]
tags
)
{
StringBuilder
strFilter
=
new
StringBuilder
();
for
(
int
i
=
0
;
i
<
tags
.
length
;
i
++)
{
if
(
i
>
0
)
{
strFilter
.
append
(
" OR "
);
new
Thread
(()
->
{
StringBuilder
strFilter
=
new
StringBuilder
();
for
(
int
i
=
0
;
i
<
tags
.
length
;
i
++)
{
if
(
i
>
0
)
{
strFilter
.
append
(
" OR "
);
}
strFilter
.
append
(
KEY_TAG
);
strFilter
.
append
(
"="
);
strFilter
.
append
(
"'"
);
strFilter
.
append
(
tags
[
i
]);
strFilter
.
append
(
"'"
);
}
strFilter
.
append
(
KEY_TAG
);
strFilter
.
append
(
"="
);
strFilter
.
append
(
"'"
);
strFilter
.
append
(
tags
[
i
]);
strFilter
.
append
(
"'"
);
}
getDb
().
delete
(
TABLE_TAGS
,
strFilter
.
toString
(),
null
);
getDb
().
delete
(
TABLE_TAGS
,
strFilter
.
toString
(),
null
);
}).
start
();
}
public
synchronized
void
removeAllTags
()
{
...
...
warply_android_sdk/src/main/res/layout/activity_couponset_info.xml
View file @
54bf817
...
...
@@ -88,7 +88,7 @@
android:layout_width=
"240dp"
android:layout_height=
"50dp"
android:layout_marginHorizontal=
"32dp"
android:layout_marginTop=
"
@dimen/marginTo
p"
android:layout_marginTop=
"
88d
p"
android:background=
"@drawable/selector_button_green"
android:gravity=
"center"
android:orientation=
"horizontal"
>
...
...
Please
register
or
login
to post a comment