• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

realm / realm-js / 7681391482

27 Jan 2024 10:00PM UTC coverage: 85.346%. Remained the same
7681391482

Pull #6431

github

web-flow
Update source-map-loader to version 5.0.0
Pull Request #6431: Update source-map-loader 4.0.2 → 5.0.0 (major)

942 of 1164 branches covered (0.0%)

Branch coverage included in aggregate %.

2372 of 2719 relevant lines covered (87.24%)

1015.64 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

0.0
/packages/realm/src/platform/react-native/device-info.ts
1
////////////////////////////////////////////////////////////////////////////
2
//
3
// Copyright 2023 Realm Inc.
4
//
5
// Licensed under the Apache License, Version 2.0 (the "License");
6
// you may not use this file except in compliance with the License.
7
// You may obtain a copy of the License at
8
//
9
// http://www.apache.org/licenses/LICENSE-2.0
10
//
11
// Unless required by applicable law or agreed to in writing, software
12
// distributed under the License is distributed on an "AS IS" BASIS,
13
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
// See the License for the specific language governing permissions and
15
// limitations under the License.
16
//
17
////////////////////////////////////////////////////////////////////////////
18

19
import { Platform } from "react-native";
20

21
import { config, version } from "realm/package.json";
22

23
import { inject } from "../device-info";
24
import { JsPlatformHelpers } from "../../binding";
25

26
function getDeviceName() {
27
  if (Platform.OS === "ios") {
×
28
    if (Platform.isPad) {
×
29
      return "iPad";
×
30
    } else if (Platform.isTV) {
×
31
      return "AppleTV";
×
32
    } else {
33
      // RN doesn't support Apple Watch
34
      return "iPhone";
×
35
    }
36
  } else if (Platform.OS === "android") {
×
37
    return `${Platform.constants.Manufacturer}:${Platform.constants.Brand}`;
×
38
  } else {
39
    return "unknown";
×
40
  }
41
}
42

43
function getDeviceVersion() {
44
  if (Platform.OS === "android") {
×
45
    return `${Platform.constants.Model}`;
×
46
  } else {
47
    return "unknown";
×
48
  }
49
}
50

51
function getReactNativeVersion() {
52
  const { major, minor, patch, prerelease } = Platform.constants.reactNativeVersion;
×
53
  const result = [major, minor, patch].join(".");
×
54
  if (prerelease) {
×
55
    return result + "-" + prerelease;
×
56
  } else {
57
    return result;
×
58
  }
59
}
60

61
inject({
×
62
  create() {
63
    return {
×
64
      sdk: "JS",
65
      sdkVersion: version,
66

67
      platform: Platform.OS,
68
      // Android reports a number ...
69
      platformVersion: `${Platform.Version}`,
70

71
      deviceName: getDeviceName(),
72
      deviceVersion: getDeviceVersion(),
73

74
      cpuArch: JsPlatformHelpers.getCpuArch(),
75

76
      frameworkName: "react-native",
77
      frameworkVersion: getReactNativeVersion(),
78

79
      bundleId: config?.anonymizedBundleId || "unknown",
×
80
    };
81
  },
82
});
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2025 Coveralls, Inc