Skip to content

Commit 4ed53a2

Browse files
1) Restructure all code
2) Reduced sdk initialize code 3) UI design changed 4) And more feature implemented
1 parent a596f26 commit 4ed53a2

File tree

210 files changed

+6069
-9434
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

210 files changed

+6069
-9434
lines changed

Diff for: .gitignore

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
11
*.iml
22
.gradle
33
/local.properties
4-
/.idea/workspace.xml
54
/.idea/libraries
5+
/.idea/modules.xml
6+
/.idea/workspace.xml
67
.DS_Store
78
/build
89
/captures

Diff for: .idea/caches/build_file_checksums.ser

-5 Bytes
Binary file not shown.

Diff for: .idea/misc.xml

+1-5
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Diff for: app/build.gradle

+21-52
Original file line numberDiff line numberDiff line change
@@ -1,73 +1,42 @@
1-
buildscript {
2-
repositories {
3-
maven { url 'https://plugins.gradle.org/m2/'}
4-
}
5-
dependencies {
6-
classpath 'gradle.plugin.com.onesignal:onesignal-gradle-plugin:[0.11.0, 0.99.99]'
7-
}
8-
}
9-
apply plugin: 'com.onesignal.androidsdk.onesignal-gradle-plugin'
10-
11-
repositories {
12-
maven { url 'https://maven.google.com' }
13-
}
141
apply plugin: 'com.android.application'
152

163
android {
174
compileSdkVersion 27
185
defaultConfig {
6+
// applicationId "com.onefeed.sdk.sample"
197
applicationId "com.sdk.wittyfeed.demo"
208
minSdkVersion 16
219
targetSdkVersion 27
22-
buildToolsVersion '27.0.3'
2310
versionCode 1
24-
versionName "1.2"
25-
testInstrumentationRunner "android.support.custom_divider.runner.AndroidJUnitRunner"
26-
manifestPlaceholders = [
27-
onesignal_app_id: '521fdc24-e473-4b3d-a62a-ddbdd3c5f637',
28-
// Project number pulled from dashboard, local value is ignored.
29-
onesignal_google_project_number: 'REMOTE'
30-
]
11+
versionName "1.0"
12+
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
3113
}
3214
buildTypes {
3315
release {
3416
minifyEnabled false
3517
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
3618
}
37-
debug {
38-
minifyEnabled false
39-
}
4019
}
4120
}
4221

4322
dependencies {
44-
compile fileTree(include: ['*.jar'], dir: 'libs')
45-
// general
46-
compile 'com.android.support:appcompat-v7:27.1.1'
47-
compile 'com.android.support:support-v4:27.1.1'
48-
compile 'com.android.support:design:27.1.1'
49-
compile 'com.android.support:cardview-v7:27.1.1'
50-
compile 'com.android.support:recyclerview-v7:27.1.1'
51-
23+
implementation fileTree(include: ['*.jar'], dir: 'libs')
24+
implementation 'com.android.support:appcompat-v7:27.1.1'
25+
implementation 'com.android.support:support-v4:27.1.1'
26+
implementation 'com.android.support.constraint:constraint-layout:1.1.3'
27+
testImplementation 'junit:junit:4.12'
28+
androidTestImplementation 'com.android.support.test:runner:1.0.2'
29+
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
30+
implementation project(':onefeedsdk')
31+
32+
//recycler-View
33+
implementation 'com.android.support:recyclerview-v7:27.1.1'
34+
//Card-View
35+
implementation 'com.android.support:cardview-v7:27.1.1'
36+
//CustomTabs
37+
implementation 'com.android.support:customtabs:27.1.1'
5238
// firebase
53-
compile 'com.google.firebase:firebase-core:12.0.1'
54-
compile 'com.google.firebase:firebase-messaging:12.0.1'
55-
56-
// SDK
57-
compile 'com.google.code.gson:gson:2.8.2'
58-
compile 'com.github.bumptech.glide:glide:4.3.1'
59-
annotationProcessor 'com.github.bumptech.glide:compiler:4.3.1'
60-
compile 'com.android.volley:volley:1.0.0'
61-
compile 'com.android.support:customtabs:27.1.1'
62-
// other auto generated
63-
64-
testCompile 'junit:junit:4.12'
65-
66-
// to add our SDK module in main app
67-
compile project(':onefeedsdk')
68-
implementation 'com.onesignal:OneSignal:[3.9.1, 3.99.99]'
69-
39+
implementation 'com.google.firebase:firebase-core:16.0.4'
40+
implementation 'com.google.firebase:firebase-messaging:17.3.3'
7041
}
71-
72-
apply plugin: 'com.google.gms.google-services'
73-
apply plugin: 'com.android.application'
42+
apply plugin: 'com.google.gms.google-services'

Diff for: app/keystore/demo.jks

2.19 KB
Binary file not shown.

Diff for: app/keystore/onefeed.jks

2.19 KB
Binary file not shown.

Diff for: app/proguard-rules.pro

+2-6
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,10 @@
11
# Add project specific ProGuard rules here.
2-
# By default, the flags in this file are appended to flags specified
3-
# in /Users/aishwarydhare/Library/Android/sdk/tools/proguard/proguard-android.txt
4-
# You can edit the include path and order by changing the proguardFiles
5-
# directive in build.gradle.
2+
# You can control the set of applied configuration files using the
3+
# proguardFiles setting in build.gradle.
64
#
75
# For more details, see
86
# http://developer.android.com/guide/developing/tools/proguard.html
97

10-
# Add any project specific keep options here:
11-
128
# If your project uses WebView with JS, uncomment the following
139
# and specify the fully qualified class name to the JavaScript interface
1410
# class:

Diff for: app/release/app-release.apk

-2.93 MB
Binary file not shown.

Diff for: app/release/onefeed-app-release.apk

3.12 MB
Binary file not shown.

Diff for: app/release/output.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
[{"outputType":{"type":"APK"},"apkInfo":{"type":"MAIN","splits":[],"versionCode":1},"path":"app-release.apk","properties":{"packageId":"com.sdk.wittyfeed.debug","split":"","minSdkVersion":"16"}}]
1+
[{"outputType":{"type":"APK"},"apkInfo":{"type":"MAIN","splits":[],"versionCode":1,"versionName":"1.0","enabled":true,"outputFile":"app-release.apk","fullName":"release","baseName":"release"},"path":"app-release.apk","properties":{}}]
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
package com.wittyfeed.sdk.demo;
1+
package com.onefeed.sdk.sample;
22

33
import android.content.Context;
44
import android.support.test.InstrumentationRegistry;
@@ -10,17 +10,17 @@
1010
import static org.junit.Assert.*;
1111

1212
/**
13-
* Instrumentation custom_divider, which will execute on an Android device.
13+
* Instrumented test, which will execute on an Android device.
1414
*
1515
* @see <a href="http://d.android.com/tools/testing">Testing documentation</a>
1616
*/
1717
@RunWith(AndroidJUnit4.class)
1818
public class ExampleInstrumentedTest {
1919
@Test
20-
public void useAppContext() throws Exception {
21-
// Context of the app under custom_divider.
20+
public void useAppContext() {
21+
// Context of the app under test.
2222
Context appContext = InstrumentationRegistry.getTargetContext();
2323

24-
assertEquals("com.sdk.wittyfeed.sdkv2", appContext.getPackageName());
24+
assertEquals("com.onefeed.sdk.sample", appContext.getPackageName());
2525
}
2626
}

Diff for: app/src/main/AndroidManifest.xml

+20-54
Original file line numberDiff line numberDiff line change
@@ -1,82 +1,48 @@
11
<?xml version="1.0" encoding="utf-8"?>
22
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
3-
package="com.wittyfeed.sdk.demo">
3+
package="com.onefeed.sdk.sample">
44

5-
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
6-
<uses-permission android:name="android.permission.INTERNET" />
7-
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
8-
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
5+
<uses-permission android:name="android.permission.INTERNET"/>
96

107
<application
11-
android:name=".Root"
12-
android:allowBackup="false"
8+
android:name=".app.Root"
9+
android:allowBackup="true"
1310
android:icon="@mipmap/ic_launcher"
1411
android:label="@string/app_name"
1512
android:roundIcon="@mipmap/ic_launcher_round"
1613
android:supportsRtl="true"
17-
android:theme="@style/WFSDKTheme">
18-
19-
20-
<activity
21-
android:name="com.wittyfeed.sdk.demo.MainActivity"
22-
android:screenOrientation="portrait"
23-
android:launchMode="singleTop"
24-
android:theme="@style/Theme.AppCompat.NoActionBar">
14+
android:theme="@style/AppTheme">
15+
<activity android:name=".DemoActivity"
16+
android:screenOrientation="portrait">
2517
<intent-filter>
26-
<!--<action android:name="OPEN_MYACTIVITY" />-->
2718
<action android:name="android.intent.action.MAIN" />
19+
2820
<category android:name="android.intent.category.LAUNCHER" />
2921
</intent-filter>
3022
</activity>
3123

32-
<activity android:name=".NativeCardsActivity"></activity>
33-
34-
<activity android:name=".NonRepeatingDemoActivity"></activity>
24+
<activity android:name=".FeedActivity"
25+
android:screenOrientation="portrait"/>
3526

27+
<activity android:name=".RepeatingCardActivity"
28+
android:screenOrientation="portrait"/>
3629

37-
<!-- Set custom default icon. This is used when no icon is set for incoming notification messages. -->
38-
<!-- See README(https://goo.gl/l4GJaQ) for more. -->
39-
40-
<meta-data
41-
android:name="com.google.firebase.messaging.default_notification_icon"
42-
android:resource="@mipmap/ic_launcher" />
43-
44-
<!--&lt;!&ndash; Set color used with incoming notification messages. This is used when no color is set for the incoming-->
45-
<!--notification message. See README(https://goo.gl/6BKBk7) for more. &ndash;&gt;-->
46-
47-
<meta-data
48-
android:name="com.google.firebase.messaging.default_notification_color"
49-
android:resource="@color/colorAccent" />
5030

5131
<service
52-
android:name="com.wittyfeed.sdk.demo.MyFirebaseInstanceIDService"
53-
android:stopWithTask="false">
32+
android:name="com.onefeed.sdk.sample.service.OnefeedFirebaseMessagingService">
5433
<intent-filter>
55-
<action android:name="com.google.firebase.INSTANCE_ID_EVENT" />
34+
<action android:name="com.google.firebase.MESSAGING_EVENT"/>
5635
</intent-filter>
5736
</service>
5837

59-
<service
60-
android:name="com.wittyfeed.sdk.demo.MyFirebaseMessagingService"
61-
android:stopWithTask="false">
62-
<intent-filter>
63-
<action android:name="com.google.firebase.MESSAGING_EVENT" />
64-
</intent-filter>
65-
</service>
38+
<meta-data android:name="com.onefeed.sdk.ApiKey"
39+
android:value="@string/onefeed_api_key"/>
6640

67-
<!-- Disable opening of launcher Activity -->
68-
<meta-data android:name="com.onesignal.NotificationOpened.DEFAULT" android:value="DISABLE" />
69-
70-
<!--<service
71-
android:name=".NotificationExtenderExample"
72-
android:permission="android.permission.BIND_JOB_SERVICE"
73-
android:exported="false">
74-
<intent-filter>
75-
<action android:name="com.onesignal.NotificationExtender" />
76-
</intent-filter>
77-
</service>-->
41+
<meta-data android:name="com.onefeed.sdk.AppId"
42+
android:value="@string/onefeed_app_id"/>
7843

44+
<meta-data android:name="com.onefeed.sdk.CardId"
45+
android:value="@string/onefeed_card_id"/>
7946
</application>
8047

81-
8248
</manifest>

Diff for: app/src/main/ic_launcher-web.png

-15.8 KB
Binary file not shown.
+105
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,105 @@
1+
package com.onefeed.sdk.sample;
2+
3+
import android.content.Intent;
4+
import android.os.Bundle;
5+
import android.support.annotation.NonNull;
6+
import android.support.annotation.Nullable;
7+
import android.support.v7.app.AppCompatActivity;
8+
import android.text.TextUtils;
9+
import android.util.Log;
10+
import android.view.View;
11+
12+
import com.google.android.gms.tasks.OnCompleteListener;
13+
import com.google.android.gms.tasks.Task;
14+
import com.google.firebase.iid.FirebaseInstanceId;
15+
import com.google.firebase.iid.InstanceIdResult;
16+
import com.google.firebase.messaging.FirebaseMessaging;
17+
import com.onefeedsdk.app.OneFeedSdk;
18+
import com.onefeedsdk.notification.NotificationHelper;
19+
20+
import java.util.HashMap;
21+
import java.util.Map;
22+
23+
/**
24+
* Created by Yogesh Soni.
25+
* Company: WittyFeed
26+
* Date: 26-September-2018
27+
* Time: 14:34
28+
*/
29+
public class DemoActivity extends AppCompatActivity {
30+
31+
@Override
32+
protected void onCreate(@Nullable Bundle savedInstanceState) {
33+
super.onCreate(savedInstanceState);
34+
setContentView(R.layout.activity_demo);
35+
36+
// Get token
37+
FirebaseInstanceId.getInstance().getInstanceId()
38+
.addOnCompleteListener(new OnCompleteListener<InstanceIdResult>() {
39+
@Override
40+
public void onComplete(@NonNull Task<InstanceIdResult> task) {
41+
if (!task.isSuccessful()) {
42+
Log.w("Token", "getInstanceId failed", task.getException());
43+
return;
44+
}
45+
try {
46+
// Get new Instance ID token
47+
String token = task.getResult().getToken();
48+
// Log and toast
49+
String msg = getString(R.string.msg_token_fmt, token);
50+
Log.d("Token", msg);
51+
52+
//set Token
53+
OneFeedSdk.getInstance().setToken(token);
54+
}catch (NullPointerException e){
55+
Log.e("Exception", e.getMessage());
56+
}
57+
}
58+
});
59+
60+
topicSubscription();
61+
}
62+
63+
//FCM Topic Subscription and Unsubscription
64+
private void topicSubscription() {
65+
66+
//Topic Subscribe
67+
FirebaseMessaging.getInstance().subscribeToTopic(OneFeedSdk.getInstance().getSubscribeTopic());
68+
69+
if (TextUtils.isEmpty(OneFeedSdk.getInstance().getOldTopicSubscribe())) {
70+
OneFeedSdk.getInstance().setTopicSubscription();
71+
} else if (OneFeedSdk.getInstance().getSubscribeTopic() != OneFeedSdk.getInstance().getOldTopicSubscribe()) {
72+
FirebaseMessaging.getInstance().unsubscribeFromTopic(OneFeedSdk.getInstance().getOldTopicSubscribe());
73+
OneFeedSdk.getInstance().setTopicSubscription();
74+
}
75+
}
76+
77+
public void onClick(View view){
78+
switch (view.getId()){
79+
case R.id.btn_feed:
80+
startActivity(new Intent(this, FeedActivity.class));
81+
break;
82+
case R.id.btn_native_card:
83+
startActivity(new Intent(this, RepeatingCardActivity.class));
84+
break;
85+
case R.id.button:
86+
Map<String, String> demoNotification = new HashMap<>();
87+
demoNotification.put("story_id", "60496");
88+
demoNotification.put("noid", "10001");
89+
demoNotification.put("story_title", "10 Things Every Girl Should Put On Her List");
90+
demoNotification.put("cover_image", "https://cdn.wittyfeed.com/41441/ilik0kqmr2hpv1i4l8ya.jpeg?imwidth=960");
91+
demoNotification.put("story_url","https://www.wittyfeed.me/story/41441/things-every-girl-should-put-in-her-list?utm_hash=ArD51&nohead=1");
92+
93+
demoNotification.put("id", "400");
94+
demoNotification.put("body", "Hey, Here's a new amazing story for you!");
95+
demoNotification.put("title", "10 Things Every Girl Should Put On Her List");
96+
demoNotification.put("notiff_agent", "wittyfeed_sdk");
97+
demoNotification.put("app_id" , "108");
98+
99+
demoNotification.put("action", "" + "WittyFeedSDKContentViewActivity");
100+
101+
NotificationHelper.sendNotification(getApplicationContext(), FeedActivity.class, demoNotification);
102+
103+
}
104+
}
105+
}

0 commit comments

Comments
 (0)