getSupportLaunchers() {
37 | return Arrays.asList("com.teslacoilsw.launcher");
38 | }
39 | }
40 |
--------------------------------------------------------------------------------
/android/lib/src/main/java/me/leolin/shortcutbadger/impl/OPPOHomeBader.java:
--------------------------------------------------------------------------------
1 | package me.leolin.shortcutbadger.impl;
2 |
3 | import android.annotation.TargetApi;
4 | import android.content.ComponentName;
5 | import android.content.Context;
6 | import android.content.Intent;
7 | import android.net.Uri;
8 | import android.os.Build;
9 | import android.os.Bundle;
10 |
11 | import java.io.BufferedReader;
12 | import java.io.IOException;
13 | import java.io.InputStreamReader;
14 | import java.lang.reflect.InvocationTargetException;
15 | import java.lang.reflect.Method;
16 | import java.util.Collections;
17 | import java.util.List;
18 |
19 | import me.leolin.shortcutbadger.Badger;
20 | import me.leolin.shortcutbadger.ShortcutBadgeException;
21 | import me.leolin.shortcutbadger.util.BroadcastHelper;
22 | import me.leolin.shortcutbadger.util.CloseHelper;
23 |
24 | /**
25 | * Created by NingSo on 2016/10/14.上午10:09
26 | *
27 | * @author: NingSo
28 | * Email: ningso.ping@gmail.com
29 | *
30 | * OPPO R9 not supported
31 | * Version number 6 applies only to chat-type apps
32 | */
33 |
34 | public class OPPOHomeBader implements Badger {
35 |
36 | private static final String PROVIDER_CONTENT_URI = "content://com.android.badge/badge";
37 | private static final String INTENT_ACTION = "com.oppo.unsettledevent";
38 | private static final String INTENT_EXTRA_PACKAGENAME = "pakeageName";
39 | private static final String INTENT_EXTRA_BADGE_COUNT = "number";
40 | private static final String INTENT_EXTRA_BADGE_UPGRADENUMBER = "upgradeNumber";
41 | private static final String INTENT_EXTRA_BADGEUPGRADE_COUNT = "app_badge_count";
42 | private static int ROMVERSION = -1;
43 |
44 | @TargetApi(Build.VERSION_CODES.HONEYCOMB)
45 | @Override
46 | public void executeBadge(Context context, ComponentName componentName, int badgeCount) throws ShortcutBadgeException {
47 | if (badgeCount == 0) {
48 | badgeCount = -1;
49 | }
50 | Intent intent = new Intent(INTENT_ACTION);
51 | intent.putExtra(INTENT_EXTRA_PACKAGENAME, componentName.getPackageName());
52 | intent.putExtra(INTENT_EXTRA_BADGE_COUNT, badgeCount);
53 | intent.putExtra(INTENT_EXTRA_BADGE_UPGRADENUMBER, badgeCount);
54 | if (BroadcastHelper.canResolveBroadcast(context, intent)) {
55 | context.sendBroadcast(intent);
56 | } else {
57 | int version = getSupportVersion();
58 | if (version == 6) {
59 | try {
60 | Bundle extras = new Bundle();
61 | extras.putInt(INTENT_EXTRA_BADGEUPGRADE_COUNT, badgeCount);
62 | context.getContentResolver().call(Uri.parse(PROVIDER_CONTENT_URI), "setAppBadgeCount", null, extras);
63 | } catch (Throwable th) {
64 | throw new ShortcutBadgeException("unable to resolve intent: " + intent.toString());
65 | }
66 | }
67 | }
68 | }
69 |
70 | @Override
71 | public List getSupportLaunchers() {
72 | return Collections.singletonList("com.oppo.launcher");
73 | }
74 |
75 | private int getSupportVersion() {
76 | int i = ROMVERSION;
77 | if (i >= 0) {
78 | return ROMVERSION;
79 | }
80 | try {
81 | i = ((Integer) executeClassLoad(getClass("com.color.os.ColorBuild"), "getColorOSVERSION", null, null)).intValue();
82 | } catch (Exception e) {
83 | i = 0;
84 | }
85 | if (i == 0) {
86 | try {
87 | String str = getSystemProperty("ro.build.version.opporom");
88 | if (str.startsWith("V1.4")) {
89 | return 3;
90 | }
91 | if (str.startsWith("V2.0")) {
92 | return 4;
93 | }
94 | if (str.startsWith("V2.1")) {
95 | return 5;
96 | }
97 | } catch (Exception ignored) {
98 |
99 | }
100 | }
101 | ROMVERSION = i;
102 | return ROMVERSION;
103 | }
104 |
105 |
106 | private Object executeClassLoad(Class cls, String str, Class[] clsArr, Object[] objArr) {
107 | Object obj = null;
108 | if (!(cls == null || checkObjExists(str))) {
109 | Method method = getMethod(cls, str, clsArr);
110 | if (method != null) {
111 | method.setAccessible(true);
112 | try {
113 | obj = method.invoke(null, objArr);
114 | } catch (IllegalAccessException e) {
115 | e.printStackTrace();
116 | } catch (InvocationTargetException e) {
117 | e.printStackTrace();
118 | }
119 | }
120 | }
121 | return obj;
122 | }
123 |
124 | private Method getMethod(Class cls, String str, Class[] clsArr) {
125 | Method method = null;
126 | if (cls == null || checkObjExists(str)) {
127 | return method;
128 | }
129 | try {
130 | cls.getMethods();
131 | cls.getDeclaredMethods();
132 | return cls.getDeclaredMethod(str, clsArr);
133 | } catch (Exception e) {
134 | try {
135 | return cls.getMethod(str, clsArr);
136 | } catch (Exception e2) {
137 | return cls.getSuperclass() != null ? getMethod(cls.getSuperclass(), str, clsArr) : method;
138 | }
139 | }
140 | }
141 |
142 | private Class getClass(String str) {
143 | Class cls = null;
144 | try {
145 | cls = Class.forName(str);
146 | } catch (ClassNotFoundException ignored) {
147 | }
148 | return cls;
149 | }
150 |
151 |
152 | private boolean checkObjExists(Object obj) {
153 | return obj == null || obj.toString().equals("") || obj.toString().trim().equals("null");
154 | }
155 |
156 |
157 | private String getSystemProperty(String propName) {
158 | String line;
159 | BufferedReader input = null;
160 | try {
161 | Process p = Runtime.getRuntime().exec("getprop " + propName);
162 | input = new BufferedReader(new InputStreamReader(p.getInputStream()), 1024);
163 | line = input.readLine();
164 | input.close();
165 | } catch (IOException ex) {
166 | return null;
167 | } finally {
168 | CloseHelper.closeQuietly(input);
169 | }
170 | return line;
171 | }
172 | }
173 |
--------------------------------------------------------------------------------
/android/lib/src/main/java/me/leolin/shortcutbadger/impl/SamsungHomeBadger.java:
--------------------------------------------------------------------------------
1 | package me.leolin.shortcutbadger.impl;
2 |
3 | import android.content.ComponentName;
4 | import android.content.ContentResolver;
5 | import android.content.ContentValues;
6 | import android.content.Context;
7 | import android.database.Cursor;
8 | import android.net.Uri;
9 | import android.os.Build;
10 |
11 | import java.util.Arrays;
12 | import java.util.List;
13 |
14 | import me.leolin.shortcutbadger.Badger;
15 | import me.leolin.shortcutbadger.ShortcutBadgeException;
16 | import me.leolin.shortcutbadger.util.CloseHelper;
17 |
18 | /**
19 | * @author Leo Lin
20 | */
21 | public class SamsungHomeBadger implements Badger {
22 | private static final String CONTENT_URI = "content://com.sec.badge/apps?notify=true";
23 | private static final String[] CONTENT_PROJECTION = new String[]{"_id", "class"};
24 |
25 | private DefaultBadger defaultBadger;
26 |
27 | public SamsungHomeBadger() {
28 | if (Build.VERSION.SDK_INT >= 21) {
29 | defaultBadger = new DefaultBadger();
30 | }
31 | }
32 |
33 | @Override
34 | public void executeBadge(Context context, ComponentName componentName, int badgeCount) throws ShortcutBadgeException {
35 | if (defaultBadger != null && defaultBadger.isSupported(context)) {
36 | defaultBadger.executeBadge(context, componentName, badgeCount);
37 | } else {
38 | Uri mUri = Uri.parse(CONTENT_URI);
39 | ContentResolver contentResolver = context.getContentResolver();
40 | Cursor cursor = null;
41 | try {
42 | cursor = contentResolver.query(mUri, CONTENT_PROJECTION, "package=?", new String[]{componentName.getPackageName()}, null);
43 | if (cursor != null) {
44 | String entryActivityName = componentName.getClassName();
45 | boolean entryActivityExist = false;
46 | while (cursor.moveToNext()) {
47 | int id = cursor.getInt(0);
48 | ContentValues contentValues = getContentValues(componentName, badgeCount, false);
49 | contentResolver.update(mUri, contentValues, "_id=?", new String[]{String.valueOf(id)});
50 | if (entryActivityName.equals(cursor.getString(cursor.getColumnIndex("class")))) {
51 | entryActivityExist = true;
52 | }
53 | }
54 |
55 | if (!entryActivityExist) {
56 | ContentValues contentValues = getContentValues(componentName, badgeCount, true);
57 | contentResolver.insert(mUri, contentValues);
58 | }
59 | }
60 | } finally {
61 | CloseHelper.close(cursor);
62 | }
63 | }
64 | }
65 |
66 | private ContentValues getContentValues(ComponentName componentName, int badgeCount, boolean isInsert) {
67 | ContentValues contentValues = new ContentValues();
68 | if (isInsert) {
69 | contentValues.put("package", componentName.getPackageName());
70 | contentValues.put("class", componentName.getClassName());
71 | }
72 |
73 | contentValues.put("badgecount", badgeCount);
74 |
75 | return contentValues;
76 | }
77 |
78 | @Override
79 | public List getSupportLaunchers() {
80 | return Arrays.asList(
81 | "com.sec.android.app.launcher",
82 | "com.sec.android.app.twlauncher"
83 | );
84 | }
85 | }
86 |
--------------------------------------------------------------------------------
/android/lib/src/main/java/me/leolin/shortcutbadger/impl/SonyHomeBadger.java:
--------------------------------------------------------------------------------
1 | package me.leolin.shortcutbadger.impl;
2 |
3 | import android.content.AsyncQueryHandler;
4 | import android.content.ComponentName;
5 | import android.content.ContentValues;
6 | import android.content.Context;
7 | import android.content.Intent;
8 | import android.content.pm.ProviderInfo;
9 | import android.net.Uri;
10 | import android.os.Looper;
11 |
12 | import java.util.Arrays;
13 | import java.util.List;
14 |
15 | import me.leolin.shortcutbadger.Badger;
16 | import me.leolin.shortcutbadger.ShortcutBadgeException;
17 |
18 |
19 | /**
20 | * @author Leo Lin
21 | */
22 | public class SonyHomeBadger implements Badger {
23 |
24 | private static final String INTENT_ACTION = "com.sonyericsson.home.action.UPDATE_BADGE";
25 | private static final String INTENT_EXTRA_PACKAGE_NAME = "com.sonyericsson.home.intent.extra.badge.PACKAGE_NAME";
26 | private static final String INTENT_EXTRA_ACTIVITY_NAME = "com.sonyericsson.home.intent.extra.badge.ACTIVITY_NAME";
27 | private static final String INTENT_EXTRA_MESSAGE = "com.sonyericsson.home.intent.extra.badge.MESSAGE";
28 | private static final String INTENT_EXTRA_SHOW_MESSAGE = "com.sonyericsson.home.intent.extra.badge.SHOW_MESSAGE";
29 |
30 | private static final String PROVIDER_CONTENT_URI = "content://com.sonymobile.home.resourceprovider/badge";
31 | private static final String PROVIDER_COLUMNS_BADGE_COUNT = "badge_count";
32 | private static final String PROVIDER_COLUMNS_PACKAGE_NAME = "package_name";
33 | private static final String PROVIDER_COLUMNS_ACTIVITY_NAME = "activity_name";
34 | private static final String SONY_HOME_PROVIDER_NAME = "com.sonymobile.home.resourceprovider";
35 | private final Uri BADGE_CONTENT_URI = Uri.parse(PROVIDER_CONTENT_URI);
36 |
37 | private AsyncQueryHandler mQueryHandler;
38 |
39 | @Override
40 | public void executeBadge(Context context, ComponentName componentName,
41 | int badgeCount) throws ShortcutBadgeException {
42 | if (sonyBadgeContentProviderExists(context)) {
43 | executeBadgeByContentProvider(context, componentName, badgeCount);
44 | } else {
45 | executeBadgeByBroadcast(context, componentName, badgeCount);
46 | }
47 | }
48 |
49 | @Override
50 | public List getSupportLaunchers() {
51 | return Arrays.asList("com.sonyericsson.home", "com.sonymobile.home");
52 | }
53 |
54 | private static void executeBadgeByBroadcast(Context context, ComponentName componentName,
55 | int badgeCount) {
56 | Intent intent = new Intent(INTENT_ACTION);
57 | intent.putExtra(INTENT_EXTRA_PACKAGE_NAME, componentName.getPackageName());
58 | intent.putExtra(INTENT_EXTRA_ACTIVITY_NAME, componentName.getClassName());
59 | intent.putExtra(INTENT_EXTRA_MESSAGE, String.valueOf(badgeCount));
60 | intent.putExtra(INTENT_EXTRA_SHOW_MESSAGE, badgeCount > 0);
61 | context.sendBroadcast(intent);
62 | }
63 |
64 | /**
65 | * Send request to Sony badge content provider to set badge in Sony home launcher.
66 | *
67 | * @param context the context to use
68 | * @param componentName the componentName to use
69 | * @param badgeCount the badge count
70 | */
71 | private void executeBadgeByContentProvider(Context context, ComponentName componentName,
72 | int badgeCount) {
73 | if (badgeCount < 0) {
74 | return;
75 | }
76 |
77 | final ContentValues contentValues = createContentValues(badgeCount, componentName);
78 | if (Looper.myLooper() == Looper.getMainLooper()) {
79 | // We're in the main thread. Let's ensure the badge update happens in a background
80 | // thread by using an AsyncQueryHandler and an async update.
81 | if (mQueryHandler == null) {
82 | mQueryHandler = new AsyncQueryHandler(
83 | context.getApplicationContext().getContentResolver()) {
84 | };
85 | }
86 | insertBadgeAsync(contentValues);
87 | } else {
88 | // Already in a background thread. Let's update the badge synchronously. Otherwise,
89 | // if we use the AsyncQueryHandler, this thread may already be dead by the time the
90 | // async execution finishes, which will lead to an IllegalStateException.
91 | insertBadgeSync(context, contentValues);
92 | }
93 | }
94 |
95 | /**
96 | * Asynchronously inserts the badge counter.
97 | *
98 | * @param contentValues Content values containing the badge count, package and activity names
99 | */
100 | private void insertBadgeAsync(final ContentValues contentValues) {
101 | mQueryHandler.startInsert(0, null, BADGE_CONTENT_URI, contentValues);
102 | }
103 |
104 | /**
105 | * Synchronously inserts the badge counter.
106 | *
107 | * @param context Caller context
108 | * @param contentValues Content values containing the badge count, package and activity names
109 | */
110 | private void insertBadgeSync(final Context context, final ContentValues contentValues) {
111 | context.getApplicationContext().getContentResolver()
112 | .insert(BADGE_CONTENT_URI, contentValues);
113 | }
114 |
115 | /**
116 | * Creates a ContentValues object to be used in the badge counter update. The package and
117 | * activity names must correspond to an activity that holds an intent filter with action
118 | * "android.intent.action.MAIN" and category android.intent.category.LAUNCHER" in the manifest.
119 | * Also, it is not allowed to publish badges on behalf of another client, so the package and
120 | * activity names must belong to the process from which the insert is made.
121 | * To be able to insert badges, the app must have the PROVIDER_INSERT_BADGE
122 | * permission in the manifest file. In case these conditions are not
123 | * fulfilled, or any content values are missing, there will be an unhandled
124 | * exception on the background thread.
125 | *
126 | * @param badgeCount the badge count
127 | * @param componentName the component name from which package and class name will be extracted
128 | *
129 | */
130 | private ContentValues createContentValues(final int badgeCount,
131 | final ComponentName componentName) {
132 | final ContentValues contentValues = new ContentValues();
133 | contentValues.put(PROVIDER_COLUMNS_BADGE_COUNT, badgeCount);
134 | contentValues.put(PROVIDER_COLUMNS_PACKAGE_NAME, componentName.getPackageName());
135 | contentValues.put(PROVIDER_COLUMNS_ACTIVITY_NAME, componentName.getClassName());
136 | return contentValues;
137 | }
138 |
139 | /**
140 | * Check if the latest Sony badge content provider exists .
141 | *
142 | * @param context the context to use
143 | * @return true if Sony badge content provider exists, otherwise false.
144 | */
145 | private static boolean sonyBadgeContentProviderExists(Context context) {
146 | boolean exists = false;
147 | ProviderInfo info = context.getPackageManager().resolveContentProvider(SONY_HOME_PROVIDER_NAME, 0);
148 | if (info != null) {
149 | exists = true;
150 | }
151 | return exists;
152 | }
153 | }
154 |
--------------------------------------------------------------------------------
/android/lib/src/main/java/me/leolin/shortcutbadger/impl/VivoHomeBadger.java:
--------------------------------------------------------------------------------
1 | package me.leolin.shortcutbadger.impl;
2 |
3 | import android.content.ComponentName;
4 | import android.content.Context;
5 | import android.content.Intent;
6 |
7 | import java.util.Arrays;
8 | import java.util.List;
9 |
10 | import me.leolin.shortcutbadger.Badger;
11 | import me.leolin.shortcutbadger.ShortcutBadgeException;
12 |
13 | /**
14 | * @author leolin
15 | */
16 | public class VivoHomeBadger implements Badger {
17 |
18 | @Override
19 | public void executeBadge(Context context, ComponentName componentName, int badgeCount) throws ShortcutBadgeException {
20 | Intent intent = new Intent("launcher.action.CHANGE_APPLICATION_NOTIFICATION_NUM");
21 | intent.putExtra("packageName", context.getPackageName());
22 | intent.putExtra("className", componentName.getClassName());
23 | intent.putExtra("notificationNum", badgeCount);
24 | context.sendBroadcast(intent);
25 | }
26 |
27 | @Override
28 | public List getSupportLaunchers() {
29 | return Arrays.asList("com.vivo.launcher");
30 | }
31 | }
32 |
--------------------------------------------------------------------------------
/android/lib/src/main/java/me/leolin/shortcutbadger/impl/XiaomiHomeBadger.java:
--------------------------------------------------------------------------------
1 | package me.leolin.shortcutbadger.impl;
2 |
3 | import android.annotation.TargetApi;
4 | import android.app.Notification;
5 | import android.app.NotificationManager;
6 | import android.content.ComponentName;
7 | import android.content.Context;
8 | import android.content.Intent;
9 | import android.content.pm.PackageManager;
10 | import android.content.pm.ResolveInfo;
11 | import android.os.Build;
12 |
13 | import java.lang.reflect.Field;
14 | import java.lang.reflect.Method;
15 | import java.util.Arrays;
16 | import java.util.List;
17 |
18 | import me.leolin.shortcutbadger.Badger;
19 | import me.leolin.shortcutbadger.ShortcutBadgeException;
20 | import me.leolin.shortcutbadger.util.BroadcastHelper;
21 |
22 |
23 | /**
24 | * @author leolin
25 | */
26 | @Deprecated
27 | public class XiaomiHomeBadger implements Badger {
28 |
29 | public static final String INTENT_ACTION = "android.intent.action.APPLICATION_MESSAGE_UPDATE";
30 | public static final String EXTRA_UPDATE_APP_COMPONENT_NAME = "android.intent.extra.update_application_component_name";
31 | public static final String EXTRA_UPDATE_APP_MSG_TEXT = "android.intent.extra.update_application_message_text";
32 | private ResolveInfo resolveInfo;
33 |
34 | @Override
35 | public void executeBadge(Context context, ComponentName componentName, int badgeCount) throws ShortcutBadgeException {
36 | try {
37 | Class miuiNotificationClass = Class.forName("android.app.MiuiNotification");
38 | Object miuiNotification = miuiNotificationClass.newInstance();
39 | Field field = miuiNotification.getClass().getDeclaredField("messageCount");
40 | field.setAccessible(true);
41 | try {
42 | field.set(miuiNotification, String.valueOf(badgeCount == 0 ? "" : badgeCount));
43 | } catch (Exception e) {
44 | field.set(miuiNotification, badgeCount);
45 | }
46 | } catch (Exception e) {
47 | Intent localIntent = new Intent(
48 | INTENT_ACTION);
49 | localIntent.putExtra(EXTRA_UPDATE_APP_COMPONENT_NAME, componentName.getPackageName() + "/" + componentName.getClassName());
50 | localIntent.putExtra(EXTRA_UPDATE_APP_MSG_TEXT, String.valueOf(badgeCount == 0 ? "" : badgeCount));
51 | if (BroadcastHelper.canResolveBroadcast(context, localIntent)) {
52 | context.sendBroadcast(localIntent);
53 | }
54 | }
55 | if (Build.MANUFACTURER.equalsIgnoreCase("Xiaomi")) {
56 | tryNewMiuiBadge(context, badgeCount);
57 | }
58 | }
59 |
60 | @TargetApi(Build.VERSION_CODES.JELLY_BEAN)
61 | private void tryNewMiuiBadge(Context context, int badgeCount) throws ShortcutBadgeException {
62 | if (resolveInfo == null) {
63 | Intent intent = new Intent(Intent.ACTION_MAIN);
64 | intent.addCategory(Intent.CATEGORY_HOME);
65 | resolveInfo = context.getPackageManager().resolveActivity(intent, PackageManager.MATCH_DEFAULT_ONLY);
66 | }
67 |
68 | if (resolveInfo != null) {
69 | NotificationManager mNotificationManager = (NotificationManager) context
70 | .getSystemService(Context.NOTIFICATION_SERVICE);
71 | Notification.Builder builder = new Notification.Builder(context)
72 | .setContentTitle("")
73 | .setContentText("")
74 | .setSmallIcon(resolveInfo.getIconResource());
75 | Notification notification = builder.build();
76 | try {
77 | Field field = notification.getClass().getDeclaredField("extraNotification");
78 | Object extraNotification = field.get(notification);
79 | Method method = extraNotification.getClass().getDeclaredMethod("setMessageCount", int.class);
80 | method.invoke(extraNotification, badgeCount);
81 | mNotificationManager.notify(0, notification);
82 | } catch (Exception e) {
83 | throw new ShortcutBadgeException("not able to set badge", e);
84 | }
85 | }
86 | }
87 |
88 | @Override
89 | public List getSupportLaunchers() {
90 | return Arrays.asList(
91 | "com.miui.miuilite",
92 | "com.miui.home",
93 | "com.miui.miuihome",
94 | "com.miui.miuihome2",
95 | "com.miui.mihome",
96 | "com.miui.mihome2",
97 | "com.i.miui.launcher"
98 | );
99 | }
100 | }
101 |
--------------------------------------------------------------------------------
/android/lib/src/main/java/me/leolin/shortcutbadger/impl/ZTEHomeBadger.java:
--------------------------------------------------------------------------------
1 | package me.leolin.shortcutbadger.impl;
2 |
3 | import android.content.ComponentName;
4 | import android.content.Context;
5 | import android.net.Uri;
6 | import android.os.Build;
7 | import android.os.Bundle;
8 |
9 | import java.util.ArrayList;
10 | import java.util.List;
11 |
12 | import me.leolin.shortcutbadger.Badger;
13 | import me.leolin.shortcutbadger.ShortcutBadgeException;
14 |
15 | public class ZTEHomeBadger implements Badger {
16 |
17 | @Override
18 | public void executeBadge(Context context, ComponentName componentName, int badgeCount)
19 | throws ShortcutBadgeException {
20 | Bundle extra = new Bundle();
21 | extra.putInt("app_badge_count", badgeCount);
22 | extra.putString("app_badge_component_name", componentName.flattenToString());
23 |
24 | if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) {
25 | context.getContentResolver().call(
26 | Uri.parse("content://com.android.launcher3.cornermark.unreadbadge"),
27 | "setAppUnreadCount", null, extra);
28 | }
29 | }
30 |
31 | @Override
32 | public List getSupportLaunchers() {
33 | return new ArrayList(0);
34 | }
35 | }
36 |
37 |
--------------------------------------------------------------------------------
/android/lib/src/main/java/me/leolin/shortcutbadger/impl/ZukHomeBadger.java:
--------------------------------------------------------------------------------
1 | package me.leolin.shortcutbadger.impl;
2 |
3 | import android.annotation.TargetApi;
4 | import android.content.ComponentName;
5 | import android.content.Context;
6 | import android.net.Uri;
7 | import android.os.Build;
8 | import android.os.Bundle;
9 |
10 | import java.util.Collections;
11 | import java.util.List;
12 |
13 | import me.leolin.shortcutbadger.Badger;
14 | import me.leolin.shortcutbadger.ShortcutBadgeException;
15 |
16 | /**
17 | * Created by wuxuejian on 2016/10/9.
18 | * 需在设置 -- 通知和状态栏 -- 应用角标管理 中开启应用
19 | */
20 |
21 | public class ZukHomeBadger implements Badger {
22 |
23 | private final Uri CONTENT_URI = Uri.parse("content://com.android.badge/badge");
24 |
25 | @TargetApi(Build.VERSION_CODES.HONEYCOMB)
26 | @Override
27 | public void executeBadge(Context context, ComponentName componentName, int badgeCount) throws ShortcutBadgeException {
28 | Bundle extra = new Bundle();
29 | extra.putInt("app_badge_count", badgeCount);
30 | context.getContentResolver().call(CONTENT_URI, "setAppBadgeCount", null, extra);
31 | }
32 |
33 | @Override
34 | public List getSupportLaunchers() {
35 | return Collections.singletonList("com.zui.launcher");
36 | }
37 | }
38 |
--------------------------------------------------------------------------------
/android/lib/src/main/java/me/leolin/shortcutbadger/util/BroadcastHelper.java:
--------------------------------------------------------------------------------
1 | package me.leolin.shortcutbadger.util;
2 |
3 | import android.content.Context;
4 | import android.content.Intent;
5 | import android.content.pm.PackageManager;
6 | import android.content.pm.ResolveInfo;
7 |
8 | import java.util.List;
9 |
10 | /**
11 | * Created by mahijazi on 17/05/16.
12 | */
13 | public class BroadcastHelper {
14 | public static boolean canResolveBroadcast(Context context, Intent intent) {
15 | PackageManager packageManager = context.getPackageManager();
16 | List receivers = packageManager.queryBroadcastReceivers(intent, 0);
17 | return receivers != null && receivers.size() > 0;
18 | }
19 | }
20 |
--------------------------------------------------------------------------------
/android/lib/src/main/java/me/leolin/shortcutbadger/util/CloseHelper.java:
--------------------------------------------------------------------------------
1 | package me.leolin.shortcutbadger.util;
2 |
3 | import android.database.Cursor;
4 |
5 | import java.io.Closeable;
6 | import java.io.IOException;
7 |
8 | /**
9 | * @author leolin
10 | */
11 | public class CloseHelper {
12 |
13 | public static void close(Cursor cursor) {
14 | if (cursor != null && !cursor.isClosed()) {
15 | cursor.close();
16 | }
17 | }
18 |
19 |
20 | public static void closeQuietly(Closeable closeable) {
21 | try {
22 | if (closeable != null) {
23 | closeable.close();
24 | }
25 | } catch (IOException var2) {
26 |
27 | }
28 | }
29 | }
30 |
--------------------------------------------------------------------------------
/android/lib/src/main/res/drawable-xhdpi/app_icon.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/freshplanet/ANE-Push-Notification/b8488a96e084ea558f26a24469d6f64dc9b2113b/android/lib/src/main/res/drawable-xhdpi/app_icon.png
--------------------------------------------------------------------------------
/android/lib/src/main/res/drawable-xhdpi/icon72.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/freshplanet/ANE-Push-Notification/b8488a96e084ea558f26a24469d6f64dc9b2113b/android/lib/src/main/res/drawable-xhdpi/icon72.png
--------------------------------------------------------------------------------
/android/lib/src/main/res/drawable-xhdpi/status_icon.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/freshplanet/ANE-Push-Notification/b8488a96e084ea558f26a24469d6f64dc9b2113b/android/lib/src/main/res/drawable-xhdpi/status_icon.png
--------------------------------------------------------------------------------
/android/lib/src/main/res/drawable-xhdpi/status_icon24.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/freshplanet/ANE-Push-Notification/b8488a96e084ea558f26a24469d6f64dc9b2113b/android/lib/src/main/res/drawable-xhdpi/status_icon24.png
--------------------------------------------------------------------------------
/android/lib/src/main/res/layout/bannernotificationcontentview.xml:
--------------------------------------------------------------------------------
1 |
2 |
7 |
8 |
14 |
15 |
--------------------------------------------------------------------------------
/android/lib/src/main/res/layout/bigcontentview.xml:
--------------------------------------------------------------------------------
1 |
2 |
7 |
8 |
14 |
15 |
20 |
21 |
22 |
31 |
32 |
41 |
42 |
43 |
52 |
53 |
61 |
62 |
--------------------------------------------------------------------------------
/android/lib/src/main/res/layout/contentview.xml:
--------------------------------------------------------------------------------
1 |
2 |
6 |
7 |
14 |
15 |
23 |
24 |
35 |
36 |
45 |
46 |
54 |
55 |
--------------------------------------------------------------------------------
/android/lib/src/main/res/layout/inflatelayout.xml:
--------------------------------------------------------------------------------
1 |
2 |
10 |
11 |
18 |
19 |
27 |
--------------------------------------------------------------------------------
/android/lib/src/main/res/values/push_colors.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | - #FF2DA9F9
4 |
--------------------------------------------------------------------------------
/android/lib/src/main/res/values/push_styles.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
7 |
8 |
12 |
13 |
19 |
20 |
24 |
25 |
29 |
33 |
34 |
--------------------------------------------------------------------------------
/android/settings.gradle:
--------------------------------------------------------------------------------
1 | include ':lib'
--------------------------------------------------------------------------------
/bin/AirPushNotification.ane:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/freshplanet/ANE-Push-Notification/b8488a96e084ea558f26a24469d6f64dc9b2113b/bin/AirPushNotification.ane
--------------------------------------------------------------------------------
/bin/AirPushNotification_multiMsg.ane:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/freshplanet/ANE-Push-Notification/b8488a96e084ea558f26a24469d6f64dc9b2113b/bin/AirPushNotification_multiMsg.ane
--------------------------------------------------------------------------------
/build/ant-contrib-0.6.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/freshplanet/ANE-Push-Notification/b8488a96e084ea558f26a24469d6f64dc9b2113b/build/ant-contrib-0.6.jar
--------------------------------------------------------------------------------
/build/example.build.config:
--------------------------------------------------------------------------------
1 | name = AirPushNotification
2 | useMultiMsg = false
3 | air.sdk.home = /path/to/your/air/sdk
4 | android.sdk.home = /path/to/your/android/sdk
5 | ios.res = /path/to/your/notification/assets
6 | include.res = true
--------------------------------------------------------------------------------
/build/extension.xml:
--------------------------------------------------------------------------------
1 |
18 |
19 |
20 | com.freshplanet.ane.AirPushNotification
21 | 2.0.0
22 |
23 |
24 |
25 |
26 | libAirPushNotification.a
27 | AirPushNotificationInitializer
28 | AirPushNotificationFinalizer
29 |
30 |
31 |
32 |
33 |
34 | AirPushNotificationMac.framework
35 | AirPushNotificationInitializer
36 | AirPushNotificationFinalizer
37 |
38 |
39 |
40 |
41 |
42 | libAirPushNotification.jar
43 | com.freshplanet.ane.AirPushNotification.Extension
44 | com.freshplanet.ane.AirPushNotification.Extension
45 |
46 |
47 |
48 |
49 |
50 | libAirPushNotification.jar
51 | com.freshplanet.ane.AirPushNotification.Extension
52 | com.freshplanet.ane.AirPushNotification.Extension
53 |
54 |
55 |
56 |
57 |
58 | libAirPushNotification.jar
59 | com.freshplanet.ane.AirPushNotification.Extension
60 | com.freshplanet.ane.AirPushNotification.Extension
61 |
62 |
63 |
64 |
65 |
66 |
67 |
68 |
69 |
--------------------------------------------------------------------------------
/build/platform-android.xml:
--------------------------------------------------------------------------------
1 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 | firebase-messaging-23.1.2.jar
43 | play-services-cloud-messaging-17.0.1.jar
44 |
45 |
46 |
47 |
48 |
49 |
50 |
51 |
52 |
53 |
54 |
55 |
56 |
57 |
58 |
59 |
60 |
61 |
62 |
63 |
64 |
65 |
66 |
67 |
68 |
69 |
70 |
71 | com.freshplanet.ane.AirPushNotification
72 | airpushnotif-res
73 |
74 |
75 |
--------------------------------------------------------------------------------
/build/platform-ios.xml:
--------------------------------------------------------------------------------
1 |
18 |
19 |
20 | 11.0
21 |
22 |
23 |
24 |
--------------------------------------------------------------------------------
/ios/AirPushNotification.xcodeproj/project.xcworkspace/contents.xcworkspacedata:
--------------------------------------------------------------------------------
1 |
2 |
4 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/ios/AirPushNotification.xcodeproj/xcshareddata/xcschemes/AirPushNotificationMac.xcscheme:
--------------------------------------------------------------------------------
1 |
2 |
5 |
8 |
9 |
15 |
21 |
22 |
23 |
24 |
25 |
30 |
31 |
32 |
33 |
43 |
44 |
50 |
51 |
57 |
58 |
59 |
60 |
62 |
63 |
66 |
67 |
68 |
--------------------------------------------------------------------------------
/ios/AirPushNotification.xcworkspace/contents.xcworkspacedata:
--------------------------------------------------------------------------------
1 |
2 |
4 |
6 |
7 |
9 |
10 |
11 |
--------------------------------------------------------------------------------
/ios/AirPushNotification/AirPushNotification.h:
--------------------------------------------------------------------------------
1 | /**
2 | * Copyright 2017 FreshPlanet
3 | * Licensed under the Apache License, Version 2.0 (the "License");
4 | * you may not use this file except in compliance with the License.
5 | * You may obtain a copy of the License at
6 | *
7 | * http://www.apache.org/licenses/LICENSE-2.0
8 | *
9 | * Unless required by applicable law or agreed to in writing, software
10 | * distributed under the License is distributed on an "AS IS" BASIS,
11 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | * See the License for the specific language governing permissions and
13 | * limitations under the License.
14 | */
15 | #include
16 | #import
17 | #if TARGET_OS_IPHONE
18 | #import
19 | #elif TARGET_OS_OSX
20 | #import
21 | #import
22 | #endif
23 | #import "FlashRuntimeExtensions.h"
24 |
25 |
26 |
27 | static NSString* const storedNotifTrackingUrl = @"storedNotifTrackingUrl";
28 |
29 | #if TARGET_OS_IPHONE
30 | @interface AirPushNotification : NSObject {
31 | FREContext _context;
32 | }
33 | #elif TARGET_OS_OSX
34 | @interface AirPushNotification : NSObject {
35 | FREContext _context;
36 | }
37 | #endif
38 |
39 | + (AirPushNotification*)instance;
40 | + (NSString*)convertToJSonString:(NSDictionary*)dict;
41 |
42 | - (BOOL) isInitialized;
43 | #if TARGET_OS_IPHONE
44 | - (void)trackRemoteNofiticationFromApp:(UIApplication*)app andUserInfo:(NSDictionary*)userInfo;
45 | #elif TARGET_OS_OSX
46 | - (void)trackRemoteNofiticationFromApp:(NSApplication*)app andUserInfo:(NSDictionary*)userInfo;
47 | #endif
48 | - (void)sendEvent:(NSString*)code;
49 | - (void)sendLog:(NSString*)log;
50 | - (void)sendEvent:(NSString*)code level:(NSString*)level;
51 |
52 |
53 | @end
54 |
55 | void AirPushNotificationContextInitializer(void* extData, const uint8_t* ctxType, FREContext ctx, uint32_t* numFunctionsToTest, const FRENamedFunction** functionsToSet);
56 | void AirPushNotificationContextFinalizer(FREContext ctx);
57 | void AirPushNotificationInitializer(void** extDataToSet, FREContextInitializer* ctxInitializerToSet, FREContextFinalizer* ctxFinalizerToSet);
58 | void AirPushNotificationFinalizer(void *extData);
59 |
60 |
--------------------------------------------------------------------------------
/ios/AirPushNotification/NotifCenterDelegate.h:
--------------------------------------------------------------------------------
1 | /**
2 | * Copyright 2017 FreshPlanet
3 | * Licensed under the Apache License, Version 2.0 (the "License");
4 | * you may not use this file except in compliance with the License.
5 | * You may obtain a copy of the License at
6 | *
7 | * http://www.apache.org/licenses/LICENSE-2.0
8 | *
9 | * Unless required by applicable law or agreed to in writing, software
10 | * distributed under the License is distributed on an "AS IS" BASIS,
11 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | * See the License for the specific language governing permissions and
13 | * limitations under the License.
14 | */
15 |
16 | #include
17 | #if TARGET_OS_IPHONE
18 | #import
19 | #elif TARGET_OS_OSX
20 | #import
21 | #import
22 | #endif
23 | #import
24 |
25 | @interface NotifCenterDelegate : NSObject
26 | @property(nonatomic, strong) NSDictionary* starterNotif;
27 | @property(nonatomic, assign) BOOL pendingOpenAppNotificationSettings;
28 |
29 | - (void)userNotificationCenter:(UNUserNotificationCenter *)center didReceiveNotificationResponse:(UNNotificationResponse *)response
30 | withCompletionHandler:(void (^)(void))completionHandler;
31 |
32 | - (void)userNotificationCenter:(UNUserNotificationCenter *)center willPresentNotification:(UNNotification *)notification withCompletionHandler:(void (^)(UNNotificationPresentationOptions))completionHandler;
33 |
34 | -(void)userNotificationCenter:(UNUserNotificationCenter *)center openSettingsForNotification:(UNNotification *)notification;
35 |
36 |
37 | @end
38 |
--------------------------------------------------------------------------------
/ios/AirPushNotification/NotifCenterDelegate.m:
--------------------------------------------------------------------------------
1 | /**
2 | * Copyright 2017 FreshPlanet
3 | * Licensed under the Apache License, Version 2.0 (the "License");
4 | * you may not use this file except in compliance with the License.
5 | * You may obtain a copy of the License at
6 | *
7 | * http://www.apache.org/licenses/LICENSE-2.0
8 | *
9 | * Unless required by applicable law or agreed to in writing, software
10 | * distributed under the License is distributed on an "AS IS" BASIS,
11 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | * See the License for the specific language governing permissions and
13 | * limitations under the License.
14 | */
15 |
16 | #import "NotifCenterDelegate.h"
17 | #import "AirPushNotification.h"
18 |
19 | @interface NotifCenterDelegate()
20 | @end
21 |
22 | @implementation NotifCenterDelegate
23 |
24 | - (void)userNotificationCenter:(UNUserNotificationCenter *)center didReceiveNotificationResponse:(UNNotificationResponse *)response
25 | withCompletionHandler:(void (^)(void))completionHandler {
26 | NSDictionary * notifDict = response.notification.request.content.userInfo;
27 |
28 | NSLog(@"MATEO userNotificationCenter didReceiveNotificationResponse");
29 | if ([[AirPushNotification instance] isInitialized]) {
30 | // we can dispatch an event
31 | #if TARGET_OS_IPHONE
32 | [[AirPushNotification instance] trackRemoteNofiticationFromApp:[UIApplication sharedApplication] andUserInfo:notifDict];
33 | #elif TARGET_OS_OSX
34 | [[AirPushNotification instance] trackRemoteNofiticationFromApp:[NSApplication sharedApplication] andUserInfo:notifDict];
35 | #endif
36 |
37 | } else {
38 | // wait for it to be fetched
39 | self.starterNotif = notifDict;
40 | }
41 |
42 |
43 | // dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(5 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
44 | // // handle the UNNotificationResponse
45 | // NSLog(@"MATEO userNotificationCenter didReceiveNotificationResponse completing after delay");
46 | // completionHandler();
47 | // });
48 | completionHandler();
49 |
50 |
51 | }
52 |
53 | - (void)userNotificationCenter:(UNUserNotificationCenter *)center
54 | willPresentNotification:(UNNotification *)notification
55 | withCompletionHandler:(void (^)(UNNotificationPresentationOptions options))completionHandler
56 | {
57 |
58 | NSLog(@"MATEO userNotificationCenter willPresentNotification");
59 | if ([[AirPushNotification instance] isInitialized]) {
60 | #if TARGET_OS_IPHONE
61 | [[AirPushNotification instance] trackRemoteNofiticationFromApp:[UIApplication sharedApplication] andUserInfo:notification.request.content.userInfo];
62 | #elif TARGET_OS_OSX
63 | [[AirPushNotification instance] trackRemoteNofiticationFromApp:[NSApplication sharedApplication] andUserInfo:notification.request.content.userInfo];
64 | #endif
65 |
66 | }
67 |
68 | completionHandler(UNNotificationPresentationOptionNone);
69 | }
70 |
71 | -(void)userNotificationCenter:(UNUserNotificationCenter *)center openSettingsForNotification:(UNNotification *)notification {
72 |
73 | if ([[AirPushNotification instance] isInitialized]) {
74 | // we can dispatch an event
75 | self.pendingOpenAppNotificationSettings = false;
76 | [[AirPushNotification instance] sendEvent:@"OPEN_APP_NOTIFICATION_SETTINGS"];
77 | } else {
78 | // wait for ane initialized
79 | self.pendingOpenAppNotificationSettings = true;
80 | }
81 | }
82 |
83 |
84 | @end
85 |
--------------------------------------------------------------------------------
/ios/AirPushNotificationMac/Info.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | CFBundleDevelopmentRegion
6 | $(DEVELOPMENT_LANGUAGE)
7 | CFBundleExecutable
8 | $(EXECUTABLE_NAME)
9 | CFBundleIdentifier
10 | $(PRODUCT_BUNDLE_IDENTIFIER)
11 | CFBundleInfoDictionaryVersion
12 | 6.0
13 | CFBundleName
14 | $(PRODUCT_NAME)
15 | CFBundlePackageType
16 | $(PRODUCT_BUNDLE_PACKAGE_TYPE)
17 | CFBundleShortVersionString
18 | 1.0
19 | CFBundleVersion
20 | $(CURRENT_PROJECT_VERSION)
21 | NSHumanReadableCopyright
22 | Copyright © 2021 Freshplanet, Inc. All rights reserved.
23 |
24 |
25 |
--------------------------------------------------------------------------------
/ios/Podfile:
--------------------------------------------------------------------------------
1 | source 'https://github.com/CocoaPods/Specs.git'
2 | platform :ios, '10.0'
3 |
4 | target 'AirPushNotification' do
5 | end
6 |
--------------------------------------------------------------------------------
/ios/Podfile.lock:
--------------------------------------------------------------------------------
1 | PODFILE CHECKSUM: 782bc6a46eb69c6f1b88ce9f6c856f24aca52952
2 |
3 | COCOAPODS: 1.5.3
4 |
--------------------------------------------------------------------------------
/ios/Pods/Manifest.lock:
--------------------------------------------------------------------------------
1 | PODFILE CHECKSUM: 782bc6a46eb69c6f1b88ce9f6c856f24aca52952
2 |
3 | COCOAPODS: 1.5.3
4 |
--------------------------------------------------------------------------------
/ios/Pods/Target Support Files/Pods-AirPushNotification/Pods-AirPushNotification-acknowledgements.markdown:
--------------------------------------------------------------------------------
1 | # Acknowledgements
2 | This application makes use of the following third party libraries:
3 | Generated by CocoaPods - https://cocoapods.org
4 |
--------------------------------------------------------------------------------
/ios/Pods/Target Support Files/Pods-AirPushNotification/Pods-AirPushNotification-acknowledgements.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | PreferenceSpecifiers
6 |
7 |
8 | FooterText
9 | This application makes use of the following third party libraries:
10 | Title
11 | Acknowledgements
12 | Type
13 | PSGroupSpecifier
14 |
15 |
16 | FooterText
17 | Generated by CocoaPods - https://cocoapods.org
18 | Title
19 |
20 | Type
21 | PSGroupSpecifier
22 |
23 |
24 | StringsTable
25 | Acknowledgements
26 | Title
27 | Acknowledgements
28 |
29 |
30 |
--------------------------------------------------------------------------------
/ios/Pods/Target Support Files/Pods-AirPushNotification/Pods-AirPushNotification-dummy.m:
--------------------------------------------------------------------------------
1 | #import
2 | @interface PodsDummy_Pods_AirPushNotification : NSObject
3 | @end
4 | @implementation PodsDummy_Pods_AirPushNotification
5 | @end
6 |
--------------------------------------------------------------------------------
/ios/Pods/Target Support Files/Pods-AirPushNotification/Pods-AirPushNotification-frameworks.sh:
--------------------------------------------------------------------------------
1 | #!/bin/sh
2 | set -e
3 |
4 | echo "mkdir -p ${CONFIGURATION_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}"
5 | mkdir -p "${CONFIGURATION_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}"
6 |
7 | SWIFT_STDLIB_PATH="${DT_TOOLCHAIN_DIR}/usr/lib/swift/${PLATFORM_NAME}"
8 |
9 | install_framework()
10 | {
11 | if [ -r "${BUILT_PRODUCTS_DIR}/$1" ]; then
12 | local source="${BUILT_PRODUCTS_DIR}/$1"
13 | elif [ -r "${BUILT_PRODUCTS_DIR}/$(basename "$1")" ]; then
14 | local source="${BUILT_PRODUCTS_DIR}/$(basename "$1")"
15 | elif [ -r "$1" ]; then
16 | local source="$1"
17 | fi
18 |
19 | local destination="${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}"
20 |
21 | if [ -L "${source}" ]; then
22 | echo "Symlinked..."
23 | source="$(readlink "${source}")"
24 | fi
25 |
26 | # use filter instead of exclude so missing patterns dont' throw errors
27 | echo "rsync -av --filter \"- CVS/\" --filter \"- .svn/\" --filter \"- .git/\" --filter \"- .hg/\" --filter \"- Headers\" --filter \"- PrivateHeaders\" --filter \"- Modules\" \"${source}\" \"${destination}\""
28 | rsync -av --filter "- CVS/" --filter "- .svn/" --filter "- .git/" --filter "- .hg/" --filter "- Headers" --filter "- PrivateHeaders" --filter "- Modules" "${source}" "${destination}"
29 |
30 | local basename
31 | basename="$(basename -s .framework "$1")"
32 | binary="${destination}/${basename}.framework/${basename}"
33 | if ! [ -r "$binary" ]; then
34 | binary="${destination}/${basename}"
35 | fi
36 |
37 | # Strip invalid architectures so "fat" simulator / device frameworks work on device
38 | if [[ "$(file "$binary")" == *"dynamically linked shared library"* ]]; then
39 | strip_invalid_archs "$binary"
40 | fi
41 |
42 | # Resign the code if required by the build settings to avoid unstable apps
43 | code_sign_if_enabled "${destination}/$(basename "$1")"
44 |
45 | # Embed linked Swift runtime libraries. No longer necessary as of Xcode 7.
46 | if [ "${XCODE_VERSION_MAJOR}" -lt 7 ]; then
47 | local swift_runtime_libs
48 | swift_runtime_libs=$(xcrun otool -LX "$binary" | grep --color=never @rpath/libswift | sed -E s/@rpath\\/\(.+dylib\).*/\\1/g | uniq -u && exit ${PIPESTATUS[0]})
49 | for lib in $swift_runtime_libs; do
50 | echo "rsync -auv \"${SWIFT_STDLIB_PATH}/${lib}\" \"${destination}\""
51 | rsync -auv "${SWIFT_STDLIB_PATH}/${lib}" "${destination}"
52 | code_sign_if_enabled "${destination}/${lib}"
53 | done
54 | fi
55 | }
56 |
57 | # Signs a framework with the provided identity
58 | code_sign_if_enabled() {
59 | if [ -n "${EXPANDED_CODE_SIGN_IDENTITY}" -a "${CODE_SIGNING_REQUIRED}" != "NO" -a "${CODE_SIGNING_ALLOWED}" != "NO" ]; then
60 | # Use the current code_sign_identitiy
61 | echo "Code Signing $1 with Identity ${EXPANDED_CODE_SIGN_IDENTITY_NAME}"
62 | local code_sign_cmd="/usr/bin/codesign --force --sign ${EXPANDED_CODE_SIGN_IDENTITY} ${OTHER_CODE_SIGN_FLAGS} --preserve-metadata=identifier,entitlements '$1'"
63 |
64 | if [ "${COCOAPODS_PARALLEL_CODE_SIGN}" == "true" ]; then
65 | code_sign_cmd="$code_sign_cmd &"
66 | fi
67 | echo "$code_sign_cmd"
68 | eval "$code_sign_cmd"
69 | fi
70 | }
71 |
72 | # Strip invalid architectures
73 | strip_invalid_archs() {
74 | binary="$1"
75 | # Get architectures for current file
76 | archs="$(lipo -info "$binary" | rev | cut -d ':' -f1 | rev)"
77 | stripped=""
78 | for arch in $archs; do
79 | if ! [[ "${VALID_ARCHS}" == *"$arch"* ]]; then
80 | # Strip non-valid architectures in-place
81 | lipo -remove "$arch" -output "$binary" "$binary" || exit 1
82 | stripped="$stripped $arch"
83 | fi
84 | done
85 | if [[ "$stripped" ]]; then
86 | echo "Stripped $binary of architectures:$stripped"
87 | fi
88 | }
89 |
90 | if [ "${COCOAPODS_PARALLEL_CODE_SIGN}" == "true" ]; then
91 | wait
92 | fi
93 |
--------------------------------------------------------------------------------
/ios/Pods/Target Support Files/Pods-AirPushNotification/Pods-AirPushNotification-resources.sh:
--------------------------------------------------------------------------------
1 | #!/bin/sh
2 | set -e
3 | set -u
4 | set -o pipefail
5 |
6 | if [ -z ${UNLOCALIZED_RESOURCES_FOLDER_PATH+x} ]; then
7 | # If UNLOCALIZED_RESOURCES_FOLDER_PATH is not set, then there's nowhere for us to copy
8 | # resources to, so exit 0 (signalling the script phase was successful).
9 | exit 0
10 | fi
11 |
12 | mkdir -p "${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}"
13 |
14 | RESOURCES_TO_COPY=${PODS_ROOT}/resources-to-copy-${TARGETNAME}.txt
15 | > "$RESOURCES_TO_COPY"
16 |
17 | XCASSET_FILES=()
18 |
19 | # This protects against multiple targets copying the same framework dependency at the same time. The solution
20 | # was originally proposed here: https://lists.samba.org/archive/rsync/2008-February/020158.html
21 | RSYNC_PROTECT_TMP_FILES=(--filter "P .*.??????")
22 |
23 | case "${TARGETED_DEVICE_FAMILY:-}" in
24 | 1,2)
25 | TARGET_DEVICE_ARGS="--target-device ipad --target-device iphone"
26 | ;;
27 | 1)
28 | TARGET_DEVICE_ARGS="--target-device iphone"
29 | ;;
30 | 2)
31 | TARGET_DEVICE_ARGS="--target-device ipad"
32 | ;;
33 | 3)
34 | TARGET_DEVICE_ARGS="--target-device tv"
35 | ;;
36 | 4)
37 | TARGET_DEVICE_ARGS="--target-device watch"
38 | ;;
39 | *)
40 | TARGET_DEVICE_ARGS="--target-device mac"
41 | ;;
42 | esac
43 |
44 | install_resource()
45 | {
46 | if [[ "$1" = /* ]] ; then
47 | RESOURCE_PATH="$1"
48 | else
49 | RESOURCE_PATH="${PODS_ROOT}/$1"
50 | fi
51 | if [[ ! -e "$RESOURCE_PATH" ]] ; then
52 | cat << EOM
53 | error: Resource "$RESOURCE_PATH" not found. Run 'pod install' to update the copy resources script.
54 | EOM
55 | exit 1
56 | fi
57 | case $RESOURCE_PATH in
58 | *.storyboard)
59 | echo "ibtool --reference-external-strings-file --errors --warnings --notices --minimum-deployment-target ${!DEPLOYMENT_TARGET_SETTING_NAME} --output-format human-readable-text --compile ${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename \"$RESOURCE_PATH\" .storyboard`.storyboardc $RESOURCE_PATH --sdk ${SDKROOT} ${TARGET_DEVICE_ARGS}" || true
60 | ibtool --reference-external-strings-file --errors --warnings --notices --minimum-deployment-target ${!DEPLOYMENT_TARGET_SETTING_NAME} --output-format human-readable-text --compile "${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename \"$RESOURCE_PATH\" .storyboard`.storyboardc" "$RESOURCE_PATH" --sdk "${SDKROOT}" ${TARGET_DEVICE_ARGS}
61 | ;;
62 | *.xib)
63 | echo "ibtool --reference-external-strings-file --errors --warnings --notices --minimum-deployment-target ${!DEPLOYMENT_TARGET_SETTING_NAME} --output-format human-readable-text --compile ${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename \"$RESOURCE_PATH\" .xib`.nib $RESOURCE_PATH --sdk ${SDKROOT} ${TARGET_DEVICE_ARGS}" || true
64 | ibtool --reference-external-strings-file --errors --warnings --notices --minimum-deployment-target ${!DEPLOYMENT_TARGET_SETTING_NAME} --output-format human-readable-text --compile "${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename \"$RESOURCE_PATH\" .xib`.nib" "$RESOURCE_PATH" --sdk "${SDKROOT}" ${TARGET_DEVICE_ARGS}
65 | ;;
66 | *.framework)
67 | echo "mkdir -p ${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}" || true
68 | mkdir -p "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}"
69 | echo "rsync --delete -av "${RSYNC_PROTECT_TMP_FILES[@]}" $RESOURCE_PATH ${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}" || true
70 | rsync --delete -av "${RSYNC_PROTECT_TMP_FILES[@]}" "$RESOURCE_PATH" "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}"
71 | ;;
72 | *.xcdatamodel)
73 | echo "xcrun momc \"$RESOURCE_PATH\" \"${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename "$RESOURCE_PATH"`.mom\"" || true
74 | xcrun momc "$RESOURCE_PATH" "${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename "$RESOURCE_PATH" .xcdatamodel`.mom"
75 | ;;
76 | *.xcdatamodeld)
77 | echo "xcrun momc \"$RESOURCE_PATH\" \"${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename "$RESOURCE_PATH" .xcdatamodeld`.momd\"" || true
78 | xcrun momc "$RESOURCE_PATH" "${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename "$RESOURCE_PATH" .xcdatamodeld`.momd"
79 | ;;
80 | *.xcmappingmodel)
81 | echo "xcrun mapc \"$RESOURCE_PATH\" \"${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename "$RESOURCE_PATH" .xcmappingmodel`.cdm\"" || true
82 | xcrun mapc "$RESOURCE_PATH" "${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename "$RESOURCE_PATH" .xcmappingmodel`.cdm"
83 | ;;
84 | *.xcassets)
85 | ABSOLUTE_XCASSET_FILE="$RESOURCE_PATH"
86 | XCASSET_FILES+=("$ABSOLUTE_XCASSET_FILE")
87 | ;;
88 | *)
89 | echo "$RESOURCE_PATH" || true
90 | echo "$RESOURCE_PATH" >> "$RESOURCES_TO_COPY"
91 | ;;
92 | esac
93 | }
94 |
95 | mkdir -p "${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}"
96 | rsync -avr --copy-links --no-relative --exclude '*/.svn/*' --files-from="$RESOURCES_TO_COPY" / "${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}"
97 | if [[ "${ACTION}" == "install" ]] && [[ "${SKIP_INSTALL}" == "NO" ]]; then
98 | mkdir -p "${INSTALL_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}"
99 | rsync -avr --copy-links --no-relative --exclude '*/.svn/*' --files-from="$RESOURCES_TO_COPY" / "${INSTALL_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}"
100 | fi
101 | rm -f "$RESOURCES_TO_COPY"
102 |
103 | if [[ -n "${WRAPPER_EXTENSION}" ]] && [ "`xcrun --find actool`" ] && [ -n "${XCASSET_FILES:-}" ]
104 | then
105 | # Find all other xcassets (this unfortunately includes those of path pods and other targets).
106 | OTHER_XCASSETS=$(find "$PWD" -iname "*.xcassets" -type d)
107 | while read line; do
108 | if [[ $line != "${PODS_ROOT}*" ]]; then
109 | XCASSET_FILES+=("$line")
110 | fi
111 | done <<<"$OTHER_XCASSETS"
112 |
113 | if [ -z ${ASSETCATALOG_COMPILER_APPICON_NAME+x} ]; then
114 | printf "%s\0" "${XCASSET_FILES[@]}" | xargs -0 xcrun actool --output-format human-readable-text --notices --warnings --platform "${PLATFORM_NAME}" --minimum-deployment-target "${!DEPLOYMENT_TARGET_SETTING_NAME}" ${TARGET_DEVICE_ARGS} --compress-pngs --compile "${BUILT_PRODUCTS_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}"
115 | else
116 | printf "%s\0" "${XCASSET_FILES[@]}" | xargs -0 xcrun actool --output-format human-readable-text --notices --warnings --platform "${PLATFORM_NAME}" --minimum-deployment-target "${!DEPLOYMENT_TARGET_SETTING_NAME}" ${TARGET_DEVICE_ARGS} --compress-pngs --compile "${BUILT_PRODUCTS_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}" --app-icon "${ASSETCATALOG_COMPILER_APPICON_NAME}" --output-partial-info-plist "${TARGET_TEMP_DIR}/assetcatalog_generated_info_cocoapods.plist"
117 | fi
118 | fi
119 |
--------------------------------------------------------------------------------
/ios/Pods/Target Support Files/Pods-AirPushNotification/Pods-AirPushNotification.debug.xcconfig:
--------------------------------------------------------------------------------
1 | GCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1
2 | OTHER_LDFLAGS = $(inherited) -ObjC
3 | PODS_BUILD_DIR = ${BUILD_DIR}
4 | PODS_CONFIGURATION_BUILD_DIR = ${PODS_BUILD_DIR}/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME)
5 | PODS_PODFILE_DIR_PATH = ${SRCROOT}/.
6 | PODS_ROOT = ${SRCROOT}/Pods
7 |
--------------------------------------------------------------------------------
/ios/Pods/Target Support Files/Pods-AirPushNotification/Pods-AirPushNotification.release.xcconfig:
--------------------------------------------------------------------------------
1 | GCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1
2 | OTHER_LDFLAGS = $(inherited) -ObjC
3 | PODS_BUILD_DIR = ${BUILD_DIR}
4 | PODS_CONFIGURATION_BUILD_DIR = ${PODS_BUILD_DIR}/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME)
5 | PODS_PODFILE_DIR_PATH = ${SRCROOT}/.
6 | PODS_ROOT = ${SRCROOT}/Pods
7 |
--------------------------------------------------------------------------------