myGro插件初始化参数
<h3>初始化便携电源模块需要传的参数</h3>
<ul>
<li>在创建<code>RCTRootView</code>或者创建<code>RCTBridge</code>是时候,便携电源模块需要传一些初始化参数。</li>
</ul>
<h3>所参参数字段</h3>
<ul>
<li><code>&quot;nickName&quot;</code>: 设备别名</li>
<li><code>&quot;deviceSN&quot;</code>: 设备SN</li>
<li><code>&quot;isBleConn&quot;</code>: 当前是否是蓝牙连接</li>
<li><code>&quot;online&quot;</code>: 设备是否在线</li>
<li><code>&quot;roleId&quot;</code>: 当前用户角色</li>
<li><code>&quot;sharingId&quot;</code>: 如果设备是共享设备,共享ID</li>
<li><code>&quot;UserId&quot;</code>: 用户id</li>
</ul>
<h3>使用示例</h3>
<p>iOS创建<code>RCTRootView</code>:</p>
<pre><code>let username = MGAuthenticator.share.currentUser.uid
let authToken = MGAuthenticator.share.currentCpowerAuthToken?.tokenString ?? &quot;&quot;
let mockData:NSDictionary = [&quot;nickName&quot;: nickName,
&quot;deviceSN&quot;: deviceSN,
&quot;isBleConn&quot;: isBleConn,
&quot;online&quot;: isOnline ? 1 : 0,
&quot;roleId&quot;: &quot;&quot;,
&quot;sharingId&quot;: &quot;&quot;,
&quot;UserId&quot;: &quot;&quot;]
let rootView = RCTRootView(
bundleURL: jsBundleLocation,
moduleName: &quot;myGroPlugin&quot;,
initialProperties: mockData as [NSObject : AnyObject],
launchOptions: nil
)
let vc = MGRNDeviceRootVC()
vc.view = rootView</code></pre>
<p>Andriod创建<code>RCTRootView</code>:</p>
<pre><code>final Bundle initialProperties = new Bundle();
initialProperties.putString(&quot;nickName&quot;, mNickName);
initialProperties.putString(&quot;deviceSN&quot;, mDeviceSN);
initialProperties.putBoolean(&quot;isBleConn&quot;, mIsBleConn);
initialProperties.putInt(&quot;online&quot;, mOnline);
initialProperties.putInt(&quot;roleId&quot;, mRoleId);
initialProperties.putInt(&quot;sharingId&quot;, mSharingId);
initialProperties.putString(&quot;UserId&quot;, AppPrefsUtils.getAccountName());
</code></pre>