Skip to content

Commit

Permalink
Remove test files i os (#97)
Browse files Browse the repository at this point in the history
* Credits, packages and bundle ID’s update to MOH
readme and podSpects ID's changed to MOH
test methods and test DB models store wrapped with if DEBUG
fixed bug that prevented turning off the BLE service after starting first time.

* Set notification icon to be ic_launcher

Co-authored-by: Yonatan Rimon MacbookPro <[email protected]>
  • Loading branch information
edwardigates and rimony authored Aug 3, 2020
1 parent 8a3f96e commit fa6bd77
Show file tree
Hide file tree
Showing 9 changed files with 51 additions and 41 deletions.
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
The MIT License (MIT)

Copyright (c) 2015 Wix.com
Copyright (c) 2020 MOH

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<p align="center">
<a href="https://www.npmjs.com/package/rn-contact-tracing"><img src="https://img.shields.io/npm/v/rn-contact-tracing" alt="NPM version"></a>
<a href="/LICENSE"><img src="https://img.shields.io/npm/l/rn-contact-tracing" alt="License"></a>
<a href="https://github.com/wix-incubator/rn-contact-tracing/actions?query=workflow%3ACI"><img src="https://github.com/wix-incubator/rn-contact-tracing/workflows/CI/badge.svg?style=flat-square" alt="CI"></a>
<a href="https://github.com/MohGovIL/rn-contact-tracing/actions?query=workflow%3ACI"><img src="https://github.com/MohGovIL/rn-contact-tracing/workflows/CI/badge.svg?style=flat-square" alt="CI"></a>
</p>

---
Expand Down Expand Up @@ -99,7 +99,7 @@ dependencies {
On top, where imports are:

```java
import com.wix.specialble.SpecialBlePackage;
import moh.gov.il.specialble.SpecialBlePackage;
```

Add the `RNLocationPackage` class to your list of exported packages.
Expand Down
2 changes: 1 addition & 1 deletion example/ios/Podfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -492,7 +492,7 @@ SPEC CHECKSUMS:
React-RCTVibration: a49a1f42bf8f5acf1c3e297097517c6b3af377ad
ReactCommon: 198c7c8d3591f975e5431bec1b0b3b581aa1c5dd
ReactNativeUiLib: 9883f80a22b855d4a866ceee433d1e24b1014a2a
rn-contact-tracing: fe147c2be110646d1aa401e15c0065ad1bc25fd8
rn-contact-tracing: 1763fde360c27068877fd9f2dcb23c38e6821f47
RNCMaskedView: 5dba3cb07493765fb66156c83c3dd281ca709a48
RNDateTimePicker: 0f657a34a0f6465ab7d0255c24954693bc7a8cf6
RNFBApp: 7b539bb25520fa73d6a240f5c6ea569e27683645
Expand Down
2 changes: 0 additions & 2 deletions lib/android/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -108,8 +108,6 @@ def configureReactNativePom(def pom) {

developers {
developer {
id packageJson.author.username
name packageJson.author.name
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -175,33 +175,36 @@ public int onStartCommand(Intent intent, int flags, int startId) {
// Small icon comes from the field notificationSmallIconPath.
//
////////////////////////////////////////////////////////////////////////////
int resId = 0;
if (config.getSmallNotificationIconPath() != null && config.getSmallNotificationIconPath().length() > 0) {
try {
resId = getResources().getIdentifier(config.getSmallNotificationIconPath(), "drawable", "com.rncontacttracing.demo");
} catch (Throwable throwable) {
throwable.printStackTrace();
}
}
Bitmap bitmap = null;
if (config.getLargeNotificationIconPath() != null && config.getLargeNotificationIconPath().length() > 0) {

try {
InputStream ims = getAssets().open(config.getLargeNotificationIconPath());
bitmap = BitmapFactory.decodeStream(ims);
} catch (IOException e) {
e.printStackTrace();
}
}

// int resId = R.mipmap.ic_launcher;
// if (config.getSmallNotificationIconPath() != null && config.getSmallNotificationIconPath().length() > 0) {
// try {
// resId = getResources().getIdentifier(config.getSmallNotificationIconPath(), "drawable", getPackageName());
// } catch (Throwable throwable) {
// throwable.printStackTrace();
// }
// }
// Bitmap bitmap = null;
// if (config.getLargeNotificationIconPath() != null && config.getLargeNotificationIconPath().length() > 0) {
//
// try {
// InputStream ims = getAssets().open(config.getLargeNotificationIconPath());
// bitmap = BitmapFactory.decodeStream(ims);
// } catch (IOException e) {
// e.printStackTrace();
// }
// }

NotificationCompat.Builder notificationBuilder = new NotificationCompat.Builder(this, CHANNEL_ID)
.setContentTitle(config.getNotificationTitle())
.setContentText(config.getNotificationContent())
.setSmallIcon(resId)
.setSmallIcon(R.mipmap.ic_launcher)
.setContentIntent(mainActivityIntent);
if (bitmap != null) {
notificationBuilder.setLargeIcon(bitmap);
}

notificationBuilder.setLargeIcon(BitmapFactory.decodeResource(getApplicationContext().getResources(),
R.mipmap.ic_launcher));
// if (bitmap != null) {
// }
Notification notification = notificationBuilder.build();

startForeground(1, notification);
Expand Down
7 changes: 6 additions & 1 deletion lib/ios/SpecialBleManager.m
Original file line number Diff line number Diff line change
Expand Up @@ -137,15 +137,16 @@ - (void)startBLEServicesWithEventEmitter:(RCTEventEmitter*)emitter

- (void)stopBLEServicesWithEmitter:(RCTEventEmitter*)emitter
{
[[NSNotificationCenter defaultCenter] postNotificationName:@"BLE_Stoped" object:nil];
self.advertisingIsOn = NO;
self.scanningIsOn = NO;
[self stopScan:emitter];
}

- (void)internalStopBLEServices
{
[self stopScan:self.eventEmitter];
[[NSNotificationCenter defaultCenter] postNotificationName:@"BLE_Stoped" object:nil];
[self stopScan:self.eventEmitter];
}

- (void)internalStartBLEServices
Expand Down Expand Up @@ -320,6 +321,7 @@ - (void)centralManager:(CBCentralManager *)central

[DBClient addContactWithAsciiEphemeral:public_key :[RSSI integerValue] :(int)unixtime :geo :lat :lon];

#ifdef DEBUG
// get current device from DB
NSArray* devicesArray = [DBClient getDeviceByKey:public_key];

Expand Down Expand Up @@ -366,6 +368,7 @@ - (void)centralManager:(CBCentralManager *)central

// send foundScan event
[self.eventEmitter sendEventWithName:EVENTS_FOUND_SCAN body:scan];
#endif
}

#pragma mark - Match API methods
Expand Down Expand Up @@ -424,6 +427,7 @@ -(NSString*)findMatchForInfections:(NSString*)jsonString

- (void) writeContactsDB:(NSString*)jsonString
{
#ifdef DEBUG
NSData *data;
if (jsonString.length > 0)
{
Expand Down Expand Up @@ -461,6 +465,7 @@ - (void) writeContactsDB:(NSString*)jsonString
{
NSLog(@"cannot parse json DB file: %@", error);
}
#endif
}

@end
2 changes: 1 addition & 1 deletion lib/ios/db/DBContactManager.swift
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ class DBContactManager {
do {
try managedContext.execute(batchDeleteRequest)
} catch let error as NSError {
print("Detele contact error :", error)
print("Delete contact error :", error)
}
}

Expand Down
15 changes: 8 additions & 7 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,17 +5,18 @@
"description": "React Native Library For Contact Tracing Over BLE (Bluetooth Low Energy) To Fight COVID-19 Pandemic",
"repository": {
"type": "git",
"url": "https://github.com/wix-incubator/rn-contact-tracing.git"
"url": "https://github.com/MohGovIL/rn-contact-tracing.git"
},
"main": "lib/src/index.js",
"contributors": [
"Lev Vidrak <[email protected]>",
"Ran Greenberg <[email protected]>"
"Ministry Of Health"
],
"authors": [
"Ofer Davidyan",
"Yonatan Rimon",
"Hagai Rotshild",
"Lev Vidrak"
],
"author": {
"name": "Lev",
"email": "[email protected]"
},
"keywords": [
"react-native",
"COVID-19",
Expand Down
11 changes: 7 additions & 4 deletions rn-contact-tracing.podspec
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,18 @@ Pod::Spec.new do |s|
s.description = <<-DESC
rn-contact-tracing
DESC
s.homepage = "https://github.com/github_account/rn-contact-tracing"
s.homepage = "https://github.com/MohGovIL/rn-contact-tracing"
# brief license entry:
s.license = "MIT"
# optional - use expanded license entry instead:
# s.license = { :type => "MIT", :file => "LICENSE" }
s.authors = { "Lev" => "[email protected]" }
s.authors = { "Ofer Davidyan" => "[email protected]",
"Yonatan Rimon" => "[email protected]",
"Hagai Rotshild" => "[email protected]",
"Lev" => "[email protected]"
}
s.platforms = { :ios => "10.0" }
s.source = { :git => "https://github.com/wix-incubator/rn-contact-tracing.git", :tag => "#{s.version}" }
s.source = { :git => "https://github.com/MohGovIL/rn-contact-tracing.git", :tag => "#{s.version}" }

s.source_files = "lib/ios/**/*.{h,m,swift}"
s.resources = 'rn-contact-tracing/*.xcdatamodel'
Expand All @@ -27,4 +31,3 @@ Pod::Spec.new do |s|
# ...
# s.dependency "..."
end

0 comments on commit fa6bd77

Please sign in to comment.