feat(mobile): custom release store file and bind alias with native modules

pull/90/head
moonrailgun 2 years ago
parent 0aa17081ea
commit e0289988d5

@ -1,3 +1,8 @@
TAILCHAT_UPLOAD_STORE_FILE=
TAILCHAT_UPLOAD_STORE_PASSWORD=
TAILCHAT_UPLOAD_KEY_ALIAS=
TAILCHAT_UPLOAD_KEY_PASSWORD=
GETUI_APPID=
GETUI_APPKEY=
GETUI_APPSECRET=

@ -132,10 +132,17 @@ android {
}
signingConfigs {
debug {
storeFile file('debug.keystore')
storePassword 'android'
keyAlias 'androiddebugkey'
keyPassword 'android'
if (project.env.get('TAILCHAT_UPLOAD_STORE_FILE')) {
storeFile file(project.env.get('TAILCHAT_UPLOAD_STORE_FILE'))
storePassword project.env.get('TAILCHAT_UPLOAD_STORE_PASSWORD')
keyAlias project.env.get('TAILCHAT_UPLOAD_KEY_ALIAS')
keyPassword project.env.get('TAILCHAT_UPLOAD_KEY_PASSWORD')
} else {
storeFile file('debug.keystore')
storePassword 'android'
keyAlias 'androiddebugkey'
keyPassword 'android'
}
}
}
buildTypes {
@ -194,6 +201,16 @@ dependencies {
// Push
implementation 'com.getui:gtsdk:3.2.15.0' //SDK
implementation 'com.getui:gtc:3.2.1.0' //
//
implementation 'com.getui.opt:hwp:3.1.1' //
// implementation 'com.getui.opt:xmp:3.3.0' //
// implementation 'com.assist-v3:oppo:3.3.0' // oppo
// implementation 'com.assist-v3:vivo:3.1.1' // vivo
// implementation 'com.getui.opt:mzp:3.2.2' //
// implementation 'com.getui.opt:ups:3.0.3' // upsups
// implementation 'com.getui.opt:honor:3.3.0' // 耀
implementation 'com.huawei.hms:push:6.9.0.300'
}

@ -0,0 +1,37 @@
package com.msgbyte.tailchat;
import com.facebook.react.ReactPackage;
import com.facebook.react.bridge.JavaScriptModule;
import com.facebook.react.bridge.NativeModule;
import com.facebook.react.bridge.ReactApplicationContext;
import com.facebook.react.uimanager.ViewManager;
import java.util.Arrays;
import java.util.Collections;
import java.util.List;
public class GetuiPackage implements ReactPackage {
public GetuiPackage(boolean logEnable) {
GetuiLogger.ENABLE = logEnable;
}
public GetuiPackage(){
GetuiLogger.ENABLE = true;
}
@Override
public List<NativeModule> createNativeModules(ReactApplicationContext reactContext) {
return Arrays.asList(new NativeModule[]{
new GetuiModule(reactContext)
});
}
public List<Class<? extends JavaScriptModule>> createJSModules() {
return Collections.emptyList();
}
@Override
public List<ViewManager> createViewManagers(ReactApplicationContext reactContext) {
return Collections.emptyList();
}
}

@ -24,7 +24,7 @@ public class MainApplication extends Application implements ReactApplication {
@SuppressWarnings("UnnecessaryLocalVariable")
List<ReactPackage> packages = new PackageList(this).getPackages();
// Packages that cannot be autolinked yet can be added manually here, for example:
// packages.add(new MyReactNativePackage());
packages.add(new GetuiPackage());
return packages;
}

@ -1,5 +1,4 @@
import { NativeModules, Platform } from 'react-native';
const GetuiModule = NativeModules.GetuiModule;
/**
@ -7,7 +6,18 @@ const GetuiModule = NativeModules.GetuiModule;
* user for server push
*/
export function bindAlias(userId: string) {
getClientId().then((cid) => {
console.log('getui cid:', cid);
});
if (Platform.OS === 'android') {
GetuiModule.bindAlias(userId);
GetuiModule.bindAlias(userId, '0');
}
}
export function getClientId() {
return new Promise<string>((resolve) => {
GetuiModule.clientId((param: string) => {
resolve(param);
});
});
}

@ -55,9 +55,10 @@ export async function initNotificationEnv(options: NotificationOptions) {
bindAlias(options.userId);
// 厂商渠道还没有ready, 推送需要依赖前台服务保活
await initForegroundService(options);
// await initForegroundService(options);
}
// eslint-disable-next-line @typescript-eslint/no-unused-vars
async function initForegroundService(options: NotificationOptions) {
notifee.registerForegroundService((_notification) => {
return new Promise(() => {

@ -1 +0,0 @@
declare module 'react-native-getui';
Loading…
Cancel
Save