View
@@ -0,0 +1,199 @@
+package de.tutao.tutanota.push;
+
+import android.app.Notification;
+import android.app.NotificationManager;
+import android.app.Service;
+import android.content.Context;
+import android.content.Intent;
+import android.media.RingtoneManager;
+import android.net.Uri;
+import android.os.Handler;
+import android.os.IBinder;
+import android.os.Looper;
+import android.text.TextUtils;
+import android.util.Log;
+
+import org.json.JSONArray;
+import org.json.JSONException;
+import org.json.JSONObject;
+
+import java.io.BufferedInputStream;
+import java.io.BufferedReader;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.InputStreamReader;
+import java.io.OutputStream;
+import java.io.UnsupportedEncodingException;
+import java.net.HttpURLConnection;
+import java.net.URL;
+import java.net.URLEncoder;
+import java.nio.charset.Charset;
+import java.util.Base64;
+import java.util.Collections;
+import java.util.Random;
+import java.util.concurrent.TimeUnit;
+import java.util.concurrent.atomic.AtomicReference;
+
+import de.tutao.tutanota.BuildConfig;
+import de.tutao.tutanota.Crypto;
+import de.tutao.tutanota.R;
+import de.tutao.tutanota.Utils;
+
+public class PushNotificationService extends Service {
+
+ private static final String TAG = "PushNotificationService";
+
+ private static final int NOTIFICATION_ID = 341;
+ private final LooperThread looperThread = new LooperThread(this::connect);
+ private final SseStorage sseStorage = new SseStorage(this);
+
+ final AtomicReference<HttpURLConnection> httpsURLConnectionRef = new AtomicReference<>(null);
+ private final Crypto crypto = new Crypto(this);
+ private SseInfo connectedSseInfo;
+
+ public PushNotificationService() {
+ }
+
+ @Override
+ public IBinder onBind(Intent intent) {
+ return null;
+ }
+
+ @Override
+ public int onStartCommand(Intent intent, int flags, int startId) {
+ Log.d(TAG, "Received start");
+ HttpURLConnection connection = httpsURLConnectionRef.get();
+ if (this.looperThread.isAlive()) {
+ Log.d(TAG, "Reconnect onStartCommand");
+ if (connection != null && this.connectedSseInfo != null && !this.connectedSseInfo.equals(sseStorage.getSseInfo())) {
+ connection.disconnect();
+ }else {
+ this.looperThread.getHandler().post(this::connect);
+ }
+ } else {
+ Log.d(TAG, "Starting looperThread");
+ looperThread.start();
+ }
+ return Service.START_STICKY;
+ }
+
+ private void connect() {
+ Log.d(TAG, "Starting SSE connection");
+ Random random = new Random();
+ BufferedReader reader = null;
+ SseInfo sseInfo = sseStorage.getSseInfo();
+ if (sseInfo == null) {
+ Log.d(TAG, "sse info not available skip reconnect");
+ return;
+ }
+ this.connectedSseInfo = sseInfo;
+ try {
+ URL url = new URL(sseInfo.getSseOrigin() + "/sse?_body=" + requestJson(sseInfo));
+ HttpURLConnection httpsURLConnection = (HttpURLConnection) url.openConnection();
+ this.httpsURLConnectionRef.set(httpsURLConnection);
+ httpsURLConnection.setRequestProperty("Content-Type", "application/json");
+ httpsURLConnection.setRequestProperty("Connection", "Keep-Alive");
+ httpsURLConnection.setRequestProperty("Keep-Alive", "header");
+ httpsURLConnection.setRequestProperty("Connection", "close");
+ httpsURLConnection.setRequestProperty("Accept", "text/event-stream");
+ httpsURLConnection.setRequestMethod("GET");
+ //httpsURLConnection.setConnectTimeout(70000);
+ httpsURLConnection.setReadTimeout((int) TimeUnit.SECONDS.toMillis(15));
+ InputStream inputStream = new BufferedInputStream(httpsURLConnection.getInputStream());
+ reader = new BufferedReader(new InputStreamReader(inputStream));
+ String event;
+ while ((event = reader.readLine()) != null) {
+ if (!event.startsWith("data: ")) {
+ continue;
+ }
+ event = event.substring(6);
+ if (event.matches("^[0-9]{1,}$"))
+ continue;
+
+ NotificationManager notificationManager =
+ (NotificationManager) getSystemService(Context.NOTIFICATION_SERVICE);
+
+ Uri notificatoinUri = RingtoneManager.getDefaultUri(RingtoneManager.TYPE_NOTIFICATION);
+
+ Notification notification = new Notification.Builder(this)
+ .setContentTitle(event)
+ .setSmallIcon(R.drawable.ic_status)
+ .setSound(notificatoinUri)
+ .setVibrate(new long[]{3000})
+ .build();
+ //noinspection ConstantConditions
+ notificationManager.notify(NOTIFICATION_ID, notification);
+ }
+ } catch (Exception ignored) {
+ HttpURLConnection httpURLConnection = httpsURLConnectionRef.get();
+ try {
+ // we get not authorized for the stored identifier and user ids, so remove them
+ if (httpURLConnection != null && httpURLConnection.getResponseCode() == 403) {
+ Log.e(TAG, "not authorized to connect, disable reconnect");
+ sseStorage.clear();
+ return;
+ }
+ } catch (IOException e) {
+ // ignore Exception when getting status code.
+ }
+ int delay = random.nextInt(15) + 15;
+ Log.e(TAG, "error opening sse, rescheduling after " + delay, ignored);
+ looperThread.getHandler().postDelayed(this::connect,
+ TimeUnit.SECONDS.toMillis(delay));
+ } finally {
+ if (reader != null) {
+ try {
+ reader.close();
+ } catch (IOException ignored) {
+ }
+ }
+ }
+ }
+
+ private String requestJson(SseInfo sseInfo) {
+ JSONObject jsonObject = new JSONObject();
+ try {
+ jsonObject.put("_format", "0");
+ jsonObject.put("identifier", sseInfo.getPushIdentifier());
+ JSONArray jsonArray = new JSONArray();
+ for (String userId : sseInfo.getUserIds()) {
+ JSONObject userIdObject = new JSONObject();
+ userIdObject.put("_id", generateId());
+ userIdObject.put("value", userId);
+ jsonArray.put(userIdObject);
+ }
+ jsonObject.put("userIds", jsonArray);
+ return URLEncoder.encode(jsonObject.toString(), "UTF-8");
+ } catch (JSONException | UnsupportedEncodingException e) {
+ throw new RuntimeException(e);
+ }
+ }
+
+ private String generateId() {
+ byte[] bytes = new byte[4];
+ crypto.getRandomizer().nextBytes(bytes);
+ return Utils.base64ToBase64Url(Utils.bytesToBase64(bytes));
+ }
+}
+
+class LooperThread extends Thread {
+
+ private Handler handler;
+ private Runnable initRunnable;
+
+ LooperThread(Runnable initRunnable) {
+ this.initRunnable = initRunnable;
+ }
+
+ @Override
+ public void run() {
+ Looper.prepare();
+ handler = new Handler();
+ handler.post(initRunnable);
+ Looper.loop();
+ }
+
+ public Handler getHandler() {
+ return handler;
+ }
+}
View
@@ -0,0 +1,120 @@
+package de.tutao.tutanota.push;
+
+import android.content.Context;
+import android.content.SharedPreferences;
+import android.preference.PreferenceManager;
+import android.support.annotation.Nullable;
+import android.util.Log;
+
+import org.json.JSONArray;
+import org.json.JSONException;
+import org.json.JSONObject;
+
+import java.io.ByteArrayOutputStream;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.List;
+
+public final class SseStorage {
+ public static final String PUSH_IDENTIFIER_JSON_KEY = "pushIdentifier";
+ public static final String USER_IDS_JSON_KEY = "userIds";
+ public static final String SSE_ORIGIN_JSON_KEY = "sseOrigin";
+
+ private static final String SSE_INFO_PREF = "sseInfo";
+ private static final String TAG = SseStorage.class.getSimpleName();
+
+
+ private Context context;
+
+ public SseStorage(Context context) {
+ this.context = context;
+ }
+
+ @Nullable
+ public String getPushIdentifier() {
+ SseInfo sseInfo = getSseInfo();
+ if (sseInfo != null) {
+ return sseInfo.getPushIdentifier();
+ }
+ return null;
+ }
+
+ @Nullable
+ public SseInfo getSseInfo() {
+ String pushIdentifierPref = getPrefs().getString(SSE_INFO_PREF, null);
+ if (pushIdentifierPref == null) {
+ return null;
+ }
+ try {
+ JSONObject jsonObject = new JSONObject(pushIdentifierPref);
+ String identifier = jsonObject.getString(PUSH_IDENTIFIER_JSON_KEY);
+ JSONArray userIdsArray = jsonObject.getJSONArray(USER_IDS_JSON_KEY);
+ List<String> userIds = new ArrayList<>(userIdsArray.length());
+ for (int i = 0; i < userIdsArray.length(); i++) {
+ userIds.add(userIdsArray.getString(i));
+ }
+ String sseOrigin = jsonObject.getString(SSE_ORIGIN_JSON_KEY);
+ return new SseInfo(identifier, userIds, sseOrigin);
+ } catch ( JSONException e) {
+ Log.w(TAG, "could read sse info", e);
+ return null;
+ }
+ }
+
+ public void storePushIdentifier(String identifier, String userId, String sseOrigin) {
+ final SseInfo sseInfo = getSseInfo();
+ SseInfo newInfo;
+ if (sseInfo == null) {
+ newInfo = new SseInfo(identifier, Collections.singletonList(userId), sseOrigin);
+ } else {
+ List<String> userList = new ArrayList<>(sseInfo.getUserIds());
+ if (!userList.contains(userId)) {
+ userList.add(userId);
+ }
+ newInfo = new SseInfo(identifier, userList, sseOrigin);
+ }
+ getPrefs().edit().putString(SSE_INFO_PREF, newInfo.toJSON()).apply();
+ }
+
+ public void clear() {
+ this.getPrefs().edit().clear().apply();
+ }
+
+ private SharedPreferences getPrefs() {
+ return PreferenceManager.getDefaultSharedPreferences(context);
+ }
+}
+
+final class SseInfo {
+ final private String pushIdentifier;
+ final private List<String> userIds;
+ final private String sseOrigin;
+
+ SseInfo(String pushIdentifier, List<String> userIds, String sseOrigin) {
+ this.pushIdentifier = pushIdentifier;
+ this.userIds = userIds;
+ this.sseOrigin = sseOrigin;
+ }
+
+ public String getPushIdentifier() {
+ return pushIdentifier;
+ }
+
+ public List<String> getUserIds() {
+ return userIds;
+ }
+
+ public String getSseOrigin() {
+ return sseOrigin;
+ }
+
+ public String toJSON() {
+ HashMap<String, Object> sseInfoMap = new HashMap<>();
+ sseInfoMap.put(SseStorage.PUSH_IDENTIFIER_JSON_KEY, this.pushIdentifier);
+ sseInfoMap.put(SseStorage.USER_IDS_JSON_KEY, this.userIds);
+ sseInfoMap.put(SseStorage.SSE_ORIGIN_JSON_KEY, this.sseOrigin);
+ JSONObject jsonObject = new JSONObject(sseInfoMap);
+ return jsonObject.toString();
+ }
+}
View
Binary file not shown.
View
Binary file not shown.
View
Binary file not shown.
View
Binary file not shown.
View
@@ -1493,3 +1493,18 @@ type SignOrderProcessingAgreementData = {
version:string;
}
+
+type GeneratedIdWrapper = {
+ _type: TypeRef<GeneratedIdWrapper>;
+ _id:Id;
+ value:Id;
+
+}
+
+type SseConnectData = {
+ _type: TypeRef<SseConnectData>;
+ _format:NumberString;
+ identifier:string;
+
+ userIds:GeneratedIdWrapper[];
+}
View
@@ -109,6 +109,7 @@ type WorkerRequestType = 'setup'
| 'switchPremiumToFreeGroup'
| 'updatePaymentData'
| 'downloadInvoice'
+ | 'generateSsePushIdentifer'
type MainRequestType ='execNative'
| 'entityEvent'
| 'error'
@@ -133,6 +134,8 @@ type NativeRequestType = 'init'
| 'initPushNotifications'
| 'openLink'
| 'logout'
+ | 'getPushIdentifier'
+ | 'storePushIdentifierLocally'
type JsRequestType ='createMailEditor'
| 'updatePushIdentifier'
| 'handleBackPress'
View
@@ -28,6 +28,10 @@ export function isIOSApp(): boolean {
return env.mode == Mode.App && env.platformId == "ios"
}
+export function isAndroidApp(): boolean {
+ return env.mode == Mode.App && env.platformId == "android"
+}
+
export function isApp(): boolean {
return env.mode == Mode.App
}
View
@@ -126,7 +126,7 @@ export const PaymentMethodType = {
}
export type PaymentMethodTypeEnum = $Values<typeof PaymentMethodType>;
-export const reverse = (objectMap:Object) => Object.keys(objectMap).reduce((r, k) => Object.assign(r, {[objectMap[k]]: (r[objectMap[k]] || []).concat(k)}), {})
+export const reverse = (objectMap: Object) => Object.keys(objectMap).reduce((r, k) => Object.assign(r, {[objectMap[k]]: (r[objectMap[k]] || []).concat(k)}), {})
export const ValueToPaymentMethodType = reverse(PaymentMethodType)
@@ -212,7 +212,8 @@ export type SessionStateEnum = $Values<typeof SessionState>;
export const PushServiceType = {
ANDROID: "0",
IOS: "1",
- EMAIL: "2"
+ EMAIL: "2",
+ SSE: "3"
}
export type PushServiceTypeEnum = $Values<typeof PushServiceType>;
View
@@ -196,7 +196,7 @@ export const _TypeModel: TypeModel = {
}
},
"app": "sys",
- "version": "31"
+ "version": "32"
}
export function createAccountingInfo(): AccountingInfo {
View
@@ -80,7 +80,7 @@ export const _TypeModel: TypeModel = {
}
},
"app": "sys",
- "version": "31"
+ "version": "32"
}
export function createAdministratedGroup(): AdministratedGroup {
View
@@ -34,7 +34,7 @@ export const _TypeModel: TypeModel = {
}
},
"app": "sys",
- "version": "31"
+ "version": "32"
}
export function createAdministratedGroupsRef(): AdministratedGroupsRef {
View
@@ -125,7 +125,7 @@ export const _TypeModel: TypeModel = {
}
},
"app": "sys",
- "version": "31"
+ "version": "32"
}
export function createAuditLogEntry(): AuditLogEntry {
View
@@ -34,7 +34,7 @@ export const _TypeModel: TypeModel = {
}
},
"app": "sys",
- "version": "31"
+ "version": "32"
}
export function createAuditLogRef(): AuditLogRef {
View
@@ -50,7 +50,7 @@ export const _TypeModel: TypeModel = {
},
"associations": {},
"app": "sys",
- "version": "31"
+ "version": "32"
}
export function createAuthenticatedDevice(): AuthenticatedDevice {
View
@@ -61,7 +61,7 @@ export const _TypeModel: TypeModel = {
}
},
"app": "sys",
- "version": "31"
+ "version": "32"
}
export function createAuthentication(): Authentication {
View
@@ -32,7 +32,7 @@ export const _TypeModel: TypeModel = {
},
"associations": {},
"app": "sys",
- "version": "31"
+ "version": "32"
}
export function createAutoLoginDataDelete(): AutoLoginDataDelete {
View
@@ -43,7 +43,7 @@ export const _TypeModel: TypeModel = {
}
},
"app": "sys",
- "version": "31"
+ "version": "32"
}
export function createAutoLoginDataGet(): AutoLoginDataGet {
View
@@ -32,7 +32,7 @@ export const _TypeModel: TypeModel = {
},
"associations": {},
"app": "sys",
- "version": "31"
+ "version": "32"
}
export function createAutoLoginDataReturn(): AutoLoginDataReturn {
View
@@ -32,7 +32,7 @@ export const _TypeModel: TypeModel = {
},
"associations": {},
"app": "sys",
- "version": "31"
+ "version": "32"
}
export function createAutoLoginPostReturn(): AutoLoginPostReturn {
View
@@ -123,7 +123,7 @@ export const _TypeModel: TypeModel = {
}
},
"app": "sys",
- "version": "31"
+ "version": "32"
}
export function createBooking(): Booking {
View
@@ -86,7 +86,7 @@ export const _TypeModel: TypeModel = {
},
"associations": {},
"app": "sys",
- "version": "31"
+ "version": "32"
}
export function createBookingItem(): BookingItem {
View
@@ -50,7 +50,7 @@ export const _TypeModel: TypeModel = {
},
"associations": {},
"app": "sys",
- "version": "31"
+ "version": "32"
}
export function createBookingServiceData(): BookingServiceData {
View
@@ -34,7 +34,7 @@ export const _TypeModel: TypeModel = {
}
},
"app": "sys",
- "version": "31"
+ "version": "32"
}
export function createBookingsRef(): BookingsRef {
View
@@ -32,7 +32,7 @@ export const _TypeModel: TypeModel = {
},
"associations": {},
"app": "sys",
- "version": "31"
+ "version": "32"
}
export function createBootstrapFeature(): BootstrapFeature {
View
@@ -59,7 +59,7 @@ export const _TypeModel: TypeModel = {
},
"associations": {},
"app": "sys",
- "version": "31"
+ "version": "32"
}
export function createBrandingDomainData(): BrandingDomainData {
View
@@ -32,7 +32,7 @@ export const _TypeModel: TypeModel = {
},
"associations": {},
"app": "sys",
- "version": "31"
+ "version": "32"
}
export function createBrandingDomainDeleteData(): BrandingDomainDeleteData {
View
@@ -34,7 +34,7 @@ export const _TypeModel: TypeModel = {
}
},
"app": "sys",
- "version": "31"
+ "version": "32"
}
export function createBucket(): Bucket {
View
@@ -106,7 +106,7 @@ export const _TypeModel: TypeModel = {
}
},
"app": "sys",
- "version": "31"
+ "version": "32"
}
export function createBucketPermission(): BucketPermission {
View
@@ -51,7 +51,7 @@ export const _TypeModel: TypeModel = {
}
},
"app": "sys",
- "version": "31"
+ "version": "32"
}
export function createChallenge(): Challenge {
View
@@ -68,7 +68,7 @@ export const _TypeModel: TypeModel = {
},
"associations": {},
"app": "sys",
- "version": "31"
+ "version": "32"
}
export function createChangePasswordData(): ChangePasswordData {
View
@@ -50,7 +50,7 @@ export const _TypeModel: TypeModel = {
},
"associations": {},
"app": "sys",
- "version": "31"
+ "version": "32"
}
export function createChat(): Chat {
View
@@ -32,7 +32,7 @@ export const _TypeModel: TypeModel = {
},
"associations": {},
"app": "sys",
- "version": "31"
+ "version": "32"
}
export function createCreateCustomerServerPropertiesData(): CreateCustomerServerPropertiesData {
View
@@ -34,7 +34,7 @@ export const _TypeModel: TypeModel = {
}
},
"app": "sys",
- "version": "31"
+ "version": "32"
}
export function createCreateCustomerServerPropertiesReturn(): CreateCustomerServerPropertiesReturn {
View
@@ -95,7 +95,7 @@ export const _TypeModel: TypeModel = {
},
"associations": {},
"app": "sys",
- "version": "31"
+ "version": "32"
}
export function createCreateGroupData(): CreateGroupData {
View
@@ -51,7 +51,7 @@ export const _TypeModel: TypeModel = {
}
},
"app": "sys",
- "version": "31"
+ "version": "32"
}
export function createCreateGroupListData(): CreateGroupListData {
View
@@ -79,7 +79,7 @@ export const _TypeModel: TypeModel = {
}
},
"app": "sys",
- "version": "31"
+ "version": "32"
}
export function createCreateSessionData(): CreateSessionData {
View
@@ -52,7 +52,7 @@ export const _TypeModel: TypeModel = {
}
},
"app": "sys",
- "version": "31"
+ "version": "32"
}
export function createCreateSessionReturn(): CreateSessionReturn {
View
@@ -68,7 +68,7 @@ export const _TypeModel: TypeModel = {
},
"associations": {},
"app": "sys",
- "version": "31"
+ "version": "32"
}
export function createCreditCard(): CreditCard {
View
@@ -43,7 +43,7 @@ export const _TypeModel: TypeModel = {
}
},
"app": "sys",
- "version": "31"
+ "version": "32"
}
export function createCustomDomainData(): CustomDomainData {
View
@@ -42,7 +42,7 @@ export const _TypeModel: TypeModel = {
}
},
"app": "sys",
- "version": "31"
+ "version": "32"
}
export function createCustomDomainReturn(): CustomDomainReturn {
View
@@ -250,7 +250,7 @@ export const _TypeModel: TypeModel = {
}
},
"app": "sys",
- "version": "31"
+ "version": "32"
}
export function createCustomer(): Customer {
View
@@ -168,7 +168,7 @@ export const _TypeModel: TypeModel = {
}
},
"app": "sys",
- "version": "31"
+ "version": "32"
}
export function createCustomerData(): CustomerData {
View
@@ -225,7 +225,7 @@ export const _TypeModel: TypeModel = {
}
},
"app": "sys",
- "version": "31"
+ "version": "32"
}
export function createCustomerInfo(): CustomerInfo {
View
@@ -32,7 +32,7 @@ export const _TypeModel: TypeModel = {
},
"associations": {},
"app": "sys",
- "version": "31"
+ "version": "32"
}
export function createCustomerInfoReturn(): CustomerInfoReturn {
View
@@ -87,7 +87,7 @@ export const _TypeModel: TypeModel = {
}
},
"app": "sys",
- "version": "31"
+ "version": "32"
}
export function createCustomerProperties(): CustomerProperties {
View
@@ -44,7 +44,7 @@ export const _TypeModel: TypeModel = {
}
},
"app": "sys",
- "version": "31"
+ "version": "32"
}
export function createCustomerReturn(): CustomerReturn {
View
@@ -105,7 +105,7 @@ export const _TypeModel: TypeModel = {
}
},
"app": "sys",
- "version": "31"
+ "version": "32"
}
export function createCustomerServerProperties(): CustomerServerProperties {
View
@@ -34,7 +34,7 @@ export const _TypeModel: TypeModel = {
}
},
"app": "sys",
- "version": "31"
+ "version": "32"
}
export function createDebitServicePutData(): DebitServicePutData {
View
@@ -70,7 +70,7 @@ export const _TypeModel: TypeModel = {
}
},
"app": "sys",
- "version": "31"
+ "version": "32"
}
export function createDeleteCustomerData(): DeleteCustomerData {
View
@@ -81,7 +81,7 @@ export const _TypeModel: TypeModel = {
}
},
"app": "sys",
- "version": "31"
+ "version": "32"
}
export function createDomainInfo(): DomainInfo {
View
@@ -32,7 +32,7 @@ export const _TypeModel: TypeModel = {
},
"associations": {},
"app": "sys",
- "version": "31"
+ "version": "32"
}
export function createDomainMailAddressAvailabilityData(): DomainMailAddressAvailabilityData {
View
@@ -32,7 +32,7 @@ export const _TypeModel: TypeModel = {
},
"associations": {},
"app": "sys",
- "version": "31"
+ "version": "32"
}
export function createDomainMailAddressAvailabilityReturn(): DomainMailAddressAvailabilityReturn {
View
@@ -34,7 +34,7 @@ export const _TypeModel: TypeModel = {
}
},
"app": "sys",
- "version": "31"
+ "version": "32"
}
export function createDomainsRef(): DomainsRef {
View
@@ -50,7 +50,7 @@ export const _TypeModel: TypeModel = {
},
"associations": {},
"app": "sys",
- "version": "31"
+ "version": "32"
}
export function createEmailSenderListElement(): EmailSenderListElement {
View
@@ -60,7 +60,7 @@ export const _TypeModel: TypeModel = {
}
},
"app": "sys",
- "version": "31"
+ "version": "32"
}
export function createEntityEventBatch(): EntityEventBatch {
View
@@ -68,7 +68,7 @@ export const _TypeModel: TypeModel = {
},
"associations": {},
"app": "sys",
- "version": "31"
+ "version": "32"
}
export function createEntityUpdate(): EntityUpdate {
View
@@ -41,7 +41,7 @@ export const _TypeModel: TypeModel = {
},
"associations": {},
"app": "sys",
- "version": "31"
+ "version": "32"
}
export function createException(): Exception {
View
@@ -60,7 +60,7 @@ export const _TypeModel: TypeModel = {
}
},
"app": "sys",
- "version": "31"
+ "version": "32"
}
export function createExternalPropertiesReturn(): ExternalPropertiesReturn {
View
@@ -71,7 +71,7 @@ export const _TypeModel: TypeModel = {
}
},
"app": "sys",
- "version": "31"
+ "version": "32"
}
export function createExternalUserReference(): ExternalUserReference {
View
@@ -32,7 +32,7 @@ export const _TypeModel: TypeModel = {
},
"associations": {},
"app": "sys",
- "version": "31"
+ "version": "32"
}
export function createFeature(): Feature {
View
@@ -50,7 +50,7 @@ export const _TypeModel: TypeModel = {
},
"associations": {},
"app": "sys",
- "version": "31"
+ "version": "32"
}
export function createFile(): SysFile {
View
@@ -0,0 +1,40 @@
+// @flow
+import {create, TypeRef} from "../../common/EntityFunctions"
+
+export const GeneratedIdWrapperTypeRef: TypeRef<GeneratedIdWrapper> = new TypeRef("sys", "GeneratedIdWrapper")
+export const _TypeModel: TypeModel = {
+ "name": "GeneratedIdWrapper",
+ "since": 32,
+ "type": "AGGREGATED_TYPE",
+ "id": 1349,
+ "rootId": "A3N5cwAFRQ",
+ "versioned": false,
+ "encrypted": false,
+ "values": {
+ "_id": {
+ "name": "_id",
+ "id": 1350,
+ "since": 32,
+ "type": "CustomId",
+ "cardinality": "One",
+ "final": true,
+ "encrypted": false
+ },
+ "value": {
+ "name": "value",
+ "id": 1351,
+ "since": 32,
+ "type": "GeneratedId",
+ "cardinality": "One",
+ "final": false,
+ "encrypted": false
+ }
+ },
+ "associations": {},
+ "app": "sys",
+ "version": "32"
+}
+
+export function createGeneratedIdWrapper(): GeneratedIdWrapper {
+ return create(_TypeModel)
+}
View
@@ -165,7 +165,7 @@ export const _TypeModel: TypeModel = {
}
},
"app": "sys",
- "version": "31"
+ "version": "32"
}
export function createGroup(): Group {
View
@@ -143,7 +143,7 @@ export const _TypeModel: TypeModel = {
}
},
"app": "sys",
- "version": "31"
+ "version": "32"
}
export function createGroupInfo(): GroupInfo {
View
@@ -81,7 +81,7 @@ export const _TypeModel: TypeModel = {
}
},
"app": "sys",
- "version": "31"
+ "version": "32"
}
export function createGroupMember(): GroupMember {
View
@@ -81,7 +81,7 @@ export const _TypeModel: TypeModel = {
}
},
"app": "sys",
- "version": "31"
+ "version": "32"
}
export function createGroupMembership(): GroupMembership {
View
@@ -80,7 +80,7 @@ export const _TypeModel: TypeModel = {
}
},
"app": "sys",
- "version": "31"
+ "version": "32"
}
export function createGroupRoot(): GroupRoot {
View
@@ -170,7 +170,7 @@ export const _TypeModel: TypeModel = {
}
},
"app": "sys",
- "version": "31"
+ "version": "32"
}
export function createInvoice(): Invoice {
View
@@ -115,7 +115,7 @@ export const _TypeModel: TypeModel = {
}
},
"app": "sys",
- "version": "31"
+ "version": "32"
}
export function createInvoiceInfo(): InvoiceInfo {
View
@@ -50,7 +50,7 @@ export const _TypeModel: TypeModel = {
},
"associations": {},
"app": "sys",
- "version": "31"
+ "version": "32"
}
export function createKeyPair(): KeyPair {
View
@@ -32,7 +32,7 @@ export const _TypeModel: TypeModel = {
},
"associations": {},
"app": "sys",
- "version": "31"
+ "version": "32"
}
export function createLocationServiceGetReturn(): LocationServiceGetReturn {
View
@@ -59,7 +59,7 @@ export const _TypeModel: TypeModel = {
},
"associations": {},
"app": "sys",
- "version": "31"
+ "version": "32"
}
export function createLogin(): Login {
View
@@ -41,7 +41,7 @@ export const _TypeModel: TypeModel = {
},
"associations": {},
"app": "sys",
- "version": "31"
+ "version": "32"
}
export function createMailAddressAlias(): MailAddressAlias {
View
@@ -43,7 +43,7 @@ export const _TypeModel: TypeModel = {
}
},
"app": "sys",
- "version": "31"
+ "version": "32"
}
export function createMailAddressAliasServiceData(): MailAddressAliasServiceData {
View
@@ -52,7 +52,7 @@ export const _TypeModel: TypeModel = {
}
},
"app": "sys",
- "version": "31"
+ "version": "32"
}
export function createMailAddressAliasServiceDataDelete(): MailAddressAliasServiceDataDelete {
View
@@ -59,7 +59,7 @@ export const _TypeModel: TypeModel = {
},
"associations": {},
"app": "sys",
- "version": "31"
+ "version": "32"
}
export function createMailAddressAliasServiceReturn(): MailAddressAliasServiceReturn {
View
@@ -32,7 +32,7 @@ export const _TypeModel: TypeModel = {
},
"associations": {},
"app": "sys",
- "version": "31"
+ "version": "32"
}
export function createMailAddressAvailabilityData(): MailAddressAvailabilityData {
View
@@ -32,7 +32,7 @@ export const _TypeModel: TypeModel = {
},
"associations": {},
"app": "sys",
- "version": "31"
+ "version": "32"
}
export function createMailAddressAvailabilityReturn(): MailAddressAvailabilityReturn {
View
@@ -61,7 +61,7 @@ export const _TypeModel: TypeModel = {
}
},
"app": "sys",
- "version": "31"
+ "version": "32"
}
export function createMailAddressToGroup(): MailAddressToGroup {
View
@@ -53,7 +53,7 @@ export const _TypeModel: TypeModel = {
}
},
"app": "sys",
- "version": "31"
+ "version": "32"
}
export function createMembershipAddData(): MembershipAddData {
View
@@ -44,7 +44,7 @@ export const _TypeModel: TypeModel = {
}
},
"app": "sys",
- "version": "31"
+ "version": "32"
}
export function createMembershipRemoveData(): MembershipRemoveData {
View
@@ -1,10 +1,115 @@
// @flow
-
import {create, TypeRef} from "../../common/EntityFunctions"
-export const OrderProcessingAgreementTypeRef:TypeRef<OrderProcessingAgreement> = new TypeRef("sys", "OrderProcessingAgreement")
-export const _TypeModel:TypeModel= {"name":"OrderProcessingAgreement","since":31,"type":"LIST_ELEMENT_TYPE","id":1326,"rootId":"A3N5cwAFLg","versioned":false,"encrypted":true,"values":{"_format":{"name":"_format","id":1330,"since":31,"type":"Number","cardinality":"One","final":false,"encrypted":false},"_id":{"name":"_id","id":1328,"since":31,"type":"GeneratedId","cardinality":"One","final":true,"encrypted":false},"_ownerEncSessionKey":{"name":"_ownerEncSessionKey","id":1332,"since":31,"type":"Bytes","cardinality":"ZeroOrOne","final":true,"encrypted":false},"_ownerGroup":{"name":"_ownerGroup","id":1331,"since":31,"type":"GeneratedId","cardinality":"ZeroOrOne","final":true,"encrypted":false},"_permissions":{"name":"_permissions","id":1329,"since":31,"type":"GeneratedId","cardinality":"One","final":true,"encrypted":false},"customerAddress":{"name":"customerAddress","id":1334,"since":31,"type":"String","cardinality":"One","final":false,"encrypted":true},"signatureDate":{"name":"signatureDate","id":1335,"since":31,"type":"Date","cardinality":"One","final":false,"encrypted":false},"version":{"name":"version","id":1333,"since":31,"type":"String","cardinality":"One","final":false,"encrypted":false}},"associations":{"customer":{"name":"customer","id":1337,"since":31,"type":"ELEMENT_ASSOCIATION","cardinality":"One","refType":"Customer","final":true,"external":false},"signerUserGroupInfo":{"name":"signerUserGroupInfo","id":1336,"since":31,"type":"LIST_ELEMENT_ASSOCIATION","cardinality":"One","refType":"GroupInfo","final":false,"external":false}},"app":"sys","version":"31"}
+export const OrderProcessingAgreementTypeRef: TypeRef<OrderProcessingAgreement> = new TypeRef("sys", "OrderProcessingAgreement")
+export const _TypeModel: TypeModel = {
+ "name": "OrderProcessingAgreement",
+ "since": 31,
+ "type": "LIST_ELEMENT_TYPE",
+ "id": 1326,
+ "rootId": "A3N5cwAFLg",
+ "versioned": false,
+ "encrypted": true,
+ "values": {
+ "_format": {
+ "name": "_format",
+ "id": 1330,
+ "since": 31,
+ "type": "Number",
+ "cardinality": "One",
+ "final": false,
+ "encrypted": false
+ },
+ "_id": {
+ "name": "_id",
+ "id": 1328,
+ "since": 31,
+ "type": "GeneratedId",
+ "cardinality": "One",
+ "final": true,
+ "encrypted": false
+ },
+ "_ownerEncSessionKey": {
+ "name": "_ownerEncSessionKey",
+ "id": 1332,
+ "since": 31,
+ "type": "Bytes",
+ "cardinality": "ZeroOrOne",
+ "final": true,
+ "encrypted": false
+ },
+ "_ownerGroup": {
+ "name": "_ownerGroup",
+ "id": 1331,
+ "since": 31,
+ "type": "GeneratedId",
+ "cardinality": "ZeroOrOne",
+ "final": true,
+ "encrypted": false
+ },
+ "_permissions": {
+ "name": "_permissions",
+ "id": 1329,
+ "since": 31,
+ "type": "GeneratedId",
+ "cardinality": "One",
+ "final": true,
+ "encrypted": false
+ },
+ "customerAddress": {
+ "name": "customerAddress",
+ "id": 1334,
+ "since": 31,
+ "type": "String",
+ "cardinality": "One",
+ "final": false,
+ "encrypted": true
+ },
+ "signatureDate": {
+ "name": "signatureDate",
+ "id": 1335,
+ "since": 31,
+ "type": "Date",
+ "cardinality": "One",
+ "final": false,
+ "encrypted": false
+ },
+ "version": {
+ "name": "version",
+ "id": 1333,
+ "since": 31,
+ "type": "String",
+ "cardinality": "One",
+ "final": false,
+ "encrypted": false
+ }
+ },
+ "associations": {
+ "customer": {
+ "name": "customer",
+ "id": 1337,
+ "since": 31,
+ "type": "ELEMENT_ASSOCIATION",
+ "cardinality": "One",
+ "refType": "Customer",
+ "final": true,
+ "external": false
+ },
+ "signerUserGroupInfo": {
+ "name": "signerUserGroupInfo",
+ "id": 1336,
+ "since": 31,
+ "type": "LIST_ELEMENT_ASSOCIATION",
+ "cardinality": "One",
+ "refType": "GroupInfo",
+ "final": false,
+ "external": false
+ }
+ },
+ "app": "sys",
+ "version": "32"
+}
-export function createOrderProcessingAgreement():OrderProcessingAgreement {
- return create(_TypeModel)
+export function createOrderProcessingAgreement(): OrderProcessingAgreement {
+ return create(_TypeModel)
}
View
@@ -1,10 +1,42 @@
// @flow
-
import {create, TypeRef} from "../../common/EntityFunctions"
-export const OrderProcessingAgreementsTypeRef:TypeRef<OrderProcessingAgreements> = new TypeRef("sys", "OrderProcessingAgreements")
-export const _TypeModel:TypeModel= {"name":"OrderProcessingAgreements","since":31,"type":"AGGREGATED_TYPE","id":1338,"rootId":"A3N5cwAFOg","versioned":false,"encrypted":false,"values":{"_id":{"name":"_id","id":1339,"since":31,"type":"CustomId","cardinality":"One","final":true,"encrypted":false}},"associations":{"agreements":{"name":"agreements","id":1340,"since":31,"type":"LIST_ASSOCIATION","cardinality":"One","refType":"OrderProcessingAgreement","final":true,"external":false}},"app":"sys","version":"31"}
+export const OrderProcessingAgreementsTypeRef: TypeRef<OrderProcessingAgreements> = new TypeRef("sys", "OrderProcessingAgreements")
+export const _TypeModel: TypeModel = {
+ "name": "OrderProcessingAgreements",
+ "since": 31,
+ "type": "AGGREGATED_TYPE",
+ "id": 1338,
+ "rootId": "A3N5cwAFOg",
+ "versioned": false,
+ "encrypted": false,
+ "values": {
+ "_id": {
+ "name": "_id",
+ "id": 1339,
+ "since": 31,
+ "type": "CustomId",
+ "cardinality": "One",
+ "final": true,
+ "encrypted": false
+ }
+ },
+ "associations": {
+ "agreements": {
+ "name": "agreements",
+ "id": 1340,
+ "since": 31,
+ "type": "LIST_ASSOCIATION",
+ "cardinality": "One",
+ "refType": "OrderProcessingAgreement",
+ "final": true,
+ "external": false
+ }
+ },
+ "app": "sys",
+ "version": "32"
+}
-export function createOrderProcessingAgreements():OrderProcessingAgreements {
- return create(_TypeModel)
+export function createOrderProcessingAgreements(): OrderProcessingAgreements {
+ return create(_TypeModel)
}
View
@@ -34,7 +34,7 @@ export const _TypeModel: TypeModel = {
}
},
"app": "sys",
- "version": "31"
+ "version": "32"
}
export function createOtpChallenge(): OtpChallenge {
View
@@ -32,7 +32,7 @@ export const _TypeModel: TypeModel = {
},
"associations": {},
"app": "sys",
- "version": "31"
+ "version": "32"
}
export function createPaymentDataServiceGetReturn(): PaymentDataServiceGetReturn {
View
@@ -123,7 +123,7 @@ export const _TypeModel: TypeModel = {
}
},
"app": "sys",
- "version": "31"
+ "version": "32"
}
export function createPaymentDataServicePutData(): PaymentDataServicePutData {
View
@@ -32,7 +32,7 @@ export const _TypeModel: TypeModel = {
},
"associations": {},
"app": "sys",
- "version": "31"
+ "version": "32"
}
export function createPaymentDataServicePutReturn(): PaymentDataServicePutReturn {
View
@@ -34,7 +34,7 @@ export const _TypeModel: TypeModel = {
}
},
"app": "sys",
- "version": "31"
+ "version": "32"
}
export function createPdfInvoiceServiceData(): PdfInvoiceServiceData {
View
@@ -32,7 +32,7 @@ export const _TypeModel: TypeModel = {
},
"associations": {},
"app": "sys",
- "version": "31"
+ "version": "32"
}
export function createPdfInvoiceServiceReturn(): PdfInvoiceServiceReturn {
View
@@ -115,7 +115,7 @@ export const _TypeModel: TypeModel = {
}
},
"app": "sys",
- "version": "31"
+ "version": "32"
}
export function createPermission(): Permission {
View
@@ -32,7 +32,7 @@ export const _TypeModel: TypeModel = {
},
"associations": {},
"app": "sys",
- "version": "31"
+ "version": "32"
}
export function createPhoneNumber(): PhoneNumber {
View
@@ -41,7 +41,7 @@ export const _TypeModel: TypeModel = {
},
"associations": {},
"app": "sys",
- "version": "31"
+ "version": "32"
}
export function createPremiumFeatureData(): PremiumFeatureData {
View
@@ -32,7 +32,7 @@ export const _TypeModel: TypeModel = {
},
"associations": {},
"app": "sys",
- "version": "31"
+ "version": "32"
}
export function createPremiumFeatureReturn(): PremiumFeatureReturn {
View
@@ -60,7 +60,7 @@ export const _TypeModel: TypeModel = {
}
},
"app": "sys",
- "version": "31"
+ "version": "32"
}
export function createPriceData(): PriceData {
View
@@ -59,7 +59,7 @@ export const _TypeModel: TypeModel = {
},
"associations": {},
"app": "sys",
- "version": "31"
+ "version": "32"
}
export function createPriceItemData(): PriceItemData {
View
@@ -77,7 +77,7 @@ export const _TypeModel: TypeModel = {
},
"associations": {},
"app": "sys",
- "version": "31"
+ "version": "32"
}
export function createPriceRequestData(): PriceRequestData {
View
@@ -42,7 +42,7 @@ export const _TypeModel: TypeModel = {
}
},
"app": "sys",
- "version": "31"
+ "version": "32"
}
export function createPriceServiceData(): PriceServiceData {
View
@@ -69,7 +69,7 @@ export const _TypeModel: TypeModel = {
}
},
"app": "sys",
- "version": "31"
+ "version": "32"
}
export function createPriceServiceReturn(): PriceServiceReturn {
View
@@ -32,7 +32,7 @@ export const _TypeModel: TypeModel = {
},
"associations": {},
"app": "sys",
- "version": "31"
+ "version": "32"
}
export function createPublicKeyData(): PublicKeyData {
View
@@ -41,7 +41,7 @@ export const _TypeModel: TypeModel = {
},
"associations": {},
"app": "sys",
- "version": "31"
+ "version": "32"
}
export function createPublicKeyReturn(): PublicKeyReturn {
View
@@ -104,7 +104,7 @@ export const _TypeModel: TypeModel = {
},
"associations": {},
"app": "sys",
- "version": "31"
+ "version": "32"
}
export function createPushIdentifier(): PushIdentifier {
View
@@ -34,7 +34,7 @@ export const _TypeModel: TypeModel = {
}
},
"app": "sys",
- "version": "31"
+ "version": "32"
}
export function createPushIdentifierList(): PushIdentifierList {
View
@@ -41,7 +41,7 @@ export const _TypeModel: TypeModel = {
},
"associations": {},
"app": "sys",
- "version": "31"
+ "version": "32"
}
export function createRegistrationCaptchaServiceData(): RegistrationCaptchaServiceData {
View
@@ -41,7 +41,7 @@ export const _TypeModel: TypeModel = {
},
"associations": {},
"app": "sys",
- "version": "31"
+ "version": "32"
}
export function createRegistrationCaptchaServiceReturn(): RegistrationCaptchaServiceReturn {
View
@@ -41,7 +41,7 @@ export const _TypeModel: TypeModel = {
},
"associations": {},
"app": "sys",
- "version": "31"
+ "version": "32"
}
export function createRegistrationConfigReturn(): RegistrationConfigReturn {
View
@@ -32,7 +32,7 @@ export const _TypeModel: TypeModel = {
},
"associations": {},
"app": "sys",
- "version": "31"
+ "version": "32"
}
export function createRegistrationReturn(): RegistrationReturn {
View
@@ -122,7 +122,7 @@ export const _TypeModel: TypeModel = {
},
"associations": {},
"app": "sys",
- "version": "31"
+ "version": "32"
}
export function createRegistrationServiceData(): RegistrationServiceData {
View
@@ -61,7 +61,7 @@ export const _TypeModel: TypeModel = {
}
},
"app": "sys",
- "version": "31"
+ "version": "32"
}
export function createResetPasswordData(): ResetPasswordData {
View
@@ -59,7 +59,7 @@ export const _TypeModel: TypeModel = {
},
"associations": {},
"app": "sys",
- "version": "31"
+ "version": "32"
}
export function createRootInstance(): RootInstance {
View
@@ -32,7 +32,7 @@ export const _TypeModel: TypeModel = {
},
"associations": {},
"app": "sys",
- "version": "31"
+ "version": "32"
}
export function createSaltData(): SaltData {
View
@@ -32,7 +32,7 @@ export const _TypeModel: TypeModel = {
},
"associations": {},
"app": "sys",
- "version": "31"
+ "version": "32"
}
export function createSaltReturn(): SaltReturn {
View
@@ -87,7 +87,7 @@ export const _TypeModel: TypeModel = {
}
},
"app": "sys",
- "version": "31"
+ "version": "32"
}
export function createSecondFactor(): SecondFactor {
View
@@ -32,7 +32,7 @@ export const _TypeModel: TypeModel = {
},
"associations": {},
"app": "sys",
- "version": "31"
+ "version": "32"
}
export function createSecondFactorAuthAllowedReturn(): SecondFactorAuthAllowedReturn {
View
@@ -61,7 +61,7 @@ export const _TypeModel: TypeModel = {
}
},
"app": "sys",
- "version": "31"
+ "version": "32"
}
export function createSecondFactorAuthData(): SecondFactorAuthData {
View
@@ -32,7 +32,7 @@ export const _TypeModel: TypeModel = {
},
"associations": {},
"app": "sys",
- "version": "31"
+ "version": "32"
}
export function createSecondFactorAuthGetData(): SecondFactorAuthGetData {
View
@@ -32,7 +32,7 @@ export const _TypeModel: TypeModel = {
},
"associations": {},
"app": "sys",
- "version": "31"
+ "version": "32"
}
export function createSecondFactorAuthGetReturn(): SecondFactorAuthGetReturn {
View
@@ -86,7 +86,7 @@ export const _TypeModel: TypeModel = {
},
"associations": {},
"app": "sys",
- "version": "31"
+ "version": "32"
}
export function createSecondFactorAuthentication(): SecondFactorAuthentication {
View
@@ -59,7 +59,7 @@ export const _TypeModel: TypeModel = {
},
"associations": {},
"app": "sys",
- "version": "31"
+ "version": "32"
}
export function createSendRegistrationCodeData(): SendRegistrationCodeData {
View
@@ -32,7 +32,7 @@ export const _TypeModel: TypeModel = {
},
"associations": {},
"app": "sys",
- "version": "31"
+ "version": "32"
}
export function createSendRegistrationCodeReturn(): SendRegistrationCodeReturn {
View
@@ -133,7 +133,7 @@ export const _TypeModel: TypeModel = {
}
},
"app": "sys",
- "version": "31"
+ "version": "32"
}
export function createSession(): Session {
View
@@ -1,10 +1,49 @@
// @flow
-
import {create, TypeRef} from "../../common/EntityFunctions"
-export const SignOrderProcessingAgreementDataTypeRef:TypeRef<SignOrderProcessingAgreementData> = new TypeRef("sys", "SignOrderProcessingAgreementData")
-export const _TypeModel:TypeModel= {"name":"SignOrderProcessingAgreementData","since":31,"type":"DATA_TRANSFER_TYPE","id":1342,"rootId":"A3N5cwAFPg","versioned":false,"encrypted":false,"values":{"_format":{"name":"_format","id":1343,"since":31,"type":"Number","cardinality":"One","final":false,"encrypted":false},"customerAddress":{"name":"customerAddress","id":1345,"since":31,"type":"String","cardinality":"One","final":false,"encrypted":false},"version":{"name":"version","id":1344,"since":31,"type":"String","cardinality":"One","final":false,"encrypted":false}},"associations":{},"app":"sys","version":"31"}
+export const SignOrderProcessingAgreementDataTypeRef: TypeRef<SignOrderProcessingAgreementData> = new TypeRef("sys", "SignOrderProcessingAgreementData")
+export const _TypeModel: TypeModel = {
+ "name": "SignOrderProcessingAgreementData",
+ "since": 31,
+ "type": "DATA_TRANSFER_TYPE",
+ "id": 1342,
+ "rootId": "A3N5cwAFPg",
+ "versioned": false,
+ "encrypted": false,
+ "values": {
+ "_format": {
+ "name": "_format",
+ "id": 1343,
+ "since": 31,
+ "type": "Number",
+ "cardinality": "One",
+ "final": false,
+ "encrypted": false
+ },
+ "customerAddress": {
+ "name": "customerAddress",
+ "id": 1345,
+ "since": 31,
+ "type": "String",
+ "cardinality": "One",
+ "final": false,
+ "encrypted": false
+ },
+ "version": {
+ "name": "version",
+ "id": 1344,
+ "since": 31,
+ "type": "String",
+ "cardinality": "One",
+ "final": false,
+ "encrypted": false
+ }
+ },
+ "associations": {},
+ "app": "sys",
+ "version": "32"
+}
-export function createSignOrderProcessingAgreementData():SignOrderProcessingAgreementData {
- return create(_TypeModel)
+export function createSignOrderProcessingAgreementData(): SignOrderProcessingAgreementData {
+ return create(_TypeModel)
}
View
@@ -0,0 +1,50 @@
+// @flow
+import {create, TypeRef} from "../../common/EntityFunctions"
+
+export const SseConnectDataTypeRef: TypeRef<SseConnectData> = new TypeRef("sys", "SseConnectData")
+export const _TypeModel: TypeModel = {
+ "name": "SseConnectData",
+ "since": 32,
+ "type": "DATA_TRANSFER_TYPE",
+ "id": 1352,
+ "rootId": "A3N5cwAFSA",
+ "versioned": false,
+ "encrypted": false,
+ "values": {
+ "_format": {
+ "name": "_format",
+ "id": 1353,
+ "since": 32,
+ "type": "Number",
+ "cardinality": "One",
+ "final": false,
+ "encrypted": false
+ },
+ "identifier": {
+ "name": "identifier",
+ "id": 1354,
+ "since": 32,
+ "type": "String",
+ "cardinality": "One",
+ "final": true,
+ "encrypted": false
+ }
+ },
+ "associations": {
+ "userIds": {
+ "name": "userIds",
+ "id": 1355,
+ "since": 32,
+ "type": "AGGREGATION",
+ "cardinality": "Any",
+ "refType": "GeneratedIdWrapper",
+ "final": false
+ }
+ },
+ "app": "sys",
+ "version": "32"
+}
+
+export function createSseConnectData(): SseConnectData {
+ return create(_TypeModel)
+}
View
@@ -41,7 +41,7 @@ export const _TypeModel: TypeModel = {
},
"associations": {},
"app": "sys",
- "version": "31"
+ "version": "32"
}
export function createStringConfigValue(): StringConfigValue {
View
@@ -32,7 +32,7 @@ export const _TypeModel: TypeModel = {
},
"associations": {},
"app": "sys",
- "version": "31"
+ "version": "32"
}
export function createStringWrapper(): StringWrapper {
View
@@ -50,7 +50,7 @@ export const _TypeModel: TypeModel = {
},
"associations": {},
"app": "sys",
- "version": "31"
+ "version": "32"
}
export function createSwitchAccountTypeData(): SwitchAccountTypeData {
View
@@ -89,7 +89,7 @@ export const _TypeModel: TypeModel = {
}
},
"app": "sys",
- "version": "31"
+ "version": "32"
}
export function createSystemKeysReturn(): SystemKeysReturn {
View
@@ -42,7 +42,7 @@ export const _TypeModel: TypeModel = {
}
},
"app": "sys",
- "version": "31"
+ "version": "32"
}
export function createU2fChallenge(): U2fChallenge {
View
@@ -52,7 +52,7 @@ export const _TypeModel: TypeModel = {
}
},
"app": "sys",
- "version": "31"
+ "version": "32"
}
export function createU2fKey(): U2fKey {
View
@@ -68,7 +68,7 @@ export const _TypeModel: TypeModel = {
},
"associations": {},
"app": "sys",
- "version": "31"
+ "version": "32"
}
export function createU2fRegisteredDevice(): U2fRegisteredDevice {
View
@@ -50,7 +50,7 @@ export const _TypeModel: TypeModel = {
},
"associations": {},
"app": "sys",
- "version": "31"
+ "version": "32"
}
export function createU2fResponseData(): U2fResponseData {
View
@@ -53,7 +53,7 @@ export const _TypeModel: TypeModel = {
}
},
"app": "sys",
- "version": "31"
+ "version": "32"
}
export function createUpdateAdminshipData(): UpdateAdminshipData {
View
@@ -62,7 +62,7 @@ export const _TypeModel: TypeModel = {
}
},
"app": "sys",
- "version": "31"
+ "version": "32"
}
export function createUpdatePermissionKeyData(): UpdatePermissionKeyData {
View
@@ -208,7 +208,7 @@ export const _TypeModel: TypeModel = {
}
},
"app": "sys",
- "version": "31"
+ "version": "32"
}
export function createUser(): User {
View
@@ -34,7 +34,7 @@ export const _TypeModel: TypeModel = {
}
},
"app": "sys",
- "version": "31"
+ "version": "32"
}
export function createUserAreaGroups(): UserAreaGroups {
View
@@ -44,7 +44,7 @@ export const _TypeModel: TypeModel = {
}
},
"app": "sys",
- "version": "31"
+ "version": "32"
}
export function createUserAuthentication(): UserAuthentication {
View
@@ -87,7 +87,7 @@ export const _TypeModel: TypeModel = {
}
},
"app": "sys",
- "version": "31"
+ "version": "32"
}
export function createUserData(): UserData {
View
@@ -52,7 +52,7 @@ export const _TypeModel: TypeModel = {
}
},
"app": "sys",
- "version": "31"
+ "version": "32"
}
export function createUserDataDelete(): UserDataDelete {
View
@@ -70,7 +70,7 @@ export const _TypeModel: TypeModel = {
}
},
"app": "sys",
- "version": "31"
+ "version": "32"
}
export function createUserExternalAuthInfo(): UserExternalAuthInfo {
View
@@ -32,7 +32,7 @@ export const _TypeModel: TypeModel = {
},
"associations": {},
"app": "sys",
- "version": "31"
+ "version": "32"
}
export function createUserIdData(): UserIdData {
View
@@ -34,7 +34,7 @@ export const _TypeModel: TypeModel = {
}
},
"app": "sys",
- "version": "31"
+ "version": "32"
}
export function createUserIdReturn(): UserIdReturn {
View
@@ -44,7 +44,7 @@ export const _TypeModel: TypeModel = {
}
},
"app": "sys",
- "version": "31"
+ "version": "32"
}
export function createUserReturn(): UserReturn {
View
@@ -104,7 +104,7 @@ export const _TypeModel: TypeModel = {
},
"associations": {},
"app": "sys",
- "version": "31"
+ "version": "32"
}
export function createVariableExternalAuthInfo(): VariableExternalAuthInfo {
View
@@ -41,7 +41,7 @@ export const _TypeModel: TypeModel = {
},
"associations": {},
"app": "sys",
- "version": "31"
+ "version": "32"
}
export function createVerifyRegistrationCodeData(): VerifyRegistrationCodeData {
View
@@ -71,7 +71,7 @@ export const _TypeModel: TypeModel = {
}
},
"app": "sys",
- "version": "31"
+ "version": "32"
}
export function createVersion(): Version {
View
@@ -59,7 +59,7 @@ export const _TypeModel: TypeModel = {
},
"associations": {},
"app": "sys",
- "version": "31"
+ "version": "32"
}
export function createVersionData(): VersionData {
View
@@ -125,7 +125,7 @@ export const _TypeModel: TypeModel = {
}
},
"app": "sys",
- "version": "31"
+ "version": "32"
}
export function createVersionInfo(): VersionInfo {
View
@@ -33,7 +33,7 @@ export const _TypeModel: TypeModel = {
}
},
"app": "sys",
- "version": "31"
+ "version": "32"
}
export function createVersionReturn(): VersionReturn {
View
@@ -123,7 +123,7 @@ export const _TypeModel: TypeModel = {
}
},
"app": "sys",
- "version": "31"
+ "version": "32"
}
export function createWebsocketWrapper(): WebsocketWrapper {
View
@@ -106,7 +106,7 @@ export const _TypeModel: TypeModel = {
}
},
"app": "sys",
- "version": "31"
+ "version": "32"
}
export function createWhitelabelChild(): WhitelabelChild {
View
@@ -34,7 +34,7 @@ export const _TypeModel: TypeModel = {
}
},
"app": "sys",
- "version": "31"
+ "version": "32"
}
export function createWhitelabelChildrenRef(): WhitelabelChildrenRef {
View
@@ -87,7 +87,7 @@ export const _TypeModel: TypeModel = {
}
},
"app": "sys",
- "version": "31"
+ "version": "32"
}
export function createWhitelabelConfig(): WhitelabelConfig {
View
@@ -44,7 +44,7 @@ export const _TypeModel: TypeModel = {
}
},
"app": "sys",
- "version": "31"
+ "version": "32"
}
export function createWhitelabelParent(): WhitelabelParent {
View
@@ -380,6 +380,10 @@ export class WorkerClient {
this._progressUpdater = null
}
}
+
+ generateSsePushIdentifer(): Promise<string> {
+ return this._postRequest(new Request('generateSsePushIdentifer', arguments))
+ }
}
export const worker = new WorkerClient()
View
@@ -13,6 +13,8 @@ import {restClient} from "./rest/RestClient"
import {TotpVerifier} from "./crypto/TotpVerifier"
import type {EntropySrcEnum} from "../common/TutanotaConstants"
import {loadContactForm} from "./facades/ContactFormFacade"
+import {keyToBase64} from "./crypto/CryptoUtils"
+import {aes256RandomKey} from "./crypto/Aes"
assertWorkerOrNode()
@@ -218,6 +220,9 @@ export class WorkerImpl {
tryReconnectEventBus(message: Request) {
return locator.login.tryReconnectEventBus()
},
+ generateSsePushIdentifer: () => {
+ return Promise.resolve(keyToBase64(aes256RandomKey()))
+ }
})
Promise.onPossiblyUnhandledRejection(e => this.sendError(e));
View
@@ -2,12 +2,14 @@
import {setup, update, loadAll} from "../api/main/Entity"
import {createPushIdentifier, PushIdentifierTypeRef} from "../api/entities/sys/PushIdentifier"
import {neverNull} from "../api/common/utils/Utils"
+import type {PushServiceTypeEnum} from "../api/common/TutanotaConstants"
import {PushServiceType} from "../api/common/TutanotaConstants"
import {lang} from "../misc/LanguageViewModel"
-import {isIOSApp} from "../api/Env"
+import {isIOSApp, isAndroidApp, getHttpOrigin} from "../api/Env"
import {nativeApp} from "./NativeWrapper"
import {Request} from "../api/common/WorkerProtocol"
import {logins} from "../api/main/LoginController"
+import {worker} from "../api/main/WorkerClient"
class PushServiceApp {
_pushNotification: ?Object;
@@ -18,10 +20,42 @@ class PushServiceApp {
this.currentPushIdentifier = "";
}
- register(): void {
- nativeApp.invokeNative(new Request("initPushNotifications", []))
+ register(): Promise<void> {
+ if (isAndroidApp()) {
+ return nativeApp.invokeNative(new Request("getPushIdentifier", [])).then(identifier => {
+ if (identifier) {
+ this._loadPushIdentifier(identifier).then(pushIdentifier => {
+ if (!pushIdentifier) { // outdated push identifer stored locally
+ return this._createPushIdentiferInstance(identifier, PushServiceType.SSE)
+ } else {
+ return Promise.resolve()
+ }
+ })
+ } else {
+ return worker.generateSsePushIdentifer()
+ .then(identifier => this._createPushIdentiferInstance(identifier, PushServiceType.SSE))
+ .then(pushIdentifier => this._storePushIdentifierLocally(pushIdentifier.identifier, logins.getUserController().user._id))
+ }
+ }).then(() => nativeApp.invokeNative(new Request("initPushNotifications", [])))
+ } else {
+ return Promise.resolve()
+ }
+
+ }
+
+ _storePushIdentifierLocally(identifier: string, userId: Id): Promise<void> {
+ return nativeApp.invokeNative(new Request("storePushIdentifierLocally", [identifier, userId, getHttpOrigin()]))
}
+
+ _loadPushIdentifier(identifier: string): Promise<?PushIdentifier> {
+ let list = logins.getUserController().user.pushIdentifierList
+ return loadAll(PushIdentifierTypeRef, neverNull(list).list).then(identifiers => {
+ return identifiers.find(i => i.identifier == identifier)
+ })
+ }
+
+
updatePushIdentifier(identifier: string) {
let identifierType = isIOSApp() ? PushServiceType.IOS : PushServiceType.ANDROID
let list = logins.getUserController().user.pushIdentifierList
@@ -34,20 +68,28 @@ class PushServiceApp {
update(existingPushIdentfier)
}
} else {
- //console.log("<<<", identifier, identifierType)
- let pushIdentifier = createPushIdentifier()
- pushIdentifier._owner = logins.getUserController().userGroupInfo.group // legacy
- pushIdentifier._ownerGroup = logins.getUserController().userGroupInfo.group
- pushIdentifier._area = "0"
- pushIdentifier.pushServiceType = identifierType
- pushIdentifier.identifier = identifier
- pushIdentifier.language = lang.code
- setup(neverNull(list).list, pushIdentifier)
+ this._createPushIdentiferInstance(identifier, identifierType)
}
})
}
+ _createPushIdentiferInstance(identifier: string, pushServiceType: PushServiceTypeEnum): Promise<PushIdentifier> {
+ let list = logins.getUserController().user.pushIdentifierList
+ let pushIdentifier = createPushIdentifier()
+ pushIdentifier._owner = logins.getUserController().userGroupInfo.group // legacy
+ pushIdentifier._ownerGroup = logins.getUserController().userGroupInfo.group
+ pushIdentifier._area = "0"
+ pushIdentifier.pushServiceType = pushServiceType
+ pushIdentifier.identifier = identifier
+ pushIdentifier.language = lang.code
+ return setup(neverNull(list).list, pushIdentifier).then(id => {
+ pushIdentifier._id = [neverNull(list).list, id]
+ return pushIdentifier
+ })
+ }
+
+
updateBadge(newValue: number): void {
if (this._pushNotification != null) {
// not supported on all android devices.