Skip to content

Commit

Permalink
Fix on crash when device_token is null
Browse files Browse the repository at this point in the history
  • Loading branch information
lorenzoPrimi committed Aug 16, 2017
1 parent 066a4c7 commit 47565c3
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 7 deletions.
2 changes: 0 additions & 2 deletions ooniprobe/AppDelegate.mm
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,6 @@ - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(
CrashlyticsKit.delegate = self;
[Fabric with:@[[Crashlytics class]]];
[[UIApplication sharedApplication] setStatusBarStyle:UIStatusBarStyleLightContent];

[NotificationService sharedNotificationService];

[self registerNotifications];

Expand Down
4 changes: 2 additions & 2 deletions ooniprobe/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,11 @@
<key>CFBundlePackageType</key>
<string>APPL</string>
<key>CFBundleShortVersionString</key>
<string>1.1.5</string>
<string>1.1.6</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleVersion</key>
<string>14</string>
<string>15</string>
<key>Fabric</key>
<dict>
<key>APIKey</key>
Expand Down
1 change: 1 addition & 0 deletions ooniprobe/Utility/NotificationService.mm
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ -(id)init


- (void)registerNotifications{
if (device_token == nil) return;

std::vector<std::string> supported_tests_list;
for (NSString *s in supported_tests) {
Expand Down
7 changes: 4 additions & 3 deletions ooniprobe/Utility/ReachabilityManager.mm
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,10 @@ - (id)init {

- (void)reachabilityDidChange:(NSNotification *)notification {
NSString *network_type = [self getStatus];
[[NotificationService sharedNotificationService] setNetwork_type:network_type];
[[NotificationService sharedNotificationService] registerNotifications];
if (![network_type isEqualToString:@"no_internet"]){
[[NotificationService sharedNotificationService] setNetwork_type:network_type];
[[NotificationService sharedNotificationService] registerNotifications];
}
}

- (NSString*)getStatus{
Expand All @@ -56,7 +58,6 @@ - (NSString*)getStatus{
network_type = @"mobile";
else if(status == NotReachable)
network_type = @"no_internet";
NSLog(@"network_type %@", network_type);
return network_type;
}

Expand Down

0 comments on commit 47565c3

Please sign in to comment.