Skip to content

Commit

Permalink
remove unnecessary weakself
Browse files Browse the repository at this point in the history
  • Loading branch information
ulukaya committed Nov 16, 2017
1 parent 22abbf7 commit e0d31f4
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 14 deletions.
12 changes: 2 additions & 10 deletions invites/InvitesExample/AppDelegate.m
Original file line number Diff line number Diff line change
Expand Up @@ -48,17 +48,13 @@ - (BOOL)application:(UIApplication *)application
annotation:annotation]) {
return YES;
}
// [START_EXCLUDE silent]
__weak AppDelegate *weakSelf = self;
// [END_EXCLUDE]
// Handle App Invite requests
return [FIRInvites handleUniversalLink:url
completion:^(FIRReceivedInvite * _Nullable receivedInvite,
NSError * _Nullable error) {
// [START_EXCLUDE]
if (receivedInvite) {
AppDelegate *strongSelf = weakSelf;
[strongSelf showAlertViewWithInvite:receivedInvite];
[self showAlertViewWithInvite:receivedInvite];
}
// [END_EXCLUDE]
}];
Expand All @@ -69,17 +65,13 @@ - (BOOL)application:(UIApplication *)application
- (BOOL)application:(UIApplication *)application
continueUserActivity:(NSUserActivity *)userActivity
restorationHandler:(void (^)(NSArray *))restorationHandler {
// [START_EXCLUDE silent]
__weak AppDelegate *weakSelf = self;
// [END_EXCLUDE]
// Handle App Invite requests
return [FIRInvites handleUniversalLink:userActivity.webpageURL
completion:^(FIRReceivedInvite * _Nullable receivedInvite,
NSError * _Nullable error) {
// [START_EXCLUDE]
if (receivedInvite) {
AppDelegate *strongSelf = weakSelf;
[strongSelf showAlertViewWithInvite:receivedInvite];
[self showAlertViewWithInvite:receivedInvite];
}
// [END_EXCLUDE]
}];
Expand Down
8 changes: 4 additions & 4 deletions invites/InvitesExampleSwift/AppDelegate.swift
Original file line number Diff line number Diff line change
Expand Up @@ -43,14 +43,14 @@ class AppDelegate: UIResponder, UIApplicationDelegate {
return true
}

return Invites.handleUniversalLink(url) { [weak self] invite, error in
return Invites.handleUniversalLink(url) { invite, error in
// [START_EXCLUDE]
if let error = error {
print(error.localizedDescription)
return
}
if let invite = invite {
self?.showAlertView(withInvite: invite)
self.showAlertView(withInvite: invite)
}
// [END_EXCLUDE]
}
Expand All @@ -60,14 +60,14 @@ class AppDelegate: UIResponder, UIApplicationDelegate {
// [START continueuseractivity]
@available(iOS 8.0, *)
func application(_ application: UIApplication, continue userActivity: NSUserActivity, restorationHandler: @escaping ([Any]?) -> Void) -> Bool {
return Invites.handleUniversalLink(userActivity.webpageURL!) { [weak self] invite, error in
return Invites.handleUniversalLink(userActivity.webpageURL!) { invite, error in
// [START_EXCLUDE]
if let error = error {
print(error.localizedDescription)
return
}
if let invite = invite {
self?.showAlertView(withInvite: invite)
self.showAlertView(withInvite: invite)
}
// [END_EXCLUDE]
}
Expand Down

0 comments on commit e0d31f4

Please sign in to comment.