From fa6bd775327713d1214d67fe9a961cab7abcd7ca Mon Sep 17 00:00:00 2001 From: edwardigates <56969762+edwardigates@users.noreply.github.com> Date: Mon, 3 Aug 2020 15:21:40 +0300 Subject: [PATCH] Remove test files i os (#97) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * 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 --- LICENSE | 2 +- README.md | 4 +- example/ios/Podfile.lock | 2 +- lib/android/build.gradle | 2 - .../il/specialble/BLEForegroundService.java | 47 ++++++++++--------- lib/ios/SpecialBleManager.m | 7 ++- lib/ios/db/DBContactManager.swift | 2 +- package.json | 15 +++--- rn-contact-tracing.podspec | 11 +++-- 9 files changed, 51 insertions(+), 41 deletions(-) diff --git a/LICENSE b/LICENSE index a903e9b..6c00454 100644 --- a/LICENSE +++ b/LICENSE @@ -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 diff --git a/README.md b/README.md index cdb9baa..8bb6aa2 100644 --- a/README.md +++ b/README.md @@ -6,7 +6,7 @@

NPM version License - CI + CI

--- @@ -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. diff --git a/example/ios/Podfile.lock b/example/ios/Podfile.lock index 2c8c175..3d31074 100644 --- a/example/ios/Podfile.lock +++ b/example/ios/Podfile.lock @@ -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 diff --git a/lib/android/build.gradle b/lib/android/build.gradle index 43b648a..287a809 100644 --- a/lib/android/build.gradle +++ b/lib/android/build.gradle @@ -108,8 +108,6 @@ def configureReactNativePom(def pom) { developers { developer { - id packageJson.author.username - name packageJson.author.name } } } diff --git a/lib/android/src/main/java/moh/gov/il/specialble/BLEForegroundService.java b/lib/android/src/main/java/moh/gov/il/specialble/BLEForegroundService.java index 8f86959..4d92b39 100644 --- a/lib/android/src/main/java/moh/gov/il/specialble/BLEForegroundService.java +++ b/lib/android/src/main/java/moh/gov/il/specialble/BLEForegroundService.java @@ -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); diff --git a/lib/ios/SpecialBleManager.m b/lib/ios/SpecialBleManager.m index dc24afa..e224515 100644 --- a/lib/ios/SpecialBleManager.m +++ b/lib/ios/SpecialBleManager.m @@ -137,6 +137,7 @@ - (void)startBLEServicesWithEventEmitter:(RCTEventEmitter*)emitter - (void)stopBLEServicesWithEmitter:(RCTEventEmitter*)emitter { + [[NSNotificationCenter defaultCenter] postNotificationName:@"BLE_Stoped" object:nil]; self.advertisingIsOn = NO; self.scanningIsOn = NO; [self stopScan:emitter]; @@ -144,8 +145,8 @@ - (void)stopBLEServicesWithEmitter:(RCTEventEmitter*)emitter - (void)internalStopBLEServices { - [self stopScan:self.eventEmitter]; [[NSNotificationCenter defaultCenter] postNotificationName:@"BLE_Stoped" object:nil]; + [self stopScan:self.eventEmitter]; } - (void)internalStartBLEServices @@ -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]; @@ -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 @@ -424,6 +427,7 @@ -(NSString*)findMatchForInfections:(NSString*)jsonString - (void) writeContactsDB:(NSString*)jsonString { +#ifdef DEBUG NSData *data; if (jsonString.length > 0) { @@ -461,6 +465,7 @@ - (void) writeContactsDB:(NSString*)jsonString { NSLog(@"cannot parse json DB file: %@", error); } +#endif } @end diff --git a/lib/ios/db/DBContactManager.swift b/lib/ios/db/DBContactManager.swift index 3d6add6..b352837 100644 --- a/lib/ios/db/DBContactManager.swift +++ b/lib/ios/db/DBContactManager.swift @@ -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) } } diff --git a/package.json b/package.json index 832f243..16a3af3 100644 --- a/package.json +++ b/package.json @@ -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 ", - "Ran Greenberg " + "Ministry Of Health" + ], + "authors": [ + "Ofer Davidyan", + "Yonatan Rimon", + "Hagai Rotshild", + "Lev Vidrak" ], - "author": { - "name": "Lev", - "email": "lev.vidrak@gmail.com" - }, "keywords": [ "react-native", "COVID-19", diff --git a/rn-contact-tracing.podspec b/rn-contact-tracing.podspec index b904cb6..fc1e809 100644 --- a/rn-contact-tracing.podspec +++ b/rn-contact-tracing.podspec @@ -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" => "lev.vidrak@gmail.com" } + s.authors = { "Ofer Davidyan" => "ofer@igates.co.il", + "Yonatan Rimon" => "yoni.rimon@igates.co.il", + "Hagai Rotshild" => "hagai.rotshild@igates.co.il", + "Lev" => "lev.vidrak@gmail.com" + } 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' @@ -27,4 +31,3 @@ Pod::Spec.new do |s| # ... # s.dependency "..." end -