omikit-plugin 2.3.0 → 2.3.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -305,8 +305,9 @@ if (@available(iOS 10.0, *)) {
305
305
  incomingDeclineButtonImage : "hangup", //image name
306
306
  backImage : "ic_back", //image name: icon of back button
307
307
  userImage : "calling_face", //image name: icon of user default
308
- prefixMissedCallMessage: 'Cuộc gọi nhỡ từ' //config prefix message for the missed call
309
- missedCallTitle: 'Cuộc gọi nhỡ' //config title for the missed call
308
+ prefixMissedCallMessage: 'Cuộc gọi nhỡ từ', //config prefix message for the missed call
309
+ missedCallTitle: 'Cuộc gọi nhỡ', //config title for the missed call
310
+ userNameKey: 'uuid', //we have 3 values: uuid, full_name, extension.
310
311
  });
311
312
  //incomingAcceptButtonImage, incomingDeclineButtonImage, backImage, userImage: Add these into `android/app/src/main/res/drawble`
312
313
  ```
@@ -96,7 +96,7 @@ dependencies {
96
96
  implementation "com.facebook.react:react-native:+" // From node_modules
97
97
  implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
98
98
 
99
- api 'vn.vihat.omicall:omi-sdk:1.2.8'
99
+ api 'vn.vihat.omicall:omi-sdk:1.2.27'
100
100
 
101
101
  implementation 'androidx.core:core-ktx:1.7.0'
102
102
  implementation 'androidx.fragment:fragment-ktx:1.4.0'
@@ -2,10 +2,8 @@ package com.omikitplugin
2
2
 
3
3
  import android.Manifest
4
4
  import android.app.Activity
5
- import android.content.Context
6
5
  import android.content.Intent
7
6
  import android.content.pm.PackageManager
8
- import android.hardware.camera2.CameraManager
9
7
  import android.os.Build
10
8
  import android.os.Handler
11
9
  import android.os.Looper
@@ -127,17 +125,13 @@ class OmikitPluginModule(reactContext: ReactApplicationContext?) :
127
125
  override fun initialize() {
128
126
  super.initialize()
129
127
  reactApplicationContext!!.addActivityEventListener(this)
128
+ OmiClient(context = reactApplicationContext!!)
129
+ OmiClient.instance.setListener(callListener)
130
130
  }
131
131
 
132
132
  @ReactMethod
133
133
  fun startServices(promise: Promise) {
134
- OmiClient(context = reactApplicationContext!!)
135
- OmiClient.instance.setListener(callListener)
136
134
  OmiClient.instance.addAccountListener(accountListener)
137
- val needSetupVideo = OmiClient.instance.needSetupCamera()
138
- if (needSetupVideo) {
139
- setCamera()
140
- }
141
135
  promise.resolve(true)
142
136
  }
143
137
 
@@ -152,6 +146,7 @@ class OmikitPluginModule(reactContext: ReactApplicationContext?) :
152
146
  val prefixMissedCallMessage = data.getString("prefixMissedCallMessage")
153
147
  val backImage = data.getString("backImage")
154
148
  val userImage = data.getString("userImage")
149
+ val userNameKey = data.getString("userNameKey")
155
150
  OmiClient.instance.configPushNotification(
156
151
  notificationIcon = notificationIcon ?: "",
157
152
  prefix = prefix ?: "Cuộc gọi tới từ: ",
@@ -161,7 +156,8 @@ class OmikitPluginModule(reactContext: ReactApplicationContext?) :
161
156
  backImage = backImage ?: "ic_back",
162
157
  userImage = userImage ?: "calling_face",
163
158
  prefixMissedCallMessage = prefixMissedCallMessage ?: "Cuộc gọi nhỡ từ",
164
- missedCallTitle = prefixMissedCallMessage ?: "Cuộc gọi nhỡ"
159
+ missedCallTitle = prefixMissedCallMessage ?: "Cuộc gọi nhỡ",
160
+ userNameKey = userNameKey ?: "extension",
165
161
  )
166
162
  promise.resolve(true)
167
163
  }
@@ -185,9 +181,6 @@ class OmikitPluginModule(reactContext: ReactApplicationContext?) :
185
181
  )
186
182
  }
187
183
  requestPermission(isVideo)
188
- if (isVideo) {
189
- setCamera()
190
- }
191
184
  promise.resolve(true)
192
185
  }
193
186
  }
@@ -215,9 +208,6 @@ class OmikitPluginModule(reactContext: ReactApplicationContext?) :
215
208
  }
216
209
  }
217
210
  requestPermission(isVideo)
218
- if (isVideo) {
219
- setCamera()
220
- }
221
211
  promise.resolve(loginResult)
222
212
  }
223
213
  }
@@ -545,12 +535,6 @@ class OmikitPluginModule(reactContext: ReactApplicationContext?) :
545
535
  )
546
536
  }
547
537
 
548
- private fun setCamera() {
549
- val cm =
550
- reactApplicationContext!!.getSystemService(Context.CAMERA_SERVICE) as CameraManager
551
- OmiClient.instance.setCameraManager(cm)
552
- }
553
-
554
538
  override fun onActivityResult(p0: Activity?, p1: Int, p2: Int, p3: Intent?) {
555
539
 
556
540
  }
@@ -99,10 +99,15 @@ class CallManager {
99
99
  }
100
100
 
101
101
  func configNotification(data: [String: Any]) {
102
+ let user = UserDefaults.standard
103
+ if let prefix = data["prefix"] as? String, let userNameKey = data["userNameKey"] as? String {
104
+ user.set(prefix, forKey: KEY_OMI_PREFIX)
105
+ user.set(userNameKey, forKey: KEY_OMI_USER_NAME_KEY)
106
+ }
102
107
  if let title = data["missedCallTitle"] as? String, let message = data["prefixMissedCallMessage"] as? String {
103
108
  let user = UserDefaults.standard
104
- user.set(title, forKey: "missedCallTitle")
105
- user.set(message, forKey: "prefixMissedCallMessage")
109
+ user.set(title, forKey: "omicall/missedCallTitle")
110
+ user.set(message, forKey: "omicall/prefixMissedCallMessage")
106
111
  }
107
112
  }
108
113
 
@@ -114,8 +119,8 @@ class CallManager {
114
119
  break
115
120
  case .authorized, .provisional:
116
121
  let user = UserDefaults.standard
117
- let title = user.string(forKey: "missedCallTitle") ?? ""
118
- let message = user.string(forKey: "prefixMissedCallMessage") ?? ""
122
+ let title = user.string(forKey: "omicall/missedCallTitle") ?? ""
123
+ let message = user.string(forKey: "omicall/prefixMissedCallMessage") ?? ""
119
124
  let content = UNMutableNotificationContent()
120
125
  content.title = title
121
126
  content.body = "\(message) \(call.callerNumber!)"
@@ -32,5 +32,5 @@ Pod::Spec.new do |s|
32
32
  s.dependency "RCTTypeSafety"
33
33
  s.dependency "ReactCommon/turbomodule/core"
34
34
  end
35
- s.dependency "OmiKit", '1.5.31'
35
+ s.dependency "OmiKit", '1.5.32'
36
36
  end
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "omikit-plugin",
3
- "version": "2.3.0",
3
+ "version": "2.3.2",
4
4
  "description": "Omikit Plugin by ViHAT",
5
5
  "main": "lib/commonjs/index",
6
6
  "module": "lib/module/index",