(options: ClientOptions, clientType?: 'Pushy' | 'Cresc')
| 131 | })(); |
| 132 | |
| 133 | constructor(options: ClientOptions, clientType?: 'Pushy' | 'Cresc') { |
| 134 | this.clientType = clientType || 'Pushy'; |
| 135 | this.options.server = cloneServerConfig(SERVER_PRESETS[this.clientType]); |
| 136 | |
| 137 | i18n.setLocale(options.locale ?? this.clientType === 'Pushy' ? 'zh' : 'en'); |
| 138 | |
| 139 | if (Platform.OS === 'ios' || Platform.OS === 'android') { |
| 140 | if (!options.appKey) { |
| 141 | throw Error(i18n.t('error_appkey_required')); |
| 142 | } |
| 143 | } |
| 144 | |
| 145 | this.setOptions(options); |
| 146 | if (isRolledBack) { |
| 147 | this.report({ |
| 148 | type: 'rollback', |
| 149 | data: { |
| 150 | rolledBackVersion, |
| 151 | }, |
| 152 | }); |
| 153 | } |
| 154 | } |
| 155 | |
| 156 | setOptions = (options: Partial<ClientOptions>) => { |
| 157 | for (const [key, value] of Object.entries(options)) { |
nothing calls this directly
no test coverage detected